Connect bounded Fremen Nexus worm-riding Betrayal

This commit is contained in:
Quintine committed 2026-09-29 19:48:43 +10:00
1 parent 66a427ab55
commit 54cbf4d06f
14 files changed
+457 -55

No files matched your search

+44 -3
View File
@@ -1,9 +1,9 @@
import assert from 'node:assert/strict';
import { applyAction, viewGame, type Action } from '../game/engine';
import { applyAction, viewGame, type Action, type Game } from '../game/engine';
import { TERRITORIES, distance, location, splitLocation } from '../game/board';
import {
finishNexusSpice, nexusInventory, nexusPlayer, nexusReady, nexusTurnTwo,
orderNexusSpice,
enterNexusSpice, finishNexusSpice, nexusInventory, nexusPlayer, nexusReady,
nexusTurnTwo, orderNexusSpice,
} from './fixture-nexus-cards';
export const fremenBetrayalSource = 'red_chasm:7';
@@ -76,3 +76,44 @@ export function fremenBetrayalFixture(
assert.equal(offer.blocked, null);
return { g, play: { type: 'nexusFremenBetrayal', event: offer.event } as Action };
}
/** Preserve the genuinely drawn card into the next turn's clean pre-blow window. */
export function fremenBetrayalWormFixture(
advanced = false,
ids: [string, string, string] = ['f', 'a', 'h'],
) {
const previous = fremenBetrayalFixture(advanced, ids);
const g = enterNexusSpice(previous.g, true);
assert.equal(g.phase, 1);
const offer = viewGame(g, ids[2]).nexusFremenBetrayal!;
assert.equal(offer.mode, 'worm');
assert.equal(offer.blocked, null);
return { g, play: { type: 'nexusFremenBetrayal', event: offer.event } as Action };
}
/** Preserve the physical Spice Deck census while choosing a real next appearance. */
export function fremenBetrayalNextWorm(g: Game, target: string) {
const cards = [...g.spiceDeck, ...g.spiceDiscard.flat()];
const landIndex = cards.findIndex(card => 'territory' in card && card.territory === target);
assert.ok(landIndex >= 0, `Spice deck needs ${target}`);
const land = cards.splice(landIndex, 1)[0];
const wormIndex = cards.findIndex(card => 'worm' in card && !card.suppressed);
assert.ok(wormIndex >= 0, 'Spice deck needs a natural worm');
const worm = cards.splice(wormIndex, 1)[0];
g.spiceDeck = [worm, ...cards];
g.spiceDiscard = [[land], []];
}
/** Recreate the exact six-field receipt persisted by the movement-only checkpoint. */
export function useLegacyFremenMovementReceipt(g: Game) {
const history = g.nexusFremenBetrayalHistory!;
const record = history.at(-1)!;
assert.equal(record.mode, 'movement');
const legacy = {
event: JSON.stringify(['nexusFremenBetrayal', record.turn, record.owner, record.target]),
owner: record.owner, target: record.target, turn: record.turn,
phase: 5 as const, signature: '',
};
legacy.signature = JSON.stringify({ ...legacy, signature: undefined });
history[history.length - 1] = legacy;
}