All files / js/levels wizard3.js

100% Statements 103/103
100% Branches 4/4
100% Functions 3/3
100% Lines 103/103

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 1041x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x  
/**
 * wizard3 - NetHack special level
 * Converted from: wizard3.lua
 */
 
import * as des from '../sp_lev.js';
import { selection, percent, hell_tweaks } from '../sp_lev.js';
 
export async function generate() {
    // NetHack yendor wizard3.lua	$NHDT-Date: 1652196040 2022/5/10 15:20:40 $  $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.4 $
    // Copyright (c) 1989 by Jean-Christophe Collet
    // Copyright (c) 1992 by M. Stephenson and Izchak Miller
    // NetHack may be freely redistributed.  See license for details.
    // 
    des.level_init({ style: "mazegrid", bg: "-" });
 
    des.level_flags("mazelevel", "noteleport", "hardfloor");
 
    let tmpbounds = selection.match("-");
    let bnds = tmpbounds.bounds();
    let bounds2 = selection.fillrect(bnds.lx, bnds.ly + 1, bnds.hx - 2, bnds.hy - 1);
 
    let wiz3 = await des.map({ halign: "center", valign: "center", map: `\
----------------------------x
|..|............S..........|x
|..|..------------------S--|x
|..|..|.........|..........|x
|..S..|.}}}}}}}.|..........|x
|..|..|.}}---}}.|-S--------|x
|..|..|.}--.--}.|..|.......|x
|..|..|.}|...|}.|..|.......|x
|..---|.}--.--}.|..|.......|x
|.....|.}}---}}.|..|.......|x
|.....S.}}}}}}}.|..|.......|x
|.....|.........|..|.......|x
----------------------------x
`, contents: async function(rm) {
       des.levregion({ type: "stair-up", region: [1,0,79,20], region_islev: 1, exclude: [0,0,28,12] });
       des.levregion({ type: "stair-down", region: [1,0,79,20], region_islev: 1, exclude: [0,0,28,12] });
       des.levregion({ type: "branch", region: [1,0,79,20], region_islev: 1, exclude: [0,0,28,12] });
       des.teleport_region({ region: [1,0,79,20], region_islev: 1, exclude: [0,0,27,12] });
       des.levregion({ region: [25,11,25,11], type: "portal", name: "fakewiz1" });
       await des.mazewalk(28,9,"east");
       await des.region({ region: [7,3, 15,11], lit: 0 ,type: "morgue", filled: 2 });
       await des.region({ region: [17,6, 18,11], lit: 0, type: "beehive", filled: 1 });
       // make the entry chamber a real room; it affects monster arrival
       await des.region({ region: [20,6,26,11],lit: 0,type: "ordinary",arrival_room: true,
                    contents: async function() {
                       let w = "north";
                       if (percent(50)) { w = "west" }
                       des.door({ state: "secret", wall: w });
                    }
       });
       des.door("closed",18,5);
       des.ladder("up", 11,7);
       // Non diggable walls
       // Walls inside the moat stay diggable
       des.non_diggable(selection.area(0,0,6,12));
       des.non_diggable(selection.area(6,0,27,2));
       des.non_diggable(selection.area(16,2,27,12));
       des.non_diggable(selection.area(6,12,16,12));
       // 
       des.non_passwall(selection.area(0,0,6,12));
       des.non_passwall(selection.area(6,0,27,2));
       des.non_passwall(selection.area(16,2,27,12));
       des.non_passwall(selection.area(6,12,16,12));
       // 
       await des.monster("L", 10, 7);
       await des.monster("vampire lord", 12, 7);
       // Some surrounding horrors
       await des.monster("kraken", 8, 5);
       await des.monster("giant eel", 8, 8);
       await des.monster("kraken", 14, 5);
       await des.monster("giant eel", 14, 8);
       // Other monsters
       await des.monster("L");
       await des.monster("D");
       await des.monster("D", 26, 9);
       await des.monster("&");
       await des.monster("&");
       await des.monster("&");
       // And to make things a little harder.
       await des.trap("board",10,7);
       await des.trap("board",12,7);
       await des.trap("board",11,6);
       await des.trap("board",11,8);
       // Some loot
       await des.object(")");
       await des.object("!");
       await des.object("?");
       await des.object("?");
       await des.object("(");
       // treasures
       await des.object("\"", 11, 7);
    }
    });
 
    let protected_region = bounds2.negate().union(wiz3);
    await hell_tweaks(protected_region);
 
 
    return des.finalize_level();
}