All files / js/levels Val-strt.js

100% Statements 113/113
100% Branches 4/4
100% Functions 2/2
100% Lines 113/113

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 1141x 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 13x 13x 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-strt - NetHack special level
 * Converted from: Val-strt.lua
 */
 
import * as des from '../sp_lev.js';
import { selection } from '../sp_lev.js';
 
export async function generate() {
    // NetHack Valkyrie Val-strt.lua	$NHDT-Date: 1652196017 2022/5/10 15:20:17 $  $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.2 $
    // Copyright (c) 1989 by Jean-Christophe Collet
    // Copyright (c) 1991-2 by M. Stephenson
    // NetHack may be freely redistributed.  See license for details.
    // 
    // 
    // The "start" level for the quest.
    // 
    // Here you meet your (besieged) class leader, the Norn,
    // and receive your quest assignment.
    // 
 
    des.level_flags("mazelevel", "noteleport", "hardfloor", "icedpools");
    des.level_init({ style: "solidfill", fg: "I" });
 
    let pools = selection.new()
    // random locations
    for (let i = 1, __end_i = 13; i <= __end_i; i++) {
       pools.set();
    }
    // some bigger ones
    pools = pools.union(selection.grow(selection.set(selection.new()), "west"))
    pools = pools.union(selection.grow(selection.set(selection.new()), "north"))
    pools = pools.union(selection.grow(selection.set(selection.new()), "random"))
 
    // Lava pools surrounded by water
    des.terrain(pools.clone().grow("all"), "P");
    des.terrain(pools, "L");
 
    await des.map(`\
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
xxxxxxxxxxxxxxxxx..xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx...xxxxxxxxxxxxxxxxxxxxx
xxxxxxxxxxxxxxxx..xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx..{..xxxxxxxxxxxxxxxxxxxx
xxxxxxxxxxxxxxx..xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx.....xxxxxxxxxxxxxxxxxxx
xxxxxxxxxxxxxx..xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx.xxxxxxxxxxxxxxxxxxx
xxxxxxxxxxxxx..xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx.xxxxxxxxxxxxxxxxxxx
xxxxxxxxxxxx..xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx..xxxxxxxxxxxxxxxxxxx
xxxxxxxx.....xxxxxxxxxxxxx|----------------|xxxxxxxxxxx.xxxxxxxxxxxxxxxxxxxx
xxxxxxx..xxx...xxxxxxxxxxx|................|xxxxxxxxxx..xxxxxxxxxxxxxxxxxxxx
xxxxxx..xxxxxx......xxxxx.|................|.xxxxxxxxx.xxxxxxxxxxxxxxxxxxxxx
xxxxx..xxxxxxxxxxxx.......+................+...xxxxxxx.xxxxxxxxxxxxxxxxxxxxx
xxxx..xxxxxxxxx.....xxxxx.|................|.x...xxxxx.xxxxxxxxxxxxxxxxxxxxx
xxx..xxxxxxxxx..xxxxxxxxxx|................|xxxx.......xxxxxxxxxxxxxxxxxxxxx
xxxx..xxxxxxx..xxxxxxxxxxx|----------------|xxxxxxxxxx...xxxxxxxxxxxxxxxxxxx
xxxxxx..xxxx..xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx...xxxxxxxxxxxxxxxxx
xxxxxxx......xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx...xxxxxxxxxxxxxxx
xxxxxxxxx...xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx...x......xxxxxx
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx.........xxxxx
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx.......xxxxxx
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
`);
    // Dungeon Description
    await des.region(selection.area(0,0,75,19), "lit");
    // Portal arrival point
    des.levregion({ region: [66,17,66,17], type: "branch" });
    // Stairs
    des.stair("down", 18,1);
    des.feature("fountain", 53,2);
    // Doors
    des.door("locked",26,10);
    des.door("locked",43,10);
    // Norn
    await des.monster({ id: "Norn", coord: [35, 10], inventory: async function() {
       await des.object({ id: "banded mail", spe: 5 });
       await des.object({ id: "long sword", spe: 4 });
    } })
    // The treasure of the Norn
    await des.object("chest", 36, 10);
    // valkyrie guards for the audience chamber
    await des.monster("warrior", 27, 8);
    await des.monster("warrior", 27, 9);
    await des.monster("warrior", 27, 11);
    await des.monster("warrior", 27, 12);
    await des.monster("warrior", 42, 8);
    await des.monster("warrior", 42, 9);
    await des.monster("warrior", 42, 11);
    await des.monster("warrior", 42, 12);
    // Non diggable walls
    des.non_diggable(selection.area(26,7,43,13));
    // Random traps
    await des.trap("fire");
    await des.trap("fire");
    await des.trap("fire");
    await des.trap("fire");
    await des.trap("fire");
    await des.trap("fire");
    // Monsters on siege duty.
    await des.monster("fire ant", 4, 12);
    await des.monster("fire ant", 8, 8);
    await des.monster("fire ant", 14, 4);
    await des.monster("fire ant", 17, 11);
    await des.monster("fire ant", 24, 10);
    await des.monster("fire ant", 45, 10);
    await des.monster("fire ant", 54, 2);
    await des.monster("fire ant", 55, 7);
    await des.monster("fire ant", 58, 14);
    await des.monster("fire ant", 63, 17);
    await des.monster({ id: "fire giant", x: 18, y: 1, peaceful: 0 });
    await des.monster({ id: "fire giant", x: 10, y: 16, peaceful: 0 });
 
 
 
    return des.finalize_level();
}