All files / js/levels Cav-strt.js

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

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 1081x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x  
/**
 * Cav-strt - NetHack special level
 * Converted from: Cav-strt.lua
 */
 
import * as des from '../sp_lev.js';
import { selection } from '../sp_lev.js';
 
export async function generate() {
    // NetHack Caveman Cav-strt.lua	$NHDT-Date: 1652196002 2022/5/10 15:20:2 $  $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.3 $
    // Copyright (c) 1989 by Jean-Christophe Collet
    // Copyright (c) 1991 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, Shaman Karnov
    // and receive your quest assignment.
    // 
    des.level_init({ style: "solidfill", fg: " " });
 
    des.level_flags("mazelevel", "noteleport", "hardfloor");
 
    await des.map(`\
                                                                            
  ......     ..........................       ...        ....  ......       
 ......       ..........................     ........       ....    .....   
  ..BB      .............................    .........            ....  ..  
     ..    ......................              .......      ..     ....  .. 
     ..     ....................                     ..  .......    ..  ... 
   ..              S   BB                .....     .......   ....      .... 
    ..        ...  .   ..               ........  ..     ..   ..       ...  
     ..      ......     ..             ............       ..          ...   
       .      ....       ..             ........           ..  ...........  
  ...   ..     ..        .............                  ................... 
 .....   .....            ...............................      ...........  
  .....B................            ...                               ...   
  .....     .  ..........        .... .      ...  ..........           ...  
   ...     ..          .............  ..    ...................        .... 
          BB       ..   .........      BB    ...  ..........  ..   ...  ... 
       ......    .....  B          ........         ..         .. ....  ... 
     ..........  ..........         ..... ...      .....        ........    
       ..  ...    .  .....         ....    ..       ...            ..       
                                                                            
`);
    // Dungeon Description
    await des.region(selection.area(0,0,75,19), "unlit");
    await des.region({ region: [13,1, 40,5], lit: 1, type: "temple", filled: 1, irregular: 1 });
    // The occupied rooms.
    await des.region({ region: [2,1, 8,3], lit: 1, type: "ordinary", irregular: 1 });
    await des.region({ region: [1,11, 6,14], lit: 1, type: "ordinary", irregular: 1 });
    await des.region({ region: [13,8, 18,10], lit: 1, type: "ordinary", irregular: 1 });
    await des.region({ region: [5,17, 14,18], lit: 1, type: "ordinary", irregular: 1 });
    await des.region({ region: [17,16, 23,18], lit: 1, type: "ordinary", irregular: 1 });
    await des.region({ region: [35,16, 44,18], lit: 1, type: "ordinary", irregular: 1 });
    // Stairs
    des.stair("down", 2,3);
    // Portal arrival point
    des.levregion({ region: [71,9,71,9], type: "branch" });
    // Doors
    des.door("locked",19,6);
    // The temple altar (this will force a priest(ess) to be created)
    await des.altar({ x: 36,y: 2, align: "coaligned", type: "shrine" });
    // Shaman Karnov
    await des.monster({ id: "Shaman Karnov", coord: [35, 2], inventory: async function() {
       await des.object({ id: "leather armor", spe: 5 });
       await des.object({ id: "club", spe: 5 });
    } })
    // The treasure of Shaman Karnov
    await des.object("chest", 34, 2);
    // neanderthal guards for the audience chamber
    await des.monster("neanderthal", 20, 3);
    await des.monster("neanderthal", 20, 2);
    await des.monster("neanderthal", 20, 1);
    await des.monster("neanderthal", 21, 3);
    await des.monster("neanderthal", 21, 2);
    await des.monster("neanderthal", 21, 1);
    await des.monster("neanderthal", 22, 1);
    await des.monster("neanderthal", 26, 9);
    // Non diggable walls
    des.non_diggable(selection.area(0,0,75,19));
    // Random traps
    await des.trap("pit",47,11);
    await des.trap("pit",57,10);
    await des.trap();
    await des.trap();
    await des.trap();
    await des.trap();
    // Monsters on siege duty (in the outer caves).
    await des.monster({ id: "bugbear", x: 47, y: 2, peaceful: 0 });
    await des.monster({ id: "bugbear", x: 48, y: 3, peaceful: 0 });
    await des.monster({ id: "bugbear", x: 49, y: 4, peaceful: 0 });
    await des.monster({ id: "bugbear", x: 67, y: 3, peaceful: 0 });
    await des.monster({ id: "bugbear", x: 69, y: 4, peaceful: 0 });
    await des.monster({ id: "bugbear", x: 51, y: 13, peaceful: 0 });
    await des.monster({ id: "bugbear", x: 53, y: 14, peaceful: 0 });
    await des.monster({ id: "bugbear", x: 55, y: 15, peaceful: 0 });
    await des.monster({ id: "bugbear", x: 63, y: 10, peaceful: 0 });
    await des.monster({ id: "bugbear", x: 65, y: 9, peaceful: 0 });
    await des.monster({ id: "bugbear", x: 67, y: 10, peaceful: 0 });
    await des.monster({ id: "bugbear", x: 69, y: 11, peaceful: 0 });
    des.wallify();
 
 
    return des.finalize_level();
}