Connect Harkonnen Nexus to Ecaz Occupy
Verify and publish checkpoint container / container (push) Successful in 11m17s

This commit is contained in:
Quintine committed 2026-11-16 21:11:16 +11:00
1 parent 007508185e
commit a2e7029a72
12 files changed
+529 -19

No files matched your search

+22 -2
View File
@@ -1,6 +1,7 @@
import { createAuditorLeader, leaders, treacheryDeck, type Card } from './cards';
import { FACTIONS } from './catalog';
import { ecazTreacheryCards } from './ecaz-cards';
import { quoteEcazOccupyBattle } from './ecaz-occupy-battle';
import { richeseCards } from './richese-cards';
import {
nexusCardMode, validateNexusCards, validateNexusPlayers,
@@ -151,7 +152,9 @@ function validatePhysical(cards: readonly Card[], independent: boolean, expansio
}
function validateBattle(battle: Battle, expansions: readonly string[]): void {
const heroes = expansions.includes('ix') ? treacheryDeck(expansions).filter(card => card.kind === 'hero').map(card => card.id) : [];
requireBetrayal(exact(battle, ['event', 'attacker', 'defender', 'plans', 'heroLeaderIds']) &&
requireBetrayal(plain(battle) && exact(battle, ['event', 'attacker', 'defender', 'plans', 'heroLeaderIds',
...(Object.hasOwn(battle, 'ecazOccupy') ? ['ecazOccupy'] : [])]) &&
(!Object.hasOwn(battle, 'ecazOccupy') || plain(battle.ecazOccupy)) &&
text(battle.event) && text(battle.attacker) && text(battle.defender) &&
battle.attacker !== battle.defender && exact(battle.plans, [battle.attacker, battle.defender]) &&
Array.isArray(battle.heroLeaderIds) && battle.heroLeaderIds.length === heroes.length &&
@@ -181,11 +184,28 @@ function validateAuthority(
authority.declaration?.voter === authority.provider,
'Harkonnen Betrayal must follow its original allowed native Harkonnen declaration.');
try {
if (battle.ecazOccupy) {
const occupy = battle.ecazOccupy;
const ecaz = players.find(player => player.id === occupy.ecaz);
const ally = players.find(player => player.id === occupy.ally);
requireBetrayal(ecaz?.faction === 'ecaz' && ally && occupy.advanced === advanced,
'Harkonnen Betrayal requires the original Occupy roster and rules band.');
const profile = quoteEcazOccupyBattle({ advanced: occupy.advanced,
battleOrderActor: occupy.battleOrderActor,
ecaz: { id: ecaz.id, faction: 'ecaz', ally: ecaz.ally, forces: occupy.ecazForces },
ally: { id: ally.id, faction: ally.faction, ally: ally.ally, forces: occupy.allyForces,
...(occupy.allyNoFieldPresence ? { noFieldPresence: true as const } : {}) },
lead: occupy.lead, canceled: occupy.canceled });
requireBetrayal(equal(profile, occupy), 'Harkonnen Betrayal changed its original Occupy profile.');
}
validateTraitorDeclaration(declarationContext(battle, players), authority.declaration);
} catch {
throw new HarkonnenBetrayalError('Harkonnen Betrayal lost its canonical native declaration or roles.');
}
const direct = authority.declaration.beneficiary === authority.provider;
// Native Ecaz co-side voters call directly even if their ally owns the plan;
// only an external Harkonnen allied call uses the Karama counter window.
const direct = authority.declaration.beneficiary === authority.provider ||
!!battle.ecazOccupy && [battle.ecazOccupy.ecaz, battle.ecazOccupy.ally].includes(authority.provider);
requireBetrayal(direct ? authority.nativeWindow === 'direct' &&
authority.nativeRequired.length === 0 && authority.nativePassed.length === 0 :
authority.nativeWindow === 'harkonnenTraitor',