All files / js/levels Ran-strt.js

100% Statements 114/114
100% Branches 3/3
100% Functions 2/2
100% Lines 114/114

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 1151x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x  
/**
 * Ran-strt - NetHack special level
 * Converted from: Ran-strt.lua
 */
 
import * as des from '../sp_lev.js';
import { selection } from '../sp_lev.js';
 
export async function generate() {
    // NetHack Ranger Ran-strt.lua	$NHDT-Date: 1652196011 2022/5/10 15:20:11 $  $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.2 $
    // Copyright (c) 1989 by Jean-Christophe Collet
    // Copyright (c) 1991 by M. Stephenson
    // NetHack may be freely redistributed.  See license for details.
    // 
    // 
    // The "start" level for the quest.
    // 
    // Here you meet your (besieged) class leader, Orion,
    // and receive your quest assignment.
    // 
    des.level_init({ style: "solidfill", fg: "." });
 
    des.level_flags("mazelevel", "noteleport", "hardfloor", "arboreal");
 
    des.level_init({ style: "mines", fg: ".", bg: ".", smoothed: true, joined: true, lit: 1, walled: false });
    des.replace_terrain({ region: [0,0, 76,19], fromterrain: ".", toterrain: "T", chance: 5 });
    // 1234567890123456789012345678901234567890123456789012345678901234567890
    await des.map({ halign: "left", valign: "center", map: `\
                                       xx
   ...................................  x
  ..                                 ..  
 ..  ...............F...............  .. 
 .  ..             .F.             ..  . 
 . ..  .............F.............  .. . 
 . .  ..                         ..  . . 
 . . ..  .......................  .. ... 
 . . .  ..                     ..  .     
 ... . ..  .|..................... ......
 FFF . .  ..S..................          
 ... . ..  .|.................  .... ... 
 . . .  ..                     ..  . . . 
 . . ..  .......................  .. . . 
 . .  ..                         ..  . . 
 . ..  .............F.............  .. . 
 .  ..             .F.             ..  . 
 ..  ...............F...............  .. 
  ..                                 ..  
   ...................................  x
                                       xx
` });
    // Dungeon Description
    await des.region(selection.area(0,0,40,20), "lit");
    // Stairs
    des.stair("down", 10,10);
    // Portal arrival point; just about anywhere on the right hand side of the map
    des.levregion({ region: [51,2,77,18], region_islev: 1, type: "branch" });
    // Orion
    await des.monster({ id: "Orion", coord: [20, 10], inventory: async function() {
       await des.object({ id: "leather armor", spe: 4 });
       await des.object({ id: "yumi", spe: 4 });
       await des.object({ id: "ya", spe: 4, quantity: 50 });
    } })
    // The treasure of Orion
    await des.object("chest", 20, 10);
    // Guards for the audience chamber
    await des.monster("hunter", 19, 9);
    await des.monster("hunter", 20, 9);
    await des.monster("hunter", 21, 9);
    await des.monster("hunter", 19, 10);
    await des.monster("hunter", 21, 10);
    await des.monster("hunter", 19, 11);
    await des.monster("hunter", 20, 11);
    await des.monster("hunter", 21, 11);
    // Non diggable walls
    des.non_diggable(selection.area(0,0,40,20));
    // Traps
    await des.trap("arrow",30,9);
    await des.trap("arrow",30,10);
    await des.trap("pit",40,9);
    await des.trap("spiked pit");
    await des.trap("bear");
    await des.trap("bear");
    // Monsters on siege duty.
    await des.monster({ id: "minotaur", x: 33, y: 9, peaceful: 0, asleep: 1 });
    await des.monster({ id: "forest centaur", x: 19, y: 3, peaceful: 0 });
    await des.monster({ id: "forest centaur", x: 19, y: 4, peaceful: 0 });
    await des.monster({ id: "forest centaur", x: 19, y: 5, peaceful: 0 });
    await des.monster({ id: "forest centaur", x: 21, y: 3, peaceful: 0 });
    await des.monster({ id: "forest centaur", x: 21, y: 4, peaceful: 0 });
    await des.monster({ id: "forest centaur", x: 21, y: 5, peaceful: 0 });
    await des.monster({ id: "forest centaur", x: 1, y: 9, peaceful: 0 });
    await des.monster({ id: "forest centaur", x: 2, y: 9, peaceful: 0 });
    await des.monster({ id: "forest centaur", x: 3, y: 9, peaceful: 0 });
    await des.monster({ id: "forest centaur", x: 1, y: 11, peaceful: 0 });
    await des.monster({ id: "forest centaur", x: 2, y: 11, peaceful: 0 });
    await des.monster({ id: "forest centaur", x: 3, y: 11, peaceful: 0 });
    await des.monster({ id: "forest centaur", x: 19, y: 15, peaceful: 0 });
    await des.monster({ id: "forest centaur", x: 19, y: 16, peaceful: 0 });
    await des.monster({ id: "forest centaur", x: 19, y: 17, peaceful: 0 });
    await des.monster({ id: "forest centaur", x: 21, y: 15, peaceful: 0 });
    await des.monster({ id: "forest centaur", x: 21, y: 16, peaceful: 0 });
    await des.monster({ id: "forest centaur", x: 21, y: 17, peaceful: 0 });
    await des.monster({ id: "plains centaur", peaceful: 0 });
    await des.monster({ id: "plains centaur", peaceful: 0 });
    await des.monster({ id: "plains centaur", peaceful: 0 });
    await des.monster({ id: "plains centaur", peaceful: 0 });
    await des.monster({ id: "plains centaur", peaceful: 0 });
    await des.monster({ id: "plains centaur", peaceful: 0 });
    await des.monster({ id: "scorpion", peaceful: 0 });
    await des.monster({ id: "scorpion", peaceful: 0 });
 
 
    return des.finalize_level();
}