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 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 | 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 5x 5x 5x 5x 5x 5x 5x 5x 5x 5x 5x 5x 5x 5x 5x 5x 5x 5x 5x 5x 5x 5x 5x 5x 5x 4x 59x 30x 59x 29x 29x 59x 4x 4x 34x 34x 4x 4x 5x 5x 4x 4x 39x 39x 4x 4x 40x 40x 4x 4x 38x 38x 4x 5x 5x 5x 5x 5x 5x 5x 5x 5x 5x 5x 5x 5x 5x 5x 5x 5x 5x 5x 5x 5x 5x 5x 5x 5x 5x 5x 5x 5x 5x 5x 5x 5x 5x 5x 5x 5x 5x 5x 5x 5x 5x 5x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 5x 5x 5x 5x 5x 5x 5x 5x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 5x 5x 5x 5x 2x 2x 2x 5x 5x 5x 5x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 5x 5x 5x 5x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 5x 5x 5x 5x 5x 5x 5x 5x 5x 5x 5x 5x 5x 5x 4x 4x 4x 4x 5x 5x 4x 4x 4x 4x 4x 4x 4x 5x | /**
* hellfill - NetHack special level
* Converted from: hellfill.lua
*/
import * as des from '../sp_lev.js';
import { selection, percent, shuffle, u, hell_tweaks } from '../sp_lev.js';
import { rn2, rnd } from '../rng.js';
export async function generate() {
// NetHack 3.7 hellfill.des $NHDT-Date: 1432512783 2015/5/25 0:13:3 $ $NHDT-Branch: master $:$NHDT-Revision: 1.25 $
// Copyright (c) 2022 by Pasi Kallinen
// NetHack may be freely redistributed. See license for details.
//
//
// The "fill" level for gehennom.
//
// This level is used to fill out any levels not occupied by
// specific levels.
//
async function hellobjects() {
let objclass = [ "(", "/", "=", "+", ")", "[", "?", "*", "%" ];
shuffle(objclass);
await des.object(objclass[0]);
await des.object(objclass[0]);
await des.object(objclass[1]);
await des.object(objclass[2]);
await des.object(objclass[3]);
await des.object(objclass[4]);
await des.object();
await des.object();
}
//
async function hellmonsters() {
let monclass = [ "V", "D", " ", "&", "Z" ];
shuffle(monclass);
await des.monster({ class: monclass[0], peaceful: 0 });
await des.monster({ class: monclass[0], peaceful: 0 });
await des.monster({ class: monclass[1], peaceful: 0 });
await des.monster({ class: monclass[1], peaceful: 0 });
await des.monster({ class: monclass[2], peaceful: 0 });
await des.monster({ class: monclass[3], peaceful: 0 });
await des.monster({ peaceful: 0 });
await des.monster({ class: "H", peaceful: 0 });
}
//
async function helltraps() {
for (let i = 1, __end_i = 12; i <= __end_i; i++) {
await des.trap();
}
}
//
async function populatemaze() {
for (let i = 1, __end_i = (rn2(8) + 1) + 11; i <= __end_i; i++) {
if ((percent(50))) {
await des.object("*");
} else {
await des.object();
}
}
for (let i = 1, __end_i = (rn2(10) + 1) + 2; i <= __end_i; i++) {
await des.object("`");
}
for (let i = 1, __end_i = (rn2(3) + 1); i <= __end_i; i++) {
await des.monster({ id: "minotaur", peaceful: 0 });
}
for (let i = 1, __end_i = (rn2(5) + 1) + 7; i <= __end_i; i++) {
await des.monster({ peaceful: 0 });
}
for (let i = 1, __end_i = (rn2(6) + 1) + 7; i <= __end_i; i++) {
des.gold();
}
for (let i = 1, __end_i = (rn2(6) + 1) + 7; i <= __end_i; i++) {
await des.trap();
}
}
//
function rnd_halign() {
let aligns = [ "half-left", "center", "half-right" ];
// return aligns[rn2(aligns.length)];
}
function rnd_valign() {
let aligns = [ "top", "center", "bottom" ];
// return aligns[rn2(aligns.length)];
}
// the prefab maps must have contents-async function, or populatemaze()
// puts the stuff only inside the prefab map.
// contains either a async function, or an object with "repeatable" and "contents".
// async function alone implies not repeatable.
let hell_prefabs = [
{
repeatable: true,
contents: async function() {
await des.map({ halign: rnd_halign(), valign: "center", map: `\
......
......
......
......
......
......
......
......
......
......
......
......
......
......
......
......`, contents: async function() { } });
}
},
{
repeatable: true,
contents: async function() {
await des.map({ halign: rnd_halign(), valign: "center", map: `\
xxxxxx.....xxxxxx
xxxx.........xxxx
xx.............xx
xx.............xx
x...............x
x...............x
.................
.................
.................
.................
.................
x...............x
x...............x
xx.............xx
xx.............xx
xxxx.........xxxx
xxxxxx.....xxxxxx
`, contents: async function() { } });
}
},
async function(coldhell) {
await des.map({ halign: rnd_halign(), valign: rnd_valign(), map: `\
xxxxxx.xxxxxx
xLLLLLLLLLLLx
xL---------Lx
xL|.......|Lx
xL|.......|Lx
.L|.......|L.
xL|.......|Lx
xL|.......|Lx
xL---------Lx
xLLLLLLLLLLLx
xxxxxx.xxxxxx
`, contents: async function() {
des.non_diggable(selection.area(2,2, 10,8));
await des.region(selection.area(4,4, 8,6), "lit");
des.exclusion({ type: "teleport", region: [ 2,2, 10,8 ] });
if ((coldhell)) {
des.replace_terrain({ region: [1,1, 11,9], fromterrain: "L", toterrain: "P" });
}
let dblocs = [
{ x: 1, y: 5, dir: "east", state: "closed" },
{ x: 11, y: 5, dir: "west", state: "closed" },
{ x: 6, y: 1, dir: "south", state: "closed" },
{ x: 6, y: 9, dir: "north", state: "closed" }
]
shuffle(dblocs);
for (let i = 1, __end_i = (rn2((dblocs.length) - (1) + 1) + (1)); i <= __end_i; i++) {
des.drawbridge(dblocs[i - 1]);
}
let mons = [ "H", "T", "@" ];
shuffle(mons);
for (let i = 1, __end_i = 3 + (rn2((5) - (1) + 1) + (1)); i <= __end_i; i++) {
await des.monster(mons[0], 6, 5);
}
} });
},
{
repeatable: true,
contents: async function() {
await des.map({ halign: "center", valign: "center", map: `\
..............................................................
..............................................................
..............................................................
..............................................................
..............................................................`, contents: async function() { } });
}
},
{
repeatable: true,
contents: async function() {
await des.map({ halign: rnd_halign(), valign: rnd_valign(), lit: true, map: `\
x.....x
.......
.......
.......
.......
.......
x.....x`, contents: async function() { } });
}
},
async function() {
await des.map({ halign: rnd_halign(), valign: rnd_valign(), map: `\
BBBBBBB
B.....B
B.....B
B.....B
B.....B
B.....B
BBBBBBB`, contents: async function() {
await des.region({ region: [2,2, 2,2], type: "temple", filled: 1, irregular: 1 });
await des.altar({ x: 3, y: 3, align: "noalign", type: percent(75) && "altar" || "shrine" });
} });
},
async function() {
await des.map({ halign: rnd_halign(), valign: rnd_valign(), map: `\
..........
..........
..........
...FFFF...
...F..F...
...F..F...
...FFFF...
..........
..........
..........`, contents: async function() {
des.exclusion({ type: "teleport", region: [ 4,4, 5,5 ] });
let mons = [ "Angel", "D", "H", "L" ];
await des.monster(mons[rn2(mons.length)], 4,4);
} });
},
async function() {
await des.map({ halign: rnd_halign(), valign: rnd_valign(), map: `\
.........
.}}}}}}}.
.}}---}}.
.}--.--}.
.}|...|}.
.}--.--}.
.}}---}}.
.}}}}}}}.
.........
`, contents: async function(rm) {
des.exclusion({ type: "teleport", region: [ 3,3, 5,5 ] });
await des.monster("L",4,4);
} })
},
async function() {
let mapstr = percent(30) && `\
.....
.LLL.
.LZL.
.LLL.
.....` || `\
.....
.PPP.
.PWP.
.PPP.
.....`;
for (let dx = 1, __end_dx = 5; dx <= __end_dx; dx++) {
await des.map({ x: dx*14 - 4, y: (rn2((15) - (3) + 1) + (3)),
map: mapstr, contents: async function() { } })
}
},
{
repeatable: true,
contents: async function() {
let mapstr = `\
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...`;
for (let dx = 1, __end_dx = 3; dx <= __end_dx; dx++) {
await des.map({ x: (rn2((75) - (3) + 1) + (3)), y: 3,
map: mapstr, contents: async function() { } })
}
}
},
];
function rnd_hell_prefab(coldhell) {
let dorepeat = true;
let nloops = 0;
repeat
nloops = nloops + 1;
let pf = rn2(hell_prefabs.length);
let fab = hell_prefabs[pf];
let fabtype = type(fab);
if ((fabtype == "async function")) {
fab(coldhell);
dorepeat = false;
} else if ((fabtype == "table")) {
fab.contents(coldhell);
dorepeat = ! (fab.repeatable && (rn2((nloops * 2) - (0) + 1) + (0)) == 0);
}
until ((! dorepeat) || (nloops > 5));
}
let hells = [
// 1: "mines" style with lava
async function() {
des.level_init({ style: "solidfill", fg: " ", lit: 0 });
des.level_flags("mazelevel", "noflip");
des.level_init({ style: "mines", fg: ".", smoothed: true ,joined: true, lit: 0, walled: true });
des.replace_terrain({ fromterrain: " ", toterrain: "L" });
des.replace_terrain({ fromterrain: ".", toterrain: "L", chance: 5 });
des.replace_terrain({ mapfragment: `w`, toterrain: "L", chance: 20 });
des.replace_terrain({ mapfragment: `w`, toterrain: ".", chance: 15 });
},
// 2: mazes like original, with some hell_tweaks
async function() {
des.level_init({ style: "solidfill", fg: " ", lit: 0 });
des.level_flags("mazelevel", "noflip");
des.level_init({ style: "mazegrid", bg: "-" });
await des.mazewalk({ coord: [1,10], dir: "east", stocked: false});
let tmpbounds = selection.match("-");
let bnds = tmpbounds.bounds();
let protected_area = selection.fillrect(bnds.lx, bnds.ly + 1, bnds.hx - 2, bnds.hy - 1);
await hell_tweaks(protected_area.negate());
if ((percent(25))) {
rnd_hell_prefab(false);
}
},
// 3: mazes, style 1: wall thick = 1, random wid corr
async function() {
des.level_init({ style: "solidfill", fg: " ", lit: 0 });
des.level_flags("mazelevel", "noflip");
des.level_init({ style: "maze", wallthick: 1 });
},
// 4: mazes, style 2: replace wall with iron bars or lava
async function() {
let cwid = (rn2(4) + 1);
des.level_init({ style: "solidfill", fg: " ", lit: 0 });
des.level_flags("mazelevel", "noflip");
des.level_init({ style: "maze", wallthick: 1, corrwid: cwid });
let outside_walls = selection.match(" ");
let wallterrain = [ "F", "L" ];
shuffle(wallterrain);
des.replace_terrain({ mapfragment: "w", toterrain: wallterrain[0] });
if ((cwid == 1)) {
if ((wallterrain[0] == "F" && percent(80))) {
// replace some horizontal iron bars walls with floor
des.replace_terrain({ mapfragment: ".\nF\n.", toterrain: ".", chance: 25 * (rn2(4) + 1) });
} else if ((percent(25))) {
rnd_hell_prefab(false);
}
}
des.terrain(outside_walls, " "); // return the outside back to solid wall;
},
// 5: mazes, thick walls, occasionally lava instead of walls
async function() {
let wwid = 1 + (rn2(2) + 1);
des.level_init({ style: "solidfill", fg: " ", lit: 0 });
des.level_flags("mazelevel", "noflip");
des.level_init({ style: "maze", wallthick: wwid, corrwid: (rn2(2) + 1) });
if ((percent(50))) {
let outside_walls = selection.match(" ");
des.replace_terrain({ mapfragment: "w", toterrain: "L" });
des.terrain(outside_walls, " "); // return the outside back to solid wall;
if ((wwid == 3 && percent(40))) {
let sel = selection.match("LLL\nLLL\nLLL");
des.terrain(sel.percentage(30 * (rn2(4) + 1)), "Z");
}
}
},
// 6: cold maze, with ice and water
async function() {
let cwid = (rn2(4) + 1);
des.level_init({ style: "solidfill", fg: " ", lit: 0 });
des.level_flags("mazelevel", "noflip", "cold");
des.level_init({ style: "maze", wallthick: 1, corrwid: cwid });
let outside_walls = selection.match(" ");
let icey = selection.negate().percentage(10).grow().filter_mapchar(".");
des.terrain(icey, "I");
if ((cwid > 1)) {
// turn some ice into wall of water
des.terrain(icey.percentage(1), "W");
}
des.terrain(icey.percentage(5), "P");
if ((percent(25))) {
des.terrain(selection.match("w"), "W"); // walls of water;
}
if ((cwid == 1 && percent(25))) {
rnd_hell_prefab(true);
}
des.terrain(outside_walls, " "); // return the outside back to solid wall;
},
// 7: open cavern, "mines" with more space
async function() {
// walls are either stone or lava
let wter = percent(50) && " " || "L";
des.level_init({ style: "solidfill", fg: " ", lit: 0 });
des.level_flags("mazelevel", "noflip");
des.level_init({ style: "mines", fg: ".", bg: wter, smoothed: true ,joined: true, lit: 0 });
let sel = selection.match(".").grow();
des.terrain({ selection: sel, typ: ".", lit: 0 });
let border = selection.rect(0,0, 78, 20);
des.terrain({ selection: border, typ: wter, lit: 0 });
des.wallify();
},
];
let hellno = rn2(hells.length);
await hells[hellno]();
//
des.stair("up");
if ((u.invocation_level)) {
await des.trap("vibrating square");
} else {
des.stair("down");
}
await populatemaze();
return des.finalize_level();
}
|