All files / js/levels fakewiz1.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  
/**
 * fakewiz1 - NetHack special level
 * Converted from: fakewiz1.lua
 */
 
import * as des from '../sp_lev.js';
import { selection, hell_tweaks } from '../sp_lev.js';
 
export async function generate() {
    // NetHack yendor fakewiz1.lua	$NHDT-Date: 1652196025 2022/5/10 15:20:25 $  $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 fakewiz1 = 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] });
       des.levregion({ region: [4,4,4,4], type: "portal", name: "wizard3" });
       await des.mazewalk(8,5,"east");
       await des.region({ region: [4,3,6,6],lit: 0,type: "ordinary",irregular: 1,arrival_room: true });
       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);
    }
    });
 
    let protected_region = bounds2.negate().union(fakewiz1);
    await hell_tweaks(protected_region);
 
 
    return des.finalize_level();
}