All files / js/levels asmodeus.js

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

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 1102x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x  
/**
 * asmodeus - NetHack special level
 * Converted from: asmodeus.lua
 */
 
import * as des from '../sp_lev.js';
import { selection, hell_tweaks } from '../sp_lev.js';
 
export async function generate() {
    // NetHack gehennom asmodeus.lua	$NHDT-Date: 1652196020 2022/5/10 15:20:20 $  $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);
 
    // First part
    let asmo1 = await des.map({ halign: "half-left", valign: "center", map: `\
---------------------
|.............|.....|
|.............S.....|
|---+------------...|
|.....|.........|-+--
|..---|.........|....
|..|..S.........|....
|..|..|.........|....
|..|..|.........|-+--
|..|..-----------...|
|..S..........|.....|
---------------------
`, contents: async function(rm) {
       // Doors
       des.door("closed",4,3);
       des.door("locked",18,4);
       des.door("closed",18,8);
       // 
       des.stair("down", 13,7);
       // Non diggable walls
       des.non_diggable(selection.area(0,0,20,11));
       // Entire main area
       await des.region(selection.area(1,1,20,10),"unlit");
       // The fellow in residence
       await des.monster("Asmodeus",12,7);
       // Some random weapons and armor.
       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("?");
       // Some traps.
       await des.trap("spiked pit", 5,2);
       await des.trap("fire", 8,6);
       await des.trap("sleep gas");
       await des.trap("anti magic");
       await des.trap("fire");
       await des.trap("magic");
       await des.trap("magic");
       // Random monsters.
       await des.monster("ghost",11,7);
       await des.monster("horned devil",10,5);
       await des.monster("L");
       // Some Vampires for good measure
       await des.monster("V");
       await des.monster("V");
       await des.monster("V");
    } });
 
    des.levregion({ region: [1,0,6,20], region_islev: 1, exclude: [6,1,70,16], exclude_islev: 1, type: "stair-up" });
 
    des.levregion({ region: [1,0,6,20], region_islev: 1, exclude: [6,1,70,16], exclude_islev: 1, type: "branch" });
    des.teleport_region({ region: [1,0,6,20], region_islev: 1, exclude: [6,1,70,16], exclude_islev: 1 });
 
    // Second part
    let asmo2 = await des.map({ halign: "half-right", valign: "center", map: `\
---------------------------------
................................|
................................+
................................|
---------------------------------
`, contents: async function(rm) {
       await des.mazewalk(32,2,"east");
       // Non diggable walls
       des.non_diggable(selection.area(0,0,32,4));
       des.door("closed",32,2);
       await des.monster("&");
       await des.monster("&");
       await des.monster("&");
       await des.trap("anti magic");
       await des.trap("fire");
       await des.trap("magic");
    } });
 
    let protected_region = bounds2.negate().union(asmo1).union(asmo2);
    await hell_tweaks(protected_region);
 
 
    return des.finalize_level();
}