All files / js/levels Mon-strt.js

100% Statements 121/121
100% Branches 6/6
100% Functions 2/2
100% Lines 121/121

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 1221x 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 2x 2x 1x 1x 1x 1x 1x 1x 8x 8x 1x 4x 4x 1x 1x 1x 1x 1x 1x 1x 1x 1x  
/**
 * Mon-strt - NetHack special level
 * Converted from: Mon-strt.lua
 */
 
import * as des from '../sp_lev.js';
import { selection } from '../sp_lev.js';
 
export async function generate() {
    // NetHack Monk Mon-strt.lua	$NHDT-Date: 1652196007 2022/5/10 15:20:7 $  $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.4 $
    // Copyright (c) 1989 by Jean-Christophe Collet
    // Copyright (c) 1991-2 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, the Grand Master
    // and receive your quest assignment.
    // 
    des.level_init({ style: "solidfill", fg: " " });
 
    des.level_flags("mazelevel", "noteleport", "hardfloor");
 
    await des.map(`\
............................................................................
............................................................................
............................................................................
....................------------------------------------....................
....................|................|.....|.....|.....|....................
....................|..------------..|--+-----+-----+--|....................
....................|..|..........|..|.................|....................
....................|..|..........|..|+---+---+-----+--|....................
..................---..|..........|......|...|...|.....|....................
..................+....|..........+......|...|...|.....|....................
..................+....|..........+......|...|...|.....|....................
..................---..|..........|......|...|...|.....|....................
....................|..|..........|..|+-----+---+---+--|....................
....................|..|..........|..|.................|....................
....................|..------------..|--+-----+-----+--|....................
....................|................|.....|.....|.....|....................
....................------------------------------------....................
............................................................................
............................................................................
............................................................................
`);
    // Dungeon Description
    await des.region(selection.area(0,0,75,19), "lit");
    await des.region({ region: [24,6, 33,13], lit: 1, type: "temple" });
 
    des.replace_terrain({ region: [0,0, 10,19], fromterrain: ".", toterrain: "T", chance: 10 });
    des.replace_terrain({ region: [65,0, 75,19], fromterrain: ".", toterrain: "T", chance: 10 });
 
    let spacelocs = selection.floodfill(5,4);
 
    // Portal arrival point
    des.terrain([5,4], ".");
    des.levregion({ region: [5,4,5,4], type: "branch" });
    // Stairs
    des.stair("down", 52,9);
    // Doors
    des.door("locked",18,9);
    des.door("locked",18,10);
    des.door("closed",34,9);
    des.door("closed",34,10);
    des.door("closed",40,5);
    des.door("closed",46,5);
    des.door("closed",52,5);
    des.door("locked",38,7);
    des.door("closed",42,7);
    des.door("closed",46,7);
    des.door("closed",52,7);
    des.door("locked",38,12);
    des.door("closed",44,12);
    des.door("closed",48,12);
    des.door("closed",52,12);
    des.door("closed",40,14);
    des.door("closed",46,14);
    des.door("closed",52,14);
    // Unattended Altar - unaligned due to conflict - player must align it.
    await des.altar({ x: 28,y: 9, align: "noalign", type: "altar" });
    // The Grand Master
    await des.monster({ id: "Grand Master", coord: [28, 10], inventory: async function() {
       await des.object({ id: "robe", spe: 6 });
    } })
    // No treasure chest!
    // guards for the audience chamber
    await des.monster("abbot", 32, 7);
    await des.monster("abbot", 32, 8);
    await des.monster("abbot", 32, 11);
    await des.monster("abbot", 32, 12);
    await des.monster("abbot", 33, 7);
    await des.monster("abbot", 33, 8);
    await des.monster("abbot", 33, 11);
    await des.monster("abbot", 33, 12);
    // Non diggable walls
    des.non_diggable(selection.area(18,3,55,16));
    // Random traps
    for (let i = 1, __end_i = 2; i <= __end_i; i++) {
       await des.trap("dart", spacelocs.rndcoord(1));
    }
    await des.trap();
    await des.trap();
    await des.trap();
    await des.trap();
    // Monsters on siege duty.
    for (let i = 1, __end_i = 8; i <= __end_i; i++) {
       await des.monster("earth elemental", spacelocs.rndcoord(1));
    }
    for (let i = 1, __end_i = 4; i <= __end_i; i++) {
       await des.monster("xorn", spacelocs.rndcoord(1));
    }
    // next to leader, so possibly tricky to pick up if not ready for quest yet;
    // there's no protection against a xorn eating these tins; BUC state is random
    await des.object({ id: "tin", coord: [29, 9], quantity: 2, montype: "spinach" });
    // ensure enough vegetarian food generates for vegetarian games
    await des.object({ id: "food ration", coord: [46, 4], quantity: 4});
 
 
    return des.finalize_level();
}