Integrate Ecaz Duke revival and bounded Mirror Weapon battles

This commit is contained in:
Quintine committed 2026-09-28 18:02:04 +10:00
1 parent 68d782ca82
commit 3b118dd845
39 files changed
+1377 -533

No files matched your search

+27
View File
@@ -1,4 +1,6 @@
import type { Game, ResponseWindow, Player } from './engine';
import { DUKE_VIDAL_ID } from './duke-vidal';
import { resolveEcazDukeRevival } from './ecaz-duke-revival';
import { isAuditorLeader } from './choam-auditor';
import { controlsLeader } from './leader-control';
import {
@@ -28,6 +30,7 @@ export type RevivalCancellationContext = Pick<
| 'players'
| 'revivalRules'
| 'freeRevival'
| 'dukeVidal'
| 'pendingRevival'
| 'emperorExtra'
>;
@@ -118,6 +121,20 @@ export function continuationCustody(
);
return;
}
if (pending.leader === DUKE_VIDAL_ID) {
requireRevival(pending.kind === 'leader' && p.faction === 'ecaz' &&
pending.normalCost === 5 && (pending.cost === 3 || pending.cost === 5) &&
!pending.checks.includes('earlyRevival'),
'The pending shared leader has invalid revival costs or checks.');
try {
resolveEcazDukeRevival(g, p.id);
} catch {
throw new RevivalCancellationError('The pending shared leader is unavailable for revival.');
}
requireRevival(!p.leaderRevived,
'The pending shared leader has already used this phase’s revival slot.');
return;
}
const matches = g.players
.flatMap((owner) => owner.leaders.map((leader) => ({ owner, leader })))
.filter(({ leader }) => leader.id === pending.leader);
@@ -241,6 +258,16 @@ export function quoteRevivalCancellation(
g.advanced && p.faction === 'atreides' && !!p.kwisatz,
'The pending Kwisatz Haderach belongs to no valid revival pool.',
);
} else if (original.leader === DUKE_VIDAL_ID) {
requireRevival(original.kind === 'leader' && p.faction === 'ecaz' &&
original.normalCost === 5 && (original.cost === 3 || original.cost === 5) &&
kind !== 'earlyRevival',
'The pending shared leader has invalid revival costs or checks.');
try {
resolveEcazDukeRevival(g, p.id);
} catch {
throw new RevivalCancellationError('The pending shared leader is unavailable for revival.');
}
} else {
const matches = g.players
.flatMap((seat) => seat.leaders.map((leader) => ({ seat, leader })))