mirror of
https://github.com/jparkerweb/plan2code.git
synced 2026-11-16 20:45:33 -08:00
Move Ghoul Rush into activities/ghoul-rush/ and split ghoul.js
Every Ghoul Rush file moves under activities/ghoul-rush/, sorted into core, arms, draw, story, sfx, stages/<stage> and rides/<ride>, with names unchanged. ghoul.js is now a facade over seven parts in core/, taking it from over the 3,000 line cap to 50 lines. Also in this tree: the Drowned Lantern replaces the Bog Runner, the "Use a Lucky Die?" question, the Old Mother Bog rework, Rapid fire at 60 ms, the rules for the finale's first kill (not plugged in yet), and small fixes the suites asked for (the Stilt House's and Drowning Pool's weapons). AI Assisted
This commit is contained in:
1 parent
0454bdd19a
commit
903fbf5680
160 files changed
+11022
-7061
No files matched your search
@@ -1,14 +1,14 @@
|
||||
// Web console tests, Ghoul Rush's secondary weapons: the double tap that uses one (hammering spends one at most, a hold carries on as bolts), the bag and its HUD pill, what each weapon does, what they may do to a boss, where they are placed and how they drop, and that all of it draws and sounds.
|
||||
import { test } from "node:test";
|
||||
import assert from "node:assert/strict";
|
||||
import * as ghoul from "../src/web-console/public/activities/ghoul.js";
|
||||
import * as arm from "../src/web-console/public/activities/ghoul-arms.js";
|
||||
import { rocketArt } from "../src/web-console/public/activities/ghoul-rockets-draw.js";
|
||||
import * as pans from "../src/web-console/public/activities/ghoul-pans.js";
|
||||
import { ARM_DROP, ARM_DROP_OWN, STAGE_ARMS, armDrop, pickPower } from "../src/web-console/public/activities/ghoul-powers.js";
|
||||
import { ARMS_SFX } from "../src/web-console/public/activities/ghoul-sfx-arms.js";
|
||||
import * as ghoulSfx from "../src/web-console/public/activities/ghoul-sfx.js";
|
||||
import { hudLayout, react } from "../src/web-console/public/activities/ghoul-draw.js";
|
||||
import * as ghoul from "../src/web-console/public/activities/ghoul-rush/ghoul.js";
|
||||
import * as arm from "../src/web-console/public/activities/ghoul-rush/arms/ghoul-arms.js";
|
||||
import { rocketArt } from "../src/web-console/public/activities/ghoul-rush/arms/ghoul-rockets-draw.js";
|
||||
import * as pans from "../src/web-console/public/activities/ghoul-rush/arms/ghoul-pans.js";
|
||||
import { ARM_DROP, ARM_DROP_OWN, STAGE_ARMS, armDrop, pickPower } from "../src/web-console/public/activities/ghoul-rush/core/ghoul-powers.js";
|
||||
import { ARMS_SFX } from "../src/web-console/public/activities/ghoul-rush/arms/ghoul-sfx-arms.js";
|
||||
import * as ghoulSfx from "../src/web-console/public/activities/ghoul-rush/sfx/ghoul-sfx.js";
|
||||
import { hudLayout, react } from "../src/web-console/public/activities/ghoul-rush/draw/ghoul-draw.js";
|
||||
|
||||
const steady = () => 0.5;
|
||||
const events = (round, type) => round.events.filter((e) => e.type === type);
|
||||
|
||||
@@ -2,15 +2,15 @@
|
||||
// Run with: node --test scripts/test-web-console-activities-ghoul-banister.mjs
|
||||
import { test } from "node:test";
|
||||
import assert from "node:assert/strict";
|
||||
import * as ghoul from "../src/web-console/public/activities/ghoul.js";
|
||||
import * as ghoul from "../src/web-console/public/activities/ghoul-rush/ghoul.js";
|
||||
import { skipBossIntro } from "./ghoul-test-helpers.mjs";
|
||||
import * as bn from "../src/web-console/public/activities/ghoul-banister.js";
|
||||
import * as ct from "../src/web-console/public/activities/ghoul-cart.js";
|
||||
import { EVENT_VOICE, LOSE_SOUNDS, LOSE_WORDS, LOOKS as BAN_LOOKS, VOICES as BAN_VOICES, telegraphMarks, telegraphs } from "../src/web-console/public/activities/ghoul-banister-draw.js";
|
||||
import { BANISTER_SFX } from "../src/web-console/public/activities/ghoul-sfx-banister.js";
|
||||
import * as ghoulSfx from "../src/web-console/public/activities/ghoul-sfx.js";
|
||||
import { LOOKS, VOICES, bonusTick, react } from "../src/web-console/public/activities/ghoul-draw.js";
|
||||
import { BONUS_FLOOR, diceFor, endBonus, makeBonus } from "../src/web-console/public/activities/ghoul-bonus.js";
|
||||
import * as bn from "../src/web-console/public/activities/ghoul-rush/rides/banister/ghoul-banister.js";
|
||||
import * as ct from "../src/web-console/public/activities/ghoul-rush/rides/cart/ghoul-cart.js";
|
||||
import { EVENT_VOICE, LOSE_SOUNDS, LOSE_WORDS, LOOKS as BAN_LOOKS, VOICES as BAN_VOICES, telegraphMarks, telegraphs } from "../src/web-console/public/activities/ghoul-rush/rides/banister/ghoul-banister-draw.js";
|
||||
import { BANISTER_SFX } from "../src/web-console/public/activities/ghoul-rush/rides/banister/ghoul-sfx-banister.js";
|
||||
import * as ghoulSfx from "../src/web-console/public/activities/ghoul-rush/sfx/ghoul-sfx.js";
|
||||
import { LOOKS, VOICES, bonusTick, react } from "../src/web-console/public/activities/ghoul-rush/draw/ghoul-draw.js";
|
||||
import { BONUS_FLOOR, diceFor, endBonus, makeBonus } from "../src/web-console/public/activities/ghoul-rush/core/ghoul-bonus.js";
|
||||
|
||||
const steady = () => 0.5;
|
||||
// The pack draws no random number: a run on this fails on the first draw.
|
||||
@@ -743,7 +743,7 @@ test("Ghoul Rush's Grand Banister: off the lip the rider launches, lands on the
|
||||
assert.equal(end.length, 1);
|
||||
assert.equal(end[0].won, true);
|
||||
assert.ok(end[0].dice >= BONUS_FLOOR && end[0].dice <= ghoul.MAX_DICE, `${end[0].dice} dice`);
|
||||
assert.equal(round.dice, Math.min(ghoul.MAX_DICE, 1 + end[0].dice));
|
||||
assert.equal(round.dice, 1 + end[0].dice);
|
||||
assert.equal(round.lives, 3);
|
||||
run(round, ghoul.CARD_MS + 100);
|
||||
assert.equal(round.spec.id, "ballroom");
|
||||
|
||||
@@ -5,19 +5,20 @@
|
||||
// Pool's boss spec. The monsters' rules, the fight and the ride land in
|
||||
// later phases.
|
||||
import { test } from "node:test";
|
||||
import { readFileSync } from "node:fs";
|
||||
import assert from "node:assert/strict";
|
||||
import * as ghoul from "../src/web-console/public/activities/ghoul.js";
|
||||
import * as bog from "../src/web-console/public/activities/ghoul-bog.js";
|
||||
import * as ghoulSfx from "../src/web-console/public/activities/ghoul-sfx.js";
|
||||
import { LOSE_SOUNDS, LOSE_WORDS, VOICES } from "../src/web-console/public/activities/ghoul-bog-draw.js";
|
||||
import { BOG_SFX } from "../src/web-console/public/activities/ghoul-sfx-bog.js";
|
||||
import { BOSS_INTROS, bossIntroFor } from "../src/web-console/public/activities/ghoul-boss-intros.js";
|
||||
import { INTROS, introFor } from "../src/web-console/public/activities/ghoul-intros.js";
|
||||
import { react } from "../src/web-console/public/activities/ghoul-draw.js";
|
||||
import * as ghoul from "../src/web-console/public/activities/ghoul-rush/ghoul.js";
|
||||
import * as bog from "../src/web-console/public/activities/ghoul-rush/stages/bog/ghoul-bog.js";
|
||||
import * as ghoulSfx from "../src/web-console/public/activities/ghoul-rush/sfx/ghoul-sfx.js";
|
||||
import { LOSE_SOUNDS, LOSE_WORDS, VOICES } from "../src/web-console/public/activities/ghoul-rush/stages/bog/ghoul-bog-draw.js";
|
||||
import { BOG_SFX } from "../src/web-console/public/activities/ghoul-rush/stages/bog/ghoul-sfx-bog.js";
|
||||
import { BOSS_INTROS, bossIntroFor } from "../src/web-console/public/activities/ghoul-rush/story/ghoul-boss-intros.js";
|
||||
import { INTROS, introFor } from "../src/web-console/public/activities/ghoul-rush/story/ghoul-intros.js";
|
||||
import { react } from "../src/web-console/public/activities/ghoul-rush/draw/ghoul-draw.js";
|
||||
|
||||
const steady = () => 0.5;
|
||||
const events = (round, type) => round.events.filter((e) => e.type === type);
|
||||
const ROOM_IDS = ["boardwalk", "hollow", "stilts", "bogboat", "drowning"];
|
||||
const ROOM_IDS = ["boardwalk", "hollow", "stilts", "lantern", "drowning"];
|
||||
|
||||
function through(round) {
|
||||
round.phase = "clear";
|
||||
@@ -85,8 +86,8 @@ test("Ghoul Rush's Gallows Bog is a stage of five rooms ending on the Drowning P
|
||||
});
|
||||
|
||||
test("Ghoul Rush's bog rooms carry the usual pieces: a key, sky treasures, candy, items and a horde in each walked room, mud spans frozen, the ride its own course, the arena the hag's", () => {
|
||||
const [boardwalk, hollow, stilts, bogboat, drowning] = ROOM_IDS.map((id) => ghoul.roomById(id));
|
||||
assert.deepEqual([boardwalk.title, hollow.title, stilts.title, bogboat.title, drowning.title], ["Sunken Boardwalk", "Cypress Hollow", "Stilt House", "The Bog Runner", "The Drowning Pool"]);
|
||||
const [boardwalk, hollow, stilts, lantern, drowning] = ROOM_IDS.map((id) => ghoul.roomById(id));
|
||||
assert.deepEqual([boardwalk.title, hollow.title, stilts.title, lantern.title, drowning.title], ["Sunken Boardwalk", "Cypress Hollow", "Stilt House", "The Drowned Lantern", "The Drowning Pool"]);
|
||||
assert.deepEqual([boardwalk.sub, hollow.sub, stilts.sub, drowning.sub], ["Mind the gaps. Something lives in them", "The moss is breathing", "She has been expecting you", "Keep to the planks, she owns the water"]);
|
||||
for (const room of [boardwalk, hollow, stilts]) {
|
||||
assert.ok(room.key, `${room.id}: a key`);
|
||||
@@ -104,17 +105,18 @@ test("Ghoul Rush's bog rooms carry the usual pieces: a key, sky treasures, candy
|
||||
assert.ok(boardwalk.shelves.some((s) => s[3] === "crumble") && hollow.shelves.some((s) => s[3] === "crumble") && stilts.shelves.some((s) => s[3] === "crumble"), "rotting boards that give way");
|
||||
// The Bog Runner is a stub: a bonus ride with empty obstacle arrays that
|
||||
// Phase 4's deterministic generator fills in.
|
||||
assert.equal(bogboat.bonus, true);
|
||||
assert.equal(bogboat.dark, false);
|
||||
assert.equal(bogboat.key, null);
|
||||
assert.equal(bogboat.boss, null);
|
||||
assert.equal(bogboat.horde.length, 0);
|
||||
assert.equal(bogboat.ride.runner, "bogboat");
|
||||
assert.equal(bogboat.ride.how, "LEFT or RIGHT at a bank: switch lane. UP jump, DOWN duck, SPACE shoot");
|
||||
assert.ok(bogboat.ride.time >= 70000 && bogboat.ride.time <= 120000);
|
||||
assert.ok(bogboat.ride.finish > 0 && bogboat.ride.finish < bogboat.length);
|
||||
assert.ok(bogboat.ride.checks.length >= 1 && bogboat.ride.checks.every((x) => x > 0 && x < bogboat.ride.finish), "checkpoints inside the run");
|
||||
assert.ok(Object.isFrozen(bogboat.ride), "the ride is frozen");
|
||||
assert.equal(lantern.bonus, true);
|
||||
assert.equal(lantern.dark, false);
|
||||
assert.equal(lantern.key, null);
|
||||
assert.equal(lantern.boss, null);
|
||||
assert.equal(lantern.horde.length, 0);
|
||||
assert.equal(lantern.ride.runner, "lantern");
|
||||
assert.equal(lantern.ride.how, "ARROWS walk, SPACE flares. Light 5 shrines, then run to the boat");
|
||||
assert.ok(lantern.ride.time >= 70000 && lantern.ride.time <= 120000);
|
||||
assert.ok(lantern.ride.shrines.length === 5 && lantern.ride.hummocks.length > 5, "an island with five shrines");
|
||||
assert.ok(Object.isFrozen(lantern.ride), "the room is frozen");
|
||||
// The Bog Runner (the fan-boat ride this room replaced) is still defined but no stage lists it.
|
||||
assert.equal(ghoul.roomById("bogboat"), null, "the retired boat is gone");
|
||||
assert.equal(drowning.boss, "motherbog");
|
||||
assert.equal(drowning.key, null);
|
||||
assert.equal(drowning.horde.length, 0);
|
||||
@@ -585,7 +587,7 @@ test("Old Mother Bog's cauldron spit lands a muck patch where you stand after a
|
||||
standAt(round, 150);
|
||||
round.you.safeMs = 1e9;
|
||||
b.act = "idle";
|
||||
b.attacks = 1;
|
||||
b.plan = "spit";
|
||||
hurry(b);
|
||||
run(round, 8);
|
||||
assert.equal(b.act, "throwWind");
|
||||
@@ -627,7 +629,7 @@ test("Old Mother Bog goes meaner at half her hp: waits shrink to MOTHER_QUICK of
|
||||
const b = round.boss;
|
||||
standAt(round, 150);
|
||||
round.you.safeMs = 1e9;
|
||||
Object.assign(b, { raged: true, sank: true, act: "idle", attacks: 1, y: 6, x: 176 });
|
||||
Object.assign(b, { raged: true, sank: true, act: "idle", plan: "spit", y: 6, x: 176 });
|
||||
b.wait = 0;
|
||||
round.you.vx = 20;
|
||||
run(round, 8);
|
||||
@@ -698,9 +700,116 @@ test("Old Mother Bog sinks at half her hp, bubbles where she will rise, rises ne
|
||||
assert.ok(h.wait <= bog.MOTHER_REST_MS * bog.MOTHER_QUICK + 1, "and her next wait is the quick one");
|
||||
});
|
||||
|
||||
test("Old Mother Bog: her guard and weak spot are what the pack says, her touch is the motherbog cause, and her fall clears the field", () => {
|
||||
test("Old Mother Bog is not a pattern: the wave opens, then a weighted pick by phase that never makes one move three times running, keeps the slow moves on a cooldown and summons only under the cap", () => {
|
||||
// A long run of picks, as she would make them.
|
||||
const rolls = (b, n, random, round = null) => Array.from({ length: n }, () => bog.pickAttack(b, random, round));
|
||||
const three = (list) => list.some((m, i) => i > 1 && m === list[i - 1] && m === list[i - 2]);
|
||||
const lcg = (seed) => () => ((seed = (seed * 1103515245 + 12345) & 0x7fffffff) / 0x7fffffff);
|
||||
assert.equal(bog.pickAttack({ hp: 100, max: 100 }, () => 0.99), "wave", "the first move is always the wave");
|
||||
const P1 = ["dive", "hands", "shell", "spit", "surge", "wave"];
|
||||
const MORE = [...P1, "brood", "double", "volley"];
|
||||
const P2 = [...MORE, "drowned", "pull", "stomp", "tide"];
|
||||
const P3 = [...P2, "wisps"];
|
||||
const phases = [
|
||||
[{ hp: 100, max: 100 }, P1, "full health: six moves"],
|
||||
[{ hp: 70, max: 100 }, MORE, "under three quarters: the double wave, the volley and the brood join"],
|
||||
[{ hp: 45, max: 100, raged: true, sank: true }, P2, "under half: the stomp, the tide, the pull and the drowned join"],
|
||||
[{ hp: 20, max: 100, raged: true, sank: true, fury: true, sank2: true }, P3, "under a quarter: the wisp lantern joins"],
|
||||
];
|
||||
for (const [b, want, what] of phases) {
|
||||
const seen = rolls(b, 600, lcg(17));
|
||||
assert.deepEqual([...new Set(seen)].sort(), [...want].sort(), what);
|
||||
assert.ok(!three(seen), `never three in a row (${what})`);
|
||||
// A slow move sits out its cooldown.
|
||||
for (const [move, n] of Object.entries(bog.COOLDOWN)) {
|
||||
const at = seen.flatMap((m, i) => (m === move ? [i] : []));
|
||||
assert.ok(at.every((i, j) => j === 0 || i - at[j - 1] > n), `${move} waits ${n} picks (${what})`);
|
||||
}
|
||||
}
|
||||
assert.equal(bog.phaseOf({}), 0);
|
||||
assert.equal(bog.phaseOf({ raged: true }), 1);
|
||||
assert.equal(bog.phaseOf({ raged: true, fury: true }), 2);
|
||||
// At the cap a summon is never picked.
|
||||
const crowd = { monsters: [] };
|
||||
for (let i = 0; i < bog.BROOD_CAP; i++) crowd.monsters.push({ kind: "leech", hag: true });
|
||||
for (let i = 0; i < bog.BODIES_CAP; i++) crowd.monsters.push({ kind: "bogbody", hag: true });
|
||||
for (let i = 0; i < bog.WISPS_CAP; i++) crowd.monsters.push({ kind: "wisp", hag: true });
|
||||
const capped = rolls({ hp: 20, max: 100, raged: true, fury: true, picks: 1 }, 400, lcg(5), crowd);
|
||||
for (const move of ["brood", "drowned", "wisps"]) assert.equal(capped.includes(move), false, `no ${move} at the cap`);
|
||||
const forced = { hp: 100, max: 100, picks: 3, plan: "volley" };
|
||||
assert.equal(bog.pickAttack(forced, () => 0), "volley", "a plan is taken");
|
||||
assert.equal(forced.plan, null, "once");
|
||||
});
|
||||
|
||||
test("Old Mother Bog's double wave sends a second wave DOUBLE_GAP_MS behind the first, and her volley lands three staggered patches", () => {
|
||||
const round = motherFight();
|
||||
const b = round.boss;
|
||||
standAt(round, 150);
|
||||
round.you.safeMs = 1e9;
|
||||
Object.assign(b, { act: "idle", plan: "double", attacks: 2 });
|
||||
hurry(b);
|
||||
run(round, 8);
|
||||
assert.equal(b.act, "wind");
|
||||
run(round, bog.MOTHER_WIND_MS + 20);
|
||||
assert.equal(events(round, "mudWave").length, 1, "one wave to start");
|
||||
run(round, bog.DOUBLE_GAP_MS + 30);
|
||||
const waves = events(round, "mudWave");
|
||||
assert.equal(waves.length, 2, "and a second behind it");
|
||||
assert.equal(waves[1].echo, true);
|
||||
const volley = motherFight();
|
||||
standAt(volley, 150);
|
||||
volley.you.safeMs = 1e9;
|
||||
Object.assign(volley.boss, { act: "idle", plan: "volley", attacks: 2 });
|
||||
hurry(volley.boss);
|
||||
run(volley, 8);
|
||||
assert.equal(volley.boss.act, "throwWind");
|
||||
run(volley, bog.SPIT_WIND_MS + 20);
|
||||
assert.ok(volley.hazards.length >= 2 && volley.hazards.length <= 3, `a spread of patches (${volley.hazards.length})`);
|
||||
const warns = volley.hazards.map((h) => h.warn).sort((a, c) => a - c);
|
||||
assert.ok(warns.at(-1) - warns[0] >= bog.VOLLEY_STAGGER_MS - 30, "landing a beat apart");
|
||||
});
|
||||
|
||||
test("Old Mother Bog never stands half out over the water (only a dive, a charge or a leap takes her off the boards), and goes under a second time at a quarter of her hp and comes back furious", () => {
|
||||
const round = motherFight();
|
||||
const b = round.boss;
|
||||
const half = (x) => [-0.45, 0, 0.45].every((f) => ghoul.groundAt(round.spec, x + f * b.w) === b.y);
|
||||
// Put down over the gap between the planks, she walks onto one that holds her.
|
||||
standAt(round, 160);
|
||||
round.you.safeMs = 1e9;
|
||||
Object.assign(b, { act: "idle", x: 131, wait: 1e9 });
|
||||
until(round, () => half(b.x), 4000);
|
||||
assert.ok(half(b.x), `she settled on the planks (x=${b.x})`);
|
||||
// However she wanders in a long fight, her body is on the boards.
|
||||
Object.assign(b, { act: "idle", wait: 0, plan: "spit" });
|
||||
for (let i = 0; i < 400; i++) {
|
||||
standAt(round, 112 + ((i * 7) % 80));
|
||||
round.you.safeMs = 1e9;
|
||||
if (b.act === "idle") b.wait = Math.min(b.wait, 400);
|
||||
run(round, 50);
|
||||
if (b.hidden || bog.UNSTOOD.includes(b.act)) continue;
|
||||
assert.ok(half(b.x), `on the planks at step ${i} (x=${b.x}, act ${b.act})`);
|
||||
}
|
||||
// A second dive at a quarter.
|
||||
const fight = motherFight();
|
||||
const h = fight.boss;
|
||||
standAt(fight, 150);
|
||||
fight.you.safeMs = 1e9;
|
||||
Object.assign(h, { raged: true, sank: true, act: "idle", wait: 1e9, hp: h.max * bog.MOTHER_FURY_AT - 1 });
|
||||
run(fight, 8);
|
||||
assert.equal(h.sank2, true);
|
||||
assert.equal(h.fury, true);
|
||||
assert.equal(h.act, "sink");
|
||||
assert.equal(h.hidden, true);
|
||||
until(fight, () => h.act === "rest", 4000);
|
||||
assert.ok(h.wait <= bog.MOTHER_REST_MS * bog.MOTHER_FURY + 1, "her waits are the furious ones");
|
||||
assert.equal(events(fight, "motherSink").length, 1);
|
||||
});
|
||||
|
||||
test("Old Mother Bog: her guard and weak spot are what the pack says, her touch is the motherbog cause, and her fall clears the field of every hazard and add she made", () => {
|
||||
assert.equal(bog.BOG.guard.motherbog({ hidden: true }), true);
|
||||
assert.equal(bog.BOG.guard.motherbog({ hidden: false }), false);
|
||||
assert.equal(bog.BOG.guard.motherbog({ hidden: false, act: "shell" }), true, "shelled");
|
||||
assert.equal(bog.BOG.guard.motherbog({ hidden: false, act: "stagger" }), false, "reeling, she is open");
|
||||
assert.equal(bog.BOG.weak.motherbog({ lit: true }), 3);
|
||||
assert.equal(bog.BOG.weak.motherbog({ lit: false }), 1);
|
||||
assert.equal(bog.BOG.cause.motherbog(), "motherbog");
|
||||
@@ -714,8 +823,14 @@ test("Old Mother Bog: her guard and weak spot are what the pack says, her touch
|
||||
const b = round.boss;
|
||||
b.hp = 1;
|
||||
b.sank = true;
|
||||
b.sank2 = true;
|
||||
round.hazards.push({ kind: "muck", x: 150, y: 6, w: bog.MUCK_W, h: bog.MUCK_H, warn: 0, live: 2000, cause: "muck" });
|
||||
round.waves.push({ x: 140, y: 6, dir: -1, life: 6000, kind: "mudwave", cause: "mudwave" });
|
||||
round.hazards.push({ kind: "boghand", x: 160, y: 6, w: bog.HAND_W, h: bog.HAND_H, warn: 0, live: 400, cause: "boghand" });
|
||||
round.hazards.push({ kind: "tide", x: 152, y: 5, w: 104, h: 1.6, x0: 104, x1: 200, warn: 0, live: 2000, cause: "tide" });
|
||||
put(round, "leech", 150, { hag: true });
|
||||
put(round, "bogbody", 160, { hag: true });
|
||||
put(round, "wisp", 150, { hag: true, y: 14 });
|
||||
Object.assign(b, { act: "rest", wait: bog.MOTHER_OPEN_MS - 100 });
|
||||
standAt(round, 120);
|
||||
round.you.safeMs = 1e9;
|
||||
@@ -723,8 +838,594 @@ test("Old Mother Bog: her guard and weak spot are what the pack says, her touch
|
||||
ghoul.advance(round, 4, steady);
|
||||
assert.equal(b.state, "down");
|
||||
assert.equal(round.hasKey, true);
|
||||
assert.equal(round.hazards.length, 0);
|
||||
assert.equal(round.hazards.length, 0, "the muck, the hands and the tide are gone");
|
||||
assert.equal(round.waves.length, 0);
|
||||
assert.equal(round.monsters.length, 0, "and so are her adds");
|
||||
});
|
||||
|
||||
// Her next move forced, from idle, as if her wait had run out; `over` sets
|
||||
// her phase or her place first.
|
||||
function force(round, move, over = {}) {
|
||||
const b = round.boss;
|
||||
Object.assign(b, { act: "idle", plan: move, picks: Math.max(3, b.picks || 0) }, over);
|
||||
b.wait = 0;
|
||||
run(round, 8);
|
||||
}
|
||||
const RAGED = { raged: true, sank: true };
|
||||
const FURY = { raged: true, sank: true, fury: true, sank2: true };
|
||||
// A bolt from the left into her middle, one slice later.
|
||||
function shoot(round) {
|
||||
const b = round.boss;
|
||||
round.shots.push({ x: b.x - b.w / 2 - 0.2, y: b.y + b.h * 0.35, vx: 80, vy: 0, gone: 0 });
|
||||
ghoul.advance(round, 4, steady);
|
||||
}
|
||||
// Runs `ms`, jumping whenever `near()` says the threat is about to arrive.
|
||||
function hop(round, ms, near) {
|
||||
for (let t = 0; t < ms; t += 4) {
|
||||
const you = round.you;
|
||||
if (you.state === "run" && near(round) && round.input.jump <= 0) round.input.jump = ghoul.JUMP_BUFFER_MS;
|
||||
ghoul.advance(round, 4, steady);
|
||||
}
|
||||
}
|
||||
// A mud wave rolling at you, within `d`.
|
||||
const waveAt = (round, d = 7.5) => round.waves.some((w) => (round.you.x - w.x) * w.dir > 0 && (round.you.x - w.x) * w.dir < d);
|
||||
const losses = (round) => events(round, "lose");
|
||||
|
||||
test("Old Mother Bog's bog hands: her arms go into the water, ripples warn where you stand and a step either side, a hand bursts up from each (a heart, grabbed), and a step between them costs nothing", () => {
|
||||
const round = motherFight();
|
||||
const b = round.boss;
|
||||
standAt(round, 150);
|
||||
const lives = round.lives;
|
||||
force(round, "hands");
|
||||
assert.equal(b.act, "hands", "her arms in the water");
|
||||
const wind = events(round, "handsWind")[0];
|
||||
assert.ok(wind, "a wind-up to read");
|
||||
const hands = round.hazards.filter((h) => h.kind === "boghand");
|
||||
assert.equal(hands.length, bog.HANDS_N[0], "two at full health");
|
||||
assert.deepEqual(wind.xs, hands.map((h) => h.x), "the event names every ripple");
|
||||
assert.ok(hands.some((h) => Math.abs(h.x - 150) <= 2), "one where you stand");
|
||||
assert.ok(hands.every((h) => h.live === 0 && h.warn >= bog.HANDS_WIND_MS + bog.HAND_WARN_MS - 10 && h.cause === "boghand"), "each warns first");
|
||||
assert.ok(hands.every((h) => Number.isFinite(ghoul.groundAt(round.spec, h.x))), "out of the planks");
|
||||
run(round, bog.HANDS_WIND_MS + bog.HAND_WARN_MS - 40);
|
||||
assert.equal(losses(round).length, 0, "a ripple does not hurt");
|
||||
run(round, 80);
|
||||
assert.ok(events(round, "handsUp").length >= 1, "up it comes");
|
||||
assert.equal(losses(round)[0]?.cause, "boghand", "standing in it, you are grabbed");
|
||||
assert.equal(round.lives, lives - 1, "a heart");
|
||||
// A step between the ripples, and every hand goes by.
|
||||
const dodge = motherFight();
|
||||
standAt(dodge, 150);
|
||||
force(dodge, "hands");
|
||||
const spots = dodge.hazards.map((h) => h.x).sort((a, c) => a - c);
|
||||
standAt(dodge, spots[0] - 4.5);
|
||||
run(dodge, bog.HANDS_WIND_MS + bog.HAND_WARN_MS + bog.HAND_STAGGER_MS * 3 + bog.HAND_UP_MS + 50);
|
||||
assert.equal(losses(dodge).length, 0, "a clean dodge costs nothing");
|
||||
assert.equal(dodge.hazards.filter((h) => h.kind === "boghand").length, 0, "the hands are gone again");
|
||||
assert.equal(dodge.boss.act, "idle");
|
||||
// More of them as she weakens.
|
||||
for (const [phase, over] of [[1, RAGED], [2, FURY]]) {
|
||||
const more = motherFight();
|
||||
standAt(more, 145);
|
||||
force(more, "hands", over);
|
||||
assert.equal(more.hazards.filter((h) => h.kind === "boghand").length, bog.HANDS_N[phase], `phase ${phase}`);
|
||||
}
|
||||
});
|
||||
|
||||
test("Old Mother Bog's surge: a crouch behind a bow wave, then a waist-deep charge along and past you; standing costs a heart, a jump over her or a shelf costs nothing, and she stops on the planks", () => {
|
||||
const round = motherFight();
|
||||
const b = round.boss;
|
||||
standAt(round, 150);
|
||||
const lives = round.lives;
|
||||
force(round, "surge");
|
||||
const from = b.x;
|
||||
assert.equal(b.act, "surgeWind");
|
||||
assert.equal(events(round, "surgeWind").length, 1, "a wind-up to read");
|
||||
run(round, bog.SURGE_WIND_MS - 40);
|
||||
assert.equal(b.x, from, "she holds still while she crouches");
|
||||
run(round, 60);
|
||||
assert.equal(b.act, "surge");
|
||||
assert.equal(events(round, "motherSurge").length, 1);
|
||||
assert.equal(b.y, b.floor - bog.SURGE_SINK, "waist deep");
|
||||
assert.ok((150 - b.surgeTo) >= 6, `past you (${b.surgeTo})`);
|
||||
until(round, () => losses(round).length > 0, 2000);
|
||||
assert.equal(losses(round)[0]?.cause, "motherbog", "run down");
|
||||
assert.equal(round.lives, lives - 1);
|
||||
// A jump as she comes clears her.
|
||||
const jumper = motherFight();
|
||||
standAt(jumper, 150);
|
||||
force(jumper, "surge");
|
||||
run(jumper, bog.SURGE_WIND_MS + 20);
|
||||
const jb = jumper.boss;
|
||||
hop(jumper, 1500, () => jb.act === "surge" && jb.x - jb.w / 2 - jumper.you.x - ghoul.HIT_W / 2 < 7.5);
|
||||
assert.equal(losses(jumper).length, 0, "jumped clean");
|
||||
assert.equal(jb.act === "rest" || jb.act === "idle", true, "the charge is over");
|
||||
assert.ok([-0.45, 0, 0.45].every((f) => ghoul.groundAt(jumper.spec, jb.x + f * jb.w) === jb.y), "she stopped on the planks");
|
||||
assert.ok(jb.x < 150, "on your other side: she moved");
|
||||
// Up on a shelf she charges underneath.
|
||||
const shelf = motherFight();
|
||||
standAt(shelf, 118, 0);
|
||||
force(shelf, "surge");
|
||||
run(shelf, bog.SURGE_WIND_MS + 1500);
|
||||
assert.equal(losses(shelf).length, 0, "the shelf is out of her reach");
|
||||
});
|
||||
|
||||
test("Old Mother Bog's mud shell: bolts chip it and not her, SHELL_HP of them break it and leave her reeling with the cauldron open (triple), and left alone she feeds and heals", () => {
|
||||
const round = motherFight();
|
||||
const b = round.boss;
|
||||
standAt(round, 150);
|
||||
round.you.safeMs = 1e9;
|
||||
force(round, "shell");
|
||||
assert.equal(b.act, "shellWind");
|
||||
assert.equal(events(round, "shellWind").length, 1, "a wind-up to read");
|
||||
run(round, bog.SHELL_WIND_MS + 10);
|
||||
assert.equal(b.act, "shell");
|
||||
assert.equal(bog.BOG.guard.motherbog(b), true, "guarded");
|
||||
assert.equal(b.shell, bog.SHELL_HP[0]);
|
||||
const hp = b.hp;
|
||||
for (let i = 0; i < bog.SHELL_HP[0] - 1; i++) shoot(round);
|
||||
assert.equal(b.hp, hp, "the shell takes the bolts");
|
||||
assert.equal(events(round, "shellChip").length, bog.SHELL_HP[0] - 1, "each a chip");
|
||||
assert.equal(b.act, "shell", "still up");
|
||||
shoot(round);
|
||||
assert.equal(events(round, "shellBreak").length, 1, "broken");
|
||||
assert.equal(b.act, "stagger");
|
||||
shoot(round);
|
||||
assert.equal(b.lit, true, "the cauldron is open while she reels");
|
||||
assert.equal(hp - b.hp, 3, "and a bolt counts triple");
|
||||
assert.ok(events(round, "cauldronOpen").length >= 1);
|
||||
run(round, bog.STAGGER_MS + 20);
|
||||
assert.equal(b.act, "idle");
|
||||
// Ignored, she ladles herself a feed.
|
||||
const feed = motherFight();
|
||||
standAt(feed, 150);
|
||||
feed.you.safeMs = 1e9;
|
||||
feed.boss.hp = feed.boss.max - 40;
|
||||
force(feed, "shell");
|
||||
run(feed, bog.SHELL_WIND_MS + bog.SHELL_MS + 20);
|
||||
const fed = events(feed, "motherFeed")[0];
|
||||
assert.ok(fed, "she feeds");
|
||||
assert.equal(fed.heal, bog.SHELL_HEAL);
|
||||
assert.equal(feed.boss.hp, feed.boss.max - 40 + bog.SHELL_HEAL, "and heals");
|
||||
const full = motherFight();
|
||||
full.you.safeMs = 1e9;
|
||||
full.boss.hp = full.boss.max - 3;
|
||||
force(full, "shell");
|
||||
run(full, bog.SHELL_WIND_MS + bog.SHELL_MS + 20);
|
||||
assert.equal(full.boss.hp, full.boss.max, "never past her max");
|
||||
// A stomp on the shell glances off.
|
||||
const stomp = motherFight();
|
||||
stomp.you.safeMs = 1e9;
|
||||
force(stomp, "shell");
|
||||
run(stomp, bog.SHELL_WIND_MS + 10);
|
||||
const sb = stomp.boss;
|
||||
const before = sb.hp;
|
||||
Object.assign(stomp.you, { x: sb.x, y: sb.y + sb.h + 0.3, vy: -20, state: "air", shelf: -1 });
|
||||
run(stomp, 20);
|
||||
assert.equal(sb.hp, before, "a stomp does nothing to the shell");
|
||||
assert.ok(events(stomp, "bossBlock").length >= 1);
|
||||
});
|
||||
|
||||
test("Old Mother Bog's dive: she goes under (shots meet water), bubbles show a new spot on the planks away from you, she rises there hittable, and meaner the rise sends a mud wave each way", () => {
|
||||
const round = motherFight();
|
||||
const b = round.boss;
|
||||
standAt(round, 150);
|
||||
round.you.safeMs = 1e9;
|
||||
force(round, "dive");
|
||||
assert.equal(b.act, "sink");
|
||||
assert.equal(b.hidden, true);
|
||||
assert.equal(b.raged || false, false, "a dive of her own is not the rage");
|
||||
assert.equal(events(round, "motherSink")[0]?.relocate, true);
|
||||
const hp = b.hp;
|
||||
round.shots.push({ x: b.x - 2, y: 7, vx: 80, vy: 0, gone: 0 });
|
||||
run(round, 40);
|
||||
assert.equal(b.hp, hp, "no damage under the water");
|
||||
until(round, () => b.act === "under", 2000);
|
||||
const bubble = events(round, "motherBubble")[0];
|
||||
assert.ok(bubble);
|
||||
assert.ok(Math.abs(b.sinkX - round.you.x) >= 6, "never on top of you");
|
||||
assert.ok([-0.45, 0, 0.45].every((f) => ghoul.groundAt(round.spec, b.sinkX + f * b.w) === b.floor), "on a plank that holds her");
|
||||
until(round, () => b.act === "resurface", 2000);
|
||||
assert.equal(b.x, bubble.x);
|
||||
shoot(round);
|
||||
assert.ok(hp - b.hp >= 1, "hittable once she is up");
|
||||
until(round, () => b.act === "rest", 2000);
|
||||
assert.equal(events(round, "mudWave").length, 0, "calm, no waves");
|
||||
// Meaner, two waves come off her as she stands.
|
||||
const mean = motherFight();
|
||||
standAt(mean, 150);
|
||||
mean.you.safeMs = 1e9;
|
||||
force(mean, "dive", RAGED);
|
||||
until(mean, () => mean.boss.act === "rest", 4000);
|
||||
const waves = events(mean, "mudWave").filter((e) => e.rise);
|
||||
assert.deepEqual(waves.map((w) => w.dir).sort(), [-1, 1], "a wave each way");
|
||||
});
|
||||
|
||||
test("Old Mother Bog's leech brood: she tips the cauldron, a swarm or two pours onto the planks and creeps at you, never more than BROOD_CAP of hers alive; a latch is a heart and two bolts see one off", () => {
|
||||
const round = motherFight();
|
||||
const b = round.boss;
|
||||
standAt(round, 140 + 10);
|
||||
round.you.safeMs = 1e9;
|
||||
force(round, "brood");
|
||||
assert.equal(b.act, "broodWind");
|
||||
assert.equal(events(round, "broodWind").length, 1, "a wind-up to read");
|
||||
assert.equal(bog.hagAdds(round, "leech"), 0, "nothing out during the tip");
|
||||
run(round, bog.BROOD_WIND_MS + 10);
|
||||
assert.equal(events(round, "broodPour")[0]?.n, bog.BROOD_N);
|
||||
assert.equal(bog.hagAdds(round, "leech"), bog.BROOD_N);
|
||||
const brood = round.monsters.filter((m) => m.hag);
|
||||
assert.ok(brood.every((m) => m.kind === "leech" && Number.isFinite(ghoul.groundAt(round.spec, m.x))), "on the planks");
|
||||
const x0 = brood[0].x;
|
||||
run(round, 300);
|
||||
assert.ok(brood[0].x < x0, "creeping at you");
|
||||
force(round, "brood");
|
||||
run(round, bog.BROOD_WIND_MS + 10);
|
||||
force(round, "brood");
|
||||
run(round, bog.BROOD_WIND_MS + 10);
|
||||
assert.equal(bog.hagAdds(round, "leech"), bog.BROOD_CAP, "capped");
|
||||
// A latch costs a heart.
|
||||
const latch = motherFight();
|
||||
const lives = latch.lives;
|
||||
standAt(latch, 150);
|
||||
put(latch, "leech", 150.5, { hag: true });
|
||||
run(latch, 40);
|
||||
assert.equal(losses(latch)[0]?.cause, "leeches");
|
||||
assert.equal(latch.lives, lives - 1);
|
||||
// Two bolts see one off.
|
||||
const shot = motherFight();
|
||||
standAt(shot, 150);
|
||||
shot.you.safeMs = 1e9;
|
||||
shot.boss.wait = 1e9;
|
||||
const m = put(shot, "leech", 160, { hag: true });
|
||||
bolt(shot, m, m.y + 0.9);
|
||||
bolt(shot, m, m.y + 0.9);
|
||||
shot.shots[1].x -= 3;
|
||||
run(shot, 200);
|
||||
assert.equal(bog.hagAdds(shot, "leech"), 0, "dispersed");
|
||||
});
|
||||
|
||||
test("Old Mother Bog's stomp: a shadow where you stand, a leap and a slam there (a heart if you stayed), then a mud wave each way; out of the shadow and over the wave costs nothing", () => {
|
||||
const round = motherFight();
|
||||
const b = round.boss;
|
||||
standAt(round, 150);
|
||||
const lives = round.lives;
|
||||
force(round, "stomp", RAGED);
|
||||
assert.equal(b.act, "stompWind");
|
||||
const wind = events(round, "stompWind")[0];
|
||||
assert.ok(wind, "a wind-up to read");
|
||||
assert.ok(Math.abs(wind.landX - 150) <= 1, "the shadow is on you");
|
||||
run(round, bog.STOMP_WIND_MS * bog.MOTHER_QUICK + 10);
|
||||
assert.equal(b.act, "stompAir");
|
||||
assert.equal(events(round, "motherLeap").length, 1);
|
||||
until(round, () => losses(round).length > 0, 2000);
|
||||
assert.equal(losses(round)[0]?.cause, "motherbog", "landed on");
|
||||
assert.equal(round.lives, lives - 1);
|
||||
// Out of the shadow, then over the wave.
|
||||
const dodge = motherFight();
|
||||
standAt(dodge, 150);
|
||||
force(dodge, "stomp", RAGED);
|
||||
standAt(dodge, 185);
|
||||
const db = dodge.boss;
|
||||
until(dodge, () => events(dodge, "motherSlam").length > 0, 3000);
|
||||
assert.equal(db.x, db.landX, "down where the shadow was");
|
||||
assert.ok([-0.45, 0, 0.45].every((f) => ghoul.groundAt(dodge.spec, db.x + f * db.w) === db.y), "on the planks");
|
||||
assert.equal(dodge.waves.length, 0, "the waves wait a beat");
|
||||
hop(dodge, 1300, (r) => waveAt(r));
|
||||
const slams = events(dodge, "mudWave").filter((e) => e.slam);
|
||||
assert.deepEqual(slams.map((w) => w.dir).sort(), [-1, 1], "a wave each way");
|
||||
assert.equal(losses(dodge).length, 0, "a clean dodge costs nothing");
|
||||
});
|
||||
|
||||
test("Old Mother Bog's tide: a long warning, then the water over every plank for TIDE_MS (a heart, drowned); a shelf keeps you dry and it drains away after", () => {
|
||||
const round = motherFight();
|
||||
const b = round.boss;
|
||||
standAt(round, 150);
|
||||
const lives = round.lives;
|
||||
force(round, "tide", RAGED);
|
||||
assert.equal(b.act, "tideWind");
|
||||
assert.equal(events(round, "tideWarn").length, 1, "a warning to read");
|
||||
const tide = round.hazards.find((h) => h.kind === "tide");
|
||||
assert.ok(tide && tide.warn > bog.TIDE_WARN_MS - 10 && tide.live === 0, "it warns first");
|
||||
run(round, bog.TIDE_WARN_MS - 40);
|
||||
assert.equal(losses(round).length, 0, "the warning does not hurt");
|
||||
run(round, 80);
|
||||
assert.equal(events(round, "tideRise").length, 1);
|
||||
assert.equal(losses(round)[0]?.cause, "tide", "drowned on the planks");
|
||||
assert.equal(round.lives, lives - 1);
|
||||
// On a shelf you stay dry the whole time, and it drains.
|
||||
for (const shelf of [0, 2]) {
|
||||
const dry = motherFight();
|
||||
const [x0, x1] = dry.spec.shelves[shelf];
|
||||
standAt(dry, (x0 + x1) / 2, shelf);
|
||||
force(dry, "tide", RAGED);
|
||||
run(dry, bog.TIDE_WARN_MS + bog.TIDE_MS + 60);
|
||||
assert.equal(losses(dry).length, 0, `shelf ${shelf} is dry`);
|
||||
assert.equal(dry.hazards.filter((h) => h.kind === "tide").length, 0, "the water is gone");
|
||||
assert.notEqual(dry.boss.act, "tideHold");
|
||||
}
|
||||
// Every spot on the arena's planks is near enough a shelf to reach in the warning.
|
||||
const spec = round.spec;
|
||||
const tops = spec.shelves.filter((s) => s[2] === 12);
|
||||
for (let x = spec.arena + ghoul.BOSS_LOCK + 2; x < spec.length - 2; x += 2) {
|
||||
if (!Number.isFinite(ghoul.groundAt(spec, x))) continue;
|
||||
const far = Math.min(...tops.map(([a, c]) => (x < a ? a + 1 - x : x > c ? x - c + 1 : 0)));
|
||||
assert.ok(far / ghoul.RUN_SPEED + 0.35 < bog.TIDE_WARN_MS / 1000, `a shelf within reach of ${x}`);
|
||||
}
|
||||
});
|
||||
|
||||
test("Old Mother Bog's drowning pull: she stirs, then the water drags you along the planks toward her (a heart at her touch); running away, a shelf or the air beats it, and it never drags you off a plank's end", () => {
|
||||
const round = motherFight();
|
||||
const b = round.boss;
|
||||
standAt(round, 150);
|
||||
const lives = round.lives;
|
||||
force(round, "pull", RAGED);
|
||||
assert.equal(b.act, "pullWind");
|
||||
assert.equal(events(round, "pullWind").length, 1, "a wind-up to read");
|
||||
run(round, bog.PULL_WIND_MS * bog.MOTHER_QUICK - 30);
|
||||
assert.equal(round.you.x, 150, "nothing pulls during the stir");
|
||||
run(round, 40);
|
||||
assert.equal(b.act, "pull");
|
||||
assert.equal(events(round, "motherPull").length, 1);
|
||||
run(round, 400);
|
||||
assert.ok(round.you.x > 150 + 4, `dragged toward her (${round.you.x.toFixed(1)})`);
|
||||
until(round, () => losses(round).length > 0, 3000);
|
||||
assert.equal(losses(round)[0]?.cause, "motherbog");
|
||||
assert.equal(round.lives, lives - 1);
|
||||
// Running away from her beats it.
|
||||
const runner = motherFight();
|
||||
Object.assign(runner.boss, { x: 150 });
|
||||
standAt(runner, 172);
|
||||
force(runner, "pull", RAGED);
|
||||
run(runner, bog.PULL_WIND_MS + bog.PULL_MS + 40, { right: true });
|
||||
assert.equal(losses(runner).length, 0, "outrun");
|
||||
// A shelf is out of its reach.
|
||||
const shelf = motherFight();
|
||||
standAt(shelf, 166, 2);
|
||||
force(shelf, "pull", RAGED);
|
||||
run(shelf, bog.PULL_WIND_MS + 600);
|
||||
assert.equal(shelf.you.x, 166, "not moved on a shelf");
|
||||
// The boards hold you at a plank's end.
|
||||
const edge = motherFight();
|
||||
Object.assign(edge.boss, { x: 120 });
|
||||
standAt(edge, 142);
|
||||
edge.you.safeMs = 1e9;
|
||||
force(edge, "pull", RAGED);
|
||||
run(edge, bog.PULL_WIND_MS + bog.PULL_MS);
|
||||
assert.ok(edge.you.x >= 140 && edge.you.y === 6, `held on the plank (${edge.you.x.toFixed(1)})`);
|
||||
});
|
||||
|
||||
test("Old Mother Bog calls the drowned: mud boils away from you and her, bog bodies climb out (harmless till up), never more than BODIES_CAP of hers alive", () => {
|
||||
const round = motherFight();
|
||||
const b = round.boss;
|
||||
standAt(round, 150);
|
||||
round.you.safeMs = 1e9;
|
||||
force(round, "drowned", RAGED);
|
||||
assert.equal(b.act, "callWind");
|
||||
const wind = events(round, "callWind")[0];
|
||||
assert.ok(wind && wind.xs.length === bog.BODIES_CAP, "a wind-up naming where they come");
|
||||
for (const x of wind.xs) {
|
||||
assert.ok(Math.abs(x - 150) >= 6 && Math.abs(x - b.x) >= b.w, `away from you and her (${x})`);
|
||||
assert.ok(Number.isFinite(ghoul.groundAt(round.spec, x)), "on a plank");
|
||||
}
|
||||
assert.equal(bog.hagAdds(round, "bogbody"), 0, "nothing yet");
|
||||
run(round, bog.CALL_WIND_MS * bog.MOTHER_QUICK + 10);
|
||||
assert.equal(events(round, "motherCall").length, 1);
|
||||
assert.equal(bog.hagAdds(round, "bogbody"), bog.BODIES_CAP);
|
||||
run(round, 20);
|
||||
assert.equal(events(round, "bogRise").length, bog.BODIES_CAP, "they climb out");
|
||||
assert.ok(round.monsters.every((m) => !ghoul.solid(m)), "harmless while they rise");
|
||||
force(round, "drowned", RAGED);
|
||||
assert.deepEqual(events(round, "callWind").at(-1).xs, [], "at the cap nothing boils");
|
||||
run(round, bog.CALL_WIND_MS + 10);
|
||||
assert.equal(bog.hagAdds(round, "bogbody"), bog.BODIES_CAP, "capped");
|
||||
});
|
||||
|
||||
test("Old Mother Bog's wisp lantern, furious only: she raises it and two wisps of hers drift at you; a bolt puts one out for good, never more than WISPS_CAP", () => {
|
||||
const round = motherFight();
|
||||
const b = round.boss;
|
||||
standAt(round, 150);
|
||||
round.you.safeMs = 1e9;
|
||||
force(round, "wisps", FURY);
|
||||
assert.equal(b.act, "lanternWind");
|
||||
assert.equal(events(round, "lanternWind").length, 1, "a wind-up to read");
|
||||
run(round, bog.LANTERN_WIND_MS * bog.MOTHER_FURY + 10);
|
||||
assert.equal(events(round, "motherLantern").length, 1);
|
||||
assert.equal(bog.hagAdds(round, "wisp"), bog.WISPS_N);
|
||||
const w = round.monsters.find((m) => m.hag && m.kind === "wisp");
|
||||
bolt(round, w, w.y + w.h / 2);
|
||||
round.shots.at(-1).x = w.x - 0.5;
|
||||
run(round, 20);
|
||||
assert.equal(bog.hagAdds(round, "wisp"), bog.WISPS_N - 1, "one put out for good");
|
||||
force(round, "wisps", FURY);
|
||||
run(round, bog.LANTERN_WIND_MS + 10);
|
||||
force(round, "wisps", FURY);
|
||||
run(round, bog.LANTERN_WIND_MS + 10);
|
||||
assert.equal(bog.hagAdds(round, "wisp"), bog.WISPS_CAP, "capped");
|
||||
});
|
||||
|
||||
test("Old Mother Bog's combo, furious only: a move that ends in an idle may go straight into the next after her eye flares, never twice running; calm she never does", () => {
|
||||
const low = () => 0.1;
|
||||
const MOVE = /Wind$|^tideWarn$|^motherSink$/;
|
||||
// Runs `ms`, noting when each combo and each move's telegraph came.
|
||||
const log = (round, ms) => {
|
||||
const out = [];
|
||||
for (let t = 0; t < ms; t += 4) {
|
||||
ghoul.advance(round, 4, low);
|
||||
for (const e of round.events) if (e.type === "motherCombo" || MOVE.test(e.type)) out.push([e.type, t]);
|
||||
round.events.length = 0;
|
||||
}
|
||||
return out;
|
||||
};
|
||||
const round = motherFight();
|
||||
standAt(round, 120);
|
||||
round.you.safeMs = 1e9;
|
||||
force(round, "hands", FURY);
|
||||
const seen = log(round, 6000);
|
||||
const i = seen.findIndex(([type]) => type === "motherCombo");
|
||||
assert.ok(i >= 0, "a combo");
|
||||
assert.ok(seen[i + 1] && MOVE.test(seen[i + 1][0]), "and straight into a move");
|
||||
assert.ok(seen[i + 1][1] - seen[i][1] <= bog.COMBO_GAP_MS + 8, `with only the short gap between (${seen[i + 1][1] - seen[i][1]} ms)`);
|
||||
const types = seen.map(([type]) => type);
|
||||
assert.ok(!types.some((t, j) => t === "motherCombo" && types[j + 2] === "motherCombo"), "never two combos running");
|
||||
const calm = motherFight();
|
||||
standAt(calm, 120);
|
||||
calm.you.safeMs = 1e9;
|
||||
force(calm, "hands");
|
||||
assert.equal(log(calm, 6000).filter(([type]) => type === "motherCombo").length, 0, "calm, never");
|
||||
});
|
||||
|
||||
test("Old Mother Bog's phases: the moves she uses change at half and a quarter of her hp, and a long fight goes through them all", () => {
|
||||
const round = motherFight();
|
||||
const b = round.boss;
|
||||
round.infinite = true;
|
||||
let seed = 3;
|
||||
const random = () => ((seed = (seed * 1103515245 + 12345) & 0x7fffffff) / 0x7fffffff);
|
||||
const seen = [new Set(), new Set(), new Set()];
|
||||
for (let t = 0; t < 150000 && b.state === "fight"; t += 4) {
|
||||
round.you.safeMs = 1e9;
|
||||
// Her hp falls steadily, so every phase gets its turn.
|
||||
if (t % 400 === 0 && b.hp > 1 && !b.hidden && b.act !== "shell") b.hp -= 1;
|
||||
const before = b.picks || 0;
|
||||
ghoul.advance(round, 4, random);
|
||||
if ((b.picks || 0) > before) seen[bog.phaseOf(b)].add(b.last);
|
||||
round.events.length = 0;
|
||||
}
|
||||
for (const m of ["stomp", "tide", "pull", "drowned", "wisps"]) assert.equal(seen[0].has(m), false, `no ${m} at full health`);
|
||||
assert.equal(seen[1].has("wisps"), false, "no wisps before she is furious");
|
||||
assert.ok(["stomp", "tide", "pull", "drowned"].filter((m) => seen[1].has(m) || seen[2].has(m)).length >= 3, `the second phase's moves (${[...seen[1]]})`);
|
||||
assert.ok(seen[0].size >= 5 && seen[1].size >= 6, `a varied fight (${[...seen[0]]} / ${[...seen[1]]} / ${[...seen[2]]})`);
|
||||
});
|
||||
|
||||
/* ------------------------------------------------------ the whole fight */
|
||||
|
||||
// A player who plays the fight sensibly: keeps a fair distance facing her,
|
||||
// fires in bursts that keep the blaster cool, steps off ripples, shadows and
|
||||
// muck, jumps waves and her charge, climbs a shelf for the tide and the pull,
|
||||
// and hops a leech rather than walking into it.
|
||||
function skilledKeys(round, mem) {
|
||||
const you = round.you;
|
||||
const b = round.boss;
|
||||
const spec = round.spec;
|
||||
const k = { left: false, right: false, fire: false, down: false, jump: false };
|
||||
const clamp = (v, lo, hi) => Math.min(hi, Math.max(lo, v));
|
||||
const onGround = you.state === "run" && you.shelf < 0;
|
||||
const lo = spec.arena + ghoul.BOSS_LOCK + 2;
|
||||
const hi = spec.length - 3;
|
||||
let goal = null;
|
||||
const climb = () => {
|
||||
if (you.shelf >= 0) {
|
||||
const s = spec.shelves[you.shelf];
|
||||
goal = clamp(you.x, s[0] + 1.5, s[1] - 1.5);
|
||||
return;
|
||||
}
|
||||
const tops = spec.shelves.filter((s) => s[2] === 12);
|
||||
const s = tops.reduce((a, c) => (Math.abs((c[0] + c[1]) / 2 - you.x) < Math.abs((a[0] + a[1]) / 2 - you.x) ? c : a));
|
||||
goal = (s[0] + s[1]) / 2;
|
||||
if (onGround && you.x > s[0] + 1 && you.x < s[1] - 1) k.jump = true;
|
||||
};
|
||||
const danger = (x) => {
|
||||
for (const h of round.hazards) {
|
||||
if (h.kind === "muck" && (h.live > 0 || h.warn < 500) && Math.abs(x - h.x) < (h.w + ghoul.HIT_W) / 2 + 0.6) return true;
|
||||
if (h.kind === "boghand" && Math.abs(x - h.x) < (h.w + ghoul.HIT_W) / 2 + 0.6) return true;
|
||||
}
|
||||
if ((b.act === "stompWind" || b.act === "stompAir") && Math.abs(x - b.landX) < (b.w + ghoul.HIT_W) / 2 + 2) return true;
|
||||
if (!b.hidden && b.act !== "stompAir" && Math.abs(x - b.x) < (b.w + ghoul.HIT_W) / 2 + 1.5) return true;
|
||||
return !Number.isFinite(ghoul.groundAt(spec, x));
|
||||
};
|
||||
if (b && b.state === "fight") {
|
||||
const side = Math.sign(you.x - b.x) || 1;
|
||||
goal = clamp(b.x + side * 15, lo, hi);
|
||||
if (Math.abs(goal - b.x) < 10) goal = clamp(b.x - side * 15, lo, hi);
|
||||
if (round.hazards.some((h) => h.kind === "tide") || b.act === "pull" || b.act === "pullWind") climb();
|
||||
else if (danger(you.x) && onGround) {
|
||||
for (let d = 0.5; d < 16; d += 0.5) {
|
||||
const c = [you.x + d, you.x - d].find((x) => x > lo && x < hi && !danger(x));
|
||||
if (c !== undefined) {
|
||||
goal = c;
|
||||
break;
|
||||
}
|
||||
}
|
||||
} else if (danger(goal)) goal = you.x;
|
||||
for (const w of round.waves) {
|
||||
const d = (you.x - w.x) * w.dir;
|
||||
if (onGround && d > 0 && d < 7.5 && Math.abs(w.y - you.y) < 1) k.jump = true;
|
||||
}
|
||||
if (b.act === "surge" || b.act === "surgeWind") goal = you.x;
|
||||
if (b.act === "surge") {
|
||||
const d = (you.x - b.x) * Math.sign(b.surgeTo - b.x) - b.w / 2 - ghoul.HIT_W / 2;
|
||||
if (onGround && d > -1 && d < 7.5) k.jump = true;
|
||||
}
|
||||
for (const m of round.monsters) if (m.kind === "leech" && onGround && Math.abs(m.x - you.x) < 4.5 && Math.abs(m.y - you.y) < 2) k.jump = true;
|
||||
}
|
||||
if (goal !== null && Math.abs(goal - you.x) > 0.6) {
|
||||
const dir = goal > you.x ? 1 : -1;
|
||||
dir > 0 ? (k.right = true) : (k.left = true);
|
||||
if (onGround && !Number.isFinite(ghoul.groundAt(spec, you.x + dir * 2.2))) k.jump = true;
|
||||
} else if (b && b.state === "fight") {
|
||||
const want = Math.sign(b.x - you.x) || 1;
|
||||
if (you.face !== want) want > 0 ? (k.right = true) : (k.left = true);
|
||||
}
|
||||
// Up where bolts fly over her head (and no tide to wait out): drop down.
|
||||
const tide = round.hazards.some((h) => h.kind === "tide");
|
||||
if (b && b.state === "fight" && you.state === "run" && you.shelf >= 0 && !tide && b.act !== "pull" && you.y + ghoul.SHOT_Y > b.y + b.h - 0.5) {
|
||||
k.left = false;
|
||||
k.right = false;
|
||||
k.down = true;
|
||||
}
|
||||
if (mem.cool && round.heat < 4) mem.cool = false;
|
||||
if (!mem.cool && round.heat >= 28) mem.cool = true;
|
||||
k.fire = !mem.cool;
|
||||
return k;
|
||||
}
|
||||
|
||||
// The whole fight from the arena door, real hearts and a seeded draw: how long
|
||||
// it took (seconds from the fight's start) and how it went.
|
||||
function wholeFight(keys, seed) {
|
||||
const round = bogRound("drowning");
|
||||
standAt(round, round.spec.arena + ghoul.BOSS_LOCK + 2);
|
||||
const random = () => ((seed = (seed * 1103515245 + 12345) & 0x7fffffff) / 0x7fffffff);
|
||||
const mem = {};
|
||||
let start = -1;
|
||||
const causes = [];
|
||||
let t = 0;
|
||||
for (; t < 240000 && !round.over; t += 4) {
|
||||
// No Lucky dice: a die picked up off an add would stop the round to ask.
|
||||
round.dice = 0;
|
||||
const k = keys(round, mem);
|
||||
Object.assign(round.input, { left: k.left, right: k.right, fire: k.fire, down: k.down });
|
||||
if (k.jump && round.input.jump <= 0) round.input.jump = ghoul.JUMP_BUFFER_MS;
|
||||
ghoul.advance(round, 4, random);
|
||||
for (const e of round.events) {
|
||||
if (e.type === "bossGo" && start < 0) start = t;
|
||||
if (e.type === "lose") causes.push(e.cause);
|
||||
}
|
||||
const down = round.events.some((e) => e.type === "bossDown");
|
||||
round.events.length = 0;
|
||||
if (down) return { won: true, secs: (t - start) / 1000, causes, round };
|
||||
}
|
||||
return { won: false, secs: (t - start) / 1000, causes, round };
|
||||
}
|
||||
|
||||
test("Old Mother Bog takes a skilled player a real fight: a bot that plays sensibly kills her in 60 to 120 seconds on every seed, losing a heart or a few, never all", () => {
|
||||
const times = [];
|
||||
for (const seed of [7, 11, 23, 71]) {
|
||||
const fight = wholeFight(skilledKeys, seed);
|
||||
assert.ok(fight.won, `seed ${seed}: she fell (${fight.causes}; ${fight.secs.toFixed(1)} s, ${fight.round.lives} lives, phase ${fight.round.phase}, hp ${fight.round.boss?.hp})`);
|
||||
assert.ok(fight.secs >= 60 && fight.secs <= 120, `seed ${seed}: ${fight.secs.toFixed(1)} s of fight`);
|
||||
assert.ok(fight.round.lives > 0, "with hearts to spare");
|
||||
const known = new Set([...Object.keys(LOSE_WORDS), "pit", "zombie", "crawler"]);
|
||||
for (const c of fight.causes) assert.ok(known.has(c), `${c} has words`);
|
||||
times.push(fight.secs);
|
||||
}
|
||||
assert.ok(Math.max(...times) - Math.min(...times) > 3, `not the same fight every time (${times.map((t) => t.toFixed(1))})`);
|
||||
});
|
||||
|
||||
test("Old Mother Bog kills a player who stands still: an idle bot loses every heart while she is barely scratched", () => {
|
||||
const fight = wholeFight(() => ({}), 7);
|
||||
assert.equal(fight.won, false);
|
||||
assert.ok(fight.round.over, "game over");
|
||||
assert.ok(fight.round.boss.hp > fight.round.boss.max * 0.9, "she is barely scratched");
|
||||
assert.ok(fight.secs < 120, `down in ${fight.secs.toFixed(1)} s`);
|
||||
assert.ok(new Set(fight.causes).size >= 2, `by more than one move (${fight.causes})`);
|
||||
});
|
||||
|
||||
/* ------------------------------------------------------ voices, words, cards */
|
||||
@@ -738,7 +1439,7 @@ const heard = (e, extra = {}) => {
|
||||
};
|
||||
|
||||
test("Ghoul Rush's bog: every new kind has a voice for every act, every new event plays exactly one picked sound, and the tones are the stage's own", () => {
|
||||
const own = { lurker: ["appear", "snap", "sink", "hurt", "die"], leech: ["appear", "latch", "hurt", "die"], wisp: ["appear", "out", "relight", "on", "hurt", "die"], bogbody: ["appear", "rise", "hurt", "die"], motherbog: ["wake", "wind", "wave", "spitWind", "spit", "open", "sink", "bubble", "rise", "muck", "hurt", "weak", "die"] };
|
||||
const own = { lurker: ["appear", "snap", "sink", "hurt", "die"], leech: ["appear", "latch", "hurt", "die"], wisp: ["appear", "out", "relight", "on", "hurt", "die"], bogbody: ["appear", "rise", "hurt", "die"], motherbog: ["wake", "wind", "wave", "spitWind", "spit", "open", "sink", "bubble", "rise", "muck", "hurt", "weak", "die", "handsWind", "handsUp", "surgeWind", "surge", "shellWind", "chip", "shellBreak", "feed", "broodWind", "pour", "stompWind", "leap", "slam", "tideWarn", "tide", "pullWind", "pull", "callWind", "call", "lanternWind", "lantern", "combo"] };
|
||||
assert.deepEqual(Object.keys(VOICES).sort(), Object.keys(own).sort(), "a voice table for each new kind and the boss");
|
||||
for (const [kind, acts] of Object.entries(own)) assert.deepEqual(Object.keys(VOICES[kind]).sort(), [...acts].sort(), `${kind}: every act`);
|
||||
const names = Object.values(VOICES).flatMap((v) => Object.values(v));
|
||||
@@ -760,6 +1461,28 @@ test("Ghoul Rush's bog: every new kind has a voice for every act, every new even
|
||||
[{ type: "motherSink", kind: "motherbog" }, "motherbog", "sink"],
|
||||
[{ type: "motherBubble", kind: "motherbog" }, "motherbog", "bubble"],
|
||||
[{ type: "motherRise", kind: "motherbog" }, "motherbog", "rise"],
|
||||
[{ type: "handsWind", kind: "motherbog", xs: [12, 19] }, "motherbog", "handsWind"],
|
||||
[{ type: "handsUp", kind: "motherbog" }, "motherbog", "handsUp"],
|
||||
[{ type: "surgeWind", kind: "motherbog" }, "motherbog", "surgeWind"],
|
||||
[{ type: "motherSurge", kind: "motherbog" }, "motherbog", "surge"],
|
||||
[{ type: "shellWind", kind: "motherbog" }, "motherbog", "shellWind"],
|
||||
[{ type: "shellChip", kind: "motherbog" }, "motherbog", "chip"],
|
||||
[{ type: "shellBreak", kind: "motherbog" }, "motherbog", "shellBreak"],
|
||||
[{ type: "motherFeed", kind: "motherbog", heal: 14 }, "motherbog", "feed"],
|
||||
[{ type: "broodWind", kind: "motherbog" }, "motherbog", "broodWind"],
|
||||
[{ type: "broodPour", kind: "motherbog", n: 2 }, "motherbog", "pour"],
|
||||
[{ type: "stompWind", kind: "motherbog", landX: 14 }, "motherbog", "stompWind"],
|
||||
[{ type: "motherLeap", kind: "motherbog" }, "motherbog", "leap"],
|
||||
[{ type: "motherSlam", kind: "motherbog" }, "motherbog", "slam"],
|
||||
[{ type: "tideWarn", kind: "motherbog" }, "motherbog", "tideWarn"],
|
||||
[{ type: "tideRise", kind: "motherbog" }, "motherbog", "tide"],
|
||||
[{ type: "pullWind", kind: "motherbog" }, "motherbog", "pullWind"],
|
||||
[{ type: "motherPull", kind: "motherbog" }, "motherbog", "pull"],
|
||||
[{ type: "callWind", kind: "motherbog", xs: [12, 30] }, "motherbog", "callWind"],
|
||||
[{ type: "motherCall", kind: "motherbog", xs: [12, 30] }, "motherbog", "call"],
|
||||
[{ type: "lanternWind", kind: "motherbog" }, "motherbog", "lanternWind"],
|
||||
[{ type: "motherLantern", kind: "motherbog", n: 2 }, "motherbog", "lantern"],
|
||||
[{ type: "motherCombo", kind: "motherbog" }, "motherbog", "combo"],
|
||||
[{ type: "bossWake", kind: "motherbog" }, "motherbog", "wake"],
|
||||
[{ type: "bossHit", kind: "motherbog", how: "shot" }, "motherbog", "hurt"],
|
||||
[{ type: "bossHit", kind: "motherbog", how: "weak", weak: true }, "motherbog", "weak"],
|
||||
@@ -789,19 +1512,27 @@ test("Ghoul Rush's bog: every new kind has a voice for every act, every new even
|
||||
assert.equal(heard({ ...at, type: "bossHit", kind: "motherbog", how: "shot" }).includes(VOICES.motherbog.weak), false, "a plain shot is not weak");
|
||||
// Events that are only looks (the pull of the lure, a swarm coming apart) say nothing the voices own.
|
||||
for (const type of ["wispLure", "leechDie"]) assert.equal(heard({ ...at, type, kind: "leech" }).filter((n) => names.includes(n)).length, 0, `${type} is visual`);
|
||||
// Every picked tone exists in the merged tones, lives in the stage's file and is named by kind and act.
|
||||
// Every event the hag's rules raise is one of the cases above (so none is left without a voice).
|
||||
const raised = new Set();
|
||||
const src = readFileSync(new URL("../src/web-console/public/activities/ghoul-rush/stages/bog/ghoul-bog.js", import.meta.url), "utf8");
|
||||
for (const [, type] of src.matchAll(/type: "([a-zA-Z]+)"/g)) raised.add(type);
|
||||
for (const [, type] of src.matchAll(/ev\("([a-zA-Z]+)"/g)) raised.add(type);
|
||||
const covered = new Set([...cases.map(([e]) => e.type), "wispLure", "leechDie", "harpoonHit"]);
|
||||
for (const type of raised) assert.ok(covered.has(type), `${type} has a reaction checked here`);
|
||||
// Every picked tone exists in the merged tones, lives in the stage's file, is short and is named by kind and act.
|
||||
const merged = ghoulSfx.default.tones;
|
||||
for (const [kind, acts] of Object.entries(VOICES)) {
|
||||
for (const [act, name] of Object.entries(acts)) {
|
||||
assert.ok(merged[name]?.layers?.length, `${kind}.${act}: ${name} is in the merged tones`);
|
||||
assert.ok(BOG_SFX.tones[name], `${name} lives in ghoul-sfx-bog.js`);
|
||||
for (const l of BOG_SFX.tones[name].layers) assert.ok(l.seconds > 0 && l.seconds + (l.delay || 0) <= 1.2 + 1e-9, `${name} is over within 1.2 s`);
|
||||
assert.equal(name, `ghoul${kind === "motherbog" ? "Mother" : kind[0].toUpperCase() + kind.slice(1)}${act[0].toUpperCase()}${act.slice(1)}`, "named by kind and act");
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
test("Ghoul Rush's bog: every new way to die has its words and its own sound, and endless lives spare the heart for each", () => {
|
||||
const causes = ["lurker", "leeches", "wisp", "bogbody", "mudwave", "muck", "motherbog"];
|
||||
const causes = ["lurker", "leeches", "wisp", "bogbody", "mudwave", "muck", "boghand", "tide", "motherbog"];
|
||||
assert.deepEqual(Object.keys(LOSE_WORDS).sort(), [...causes].sort(), "words for exactly these");
|
||||
assert.deepEqual(Object.keys(LOSE_SOUNDS).sort(), [...causes].sort(), "a sound for exactly these");
|
||||
for (const cause of causes) {
|
||||
@@ -818,7 +1549,7 @@ test("Ghoul Rush's bog: every new way to die has its words and its own sound, an
|
||||
assert.equal(normal.lives, had - 1, `${cause} costs a heart otherwise`);
|
||||
}
|
||||
// The real causes the stage raises are all among them.
|
||||
for (const cause of ["leeches", "mudwave", "muck", "motherbog"]) assert.ok(LOSE_WORDS[cause]);
|
||||
for (const cause of ["leeches", "mudwave", "muck", "boghand", "tide", "motherbog"]) assert.ok(LOSE_WORDS[cause]);
|
||||
assert.equal(bog.BOG.cause.motherbog(), "motherbog");
|
||||
});
|
||||
|
||||
@@ -857,14 +1588,14 @@ test("Ghoul Rush's bog round flow: the stage card opens before the Sunken Boardw
|
||||
assert.equal(r.phase, "ready");
|
||||
ghoul.advance(r, ghoul.READY_MS + 20, steady);
|
||||
assert.equal(r.phase, "play");
|
||||
for (const id of ["hollow", "stilts", "bogboat"]) {
|
||||
for (const id of ["hollow", "stilts", "lantern"]) {
|
||||
r.events.length = 0;
|
||||
through(r);
|
||||
assert.equal(r.spec.id, id);
|
||||
assert.notEqual(r.phase, "bossintro", `${id}: no boss card`);
|
||||
assert.equal(r.events.some((e) => e.type === "bossIntro"), false);
|
||||
}
|
||||
assert.ok(ghoul.roomById("bogboat").bonus, "the ride comes right before the boss");
|
||||
assert.ok(ghoul.roomById("lantern").bonus, "the bonus round comes right before the boss");
|
||||
r.events.length = 0;
|
||||
through(r);
|
||||
assert.equal(r.spec.id, "drowning");
|
||||
@@ -918,22 +1649,25 @@ test("Ghoul Rush's bog draws: every walked room and the arena, every monster in
|
||||
if (r.boss) {
|
||||
ghoul.advance(r, ghoul.BOSS_INTRO_MS + 16, steady);
|
||||
for (const hidden of [false, true]) {
|
||||
for (const act of ["idle", "wind", "rest", "throwWind", "sink", "under", "resurface"]) {
|
||||
Object.assign(r.boss, { act, wait: 400, dir: -1, lit: act === "rest", hidden: hidden && (act === "sink" || act === "under"), sinkX: r.boss.x - 10, home: 6 });
|
||||
for (const act of ["idle", "wind", "rest", "throwWind", "sink", "under", "resurface", "hands", "surgeWind", "surge", "shellWind", "shell", "stagger", "broodWind", "stompWind", "stompAir", "tideWind", "tideHold", "pullWind", "pull", "callWind", "lanternWind"]) {
|
||||
Object.assign(r.boss, { act, wait: 400, dir: -1, lit: act === "rest" || act === "stagger", hidden: hidden && (act === "sink" || act === "under"), sinkX: r.boss.x - 10, home: 6, floor: 6, y: act === "surge" ? 6 - bog.SURGE_SINK : act === "stompAir" ? 14 : 6, landX: r.boss.x - 12, airMs: 300, callXs: [r.boss.x - 12, r.boss.x - 24], shell: 5, shellMax: bog.SHELL_HP[0], comboMs: hidden ? 200 : 0 });
|
||||
g.tick(16);
|
||||
drew++;
|
||||
}
|
||||
Object.assign(r.boss, { y: 6, comboMs: 0 });
|
||||
}
|
||||
Object.assign(r.boss, { hidden: false, act: "rest", wait: 1e9 });
|
||||
r.hazards.push({ kind: "muck", x: r.you.x + 10, y: 6, w: bog.MUCK_W, h: bog.MUCK_H, warn: 400, live: 0, cause: "muck", sx: r.boss.x, sy: 9 }, { kind: "muck", x: r.you.x + 20, y: 6, w: bog.MUCK_W, h: bog.MUCK_H, warn: 0, live: 1500, cause: "muck" });
|
||||
r.waves.push({ x: r.you.x + 8, y: 6, dir: -1, life: 6000, kind: "mudwave", cause: "mudwave" });
|
||||
r.hazards.push({ kind: "boghand", x: r.you.x + 14, y: 6, w: bog.HAND_W, h: bog.HAND_H, warn: 500, full: 1200, live: 0, cause: "boghand" }, { kind: "boghand", x: r.you.x + 18, y: 6, w: bog.HAND_W, h: bog.HAND_H, warn: 0, live: 300, cause: "boghand" });
|
||||
r.hazards.push({ kind: "tide", x: 152, y: 5, w: 104, h: 1.6, x0: 104, x1: 200, warn: 600, live: 0, cause: "tide" }, { kind: "tide", x: 152, y: 5, w: 104, h: 1.6, x0: 104, x1: 200, warn: 0, live: 2000, cause: "tide" });
|
||||
}
|
||||
for (let k = 0; k < 20; k++) g.tick(16);
|
||||
r.you.safeMs = 1e9;
|
||||
drew++;
|
||||
}
|
||||
}
|
||||
assert.ok(drew >= 8 + 14, "drew a lot");
|
||||
assert.ok(drew >= 8 + 44, "drew a lot");
|
||||
assert.equal(r.spec.id, "drowning", "got to the pool and drew it");
|
||||
});
|
||||
|
||||
|
||||
@@ -1,945 +0,0 @@
|
||||
// Web console tests, Ghoul Rush's Bog Runner (Gallows Bog's bonus round, between the Stilt House and the Drowning Pool): its shape (two lanes, the banks, every thing spaced for a player), the boat's motion (a steady speed on the channel, slower on the flats, a jump, a duck, a hop between lanes only at a bank), each obstacle and its cost (snag, knee, veil, limb), the fan's clog and stall, the swarm in the wake and its catch, the charms and gas pockets shot for points and a cover burst, the hearts and the grade and the dice, endless lives, the drawing and the sounds, and bots that play it.
|
||||
// Run with: node --test scripts/test-web-console-activities-ghoul-bogboat.mjs
|
||||
import { test } from "node:test";
|
||||
import assert from "node:assert/strict";
|
||||
import * as ghoul from "../src/web-console/public/activities/ghoul.js";
|
||||
import { skipBossIntro } from "./ghoul-test-helpers.mjs";
|
||||
import * as bz from "../src/web-console/public/activities/ghoul-bogboat.js";
|
||||
import { ANSWERS, EVENT_VOICE, LOOKS as BOAT_LOOKS, LOSE_SOUNDS, LOSE_WORDS, TELEGRAPH_WORDS, VOICES as BOAT_VOICES, telegraphMarks, telegraphs } from "../src/web-console/public/activities/ghoul-bogboat-draw.js";
|
||||
import * as ghoulSfx from "../src/web-console/public/activities/ghoul-sfx.js";
|
||||
import { BOGBOAT_SFX } from "../src/web-console/public/activities/ghoul-sfx-bogboat.js";
|
||||
import { LOOKS, VOICES, bonusTick, react } from "../src/web-console/public/activities/ghoul-draw.js";
|
||||
import { BONUS_FLOOR, diceFor, endBonus, makeBonus } from "../src/web-console/public/activities/ghoul-bonus.js";
|
||||
|
||||
const steady = () => 0.5;
|
||||
// The pack draws no random number: a run on this fails on the first draw.
|
||||
const never = () => {
|
||||
throw new Error("the bog runner drew a random number");
|
||||
};
|
||||
const events = (round, type) => round.events.filter((e) => e.type === type);
|
||||
|
||||
function through(round) {
|
||||
round.phase = "clear";
|
||||
round.phaseMs = 1;
|
||||
ghoul.advance(round, 4, steady);
|
||||
}
|
||||
|
||||
// A round in the Bog Runner reached the way play reaches it, nothing woken, the clocks long,
|
||||
// the bonus round on (five hearts).
|
||||
function boatRound(seed = 5) {
|
||||
const round = ghoul.newRound(seed);
|
||||
round.lives = 3;
|
||||
round.dice = 0;
|
||||
through(round);
|
||||
round.offer = ["bog"];
|
||||
round.phaseMs = 0;
|
||||
ghoul.pickStage(round, 0);
|
||||
while (round.spec.id !== "bogboat") through(round);
|
||||
round.phase = "play";
|
||||
for (const st of round.spawns) st.over = true;
|
||||
round.monsters.length = 0;
|
||||
round.hordeMs = Infinity;
|
||||
round.timeMs = 1e9;
|
||||
round.bonus = 1e9;
|
||||
round.events.length = 0;
|
||||
return round;
|
||||
}
|
||||
|
||||
const NONE = { runner: "bogboat", time: 1e9, finish: 1e6, banks: [], snags: [], knees: [], veils: [], limbs: [], props: [], gas: [], checks: [] };
|
||||
// The same round over a ride of its own (a plain channel to measure the boat on).
|
||||
function synth(ride) {
|
||||
const round = boatRound();
|
||||
round.spec = { ...round.spec, start: 10, ground: [[0, 1e6, 9]], ride: { ...NONE, ...ride } };
|
||||
round.runner = null;
|
||||
bz.BOGBOAT.place[0](round, {});
|
||||
return round;
|
||||
}
|
||||
|
||||
// The boat at `x` in `lane`, on the water.
|
||||
function at(round, x, lane = 0, { safe = false } = {}) {
|
||||
Object.assign(round.runner, { lane, from: lane, swMs: 0, h: 0, vy: 0, air: false, v: lane ? bz.FLATS_V : bz.BOGBOAT_V, stall: 0, clog: 0 });
|
||||
Object.assign(round.you, { x, y: bz.LANE_Y[lane], vy: 0, state: "run", shelf: -1, face: 1, out: 0, safeMs: safe ? 1e9 : 0, ducking: false });
|
||||
round.camX = Math.max(0, Math.min(round.spec.length - ghoul.FIELD_W, x - 24));
|
||||
}
|
||||
|
||||
function run(round, ms, keys = {}, random = steady) {
|
||||
Object.assign(round.input, keys);
|
||||
for (let t = 0; t < ms; t += 4) ghoul.advance(round, 4, random);
|
||||
for (const k of Object.keys(keys)) round.input[k] = typeof keys[k] === "number" ? 0 : false;
|
||||
}
|
||||
|
||||
function until(round, done, ms = 6000, random = steady) {
|
||||
let t = 0;
|
||||
for (; t < ms && !done(); t += 4) ghoul.advance(round, 4, random);
|
||||
return t;
|
||||
}
|
||||
|
||||
const press = (round) => {
|
||||
round.input.jump = ghoul.JUMP_BUFFER_MS;
|
||||
round.input.up = true;
|
||||
};
|
||||
|
||||
const heard = (e, extra = {}) => {
|
||||
const played = [];
|
||||
const noop = () => {};
|
||||
const kit = { tone: (name) => played.push(name), burst: noop, float: noop, ring: noop, banner: () => null, shake: noop, flash: noop, glow: noop, splat: noop, fx: { clock: 1e6 }, monsters: ghoul.MONSTERS, powers: ghoul.POWERS, bosses: ghoul.BOSSES, g: {}, floorAt: () => 6, ...extra };
|
||||
react({ x: 10, y: 9, tx: 20, ty: 9, ...e }, kit);
|
||||
return { played };
|
||||
};
|
||||
|
||||
const ROOM = ghoul.roomById("bogboat");
|
||||
const R = ROOM.ride;
|
||||
const V = bz.BOGBOAT_V;
|
||||
const things = () => [
|
||||
...R.snags.map(([x, lane], i) => ({ id: `s${i}`, kind: "snag", lane, x })),
|
||||
...R.knees.map(([x, lane], i) => ({ id: `k${i}`, kind: "knee", lane, x })),
|
||||
...R.veils.map(([x0, x1, lane], i) => ({ id: `v${i}`, kind: "veil", lane, x: (x0 + x1) / 2 })),
|
||||
...R.limbs.map(([x0, x1, lane], i) => ({ id: `l${i}`, kind: "limb", lane, x: (x0 + x1) / 2 })),
|
||||
...R.props.map(([x, lane], i) => ({ id: `p${i}`, kind: "prop", lane, x })),
|
||||
...R.gas.map(([x, lane], i) => ({ id: `g${i}`, kind: "gas", lane, x })),
|
||||
];
|
||||
const HARMFUL = new Set(["snag", "knee", "veil", "limb"]);
|
||||
|
||||
/* -------------------------------------------------------------- the room */
|
||||
|
||||
test("Ghoul Rush's Bog Runner is Gallows Bog's fourth room, between the Stilt House and the Drowning Pool: lit, no key, no boss, a ride about a minute long, a bonus round that plays its own track", () => {
|
||||
const st = ghoul.stageById("bog");
|
||||
assert.deepEqual(st.rooms, ["boardwalk", "hollow", "stilts", "bogboat", "drowning"]);
|
||||
assert.deepEqual([ROOM.title, ROOM.sub], ["The Bog Runner", "Something swims in your wake"]);
|
||||
assert.equal(ROOM.dark, false, "a moonlit night, always lit");
|
||||
assert.equal(ROOM.key, null);
|
||||
assert.equal(ROOM.boss, null);
|
||||
assert.equal(ROOM.bonus, true, "a bonus round");
|
||||
assert.equal(R.runner, "bogboat");
|
||||
assert.ok(ROOM.length >= 2400 && ROOM.length <= 3000, `${ROOM.length} units long`);
|
||||
assert.equal(ghoul.ROOM_MUSIC.bogboat, "ghoulBoatRide");
|
||||
assert.ok(ghoulSfx.default.music.ghoulBoatRide, "its own track");
|
||||
assert.deepEqual(Object.keys(bz.BOGBOAT.monsters), [], "no new monster kinds");
|
||||
assert.equal(LOOKS.bogboat, BOAT_LOOKS.bogboat);
|
||||
assert.equal(LOOKS.bogboat.pack, "bogboat");
|
||||
assert.ok(Object.isFrozen(R) && Object.isFrozen(R.snags) && Object.isFrozen(R.snags[0]), "frozen all the way down");
|
||||
assert.ok(ROOM.horde.length === 0 && ROOM.spawns.length === 0 && ROOM.items.length === 0, "no monsters or pickups: the things on the water are the pack's own");
|
||||
assert.deepEqual(ROOM.ground.map((g) => g.slice()), [[0, ROOM.length, bz.LANE_Y[0]]], "one flat floor under the water");
|
||||
assert.ok(R.finish < ROOM.door && ROOM.door > ROOM.length - 20, "the door at the room's end, past the finish");
|
||||
assert.ok(ghoul.groundAt(ROOM, ROOM.door - 2) > -Infinity, "floor to walk out on");
|
||||
const secs = (R.finish - ROOM.start) / V;
|
||||
assert.ok(secs >= 56 && secs <= 80, `${secs.toFixed(1)} s at BOGBOAT_V`);
|
||||
assert.equal(ghoul.timeFor(ROOM), R.time, "its own clock");
|
||||
assert.ok(R.time / 1000 > secs * 1.4, "a clock with room to spare");
|
||||
assert.equal(ghoul.STAGES.find((s) => s.id === "bog").rooms.length, 5);
|
||||
assert.equal(R.banks.length, 11);
|
||||
assert.equal(R.checks.length, 4);
|
||||
assert.ok(R.props.length >= 16 && R.gas.length >= 14, "enough to shoot");
|
||||
assert.ok(R.snags.length && R.knees.length && R.veils.length && R.limbs.length, "one of each thing to dodge");
|
||||
});
|
||||
|
||||
test("Ghoul Rush's Bog Runner: every thing is in lane 0 or 1, off the ends, spaced for a player, and clear of the banks", () => {
|
||||
const all = things();
|
||||
assert.ok(all.length >= 70 && all.length <= 130, `${all.length} things`);
|
||||
for (const t of all) {
|
||||
assert.ok(t.lane === 0 || t.lane === 1, `${t.id} lane`);
|
||||
assert.ok(t.x >= 120 && t.x < R.finish - 40, `${t.id} at ${t.x}`);
|
||||
}
|
||||
for (const lane of [0, 1]) assert.ok(all.filter((t) => t.lane === lane && HARMFUL.has(t.kind)).length >= 12, `plenty to dodge in lane ${lane}`);
|
||||
// The same lane: 36 between any two (a jump and a duck need 38 at the full speed, so the slots never share).
|
||||
for (const lane of [0, 1]) {
|
||||
const xs = all.filter((t) => t.lane === lane).map((t) => t.x).sort((a, b) => a - b);
|
||||
for (let i = 1; i < xs.length; i++) assert.ok(xs[i] - xs[i - 1] >= 36, `lane ${lane}: ${xs[i - 1]} and ${xs[i]}`);
|
||||
}
|
||||
// Banks: 16 wide, 200 apart, in order, and nothing within the hop of one.
|
||||
R.banks.forEach(([a, b], i) => {
|
||||
assert.equal(b - a, 16);
|
||||
if (i) assert.equal(a - R.banks[i - 1][0], 200, "banks are spaced out");
|
||||
for (const t of all) assert.ok(t.x < a - 6 || t.x > b + 22, `${t.id} at ${t.x} is near the bank ${a}`);
|
||||
});
|
||||
for (const [x0, x1] of R.veils) assert.equal(x1 - x0, 8);
|
||||
for (const [x0, x1] of R.limbs) assert.equal(x1 - x0, 6);
|
||||
// The channel is the thicker lane and the flats hold most of the gas.
|
||||
const dense = (lane) => all.filter((t) => t.lane === lane && HARMFUL.has(t.kind)).length;
|
||||
assert.ok(dense(0) > dense(1) * 1.5, `${dense(0)} to dodge in the channel, ${dense(1)} on the flats`);
|
||||
});
|
||||
|
||||
test("Ghoul Rush's Bog Runner: every jump is clearable and every duck passable, at the speed of either lane, and the checkpoints sit clear of the banks", () => {
|
||||
const clearFor = (h, speed) => (2 * Math.sqrt(bz.JUMP_V ** 2 - 2 * bz.GRAVITY * h) / bz.GRAVITY) * speed;
|
||||
for (const speed of [bz.BOGBOAT_V, bz.FLATS_V]) {
|
||||
assert.ok(clearFor(bz.SNAG_H, speed) >= bz.SNAG_W + ghoul.HIT_W + 8, `a snag at ${speed}`);
|
||||
assert.ok(clearFor(bz.KNEE_H, speed) >= bz.KNEE_W + ghoul.HIT_W + 8, `knees at ${speed}`);
|
||||
}
|
||||
assert.ok(bz.SNAG_H < (bz.JUMP_V ** 2) / (2 * bz.GRAVITY) - 4, "a snag is well under the jump's peak");
|
||||
assert.ok(ghoul.DUCK_H < bz.LOW_Y && ghoul.HIT_H > bz.LOW_Y, "a ducked Planny fits under a low and a standing one does not");
|
||||
R.checks.forEach((x, i) => {
|
||||
if (i) assert.ok(x - R.checks[i - 1] >= 400);
|
||||
assert.ok(R.banks.every(([a, b]) => x < a - 4 || x > b + 4));
|
||||
});
|
||||
});
|
||||
|
||||
/* ---------------------------------------------------------------- the boat */
|
||||
|
||||
test("Ghoul Rush's Bog Runner rolls at BOGBOAT_V on the channel whatever is pressed, slower on the flats, and DOWN eases the throttle in either; the camera leads it", () => {
|
||||
const round = synth({});
|
||||
assert.equal(round.runner.id, "bogboat");
|
||||
assert.equal(round.camLead, bz.CAM_AHEAD);
|
||||
assert.equal(round.you.y, bz.LANE_Y[0]);
|
||||
const x0 = round.you.x;
|
||||
run(round, 1000);
|
||||
assert.ok(Math.abs(round.you.x - x0 - V) < 0.5, `${round.you.x - x0} in a second`);
|
||||
for (const keys of [{ left: true }, { fire: true }]) {
|
||||
const a = round.you.x;
|
||||
run(round, 500, keys);
|
||||
assert.ok(Math.abs(round.you.x - a - V / 2) < 0.5, JSON.stringify(keys));
|
||||
}
|
||||
assert.equal(round.you.face, 1);
|
||||
// Left and right do nothing off a bank.
|
||||
run(round, 400, { right: true });
|
||||
assert.equal(round.runner.lane, 0);
|
||||
assert.equal(round.you.y, bz.LANE_Y[0]);
|
||||
const speedOf = (lane, keys) => {
|
||||
const r = synth({});
|
||||
at(r, 100, lane);
|
||||
run(r, 1500, keys);
|
||||
return r.runner.v;
|
||||
};
|
||||
assert.ok(Math.abs(speedOf(0, {}) - bz.BOGBOAT_V) < 0.3);
|
||||
assert.ok(Math.abs(speedOf(0, { down: true }) - bz.EASE_V) < 0.3);
|
||||
assert.ok(Math.abs(speedOf(1, {}) - bz.FLATS_V) < 0.3);
|
||||
assert.ok(Math.abs(speedOf(1, { down: true }) - bz.FLATS_EASE_V) < 0.3);
|
||||
});
|
||||
|
||||
test("Ghoul Rush's Bog Runner jumps about 13 high for about three quarters of a second, a press saved for a landing jumps on it, and it cannot jump in the air", () => {
|
||||
const round = synth({});
|
||||
at(round, 100, 0, { safe: true });
|
||||
let peak = 0;
|
||||
let ms = 0;
|
||||
press(round);
|
||||
ghoul.advance(round, 4, steady);
|
||||
round.input.up = false;
|
||||
assert.equal(round.runner.air, true);
|
||||
while (round.runner.air && ms < 2000) {
|
||||
ghoul.advance(round, 4, steady);
|
||||
peak = Math.max(peak, round.you.y - bz.LANE_Y[0]);
|
||||
ms += 4;
|
||||
}
|
||||
assert.ok(peak > 12 && peak < 15, `${peak} high`);
|
||||
assert.ok(ms > 650 && ms < 850, `${ms} ms`);
|
||||
assert.equal(round.you.y, bz.LANE_Y[0]);
|
||||
assert.equal(events(round, "bogboatJump").length, 1);
|
||||
assert.equal(events(round, "bogboatLand").length, 1);
|
||||
// A press in the air does not double jump, but waits for the landing.
|
||||
const again = synth({});
|
||||
at(again, 100, 0, { safe: true });
|
||||
press(again);
|
||||
ghoul.advance(again, 4, steady);
|
||||
run(again, 400);
|
||||
press(again);
|
||||
run(again, 100);
|
||||
assert.ok(again.runner.vy <= 0 || again.runner.air, "no second jump in mid-air");
|
||||
until(again, () => !again.runner.air, 1000);
|
||||
press(again);
|
||||
ghoul.advance(again, 4, steady);
|
||||
assert.equal(again.runner.air, true, "a press saved for the landing jumps on it");
|
||||
});
|
||||
|
||||
test("Ghoul Rush's Bog Runner: DOWN ducks, a ducked Planny passes under a veil or a limb and a standing one hits it (causes veil and limb), at the cost of a heart", () => {
|
||||
for (const [key, cause, ride] of [["veils", "veil", { veils: [[300, 308, 0]] }], ["limbs", "limb", { limbs: [[300, 306, 0]] }]]) {
|
||||
const standing = synth(ride);
|
||||
at(standing, 270, 0);
|
||||
run(standing, 1500);
|
||||
assert.equal(standing.bonusRound.hearts, 4, `${key}: a standing boat is hit`);
|
||||
assert.equal(events(standing, "lose").map((e) => e.cause).join(), cause);
|
||||
const ducked = synth(ride);
|
||||
at(ducked, 270, 0);
|
||||
run(ducked, 1500, { down: true });
|
||||
assert.equal(ducked.bonusRound.hearts, 5, `${key}: a ducked boat passes`);
|
||||
assert.equal(events(ducked, "bogboatDuck").length, 1);
|
||||
assert.equal(events(ducked, "lose").length, 0);
|
||||
}
|
||||
});
|
||||
|
||||
test("Ghoul Rush's Bog Runner: a snag or cypress knees stop a boat that does not jump (causes snag and knee); a jump clears each; each costs only once", () => {
|
||||
for (const [cause, ride] of [["snag", { snags: [[300, 0]] }], ["knee", { knees: [[300, 0]] }]]) {
|
||||
const hit = synth(ride);
|
||||
at(hit, 270, 0);
|
||||
run(hit, 1500);
|
||||
assert.equal(hit.bonusRound.hearts, 4, cause);
|
||||
assert.equal(events(hit, "lose").map((e) => e.cause).join(), cause, "one heart, once");
|
||||
assert.equal(events(hit, "bogboatCrash").length, 1);
|
||||
const jumped = synth(ride);
|
||||
at(jumped, 270, 0);
|
||||
let pressed = false;
|
||||
until(jumped, () => {
|
||||
if (!pressed && jumped.you.x >= 300 - 14) {
|
||||
press(jumped);
|
||||
pressed = true;
|
||||
}
|
||||
return jumped.you.x > 340;
|
||||
}, 3000);
|
||||
assert.equal(jumped.bonusRound.hearts, 5, `${cause}: a jump clears it`);
|
||||
assert.equal(jumped.bonusRound.perf.hits.length, 0);
|
||||
}
|
||||
// The things in the other lane do not touch a boat.
|
||||
const other = synth({ snags: [[300, 1]], knees: [[300, 1]], veils: [[330, 338, 1]], limbs: [[360, 366, 1]] });
|
||||
at(other, 270, 0);
|
||||
run(other, 2400);
|
||||
assert.equal(other.bonusRound.hearts, 5);
|
||||
});
|
||||
|
||||
test("Ghoul Rush's Bog Runner switches lanes only inside a bank: LEFT is the channel, RIGHT the flats, in SWITCH_MS, with no jump or duck in the hop; the boat slows to the flats' speed and comes back up to the channel's", () => {
|
||||
const round = synth({ banks: [[300, 316], [500, 516]] });
|
||||
at(round, 301, 0, { safe: true });
|
||||
run(round, 200, { right: true });
|
||||
assert.equal(round.runner.lane, 1);
|
||||
assert.equal(events(round, "bogboatSwitch").length, 1);
|
||||
assert.equal(events(round, "bogboatSwitch")[0].to, 1);
|
||||
assert.ok(round.runner.swMs > 0, "mid-hop");
|
||||
assert.equal(round.you.state, "run");
|
||||
// No jump or duck in the hop.
|
||||
press(round);
|
||||
ghoul.advance(round, 4, steady);
|
||||
assert.equal(round.runner.air, false);
|
||||
round.input.up = false;
|
||||
run(round, bz.SWITCH_MS);
|
||||
assert.equal(round.runner.swMs, 0);
|
||||
assert.equal(round.you.y, bz.LANE_Y[1], "up on the flats");
|
||||
assert.ok(round.runner.v < bz.BOGBOAT_V - 5, "slowed");
|
||||
// Not outside a bank.
|
||||
run(round, 400, { left: true });
|
||||
assert.equal(round.runner.lane, 1, "off a bank nothing changes");
|
||||
// Back down at the next one.
|
||||
at(round, 496, 1, { safe: true });
|
||||
run(round, 600, { left: true });
|
||||
assert.equal(round.runner.lane, 0);
|
||||
assert.equal(round.you.y, bz.LANE_Y[0]);
|
||||
// Not in the air.
|
||||
const air = synth({ banks: [[300, 316]] });
|
||||
at(air, 304, 0, { safe: true });
|
||||
press(air);
|
||||
run(air, 40);
|
||||
run(air, 40, { right: true });
|
||||
assert.equal(air.runner.lane, 0, "no switch in the air");
|
||||
});
|
||||
|
||||
test("Ghoul Rush's Bog Runner: the fan clogs on the flats at full throttle (a warning at CLOG_WARN, a stall at CLOG_MAX that stops the boat for STALL_MS), an ease or the channel clears it", () => {
|
||||
const round = synth({});
|
||||
at(round, 100, 1, { safe: true });
|
||||
run(round, 1000);
|
||||
assert.ok(Math.abs(round.runner.clog - bz.CLOG_RISE) < 2, `${round.runner.clog} after a second`);
|
||||
until(round, () => events(round, "bogboatClog").length > 0, 4000);
|
||||
assert.ok(round.runner.clog >= bz.CLOG_WARN - 1);
|
||||
until(round, () => round.runner.stall > 0, 4000);
|
||||
assert.equal(events(round, "bogboatStall").length, 1);
|
||||
run(round, 800);
|
||||
assert.ok(round.runner.v < 3, `coasting to a stop (${round.runner.v})`);
|
||||
const x = round.you.x;
|
||||
until(round, () => round.runner.stall === 0, 2000);
|
||||
assert.equal(round.runner.stall, 0);
|
||||
assert.ok(round.runner.clog >= bz.CLOG_RESTART && round.runner.clog < bz.CLOG_WARN, `restarted at ${round.runner.clog}`);
|
||||
assert.ok(round.you.x - x < 6, "hardly moved while stalled");
|
||||
// Eased, the flats cool the fan.
|
||||
const eased = synth({});
|
||||
at(eased, 100, 1, { safe: true });
|
||||
run(eased, 1200);
|
||||
const hot = eased.runner.clog;
|
||||
run(eased, 1000, { down: true });
|
||||
assert.ok(eased.runner.clog < hot, "an ease cools it");
|
||||
// And the channel does.
|
||||
const channel = synth({});
|
||||
at(channel, 100, 0, { safe: true });
|
||||
channel.runner.clog = 80;
|
||||
run(channel, 1000);
|
||||
assert.ok(Math.abs(channel.runner.clog - (80 - bz.CLOG_COOL)) < 0.5, `${channel.runner.clog}`);
|
||||
// A stalled fan stops the boat, so the swarm gains on it.
|
||||
const lost = synth({});
|
||||
at(lost, 100, 1, { safe: true });
|
||||
Object.assign(lost.runner, { clog: bz.CLOG_MAX - 0.1, gap: bz.GAP_MAX });
|
||||
until(lost, () => lost.runner.stall > 0, 1000);
|
||||
const gap = lost.runner.gap;
|
||||
run(lost, 1000);
|
||||
assert.ok(lost.runner.gap < gap - 10, `${gap} to ${lost.runner.gap}`);
|
||||
});
|
||||
|
||||
test("Ghoul Rush's Bog Runner's wake: it opens on clean riding, closes when the boat is eased or on the flats, a hit shoves it HIT_CLOSE closer, and PANIC_ON boils it until PANIC_OFF", () => {
|
||||
const round = synth({});
|
||||
at(round, 100, 0, { safe: true });
|
||||
run(round, 500);
|
||||
assert.ok(round.runner.gap > bz.GAP_START, "opening");
|
||||
run(round, 2000);
|
||||
assert.equal(round.runner.gap, bz.GAP_MAX, "never over GAP_MAX");
|
||||
const eased = synth({});
|
||||
at(eased, 100, 0, { safe: true });
|
||||
eased.runner.gap = 30;
|
||||
run(eased, 2000, { down: true });
|
||||
assert.ok(eased.runner.gap < 30, "the ease loses ground");
|
||||
const flats = synth({});
|
||||
at(flats, 100, 1, { safe: true });
|
||||
flats.runner.gap = 30;
|
||||
run(flats, 500, { down: true });
|
||||
assert.ok(flats.runner.gap < 30, "the eased flats lose ground");
|
||||
// A hit shoves it closer.
|
||||
const hit = synth({ snags: [[300, 0]] });
|
||||
at(hit, 280, 0);
|
||||
hit.runner.gap = 30;
|
||||
run(hit, 500);
|
||||
assert.ok(hit.runner.gap <= 30 - bz.HIT_CLOSE + (V - bz.WAKE_V) * 0.5 + 1, `${hit.runner.gap}`);
|
||||
assert.equal(hit.bonusRound.hearts, 4);
|
||||
// PANIC_ON: the swarm boils (an event, once), PANIC_OFF puts it out and it can boil again.
|
||||
const panic = synth({});
|
||||
at(panic, 100, 0, { safe: true });
|
||||
panic.runner.gap = bz.PANIC_ON + 0.5;
|
||||
panic.runner.v = 20;
|
||||
run(panic, 200, { down: true });
|
||||
assert.equal(panic.runner.panic, true);
|
||||
assert.equal(events(panic, "bogboatPanic").length, 1);
|
||||
run(panic, 4000);
|
||||
assert.equal(panic.runner.panic, false);
|
||||
assert.equal(panic.bonusRound.perf.steady, false, "a swarm that boiled loses the steady die");
|
||||
assert.equal(panic.runner.panicked, true);
|
||||
const clean = synth({});
|
||||
at(clean, 100, 0, { safe: true });
|
||||
run(clean, 3000);
|
||||
assert.equal(clean.bonusRound.perf.steady, true);
|
||||
});
|
||||
|
||||
test("Ghoul Rush's Bog Runner: at WAKE_CATCH the swarm has you, a heart (cause wake), and it falls back to WAKE_FALLBACK, once; a blinking boat is caught for free; the catch is counted for the grade", () => {
|
||||
const round = synth({});
|
||||
at(round, 100, 0);
|
||||
round.runner.v = 20;
|
||||
round.runner.gap = bz.WAKE_CATCH + 0.2;
|
||||
run(round, 200, { down: true });
|
||||
assert.equal(round.bonusRound.hearts, 4);
|
||||
assert.equal(events(round, "lose").map((e) => e.cause).join(), "wake");
|
||||
assert.equal(events(round, "bogboatCatch").length, 1);
|
||||
assert.ok(round.runner.gap > bz.WAKE_FALLBACK - 3 && round.runner.gap <= bz.WAKE_FALLBACK + 2, `${round.runner.gap}`);
|
||||
assert.equal(round.runner.catches, 1);
|
||||
assert.equal(round.bonusRound.perf.total, 1);
|
||||
assert.deepEqual(round.bonusRound.perf.hits, ["w1"]);
|
||||
assert.equal(round.phase, "play", "the ride goes on");
|
||||
const free = synth({});
|
||||
at(free, 100, 0, { safe: true });
|
||||
free.runner.v = 20;
|
||||
free.runner.gap = bz.WAKE_CATCH + 0.2;
|
||||
run(free, 200, { down: true });
|
||||
assert.equal(free.bonusRound.hearts, 5);
|
||||
assert.equal(events(free, "bogboatCatch").length, 1);
|
||||
assert.equal(free.runner.gap > bz.WAKE_CATCH + 10, true, "still falls back");
|
||||
});
|
||||
|
||||
/* ------------------------------------------------------------ shooting */
|
||||
|
||||
test("Ghoul Rush's Bog Runner: one bolt breaks a charm (60 points) and one bursts a gas pocket (90 points, the wake pushed back GAS_PUSH), each an act for the grade; a bolt at another height flies on; a pocket stays burst across a re-seat", () => {
|
||||
const round = synth({ props: [[330, 0, 0], [380, 1, 1]], gas: [[420, 0], [470, 1]] });
|
||||
at(round, 300, 0, { safe: true });
|
||||
round.runner.gap = 20;
|
||||
const score = round.score;
|
||||
round.shots.push({ x: 328, y: bz.LANE_Y[0] + 2.4, vx: 130, vy: 0, gone: 0 });
|
||||
ghoul.advance(round, 4, steady);
|
||||
assert.equal(round.runner.props[0].state, "broken");
|
||||
assert.equal(round.score - score, bz.PROP_POINTS);
|
||||
assert.equal(round.bonusRound.perf.acts, 1);
|
||||
assert.equal(events(round, "bogboatProp").length, 1);
|
||||
assert.equal(events(round, "bogboatProp")[0].points, bz.PROP_POINTS);
|
||||
// A bolt too high flies on, one in the wrong lane too.
|
||||
round.shots.push({ x: 418, y: bz.LANE_Y[0] + 9, vx: 130, vy: 0, gone: 0 });
|
||||
round.shots.push({ x: 468, y: bz.LANE_Y[0] + 2.4, vx: 130, vy: 0, gone: 0 });
|
||||
ghoul.advance(round, 4, steady);
|
||||
assert.equal(round.runner.gas[0].state, "up");
|
||||
assert.equal(round.runner.gas[1].state, "up", "the flats' pocket needs a bolt at the flats' height");
|
||||
const gap = round.runner.gap;
|
||||
round.shots.push({ x: 418, y: bz.LANE_Y[0] + 2.4, vx: 130, vy: 0, gone: 0 });
|
||||
ghoul.advance(round, 4, steady);
|
||||
assert.equal(round.runner.gas[0].state, "burst");
|
||||
assert.ok(round.runner.gap - gap >= bz.GAS_PUSH - 0.5, `pushed back ${round.runner.gap - gap}`);
|
||||
assert.equal(round.bonusRound.perf.acts, 2);
|
||||
assert.equal(events(round, "bogboatGas")[0].points, bz.GAS_POINTS);
|
||||
// Burst, then spent; a second bolt through the cloud does nothing.
|
||||
run(round, bz.GAS_BURST_MS + 20);
|
||||
assert.equal(round.runner.gas[0].state, "spent");
|
||||
const acts = round.bonusRound.perf.acts;
|
||||
round.shots.push({ x: 418, y: bz.LANE_Y[0] + 2.4, vx: 130, vy: 0, gone: 0 });
|
||||
ghoul.advance(round, 4, steady);
|
||||
assert.equal(round.bonusRound.perf.acts, acts);
|
||||
// A charm hit in the flats' height.
|
||||
at(round, 340, 1, { safe: true });
|
||||
round.shots.push({ x: 378, y: bz.LANE_Y[1] + 2.4, vx: 130, vy: 0, gone: 0 });
|
||||
ghoul.advance(round, 4, steady);
|
||||
assert.equal(round.runner.props[1].state, "broken");
|
||||
// What was shot stays shot when the boat is put back (a re-seat in the same room), a pocket still bursting too.
|
||||
Object.assign(round.runner.gas[1], { state: "burst", t: 300 });
|
||||
bz.BOGBOAT.place[0](round, {});
|
||||
assert.equal(round.runner.gas[0].state, "spent");
|
||||
assert.equal(round.runner.props[0].state, "broken");
|
||||
assert.equal(round.runner.props[1].state, "broken");
|
||||
assert.equal(round.runner.gas[1].state, "spent", "a burst pocket is not revived");
|
||||
const fresh = synth({ gas: [[420, 0]] });
|
||||
assert.equal(fresh.runner.gas[0].state, "up");
|
||||
});
|
||||
|
||||
/* --------------------------------------------------------------- the round */
|
||||
|
||||
test("Ghoul Rush's Bog Runner: the last heart gone ends the round with nothing at once (no life lost, the dice in hand kept) and the run goes on to the Drowning Pool", () => {
|
||||
const round = boatRound();
|
||||
round.dice = 2;
|
||||
round.bonusRound.hearts = 1;
|
||||
const first = things().filter((t) => t.lane === 0 && HARMFUL.has(t.kind)).sort((a, b) => a.x - b.x)[0];
|
||||
at(round, first.x - 12, 0);
|
||||
until(round, () => round.phase === "clear", 8000);
|
||||
assert.equal(round.bonusRound.hearts, 0);
|
||||
assert.equal(round.bonusRound.over, true);
|
||||
assert.equal(round.bonusRound.won, false);
|
||||
const end = events(round, "bonusEnd");
|
||||
assert.equal(end.length, 1);
|
||||
assert.equal(end[0].won, false);
|
||||
assert.equal(end[0].dice, 0);
|
||||
assert.equal(round.over, false, "no game over");
|
||||
assert.equal(round.lives, 3);
|
||||
assert.equal(round.dice, 2);
|
||||
run(round, ghoul.CARD_LOST_MS + 100);
|
||||
assert.equal(round.spec.id, "drowning");
|
||||
assert.equal(round.bonusRound, null);
|
||||
assert.equal(round.runner, null);
|
||||
assert.equal(round.lives, 3);
|
||||
assert.equal(round.dice, 2);
|
||||
skipBossIntro(ghoul, round);
|
||||
assert.equal(round.phase, "ready");
|
||||
});
|
||||
|
||||
test("Ghoul Rush's Bog Runner: the checkpoints are passed in order (an event each) and the ride goes back to the last one after the last heart", () => {
|
||||
const round = boatRound();
|
||||
at(round, R.checks[0] - 6, 0, { safe: true });
|
||||
until(round, () => round.runner.check >= 0, 3000);
|
||||
assert.deepEqual(events(round, "bogboatCheck").map((e) => e.n).slice(0, 1), [1]);
|
||||
const c0 = round.runner.check;
|
||||
round.you.x = 1;
|
||||
bz.BOGBOAT.place[0](round, {});
|
||||
assert.equal(round.you.x, R.checks[c0]);
|
||||
assert.equal(round.runner.check, c0);
|
||||
assert.equal(round.runner.lane, 0);
|
||||
assert.equal(round.camLead, bz.CAM_AHEAD);
|
||||
const fresh = boatRound();
|
||||
assert.equal(fresh.you.x, ROOM.start);
|
||||
assert.equal(fresh.runner.check, -1);
|
||||
// Past all four on a long ride.
|
||||
const long = synth({ checks: R.checks });
|
||||
long.you.safeMs = 1e9;
|
||||
long.timeMs = 1e9;
|
||||
run(long, 62000);
|
||||
assert.equal(long.runner.check, R.checks.length - 1);
|
||||
});
|
||||
|
||||
test("Ghoul Rush's Bog Runner: at the finish the fan is cut, the door opens, and walking out ends the round with 3 to 9 Lucky dice", () => {
|
||||
const round = boatRound();
|
||||
round.dice = 1;
|
||||
at(round, R.finish - 8, 1, { safe: true });
|
||||
until(round, () => round.runner.done, 3000);
|
||||
assert.equal(round.runner.done, true);
|
||||
assert.equal(events(round, "bogboatFinish").length, 1);
|
||||
assert.equal(round.you.y, ghoul.groundAt(ROOM, round.you.x), "back down on the water's floor, from either lane");
|
||||
assert.equal(round.hasKey, true, "the door opens");
|
||||
assert.equal(round.bonusRound.hearts, 5);
|
||||
assert.equal(round.phase, "play");
|
||||
round.input.right = true;
|
||||
until(round, () => round.phase === "clear", 20000);
|
||||
round.input.right = false;
|
||||
assert.equal(round.phase, "clear");
|
||||
const end = events(round, "bonusEnd");
|
||||
assert.equal(end.length, 1);
|
||||
assert.equal(end[0].won, true);
|
||||
assert.ok(end[0].dice >= BONUS_FLOOR && end[0].dice <= ghoul.MAX_DICE, `${end[0].dice} dice`);
|
||||
assert.equal(round.dice, Math.min(ghoul.MAX_DICE, 1 + end[0].dice));
|
||||
assert.equal(round.lives, 3);
|
||||
run(round, ghoul.CARD_MS + 100);
|
||||
assert.equal(round.spec.id, "drowning");
|
||||
assert.equal(round.runner, null);
|
||||
});
|
||||
|
||||
test("Ghoul Rush's Bog Runner: no random number is drawn in the room (a ride of 20 seconds, jumping, switching and shooting, on a draw that throws)", () => {
|
||||
const round = boatRound();
|
||||
round.you.safeMs = 1e9;
|
||||
for (let t = 0; t < 20000; t += 16) {
|
||||
round.input.fire = true;
|
||||
round.input.right = t % 6000 < 3000;
|
||||
round.input.left = !round.input.right;
|
||||
round.input.down = t % 2500 < 400;
|
||||
if (t % 1500 === 0) press(round);
|
||||
ghoul.advance(round, 16, never);
|
||||
round.input.up = false;
|
||||
round.events.length = 0;
|
||||
}
|
||||
assert.ok(round.you.x > 300);
|
||||
});
|
||||
|
||||
/* ----------------------------------------------------------- grade and dice */
|
||||
|
||||
test("Ghoul Rush's Bog Runner's grade: the obstacles the boat faced are the total, one passed in its lane counts and one dodged by a lane does not, shooting 8 things is the die, a swarm that never boiled is the die", () => {
|
||||
const ride = { banks: [[300, 316]], snags: [[400, 0]], knees: [[460, 0], [460, 1]], gas: [[600, 1]] };
|
||||
const round = synth(ride);
|
||||
at(round, 250, 0, { safe: true });
|
||||
assert.equal(round.bonusRound.perf.total, 0);
|
||||
assert.equal(round.bonusRound.perf.goal, bz.ACTS_GOAL);
|
||||
// Stay in the channel: the snag and the channel's knees are faced, not the flats' knees.
|
||||
until(round, () => round.you.x > 480, 6000);
|
||||
assert.equal(round.bonusRound.perf.total, 2);
|
||||
// Switch away at the bank: the channel's things are dodged by the lane and not counted; the flats' are.
|
||||
const away = synth(ride);
|
||||
at(away, 296, 0, { safe: true });
|
||||
away.input.right = true;
|
||||
run(away, 500);
|
||||
away.input.right = false;
|
||||
assert.equal(away.runner.lane, 1);
|
||||
until(away, () => away.you.x > 480, 8000);
|
||||
const faced = Object.keys(away.runner.faced).filter((id) => id[0] !== "w");
|
||||
assert.deepEqual(faced, ["k1"], "the flats' knees only: the channel's things were dodged by a lane");
|
||||
assert.equal(away.bonusRound.perf.hits.filter((id) => id[0] !== "w").length, 0);
|
||||
// A faced thing that cost a heart is a hit, counted once.
|
||||
const hit = synth(ride);
|
||||
at(hit, 385, 0);
|
||||
run(hit, 800);
|
||||
assert.deepEqual(hit.bonusRound.perf.hits, ["s0"]);
|
||||
assert.equal(hit.bonusRound.perf.total, 1);
|
||||
// The dice: the floor, hearts, clean passes, acts, a swarm that never boiled.
|
||||
const b = makeBonus({ stats: { kills: 0 } });
|
||||
b.perf = { total: 20, hits: [], acts: 0, goal: bz.ACTS_GOAL, steady: false, kills0: 0 };
|
||||
assert.equal(diceFor(b), BONUS_FLOOR + 2 + 2);
|
||||
b.perf.steady = true;
|
||||
assert.equal(diceFor(b), 9 - 1);
|
||||
b.perf.acts = bz.ACTS_GOAL;
|
||||
assert.equal(diceFor(b), 9);
|
||||
b.perf.acts = bz.ACTS_GOAL - 1;
|
||||
assert.equal(diceFor(b), 8);
|
||||
b.hearts = 1;
|
||||
assert.equal(diceFor(b), 6);
|
||||
b.perf.hits = Array.from({ length: 20 }, (_, i) => `x${i}`);
|
||||
assert.equal(diceFor(b), BONUS_FLOOR + 0 + 0 + 0 + 1);
|
||||
b.perf.steady = false;
|
||||
assert.equal(diceFor(b), BONUS_FLOOR);
|
||||
});
|
||||
|
||||
const CAUSES = {
|
||||
snag: { snags: [[300, 0]] },
|
||||
knee: { knees: [[300, 0]] },
|
||||
veil: { veils: [[300, 308, 0]] },
|
||||
limb: { limbs: [[300, 306, 0]] },
|
||||
};
|
||||
|
||||
test("Ghoul Rush's Bog Runner: endless lives (round.infinite) spare the hearts for every cause, through the same lose path", () => {
|
||||
for (const [cause, ride] of Object.entries(CAUSES)) {
|
||||
const round = synth(ride);
|
||||
round.infinite = true;
|
||||
at(round, 270, 0);
|
||||
run(round, 1800);
|
||||
assert.ok(events(round, "lose").some((e) => e.cause === cause), `${cause} was lost to`);
|
||||
assert.equal(round.bonusRound.hearts, 5, `${cause} cost nothing`);
|
||||
assert.equal(round.lives, 3);
|
||||
assert.equal(round.phase, "play");
|
||||
}
|
||||
const wake = synth({});
|
||||
wake.infinite = true;
|
||||
at(wake, 100, 0);
|
||||
wake.runner.v = 20;
|
||||
wake.runner.gap = bz.WAKE_CATCH + 0.2;
|
||||
run(wake, 200, { down: true });
|
||||
assert.ok(events(wake, "lose").some((e) => e.cause === "wake"), "the wake was lost to");
|
||||
assert.equal(wake.bonusRound.hearts, 5);
|
||||
});
|
||||
|
||||
test("Ghoul Rush's Bog Runner: every cause costs exactly one heart", () => {
|
||||
for (const [cause, ride] of Object.entries(CAUSES)) {
|
||||
const round = synth(ride);
|
||||
at(round, 270, 0);
|
||||
run(round, 1800);
|
||||
assert.equal(round.bonusRound.hearts, 4, cause);
|
||||
assert.equal(events(round, "lose").map((e) => e.cause).join(), cause);
|
||||
assert.equal(round.lives, 3);
|
||||
}
|
||||
});
|
||||
|
||||
test("Ghoul Rush's Bog Runner: the Garlic shield takes a hit instead of a heart", () => {
|
||||
const round = synth({ snags: [[300, 0]] });
|
||||
round.you.garlic = true;
|
||||
at(round, 285, 0);
|
||||
round.you.garlic = true;
|
||||
run(round, 800);
|
||||
assert.equal(round.bonusRound.hearts, 5);
|
||||
assert.equal(round.you.garlic, false);
|
||||
});
|
||||
|
||||
/* ---------------------------------------------------------------- voices */
|
||||
|
||||
test("Ghoul Rush's Bog Runner: every event has a voice that plays, every cause has words and a sound, and the voices are tones that exist (none over 1.2 s)", () => {
|
||||
assert.deepEqual(Object.keys(EVENT_VOICE).sort(), [...bz.EVENTS].sort(), "a voice for every event and no more");
|
||||
const tones = ghoulSfx.default.tones;
|
||||
for (const [event, [kind, act]] of Object.entries(EVENT_VOICE)) {
|
||||
const name = BOAT_VOICES[kind] && BOAT_VOICES[kind][act];
|
||||
assert.ok(name, `${event} has a ${kind}.${act} voice`);
|
||||
assert.ok(tones[name], `${name} exists`);
|
||||
assert.equal(VOICES[kind][act], name, "joined to the game's voices");
|
||||
const played = heard({ type: event, what: "snag", kind: 0, points: 50, to: 1 }).played;
|
||||
assert.ok(played.includes(name), `${event} plays ${name}`);
|
||||
}
|
||||
for (const [name, def] of Object.entries(BOGBOAT_SFX.tones)) {
|
||||
assert.ok(tones[name], name);
|
||||
for (const l of def.layers) assert.ok(l.seconds > 0 && l.seconds + (l.delay || 0) <= 1.2, `${name} is short`);
|
||||
}
|
||||
for (const cause of ["snag", "knee", "veil", "limb", "wake"]) {
|
||||
assert.ok(LOSE_WORDS[cause], `${cause} has words`);
|
||||
assert.ok(LOSE_SOUNDS[cause] && LOSE_SOUNDS[cause].length === 3, `${cause} has a sound`);
|
||||
assert.ok(heard({ type: "lose", cause, hearts: 3 }).played.length > 0, `${cause} sounds`);
|
||||
}
|
||||
assert.equal(heard({ type: "bogboatJump" }).played.length, 1);
|
||||
assert.equal(heard({ type: "bogboatGas", points: 90 }).played.length, 1);
|
||||
});
|
||||
|
||||
test("Ghoul Rush's Bog Runner: its music has the room's level of voices, bars of sixteen steps, and a track for the room", () => {
|
||||
const track = ghoulSfx.default.music.ghoulBoatRide;
|
||||
assert.equal(track, BOGBOAT_SFX.music.ghoulBoatRide);
|
||||
const playing = Object.entries(track.voices).filter(([, v]) => (v.from ?? 0) <= 0.7);
|
||||
assert.ok(playing.length >= 4);
|
||||
for (const [name, p] of Object.entries(track.patterns)) {
|
||||
for (const [voice, line] of Object.entries(p)) {
|
||||
assert.ok(track.voices[voice], `${name}.${voice} is a voice`);
|
||||
for (const bar of line.split("|")) assert.equal(bar.trim().split(/\s+/).length, 16, `${name}.${voice}`);
|
||||
}
|
||||
}
|
||||
for (const name of track.order) assert.ok(track.patterns[name]);
|
||||
});
|
||||
|
||||
test("Ghoul Rush's Bog Runner: the room's own names do not collide with the game's (hazards, events, kinds)", () => {
|
||||
for (const e of bz.EVENTS) assert.ok(e.startsWith("bogboat"), e);
|
||||
assert.ok(!bz.EVENTS.some((e) => e.startsWith("bogboatboat")), "no bogboatboat names");
|
||||
assert.deepEqual(Object.keys(bz.BOGBOAT).filter((key) => ["hazards", "bosses", "boss"].includes(key)), []);
|
||||
assert.equal(typeof ghoul.ROOM_MUSIC.bogboat, "string");
|
||||
assert.equal(ghoul.roomById("bogboat").ride.runner, "bogboat");
|
||||
for (const kind of Object.keys(BOAT_VOICES)) assert.ok(kind.startsWith("bogboat"), kind);
|
||||
});
|
||||
|
||||
/* --------------------------------------------------------------- drawing */
|
||||
|
||||
test("Ghoul Rush's Bog Runner draws: the room in a lit and a dark one, the boat on each lane, in the air, ducking and switching, each thing in each state, the swarm far and close, the clog and the stall, a crash, the finish and the cards", () => {
|
||||
const ctx = new Proxy({}, { get: (t, name) => (name in t ? t[name] : () => {}), set: (t, name, value) => ((t[name] = value), true) });
|
||||
const g = ghoul.default.create({ canvas: { width: 0, height: 0, getContext: () => ctx } });
|
||||
g.resize(900, 900);
|
||||
g.key("action");
|
||||
g.tick(16);
|
||||
const r = g.round;
|
||||
through(r);
|
||||
r.offer = ["bog"];
|
||||
r.phaseMs = 0;
|
||||
ghoul.pickStage(r, 0);
|
||||
while (r.spec.id !== "bogboat") through(r);
|
||||
r.lives = 99;
|
||||
const spots = [ROOM.start + 40, R.snags[0][0] - 10, R.limbs[0][0] - 5, R.veils[0][0] - 5, R.gas[0][0] - 10, R.checks[0], R.banks[0][0] + 2, R.finish - 40];
|
||||
for (const dark of [true, false]) {
|
||||
for (const x of spots) {
|
||||
r.dark = dark;
|
||||
r.phase = "play";
|
||||
for (const st of r.spawns) st.over = true;
|
||||
r.hordeMs = Infinity;
|
||||
r.monsters.length = 0;
|
||||
for (const lane of [0, 1]) {
|
||||
at(r, x, lane, { safe: true });
|
||||
r.runner.props = r.runner.props.map((p, i) => ({ ...p, state: i % 3 ? "up" : "broken" }));
|
||||
r.runner.gas = r.runner.gas.map((p, i) => ({ ...p, state: ["up", "burst", "spent"][i % 3], t: 300 }));
|
||||
for (const air of [false, true]) {
|
||||
if (air) Object.assign(r.runner, { air: true, h: 5, vy: 20, gap: 12, panic: true, clog: 90 });
|
||||
if (air) Object.assign(r.you, { state: "air", vy: 20, y: r.you.y + 5 });
|
||||
if (!air) Object.assign(r.runner, { gap: 30, panic: false, clog: 20 });
|
||||
r.you.ducking = !air && lane === 0;
|
||||
r.runner.stall = air ? 800 : 0;
|
||||
r.shots.push({ x: x + 6, y: r.you.y + 2.4, vx: 130, vy: 0, gone: 0 });
|
||||
for (let k = 0; k < 4; k++) g.tick(16);
|
||||
r.monsters.length = 0;
|
||||
r.you.safeMs = 1e9;
|
||||
at(r, x, lane, { safe: true });
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// A switch in progress, mid-hop.
|
||||
at(r, R.banks[0][0] + 2, 0, { safe: true });
|
||||
r.input.right = true;
|
||||
for (let k = 0; k < 12; k++) g.tick(16);
|
||||
r.input.right = false;
|
||||
assert.equal(r.spec.id, "bogboat");
|
||||
// Crashes: a snag.
|
||||
r.you.safeMs = 0;
|
||||
at(r, R.snags[0][0] - 3, R.snags[0][1]);
|
||||
for (let k = 0; k < 30; k++) g.tick(16);
|
||||
assert.ok(r.bonusRound.hearts < r.bonusRound.max || r.phase !== "play", "the crash draws too");
|
||||
const done = ghoul.default.create({ canvas: { width: 0, height: 0, getContext: () => ctx } });
|
||||
done.resize(900, 900);
|
||||
done.key("action");
|
||||
done.tick(16);
|
||||
const d = done.round;
|
||||
through(d);
|
||||
d.offer = ["bog"];
|
||||
d.phaseMs = 0;
|
||||
ghoul.pickStage(d, 0);
|
||||
while (d.spec.id !== "bogboat") through(d);
|
||||
d.phase = "play";
|
||||
d.runner.done = true;
|
||||
d.runner.restX = R.finish + 10;
|
||||
Object.assign(d.you, { x: R.finish + 20, y: 9, state: "run" });
|
||||
d.camX = R.finish - 40;
|
||||
for (let k = 0; k < 10; k++) done.tick(16);
|
||||
for (const won of [true, false]) {
|
||||
endBonus(d, won, { ROOM_POINTS: 300, award: (rd, pts) => (rd.score += pts) });
|
||||
d.bonusRound.over = true;
|
||||
for (let k = 0; k < 10; k++) {
|
||||
done.tick(16);
|
||||
bonusTick(d, { tone() {}, fx: {} });
|
||||
}
|
||||
d.bonusRound.over = false;
|
||||
}
|
||||
// The stage select goes straight into it.
|
||||
const pick = ghoul.default.create({ canvas: { width: 0, height: 0, getContext: () => ctx } });
|
||||
pick.resize(900, 900);
|
||||
pick.stageSelect();
|
||||
const p = pick.round;
|
||||
const at2 = ghoul.STAGES.findIndex((s) => s.id === "bog");
|
||||
for (let i = 0; i < at2; i++) ghoul.steerSelect(p, 1, 0);
|
||||
for (let i = 0; i < 3; i++) ghoul.steerSelect(p, 0, 1);
|
||||
assert.equal(p.select.room, 3);
|
||||
pick.tick(16);
|
||||
ghoul.takeSelect(p);
|
||||
assert.equal(p.spec.id, "bogboat");
|
||||
assert.equal(p.runner.lane, 0);
|
||||
assert.equal(p.you.y, bz.LANE_Y[0]);
|
||||
pick.tick(16);
|
||||
});
|
||||
|
||||
/* ----------------------------------------------------------- the bots */
|
||||
|
||||
// A bot that rides well: it keeps to the channel, jumps 9 to 15 short of a snag or cypress knees, ducks under
|
||||
// every veil and limb, and holds the blaster. `miss` is the share of things it fails to dodge (by a hash).
|
||||
const mix = (a, b) => {
|
||||
let h = Math.imul(a + 0x9e37, 0x85ebca6b) ^ Math.imul(b + 0x7f4a, 0xc2b2ae35);
|
||||
h ^= h >>> 13;
|
||||
h = Math.imul(h, 0x5bd1e995);
|
||||
h ^= h >>> 15;
|
||||
return (h >>> 0) / 4294967296;
|
||||
};
|
||||
function goodBot(round, seed, miss = 0.04, shoot = true) {
|
||||
const { you, runner: c, input: inp } = round;
|
||||
inp.left = inp.right = inp.down = false;
|
||||
inp.fire = shoot;
|
||||
if (round.phase !== "play" || !c || c.done) {
|
||||
inp.up = false;
|
||||
return;
|
||||
}
|
||||
const ok = (x) => mix(seed, Math.round(x)) >= miss;
|
||||
const look = 9 + (seed % 7);
|
||||
const lane = c.lane;
|
||||
const bank = R.banks.find(([a, b]) => you.x >= a && you.x <= b);
|
||||
if (bank) inp.left = true;
|
||||
let jump = false;
|
||||
const ahead = (x) => x - you.x > 6 && x - you.x < look;
|
||||
for (const [x, l] of R.snags) if (l === lane && ahead(x) && ok(x)) jump = true;
|
||||
for (const [x, l] of R.knees) if (l === lane && ahead(x) && ok(x)) jump = true;
|
||||
for (const [x0, x1, l] of [...R.veils, ...R.limbs]) if (l === lane && you.x > x0 - 10 && you.x < x1 + 3 && ok(x0)) inp.down = true;
|
||||
if (jump && !inp.down && !c.air) press(round);
|
||||
else inp.up = false;
|
||||
}
|
||||
function idleBot(round) {
|
||||
const inp = round.input;
|
||||
inp.left = inp.right = inp.down = false;
|
||||
inp.up = false;
|
||||
inp.fire = true;
|
||||
}
|
||||
function rideWith(seed, bot, limit = 100000) {
|
||||
const round = boatRound(seed);
|
||||
const lost = [];
|
||||
let t = 0;
|
||||
for (; t < limit && round.phase !== "clear" && !round.over; t += 16) {
|
||||
bot(round);
|
||||
if (round.runner && round.runner.done && round.phase === "play") round.input.right = true;
|
||||
ghoul.advance(round, 16, steady);
|
||||
for (const e of round.events) if (e.type === "lose") lost.push(e.cause);
|
||||
if (round.runner && !round.runner.done) {
|
||||
const off = round.you.x - round.camX;
|
||||
assert.ok(off > 4 && off < 70, `the boat stays in view (${off.toFixed(1)} from the left edge at ${round.you.x.toFixed(0)})`);
|
||||
}
|
||||
round.events.length = 0;
|
||||
}
|
||||
return { round, lost, ms: t };
|
||||
}
|
||||
|
||||
test("Ghoul Rush's Bog Runner: a bot that rides well finishes the whole channel in 57 to 75 seconds, with 5 to 9 dice, a few hearts lost at most, past every checkpoint", () => {
|
||||
const dice = [];
|
||||
const gone = [];
|
||||
for (let seed = 1; seed <= 12; seed++) {
|
||||
const { round, lost, ms } = rideWith(seed, (r) => goodBot(r, seed));
|
||||
const b = round.bonusRound;
|
||||
assert.equal(b.won, true, `seed ${seed} finished (lost ${lost.join(",")})`);
|
||||
assert.ok(ms > 57000 && ms < 76000, `${ms} ms`);
|
||||
assert.ok(b.dice >= 5 && b.dice <= ghoul.MAX_DICE, `${b.dice} dice`);
|
||||
assert.equal(round.lives, 3, "never a run life");
|
||||
dice.push(b.dice);
|
||||
gone.push(lost.length);
|
||||
}
|
||||
assert.ok(dice.reduce((a, b) => a + b, 0) / dice.length >= 5.5, `${dice.join(",")}`);
|
||||
assert.ok(gone.every((n) => n <= 4), `${gone.join(",")}`);
|
||||
});
|
||||
|
||||
test("Ghoul Rush's Bog Runner: a bot that misses a quarter of the things loses, and a bot that never dodges (holding fire) loses all five hearts before 40% of the room, ends with 0 dice and the run goes on", () => {
|
||||
let finished = 0;
|
||||
for (let seed = 1; seed <= 6; seed++) if (rideWith(seed, (r) => goodBot(r, seed, 0.25)).round.bonusRound.won) finished++;
|
||||
assert.ok(finished <= 3, `${finished} of 6 finished missing a quarter`);
|
||||
for (let seed = 1; seed <= 6; seed++) {
|
||||
const { round, lost } = rideWith(seed, idleBot);
|
||||
const b = round.bonusRound;
|
||||
assert.equal(b.won, false, "never finishes");
|
||||
assert.equal(b.dice, 0);
|
||||
assert.equal(b.hearts, 0);
|
||||
assert.equal(lost.length, 5);
|
||||
assert.ok(round.you.x < ROOM.length * 0.4, `out at ${round.you.x}`);
|
||||
assert.equal(round.lives, 3);
|
||||
assert.equal(round.over, false);
|
||||
}
|
||||
});
|
||||
|
||||
/* ------------------------------------------------------------ telegraphs */
|
||||
|
||||
test("Ghoul Rush's Bog Runner telegraphs: JUMP over snags and knees, DUCK under veils and limbs, SHOOT at the first gas pockets, for the boat's lane only, words on the first three of each kind, the same every time", () => {
|
||||
const marks = telegraphMarks(R);
|
||||
const gasMarks = marks.filter((m) => m.kind === "gas");
|
||||
assert.ok(gasMarks.length >= 1 && gasMarks.length < R.gas.length, "only the first pockets are marked");
|
||||
assert.equal(marks.length, R.snags.length + R.knees.length + R.veils.length + R.limbs.length + gasMarks.length);
|
||||
for (const m of marks) assert.equal(m.answer, ANSWERS[m.kind], m.kind);
|
||||
assert.equal(ANSWERS.snag, "JUMP");
|
||||
assert.equal(ANSWERS.knee, "JUMP");
|
||||
assert.equal(ANSWERS.veil, "DUCK");
|
||||
assert.equal(ANSWERS.limb, "DUCK");
|
||||
assert.equal(ANSWERS.gas, "SHOOT");
|
||||
const first = R.limbs[0];
|
||||
const m = marks.find((q) => q.kind === "limb" && q.x === (first[0] + first[1]) / 2);
|
||||
const lane = first[2];
|
||||
const xs = [m.lead - 45, m.lead - 41, m.lead - 36, m.lead - 30, m.lead - 10, m.lead, m.lead + 3, m.lead + 7];
|
||||
const alphaOf = (x) => (telegraphs(R, x, lane).find((t) => t.kind === "limb" && t.lead === m.lead) || { alpha: 0 }).alpha;
|
||||
const a = xs.map(alphaOf);
|
||||
assert.equal(a[0], 0, "not yet in view");
|
||||
assert.ok(a[2] > 0 && a[2] < 1, "fading in 40 to 30 ahead");
|
||||
assert.equal(a[3], 1);
|
||||
assert.equal(a[4], 1);
|
||||
assert.ok(a[6] > 0 && a[6] < 1, "fading as it passes");
|
||||
assert.equal(a[7], 0, "gone once passed");
|
||||
assert.deepEqual(telegraphs(R, m.lead - 33, lane), telegraphs(R, m.lead - 33, lane), "deterministic");
|
||||
for (const kind of ["snag", "knee", "veil", "limb", "gas"]) {
|
||||
const of = marks.filter((q) => q.kind === kind).sort((p, q) => p.lead - q.lead);
|
||||
assert.ok(of.length >= 1, kind);
|
||||
of.forEach((q, i) => {
|
||||
assert.equal(q.n, kind === "gas" ? q.n : i);
|
||||
const shown = telegraphs(R, q.lead - 32, q.lane).find((t) => t.lead === q.lead && t.kind === kind);
|
||||
assert.ok(shown, `${kind} ${i} shows`);
|
||||
assert.equal(shown.words, q.n < TELEGRAPH_WORDS, `${kind} ${i}`);
|
||||
});
|
||||
}
|
||||
// In the other lane a thing shows nothing.
|
||||
const s = marks.find((q) => q.kind === "snag");
|
||||
assert.ok(!telegraphs(R, s.lead - 32, 1 - s.lane).some((t) => t.lead === s.lead && t.kind === "snag"));
|
||||
});
|
||||
|
||||
test("Ghoul Rush's Bog Runner's intro banner says the controls plainly", () => {
|
||||
assert.match(R.how, /LEFT or RIGHT at a bank/);
|
||||
assert.match(R.how, /UP jump, DOWN duck/);
|
||||
assert.match(R.how, /SPACE shoot/);
|
||||
assert.ok(R.how.length <= 72);
|
||||
});
|
||||
@@ -1,10 +1,10 @@
|
||||
// Web console tests, Ghoul Rush's Old Rattlebones: his volley and slam, the skull he throws like a boomerang (and is headless without), the bone rain and the skeletons he raises once his rage begins, the double slam, and what each move looks and sounds like.
|
||||
import { test } from "node:test";
|
||||
import assert from "node:assert/strict";
|
||||
import * as ghoul from "../src/web-console/public/activities/ghoul.js";
|
||||
import * as bn from "../src/web-console/public/activities/ghoul-bones.js";
|
||||
import { LOSE_SOUNDS, LOSE_WORDS } from "../src/web-console/public/activities/ghoul-bones-draw.js";
|
||||
import { VOICES, react } from "../src/web-console/public/activities/ghoul-draw.js";
|
||||
import * as ghoul from "../src/web-console/public/activities/ghoul-rush/ghoul.js";
|
||||
import * as bn from "../src/web-console/public/activities/ghoul-rush/stages/wing/ghoul-bones.js";
|
||||
import { LOSE_SOUNDS, LOSE_WORDS } from "../src/web-console/public/activities/ghoul-rush/stages/wing/ghoul-bones-draw.js";
|
||||
import { VOICES, react } from "../src/web-console/public/activities/ghoul-rush/draw/ghoul-draw.js";
|
||||
|
||||
const steady = () => 0.5;
|
||||
const events = (round, type) => round.events.filter((e) => e.type === type);
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
// Web console tests, Ghoul Rush's boss intro cards: every boss room has an entry (the boss's exact name, an epithet, no em dash, never the hero's name), the card shows when a boss room is entered (after the bonus ride too) and in no other room, not again on a retry, any fresh move key, fire or click moves it on after the lockout (repeats and early presses never do), it never moves on by itself, a pause holds it, and it draws for every boss on a fake canvas (through the boss's own art, with a fallback when the art throws or is missing).
|
||||
import { test } from "node:test";
|
||||
import assert from "node:assert/strict";
|
||||
import * as ghoul from "../src/web-console/public/activities/ghoul.js";
|
||||
import { BOSS_INTROS, MAX_EPITHET, bossIntroFor } from "../src/web-console/public/activities/ghoul-boss-intros.js";
|
||||
import { BOSS_HINT, BOSS_TITLE, beatAt, landAt, shakeAt, bossIntroArt } from "../src/web-console/public/activities/ghoul-bossintro-draw.js";
|
||||
import { INTROS } from "../src/web-console/public/activities/ghoul-intros.js";
|
||||
import * as ghoul from "../src/web-console/public/activities/ghoul-rush/ghoul.js";
|
||||
import { BOSS_INTROS, MAX_EPITHET, bossIntroFor } from "../src/web-console/public/activities/ghoul-rush/story/ghoul-boss-intros.js";
|
||||
import { BOSS_HINT, BOSS_TITLE, beatAt, landAt, shakeAt, bossIntroArt } from "../src/web-console/public/activities/ghoul-rush/story/ghoul-bossintro-draw.js";
|
||||
import { INTROS } from "../src/web-console/public/activities/ghoul-rush/story/ghoul-intros.js";
|
||||
import { toneNames } from "../src/web-console/public/tones.js";
|
||||
import { skipBossIntro } from "./ghoul-test-helpers.mjs";
|
||||
|
||||
|
||||
@@ -1,21 +1,21 @@
|
||||
// Web console tests, Ghoul Rush's Midnight Carnival stage: its four rooms (the Midway, the Hall of Mirrors, the Funhouse with its conveyor floors, the Big Top), grinners that honk out acid balloons, marionettes that drop on their strings, Mirror You that copies your moves and shots half a second late, strongmen that lob barbells, circus hounds that leap through hoops of fire, Cotton Candy and the Custard Pie (found only here), and the Ringmaster, whose puppet hangs on three strings: cut them all and he is open for four seconds.
|
||||
import { test } from "node:test";
|
||||
import assert from "node:assert/strict";
|
||||
import * as ghoul from "../src/web-console/public/activities/ghoul.js";
|
||||
import * as cv from "../src/web-console/public/activities/ghoul-carnival.js";
|
||||
import * as arm from "../src/web-console/public/activities/ghoul-arms.js";
|
||||
import { EVENT_VOICE, LOSE_SOUNDS, LOSE_WORDS } from "../src/web-console/public/activities/ghoul-carnival-draw.js";
|
||||
import { PILL_WORDS, pickPower } from "../src/web-console/public/activities/ghoul-powers.js";
|
||||
import { BONES } from "../src/web-console/public/activities/ghoul-bones.js";
|
||||
import { GRAVEYARD } from "../src/web-console/public/activities/ghoul-graveyard.js";
|
||||
import { GROUNDS } from "../src/web-console/public/activities/ghoul-grounds.js";
|
||||
import { CHAPEL } from "../src/web-console/public/activities/ghoul-chapel.js";
|
||||
import { SANATORIUM } from "../src/web-console/public/activities/ghoul-sanatorium.js";
|
||||
import { VILLAGE } from "../src/web-console/public/activities/ghoul-village.js";
|
||||
import { MINE } from "../src/web-console/public/activities/ghoul-mine.js";
|
||||
import { CART } from "../src/web-console/public/activities/ghoul-cart.js";
|
||||
import * as ghoulSfx from "../src/web-console/public/activities/ghoul-sfx.js";
|
||||
import { LOOKS, VOICES, react } from "../src/web-console/public/activities/ghoul-draw.js";
|
||||
import * as ghoul from "../src/web-console/public/activities/ghoul-rush/ghoul.js";
|
||||
import * as cv from "../src/web-console/public/activities/ghoul-rush/stages/carnival/ghoul-carnival.js";
|
||||
import * as arm from "../src/web-console/public/activities/ghoul-rush/arms/ghoul-arms.js";
|
||||
import { EVENT_VOICE, LOSE_SOUNDS, LOSE_WORDS } from "../src/web-console/public/activities/ghoul-rush/stages/carnival/ghoul-carnival-draw.js";
|
||||
import { PILL_WORDS, pickPower } from "../src/web-console/public/activities/ghoul-rush/core/ghoul-powers.js";
|
||||
import { BONES } from "../src/web-console/public/activities/ghoul-rush/stages/wing/ghoul-bones.js";
|
||||
import { GRAVEYARD } from "../src/web-console/public/activities/ghoul-rush/stages/graveyard/ghoul-graveyard.js";
|
||||
import { GROUNDS } from "../src/web-console/public/activities/ghoul-rush/stages/grounds/ghoul-grounds.js";
|
||||
import { CHAPEL } from "../src/web-console/public/activities/ghoul-rush/stages/chapel/ghoul-chapel.js";
|
||||
import { SANATORIUM } from "../src/web-console/public/activities/ghoul-rush/stages/sanatorium/ghoul-sanatorium.js";
|
||||
import { VILLAGE } from "../src/web-console/public/activities/ghoul-rush/stages/village/ghoul-village.js";
|
||||
import { MINE } from "../src/web-console/public/activities/ghoul-rush/stages/mine/ghoul-mine.js";
|
||||
import { CART } from "../src/web-console/public/activities/ghoul-rush/rides/cart/ghoul-cart.js";
|
||||
import * as ghoulSfx from "../src/web-console/public/activities/ghoul-rush/sfx/ghoul-sfx.js";
|
||||
import { LOOKS, VOICES, react } from "../src/web-console/public/activities/ghoul-rush/draw/ghoul-draw.js";
|
||||
|
||||
const steady = () => 0.5;
|
||||
// The pack draws no random number: a run on this fails on the first draw.
|
||||
|
||||
@@ -2,13 +2,13 @@
|
||||
// Run with: node --test scripts/test-web-console-activities-ghoul-cart.mjs
|
||||
import { test } from "node:test";
|
||||
import assert from "node:assert/strict";
|
||||
import * as ghoul from "../src/web-console/public/activities/ghoul.js";
|
||||
import * as ghoul from "../src/web-console/public/activities/ghoul-rush/ghoul.js";
|
||||
import { skipBossIntro } from "./ghoul-test-helpers.mjs";
|
||||
import * as ct from "../src/web-console/public/activities/ghoul-cart.js";
|
||||
import { EVENT_VOICE, LOSE_SOUNDS, LOSE_WORDS, LOOKS as CART_LOOKS, VOICES as CART_VOICES } from "../src/web-console/public/activities/ghoul-cart-draw.js";
|
||||
import * as ghoulSfx from "../src/web-console/public/activities/ghoul-sfx.js";
|
||||
import { LOOKS, VOICES, bonusTick, hudLayout, react } from "../src/web-console/public/activities/ghoul-draw.js";
|
||||
import { BONUS_FLOOR, BONUS_HEARTS, diceFor, endBonus, heartsText, makeBonus } from "../src/web-console/public/activities/ghoul-bonus.js";
|
||||
import * as ct from "../src/web-console/public/activities/ghoul-rush/rides/cart/ghoul-cart.js";
|
||||
import { EVENT_VOICE, LOSE_SOUNDS, LOSE_WORDS, LOOKS as CART_LOOKS, VOICES as CART_VOICES } from "../src/web-console/public/activities/ghoul-rush/rides/cart/ghoul-cart-draw.js";
|
||||
import * as ghoulSfx from "../src/web-console/public/activities/ghoul-rush/sfx/ghoul-sfx.js";
|
||||
import { LOOKS, VOICES, bonusTick, hudLayout, react } from "../src/web-console/public/activities/ghoul-rush/draw/ghoul-draw.js";
|
||||
import { BONUS_FLOOR, BONUS_HEARTS, diceFor, endBonus, heartsText, makeBonus } from "../src/web-console/public/activities/ghoul-rush/core/ghoul-bonus.js";
|
||||
|
||||
const steady = () => 0.5;
|
||||
// The pack draws no random number: a run on this fails on the first draw.
|
||||
@@ -1125,6 +1125,9 @@ test("Ghoul Rush's bonus round: the fifth lost heart ends it with no dice and no
|
||||
// A life lost there is a run life as always, and the dice roll for it.
|
||||
round.phase = "play";
|
||||
ghoul.lose(round, "zombie");
|
||||
assert.equal(round.phase, "ask", "the carried dice are offered");
|
||||
round.ask.t = ghoul.ASK_GUARD_MS;
|
||||
ghoul.answerDie(round, true);
|
||||
assert.equal(round.phase, "roll", "the carried dice are rolled");
|
||||
});
|
||||
|
||||
@@ -1198,14 +1201,14 @@ test("Ghoul Rush's bonus round: the dice formula (floor 3, up to six more by hea
|
||||
assert.equal(diceFor(mk(5, { hits: [], acts: 0, total: 0 })), 3 + 2 + 0 + 0 + 1, "no obstacles counted");
|
||||
// Kills count with the acts.
|
||||
assert.equal(diceFor(mk(5, { hits: [], acts: 4, goal: 8 }), 4), 9);
|
||||
// The cap on the run's dice: eight in hand and a nine-die ride leaves nine.
|
||||
// No cap on the run's dice: eight in hand and a nine-die ride leaves seventeen.
|
||||
const round = bonusCart();
|
||||
round.dice = 8;
|
||||
Object.assign(round.bonusRound.perf, { hits: [], acts: 8 });
|
||||
assert.equal(endBonus(round, true, awardKit), true);
|
||||
assert.equal(round.dice, ghoul.MAX_DICE);
|
||||
assert.equal(round.dice, 17);
|
||||
assert.equal(round.bonusRound.dice, 9, "earned nine");
|
||||
assert.equal(round.bonusRound.gained, 1, "one more fits");
|
||||
assert.equal(round.bonusRound.gained, 9, "all nine kept");
|
||||
assert.equal(endBonus(round, true, awardKit), false, "ends once");
|
||||
// Braking: a short brake is fine, too long is no steady hand.
|
||||
const brake = bonusCart();
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
// Web console tests, Ghoul Rush's Chapel stage: its four rooms, gargoyles that are stone on their perch and dive when you pass under, choir ghosts whose song quickens the monsters near them, censer monks and their smoke, bats in the bells, the bell toll that freezes everything for a second, Holy Water (found only here), and the Choirmaster, whose organ pipes guard him and whose columns of notes have one gap each.
|
||||
import { test } from "node:test";
|
||||
import assert from "node:assert/strict";
|
||||
import * as ghoul from "../src/web-console/public/activities/ghoul.js";
|
||||
import * as ch from "../src/web-console/public/activities/ghoul-chapel.js";
|
||||
import { LOSE_SOUNDS, LOSE_WORDS } from "../src/web-console/public/activities/ghoul-chapel-draw.js";
|
||||
import { PILL_WORDS, pickPower } from "../src/web-console/public/activities/ghoul-powers.js";
|
||||
import * as sfxChapel from "../src/web-console/public/activities/ghoul-sfx-chapel.js";
|
||||
import * as ghoulSfx from "../src/web-console/public/activities/ghoul-sfx.js";
|
||||
import { VOICES, react } from "../src/web-console/public/activities/ghoul-draw.js";
|
||||
import * as ghoul from "../src/web-console/public/activities/ghoul-rush/ghoul.js";
|
||||
import * as ch from "../src/web-console/public/activities/ghoul-rush/stages/chapel/ghoul-chapel.js";
|
||||
import { LOSE_SOUNDS, LOSE_WORDS } from "../src/web-console/public/activities/ghoul-rush/stages/chapel/ghoul-chapel-draw.js";
|
||||
import { PILL_WORDS, pickPower } from "../src/web-console/public/activities/ghoul-rush/core/ghoul-powers.js";
|
||||
import * as sfxChapel from "../src/web-console/public/activities/ghoul-rush/stages/chapel/ghoul-sfx-chapel.js";
|
||||
import * as ghoulSfx from "../src/web-console/public/activities/ghoul-rush/sfx/ghoul-sfx.js";
|
||||
import { VOICES, react } from "../src/web-console/public/activities/ghoul-rush/draw/ghoul-draw.js";
|
||||
|
||||
const steady = () => 0.5;
|
||||
const events = (round, type) => round.events.filter((e) => e.type === type);
|
||||
|
||||
@@ -1,12 +1,24 @@
|
||||
// Web console tests, Ghoul Rush's Lucky die: it comes only from a kill, stacks to nine and lasts the run; when a life would be lost one rolls: a 4 to 6 brings Planny back (the monsters in view blown apart in an ordinary room, a boss's room untouched; a 5 adds a heart, a 6 a heart and a Garlic shield), a 3 or 2 costs the life and leaves a gift for the respawn, a 1 only laughs.
|
||||
import { test } from "node:test";
|
||||
import assert from "node:assert/strict";
|
||||
import * as ghoul from "../src/web-console/public/activities/ghoul.js";
|
||||
import { pickPower } from "../src/web-console/public/activities/ghoul-powers.js";
|
||||
import { react } from "../src/web-console/public/activities/ghoul-draw.js";
|
||||
import * as ghoul from "../src/web-console/public/activities/ghoul-rush/ghoul.js";
|
||||
import { pickPower } from "../src/web-console/public/activities/ghoul-rush/core/ghoul-powers.js";
|
||||
import { react } from "../src/web-console/public/activities/ghoul-rush/draw/ghoul-draw.js";
|
||||
import { toneNames } from "../src/web-console/public/tones.js";
|
||||
|
||||
const steady = () => 0.5;
|
||||
// Answer "Use a Lucky Die?" once the guard is past (nothing happens when no question is up).
|
||||
const accept = (round, yes = true) => {
|
||||
if (round.phase !== "ask") return false;
|
||||
round.ask.t = ghoul.ASK_GUARD_MS;
|
||||
return ghoul.answerDie(round, yes);
|
||||
};
|
||||
// A life lost, the question answered Yes: the old automatic roll.
|
||||
const lose = (round, cause) => {
|
||||
const r = ghoul.lose(round, cause);
|
||||
accept(round);
|
||||
return r;
|
||||
};
|
||||
const events = (round, type) => round.events.filter((e) => e.type === type);
|
||||
// A random that plays `values` in order, then 0.5.
|
||||
const rolls = (...values) => {
|
||||
@@ -99,12 +111,11 @@ test("Ghoul Rush: picking up Lucky dice stacks them to nine, then pays points li
|
||||
assert.equal(round.drops.length, 0);
|
||||
assert.equal(events(round, "power")[0].kind, "die");
|
||||
for (let k = 0; k < 8; k++) ghoul.applyPower(round, "die");
|
||||
assert.equal(round.dice, ghoul.MAX_DICE);
|
||||
assert.equal(ghoul.MAX_DICE, 9);
|
||||
assert.equal(round.dice, 9);
|
||||
const score = round.score;
|
||||
ghoul.applyPower(round, "die");
|
||||
assert.equal(round.dice, 9, "capped");
|
||||
assert.equal(round.score - score, ghoul.POWER_POINTS * 10, "points instead");
|
||||
assert.equal(round.dice, 10, "no cap");
|
||||
assert.equal(round.score, score, "no points instead");
|
||||
const canvas = { getContext: () => null };
|
||||
const game = ghoul.default.create({ canvas });
|
||||
game.start();
|
||||
@@ -140,7 +151,7 @@ test("Ghoul Rush: a fresh run holds 3 Lucky dice, a lost life with one in hand s
|
||||
round.monsters.length = 0;
|
||||
round.hordeMs = Infinity;
|
||||
stand(round, 100);
|
||||
ghoul.lose(round, "zombie");
|
||||
lose(round, "zombie");
|
||||
assert.equal(round.phase, "roll", "a lost life with a die in hand rolls");
|
||||
assert.equal(round.dice, 2, "the roll spends one");
|
||||
const next = ghoul.newRound(5);
|
||||
@@ -159,7 +170,7 @@ test("Ghoul Rush: a death with dice holds and rolls just one; a six saves Planny
|
||||
const far = zombie(round, round.camX + ghoul.FIELD_W + 40);
|
||||
far.hp = 3;
|
||||
const x = round.you.x;
|
||||
assert.equal(ghoul.lose(round, "zombie"), true);
|
||||
assert.equal(lose(round, "zombie"), true);
|
||||
assert.equal(round.phase, "roll");
|
||||
assert.equal(round.lives, 3, "no life lost yet");
|
||||
assert.equal(round.dice, 2, "the die is in hand");
|
||||
@@ -201,7 +212,7 @@ test("Ghoul Rush: a death with dice holds and rolls just one; a six saves Planny
|
||||
test("Ghoul Rush: the same random rolls the same face, and each slice of the die lands on its face", () => {
|
||||
const face = (value) => {
|
||||
const round = hall(5);
|
||||
ghoul.lose(round, "bone");
|
||||
lose(round, "bone");
|
||||
ghoul.advance(round, ghoul.ROLL_MS, rolls(value));
|
||||
return events(round, "diceFace").map((e) => e.face);
|
||||
};
|
||||
@@ -209,15 +220,15 @@ test("Ghoul Rush: the same random rolls the same face, and each slice of the die
|
||||
assert.deepEqual([ONE, 0.2, 0.4, 0.6, 0.8, SIX].flatMap(face), [1, 2, 3, 4, 5, 6]);
|
||||
});
|
||||
|
||||
test("Ghoul Rush: a 5 saves him with a heart and no shield, a 4 just saves him, and a heart past the cap is points", () => {
|
||||
test("Ghoul Rush: a 5 saves him with a heart and no shield, a 4 just saves him, and a heart has no cap", () => {
|
||||
const five = hall(1);
|
||||
ghoul.lose(five, "zombie");
|
||||
lose(five, "zombie");
|
||||
ghoul.advance(five, ghoul.ROLL_MS + 8, rolls(FIVE));
|
||||
assert.equal(five.phase, "play");
|
||||
assert.equal(five.lives, 4);
|
||||
assert.equal(five.you.garlic, false);
|
||||
const four = hall(1);
|
||||
ghoul.lose(four, "zombie");
|
||||
lose(four, "zombie");
|
||||
ghoul.advance(four, ghoul.ROLL_MS + 8, rolls(FOUR));
|
||||
assert.equal(four.phase, "play");
|
||||
assert.equal(four.lives, 3);
|
||||
@@ -225,16 +236,16 @@ test("Ghoul Rush: a 5 saves him with a heart and no shield, a 4 just saves him,
|
||||
assert.ok(four.you.safeMs > 0, "still safe a moment");
|
||||
const held = hall(1);
|
||||
held.you.garlic = true;
|
||||
ghoul.lose(held, "pit");
|
||||
lose(held, "pit");
|
||||
ghoul.advance(held, ghoul.ROLL_MS + 8, rolls(FOUR));
|
||||
assert.equal(held.you.garlic, true, "a shield he already held stays");
|
||||
const full = hall(1);
|
||||
full.lives = 9;
|
||||
const score = full.score;
|
||||
ghoul.lose(full, "zombie");
|
||||
lose(full, "zombie");
|
||||
ghoul.advance(full, ghoul.ROLL_MS + 8, rolls(FIVE));
|
||||
assert.equal(full.lives, 9, "capped");
|
||||
assert.ok(full.score > score, "points instead");
|
||||
assert.equal(full.lives, 10, "no cap");
|
||||
assert.equal(full.score, score, "no points instead");
|
||||
});
|
||||
|
||||
test("Ghoul Rush: a 3 costs the life and he comes back with Rapid fire and a Garlic shield, a 2 with Bottle Rockets and a Garlic shield", () => {
|
||||
@@ -243,7 +254,7 @@ test("Ghoul Rush: a 3 costs the life and he comes back with Rapid fire and a Gar
|
||||
[TWO, (round) => assert.deepEqual(round.arms.map((a) => [a.kind, a.n]), [["rocket", ghoul.POWERS.rocket.sticks]])],
|
||||
]) {
|
||||
const round = hall(2);
|
||||
ghoul.lose(round, "zombie");
|
||||
lose(round, "zombie");
|
||||
ghoul.advance(round, ghoul.ROLL_MS + 8, rolls(value));
|
||||
assert.equal(round.phase, "crash", "the life is lost");
|
||||
assert.equal(round.lives, 2);
|
||||
@@ -262,7 +273,7 @@ test("Ghoul Rush: a 3 costs the life and he comes back with Rapid fire and a Gar
|
||||
round.phase = "play";
|
||||
round.you.garlic = false;
|
||||
round.you.safeMs = 0;
|
||||
ghoul.lose(round, "zombie");
|
||||
lose(round, "zombie");
|
||||
ghoul.advance(round, ghoul.CRASH_MS + 8, steady);
|
||||
assert.equal(round.you.garlic, false, "the gift comes once");
|
||||
assert.equal(events(round, "diceGift").length, 1);
|
||||
@@ -272,7 +283,7 @@ test("Ghoul Rush: a 3 costs the life and he comes back with Rapid fire and a Gar
|
||||
|
||||
test("Ghoul Rush: a 1 costs the life and leaves nothing, with its laugh and its words", () => {
|
||||
const round = hall(2);
|
||||
ghoul.lose(round, "zombie");
|
||||
lose(round, "zombie");
|
||||
ghoul.advance(round, ghoul.ROLL_MS - 8, rolls(ONE));
|
||||
assert.equal(round.phase, "roll", "the beat has not finished");
|
||||
ghoul.advance(round, 16, steady);
|
||||
@@ -294,7 +305,7 @@ test("Ghoul Rush: a 1 costs the life and leaves nothing, with its laugh and its
|
||||
test("Ghoul Rush: on the last heart a 5 or 6 saves him in place, a 2, 3 or 4 pays one heart and he respawns as usual, a 1 loses the run", () => {
|
||||
const saved = hall(1);
|
||||
saved.lives = 1;
|
||||
ghoul.lose(saved, "zombie");
|
||||
lose(saved, "zombie");
|
||||
ghoul.advance(saved, ghoul.ROLL_MS + 8, rolls(FIVE));
|
||||
assert.equal(saved.lives, 2, "saved in place, with the 5's heart");
|
||||
assert.equal(saved.over, false);
|
||||
@@ -302,7 +313,7 @@ test("Ghoul Rush: on the last heart a 5 or 6 saves him in place, a 2, 3 or 4 pay
|
||||
for (const face of [TWO, THREE, FOUR]) {
|
||||
const mercy = hall(1);
|
||||
mercy.lives = 1;
|
||||
ghoul.lose(mercy, "zombie");
|
||||
lose(mercy, "zombie");
|
||||
ghoul.advance(mercy, ghoul.ROLL_MS + 8, rolls(face));
|
||||
assert.equal(events(mercy, "diceHeart").length, 1, "a heart is paid");
|
||||
assert.equal(mercy.phase, "crash", "the loss goes ahead");
|
||||
@@ -316,13 +327,13 @@ test("Ghoul Rush: on the last heart a 5 or 6 saves him in place, a 2, 3 or 4 pay
|
||||
// Not on the last heart: a 3 is a gift, a 4 a save, as ever.
|
||||
const plenty = hall(1);
|
||||
plenty.lives = 2;
|
||||
ghoul.lose(plenty, "zombie");
|
||||
lose(plenty, "zombie");
|
||||
ghoul.advance(plenty, ghoul.ROLL_MS + 8, rolls(FOUR));
|
||||
assert.equal(plenty.lives, 2);
|
||||
assert.equal(events(plenty, "diceHeart").length, 0);
|
||||
const lost = hall(1);
|
||||
lost.lives = 1;
|
||||
ghoul.lose(lost, "zombie");
|
||||
lose(lost, "zombie");
|
||||
ghoul.advance(lost, ghoul.ROLL_MS + ghoul.CRASH_MS + 40, rolls(ONE));
|
||||
assert.equal(lost.lives, 0);
|
||||
assert.equal(lost.over, true);
|
||||
@@ -331,7 +342,7 @@ test("Ghoul Rush: on the last heart a 5 or 6 saves him in place, a 2, 3 or 4 pay
|
||||
test("Ghoul Rush: endless lives never roll the dice", () => {
|
||||
const round = hall(3);
|
||||
round.infinite = true;
|
||||
ghoul.lose(round, "zombie");
|
||||
lose(round, "zombie");
|
||||
assert.equal(round.phase, "crash");
|
||||
assert.equal(round.dice, 3, "kept");
|
||||
assert.equal(round.lives, 3);
|
||||
@@ -342,6 +353,8 @@ test("Ghoul Rush: the clock running out can be saved too, with some time back",
|
||||
const round = hall(1);
|
||||
round.timeMs = 5;
|
||||
ghoul.advance(round, 8, steady);
|
||||
assert.equal(round.phase, "ask", "the clock running out asks too");
|
||||
accept(round);
|
||||
assert.equal(round.phase, "roll");
|
||||
ghoul.advance(round, ghoul.ROLL_MS + 8, rolls(SIX));
|
||||
assert.equal(round.phase, "play");
|
||||
@@ -369,6 +382,8 @@ test("Ghoul Rush: a pit fall rolls too, and a save puts Planny back on the last
|
||||
round.input.right = false;
|
||||
round.you.safeMs = 1e9;
|
||||
ghoul.advance(round, 4, steady);
|
||||
assert.equal(round.phase, "ask", "a pit asks too");
|
||||
accept(round);
|
||||
assert.equal(round.phase, "roll");
|
||||
assert.equal(events(round, "diceStart")[0].cause, "pit");
|
||||
assert.equal(round.lives, 3);
|
||||
@@ -388,6 +403,7 @@ test("Ghoul Rush: a pit fall rolls too, and a save puts Planny back on the last
|
||||
lost.lives = 3;
|
||||
lost.you.safeMs = 1e9;
|
||||
ghoul.advance(lost, 4, steady);
|
||||
accept(lost);
|
||||
ghoul.advance(lost, ghoul.ROLL_MS + 8, rolls(0.2));
|
||||
assert.equal(lost.lives, 2);
|
||||
assert.equal(lost.phase, "crash");
|
||||
@@ -399,7 +415,7 @@ test("Ghoul Rush: in an ordinary room a saved life blows apart every monster in
|
||||
const near = [zombie(round, 110), zombie(round, 130), zombie(round, round.camX + 5)];
|
||||
const far = zombie(round, round.camX + ghoul.FIELD_W + 40);
|
||||
const score = round.score;
|
||||
ghoul.lose(round, "zombie");
|
||||
lose(round, "zombie");
|
||||
ghoul.advance(round, ghoul.ROLL_MS + 8, rolls(SIX));
|
||||
assert.equal(round.phase, "play");
|
||||
assert.ok(near.every((m) => m.dead), "all in view are dead");
|
||||
@@ -414,7 +430,7 @@ test("Ghoul Rush: in an ordinary room a saved life blows apart every monster in
|
||||
// Any saving face blows them apart, not only a six.
|
||||
const four = hall(1);
|
||||
const by = zombie(four, 110);
|
||||
ghoul.lose(four, "zombie");
|
||||
lose(four, "zombie");
|
||||
ghoul.advance(four, ghoul.ROLL_MS + 8, rolls(FOUR));
|
||||
assert.ok(by.dead);
|
||||
});
|
||||
@@ -428,7 +444,7 @@ test("Ghoul Rush: in a boss's room a saved life blows nothing apart, and the bos
|
||||
const m = ghoul.spawnMonster(round, "zombie", round.you.x + 6, ghoul.groundAt(round.spec, round.you.x + 6), { rise: 0, awake: true });
|
||||
round.dice = 1;
|
||||
round.events.length = 0;
|
||||
ghoul.lose(round, "bones");
|
||||
lose(round, "bones");
|
||||
ghoul.advance(round, ghoul.ROLL_MS + 8, rolls(SIX));
|
||||
assert.equal(round.phase, "play");
|
||||
assert.ok(!m.dead && round.monsters.includes(m), "the monster stands");
|
||||
@@ -443,7 +459,7 @@ test("Ghoul Rush: in a boss's room a saved life blows nothing apart, and the bos
|
||||
test("Ghoul Rush: every step of the roll has a look and a sound, and the revive's jingle plays once", () => {
|
||||
const round = hall(3);
|
||||
zombie(round, 110);
|
||||
ghoul.lose(round, "zombie");
|
||||
lose(round, "zombie");
|
||||
ghoul.advance(round, ghoul.ROLL_MS + 8, rolls(SIX));
|
||||
const played = [];
|
||||
const fx = {};
|
||||
|
||||
@@ -1,25 +1,25 @@
|
||||
// Web console tests, Ghoul Rush's Frozen Lake stage: its rooms (Ice Fishing Huts, Snowbound Lodge, The Black Ice, the Widow's Web), slippery ice and thin ice that cracks and breaks, under-ice hands, snow shades you only see by their footprints, frozen ghouls that slide and shatter, ice wraiths whose dive leaves you frozen, Hot Cocoa and the Road Flare (found only here), and the Frost Widow, whose veil melts only to a burning barrel or a flare.
|
||||
import { test } from "node:test";
|
||||
import assert from "node:assert/strict";
|
||||
import * as ghoul from "../src/web-console/public/activities/ghoul.js";
|
||||
import * as fz from "../src/web-console/public/activities/ghoul-frozen.js";
|
||||
import * as fl from "../src/web-console/public/activities/ghoul-flare.js";
|
||||
import * as arm from "../src/web-console/public/activities/ghoul-arms.js";
|
||||
import { PILL_WORDS, STAGE_ARMS, armDrop, pickPower } from "../src/web-console/public/activities/ghoul-powers.js";
|
||||
import { BONES } from "../src/web-console/public/activities/ghoul-bones.js";
|
||||
import { GRAVEYARD } from "../src/web-console/public/activities/ghoul-graveyard.js";
|
||||
import { GROUNDS } from "../src/web-console/public/activities/ghoul-grounds.js";
|
||||
import { CHAPEL } from "../src/web-console/public/activities/ghoul-chapel.js";
|
||||
import { SANATORIUM } from "../src/web-console/public/activities/ghoul-sanatorium.js";
|
||||
import { VILLAGE } from "../src/web-console/public/activities/ghoul-village.js";
|
||||
import { MINE } from "../src/web-console/public/activities/ghoul-mine.js";
|
||||
import { CART } from "../src/web-console/public/activities/ghoul-cart.js";
|
||||
import { CARNIVAL } from "../src/web-console/public/activities/ghoul-carnival.js";
|
||||
import { LOOKS, VOICES, react } from "../src/web-console/public/activities/ghoul-draw.js";
|
||||
import { EVENT_VOICE, LOSE_SOUNDS, LOSE_WORDS, SILENT } from "../src/web-console/public/activities/ghoul-frozen-draw.js";
|
||||
import { FROZEN_SFX } from "../src/web-console/public/activities/ghoul-sfx-frozen.js";
|
||||
import { SLED_SFX } from "../src/web-console/public/activities/ghoul-sfx-sled.js";
|
||||
import * as ghoulSfx from "../src/web-console/public/activities/ghoul-sfx.js";
|
||||
import * as ghoul from "../src/web-console/public/activities/ghoul-rush/ghoul.js";
|
||||
import * as fz from "../src/web-console/public/activities/ghoul-rush/stages/frozen/ghoul-frozen.js";
|
||||
import * as fl from "../src/web-console/public/activities/ghoul-rush/arms/ghoul-flare.js";
|
||||
import * as arm from "../src/web-console/public/activities/ghoul-rush/arms/ghoul-arms.js";
|
||||
import { PILL_WORDS, STAGE_ARMS, armDrop, pickPower } from "../src/web-console/public/activities/ghoul-rush/core/ghoul-powers.js";
|
||||
import { BONES } from "../src/web-console/public/activities/ghoul-rush/stages/wing/ghoul-bones.js";
|
||||
import { GRAVEYARD } from "../src/web-console/public/activities/ghoul-rush/stages/graveyard/ghoul-graveyard.js";
|
||||
import { GROUNDS } from "../src/web-console/public/activities/ghoul-rush/stages/grounds/ghoul-grounds.js";
|
||||
import { CHAPEL } from "../src/web-console/public/activities/ghoul-rush/stages/chapel/ghoul-chapel.js";
|
||||
import { SANATORIUM } from "../src/web-console/public/activities/ghoul-rush/stages/sanatorium/ghoul-sanatorium.js";
|
||||
import { VILLAGE } from "../src/web-console/public/activities/ghoul-rush/stages/village/ghoul-village.js";
|
||||
import { MINE } from "../src/web-console/public/activities/ghoul-rush/stages/mine/ghoul-mine.js";
|
||||
import { CART } from "../src/web-console/public/activities/ghoul-rush/rides/cart/ghoul-cart.js";
|
||||
import { CARNIVAL } from "../src/web-console/public/activities/ghoul-rush/stages/carnival/ghoul-carnival.js";
|
||||
import { LOOKS, VOICES, react } from "../src/web-console/public/activities/ghoul-rush/draw/ghoul-draw.js";
|
||||
import { EVENT_VOICE, LOSE_SOUNDS, LOSE_WORDS, SILENT } from "../src/web-console/public/activities/ghoul-rush/stages/frozen/ghoul-frozen-draw.js";
|
||||
import { FROZEN_SFX } from "../src/web-console/public/activities/ghoul-rush/stages/frozen/ghoul-sfx-frozen.js";
|
||||
import { SLED_SFX } from "../src/web-console/public/activities/ghoul-rush/rides/sled/ghoul-sfx-sled.js";
|
||||
import * as ghoulSfx from "../src/web-console/public/activities/ghoul-rush/sfx/ghoul-sfx.js";
|
||||
|
||||
const steady = () => 0.5;
|
||||
// The pack draws no random number: a run on this fails on the first draw.
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
// Web console tests, Ghoul Rush's game over: a lost end plays the mechanical laugh track (and a win does not), and the "G A M E - O V E R" banner drops in letter by letter and draws on a fake canvas.
|
||||
import { test } from "node:test";
|
||||
import assert from "node:assert/strict";
|
||||
import * as ghoul from "../src/web-console/public/activities/ghoul.js";
|
||||
import { skipStory } from "../src/web-console/public/activities/ghoul-story.js";
|
||||
import { dropAt, gameOverBanner, OVER_WORD } from "../src/web-console/public/activities/ghoul-gameover-draw.js";
|
||||
import * as ghoul from "../src/web-console/public/activities/ghoul-rush/ghoul.js";
|
||||
import { skipStory } from "../src/web-console/public/activities/ghoul-rush/story/ghoul-story.js";
|
||||
import { dropAt, gameOverBanner, OVER_WORD } from "../src/web-console/public/activities/ghoul-rush/story/ghoul-gameover-draw.js";
|
||||
import { toneNames } from "../src/web-console/public/tones.js";
|
||||
|
||||
function fakeCtx(texts) {
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
// Web console tests, Ghoul Rush's Graveyard stage: its four rooms, grasping hands, mourners and their wail, grave robbers, rotters and the legs they leave, carrion crows, the graves rotters climb out of, and Mother Mourning, who can only be hurt while she watches and drops a stone fist on whatever moves.
|
||||
import { test } from "node:test";
|
||||
import assert from "node:assert/strict";
|
||||
import * as ghoul from "../src/web-console/public/activities/ghoul.js";
|
||||
import * as gy from "../src/web-console/public/activities/ghoul-graveyard.js";
|
||||
import { VOICES, react } from "../src/web-console/public/activities/ghoul-draw.js";
|
||||
import * as ghoul from "../src/web-console/public/activities/ghoul-rush/ghoul.js";
|
||||
import * as gy from "../src/web-console/public/activities/ghoul-rush/stages/graveyard/ghoul-graveyard.js";
|
||||
import { VOICES, react } from "../src/web-console/public/activities/ghoul-rush/draw/ghoul-draw.js";
|
||||
|
||||
const steady = () => 0.5;
|
||||
const events = (round, type) => round.events.filter((e) => e.type === type);
|
||||
|
||||
@@ -1,14 +1,14 @@
|
||||
// Web console tests, Ghoul Rush's Grounds stage: its four rooms, topiary beasts that creep only when your back is turned, rootlings under the lawn, lantern moths, mulch crawlers, the Hedge shears (found only here), and the Groundskeeper, whose lantern takes triple damage, whose scythe is jumped, whose fire burns the floor and who mounts a mower at half his hp.
|
||||
import { test } from "node:test";
|
||||
import assert from "node:assert/strict";
|
||||
import * as ghoul from "../src/web-console/public/activities/ghoul.js";
|
||||
import * as gr from "../src/web-console/public/activities/ghoul-grounds.js";
|
||||
import { LOSE_SOUNDS, LOSE_WORDS } from "../src/web-console/public/activities/ghoul-grounds-draw.js";
|
||||
import { PILL_WORDS } from "../src/web-console/public/activities/ghoul-powers.js";
|
||||
import { pickPower } from "../src/web-console/public/activities/ghoul-powers.js";
|
||||
import * as sfxGrounds from "../src/web-console/public/activities/ghoul-sfx-grounds.js";
|
||||
import * as ghoulSfx from "../src/web-console/public/activities/ghoul-sfx.js";
|
||||
import { VOICES, react } from "../src/web-console/public/activities/ghoul-draw.js";
|
||||
import * as ghoul from "../src/web-console/public/activities/ghoul-rush/ghoul.js";
|
||||
import * as gr from "../src/web-console/public/activities/ghoul-rush/stages/grounds/ghoul-grounds.js";
|
||||
import { LOSE_SOUNDS, LOSE_WORDS } from "../src/web-console/public/activities/ghoul-rush/stages/grounds/ghoul-grounds-draw.js";
|
||||
import { PILL_WORDS } from "../src/web-console/public/activities/ghoul-rush/core/ghoul-powers.js";
|
||||
import { pickPower } from "../src/web-console/public/activities/ghoul-rush/core/ghoul-powers.js";
|
||||
import * as sfxGrounds from "../src/web-console/public/activities/ghoul-rush/stages/grounds/ghoul-sfx-grounds.js";
|
||||
import * as ghoulSfx from "../src/web-console/public/activities/ghoul-rush/sfx/ghoul-sfx.js";
|
||||
import { VOICES, react } from "../src/web-console/public/activities/ghoul-rush/draw/ghoul-draw.js";
|
||||
|
||||
const steady = () => 0.5;
|
||||
const events = (round, type) => round.events.filter((e) => e.type === type);
|
||||
|
||||
@@ -2,14 +2,14 @@
|
||||
// Run with: node --test scripts/test-web-console-activities-ghoul-gurney.mjs
|
||||
import { test } from "node:test";
|
||||
import assert from "node:assert/strict";
|
||||
import * as ghoul from "../src/web-console/public/activities/ghoul.js";
|
||||
import * as ghoul from "../src/web-console/public/activities/ghoul-rush/ghoul.js";
|
||||
import { skipBossIntro } from "./ghoul-test-helpers.mjs";
|
||||
import * as gn from "../src/web-console/public/activities/ghoul-gurney.js";
|
||||
import * as ct from "../src/web-console/public/activities/ghoul-cart.js";
|
||||
import { EVENT_VOICE, LOSE_SOUNDS, LOSE_WORDS, LOOKS as GURNEY_LOOKS, VOICES as GURNEY_VOICES, gurneyArt, telegraphMarks, telegraphs } from "../src/web-console/public/activities/ghoul-gurney-draw.js";
|
||||
import * as ghoulSfx from "../src/web-console/public/activities/ghoul-sfx.js";
|
||||
import { LOOKS, VOICES, bonusTick, react } from "../src/web-console/public/activities/ghoul-draw.js";
|
||||
import { BONUS_FLOOR, diceFor, endBonus, makeBonus } from "../src/web-console/public/activities/ghoul-bonus.js";
|
||||
import * as gn from "../src/web-console/public/activities/ghoul-rush/rides/gurney/ghoul-gurney.js";
|
||||
import * as ct from "../src/web-console/public/activities/ghoul-rush/rides/cart/ghoul-cart.js";
|
||||
import { EVENT_VOICE, LOSE_SOUNDS, LOSE_WORDS, LOOKS as GURNEY_LOOKS, VOICES as GURNEY_VOICES, gurneyArt, telegraphMarks, telegraphs } from "../src/web-console/public/activities/ghoul-rush/rides/gurney/ghoul-gurney-draw.js";
|
||||
import * as ghoulSfx from "../src/web-console/public/activities/ghoul-rush/sfx/ghoul-sfx.js";
|
||||
import { LOOKS, VOICES, bonusTick, react } from "../src/web-console/public/activities/ghoul-rush/draw/ghoul-draw.js";
|
||||
import { BONUS_FLOOR, diceFor, endBonus, makeBonus } from "../src/web-console/public/activities/ghoul-rush/core/ghoul-bonus.js";
|
||||
|
||||
const steady = () => 0.5;
|
||||
// The pack draws no random number: a run on this fails on the first draw.
|
||||
@@ -633,7 +633,7 @@ test("Ghoul Rush's Code Blue: off the ramp the gurney launches, lands on the bay
|
||||
assert.equal(end.length, 1);
|
||||
assert.equal(end[0].won, true);
|
||||
assert.ok(end[0].dice >= BONUS_FLOOR && end[0].dice <= ghoul.MAX_DICE, `${end[0].dice} dice`);
|
||||
assert.equal(round.dice, Math.min(ghoul.MAX_DICE, 1 + end[0].dice));
|
||||
assert.equal(round.dice, 1 + end[0].dice);
|
||||
assert.equal(round.lives, 3);
|
||||
run(round, ghoul.CARD_MS + 100);
|
||||
assert.equal(round.spec.id, "ward");
|
||||
|
||||
@@ -2,14 +2,14 @@
|
||||
// Run with: node --test scripts/test-web-console-activities-ghoul-hearse.mjs
|
||||
import { test } from "node:test";
|
||||
import assert from "node:assert/strict";
|
||||
import * as ghoul from "../src/web-console/public/activities/ghoul.js";
|
||||
import * as ghoul from "../src/web-console/public/activities/ghoul-rush/ghoul.js";
|
||||
import { skipBossIntro } from "./ghoul-test-helpers.mjs";
|
||||
import * as hz from "../src/web-console/public/activities/ghoul-hearse.js";
|
||||
import { ANSWERS, EVENT_VOICE, LOOKS as HEARSE_LOOKS, LOSE_SOUNDS, LOSE_WORDS, VOICES as HEARSE_VOICES, telegraphMarks, telegraphs } from "../src/web-console/public/activities/ghoul-hearse-draw.js";
|
||||
import * as ghoulSfx from "../src/web-console/public/activities/ghoul-sfx.js";
|
||||
import { HEARSE_SFX } from "../src/web-console/public/activities/ghoul-sfx-hearse.js";
|
||||
import { LOOKS, VOICES, bonusTick, react } from "../src/web-console/public/activities/ghoul-draw.js";
|
||||
import { BONUS_FLOOR, diceFor, endBonus, makeBonus } from "../src/web-console/public/activities/ghoul-bonus.js";
|
||||
import * as hz from "../src/web-console/public/activities/ghoul-rush/rides/hearse/ghoul-hearse.js";
|
||||
import { ANSWERS, EVENT_VOICE, LOOKS as HEARSE_LOOKS, LOSE_SOUNDS, LOSE_WORDS, VOICES as HEARSE_VOICES, telegraphMarks, telegraphs } from "../src/web-console/public/activities/ghoul-rush/rides/hearse/ghoul-hearse-draw.js";
|
||||
import * as ghoulSfx from "../src/web-console/public/activities/ghoul-rush/sfx/ghoul-sfx.js";
|
||||
import { HEARSE_SFX } from "../src/web-console/public/activities/ghoul-rush/rides/hearse/ghoul-sfx-hearse.js";
|
||||
import { LOOKS, VOICES, bonusTick, react } from "../src/web-console/public/activities/ghoul-rush/draw/ghoul-draw.js";
|
||||
import { BONUS_FLOOR, diceFor, endBonus, makeBonus } from "../src/web-console/public/activities/ghoul-rush/core/ghoul-bonus.js";
|
||||
|
||||
const steady = () => 0.5;
|
||||
// The pack draws no random number: a run on this fails on the first draw.
|
||||
@@ -732,7 +732,7 @@ test("Ghoul Rush's Midnight Hearse: at the finish the hearse brakes, the door op
|
||||
assert.equal(end.length, 1);
|
||||
assert.equal(end[0].won, true);
|
||||
assert.ok(end[0].dice >= BONUS_FLOOR && end[0].dice <= ghoul.MAX_DICE, `${end[0].dice} dice`);
|
||||
assert.equal(round.dice, Math.min(ghoul.MAX_DICE, 1 + end[0].dice));
|
||||
assert.equal(round.dice, 1 + end[0].dice);
|
||||
assert.equal(round.lives, 3);
|
||||
run(round, ghoul.CARD_MS + 100);
|
||||
assert.equal(round.spec.id, "angel");
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
// Web console tests, Ghoul Rush's stage intro cards: every stage has one (3 or 4 lines, short, no em dash, never the hero's name), the card shows when a stage is entered and not before the pick, any move key or fire moves it on after the minimum (repeats and early presses never do) and it never moves on by itself, and it draws on a fake canvas.
|
||||
import { test } from "node:test";
|
||||
import assert from "node:assert/strict";
|
||||
import * as ghoul from "../src/web-console/public/activities/ghoul.js";
|
||||
import { INTROS, MAX_LINE, introFor } from "../src/web-console/public/activities/ghoul-intros.js";
|
||||
import { INTRO_HINT, LINE_SIZE, TITLE_SIZE, dropAt, titleLayout } from "../src/web-console/public/activities/ghoul-intro-draw.js";
|
||||
import * as ghoul from "../src/web-console/public/activities/ghoul-rush/ghoul.js";
|
||||
import { INTROS, MAX_LINE, introFor } from "../src/web-console/public/activities/ghoul-rush/story/ghoul-intros.js";
|
||||
import { INTRO_HINT, LINE_SIZE, TITLE_SIZE, dropAt, titleLayout } from "../src/web-console/public/activities/ghoul-rush/story/ghoul-intro-draw.js";
|
||||
import { toneNames } from "../src/web-console/public/tones.js";
|
||||
|
||||
const steady = () => 0.5;
|
||||
|
||||
File diff suppressed because it is too large.
Load diff
@@ -1,19 +1,19 @@
|
||||
// Web console tests, Ghoul Rush's Deep Seam Mine stage: its four rooms (always dark, the cage lifts, the water, the rockfall), rocks that fall after a dust warning and crush monsters and cost a life, the knocker imp that steals your light but never a life, the canary ghost whose scream brings three rocks down, the dead miner that digs out of the wall, the blind crawler that hunts by sound, the cage you can ride, the Hard Hat and Dynamite (found only here), and the Tommyknocker, who knocks, sweeps his hammer, puts the lights out, sinks into the seam and bursts out dazed, and rages at half his hp.
|
||||
import { test } from "node:test";
|
||||
import assert from "node:assert/strict";
|
||||
import * as ghoul from "../src/web-console/public/activities/ghoul.js";
|
||||
import * as mn from "../src/web-console/public/activities/ghoul-mine.js";
|
||||
import * as arm from "../src/web-console/public/activities/ghoul-arms.js";
|
||||
import { EVENT_VOICE, LOSE_SOUNDS, LOSE_WORDS } from "../src/web-console/public/activities/ghoul-mine-draw.js";
|
||||
import { PILL_WORDS, pickPower } from "../src/web-console/public/activities/ghoul-powers.js";
|
||||
import { BONES } from "../src/web-console/public/activities/ghoul-bones.js";
|
||||
import { GRAVEYARD } from "../src/web-console/public/activities/ghoul-graveyard.js";
|
||||
import { GROUNDS } from "../src/web-console/public/activities/ghoul-grounds.js";
|
||||
import { CHAPEL } from "../src/web-console/public/activities/ghoul-chapel.js";
|
||||
import { SANATORIUM } from "../src/web-console/public/activities/ghoul-sanatorium.js";
|
||||
import { VILLAGE } from "../src/web-console/public/activities/ghoul-village.js";
|
||||
import * as ghoulSfx from "../src/web-console/public/activities/ghoul-sfx.js";
|
||||
import { LOOKS, VOICES, react } from "../src/web-console/public/activities/ghoul-draw.js";
|
||||
import * as ghoul from "../src/web-console/public/activities/ghoul-rush/ghoul.js";
|
||||
import * as mn from "../src/web-console/public/activities/ghoul-rush/stages/mine/ghoul-mine.js";
|
||||
import * as arm from "../src/web-console/public/activities/ghoul-rush/arms/ghoul-arms.js";
|
||||
import { EVENT_VOICE, LOSE_SOUNDS, LOSE_WORDS } from "../src/web-console/public/activities/ghoul-rush/stages/mine/ghoul-mine-draw.js";
|
||||
import { PILL_WORDS, pickPower } from "../src/web-console/public/activities/ghoul-rush/core/ghoul-powers.js";
|
||||
import { BONES } from "../src/web-console/public/activities/ghoul-rush/stages/wing/ghoul-bones.js";
|
||||
import { GRAVEYARD } from "../src/web-console/public/activities/ghoul-rush/stages/graveyard/ghoul-graveyard.js";
|
||||
import { GROUNDS } from "../src/web-console/public/activities/ghoul-rush/stages/grounds/ghoul-grounds.js";
|
||||
import { CHAPEL } from "../src/web-console/public/activities/ghoul-rush/stages/chapel/ghoul-chapel.js";
|
||||
import { SANATORIUM } from "../src/web-console/public/activities/ghoul-rush/stages/sanatorium/ghoul-sanatorium.js";
|
||||
import { VILLAGE } from "../src/web-console/public/activities/ghoul-rush/stages/village/ghoul-village.js";
|
||||
import * as ghoulSfx from "../src/web-console/public/activities/ghoul-rush/sfx/ghoul-sfx.js";
|
||||
import { LOOKS, VOICES, react } from "../src/web-console/public/activities/ghoul-rush/draw/ghoul-draw.js";
|
||||
|
||||
const steady = () => 0.5;
|
||||
// The pack draws no random number: a run on this fails on the first draw.
|
||||
|
||||
@@ -2,15 +2,15 @@
|
||||
// Run with: node --test scripts/test-web-console-activities-ghoul-mower.mjs
|
||||
import { test } from "node:test";
|
||||
import assert from "node:assert/strict";
|
||||
import * as ghoul from "../src/web-console/public/activities/ghoul.js";
|
||||
import * as ghoul from "../src/web-console/public/activities/ghoul-rush/ghoul.js";
|
||||
import { skipBossIntro } from "./ghoul-test-helpers.mjs";
|
||||
import * as mw from "../src/web-console/public/activities/ghoul-mower.js";
|
||||
import * as ct from "../src/web-console/public/activities/ghoul-cart.js";
|
||||
import { ANSWERS, EVENT_VOICE, LOSE_SOUNDS, LOSE_WORDS, LOOKS as MOWER_LOOKS, VOICES as MOWER_VOICES, telegraphMarks, telegraphs } from "../src/web-console/public/activities/ghoul-mower-draw.js";
|
||||
import { MOWER_SFX } from "../src/web-console/public/activities/ghoul-sfx-mower.js";
|
||||
import * as ghoulSfx from "../src/web-console/public/activities/ghoul-sfx.js";
|
||||
import { LOOKS, VOICES, bonusTick, react } from "../src/web-console/public/activities/ghoul-draw.js";
|
||||
import { BONUS_FLOOR, diceFor, endBonus } from "../src/web-console/public/activities/ghoul-bonus.js";
|
||||
import * as mw from "../src/web-console/public/activities/ghoul-rush/rides/mower/ghoul-mower.js";
|
||||
import * as ct from "../src/web-console/public/activities/ghoul-rush/rides/cart/ghoul-cart.js";
|
||||
import { ANSWERS, EVENT_VOICE, LOSE_SOUNDS, LOSE_WORDS, LOOKS as MOWER_LOOKS, VOICES as MOWER_VOICES, telegraphMarks, telegraphs } from "../src/web-console/public/activities/ghoul-rush/rides/mower/ghoul-mower-draw.js";
|
||||
import { MOWER_SFX } from "../src/web-console/public/activities/ghoul-rush/rides/mower/ghoul-sfx-mower.js";
|
||||
import * as ghoulSfx from "../src/web-console/public/activities/ghoul-rush/sfx/ghoul-sfx.js";
|
||||
import { LOOKS, VOICES, bonusTick, react } from "../src/web-console/public/activities/ghoul-rush/draw/ghoul-draw.js";
|
||||
import { BONUS_FLOOR, diceFor, endBonus } from "../src/web-console/public/activities/ghoul-rush/core/ghoul-bonus.js";
|
||||
|
||||
const steady = () => 0.5;
|
||||
// The pack draws no random number: a run on this fails on the first draw.
|
||||
@@ -586,7 +586,7 @@ test("Ghoul Rush's Gardener's Revenge: rolling onto the lawn's end stops the mow
|
||||
assert.equal(end.length, 1);
|
||||
assert.equal(end[0].won, true);
|
||||
assert.ok(end[0].dice >= BONUS_FLOOR && end[0].dice <= ghoul.MAX_DICE, `${end[0].dice} dice`);
|
||||
assert.equal(round.dice, Math.min(ghoul.MAX_DICE, 1 + end[0].dice));
|
||||
assert.equal(round.dice, 1 + end[0].dice);
|
||||
assert.equal(round.lives, 3);
|
||||
run(round, ghoul.CARD_MS + 100);
|
||||
assert.equal(round.spec.id, "yard");
|
||||
|
||||
@@ -2,13 +2,13 @@
|
||||
// Run with: node --test scripts/test-web-console-activities-ghoul-pew.mjs
|
||||
import { test } from "node:test";
|
||||
import assert from "node:assert/strict";
|
||||
import * as ghoul from "../src/web-console/public/activities/ghoul.js";
|
||||
import * as pew from "../src/web-console/public/activities/ghoul-pew.js";
|
||||
import { EVENT_VOICE, LOSE_SOUNDS, LOSE_WORDS, LOOKS as PEW_LOOKS, VOICES as PEW_VOICES } from "../src/web-console/public/activities/ghoul-pew-draw.js";
|
||||
import * as ghoulSfx from "../src/web-console/public/activities/ghoul-sfx.js";
|
||||
import { LOOKS, VOICES, bonusTick, react } from "../src/web-console/public/activities/ghoul-draw.js";
|
||||
import { BONUS_FLOOR, diceFor, endBonus, makeBonus } from "../src/web-console/public/activities/ghoul-bonus.js";
|
||||
import { BPM, pulse } from "../src/web-console/public/activities/ghoul-pew-world.js";
|
||||
import * as ghoul from "../src/web-console/public/activities/ghoul-rush/ghoul.js";
|
||||
import * as pew from "../src/web-console/public/activities/ghoul-rush/rides/pew/ghoul-pew.js";
|
||||
import { EVENT_VOICE, LOSE_SOUNDS, LOSE_WORDS, LOOKS as PEW_LOOKS, VOICES as PEW_VOICES } from "../src/web-console/public/activities/ghoul-rush/rides/pew/ghoul-pew-draw.js";
|
||||
import * as ghoulSfx from "../src/web-console/public/activities/ghoul-rush/sfx/ghoul-sfx.js";
|
||||
import { LOOKS, VOICES, bonusTick, react } from "../src/web-console/public/activities/ghoul-rush/draw/ghoul-draw.js";
|
||||
import { BONUS_FLOOR, diceFor, endBonus, makeBonus } from "../src/web-console/public/activities/ghoul-rush/core/ghoul-bonus.js";
|
||||
import { BPM, pulse } from "../src/web-console/public/activities/ghoul-rush/rides/pew/ghoul-pew-world.js";
|
||||
|
||||
const steady = () => 0.5;
|
||||
// The pack draws no random number: a run on this fails on the first draw.
|
||||
|
||||
@@ -3,9 +3,9 @@
|
||||
|
||||
import test from "node:test";
|
||||
import assert from "node:assert/strict";
|
||||
import * as ghoul from "../src/web-console/public/activities/ghoul.js";
|
||||
import { skipStory as storySkip } from "../src/web-console/public/activities/ghoul-story.js";
|
||||
import { MERCY_FAR, MERCY_NEAR, mercyKind, mercySpot, mix3 } from "../src/web-console/public/activities/ghoul-powers.js";
|
||||
import * as ghoul from "../src/web-console/public/activities/ghoul-rush/ghoul.js";
|
||||
import { skipStory as storySkip } from "../src/web-console/public/activities/ghoul-rush/story/ghoul-story.js";
|
||||
import { MERCY_FAR, MERCY_NEAR, mercyKind, mercySpot, mix3 } from "../src/web-console/public/activities/ghoul-rush/core/ghoul-powers.js";
|
||||
|
||||
const steady = () => 0.5;
|
||||
const mercies = (round) => round.drops.filter((d) => d.mercy);
|
||||
|
||||
@@ -2,16 +2,16 @@
|
||||
// Run with: node --test scripts/test-web-console-activities-ghoul-ride.mjs
|
||||
import { test } from "node:test";
|
||||
import assert from "node:assert/strict";
|
||||
import * as ghoul from "../src/web-console/public/activities/ghoul.js";
|
||||
import * as rt from "../src/web-console/public/activities/ghoul-ride.js";
|
||||
import { SCENES, END_P } from "../src/web-console/public/activities/ghoul-ride-scenes.js";
|
||||
import { CAR_X, DUCK_OFF, DUCK_ON, bindG } from "../src/web-console/public/activities/ghoul-ride-core.js";
|
||||
import { EVENT_VOICE, LOSE_SOUNDS, LOSE_WORDS, LOOKS as RIDE_LOOKS, VOICES as RIDE_VOICES } from "../src/web-console/public/activities/ghoul-ride-voices.js";
|
||||
import { CARNIVAL_ROOMS } from "../src/web-console/public/activities/ghoul-carnival.js";
|
||||
import * as ghoulSfx from "../src/web-console/public/activities/ghoul-sfx.js";
|
||||
import { LOOKS, VOICES } from "../src/web-console/public/activities/ghoul-draw.js";
|
||||
import { endBonus } from "../src/web-console/public/activities/ghoul-bonus.js";
|
||||
import { rideArt } from "../src/web-console/public/activities/ghoul-ride-draw.js";
|
||||
import * as ghoul from "../src/web-console/public/activities/ghoul-rush/ghoul.js";
|
||||
import * as rt from "../src/web-console/public/activities/ghoul-rush/rides/dark-ride/ghoul-ride.js";
|
||||
import { SCENES, END_P } from "../src/web-console/public/activities/ghoul-rush/rides/dark-ride/ghoul-ride-scenes.js";
|
||||
import { CAR_X, DUCK_OFF, DUCK_ON, bindG } from "../src/web-console/public/activities/ghoul-rush/rides/dark-ride/ghoul-ride-core.js";
|
||||
import { EVENT_VOICE, LOSE_SOUNDS, LOSE_WORDS, LOOKS as RIDE_LOOKS, VOICES as RIDE_VOICES } from "../src/web-console/public/activities/ghoul-rush/rides/dark-ride/ghoul-ride-voices.js";
|
||||
import { CARNIVAL_ROOMS } from "../src/web-console/public/activities/ghoul-rush/stages/carnival/ghoul-carnival.js";
|
||||
import * as ghoulSfx from "../src/web-console/public/activities/ghoul-rush/sfx/ghoul-sfx.js";
|
||||
import { LOOKS, VOICES } from "../src/web-console/public/activities/ghoul-rush/draw/ghoul-draw.js";
|
||||
import { endBonus } from "../src/web-console/public/activities/ghoul-rush/core/ghoul-bonus.js";
|
||||
import { rideArt } from "../src/web-console/public/activities/ghoul-rush/rides/dark-ride/ghoul-ride-draw.js";
|
||||
|
||||
const steady = () => 0.5;
|
||||
const events = (round, type) => round.events.filter((e) => e.type === type);
|
||||
@@ -249,7 +249,7 @@ test("Ghoul Rush ride: under the endless-lives code a hit costs nothing", () =>
|
||||
|
||||
/* ---------------------------------------------------------------- dice */
|
||||
|
||||
test("Ghoul Rush ride: the dice rule is 5 to 9 by performance, a perfect ride is 9, and the bonus adds them under the cap of 9", () => {
|
||||
test("Ghoul Rush ride: the dice rule is 5 to 9 by performance, a perfect ride is 9, and the bonus adds them with no cap on the dice in hand", () => {
|
||||
const base = { shots: 100, hits: 100, kills: 50, missed: 0, hp: 5, ducksOK: 4, best: 20, innoHits: 0 };
|
||||
assert.equal(rt.gradeOf(base).dice, 9);
|
||||
assert.equal(rt.gradeOf(base).grade, "S");
|
||||
@@ -264,15 +264,15 @@ test("Ghoul Rush ride: the dice rule is 5 to 9 by performance, a perfect ride is
|
||||
assert.ok(rt.gradeOf({ ...base, hp: 1 }).dice <= rt.gradeOf({ ...base, hp: 5 }).dice);
|
||||
// A guest shot costs.
|
||||
assert.ok(rt.gradeOf({ ...base, innoHits: 10 }).perf < rt.gradeOf(base).perf);
|
||||
// The bonus uses the ride's own number and caps the dice in hand at 9.
|
||||
// The bonus uses the ride's own number and adds them all to the dice in hand.
|
||||
const round = playing();
|
||||
round.dice = 6;
|
||||
round.bonusRound.perf.dice = 8;
|
||||
round.bonusRound.perf.cardMs = 7000;
|
||||
endBonus(round, true, { award: (r, p) => (r.score += p), ROOM_POINTS: 100 });
|
||||
assert.equal(round.bonusRound.dice, 8);
|
||||
assert.equal(round.bonusRound.gained, 3, "6 + 8 caps at 9");
|
||||
assert.equal(round.dice, 9);
|
||||
assert.equal(round.bonusRound.gained, 8, "6 + 8 is 14");
|
||||
assert.equal(round.dice, 14);
|
||||
assert.equal(round.bonusRound.cardMs, 7000);
|
||||
});
|
||||
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
// Web console tests, Ghoul Rush's Blackmoor Sanatorium stage: its four rooms, orderlies that grab and throw you (and cost no life), gurneys that park, rattle and roll, flickers you can only hit and be hurt by when the lamps go out, specimen bloaters and their formaldehyde, the lamps' flicker, Smelling Salts and the Bone Saw (found only here), and the Night Matron, whose lantern cone builds heat, is stopped by the medicine cabinets and cannot reach the boards, with her syringes, arms and rage.
|
||||
import { test } from "node:test";
|
||||
import assert from "node:assert/strict";
|
||||
import * as ghoul from "../src/web-console/public/activities/ghoul.js";
|
||||
import * as sn from "../src/web-console/public/activities/ghoul-sanatorium.js";
|
||||
import { LOSE_SOUNDS, LOSE_WORDS } from "../src/web-console/public/activities/ghoul-sanatorium-draw.js";
|
||||
import { PILL_WORDS, pickPower } from "../src/web-console/public/activities/ghoul-powers.js";
|
||||
import * as ghoulSfx from "../src/web-console/public/activities/ghoul-sfx.js";
|
||||
import { VOICES, react } from "../src/web-console/public/activities/ghoul-draw.js";
|
||||
import * as ghoul from "../src/web-console/public/activities/ghoul-rush/ghoul.js";
|
||||
import * as sn from "../src/web-console/public/activities/ghoul-rush/stages/sanatorium/ghoul-sanatorium.js";
|
||||
import { LOSE_SOUNDS, LOSE_WORDS } from "../src/web-console/public/activities/ghoul-rush/stages/sanatorium/ghoul-sanatorium-draw.js";
|
||||
import { PILL_WORDS, pickPower } from "../src/web-console/public/activities/ghoul-rush/core/ghoul-powers.js";
|
||||
import * as ghoulSfx from "../src/web-console/public/activities/ghoul-rush/sfx/ghoul-sfx.js";
|
||||
import { VOICES, react } from "../src/web-console/public/activities/ghoul-rush/draw/ghoul-draw.js";
|
||||
|
||||
const steady = () => 0.5;
|
||||
const events = (round, type) => round.events.filter((e) => e.type === type);
|
||||
|
||||
@@ -2,14 +2,14 @@
|
||||
// Run with: node --test scripts/test-web-console-activities-ghoul-sled.mjs
|
||||
import { test } from "node:test";
|
||||
import assert from "node:assert/strict";
|
||||
import * as ghoul from "../src/web-console/public/activities/ghoul.js";
|
||||
import * as ghoul from "../src/web-console/public/activities/ghoul-rush/ghoul.js";
|
||||
import { skipBossIntro } from "./ghoul-test-helpers.mjs";
|
||||
import * as sl from "../src/web-console/public/activities/ghoul-sled.js";
|
||||
import * as ct from "../src/web-console/public/activities/ghoul-cart.js";
|
||||
import { EVENT_VOICE, LOSE_SOUNDS, LOSE_WORDS, LOOKS as SLED_LOOKS, VOICES as SLED_VOICES, telegraphMarks, telegraphs } from "../src/web-console/public/activities/ghoul-sled-draw.js";
|
||||
import * as ghoulSfx from "../src/web-console/public/activities/ghoul-sfx.js";
|
||||
import { LOOKS, VOICES, bonusTick, react } from "../src/web-console/public/activities/ghoul-draw.js";
|
||||
import { BONUS_FLOOR, diceFor, endBonus, makeBonus } from "../src/web-console/public/activities/ghoul-bonus.js";
|
||||
import * as sl from "../src/web-console/public/activities/ghoul-rush/rides/sled/ghoul-sled.js";
|
||||
import * as ct from "../src/web-console/public/activities/ghoul-rush/rides/cart/ghoul-cart.js";
|
||||
import { EVENT_VOICE, LOSE_SOUNDS, LOSE_WORDS, LOOKS as SLED_LOOKS, VOICES as SLED_VOICES, telegraphMarks, telegraphs } from "../src/web-console/public/activities/ghoul-rush/rides/sled/ghoul-sled-draw.js";
|
||||
import * as ghoulSfx from "../src/web-console/public/activities/ghoul-rush/sfx/ghoul-sfx.js";
|
||||
import { LOOKS, VOICES, bonusTick, react } from "../src/web-console/public/activities/ghoul-rush/draw/ghoul-draw.js";
|
||||
import { BONUS_FLOOR, diceFor, endBonus, makeBonus } from "../src/web-console/public/activities/ghoul-rush/core/ghoul-bonus.js";
|
||||
|
||||
const steady = () => 0.5;
|
||||
// The pack draws no random number: a run on this fails on the first draw.
|
||||
@@ -594,7 +594,7 @@ test("Ghoul Rush's Coffin Sled: off the lip the sled launches, lands on the snow
|
||||
assert.equal(end.length, 1);
|
||||
assert.equal(end[0].won, true);
|
||||
assert.ok(end[0].dice >= BONUS_FLOOR && end[0].dice <= ghoul.MAX_DICE, `${end[0].dice} dice`);
|
||||
assert.equal(round.dice, Math.min(ghoul.MAX_DICE, 1 + end[0].dice));
|
||||
assert.equal(round.dice, 1 + end[0].dice);
|
||||
assert.equal(round.lives, 3);
|
||||
run(round, ghoul.CARD_MS + 100);
|
||||
assert.equal(round.spec.id, "widow");
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
// Web console tests, Ghoul Rush's intro story: 6 to 8 pages that fit the field, never name the hero, stay generic about stages (no names, no counts) and speak to YOU; a run opens on it and ends in The Long Hall; the lockout, the typing that finishes first, every key and a click, the skip by holding fire, a pause that holds it; never in the practice stage select, on a respawn or in a new room; every page draws on a fake canvas at many moments; every sound it asks for exists.
|
||||
import { test } from "node:test";
|
||||
import assert from "node:assert/strict";
|
||||
import * as ghoul from "../src/web-console/public/activities/ghoul.js";
|
||||
import ghoulSfx from "../src/web-console/public/activities/ghoul-sfx.js";
|
||||
import { INTROS } from "../src/web-console/public/activities/ghoul-intros.js";
|
||||
import * as ghoul from "../src/web-console/public/activities/ghoul-rush/ghoul.js";
|
||||
import ghoulSfx from "../src/web-console/public/activities/ghoul-rush/sfx/ghoul-sfx.js";
|
||||
import { INTROS } from "../src/web-console/public/activities/ghoul-rush/story/ghoul-intros.js";
|
||||
import {
|
||||
CHAR_MS,
|
||||
FINALE_TITLE,
|
||||
@@ -28,8 +28,8 @@ import {
|
||||
stepStory,
|
||||
takeStory,
|
||||
typed,
|
||||
} from "../src/web-console/public/activities/ghoul-story.js";
|
||||
import { SCENE_H, TEXT_SIZE } from "../src/web-console/public/activities/ghoul-story-draw.js";
|
||||
} from "../src/web-console/public/activities/ghoul-rush/story/ghoul-story.js";
|
||||
import { SCENE_H, TEXT_SIZE } from "../src/web-console/public/activities/ghoul-rush/story/ghoul-story-draw.js";
|
||||
import { toneNames } from "../src/web-console/public/tones.js";
|
||||
|
||||
const steady = () => 0.5;
|
||||
|
||||
@@ -2,15 +2,15 @@
|
||||
// Run with: node --test scripts/test-web-console-activities-ghoul-tray.mjs
|
||||
import { test } from "node:test";
|
||||
import assert from "node:assert/strict";
|
||||
import * as ghoul from "../src/web-console/public/activities/ghoul.js";
|
||||
import * as ghoul from "../src/web-console/public/activities/ghoul-rush/ghoul.js";
|
||||
import { skipBossIntro } from "./ghoul-test-helpers.mjs";
|
||||
import * as tr from "../src/web-console/public/activities/ghoul-tray.js";
|
||||
import * as ct from "../src/web-console/public/activities/ghoul-cart.js";
|
||||
import * as sl from "../src/web-console/public/activities/ghoul-sled.js";
|
||||
import { EVENT_VOICE, LOSE_SOUNDS, LOSE_WORDS, LOOKS as TRAY_LOOKS, VOICES as TRAY_VOICES, telegraphMarks, telegraphs } from "../src/web-console/public/activities/ghoul-tray-draw.js";
|
||||
import * as ghoulSfx from "../src/web-console/public/activities/ghoul-sfx.js";
|
||||
import { LOOKS, VOICES, bonusTick, react } from "../src/web-console/public/activities/ghoul-draw.js";
|
||||
import { BONUS_FLOOR, diceFor, endBonus, makeBonus } from "../src/web-console/public/activities/ghoul-bonus.js";
|
||||
import * as tr from "../src/web-console/public/activities/ghoul-rush/rides/tray/ghoul-tray.js";
|
||||
import * as ct from "../src/web-console/public/activities/ghoul-rush/rides/cart/ghoul-cart.js";
|
||||
import * as sl from "../src/web-console/public/activities/ghoul-rush/rides/sled/ghoul-sled.js";
|
||||
import { EVENT_VOICE, LOSE_SOUNDS, LOSE_WORDS, LOOKS as TRAY_LOOKS, VOICES as TRAY_VOICES, telegraphMarks, telegraphs } from "../src/web-console/public/activities/ghoul-rush/rides/tray/ghoul-tray-draw.js";
|
||||
import * as ghoulSfx from "../src/web-console/public/activities/ghoul-rush/sfx/ghoul-sfx.js";
|
||||
import { LOOKS, VOICES, bonusTick, react } from "../src/web-console/public/activities/ghoul-rush/draw/ghoul-draw.js";
|
||||
import { BONUS_FLOOR, diceFor, endBonus, makeBonus } from "../src/web-console/public/activities/ghoul-rush/core/ghoul-bonus.js";
|
||||
|
||||
const steady = () => 0.5;
|
||||
// The pack draws no random number: a run on this fails on the first draw.
|
||||
@@ -554,7 +554,7 @@ test("Ghoul Rush's Servants' Back Stairs: off the lip the tray launches, lands o
|
||||
assert.equal(end.length, 1);
|
||||
assert.equal(end[0].won, true);
|
||||
assert.ok(end[0].dice >= BONUS_FLOOR && end[0].dice <= ghoul.MAX_DICE, `${end[0].dice} dice`);
|
||||
assert.equal(round.dice, Math.min(ghoul.MAX_DICE, 1 + end[0].dice));
|
||||
assert.equal(round.dice, 1 + end[0].dice);
|
||||
assert.equal(round.lives, 3);
|
||||
run(round, ghoul.CARD_MS + 100);
|
||||
assert.equal(round.spec.id, "crypt");
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
// Web console tests, Ghoul Rush's Hollow End Village stage: its four rooms, the moonrise (a moon that climbs over each room and, at full, turns the villagers into wolf-men and makes the moonhounds grow), torch mob villagers that lob fire, hanged men that drop on their ropes, shutter ghouls that can be hit only while out, moonhounds, Wolfsbane (found only here), and the Beast of Hollow End, which clings to the wall for double damage, pounces under a shadow, swipes, howls for hounds and rages at half its hp.
|
||||
import { test } from "node:test";
|
||||
import assert from "node:assert/strict";
|
||||
import * as ghoul from "../src/web-console/public/activities/ghoul.js";
|
||||
import * as vl from "../src/web-console/public/activities/ghoul-village.js";
|
||||
import { EVENT_VOICE, LOSE_SOUNDS, LOSE_WORDS } from "../src/web-console/public/activities/ghoul-village-draw.js";
|
||||
import { PILL_WORDS, pickPower } from "../src/web-console/public/activities/ghoul-powers.js";
|
||||
import * as ghoulSfx from "../src/web-console/public/activities/ghoul-sfx.js";
|
||||
import { LOOKS, VOICES, react } from "../src/web-console/public/activities/ghoul-draw.js";
|
||||
import * as ghoul from "../src/web-console/public/activities/ghoul-rush/ghoul.js";
|
||||
import * as vl from "../src/web-console/public/activities/ghoul-rush/stages/village/ghoul-village.js";
|
||||
import { EVENT_VOICE, LOSE_SOUNDS, LOSE_WORDS } from "../src/web-console/public/activities/ghoul-rush/stages/village/ghoul-village-draw.js";
|
||||
import { PILL_WORDS, pickPower } from "../src/web-console/public/activities/ghoul-rush/core/ghoul-powers.js";
|
||||
import * as ghoulSfx from "../src/web-console/public/activities/ghoul-rush/sfx/ghoul-sfx.js";
|
||||
import { LOOKS, VOICES, react } from "../src/web-console/public/activities/ghoul-rush/draw/ghoul-draw.js";
|
||||
|
||||
const steady = () => 0.5;
|
||||
// The pack draws no random number: a run on this fails on the first draw.
|
||||
|
||||
@@ -2,13 +2,13 @@
|
||||
// Run with: node --test scripts/test-web-console-activities-ghoul-wagon.mjs
|
||||
import { test } from "node:test";
|
||||
import assert from "node:assert/strict";
|
||||
import * as ghoul from "../src/web-console/public/activities/ghoul.js";
|
||||
import * as wg from "../src/web-console/public/activities/ghoul-wagon.js";
|
||||
import * as ct from "../src/web-console/public/activities/ghoul-cart.js";
|
||||
import { ANSWERS, EVENT_VOICE, LOSE_SOUNDS, LOSE_WORDS, LOOKS as WAGON_LOOKS, VOICES as WAGON_VOICES, telegraphMarks, telegraphs } from "../src/web-console/public/activities/ghoul-wagon-draw.js";
|
||||
import * as ghoulSfx from "../src/web-console/public/activities/ghoul-sfx.js";
|
||||
import { LOOKS, VOICES, bonusTick, react } from "../src/web-console/public/activities/ghoul-draw.js";
|
||||
import { BONUS_FLOOR, diceFor, endBonus, makeBonus } from "../src/web-console/public/activities/ghoul-bonus.js";
|
||||
import * as ghoul from "../src/web-console/public/activities/ghoul-rush/ghoul.js";
|
||||
import * as wg from "../src/web-console/public/activities/ghoul-rush/rides/wagon/ghoul-wagon.js";
|
||||
import * as ct from "../src/web-console/public/activities/ghoul-rush/rides/cart/ghoul-cart.js";
|
||||
import { ANSWERS, EVENT_VOICE, LOSE_SOUNDS, LOSE_WORDS, LOOKS as WAGON_LOOKS, VOICES as WAGON_VOICES, telegraphMarks, telegraphs } from "../src/web-console/public/activities/ghoul-rush/rides/wagon/ghoul-wagon-draw.js";
|
||||
import * as ghoulSfx from "../src/web-console/public/activities/ghoul-rush/sfx/ghoul-sfx.js";
|
||||
import { LOOKS, VOICES, bonusTick, react } from "../src/web-console/public/activities/ghoul-rush/draw/ghoul-draw.js";
|
||||
import { BONUS_FLOOR, diceFor, endBonus, makeBonus } from "../src/web-console/public/activities/ghoul-rush/core/ghoul-bonus.js";
|
||||
|
||||
const steady = () => 0.5;
|
||||
// The pack draws no random number: a run on this fails on the first draw.
|
||||
@@ -770,7 +770,7 @@ test("Ghoul Rush's Torch Mob: off the lip the wagon launches, lands on the green
|
||||
assert.equal(end.length, 1);
|
||||
assert.equal(end[0].won, true);
|
||||
assert.ok(end[0].dice >= BONUS_FLOOR && end[0].dice <= ghoul.MAX_DICE, `${end[0].dice} dice`);
|
||||
assert.equal(round.dice, Math.min(ghoul.MAX_DICE, 1 + end[0].dice));
|
||||
assert.equal(round.dice, 1 + end[0].dice);
|
||||
assert.equal(round.lives, 3);
|
||||
run(round, ghoul.CARD_MS + 100);
|
||||
assert.equal(round.spec.id, "green");
|
||||
|
||||
@@ -10,12 +10,12 @@ import assert from "node:assert/strict";
|
||||
import fs from "node:fs";
|
||||
import path from "node:path";
|
||||
import { fileURLToPath } from "node:url";
|
||||
import * as ghoul from "../src/web-console/public/activities/ghoul.js";
|
||||
import { skipStory as storySkip } from "../src/web-console/public/activities/ghoul-story.js";
|
||||
import { BANNER_SHADE, CHUNK, GAUGE_COOL, GAUGE_HOT, GAUGE_WARM, LOOKS, SEAM, VOICES, contrast, gaugeColor, hudLayout, labelSpot, limbInk } from "../src/web-console/public/activities/ghoul-draw.js";
|
||||
import * as ghoul from "../src/web-console/public/activities/ghoul-rush/ghoul.js";
|
||||
import { skipStory as storySkip } from "../src/web-console/public/activities/ghoul-rush/story/ghoul-story.js";
|
||||
import { BANNER_SHADE, CHUNK, GAUGE_COOL, GAUGE_HOT, GAUGE_WARM, LOOKS, SEAM, VOICES, contrast, gaugeColor, hudLayout, labelSpot, limbInk } from "../src/web-console/public/activities/ghoul-rush/draw/ghoul-draw.js";
|
||||
import { ACCENTS } from "../src/web-console/public/palette.js";
|
||||
import { humNames, toneNames } from "../src/web-console/public/tones.js";
|
||||
import ghoulSfx from "../src/web-console/public/activities/ghoul-sfx.js";
|
||||
import ghoulSfx from "../src/web-console/public/activities/ghoul-rush/sfx/ghoul-sfx.js";
|
||||
import { LIVES, LIVES_BACK, LIVES_INK, livesText } from "../src/web-console/public/activities/pills.js";
|
||||
|
||||
const ROOT = path.join(path.dirname(fileURLToPath(import.meta.url)), "..");
|
||||
@@ -189,7 +189,10 @@ function ghoulRound(id = "foyer", depth = 0) {
|
||||
const round = ghoul.newRound(5);
|
||||
round.dice = 0;
|
||||
for (let i = 0; i < depth; i++) round.cleared.push(`cleared${i}`);
|
||||
if (id !== "hall") {
|
||||
const listed = id === "hall" || ghoul.STAGES.some((s) => s.rooms.includes(id));
|
||||
// A room no stage lists (the retired Bog Runner) is set up directly; every other room is reached the way a run reaches it.
|
||||
if (!listed) ghoul.setupRoom(round, id);
|
||||
else if (id !== "hall") {
|
||||
const st = ghoul.STAGES.find((s) => s.rooms.includes(id));
|
||||
through(round);
|
||||
assert.equal(round.phase, "pick");
|
||||
@@ -421,7 +424,7 @@ test("Ghoul Rush: held fire shoots a bolt every FIRE_MS the way you face (RAPID_
|
||||
assert.equal(plain.shots, Math.ceil(1020 / ghoul.FIRE_MS), "a bolt every FIRE_MS");
|
||||
assert.ok(plain.round.shots.every((s) => s.vx > 0), "facing right, they fly right");
|
||||
const rapid = count((r) => ghoul.applyPower(r, "rapid"));
|
||||
assert.equal(rapid.shots, Math.ceil(1020 / ghoul.RAPID_MS), "twice as often with Rapid fire");
|
||||
assert.equal(rapid.shots, Math.ceil(1020 / ghoul.RAPID_MS), "about 1.65 times as often with Rapid fire");
|
||||
const left = count((r) => (r.you.face = -1));
|
||||
assert.ok(left.round.shots.every((s) => s.vx < 0), "facing left, they fly left");
|
||||
const round = ghoulRound();
|
||||
@@ -1031,7 +1034,7 @@ test("Ghoul Rush: a timed power-up taken while the same one runs adds its time t
|
||||
assert.equal(events(round, "expire").filter((e) => e.kind === "rapid").length, 1, "one run, one expiry");
|
||||
});
|
||||
|
||||
test("Ghoul Rush: Spread shot and Rapid fire run out after their time, the Garlic shield takes one hit and sees off what touched you, a 1UP is a life up to MAX_LIVES, and kills sometimes leave candy or a power-up", () => {
|
||||
test("Ghoul Rush: Spread shot and Rapid fire run out after their time, the Garlic shield takes one hit and sees off what touched you, a 1UP is a life with no limit, and kills sometimes leave candy or a power-up", () => {
|
||||
const round = ghoulRound();
|
||||
standAt(round, 30);
|
||||
ghoul.applyPower(round, "spread");
|
||||
@@ -1047,11 +1050,11 @@ test("Ghoul Rush: Spread shot and Rapid fire run out after their time, the Garli
|
||||
assert.ok(round.you.safeMs > 0);
|
||||
ghoul.applyPower(round, "life");
|
||||
assert.equal(round.lives, ghoul.START_LIVES + 1);
|
||||
round.lives = ghoul.MAX_LIVES;
|
||||
round.lives = 9;
|
||||
const score = round.score;
|
||||
ghoul.applyPower(round, "life");
|
||||
assert.equal(round.lives, ghoul.MAX_LIVES, "never past MAX_LIVES");
|
||||
assert.ok(round.score > score, "points instead");
|
||||
assert.equal(round.lives, 10, "no limit");
|
||||
assert.equal(round.score, score, "no points instead");
|
||||
// Placed power-ups are taken by touching them, and drops fall to the floor.
|
||||
const r2 = ghoulRound();
|
||||
const [kind, x, y] = r2.spec.items[0];
|
||||
@@ -1708,6 +1711,7 @@ test("Ghoul Rush: each stage is three rooms and a boss's, every room in one stag
|
||||
assert.equal(ghoul.ROOMS[0].boss, null);
|
||||
const placed = ghoul.STAGES.flatMap((st) => st.rooms);
|
||||
assert.equal(new Set(placed).size, placed.length, "no room in two stages");
|
||||
// Every room but the hall is in a stage; one in none is a room forgotten.
|
||||
assert.deepEqual([...placed].sort(), ghoul.ROOMS.slice(1).map((r) => r.id).sort(), "every room but the hall in a stage");
|
||||
for (const st of ghoul.STAGES) {
|
||||
// Four rooms; the Mine's Runaway Cart makes it five.
|
||||
@@ -1804,16 +1808,15 @@ test("Ghoul Rush: clearing every stage wins the run, and its end says so", () =>
|
||||
assert.equal(ghoul.advance(round, 16, steady), "over");
|
||||
});
|
||||
|
||||
test("Ghoul Rush: a boss always gives a life (up to MAX_LIVES, 9), and the 1UP turns up a little more often than before", () => {
|
||||
assert.equal(ghoul.MAX_LIVES, 9);
|
||||
test("Ghoul Rush: a boss always gives a life (no limit), and the 1UP turns up a little more often than before", () => {
|
||||
assert.equal(ghoul.POWERS.life.weight, 1.5);
|
||||
const round = bossFight("ballroom");
|
||||
const b = round.boss;
|
||||
round.lives = ghoul.MAX_LIVES - 1;
|
||||
round.lives = 9;
|
||||
b.hp = 1;
|
||||
round.shots.push({ x: b.x - b.w / 2 - 0.2, y: b.y + 2, vx: 80, vy: 0, gone: 0 });
|
||||
ghoul.advance(round, 4, steady);
|
||||
assert.equal(round.lives, ghoul.MAX_LIVES);
|
||||
assert.equal(round.lives, 10);
|
||||
assert.equal(events(round, "bossDown")[0].life, true);
|
||||
});
|
||||
|
||||
@@ -2141,6 +2144,11 @@ function makeBot(G, skill, random) {
|
||||
let venting = false;
|
||||
const missed = new Set();
|
||||
return (round) => {
|
||||
// "Use a Lucky Die?": the bot always says yes, once the guard is past.
|
||||
if (round.phase === "ask") {
|
||||
round.ask.t = G.ASK_GUARD_MS;
|
||||
G.answerDie(round, true);
|
||||
}
|
||||
const { you, input: inp, spec } = round;
|
||||
const dt = last < 0 ? 16 : Math.max(0, round.clock - last);
|
||||
last = round.clock;
|
||||
@@ -2436,8 +2444,9 @@ test("Ghoul Rush: of ten runs a sharp bot gets nearly all through the hall and t
|
||||
round.events.length = 0;
|
||||
}
|
||||
// The Garlic gift for a quick loss can carry a masher out of the hall; it
|
||||
// then waits on the stage pick, since it never picks, and goes no further.
|
||||
assert.ok((round.over || round.phase === "pick") && round.room <= 2, `a masher (seed ${seed}) is dead, or stuck on the pick, by the Gallery (room ${round.room}, ${round.phase})`);
|
||||
// then waits on the stage pick, since it never picks, and goes no further (nor does it
|
||||
// ever answer "Use a Lucky Die?", so it may be waiting there).
|
||||
assert.ok((round.over || round.phase === "pick" || round.phase === "ask") && round.room <= 2, `a masher (seed ${seed}) is dead, or stuck on the pick or the Lucky die question, by the Gallery (room ${round.room}, ${round.phase})`);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -2736,6 +2745,120 @@ test("Ghoul Rush game: every tone it plays is one tones.js has, its own blips am
|
||||
for (const name of ["ghoulBlast", "zombiePop", "ghoulCandy", "doorUnlock", "doorThrough", "hop"]) assert.ok(heard.has(name), `${name} played`);
|
||||
});
|
||||
|
||||
// A started game with the hall's dice in hand, ready to lose a life.
|
||||
function askGame(dice = 2) {
|
||||
const heard = [];
|
||||
const g = ghoul.default.create({ canvas: stubCanvas().canvas, tone: (name) => heard.push(name) });
|
||||
g.resize(900, 900);
|
||||
g.key("action");
|
||||
skipStory(g);
|
||||
const r = g.round;
|
||||
for (const st of r.spawns) st.over = true;
|
||||
r.monsters.length = 0;
|
||||
r.hordeMs = Infinity;
|
||||
r.phase = "play";
|
||||
r.lives = 3;
|
||||
r.dice = dice;
|
||||
standAt(r, 100);
|
||||
r.events.length = 0;
|
||||
return { g, r, heard };
|
||||
}
|
||||
|
||||
test("Ghoul Rush: a lost life with Lucky dice in hand asks \"Use a Lucky Die?\" first, and nothing rolls, spends or ticks until the player answers", () => {
|
||||
const { g, r } = askGame(2);
|
||||
assert.equal(ghoul.lose(r, "zombie"), true);
|
||||
assert.equal(r.phase, "ask");
|
||||
assert.equal(r.ask.cause, "zombie");
|
||||
assert.equal(r.ask.yes, true, "Yes is lit first");
|
||||
assert.equal(r.dice, 2, "asking spends nothing");
|
||||
assert.equal(r.lives, 3, "and costs nothing");
|
||||
assert.equal(r.events.filter((e) => e.type === "diceAsk").length, 1);
|
||||
const time = r.timeMs;
|
||||
// It waits as long as it likes: no roll, no loss, the clock held.
|
||||
for (let i = 0; i < 400; i++) g.tick(16);
|
||||
assert.equal(r.phase, "ask");
|
||||
assert.equal(r.timeMs, time, "the room's clock holds while asking");
|
||||
assert.equal(r.roll, null);
|
||||
assert.equal(r.lives, 3);
|
||||
});
|
||||
|
||||
test("Ghoul Rush: the Lucky die question ignores a press inside its guard and any key repeat, left and up light Yes, right and down No, and Yes spends one die and rolls", () => {
|
||||
const { g, r } = askGame(2);
|
||||
ghoul.lose(r, "zombie");
|
||||
// The key held or mashed as Planny died must not answer.
|
||||
g.key("action");
|
||||
assert.equal(r.phase, "ask", "inside the guard, a press does nothing");
|
||||
assert.equal(r.dice, 2);
|
||||
g.release("action");
|
||||
for (let t = 0; t < ghoul.ASK_GUARD_MS + 16; t += 16) g.tick(16);
|
||||
g.key("action", true);
|
||||
assert.equal(r.phase, "ask", "a held key repeating never answers");
|
||||
g.key("right");
|
||||
assert.equal(r.ask.yes, false);
|
||||
g.key("left");
|
||||
assert.equal(r.ask.yes, true);
|
||||
g.key("down");
|
||||
assert.equal(r.ask.yes, false);
|
||||
g.key("up");
|
||||
assert.equal(r.ask.yes, true);
|
||||
assert.equal(r.phase, "ask", "steering alone never answers");
|
||||
g.key("action");
|
||||
assert.equal(r.phase, "roll", "Yes starts the roll");
|
||||
assert.equal(r.dice, 1, "and spends one die");
|
||||
assert.equal(r.ask, null);
|
||||
assert.equal(r.events.filter((e) => e.type === "diceStart").length, 1);
|
||||
});
|
||||
|
||||
test("Ghoul Rush: answering No to the Lucky die question keeps every die and lets the loss go ahead", () => {
|
||||
const { g, r, heard } = askGame(2);
|
||||
ghoul.lose(r, "zombie");
|
||||
for (let t = 0; t < ghoul.ASK_GUARD_MS + 16; t += 16) g.tick(16);
|
||||
g.key("right");
|
||||
g.key("action");
|
||||
assert.equal(r.ask, null);
|
||||
assert.equal(r.dice, 2, "both dice are kept for later");
|
||||
assert.equal(r.lives, 2, "the life is lost");
|
||||
assert.equal(r.phase, "crash", "and the fall plays as without dice");
|
||||
assert.equal(r.roll, null, "no roll");
|
||||
assert.equal(r.events.filter((e) => e.type === "diceKeep").length, 1);
|
||||
assert.equal(r.events.filter((e) => e.type === "diceStart").length, 0);
|
||||
assert.ok(heard.length > 0);
|
||||
// A kept die is asked about again at the next loss.
|
||||
for (let t = 0; t < 4000 && r.phase !== "play"; t += 16) g.tick(16);
|
||||
r.you.safeMs = 0;
|
||||
ghoul.lose(r, "zombie");
|
||||
assert.equal(r.phase, "ask", "asked again");
|
||||
assert.equal(r.dice, 2);
|
||||
});
|
||||
|
||||
test("Ghoul Rush: a click on the Lucky die question lights its half (Yes left, No right), and a click on the lit half answers; endless lives and a bonus room never ask", () => {
|
||||
const { g, r } = askGame(1);
|
||||
ghoul.lose(r, "zombie");
|
||||
for (let t = 0; t < ghoul.ASK_GUARD_MS + 16; t += 16) g.tick(16);
|
||||
assert.equal(r.ask.yes, true);
|
||||
assert.equal(g.pointer("down", 850, 400), true);
|
||||
assert.equal(r.phase, "ask", "a click on the unlit half lights it");
|
||||
assert.equal(r.ask.yes, false);
|
||||
g.pointer("down", 850, 400);
|
||||
assert.equal(r.phase, "crash", "a click on the lit No answers it");
|
||||
assert.equal(r.dice, 1);
|
||||
const again = askGame(1);
|
||||
ghoul.lose(again.r, "zombie");
|
||||
for (let t = 0; t < ghoul.ASK_GUARD_MS + 16; t += 16) again.g.tick(16);
|
||||
assert.equal(again.r.ask.yes, true);
|
||||
again.g.pointer("down", 30, 400);
|
||||
assert.equal(again.r.phase, "roll", "a click on the lit Yes answers it");
|
||||
const endless = askGame(2);
|
||||
endless.r.infinite = true;
|
||||
ghoul.lose(endless.r, "zombie");
|
||||
assert.equal(endless.r.phase !== "ask" && endless.r.phase !== "roll", true, "endless lives never ask");
|
||||
const bonus = askGame(2);
|
||||
bonus.r.bonusRound = { hearts: 5, max: 5, dice: 0, over: false, won: false, perf: { total: 0, hits: [], acts: 0, goal: 0, steady: true } };
|
||||
ghoul.lose(bonus.r, "zombie");
|
||||
assert.notEqual(bonus.r.phase, "ask", "a bonus room's hearts are its own: no question");
|
||||
assert.equal(bonus.r.dice, 2);
|
||||
});
|
||||
|
||||
test("Ghoul Rush game: its own sounds keep its prefix, and a run holds a monster's hum (and no drone under the music), steps on the boards, and tolls at the end", () => {
|
||||
for (const name of [...Object.keys(ghoulSfx.tones), ...Object.keys(ghoulSfx.hums)]) assert.match(name, /^ghoul/, `${name} keeps to this game's prefix`);
|
||||
const known = new Set(toneNames());
|
||||
@@ -2934,7 +3057,7 @@ test("Ghoul Rush: the top bar names the stage (or the hall) and counts the stage
|
||||
const box = (p, h) => [p.x, p.y, p.x + p.w, p.y + h];
|
||||
for (const h of [Math.max(12 / ghoul.MIN_CELL, 2.4), 2.4]) {
|
||||
const hud = { room: "THE GRAND OPERA HOUSE", stage: "STAGE 20 OF 21", time: 80, timeLow: false, bonus: ghoul.BONUS_START, chain: ghoul.MAX_MULT, chainFill: 0.5, key: true, effects: ["SPREAD", "RAPID", "GARLIC"].map((text) => ({ text, color: "#ffffff", fill: 0.5 })), gauge: { fill: 0.5, free: 0.6, rapid: null } };
|
||||
const laid = hudLayout(h, ghoul.W, ghoul.MAX_LIVES, hud, ghoul.HUD_H);
|
||||
const laid = hudLayout(h, ghoul.W, 9, hud, ghoul.HUD_H);
|
||||
assert.ok(laid.every((p) => p.h >= h * 0.6), "shrunk no more than it must");
|
||||
const placed = laid.map((p) => box(p, p.h));
|
||||
// A pill 2.4 units tall is every board but the smallest: one row, in the strip.
|
||||
@@ -3128,7 +3251,9 @@ test("Ghoul Rush game: every room and boss draws, and each pick of stage, throug
|
||||
g.resize(900, 900);
|
||||
g.key("action");
|
||||
skipStory(g);
|
||||
for (let n = 1; n <= ghoul.ROOMS.length; n++) {
|
||||
// Every room a run can reach: the hall and each stage's, not the retired Bog Runner.
|
||||
const LIVE = 1 + ghoul.STAGES.flatMap((st) => st.rooms).length;
|
||||
for (let n = 1; n <= LIVE; n++) {
|
||||
const r = g.round;
|
||||
r.lives = 99;
|
||||
const bot = makeBot(ghoul, 1, ghoul.seeded(n));
|
||||
@@ -3149,6 +3274,10 @@ test("Ghoul Rush game: every room and boss draws, and each pick of stage, throug
|
||||
r.monsters.length = 0;
|
||||
standAt(r, r.spec.door);
|
||||
}
|
||||
if (r.phase === "ask") {
|
||||
r.ask.t = ghoul.ASK_GUARD_MS;
|
||||
ghoul.answerDie(r, true);
|
||||
}
|
||||
if (r.phase === "pick") {
|
||||
const before = calls.count;
|
||||
g.tick(16);
|
||||
@@ -3158,7 +3287,7 @@ test("Ghoul Rush game: every room and boss draws, and each pick of stage, throug
|
||||
}
|
||||
g.tick(16);
|
||||
}
|
||||
if (n === ghoul.ROOMS.length) break;
|
||||
if (n === LIVE) break;
|
||||
leaveIntro(g);
|
||||
for (let ms = 0; ms < ghoul.READY_MS + 100; ms += 16) g.tick(16);
|
||||
assert.equal(g.round.room, n + 1);
|
||||
|
||||
@@ -28,7 +28,7 @@ import * as hop from "../src/web-console/public/activities/hop.js";
|
||||
import { hudLayout as hopHudLayout, labelSpot as hopLabelSpot, LANES as HOP_LANES, limbInk as hopLimbInk, contrast as hopContrast } from "../src/web-console/public/activities/hop-draw.js";
|
||||
import * as bounce from "../src/web-console/public/activities/bounce.js";
|
||||
import * as rapids from "../src/web-console/public/activities/rapids.js";
|
||||
import * as ghoul from "../src/web-console/public/activities/ghoul.js";
|
||||
import * as ghoul from "../src/web-console/public/activities/ghoul-rush/ghoul.js";
|
||||
import { ACCENTS } from "../src/web-console/public/palette.js";
|
||||
import { LIVES, LIVES_BACK, LIVES_INK, livesText, pillContrast } from "../src/web-console/public/activities/pills.js";
|
||||
|
||||
@@ -277,7 +277,7 @@ test("the list names Snake, Mini golf, Light Trails, Bug Hunt, Sunset Drive, Sta
|
||||
assert.equal(ACTIVITIES[11].title, "Ghoul Rush");
|
||||
for (const a of ACTIVITIES) {
|
||||
assert.ok(Object.isFrozen(a), `${a.id} is frozen`);
|
||||
assert.equal(a.module, `/activities/${a.id}.js`);
|
||||
assert.equal(a.module, a.id === "ghoul" ? "/activities/ghoul-rush/ghoul.js" : `/activities/${a.id}.js`);
|
||||
assert.equal(typeof a.title, "string");
|
||||
assert.ok(typeof a.blurb === "string" && a.blurb.length > 10, `${a.id} has a line for its picker card`);
|
||||
}
|
||||
|
||||
@@ -22,7 +22,7 @@ import fs from "node:fs";
|
||||
import path from "node:path";
|
||||
import test from "node:test";
|
||||
import assert from "node:assert/strict";
|
||||
import { pageSuite, openSession, drawn, itemCard , boxValue} from "./page-test-helpers.mjs";
|
||||
import { pageSuite, openSession, drawn, itemCard, boxValue, fillBox } from "./page-test-helpers.mjs";
|
||||
import { until, HOME } from "./web-console-test-helpers.mjs";
|
||||
|
||||
const suite = pageSuite(test);
|
||||
@@ -861,7 +861,7 @@ test("the stage code typed on Ghoul Rush's board opens its stage select, the arr
|
||||
await s.page.evaluate(async () => {
|
||||
const m = await import("/screens/activities.js");
|
||||
const { ACTIVITIES } = await import("/activities.js");
|
||||
const ghoul = (await import("/activities/ghoul.js")).default;
|
||||
const ghoul = (await import("/activities/ghoul-rush/ghoul.js")).default;
|
||||
const watched = { ...ghoul, create: (opts) => (window.__ghoul = ghoul.create(opts)) };
|
||||
m.setActivityList(ACTIVITIES.map((e) => (e.id === "ghoul" ? { ...e, game: watched } : e)));
|
||||
});
|
||||
@@ -897,7 +897,7 @@ test("Ghoul Rush's secondary weapon, with real keys in the window: a double tap
|
||||
await s.page.evaluate(async () => {
|
||||
const m = await import("/screens/activities.js");
|
||||
const { ACTIVITIES } = await import("/activities.js");
|
||||
const ghoul = (await import("/activities/ghoul.js")).default;
|
||||
const ghoul = (await import("/activities/ghoul-rush/ghoul.js")).default;
|
||||
const watched = { ...ghoul, create: (opts) => (window.__ghoul = ghoul.create(opts)) };
|
||||
m.setActivityList(ACTIVITIES.map((e) => (e.id === "ghoul" ? { ...e, game: watched } : e)));
|
||||
});
|
||||
@@ -2365,7 +2365,7 @@ test("Ghoul Rush plays in the real window: its board's shape and Planny big enou
|
||||
await s.page.evaluate(async () => {
|
||||
const m = await import("/screens/activities.js");
|
||||
const { ACTIVITIES } = await import("/activities.js");
|
||||
const ghoul = (await import("/activities/ghoul.js")).default;
|
||||
const ghoul = (await import("/activities/ghoul-rush/ghoul.js")).default;
|
||||
window.__calm = true;
|
||||
const watched = {
|
||||
...ghoul,
|
||||
@@ -2389,7 +2389,7 @@ test("Ghoul Rush plays in the real window: its board's shape and Planny big enou
|
||||
await openActivities(s, "ghoul");
|
||||
assert.equal(await overlay(s), "Press space or click to start");
|
||||
const { W, H, YOU_H } = await s.page.evaluate(async () => {
|
||||
const { W, H, YOU_H } = await import("/activities/ghoul.js");
|
||||
const { W, H, YOU_H } = await import("/activities/ghoul-rush/ghoul.js");
|
||||
return { W, H, YOU_H };
|
||||
});
|
||||
const box = await s.page.locator("#activities-canvas").boundingBox();
|
||||
@@ -2477,7 +2477,7 @@ test("Ghoul Rush plays in the real window: its board's shape and Planny big enou
|
||||
// one stage cleared), and lose the last life.
|
||||
const outOf = (last) =>
|
||||
s.page.evaluate(async (last) => {
|
||||
const { groundAt, stageById } = await import("/activities/ghoul.js");
|
||||
const { groundAt, stageById } = await import("/activities/ghoul-rush/ghoul.js");
|
||||
const r = window.__ghoul.round;
|
||||
if (last) r.stageAt = stageById(r.stage).rooms.length - 1;
|
||||
r.hasKey = true;
|
||||
@@ -2494,7 +2494,7 @@ test("Ghoul Rush plays in the real window: its board's shape and Planny big enou
|
||||
await outOf(true);
|
||||
await until(async () => (await you()).phase === "pick" || (await step(s, 10, 50), false), 5000);
|
||||
await s.page.evaluate(async () => {
|
||||
const { lose } = await import("/activities/ghoul.js");
|
||||
const { lose } = await import("/activities/ghoul-rush/ghoul.js");
|
||||
window.__calm = false;
|
||||
const r = window.__ghoul.round;
|
||||
r.lives = 1;
|
||||
@@ -2515,7 +2515,7 @@ test("Ghoul Rush plays in the real window: its board's shape and Planny big enou
|
||||
test("the server serves the activities' scripts, golf's seventeen, Light Trails, Bug Hunt, Sunset Drive, Stack Deploy, Bumper Ring's two, Rapids Run's two, Hot Potato's two, Crossing Rush's two, Bounce Road's seven, Ghoul Rush's eighty-three, every game's sound effects and the shared pills included", () => {
|
||||
const server = fs.readFileSync(new URL("../src/web-console/static.mjs", import.meta.url), "utf8");
|
||||
const servable = server.slice(server.indexOf("const SERVABLE = new Set(["), server.indexOf("]);", server.indexOf("const SERVABLE = new Set([")));
|
||||
for (const file of ["activities.js", "tones.js", "music.js", "activities/snake.js", "screens/activities.js", "activities/golf.js", "activities/golf-holes.js", "activities/golf-draw.js", "activities/golf-decor.js", "activities/golf-kit.js", "activities/golf-paint.js", "activities/golf-looks.js", "activities/golf-course-pirate.js", "activities/golf-course-cave.js", "activities/golf-course-dino.js", "activities/golf-course-candy.js", "activities/golf-course-space.js", "activities/golf-course-frost.js", "activities/golf-look-dino.js", "activities/golf-look-candy.js", "activities/golf-look-space.js", "activities/golf-look-frost.js", "activities/trails.js", "activities/bugs.js", "activities/drive.js", "activities/stack.js", "activities/bumper.js", "activities/bumper-draw.js", "activities/rapids.js", "activities/rapids-draw.js", "activities/fuse.js", "activities/fuse-draw.js", "activities/hop.js", "activities/hop-draw.js", "activities/bounce.js", "activities/bounce-draw.js", "activities/bounce-roads.js", "activities/bounce-road.js", "activities/bounce-rivals.js", "activities/bounce-scenery.js", "activities/bounce-cars.js", "activities/ghoul.js", "activities/ghoul-draw.js", "activities/ghoul-rooms.js", "activities/ghoul-bones.js", "activities/ghoul-bones-draw.js", "activities/ghoul-graveyard.js", "activities/ghoul-graveyard-draw.js", "activities/ghoul-grounds.js", "activities/ghoul-grounds-draw.js", "activities/ghoul-chapel.js", "activities/ghoul-chapel-draw.js", "activities/ghoul-sanatorium.js", "activities/ghoul-sanatorium-draw.js", "activities/ghoul-village.js", "activities/ghoul-village-draw.js", "activities/ghoul-village-world.js", "activities/ghoul-village-wolf.js", "activities/ghoul-mine.js", "activities/ghoul-mine-draw.js", "activities/ghoul-mine-world.js", "activities/ghoul-mine-tommy.js", "activities/ghoul-cart.js", "activities/ghoul-cart-draw.js", "activities/ghoul-sled.js", "activities/ghoul-sled-draw.js", "activities/ghoul-gurney.js", "activities/ghoul-gurney-draw.js", "activities/ghoul-banister.js", "activities/ghoul-banister-draw.js", "activities/ghoul-sfx-banister.js", "activities/ghoul-hearse.js", "activities/ghoul-hearse-draw.js", "activities/ghoul-wagon.js", "activities/ghoul-wagon-draw.js", "activities/ghoul-pew.js", "activities/ghoul-pew-draw.js", "activities/ghoul-pew-course.js", "activities/ghoul-pew-world.js", "activities/ghoul-mower.js", "activities/ghoul-mower-draw.js", "activities/ghoul-tray.js", "activities/ghoul-tray-draw.js", "activities/ghoul-carnival.js", "activities/ghoul-carnival-draw.js", "activities/ghoul-carnival-world.js", "activities/ghoul-frozen.js", "activities/ghoul-frozen-draw.js", "activities/ghoul-frozen-world.js", "activities/ghoul-flare.js", "activities/ghoul-bog.js", "activities/ghoul-bog-draw.js", "activities/ghoul-bogboat.js", "activities/ghoul-bogboat-draw.js", "activities/ghoul-picker-draw.js", "activities/ghoul-powers.js", "activities/ghoul-arms.js", "activities/ghoul-arms-draw.js", "activities/ghoul-rockets.js", "activities/ghoul-rockets-draw.js", "activities/ghoul-pans.js", "activities/ghoul-sfx-arms.js", "activities/ghoul-run.js", "activities/ghoul-dice.js", "activities/ghoul-dice-draw.js", "activities/ghoul-gameover-draw.js", "activities/ghoul-intros.js", "activities/ghoul-intro-draw.js", "activities/ghoul-boss-intros.js", "activities/ghoul-bossintro-draw.js", "activities/ghoul-story.js", "activities/ghoul-story-draw.js", "activities/ghoul-sfx-story.js", "activities/ghoul-bonus.js", "activities/ghoul-bonus-draw.js", "activities/ghoul-monsters-draw.js", "activities/pills.js", "activities/snake-sfx.js", "activities/golf-sfx.js", "activities/trails-sfx.js", "activities/bugs-sfx.js", "activities/drive-sfx.js", "activities/stack-sfx.js", "activities/bumper-sfx.js", "activities/rapids-sfx.js", "activities/fuse-sfx.js", "activities/hop-sfx.js", "activities/bounce-sfx.js", "activities/ghoul-sfx.js", "activities/ghoul-sfx-graveyard.js", "activities/ghoul-sfx-grounds.js", "activities/ghoul-sfx-chapel.js", "activities/ghoul-sfx-sanatorium.js", "activities/ghoul-sfx-village.js", "activities/ghoul-sfx-mine.js", "activities/ghoul-sfx-carnival.js", "activities/ghoul-sfx-frozen.js", "activities/ghoul-sfx-sled.js", "activities/ghoul-sfx-gurney.js", "activities/ghoul-sfx-hearse.js", "activities/ghoul-sfx-bog.js", "activities/ghoul-sfx-bogboat.js", "activities/ghoul-sfx-wagon.js", "activities/ghoul-sfx-pew.js", "activities/ghoul-sfx-mower.js", "activities/ghoul-sfx-tray.js", "activities/ghoul-ride-core.js", "activities/ghoul-ride-scenes.js", "activities/ghoul-ride.js", "activities/ghoul-ride-gfx.js", "activities/ghoul-ride-draw-kinds.js", "activities/ghoul-ride-draw-sets.js", "activities/ghoul-ride-draw-hud.js", "activities/ghoul-ride-draw.js", "activities/ghoul-ride-voices.js", "activities/ghoul-sfx-ride.js"]) {
|
||||
for (const file of ["activities.js", "tones.js", "music.js", "activities/snake.js", "screens/activities.js", "activities/golf.js", "activities/golf-holes.js", "activities/golf-draw.js", "activities/golf-decor.js", "activities/golf-kit.js", "activities/golf-paint.js", "activities/golf-looks.js", "activities/golf-course-pirate.js", "activities/golf-course-cave.js", "activities/golf-course-dino.js", "activities/golf-course-candy.js", "activities/golf-course-space.js", "activities/golf-course-frost.js", "activities/golf-look-dino.js", "activities/golf-look-candy.js", "activities/golf-look-space.js", "activities/golf-look-frost.js", "activities/trails.js", "activities/bugs.js", "activities/drive.js", "activities/stack.js", "activities/bumper.js", "activities/bumper-draw.js", "activities/rapids.js", "activities/rapids-draw.js", "activities/fuse.js", "activities/fuse-draw.js", "activities/hop.js", "activities/hop-draw.js", "activities/bounce.js", "activities/bounce-draw.js", "activities/bounce-roads.js", "activities/bounce-road.js", "activities/bounce-rivals.js", "activities/bounce-scenery.js", "activities/bounce-cars.js", "activities/ghoul-rush/ghoul.js", "activities/ghoul-rush/draw/ghoul-draw.js", "activities/ghoul-rush/core/ghoul-rooms.js", "activities/ghoul-rush/stages/wing/ghoul-bones.js", "activities/ghoul-rush/stages/wing/ghoul-bones-draw.js", "activities/ghoul-rush/stages/graveyard/ghoul-graveyard.js", "activities/ghoul-rush/stages/graveyard/ghoul-graveyard-draw.js", "activities/ghoul-rush/stages/grounds/ghoul-grounds.js", "activities/ghoul-rush/stages/grounds/ghoul-grounds-draw.js", "activities/ghoul-rush/stages/chapel/ghoul-chapel.js", "activities/ghoul-rush/stages/chapel/ghoul-chapel-draw.js", "activities/ghoul-rush/stages/sanatorium/ghoul-sanatorium.js", "activities/ghoul-rush/stages/sanatorium/ghoul-sanatorium-draw.js", "activities/ghoul-rush/stages/village/ghoul-village.js", "activities/ghoul-rush/stages/village/ghoul-village-draw.js", "activities/ghoul-rush/stages/village/ghoul-village-world.js", "activities/ghoul-rush/stages/village/ghoul-village-wolf.js", "activities/ghoul-rush/stages/mine/ghoul-mine.js", "activities/ghoul-rush/stages/mine/ghoul-mine-draw.js", "activities/ghoul-rush/stages/mine/ghoul-mine-world.js", "activities/ghoul-rush/stages/mine/ghoul-mine-tommy.js", "activities/ghoul-rush/rides/cart/ghoul-cart.js", "activities/ghoul-rush/rides/cart/ghoul-cart-draw.js", "activities/ghoul-rush/rides/sled/ghoul-sled.js", "activities/ghoul-rush/rides/sled/ghoul-sled-draw.js", "activities/ghoul-rush/rides/gurney/ghoul-gurney.js", "activities/ghoul-rush/rides/gurney/ghoul-gurney-draw.js", "activities/ghoul-rush/rides/banister/ghoul-banister.js", "activities/ghoul-rush/rides/banister/ghoul-banister-draw.js", "activities/ghoul-rush/rides/banister/ghoul-sfx-banister.js", "activities/ghoul-rush/rides/hearse/ghoul-hearse.js", "activities/ghoul-rush/rides/hearse/ghoul-hearse-draw.js", "activities/ghoul-rush/rides/wagon/ghoul-wagon.js", "activities/ghoul-rush/rides/wagon/ghoul-wagon-draw.js", "activities/ghoul-rush/rides/pew/ghoul-pew.js", "activities/ghoul-rush/rides/pew/ghoul-pew-draw.js", "activities/ghoul-rush/rides/pew/ghoul-pew-course.js", "activities/ghoul-rush/rides/pew/ghoul-pew-world.js", "activities/ghoul-rush/rides/mower/ghoul-mower.js", "activities/ghoul-rush/rides/mower/ghoul-mower-draw.js", "activities/ghoul-rush/rides/tray/ghoul-tray.js", "activities/ghoul-rush/rides/tray/ghoul-tray-draw.js", "activities/ghoul-rush/stages/carnival/ghoul-carnival.js", "activities/ghoul-rush/stages/carnival/ghoul-carnival-draw.js", "activities/ghoul-rush/stages/carnival/ghoul-carnival-world.js", "activities/ghoul-rush/stages/frozen/ghoul-frozen.js", "activities/ghoul-rush/stages/frozen/ghoul-frozen-draw.js", "activities/ghoul-rush/stages/frozen/ghoul-frozen-world.js", "activities/ghoul-rush/arms/ghoul-flare.js", "activities/ghoul-rush/stages/bog/ghoul-bog.js", "activities/ghoul-rush/stages/bog/ghoul-bog-draw.js", "activities/ghoul-rush/draw/ghoul-picker-draw.js", "activities/ghoul-rush/core/ghoul-powers.js", "activities/ghoul-rush/arms/ghoul-arms.js", "activities/ghoul-rush/arms/ghoul-arms-draw.js", "activities/ghoul-rush/arms/ghoul-rockets.js", "activities/ghoul-rush/arms/ghoul-rockets-draw.js", "activities/ghoul-rush/arms/ghoul-pans.js", "activities/ghoul-rush/arms/ghoul-sfx-arms.js", "activities/ghoul-rush/core/ghoul-run.js", "activities/ghoul-rush/core/ghoul-dice.js", "activities/ghoul-rush/core/ghoul-dice-draw.js", "activities/ghoul-rush/story/ghoul-gameover-draw.js", "activities/ghoul-rush/story/ghoul-intros.js", "activities/ghoul-rush/story/ghoul-intro-draw.js", "activities/ghoul-rush/story/ghoul-boss-intros.js", "activities/ghoul-rush/story/ghoul-bossintro-draw.js", "activities/ghoul-rush/story/ghoul-story.js", "activities/ghoul-rush/story/ghoul-story-draw.js", "activities/ghoul-rush/story/ghoul-sfx-story.js", "activities/ghoul-rush/core/ghoul-bonus.js", "activities/ghoul-rush/core/ghoul-bonus-drLine truncated
|
||||
assert.ok(servable.includes(`"${file}"`), `SERVABLE includes ${file}`);
|
||||
}
|
||||
});
|
||||
@@ -84,7 +84,8 @@ test("every tone is well formed: a known wave or noise, a sane length, a filter
|
||||
assert.ok(Object.isFrozen(spec), `${name} is frozen`);
|
||||
for (const p of partsOf(spec)) {
|
||||
assert.ok(WAVES.has(p.type) || (spec.layers && NOISES.has(p.type)), `${name}: ${p.type} is a wave, or a noise in a layered tone`);
|
||||
assert.ok(p.seconds > 0 && p.seconds + (p.delay || 0) <= 1.2, `${name} is over within 1.2 s`);
|
||||
// (a tiny tolerance: 0.1 + 1.1 is 1.2000000000000002 in floating point)
|
||||
assert.ok(p.seconds > 0 && p.seconds + (p.delay || 0) <= 1.2 + 1e-9, `${name} is over within 1.2 s`);
|
||||
if (WAVES.has(p.type)) assert.ok(p.notes ? p.notes.every((f) => f > 0) : p.from > 0 && p.to > 0, `${name} has its pitches`);
|
||||
if (p.filter) assert.ok(FILTERS.has(p.filter.type) && p.filter.from > 0, `${name}'s filter is known`);
|
||||
if (p.gain !== undefined) assert.ok(p.gain > 0 && p.gain <= 1, `${name}'s part gain is a share`);
|
||||
|
||||
Reference in new issue
Block a user