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

+11 -5
View File
@@ -11958,7 +11958,9 @@ function recordMoritaniAssassinateOpportunity(g: Game, b: Battle, winner: Player
faction:winner.faction,event:g.lastBattleContext!.event,turn:g.turn,territory:b.territory,
opposingLeader:opposingLeader?.id ?? null,opposingLeaderSurvived:!!opposingLeader && !opposingLeader.dead,
normalBattle:g.lastBattleContext!.result === 'normal',lostBattle:true,
traitorCalled:Object.values(b.traitorCalls).some(Boolean)};
// Betrayal cancels the battle outcome, not the preceding public reveal.
traitorCalled:Object.values(b.traitorCalls).some(Boolean) ||
!!g.nexusHarkonnenBetrayalHistory?.some(r => r.outcome === 'use' && r.source.battle.event === b.event)};
if (!moritaniAssassinateTrigger(trigger)) return;
const receipt = createMoritaniAssassinateOpportunity(trigger);
if (g.leaderSkills) receipt.stage = 'skills';
@@ -12992,7 +12994,12 @@ function harkonnenNexusBetrayalContext(g: Game) {
const plans = Object.fromEntries([b.attacker,b.defender].map(id => [id,{
leader:b.plans[id].leader,...(b.plans[id].kwisatz === undefined ? {} : {kwisatz:b.plans[id].kwisatz}),
}]));
// A previously opened Basic Occupy reaction retains its original source
// shape; only newly opened reactions bind the coalition profile.
const legacyOccupySource = !!g.pendingNexusHarkonnenBetrayal &&
!Object.hasOwn(g.pendingNexusHarkonnenBetrayal.source.battle, 'ecazOccupy');
const battle = {event:b.event!,attacker:b.attacker,defender:b.defender,plans,
...(b.ecazOccupy && !legacyOccupySource ? {ecazOccupy:ecazBattleProfile(g)!} : {}),
heroLeaderIds:g.expansions.includes('ix') ? physicalTreacheryCards(g).filter(card => card.kind === 'hero').map(card => card.id) : []};
return {status:g.status,phase:g.phase,turn:g.turn,advanced:g.advanced,ecazTreachery:g.ecazTreachery === true,
...(g.expansions.length ? {expansions:g.expansions} : {}),
@@ -13010,7 +13017,9 @@ function harkonnenNexusBetrayalAuthority(g: Game): HarkonnenBetrayalAuthority {
'The Harkonnen reaction lost its original legal native call.');
const declaration = nexusRule(() => createTraitorDeclaration(traitorDeclarationContext(g),allowance.provider));
requireRule(JSON.stringify(declaration) === JSON.stringify(b.traitorDeclarations?.[allowance.provider]) &&
allowance.nativeWindow === ([b.attacker,b.defender].includes(allowance.provider) ? 'direct' : 'harkonnenTraitor'),
allowance.nativeWindow === ([b.attacker,b.defender].includes(allowance.provider) ||
!!b.ecazOccupy && [b.ecazOccupy.ecaz,b.ecazOccupy.ally].includes(allowance.provider)
? 'direct' : 'harkonnenTraitor'),
'The Harkonnen call lost its original canonical declaration or native window.');
const required = allowance.nativeWindow === 'direct' ? [] :
g.players.filter(p => responseCancelCards(g,p,{kind:'harkonnenTraitor',owner:allowance.provider,passed:[]}).length > 0).map(p => p.id);
@@ -13093,9 +13102,6 @@ function harkonnenNexusBetrayalIntegrity(g: Game, mentatOpening = false): void {
function offerHarkonnenNexusBetrayal(g: Game, provider: string, response?: ResponseWindow): boolean {
if (!g.nexusHarkonnenBetrayalPreview || getPlayer(g,provider).faction !== 'harkonnen') return false;
const b = g.battle!;
// Occupy can add co-side voters that the current two-sided source cannot bind.
// Retain the original Traitor call until that declaration is supported.
if (b.ecazOccupy && harkonnenE3NexusBetrayalProfile(g)) return false;
const required = nexusRule(() => harkonnenBetrayalResponders(g.nexusCards!.cards!,g.players));
if (!required.length) return false;
requireRule(!b.nexusHarkonnenAllowance && (!response || response.kind === 'harkonnenTraitor'),
+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',
+3 -3
View File
@@ -4422,7 +4422,7 @@ export const RULE_TOPICS: RuleTopic[] = [
summary:
'Supported native Advanced Moritani reveals a different opposing-faction Traitor Card after a loss and replaces it during Mentat Pause.',
steps: [
'After you lose a battle, this advanced advantage is available only if the opposing leader disc survived and no Traitor was called.',
'After you lose a battle, this advanced advantage is available only if the opposing leader disc survived and no Traitor was revealed. A Harkonnen Traitor publicly revealed before Nexus Betrayal cancels its outcome still prevents this advantage; the combined interpretation is provisional.',
'You may reveal a Traitor Card for that opposing faction, but it must name a different leader from the one you just fought. If that named leader is not in the Tanks, kill it and collect spice for its value.',
'An already-dead named leader remains a legal reveal, awarding no death or spice. During Mentat Pause, set the revealed card aside face up as a marker and draw a new Traitor Card. You can use this advantage only once against each faction in the game.',
'A Mentat replacement is an ordinary physical Traitor Card, including the original Ix Hero identity when present. After original owned initialization, retire the victim permanently. The replacement itself may later be legally exchanged, returned and drawn again; keep its old receipt unchanged and count one live card, not one per historical reference.',
@@ -6262,7 +6262,7 @@ export const RULE_TOPICS: RuleTopic[] = [
searchText: 'Harkonnen Nexus Betrayal revealed declared traitor ally caller beneficiary shuffle replacement Mentat neutral acknowledgement',
steps: [
'Fresh supported Basic and Advanced Nexus core starts with selected faction decks initialize this reaction for native expansion leaders and the Ix Cheap Hero Traitor. Advanced CHOAM’s Auditor has its real Traitor identity. An owed replacement waits through Ix phase-opening acknowledgements before the original Mentat draw. Fresh Advanced games with Harkonnen and one Ecaz or Moritani faction also support the reaction with Nexus alone; wider E3 combinations remain unfinished.',
'Ecaz Occupy battles retain the ordinary Traitor call without the Harkonnen Nexus reaction until coalition declarations are supported. Harkonnen replacement precedes Moritani assassination replacement when both are due; that ordering is provisional.',
'Ecaz Occupy retains the actual coalition lead and co-side declarations. Harkonnen calls directly as a combatant or co-side voter; a separate allied call retains its native counter. Harkonnen replacement precedes Moritani assassination replacement when both are due; that ordering is provisional and the simultaneous case still needs a full native journey.',
'Original standalone preview requires native Harkonnen, classic2–6 Basic/Advanced, base33 and Nexus alone. Fresh classic Nexus core initializes the same effect with base33 or selected36, optional14, original Tech3+ and Advanced Strongholds2+, alongside actual Guild/Ixian reactions. Public selection binds the census; real held-card effects and cleanup stay native. No played game is reflagged; other native/module envelopes remain separate.',
'Nexus has no initial deal. An actual alliance-qualified closing Nexus must supply the unallied holder. An effect scenario needs at least three seats; two seats can continue ordinary play without inventing a card. Two simultaneous receivers need four actual seats.',
'The photographed publisher face cancels a revealed Harkonnen traitor, shuffles that exact card back immediately, and gives Harkonnen one replacement during Mentat Pause. It is not a draw-now exchange, whole-battle ban or refund of an already resolved outcome. Native Cunning and absent-Harkonnen Secret Ally remain separate effects.',
@@ -6283,7 +6283,7 @@ export const RULE_TOPICS: RuleTopic[] = [
{ area: 'Player controls', status: 'Partial', detail: 'Public declared-Traitor inspector, own eligible event-only Use/Pass/Nexus inspector, sole/multiple public ownership and every-seat independent autopilot are connected. Actual phone Use, wrong-face Pass, partial refresh and raw administrator owner agree.', evidence: ['components/nexus-harkonnen-betrayal.tsx', 'components/game-table.tsx', 'game/table-turn.ts', 'db/admin-directory.ts'] },
{ area: 'AI', status: 'Partial', detail: 'All four minimal policies consume canonical own-view choices and native pending priority with legal paced continuation; full strategy and calibration remain separate.', evidence: ['game/bot-nexus-harkonnen-betrayal.ts', 'game/bots.ts'] },
{ area: 'Documentation', status: 'Partial', detail: 'Printed immediate/delayed operations, personal/allied roles, inferred local counter/privacy convention, fresh natural card rights and unchanged outside-profile/module/public/deployment questions are explicit.', evidence: ['docs/NEXUS_HARKONNEN_RULES.md', 'docs/NEXUS_CARD_RUNTIME.md', 'docs/RULE_DECISIONS.md'] },
{area:'Verification',status:'Partial',detail:"Fresh classic and selected-deck evidence remains. Standalone Advanced Ecaz and Moritani have staged native battle, control and delayed-replacement smoke; Occupy and simultaneous replacement composition remain open. Other modes, universal timing and deferred assurance remain open.",evidence:['tests/classic-nexus-core.test.ts','tests/fixture-classic-nexus-core.ts','game/faction-module-profile.ts','tests/classic-independent-nexus-reactions.test.ts','tests/fixture-classic-independent-nexus-reactions.ts','tests/fixture-nexus-harkonnen-betrayal.ts', 'tests/nexus-harkonnen-betrayal.test.ts', 'tests/nexus-harkonnen-betrayal-runtime.test.ts', 'tests/nexus-harkonnen-betrayal-controls.test.tsx', 'tests/bot-nexus-harkonnen-betrayal.test.ts', 'tests/nexus-harkonnen-e3-runtime.test.ts', 'tests/nexus-harkonnen-e3-controls.test.tsx', 'tests/nexus-harkonnen-e3-quote.test.ts', 'tests/nexus-harkonnen-betrayal-recovery.test.ts', 'tests/prototype-room.test.ts', 'tests/admin-directory.test.ts']},
{area:'Verification',status:'Partial',detail:"Fresh classic and selected-deck evidence remains. Standalone Advanced Ecaz and Moritani have staged native battle, control and delayed-replacement smoke; genuine Occupy battles cover both leads and Harkonnen on either side. Simultaneous replacement composition, other modes, universal timing and deferred assurance remain open.",evidence:['tests/classic-nexus-core.test.ts','tests/fixture-classic-nexus-core.ts','game/faction-module-profile.ts','tests/classic-independent-nexus-reactions.test.ts','tests/fixture-classic-independent-nexus-reactions.ts','tests/fixture-nexus-harkonnen-betrayal.ts', 'tests/nexus-harkonnen-betrayal.test.ts', 'tests/nexus-harkonnen-betrayal-runtime.test.ts', 'tests/nexus-harkonnen-betrayal-controls.test.tsx', 'tests/bot-nexus-harkonnen-betrayal.test.ts', 'tests/nexus-harkonnen-e3-runtime.test.ts', 'tests/nexus-harkonnen-e3-controls.test.tsx', 'tests/nexus-harkonnen-e3-quote.test.ts', 'tests/nexus-harkonnen-occupy-runtime.test.ts', 'tests/nexus-harkonnen-occupy-quote.test.ts', 'tests/nexus-harkonnen-moritani-reveal.test.ts', 'tests/nexus-harkonnen-betrayal-recovery.test.ts', 'tests/prototype-room.test.ts', 'tests/admin-directory.test.ts']},
],
},
{