React to a paid Box search in the Homeworld Semuta envelope

This commit is contained in:
Quintine committed 2026-10-12 23:34:06 +11:00
1 parent cb4c32fc87
commit a9a8ae6b75
10 files changed
+157 -19

No files matched your search

@@ -30,6 +30,46 @@ export function createSemutaHomeworldOrdinaryFixture(): SemutaHomeworldOrdinaryF
action: { type: 'card', card: hajr } };
}
export type SemutaHomeworldBoxFixture = {
game: Game; source: Game; holder: string; box: string; owner: string;
action: Action; cost: number;
};
/** Genuine original Homeworld occupation state; a real paid Nullentropy Box
* search runs through the engine's own singleton completion. The searched card
* and its candidate discard are conserved physical cards, not minted. */
export function createSemutaHomeworldBoxFixture(): SemutaHomeworldBoxFixture {
const income = createSemutaHomeworldGuildIncomeFixture({ advanced: false });
const game = income.game;
assert.equal(game.phase, 5);
assert.equal(game.active, 'a');
const holder = income.holder, owner = 'a';
assert.equal(semutaEmperorPlayer(game, holder).hand.some(card => card.id === SEMUTA_DRUG_ID), true);
if (!game.discard.some(card => card.effect !== 'nullentropyBox')) {
const id = semutaEmperorCardId(game, card => card.effect !== 'nullentropyBox' &&
card.kind !== 'special' && card.effect !== 'karama');
moveSemutaEmperorCard(game, id, owner);
game.discard.push(semutaEmperorPlayer(game, owner).hand.pop()!);
}
const box = moveSemutaEmperorCard(game,
semutaEmperorCardId(game, card => card.effect === 'nullentropyBox'), owner);
const atreides = semutaEmperorPlayer(game, owner);
assert.ok(atreides.hand.some(card => card.id === box));
const action: Action = { type: 'card', card: box };
return { game, source: income.game, holder, box, owner, action, cost: 2 };
}
export function reactSemutaHomeworldBox(
state: Game, fixture: SemutaHomeworldBoxFixture, claim: boolean,
): Game {
const event = state.pendingTreacheryDiscard!.batch.event;
if (claim) return applyAction(state, fixture.holder, { type: 'semutaCommit', event });
let game = state;
for (const player of state.players)
game = applyAction(game, player.id, { type: 'semutaPass', event });
return game;
}
export function reactSemutaHomeworldOrdinary(
state: Game, fixture: SemutaHomeworldOrdinaryFixture, claim: boolean,
): Game {