All files / js/levels minend-3.js

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

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 1218x 8x 8x 8x 8x 8x 8x 8x 8x 8x 8x 8x 8x 8x 8x 8x 8x 8x 8x 8x 8x 8x 8x 8x 8x 8x 8x 8x 8x 8x 8x 8x 8x 8x 8x 8x 8x 8x 8x 8x 8x 8x 8x 8x 8x 8x 8x 8x 8x 8x 8x 8x 8x 8x 8x 8x 8x 8x 8x 8x 8x 8x 8x 8x 8x 8x 8x 8x 8x 8x 8x 8x 8x 8x 8x 8x 8x 8x 8x 8x 8x 8x 8x 8x 8x 8x 8x 8x 8x 8x 8x 8x 8x 8x 8x 8x 8x 8x 8x 8x 8x 8x 8x 8x 8x 8x 8x 8x 8x 8x 8x 8x 8x 8x 8x 8x 8x 8x 8x 8x  
/**
 * minend-3 - NetHack special level
 * Converted from: minend-3.lua
 */
 
import * as des from '../sp_lev.js';
import { selection, shuffle } from '../sp_lev.js';
 
export async function generate() {
    // NetHack mines minend-3.lua	$NHDT-Date: 1652196029 2022/5/10 15:20:29 $  $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.2 $
    // Copyright (c) 1989-95 by Jean-Christophe Collet
    // Copyright (c) 1991-95 by M. Stephenson
    // NetHack may be freely redistributed.  See license for details.
    // 
    // "Catacombs" by Kelly Bailey
    // Relies on some very specific behavior of MAZEWALK.
 
    des.level_init({ style: "solidfill", fg: "-" });
 
    des.level_flags("mazelevel", "nommap");
 
    await des.map({ halign: "center", valign: "bottom", map: `\
 - - - - - - - - - - -- -- - - . - - - - - - - - - -- - - -- - - - - . - - |
------...---------.-----------...-----.-------.-------     ----------------|
 - - - - - - - - - - - . - - - . - - - - - - - - - - -- - -- - . - - - - - |
------------.---------...-------------------------.---   ------------------|
 - - - - - - - - - - . . - - --- - . - - - - - - - - -- -- - - - - |.....| |
--.---------------.......------------------------------- ----------|.....S-|
 - - - - |.. ..| - ....... . - - - - |.........| - - - --- - - - - |.....| |
----.----|.....|------.......--------|.........|--------------.------------|
 - - - - |..{..| - - -.... . --- - -.S.........S - - - - - - - - - - - - - |
---------|.....|--.---...------------|.........|---------------------------|
 - - - - |.. ..| - - - . - - - - - - |.........| - --- . - - - - - - - - - |
----------------------...-------.---------------------...------------------|
---..| - - - - - - - - . --- - - - - - - - - - - - - - . - - --- - - --- - |
-.S..|----.-------.------- ---------.-----------------...----- -----.-------
---..| - - - - - - - -- - - -- . - - - - - . - - - . - . - - -- -- - - - -- 
-.S..|--------.---.---       -...---------------...{.---------   ---------  
--|. - - - - - - - -- - - - -- . - - - --- - - - . . - - - - -- - - - - - - 
` });
 
    let place = [ [1,15],[68,6],[1,13] ]
    shuffle(place)
 
    des.non_diggable(selection.area(67,3,73,7));
    des.non_diggable(selection.area(0,12,2,16));
    des.feature("fountain", [12,8]);
    des.feature("fountain", [51,15]);
    await des.region(selection.area(0,0,75,16),"unlit");
    await des.region(selection.area(38,6,46,10),"lit");
    des.door("closed",37,8);
    des.door("closed",47,8);
    des.door("closed",73,5);
    des.door("closed",2,15);
    await des.mazewalk({ x: 36, y: 8, dir: "west", stocked: false });
    des.stair("up", 42,8);
    des.wallify();
 
    // Objects
    await des.object("diamond");
    await des.object("*");
    await des.object("diamond");
    await des.object("*");
    await des.object("emerald");
    await des.object("*");
    await des.object("emerald");
    await des.object("*");
    await des.object("emerald");
    await des.object("*");
    await des.object("ruby");
    await des.object("*");
    await des.object("ruby");
    await des.object("amethyst");
    await des.object("*");
    await des.object("amethyst");
    await des.object({ id: "luckstone", coord: place[1], buc: "not-cursed", achievement: 1 });
    await des.object("flint",place[0]);
    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.trap();
    await des.trap();
    await des.trap();
    await des.trap();
    await des.trap();
    await des.trap();
    await des.trap();
    // One-time annoyance factor
    await des.trap("level teleport",place[1]);
    await des.trap("level teleport",place[0]);
    await des.monster("M");
    await des.monster("M");
    await des.monster("M");
    await des.monster("M");
    await des.monster("M");
    await des.monster("ettin mummy");
    await des.monster("V");
    await des.monster("Z");
    await des.monster("Z");
    await des.monster("Z");
    await des.monster("Z");
    await des.monster("Z");
    await des.monster("V");
    await des.monster("e");
    await des.monster("e");
    await des.monster("e");
    await des.monster("e");
 
 
    return des.finalize_level();
}