All files / js/levels Bar-loca.js

100% Statements 120/120
100% Branches 2/2
100% Functions 1/1
100% Lines 120/120

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 118 119 120 1211x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x  
/**
 * Bar-loca - NetHack special level
 * Converted from: Bar-loca.lua
 */
 
import * as des from '../sp_lev.js';
import { selection } from '../sp_lev.js';
 
export async function generate() {
    // NetHack Barbarian Bar-loca.lua	$NHDT-Date: 1652196000 2022/5/10 15:20:0 $  $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.1 $
    // Copyright (c) 1989 by Jean-Christophe Collet
    // Copyright (c) 1991 by M. Stephenson
    // NetHack may be freely redistributed.  See license for details.
    // 
    des.level_init({ style: "solidfill", fg: " " });
 
    des.level_flags("mazelevel", "hardfloor");
 
    await des.map(`\
..........PPP.........................................                      
...........PP..........................................        .......      
..........PP...........-----..........------------------     ..........     
...........PP..........+...|..........|....S...........|..  ............    
..........PPP..........|...|..........|-----...........|...  .............  
...........PPP.........-----..........+....+...........|...  .............  
..........PPPPPPPPP...................+....+...........S.................   
........PPPPPPPPPPPPP.........-----...|-----...........|................    
......PPPPPPPPPPPPPP..P.......+...|...|....S...........|          ...       
.....PPPPPPP......P..PPPP.....|...|...------------------..         ...      
....PPPPPPP.........PPPPPP....-----........................      ........   
...PPPPPPP..........PPPPPPP..................................   ..........  
....PPPPPPP........PPPPPPP....................................  ..........  
.....PPPPP........PPPPPPP.........-----........................   ........  
......PPP..PPPPPPPPPPPP...........+...|.........................    .....   
..........PPPPPPPPPPP.............|...|.........................     ....   
..........PPPPPPPPP...............-----.........................       .    
..............PPP.................................................          
...............PP....................................................       
................PPP...................................................      
`);
    // Dungeon Description
    await des.region(selection.area(0,0,75,19), "lit");
    await des.region(selection.area(24,3,26,4), "unlit");
    await des.region(selection.area(31,8,33,9), "unlit");
    await des.region(selection.area(35,14,37,15), "unlit");
    await des.region(selection.area(39,3,54,8), "lit");
    await des.region(selection.area(56,0,75,8), "unlit");
    await des.region(selection.area(64,9,75,16), "unlit");
    // Doors
    des.door("open",23,3);
    des.door("open",30,8);
    des.door("open",34,14);
    des.door("locked",38,5);
    des.door("locked",38,6);
    des.door("closed",43,3);
    des.door("closed",43,5);
    des.door("closed",43,6);
    des.door("closed",43,8);
    des.door("locked",55,6);
    // Stairs
    des.stair("up", 5,2);
    des.stair("down", 70,13);
    // Objects
    await des.object({ x: 42, y: 3 });
    await des.object({ x: 42, y: 3 });
    await des.object({ x: 42, y: 3 });
    await des.object({ x: 41, y: 3 });
    await des.object({ x: 41, y: 3 });
    await des.object({ x: 41, y: 3 });
    await des.object({ x: 41, y: 3 });
    await des.object({ x: 41, y: 8 });
    await des.object({ x: 41, y: 8 });
    await des.object({ x: 42, y: 8 });
    await des.object({ x: 42, y: 8 });
    await des.object({ x: 42, y: 8 });
    await des.object({ x: 71, y: 13 });
    await des.object({ x: 71, y: 13 });
    await des.object({ x: 71, y: 13 });
    // Random traps
    await des.trap("spiked pit",10,13);
    await des.trap("spiked pit",21,7);
    await des.trap("spiked pit",67,8);
    await des.trap("spiked pit",68,9);
    await des.trap();
    await des.trap();
    await des.trap();
    await des.trap();
    // Random monsters.
    await des.monster({ id: "ogre", x: 12, y: 9, peaceful: 0 });
    await des.monster({ id: "ogre", x: 18, y: 11, peaceful: 0 });
    await des.monster({ id: "ogre", x: 45, y: 5, peaceful: 0 });
    await des.monster({ id: "ogre", x: 45, y: 6, peaceful: 0 });
    await des.monster({ id: "ogre", x: 47, y: 5, peaceful: 0 });
    await des.monster({ id: "ogre", x: 46, y: 5, peaceful: 0 });
    await des.monster({ id: "ogre", x: 56, y: 3, peaceful: 0 });
    await des.monster({ id: "ogre", x: 56, y: 4, peaceful: 0 });
    await des.monster({ id: "ogre", x: 56, y: 5, peaceful: 0 });
    await des.monster({ id: "ogre", x: 56, y: 6, peaceful: 0 });
    await des.monster({ id: "ogre", x: 57, y: 3, peaceful: 0 });
    await des.monster({ id: "ogre", x: 57, y: 4, peaceful: 0 });
    await des.monster({ id: "ogre", x: 57, y: 5, peaceful: 0 });
    await des.monster({ id: "ogre", x: 57, y: 6, peaceful: 0 });
    await des.monster({ id: "ogre", peaceful: 0 });
    await des.monster({ id: "ogre", peaceful: 0 });
    await des.monster({ id: "ogre", peaceful: 0 });
    await des.monster({ class: "O", peaceful: 0 });
    await des.monster({ class: "T", peaceful: 0 });
    await des.monster({ id: "rock troll", x: 46, y: 6, peaceful: 0 });
    await des.monster({ id: "rock troll", x: 47, y: 6, peaceful: 0 });
    await des.monster({ id: "rock troll", x: 56, y: 7, peaceful: 0 });
    await des.monster({ id: "rock troll", x: 57, y: 7, peaceful: 0 });
    await des.monster({ id: "rock troll", x: 70, y: 13, peaceful: 0 });
    await des.monster({ id: "rock troll", peaceful: 0 });
    await des.monster({ id: "rock troll", peaceful: 0 });
    await des.monster({ class: "T", peaceful: 0 });
 
 
 
    return des.finalize_level();
}