import assert from 'node:assert/strict'; import { type Action, type Game } from '../game/engine'; import { advanceTruthRevival, truthRevivalClean, truthRevivalInventory, truthRevivalPlayer } from './fixture-truth-revival'; import { actFutureBattleRevival, askFutureBattleRevival, createFutureBattleRevivalFixture, futureBattleRevivalRecords, reachFutureBattleRevivalBattle, reachFutureBattleRevivalMovement, } from './fixture-truth-future-battle-revival'; export const actFutureBattleCharity = actFutureBattleRevival; export const askFutureBattleCharity = askFutureBattleRevival; export const futureBattleCharityRecords = futureBattleRevivalRecords; export const futureBattleCharityInventory = truthRevivalInventory; export const reachFutureBattleCharityBattle = reachFutureBattleRevivalBattle; export const reachFutureBattleCharityMovement = reachFutureBattleRevivalMovement; /** Start from the original public classic setup and actual turn-two Storm, * then advance the source's real native actions to a quiet Charity window. */ export function createFutureBattleCharityFixture() { const origin = createFutureBattleRevivalFixture(); const game = advanceTruthRevival(structuredClone(origin.base.storm.after), state => state.turn === origin.game.turn && state.phase === 2 && truthRevivalClean(state)); assert.equal(game.status, 'playing'); assert.equal(game.phase, 2); assert.equal(game.advanced, false); assert.deepEqual(game.expansions, []); assert.ok(truthRevivalClean(game)); assert.ok(truthRevivalPlayer(game, origin.asker).hand.some(card => card.id === origin.truth)); assert.deepEqual(truthRevivalInventory(game), origin.originalCards); const target = truthRevivalPlayer(game, origin.target); const available = target.leaders.filter(leader => !leader.dead && !leader.capturedBy && !leader.gholaBy && !leader.usedAt); assert.ok(available.length >= 2); const leader = available[0].id, alternative = available[1].id; const question = { kind: 'futureBattleLeader', target: origin.target, turn: game.turn, leader }; return { ...origin, game, source: structuredClone(game), leader, alternative, question, ask: { type: 'truthAsk', question } as unknown as Action }; } export type FutureBattleCharityFixture = ReturnType; /** Drive the real, earlier phase source to the original target movement turn. */ export function reachFutureBattleCharityWindow(game: Game, fixture: FutureBattleCharityFixture) { return reachFutureBattleCharityMovement(game, fixture); }