map.ts
1 /** 2 * Room map and room setup for Dunnet 3 * 4 * The dungeon map defines connections between rooms. 5 * Format: [north, south, east, west, northeast, southeast, northwest, southwest, up, down, in, out] 6 * -1 = can't go that way 7 * 255 = special handling required 8 */ 9 10 // Direction indices 11 const N = 0, S = 1, E = 2, W = 3, NE = 4, SE = 5, NW = 6, SW = 7, U = 8, D = 9, IN = 10, OUT = 11; 12 13 /** 14 * Room map - defines which room you reach when going in each direction. 15 * -1 = blocked, 255 = special handling needed 16 */ 17 export const DUNGEON_MAP: number[][] = [ 18 // Room 0: Treasure Room 19 [96, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1], 20 21 // Room 1: Dead End 22 [-1, -1, 2, -1, -1, -1, -1, -1, -1, -1, -1, -1], 23 24 // Room 2: E/W Dirt Road 25 [-1, -1, 3, 1, -1, -1, -1, -1, -1, -1, -1, -1], 26 27 // Room 3: Fork 28 [-1, -1, -1, 2, 4, 6, -1, -1, -1, -1, -1, -1], 29 30 // Room 4: NE/SW Road 31 [-1, -1, -1, -1, 5, -1, -1, 3, -1, -1, -1, -1], 32 33 // Room 5: Building Front 34 [-1, -1, -1, -1, -1, -1, -1, 4, -1, -1, 255, -1], // IN = building entrance (special) 35 36 // Room 6: SE/NW Road 37 [-1, -1, -1, -1, -1, 7, 3, -1, -1, -1, -1, -1], 38 39 // Room 7: Bear Hangout 40 [-1, -1, -1, -1, -1, 255, 6, 27, -1, -1, -1, -1], // SE = cave entrance (special) 41 42 // Room 8: Old Building Hallway 43 [255, 5, 9, 10, -1, -1, -1, 5, -1, -1, -1, 5], 44 45 // Room 9: Mailroom 46 [-1, -1, -1, 8, -1, -1, -1, -1, -1, -1, -1, -1], 47 48 // Room 10: Computer Room 49 [-1, -1, 8, -1, -1, -1, -1, -1, -1, -1, -1, -1], 50 51 // Room 11: Meadow 52 [-1, 8, -1, 58, -1, -1, -1, -1, -1, -1, -1, -1], 53 54 // Room 12: Receiving Room 55 [-1, -1, 13, -1, -1, -1, -1, -1, -1, -1, -1, -1], 56 57 // Room 13: N/S Hallway 58 [15, -1, 14, 12, -1, -1, -1, -1, -1, -1, -1, -1], 59 60 // Room 14: Sauna 61 [-1, -1, -1, 13, -1, -1, -1, -1, -1, -1, -1, -1], 62 63 // Room 15: End N/S Hallway 64 [-1, 13, 16, -1, -1, -1, -1, -1, -1, -1, -1, -1], 65 66 // Room 16: Weight Room 67 [-1, -1, -1, 15, -1, -1, -1, -1, -1, 17, -1, -1], 68 69 // Room 17: Maze Button Room 70 [-1, -1, 17, 17, 17, 17, 255, 17, 255, 17, -1, -1], 71 // NW and D have special handling (button weight puzzle) 72 73 // Room 18: Maze 74 [18, 18, 18, 18, 18, -1, 18, 18, 19, 18, -1, -1], 75 76 // Room 19: Maze 77 [-1, 18, 18, 19, 19, 20, 19, 19, -1, 18, -1, -1], 78 79 // Room 20: Maze 80 [-1, -1, -1, 18, -1, -1, -1, -1, -1, 21, -1, -1], 81 82 // Room 21: Maze 83 [-1, -1, -1, -1, -1, 20, 22, -1, -1, -1, -1, -1], 84 85 // Room 22: Maze 86 [18, 18, 18, 18, 16, 18, 23, 18, 18, 18, 18, 18], 87 88 // Room 23: Reception Area 89 [-1, 255, -1, -1, -1, 19, -1, -1, -1, -1, -1, -1], 90 91 // Room 24: Health Club Front 92 [23, 25, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1], 93 94 // Room 25: Lakefront North 95 [24, 255, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1], 96 97 // Room 26: Lakefront South 98 [255, 28, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1], 99 100 // Room 27: Hidden Area 101 [-1, -1, -1, -1, 7, -1, -1, -1, -1, -1, -1, -1], 102 103 // Room 28: Cave Entrance 104 [26, 255, -1, -1, -1, -1, -1, -1, -1, -1, 255, -1], 105 106 // Room 29: Misty Room 107 [-1, -1, 30, -1, -1, -1, -1, -1, -1, -1, -1, -1], 108 109 // Room 30: Cave E/W Passage 110 [-1, -1, 31, 29, -1, -1, -1, -1, -1, -1, -1, -1], 111 112 // Room 31: N/S/W Junction 113 [32, 33, -1, 30, -1, -1, -1, -1, -1, -1, -1, -1], 114 115 // Room 32: North End of Cave Passage 116 [-1, 31, -1, 255, -1, -1, -1, -1, -1, 34, -1, -1], 117 118 // Room 33: South End of Cave Passage 119 [31, -1, -1, -1, -1, -1, -1, -1, -1, 35, -1, -1], 120 121 // Room 34: Bedroom 122 [-1, 35, -1, -1, -1, -1, -1, -1, 32, 37, -1, -1], 123 124 // Room 35: Bathroom 125 [34, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1], 126 127 // Room 36: Urinal (internal) 128 [-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1], 129 130 // Room 37: NE End of NE/SW Passage 131 [-1, -1, -1, -1, -1, -1, -1, 38, 34, -1, -1, -1], 132 133 // Room 38: NE/SW-E/W Junction 134 [-1, -1, 40, 41, 37, -1, -1, 39, -1, -1, -1, -1], 135 136 // Room 39: SW End of NE/SW Passage 137 [-1, -1, -1, -1, 38, -1, -1, -1, -1, -1, -1, -1], 138 139 // Room 40: East End of E/W Passage 140 [-1, -1, -1, 38, -1, -1, -1, -1, 42, -1, -1, -1], 141 142 // Room 41: West End of E/W Passage 143 [-1, -1, 38, -1, -1, -1, -1, -1, -1, 43, -1, -1], 144 145 // Room 42: Horseshoe Boulder Room 146 [-1, -1, -1, -1, -1, -1, -1, -1, -1, 40, -1, -1], 147 148 // Room 43: Empty Room 149 [44, -1, 46, -1, -1, -1, -1, -1, -1, -1, -1, -1], 150 151 // Room 44: Blue Room 152 [-1, 43, 45, -1, -1, -1, -1, -1, -1, -1, -1, -1], 153 154 // Room 45: Yellow Room 155 [-1, 46, -1, 44, -1, -1, -1, -1, -1, -1, -1, -1], 156 157 // Room 46: Red Room 158 [45, -1, -1, 43, -1, -1, -1, -1, -1, 255, -1, -1], // Down = hole (special) 159 160 // Room 47: Long N/S Hallway 161 [48, 50, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1], 162 163 // Room 48: 3/4 North 164 [49, 47, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1], 165 166 // Room 49: North End of Long Hallway 167 [-1, 48, -1, -1, -1, -1, -1, -1, 52, -1, -1, -1], 168 169 // Room 50: 3/4 South 170 [47, 51, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1], 171 172 // Room 51: South End of Long Hallway 173 [50, 104, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1], 174 175 // Room 52: Stair Landing 176 [-1, -1, -1, -1, -1, -1, -1, -1, 53, 49, -1, -1], 177 178 // Room 53: Up/Down Staircase 179 [-1, -1, -1, -1, -1, -1, -1, -1, 54, 52, -1, -1], 180 181 // Room 54: Top of Staircase 182 [-1, -1, -1, -1, 55, -1, -1, -1, -1, 53, -1, -1], 183 184 // Room 55: NE Crawlway 185 [-1, -1, -1, -1, 56, -1, -1, 54, -1, -1, -1, 54], 186 187 // Room 56: Small Crawlspace 188 [-1, -1, -1, -1, -1, -1, -1, 55, -1, 31, -1, -1], 189 190 // Room 57: Gamma Computing Center 191 [-1, -1, 32, -1, -1, -1, -1, -1, -1, -1, -1, -1], 192 193 // Room 58: Post Office 194 [59, -1, 11, -1, -1, -1, -1, -1, -1, -1, 255, 255], 195 196 // Room 59: Main-Maple Intersection 197 [60, 58, 63, -1, -1, -1, 255, -1, -1, -1, 255, 255], 198 199 // Room 60: Main-Oaktree Intersection 200 [61, 59, 64, -1, -1, -1, -1, -1, -1, -1, 255, 255], 201 202 // Room 61: Main-Vermont Intersection 203 [62, 60, 65, -1, -1, -1, -1, -1, -1, -1, 255, 255], 204 205 // Room 62: Main-Sycamore Intersection 206 [-1, 61, 66, -1, -1, -1, -1, -1, -1, -1, 255, 255], 207 208 // Room 63: First-Maple Intersection 209 [64, -1, 67, 59, -1, -1, -1, -1, -1, -1, 255, 255], 210 211 // Room 64: First-Oaktree Intersection 212 [65, 63, 68, 60, -1, -1, -1, -1, -1, -1, 255, 255], 213 214 // Room 65: First-Vermont Intersection 215 [66, 64, 69, 61, -1, -1, -1, -1, -1, -1, 255, 255], 216 217 // Room 66: First-Sycamore Intersection 218 [-1, 65, 70, 62, -1, -1, -1, -1, -1, -1, 255, 255], 219 220 // Room 67: Second-Maple Intersection 221 [68, -1, 71, 63, -1, -1, -1, -1, -1, -1, 255, 255], 222 223 // Room 68: Second-Oaktree Intersection 224 [69, 67, 72, 64, -1, -1, -1, -1, -1, -1, 255, 255], 225 226 // Room 69: Second-Vermont Intersection 227 [70, 68, 73, 65, -1, -1, -1, -1, -1, -1, 255, 255], 228 229 // Room 70: Second-Sycamore Intersection 230 [-1, 69, 74, 66, -1, -1, -1, -1, -1, -1, 255, 255], 231 232 // Room 71: Third-Maple Intersection 233 [72, -1, 75, 67, -1, -1, -1, -1, -1, -1, 255, 255], 234 235 // Room 72: Third-Oaktree Intersection 236 [73, 71, 76, 68, -1, -1, -1, -1, -1, -1, 255, 255], 237 238 // Room 73: Third-Vermont Intersection 239 [74, 72, 77, 69, -1, -1, -1, -1, -1, -1, 255, 255], 240 241 // Room 74: Third-Sycamore Intersection 242 [-1, 73, 78, 70, -1, -1, -1, -1, -1, -1, 255, 255], 243 244 // Room 75: Fourth-Maple Intersection 245 [76, -1, 79, 71, -1, -1, -1, -1, -1, -1, 255, 255], 246 247 // Room 76: Fourth-Oaktree Intersection 248 [77, 75, 80, 72, -1, -1, -1, -1, -1, -1, 255, 255], 249 250 // Room 77: Fourth-Vermont Intersection 251 [78, 76, 81, 73, -1, -1, -1, -1, -1, -1, 255, 255], 252 253 // Room 78: Fourth-Sycamore Intersection 254 [-1, 77, 82, 74, -1, -1, -1, -1, -1, -1, 255, 255], 255 256 // Room 79: Fifth-Maple Intersection 257 [80, -1, -1, 75, -1, -1, -1, -1, -1, -1, 255, 255], 258 259 // Room 80: Fifth-Oaktree Intersection 260 [81, 79, 255, 76, -1, -1, -1, -1, -1, -1, 255, 255], // East = cliff (special) 261 262 // Room 81: Fifth-Vermont Intersection 263 [82, 80, -1, 77, -1, -1, -1, -1, -1, -1, 255, 255], 264 265 // Room 82: Fifth-Sycamore Intersection 266 [-1, 81, -1, 78, -1, -1, -1, -1, -1, -1, 255, 255], 267 268 // Room 83: Museum Entrance 269 [84, -1, -1, -1, -1, 59, -1, -1, -1, -1, 255, 255], 270 271 // Room 84: Museum Lobby 272 [-1, 83, 85, -1, -1, -1, -1, -1, -1, -1, -1, -1], 273 274 // Room 85: Geological Display 275 [86, -1, 87, 84, -1, -1, -1, -1, -1, -1, -1, -1], 276 277 // Room 86: Marine Life Area 278 [-1, 85, 88, -1, -1, -1, -1, -1, -1, -1, -1, -1], 279 280 // Room 87: Maintenance Room 281 [88, -1, -1, 85, -1, -1, -1, -1, -1, -1, -1, -1], 282 283 // Room 88: Classroom 284 [-1, 87, 255, 86, -1, -1, -1, -1, -1, -1, -1, -1], // East = locked (special) 285 286 // Room 89: Vermont Station 287 [-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 255, -1], 288 289 // Room 90: Museum Station 290 [91, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1], 291 292 // Room 91: N/S Tunnel 293 [92, 90, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1], 294 295 // Room 92: North End of N/S Tunnel 296 [-1, 91, -1, -1, -1, -1, -1, -1, 93, 94, -1, -1], 297 298 // Room 93: Top of Subway Stairs 299 [-1, -1, -1, 88, -1, -1, -1, -1, -1, 92, -1, -1], 300 301 // Room 94: Bottom of Subway Stairs 302 [-1, -1, -1, -1, 95, -1, -1, -1, 92, -1, -1, -1], 303 304 // Room 95: Endgame Computer Room 305 [-1, -1, -1, -1, -1, -1, -1, 94, -1, -1, -1, -1], 306 307 // Room 96: Endgame N/S Hallway 308 [97, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1], 309 310 // Room 97: Question Room 1 311 [-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1], 312 313 // Room 98: Endgame N/S Hallway 314 [99, 97, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1], 315 316 // Room 99: Question Room 2 317 [-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1], 318 319 // Room 100: Endgame N/S Hallway 320 [101, 99, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1], 321 322 // Room 101: Question Room 3 323 [-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1], 324 325 // Room 102: Endgame Treasure Room 326 [103, 101, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1], 327 328 // Room 103: Winner's Room 329 [-1, 102, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1], 330 331 // Room 104: PC Area 332 [51, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1], 333 ]; 334 335 /** 336 * Rooms that are always lit (no lamp needed) 337 */ 338 export const LIGHT_ROOMS: Set<number> = new Set([ 339 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 24, 25, 26, 27, 28, 58, 59, 340 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83 341 ]); 342 343 /** 344 * Initial room objects 345 */ 346 export function createInitialRoomObjects(): Map<number, number[]> { 347 return new Map([ 348 [0, []], // Treasure room (empty initially) 349 [1, [-1, -2]], // Dead end: boulder, trees 350 [2, [-2]], // E/W Dirt: trees 351 [3, []], // Fork 352 [4, []], // NE/SW Road 353 [5, []], // Building Front 354 [6, [3]], // SE/NW Road: food 355 [7, [-3]], // Bear Hangout: bear 356 [8, []], // Old Building Hallway 357 [9, [-4]], // Mailroom: bins 358 [10, [-5, 0, 16, 15]], // Computer Room: computer, shovel, license, silver 359 [11, [1, 16, 15]], // Meadow: lamp, license, silver 360 [12, []], // Receiving Room 361 [13, []], // N/S Hallway 362 [14, [-7]], // Sauna: dial 363 [15, []], // End N/S Hallway 364 [16, [8, 9]], // Weight Room: weight, life preserver 365 [17, [-8]], // Maze Button Room: button 366 [18, []], // Maze 367 [19, [6, 27]], // Maze (thirsty): RMS statuette, floppy 368 [20, []], // Maze 369 [21, []], // Maze (daze) 370 [22, []], // Maze (cabbages) 371 [23, []], // Reception Area 372 [24, []], // Health Club Front 373 [25, [-32]], // Lakefront North: lake 374 [26, [-32]], // Lakefront South: lake 375 [27, [10]], // Hidden Area: emerald 376 [28, [-9, 11]], // Cave Entrance: chute, gold 377 [29, [11]], // Misty Room: gold 378 [30, []], // Cave E/W Passage 379 [31, []], // N/S/W Junction 380 [32, []], // North End of Cave Passage 381 [33, []], // South End of Cave Passage 382 [34, [-10, -11]], // Bedroom: painting, bed 383 [35, [-12, -14]], // Bathroom: urinal, pipes 384 [36, []], // Urinal (hidden) 385 [37, []], // NE End of NE/SW Passage 386 [38, []], // NE/SW-E/W Junction 387 [39, []], // SW End of NE/SW Passage 388 [40, []], // East End of E/W Passage 389 [41, []], // West End of E/W Passage 390 [42, [-1]], // Horseshoe Boulder Room: boulder 391 [43, []], // Empty Room 392 [44, []], // Blue Room 393 [45, []], // Yellow Room 394 [46, [13]], // Red Room: towel 395 [47, []], // Long N/S Hallway 396 [48, []], // 3/4 North 397 [49, []], // North End of Long Hallway 398 [50, []], // 3/4 South 399 [51, []], // South End of Long Hallway 400 [52, [-15]], // Stair Landing: key box 401 [53, []], // Up/Down Staircase 402 [54, []], // Top of Staircase 403 [55, []], // NE Crawlway 404 [56, [14]], // Small Crawlspace: axe 405 [57, [-5, -16]], // Gamma Computing Center: computer, cable 406 [58, [-17]], // Post Office: mail 407 [59, [-19]], // Main-Maple: gate 408 [60, []], // Main-Oaktree 409 [61, []], // Main-Vermont 410 [62, []], // Main-Sycamore 411 [63, []], // First-Maple 412 [64, []], // First-Oaktree 413 [65, []], // First-Vermont 414 [66, []], // First-Sycamore 415 [67, []], // Second-Maple 416 [68, []], // Second-Oaktree 417 [69, []], // Second-Vermont 418 [70, []], // Second-Sycamore 419 [71, []], // Third-Maple 420 [72, []], // Third-Oaktree 421 [73, []], // Third-Vermont 422 [74, []], // Third-Sycamore 423 [75, []], // Fourth-Maple 424 [76, []], // Fourth-Oaktree 425 [77, []], // Fourth-Vermont 426 [78, []], // Fourth-Sycamore 427 [79, []], // Fifth-Maple 428 [80, [-20]], // Fifth-Oaktree: cliff 429 [81, [17]], // Fifth-Vermont: coins 430 [82, [-18]], // Fifth-Sycamore: bus 431 [83, []], // Museum Entrance 432 [84, [-21, 20]], // Museum Lobby: skeleton, bone 433 [85, []], // Geological Display 434 [86, [-22, -23, 19, 23]], // Marine Life Area: fish, tanks, jar, ruby 435 [87, [-24, 21]], // Maintenance Room: switch, nitric 436 [88, [-25, 22]], // Classroom: blackboard, glycerine 437 [89, [-28]], // Vermont Station: train 438 [90, []], // Museum Station 439 [91, []], // N/S Tunnel 440 [92, [-26, 24]], // North End of N/S Tunnel: disposal, amethyst 441 [93, []], // Top of Subway Stairs 442 [94, []], // Bottom of Subway Stairs 443 [95, [-5]], // Endgame Computer Room: computer 444 [96, []], // Endgame N/S Hallway 445 [97, []], // Question Room 1 446 [98, []], // Endgame N/S Hallway 447 [99, []], // Question Room 2 448 [100, []], // Endgame N/S Hallway 449 [101, []], // Question Room 3 450 [102, []], // Endgame Treasure Room 451 [103, [25]], // Winner's Room: Mona Lisa 452 [104, [-29]], // PC Area: PC 453 ]); 454 } 455 456 /** 457 * Rooms where you can dig 458 */ 459 export function createDiggables(): Map<number, number[]> { 460 return new Map([ 461 [3, [2]], // Fork: CPU card 462 [41, [12]], // West End: platinum bar 463 ]); 464 } 465 466 /** 467 * Generate random 3-digit combination for cave entrance 468 */ 469 export function generateCombination(): string { 470 const num = 100 + Math.floor(Math.random() * 900); 471 return num.toString(); 472 }