All files / js/levels Pri-strt.js

100% Statements 115/115
100% Branches 5/5
100% Functions 2/2
100% Lines 115/115

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 1161x 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 2x 2x 1x 1x 1x 1x 1x 1x 12x 12x 1x 1x 1x 1x  
/**
 * Pri-strt - NetHack special level
 * Converted from: Pri-strt.lua
 */
 
import * as des from '../sp_lev.js';
import { selection } from '../sp_lev.js';
 
export async function generate() {
    // NetHack Priest Pri-strt.lua	$NHDT-Date: 1652196009 2022/5/10 15:20:9 $  $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.
    // 
    // 
    // The "start" level for the quest.
    // 
    // Here you meet your (besieged) class leader, High Priest
    // and receive your quest assignment.
    // 
    des.level_init({ style: "solidfill", fg: " " });
 
    des.level_flags("mazelevel", "noteleport", "hardfloor");
 
    await des.map(`\
............................................................................
............................................................................
............................................................................
....................------------------------------------....................
....................|................|.....|.....|.....|....................
....................|..------------..|--+-----+-----+--|....................
....................|..|..........|..|.................|....................
....................|..|..........|..|+---+---+-----+--|....................
..................---..|..........|......|...|...|.....|....................
..................+....|..........+......|...|...|.....|....................
..................+....|..........+......|...|...|.....|....................
..................---..|..........|......|...|...|.....|....................
....................|..|..........|..|+-----+---+---+--|....................
....................|..|..........|..|.................|....................
....................|..------------..|--+-----+-----+--|....................
....................|................|.....|.....|.....|....................
....................------------------------------------....................
............................................................................
............................................................................
............................................................................
`);
    // Dungeon Description
    await des.region(selection.area(0,0,75,19), "lit");
    await des.region({ region: [24,6, 33,13], lit: 1, type: "temple", filled: 2 });
 
    des.replace_terrain({ region: [0,0, 10,19], fromterrain: ".", toterrain: "T", chance: 10 });
    des.replace_terrain({ region: [65,0, 75,19], fromterrain: ".", toterrain: "T", chance: 10 });
    des.terrain([5,4], ".");
 
    let spacelocs = selection.floodfill(5,4);
 
    // Portal arrival point
    des.levregion({ region: [5,4,5,4], type: "branch" });
    // Stairs
    des.stair("down", 52,9);
    // Doors
    des.door("locked",18,9);
    des.door("locked",18,10);
    des.door("closed",34,9);
    des.door("closed",34,10);
    des.door("closed",40,5);
    des.door("closed",46,5);
    des.door("closed",52,5);
    des.door("locked",38,7);
    des.door("closed",42,7);
    des.door("closed",46,7);
    des.door("closed",52,7);
    des.door("locked",38,12);
    des.door("closed",44,12);
    des.door("closed",48,12);
    des.door("closed",52,12);
    des.door("closed",40,14);
    des.door("closed",46,14);
    des.door("closed",52,14);
    // Unattended Altar - unaligned due to conflict - player must align it.
    await des.altar({ x: 28, y: 9, align: "noalign", type: "altar" });
    // High Priest
    await des.monster({ id: "Arch Priest", coord: [28, 10], inventory: async function() {
       await des.object({ id: "robe", spe: 4 });
       await des.object({ id: "mace", spe: 4 });
    } })
    // The treasure of High Priest
    await des.object("chest", 27, 10);
    // knight guards for the audience chamber
    await des.monster("acolyte", 32, 7);
    await des.monster("acolyte", 32, 8);
    await des.monster("acolyte", 32, 11);
    await des.monster("acolyte", 32, 12);
    await des.monster("acolyte", 33, 7);
    await des.monster("acolyte", 33, 8);
    await des.monster("acolyte", 33, 11);
    await des.monster("acolyte", 33, 12);
    // Non diggable walls
    des.non_diggable(selection.area(18,3,55,16));
    // Random traps
    for (let i = 1, __end_i = 2; i <= __end_i; i++) {
       await des.trap("dart", spacelocs.rndcoord(1));
    }
    await des.trap();
    await des.trap();
    await des.trap();
    await des.trap();
    // Monsters on siege duty.
    for (let i = 1, __end_i = 12; i <= __end_i; i++) {
       await des.monster("human zombie", spacelocs.rndcoord(1));
    }
 
 
    return des.finalize_level();
}