All files / js/levels fakewiz2.js

100% Statements 57/57
100% Branches 3/3
100% Functions 2/2
100% Lines 57/57

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 581x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x  
/**
 * fakewiz2 - NetHack special level
 * Converted from: fakewiz2.lua
 */
 
import * as des from '../sp_lev.js';
import { selection, hell_tweaks } from '../sp_lev.js';
 
export async function generate() {
    // NetHack yendor fakewiz2.lua	$NHDT-Date: 1652196026 2022/5/10 15:20:26 $  $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.2 $
    // 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");
 
    let tmpbounds = selection.match("-");
    let bnds = tmpbounds.bounds();
    let bounds2 = selection.fillrect(bnds.lx, bnds.ly + 1, bnds.hx - 2, bnds.hy - 1);
 
    let fakewiz2 = await des.map({ halign: "center", valign: "center", map: `\
.........
.}}}}}}}.
.}}---}}.
.}--.--}.
.}|...|}.
.}--.--}.
.}}---}}.
.}}}}}}}.
.........
`, contents: async function(rm) {
       des.levregion({ region: [1,0,79,20], region_islev: 1, exclude: [0,0,8,8], type: "stair-up" });
       des.levregion({ region: [1,0,79,20], region_islev: 1, exclude: [0,0,8,8], type: "stair-down" });
       des.levregion({ region: [1,0,79,20], region_islev: 1, exclude: [0,0,8,8], type: "branch" });
       des.teleport_region({ region: [1,0,79,20], region_islev: 1,exclude: [2,2,6,6] });
       await des.mazewalk(8,5,"east");
       await des.monster("L",4,4);
       await des.monster("vampire lord",3,4);
       await des.monster("kraken",6,6);
       // And to make things a little harder.
       await des.trap("board",4,3);
       await des.trap("board",4,5);
       await des.trap("board",3,4);
       await des.trap("board",5,4);
       // treasures
       await des.object("\"",4,4);
    }
    });
 
    let protected_region = bounds2.negate().union(fakewiz2);
    await hell_tweaks(protected_region);
 
 
    return des.finalize_level();
}