Files
Dune/game/ordinary-discard-income.ts
Quintine 047011e243 Allow Semuta recovery before native Ghola income
Reuse the exact ordinary-discard income qualification for admission and
parent validation. Preserve physical revival and native conditional income
through claim, decline, full-hand exchange and original allow/cancel.
2026-10-24 16:48:20 +11:00

22 lines
866 B
TypeScript

import type { Game } from './engine';
type OrdinaryDiscard = Extract<
NonNullable<Game['pendingTreacheryDiscard']>['continuation'],
{ kind: 'ordinaryCardDiscard' }
>;
/** Only Ghola creates this conditional income after its physical effect. The
* same source qualification governs the fresh offer and its saved parent. */
export function ordinaryDiscardIncomeMatches(
game: Pick<Game, 'players'>,
continuation: Pick<OrdinaryDiscard, 'effect' | 'player' | 'resume'>,
): boolean {
const income = continuation.resume.response;
const tleilaxu = game.players.find(player => player.faction === 'tleilaxu');
return continuation.effect === 'ghola' && tleilaxu
? income?.kind === 'revivalIncome' && income.owner === tleilaxu.id &&
income.recipient === continuation.player && income.amount === 1 &&
income.passed.length === 0
: !income;
}