All files / js/levels Val-goal.js

98.29% Statements 115/117
66.66% Branches 2/3
100% Functions 1/1
98.29% Lines 115/117

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 1181x 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 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x  
/**
 * Val-goal - NetHack special level
 * Converted from: Val-goal.lua
 */
 
import * as des from '../sp_lev.js';
import { selection, percent } from '../sp_lev.js';
 
export async function generate() {
    // NetHack Valkyrie Val-goal.lua	$NHDT-Date: 1652196017 2022/5/10 15:20:17 $  $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.5 $
    // Copyright (c) 1989 by Jean-Christophe Collet
    // Copyright (c) 1991-2 by M. Stephenson
    // NetHack may be freely redistributed.  See license for details.
    // 
    des.level_init({ style: "solidfill", fg: "L" });
 
    des.level_flags("mazelevel", "icedpools");
 
    des.level_init({ style: "mines", fg: ".", bg: "L", smoothed: true, joined: true, lit: 1, walled: false });
 
    await des.map(`\
xxxxxx.....................xxxxxxxx
xxxxx.......LLLLL.LLLLL......xxxxxx
xxxx......LLLLLLLLLLLLLLL......xxxx
xxxx.....LLL|---------|LLL.....xxxx
xxxx....LL|--.........--|LL.....xxx
x......LL|-...LLLLLLL...-|LL.....xx
.......LL|...LL.....LL...|LL......x
......LL|-..LL.......LL..-|LL......
......LL|.................|LL......
......LL|-..LL.......LL..-|LL......
.......LL|...LL.....LL...|LL.......
xx.....LL|-...LLLLLLL...-|LL......x
xxx.....LL|--.........--|LL.....xxx
xxxx.....LLL|---------|LLL...xxxxxx
xxxxx.....LLLLLLLLLLLLLLL...xxxxxxx
xxxxxx......LLLLL.LLLLL.....xxxxxxx
xxxxxxxxx..................xxxxxxxx
`);
    // Dungeon Description
    await des.region(selection.area(0,0,34,16), "lit");
    // Stairs
    // Note:  The up stairs are *intentionally* off of the map.
    // if the stairs are surrounded by lava, maybe give some room
    des.replace_terrain({ region: [44,9, 46,11], fromterrain: 'L', toterrain: '.', chance: 50 });
    des.stair("up", 45,10);
    // Non diggable walls
    des.non_diggable(selection.area(0,0,34,16));
    // Drawbridges; northern one opens from the south (portcullis) to further
    // north (lowered span), southern one from the north to further south
    des.drawbridge({ x: 17, y: 2, dir: "south", state: "random" });
    if (percent(75)) {
       des.drawbridge({ x: 17, y: 14, dir: "north", state: "open" });
    } else {
       des.drawbridge({ x: 17, y: 14, dir: "north", state: "random" });
    }
    // Objects
    await des.object({ id: "crystal ball", x: 17, y: 8, buc: "blessed", spe: 5, name: "The Orb of Fate" });
    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();
    await des.object();
    await des.object();
    await des.object();
    await des.object();
    // Traps
    await des.trap("board",13,8);
    await des.trap("board",21,8);
    // Random traps
    await des.trap("fire");
    await des.trap("fire");
    await des.trap("fire");
    await des.trap("fire");
    await des.trap("board");
    await des.trap();
    await des.trap();
    // Random monsters.
    await des.monster("Lord Surtur", 17, 8);
    await des.monster("fire ant");
    await des.monster("fire ant");
    await des.monster("fire ant");
    await des.monster("fire ant");
    await des.monster("a");
    await des.monster("a");
    await des.monster({ id: "fire giant", x: 10, y: 6, peaceful: 0 });
    await des.monster({ id: "fire giant", x: 10, y: 7, peaceful: 0 });
    await des.monster({ id: "fire giant", x: 10, y: 8, peaceful: 0 });
    await des.monster({ id: "fire giant", x: 10, y: 9, peaceful: 0 });
    await des.monster({ id: "fire giant", x: 10, y: 10, peaceful: 0 });
    await des.monster({ id: "fire giant", x: 24, y: 6, peaceful: 0 });
    await des.monster({ id: "fire giant", x: 24, y: 7, peaceful: 0 });
    await des.monster({ id: "fire giant", x: 24, y: 8, peaceful: 0 });
    await des.monster({ id: "fire giant", x: 24, y: 9, peaceful: 0 });
    await des.monster({ id: "fire giant", x: 24, y: 10, peaceful: 0 });
    await des.monster({ id: "fire giant", peaceful: 0 });
    await des.monster({ id: "fire giant", peaceful: 0 });
    await des.monster({ class: "H", peaceful: 0 });
 
    // 
    // The "fill" levels for the quest.
    // 
    // These levels are used to fill out any levels not occupied by specific
    // levels as defined above. "filla" is the upper filler, between the
    // start and locate levels, and "fillb" the lower between the locate
    // and goal levels.
    // 
 
 
    return des.finalize_level();
}