All files / js/levels Sam-strt.js

100% Statements 111/111
100% Branches 3/3
100% Functions 2/2
100% Lines 111/111

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 1121x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x  
/**
 * Sam-strt - NetHack special level
 * Converted from: Sam-strt.lua
 */
 
import * as des from '../sp_lev.js';
import { selection } from '../sp_lev.js';
 
export async function generate() {
    // NetHack Samurai Sam-strt.lua	$NHDT-Date: 1695932714 2023/9/28 20:25:14 $  $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.4 $
    // Copyright (c) 1989 by Jean-Christophe Collet
    // Copyright (c) 1991-92 by M. Stephenson, P. Winner
    // NetHack may be freely redistributed.  See license for details.
    // 
    // 
    // The "start" level for the quest.
    // 
    // Here you meet your (besieged) class leader, Lord Sato
    // and receive your quest assignment.
    // 
    // The throne room designation produces random atmospheric
    // messages (until the room is entered) but this one doesn't
    // actually contain any throne.
    // 
    des.level_init({ style: "solidfill", fg: " " });
 
    des.level_flags("mazelevel", "noteleport", "hardfloor");
 
    await des.map(`\
..............................................................PP............
...............................................................PP...........
..........---------------------------------------------------...PPP.........
..........|......|.........|...|..............|...|.........|....PPPPP......
......... |......|.........S...|..............|...S.........|.....PPPP......
..........|......|.........|---|..............|---|.........|.....PPP.......
..........+......|.........+...-------++-------...+.........|......PP.......
..........+......|.........|......................|.........|......PP.......
......... |......---------------------++--------------------|........PP.....
..........|.................................................|.........PP....
..........|.................................................|...........PP..
..........----------------------------------------...-------|............PP.
..........................................|.................|.............PP
.............. ................. .........|.................|..............P
............. } ............... } ........|.................|...............
.............. ........PP....... .........|.................|...............
.....................PPP..................|.................|...............
......................PP..................-------------------...............
............................................................................
............................................................................
`);
    // Dungeon Description
    await des.region(selection.area(0,0,75,19), "lit");
    await des.region({ region: [18,3, 26,7], lit: 1, type: "throne", filled: 2 });
    // Portal arrival zone
    des.levregion({ region: [62,12,70,17], type: "branch" });
    // Stairs
    des.stair("down", 29,4);
    // Doors
    des.door("locked",10,6);
    des.door("locked",10,7);
    des.door("closed",27,4);
    des.door("closed",27,6);
    des.door("closed",38,6);
    des.door("locked",38,8);
    des.door("closed",39,6);
    des.door("locked",39,8);
    des.door("closed",50,4);
    des.door("closed",50,6);
    // Lord Sato
    await des.monster({ id: "Lord Sato", coord: [20, 4], inventory: async function() {
       await des.object({ id: "splint mail", spe: 5, eroded: -1, buc: "not-cursed" });
       await des.object({ id: "katana", spe: 4, eroded: -1, buc: "not-cursed" });
    } })
    // The treasure of Lord Sato
    await des.object("chest", 20, 4);
    // roshi guards for the audience chamber
    await des.monster("roshi", 18, 4);
    await des.monster("roshi", 18, 5);
    await des.monster("roshi", 18, 6);
    await des.monster("roshi", 18, 7);
    await des.monster("roshi", 26, 4);
    await des.monster("roshi", 26, 5);
    await des.monster("roshi", 26, 6);
    await des.monster("roshi", 26, 7);
    // Non diggable walls
    des.non_diggable(selection.area(0,0,75,19));
    // Random traps
    await des.trap();
    await des.trap();
    await des.trap();
    await des.trap();
    await des.trap();
    await des.trap();
    // Monsters on siege duty.
    await des.monster({ id: "ninja", x: 64, y: 0, peaceful: 0 });
    await des.monster("wolf", 65, 1);
    await des.monster({ id: "ninja", x: 67, y: 2, peaceful: 0 });
    await des.monster({ id: "ninja", x: 69, y: 5, peaceful: 0 });
    await des.monster({ id: "ninja", x: 69, y: 6, peaceful: 0 });
    await des.monster("wolf", 69, 7);
    await des.monster({ id: "ninja", x: 70, y: 6, peaceful: 0 });
    await des.monster({ id: "ninja", x: 70, y: 7, peaceful: 0 });
    await des.monster({ id: "ninja", x: 72, y: 1, peaceful: 0 });
    await des.monster("wolf", 75, 9);
    await des.monster({ id: "ninja", x: 73, y: 5, peaceful: 0 });
    await des.monster({ id: "ninja", x: 68, y: 2, peaceful: 0 });
    await des.monster("stalker");
 
 
    return des.finalize_level();
}