All files / js/levels minetn-4.js

100% Statements 149/149
100% Branches 19/19
100% Functions 18/18
100% Lines 149/149

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 1503x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x  
/**
 * minetn-4 - NetHack special level
 * Converted from: minetn-4.lua
 */
 
import * as des from '../sp_lev.js';
import { shuffle, monkfoodshop } from '../sp_lev.js';
import { A_CHAOTIC, A_NEUTRAL, A_LAWFUL } from '../const.js';
 
export async function generate(_nhlib_align) {
    const align = _nhlib_align;
 
    // NetHack mines minetn-4.lua	$NHDT-Date: 1652196031 2022/5/10 15:20:31 $  $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.
    // 
    // Minetown variant 4 by Kelly Bailey
    // "College Town"
 
    await des.makeRoom({ type: "ordinary", lit: 1, x: 3,y: 3,
               xalign: "center", yalign: "center", w: 30, h: 15,
               contents: async function() {
                  des.feature("fountain", 8,7);
                  des.feature("fountain", 18,7);
 
                  await des.makeRoom({ type: "book shop", lit: 1, x: 4, y: 2, w: 3, h: 3,
                             contents: async function() {
                                des.door({ state: "closed", wall: "south" });
                             }
                  })
 
                  await des.makeRoom({ type: "ordinary", x: 8, y: 2, w: 2, h: 2,
                             contents: async function() {
                                des.door({ state: "closed", wall: "south" });
                             }
                  })
 
                  await des.makeRoom({ type: "temple", lit: 1, x: 11, y: 3, w: 5, h: 4,
                             contents: async function() {
                                des.door({ state: "closed", wall: "south" });
                                await des.altar({ x: 2,y: 1,align: align[0], type: "shrine" });
                                await des.monster("gnomish wizard");
                                await des.monster("gnomish wizard");
                             }
                  })
 
                  await des.makeRoom({ type: "ordinary", x: 19, y: 2, w: 2, h: 2,
                             contents: async function() {
                                des.door({ state: "closed", wall: "south" });
                                await des.monster("G");
                             }
                  })
 
                  await des.makeRoom({ type: "candle shop", lit: 1, x: 22, y: 2, w: 3, h: 3,
                             contents: async function() {
                                des.door({ state: "closed", wall: "south" });
                             }
                  })
 
                  await des.makeRoom({ type: "ordinary", x: 26, y: 2, w: 2, h: 2,
                             contents: async function() {
                                des.door({ state: "locked", wall: "east" });
                                await des.monster("G");
                             }
                  })
 
                  await des.makeRoom({ type: "tool shop", chance: 90, lit: 1, x: 4,y: 10, w: 3,h: 3,
                             contents: async function() {
                                des.door({ state: "closed", wall: "north" });
                             }
                  })
 
                  await des.makeRoom({ type: "ordinary", x: 8, y: 11, w: 2, h: 2,
                             contents: async function() {
                                des.door({ state: "locked", wall: "south" });
                                await des.monster("kobold shaman");
                                await des.monster("kobold shaman");
                                await des.monster("kitten");
                                await des.monster("f");
                             }
                  })
 
                  await des.makeRoom({ type: monkfoodshop(), chance: 90, lit: 1, x: 11, y: 11, w: 3, h: 2,
                             contents: async function() {
                                des.door({ state: "closed", wall: "east" });
                             }
                  })
 
                  await des.makeRoom({ type: "ordinary", x: 17, y: 11, w: 2, h: 2,
                             contents: async function() {
                                des.door({ state: "closed", wall: "west" });
                             }
                  })
 
                  await des.makeRoom({ type: "ordinary", x: 20, y: 10, w: 2, h: 2,
                             contents: async function() {
                                des.door({ state: "locked", wall: "north" });
                                await des.monster("G");
                             }
                  })
 
                  await des.makeRoom({ type: "shop", chance: 90, lit: 1, x: 23, y: 10, w: 3, h: 3,
                             contents: async function() {
                                des.door({ state: "closed", wall: "north" });
                             }
                  })
 
                  await des.monster({ id: "watchman", peaceful: 1 });
                  await des.monster({ id: "watchman", peaceful: 1 });
                  await des.monster({ id: "watchman", peaceful: 1 });
                  await des.monster({ id: "watchman", peaceful: 1 });
                  await des.monster({ id: "watch captain", peaceful: 1 });
               }
    })
 
    await des.makeRoom({ type: "ordinary",
               contents: async function() {
                  des.stair("up");
               }
    })
 
    await des.makeRoom({ type: "ordinary",
               contents: async function() {
                  des.stair("down");
                  await des.trap();
                  await des.monster("gnome");
                  await des.monster("gnome");
               }
    })
 
    await des.makeRoom({ type: "ordinary",
               contents: async function() {
                  await des.monster("dwarf");
               }
    })
 
    await des.makeRoom({ type: "ordinary",
               contents: async function() {
                  await des.trap();
                  await des.monster("gnome");
               }
    })
 
    await des.random_corridors();
 
 
    return des.finalize_level();
}