All files / js/levels Tou-strt.js

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

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 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 1481x 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 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  
/**
 * Tou-strt - NetHack special level
 * Converted from: Tou-strt.lua
 */
 
import * as des from '../sp_lev.js';
import { selection } from '../sp_lev.js';
 
export async function generate() {
    // NetHack Tourist Tou-strt.lua	$NHDT-Date: 1652196016 2022/5/10 15:20:16 $  $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.3 $
    // Copyright (c) 1989 by Jean-Christophe Collet
    // Copyright (c) 1991,92 by M. Stephenson, P. Winner
    // NetHack may be freely redistributed.  See license for details.
    // 
    // 
    // The "start" level for the quest.
    // 
    // Here you meet your (besieged) class leader, Twoflower
    // and receive your quest assignment.
    // 
    des.level_init({ style: "solidfill", fg: " " });
 
    des.level_flags("mazelevel", "noteleport", "hardfloor");
    await des.map(`\
.......}}....---------..-------------------------------------------------...
........}}...|.......|..|.-------------------------------------------...|...
.........}}..|.......|..|.|......|......|.............|......|......|...|...
..........}}.|.......|..|.|......+......+.............+......+..\\...|...|...
...........}}}..........|.|......|......|.............|......|......|...|...
.............}}.........|.|----S-|--S---|S----------S-|---S--|------|...|...
..............}}}.......|...............................................|...
................}}}.....----S------++--S----------S----------S-----------...
..................}}...........    ..    ...................................
......-------......}}}}........}}}}..}}}}..}}}}..}}}}.......................
......|.....|.......}}}}}}..}}}}   ..   }}}}..}}}}..}}}.....................
......|.....+...........}}}}}}........................}}}..}}}}..}}}..}}}...
......|.....|...........................................}}}}..}}}..}}}}.}}}}
......-------...............................................................
............................................................................
...-------......-------.....................................................
...|.....|......|.....|.....................................................
...|.....+......+.....|.....................................................
...|.....|......|.....|.....................................................
...-------......-------.....................................................
`);
    // Dungeon Description
    await des.region(selection.area(0,0,75,19), "lit");
    await des.region({ region: [14,1, 20,3], lit: 0, type: "morgue", filled: 1 });
    await des.region(selection.area(7,10,11,12), "unlit");
    await des.region(selection.area(4,16,8,18), "unlit");
    await des.region(selection.area(17,16,21,18), "unlit");
    await des.region(selection.area(27,2,32,4), "unlit");
    await des.region(selection.area(34,2,39,4), "unlit");
    await des.region(selection.area(41,2,53,4), "unlit");
    await des.region(selection.area(55,2,60,4), "unlit");
    await des.region(selection.area(62,2,67,4), "lit");
    // Stairs
    des.stair("down", 66,3);
    // Portal arrival point
    des.levregion({ region: [68,14,68,14], type: "branch" });
    // Non diggable walls
    des.non_diggable(selection.area(0,0,75,19));
    // Doors
    des.door("locked",31,5);
    des.door("locked",36,5);
    des.door("locked",41,5);
    des.door("locked",52,5);
    des.door("locked",58,5);
    des.door("locked",28,7);
    des.door("locked",39,7);
    des.door("locked",50,7);
    des.door("locked",61,7);
    des.door("closed",33,3);
    des.door("closed",40,3);
    des.door("closed",54,3);
    des.door("closed",61,3);
    des.door("open",12,11);
    des.door("open",9,17);
    des.door("open",16,17);
    des.door("locked",35,7);
    des.door("locked",36,7);
    // Monsters on siege duty.
    await des.monster("giant spider");
    await des.monster("giant spider");
    await des.monster("giant spider");
    await des.monster("giant spider");
    await des.monster("giant spider");
    await des.monster("giant spider");
    await des.monster("giant spider");
    await des.monster("giant spider");
    await des.monster("giant spider");
    await des.monster("giant spider");
    await des.monster("giant spider");
    await des.monster("giant spider");
    await des.monster("s");
    await des.monster("s");
    await des.monster("forest centaur");
    await des.monster("forest centaur");
    await des.monster("forest centaur");
    await des.monster("forest centaur");
    await des.monster("forest centaur");
    await des.monster("forest centaur");
    await des.monster("forest centaur");
    await des.monster("forest centaur");
    await des.monster("C");
    // Twoflower
    await des.monster({ id: "Twoflower", coord: [64, 3], inventory: async function() {
       await des.object({ id: "walking shoes", spe: 3 });
       await des.object({ id: "hawaiian shirt", spe: 3 });
    } })
    // The treasure of Twoflower
    await des.object("chest", 64, 3);
    // guides for the audience chamber
    await des.monster("guide", 29, 3);
    await des.monster("guide", 32, 4);
    await des.monster("guide", 35, 2);
    await des.monster("guide", 38, 3);
    await des.monster("guide", 45, 3);
    await des.monster("guide", 48, 2);
    await des.monster("guide", 49, 4);
    await des.monster("guide", 51, 3);
    await des.monster("guide", 57, 3);
    await des.monster("guide", 62, 4);
    await des.monster("guide", 66, 4);
    // path guards
    await des.monster("watchman", 35, 8);
    await des.monster("watchman", 36, 8);
    // river monsters
    await des.monster("giant eel", 62, 12);
    await des.monster("piranha", 47, 10);
    await des.monster("piranha", 29, 11);
    await des.monster("kraken", 34, 9);
    await des.monster("kraken", 37, 9);
    // Random traps
    await des.trap();
    await des.trap();
    await des.trap();
    await des.trap();
    await des.trap();
    await des.trap();
    await des.trap();
    await des.trap();
    await des.trap();
 
 
    return des.finalize_level();
}