All files / js/levels Kni-loca.js

100% Statements 150/150
100% Branches 2/2
100% Functions 1/1
100% Lines 150/150

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 148 149 150 1511x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x  
/**
 * Kni-loca - NetHack special level
 * Converted from: Kni-loca.lua
 */
 
import * as des from '../sp_lev.js';
import { selection } from '../sp_lev.js';
 
export async function generate() {
    // NetHack Knight Kni-loca.lua	$NHDT-Date: 1652196005 2022/5/10 15:20:5 $  $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.2 $
    // Copyright (c) 1989 by Jean-Christophe Collet
    // Copyright (c) 1991,92 by M. Stephenson
    // NetHack may be freely redistributed.  See license for details.
    // 
    des.level_init({ style: "solidfill", fg: " " });
 
    des.level_flags("mazelevel", "hardfloor");
 
    des.level_init({ style: "mines", fg: ".", bg: "P", smoothed: false, joined: true, lit: 1, walled: false });
 
    await des.map(`\
xxxxxxxxx......xxxx...........xxxxxxxxxx
xxxxxxx.........xxx.............xxxxxxxx
xxxx..............................xxxxxx
xx.................................xxxxx
....................................xxxx
.......................................x
........................................
xx...................................xxx
xxxx..............................xxxxxx
xxxxxx..........................xxxxxxxx
xxxxxxxx.........xx..........xxxxxxxxxxx
xxxxxxxxx.......xxxxxx.....xxxxxxxxxxxxx
`);
    // Dungeon Description
    // The Isle of Glass is a Tor rising out of the swamps surrounding it.
    await des.region(selection.area(0,0,39,11), "lit");
    // The top area of the Tor is a holy site.
    await des.region({ region: [9,2, 27,9], lit: 1, type: "temple", filled: 2 });
    // Stairs
    des.stair("up", 38,0);
    des.stair("down", 18,5);
    // The altar atop the Tor and its attendant (creating altar makes the priest).
    await des.altar({ x: 17, y: 5, align: "neutral", type: "shrine" });
    // Objects
    await des.object();
    await des.object();
    await des.object();
    await des.object();
    await des.object();
    await des.object();
    await des.object();
    await des.object();
    await des.object();
    await des.object();
    await des.object();
    await des.object();
    await des.object();
    await des.object();
    await des.object();
    // Random traps
    // All of the avenues are guarded by magic except for the East.
    // South
    await des.trap("magic",8,11);
    await des.trap("magic",9,11);
    await des.trap("magic",10,11);
    await des.trap("magic",11,11);
    await des.trap("magic",12,11);
    await des.trap("magic",13,11);
    await des.trap("magic",14,11);
    await des.trap("magic",15,11);
    await des.trap("magic",16,11);
    await des.trap("magic",20,11);
    await des.trap("magic",21,11);
    await des.trap("magic",22,11);
    await des.trap("magic",23,11);
    await des.trap("magic",24,11);
    await des.trap("magic",25,11);
    await des.trap("magic",26,11);
    await des.trap("magic",27,11);
    await des.trap("magic",28,11);
    // West
    await des.trap("magic",0,3);
    await des.trap("magic",0,4);
    await des.trap("magic",0,5);
    await des.trap("magic",0,6);
    // North
    await des.trap("magic",6,0);
    await des.trap("magic",7,0);
    await des.trap("magic",8,0);
    await des.trap("magic",9,0);
    await des.trap("magic",10,0);
    await des.trap("magic",11,0);
    await des.trap("magic",12,0);
    await des.trap("magic",13,0);
    await des.trap("magic",14,0);
    await des.trap("magic",19,0);
    await des.trap("magic",20,0);
    await des.trap("magic",21,0);
    await des.trap("magic",22,0);
    await des.trap("magic",23,0);
    await des.trap("magic",24,0);
    await des.trap("magic",25,0);
    await des.trap("magic",26,0);
    await des.trap("magic",27,0);
    await des.trap("magic",28,0);
    await des.trap("magic",29,0);
    await des.trap("magic",30,0);
    await des.trap("magic",31,0);
    await des.trap("magic",32,0);
    // Even so, there are magic "sinkholes" around.
    await des.trap("anti magic");
    await des.trap("anti magic");
    await des.trap("anti magic");
    await des.trap("anti magic");
    await des.trap("anti magic");
    await des.trap("anti magic");
    await des.trap("anti magic");
    // Random monsters.
    await des.monster({ id: "quasit", peaceful: 0 });
    await des.monster({ id: "quasit", peaceful: 0 });
    await des.monster({ id: "quasit", peaceful: 0 });
    await des.monster({ id: "quasit", peaceful: 0 });
    await des.monster({ id: "quasit", peaceful: 0 });
    await des.monster({ id: "quasit", peaceful: 0 });
    await des.monster({ id: "quasit", peaceful: 0 });
    await des.monster({ id: "quasit", peaceful: 0 });
    await des.monster({ id: "quasit", peaceful: 0 });
    await des.monster({ id: "quasit", peaceful: 0 });
    await des.monster({ id: "quasit", peaceful: 0 });
    await des.monster({ id: "quasit", peaceful: 0 });
    await des.monster({ id: "quasit", peaceful: 0 });
    await des.monster({ id: "quasit", peaceful: 0 });
    await des.monster({ id: "quasit", peaceful: 0 });
    await des.monster({ id: "quasit", peaceful: 0 });
    await des.monster({ id: "quasit", peaceful: 0 });
    await des.monster({ class: "i", peaceful: 0 });
    await des.monster({ class: "j", peaceful: 0 });
    await des.monster({ id: "ochre jelly", peaceful: 0 });
    await des.monster({ id: "ochre jelly", peaceful: 0 });
    await des.monster({ id: "ochre jelly", peaceful: 0 });
    await des.monster({ id: "ochre jelly", peaceful: 0 });
    await des.monster({ id: "ochre jelly", peaceful: 0 });
    await des.monster({ id: "ochre jelly", peaceful: 0 });
    await des.monster({ id: "ochre jelly", peaceful: 0 });
    await des.monster({ class: "j", peaceful: 0 });
 
 
    return des.finalize_level();
}