Support mixed-deck Emperor gifts at Ix openings
Verify and publish checkpoint container / container (push) Successful in 10m47s

This commit is contained in:
Quintine committed 2026-11-16 13:40:59 +11:00
1 parent 0c64d320ea
commit 66c563be71
7 files changed
+204 -14

No files matched your search

+11
View File
@@ -17,6 +17,17 @@ open mode gates.
## Current checkpoint and work ## Current checkpoint and work
**Basic mixed-deck Emperor gifts at Ix openings — 16 November. Prototyped /
Partial.** Supported selected Basic faction decks, including Nexus or independent
Ecaz cards, retain the original gift and final-bot-pass opportunity. Karama, Kull,
counter-Karama and Semuta resume the original opening. Eight related files
pass 48 cases, including a later real Nexus draw; type checking and lint pass.
The Harkonnen test driver now
resolves actual Semuta reactions rather than stalling. A pending Harkonnen
replacement, Tech, Strongholds, Skills, Homeworlds, Discovery, wider interactions
and deployed acceptance remain open.
[Scope](EMPEROR_ALLIANCE_TIMING.md#basic-mixed-deck-emperor-gifts-at-ix-openings--16-november-2026).
**Human Emperor priority at Basic Ix phase openings — 16 November. Prototyped / **Human Emperor priority at Basic Ix phase openings — 16 November. Prototyped /
Partial.** A final automated pass waits for the human Emperor's optional gift Partial.** A final automated pass waits for the human Emperor's optional gift
and Continue, without revealing available spice. The original passes survive and Continue, without revealing available spice. The original passes survive
+17 -5
View File
@@ -1,5 +1,17 @@
# Emperor alliance gift timing # Emperor alliance gift timing
## Basic mixed-deck Emperor gifts at Ix openings — 16 November 2026
The existing Basic Ix opening gift and final-bot-pass opportunity now work
with supported selected faction decks, including public Nexus starts and,
separately, independent Ecaz Treachery Card starts. Native Karama, Kull, counter-Karama and Semuta
preserve the original opening and pass history. [Public setup journeys](../tests/emperor-phase-opening-mixed-basic.test.ts)
stage an alliance and original physical hands; one later journey earns a
Nexus draw through a real worm and alliance. The online timing remains a
provisional interpretation. A pending Harkonnen Nexus replacement remains
guarded, as do Tech Tokens, Strongholds, Homeworlds, Skills, Discovery and
other interrupted windows; complete games and deployed acceptance remain open.
## Human Emperor before an automated Ix opening pass — 16 November 2026 ## Human Emperor before an automated Ix opening pass — 16 November 2026
In the existing supported Basic Ix opening, the final automated player waits In the existing supported Basic Ix opening, the final automated player waits
@@ -11,8 +23,8 @@ opportunity; a stale Continue cannot release it. Other player types retain
their original actions. This neutral online ordering is provisional, not a their original actions. This neutral online ordering is provisional, not a
publisher timing ruling. [Runtime cases](../tests/emperor-phase-opening-bot-priority.test.ts) publisher timing ruling. [Runtime cases](../tests/emperor-phase-opening-bot-priority.test.ts)
and [controls](../tests/emperor-phase-opening-priority-controls.test.tsx) and [controls](../tests/emperor-phase-opening-priority-controls.test.tsx)
exercise the existing Basic envelope, with a staged alliance and card custody. exercise the then-supported Basic envelope, with a staged alliance and card
Other faction and optional-module combinations remain open. custody. The newer section above records selected-deck expansion.
## Basic Nexus Richese cache gifts — 16 November 2026 ## Basic Nexus Richese cache gifts — 16 November 2026
@@ -86,9 +98,9 @@ to the updated balances and resets passes normally.
The [publisher FAQ, p. 5](https://www.gf9games.com/dune/wp-content/uploads/2020/11/Dune-FAQ-Nov-2020.pdf) The [publisher FAQ, p. 5](https://www.gf9games.com/dune/wp-content/uploads/2020/11/Dune-FAQ-Nov-2020.pdf)
permits direct allied gifts for any reason and immediate collection. Applying permits direct allied gifts for any reason and immediate collection. Applying
that power during the Basic opening is a provisional online timing that power during the Basic opening is a provisional online timing
interpretation. The scope excludes other expansion families, optional modules, interpretation. This original checkpoint excluded other expansion families,
competing continuations and outstanding commitments requiring a combined optional modules, competing continuations and outstanding commitments
planner. At that checkpoint a bot could finish the opening before a human requiring a combined planner. At that checkpoint a bot could finish the opening before a human
Emperor could act; the newer section above covers the final automated pass. Emperor could act; the newer section above covers the final automated pass.
Advanced and other interruption windows remain unfinished. Runtime evidence Advanced and other interruption windows remain unfinished. Runtime evidence
covers [classic](../tests/emperor-phase-opening-gift.test.ts) and covers [classic](../tests/emperor-phase-opening-gift.test.ts) and
+7
View File
@@ -1,5 +1,12 @@
# Rule decision index # Rule decision index
## Basic mixed-deck Emperor gifts at Ix openings — 16 November 2026
The existing provisional opening-gift and final-bot-pass ordering extends to
supported selected Basic faction decks, including Nexus or independent Ecaz cards.
Native Karama, Kull and Semuta resume the original opening.
[Scope](EMPEROR_ALLIANCE_TIMING.md#basic-mixed-deck-emperor-gifts-at-ix-openings--16-november-2026).
## Human Emperor before an automated Ix opening pass — 16 November 2026 ## Human Emperor before an automated Ix opening pass — 16 November 2026
An automated final pass waits for the human Emperor's optional gift or An automated final pass waits for the human Emperor's optional gift or
+10 -8
View File
@@ -10093,7 +10093,8 @@ function semutaOfferSupported(
continuation.kind === 'choamSaleDiscard' || continuation.kind === 'choamKulonDiscard' || continuation.kind === 'choamSaleDiscard' || continuation.kind === 'choamKulonDiscard' ||
continuation.kind === 'choamLaLaLaDiscard' || continuation.kind === 'choamBalisetDiscard' || continuation.kind === 'choamLaLaLaDiscard' || continuation.kind === 'choamBalisetDiscard' ||
continuation.kind === 'choamGamontDiscard' || continuation.kind === 'choamJubbaDiscard' || continuation.kind === 'choamGamontDiscard' || continuation.kind === 'choamJubbaDiscard' ||
continuation.kind === 'karamaShipmentPriceDiscard'; continuation.kind === 'karamaShipmentPriceDiscard' ||
continuation.kind === 'karamaEmperorShareDiscard' && !!continuation.use.response.emperorPhaseOpeningGift;
return (g.semutaPreview === true || return (g.semutaPreview === true ||
g.semutaAdvancedOrdinaryPreview === true && bareAdvancedClassicSemutaProfile(g) && g.semutaAdvancedOrdinaryPreview === true && bareAdvancedClassicSemutaProfile(g) &&
(!g.pendingTreacheryDiscard || !!g.pendingTreacheryDiscard.reaction) && (!g.pendingTreacheryDiscard || !!g.pendingTreacheryDiscard.reaction) &&
@@ -30539,16 +30540,15 @@ function emperorPhaseOpeningGiftSignature(g: Game, opening: {passed: string[]; i
return JSON.stringify([g.turn, g.phase, g.active, g.order, g.ready, g.amalWindowOpen ?? false, return JSON.stringify([g.turn, g.phase, g.active, g.order, g.ready, g.amalWindowOpen ?? false,
opening, owner, recipient, amount]); opening, owner, recipient, amount]);
} }
/** Initial Basic Ix opening support, with no independent competing windows. */ /** Basic selected-deck Ix opening support, with no competing windows. */
function emperorPhaseOpeningGiftPublicEligible(g: Game, p: Player): boolean { function emperorPhaseOpeningGiftPublicEligible(g: Game, p: Player): boolean {
if (g.advanced || g.status !== 'playing' || g.expansions.length !== 1 || g.expansions[0] !== 'ix' || if (g.advanced || g.status !== 'playing' || !g.expansions.includes('ix') || !selectedPhaseModuleRoster(g) ||
g.players.some(seat => !['atreides', 'beneGesserit', 'emperor', 'fremen', 'guild', 'harkonnen', 'ixians', 'tleilaxu'].includes(seat.faction)) || g.techTokens || g.strongholdCards || g.leaderSkills || g.homeworlds ||
g.techTokens || g.strongholdCards || g.leaderSkills || g.homeworlds || g.nexusCards || g.discoveryEnabled || g.sandtrout || g.coalitionState ||
g.discoveryEnabled || g.sandtrout || g.coalitionState || g.semutaPreview || g.semutaRecruitsPreview ||
!g.phaseOpening || !g.amalWindowOpen || !g.phaseOpening || !g.amalWindowOpen ||
g.response || g.decision || g.truthtrance || g.pendingKarama || g.pendingTreacheryDiscard || g.battle || g.response || g.decision || g.truthtrance || g.pendingKarama || g.pendingTreacheryDiscard || g.battle ||
g.pendingRicheseGift || g.pendingNullentropy || g.pendingShipment || g.pendingGuildTransport || g.pendingRicheseGift || g.pendingNullentropy || g.pendingShipment || g.pendingGuildTransport ||
g.pendingArrivalOverlap || g.pendingAmbassador || g.pendingEmperorAuctionGift || g.pendingArrivalOverlap || g.pendingAmbassador || g.pendingEmperorAuctionGift || g.pendingNexusHarkonnenReplacement ||
p.faction !== 'emperor' || !p.ally || p.faction !== 'emperor' || !p.ally ||
!g.players.some(seat => seat.id === p.ally && seat.ally === p.id)) return false; !g.players.some(seat => seat.id === p.ally && seat.ally === p.id)) return false;
return true; return true;
@@ -43485,7 +43485,9 @@ function applyActionWithInitiator(state: Game, id: string, action: Action, initi
const phaseGiftResponse = state.response?.emperorPhaseOpeningGift || const phaseGiftResponse = state.response?.emperorPhaseOpeningGift ||
(state.pendingKarama?.use.kind === 'cancel' && state.pendingKarama.use.response.emperorPhaseOpeningGift); (state.pendingKarama?.use.kind === 'cancel' && state.pendingKarama.use.response.emperorPhaseOpeningGift);
if (phaseGiftResponse && action?.type !== 'advanceBots') if (phaseGiftResponse && action?.type !== 'advanceBots')
requireRule(action?.type === 'passResponse' || action?.type === 'card' && action.mode === 'cancel', requireRule(action?.type === 'passResponse' || action?.type === 'card' && action.mode === 'cancel' ||
action?.type === 'kullDecision' && !!state.pendingKull &&
state.pendingKull.resume.response?.emperorPhaseOpeningGift?.event === phaseGiftResponse.event,
'Resolve the Emperor gift response before another action.'); 'Resolve the Emperor gift response before another action.');
const extortionGiftResponse = state.response?.emperorExtortionGift || const extortionGiftResponse = state.response?.emperorExtortionGift ||
(state.pendingKarama?.use.kind === 'cancel' && state.pendingKarama.use.response.emperorExtortionGift); (state.pendingKarama?.use.kind === 'cancel' && state.pendingKarama.use.response.emperorExtortionGift);
+1 -1
View File
@@ -88,7 +88,7 @@ export const FACTION_RULES: Record<
'Give spice directly to your ally. After the response window it is immediately spendable, unlike a deferred bribe between non-allies.', 'Give spice directly to your ally. After the response window it is immediately spendable, unlike a deferred bribe between non-allies.',
'In supported Basic ordinary auctions and Richese cache sales, including Nexus games, you may give your mutual ally spice after they win and before their original payment. Continue preserves the bid and pledged split; a canceled gift transfers nothing.', 'In supported Basic ordinary auctions and Richese cache sales, including Nexus games, you may give your mutual ally spice after they win and before their original payment. Continue preserves the bid and pledged split; a canceled gift transfers nothing.',
'In supported Moritani games, including Basic games with other selected faction decks, you may also give spice while your ally is choosing whether to pay Extortion. The original choice resumes after the gift’s Karama response.', 'In supported Moritani games, including Basic games with other selected faction decks, you may also give spice while your ally is choosing whether to pay Extortion. The original choice resumes after the gift’s Karama response.',
'In supported Basic Ix-deck games with classic factions, Ixians or Tleilaxu, you may give an ally spice during the Amal phase opening, even after you have passed. The original opening resumes after the gift response. If a final automated pass would close it, a human Emperor may share or continue first.', 'In supported Basic games with the Ix deck and selected expansion factions, you may give an ally spice during the Amal phase opening, even after you have passed. The original opening resumes after the gift response. If a final automated pass would close it, a human Emperor may share or continue first.',
'During Revival, pay two spice per extra allied force, up to three extra forces per turn. These are separate from the ally’s normal three-force allowance and may be purchased before or after ordinary revivals.', 'During Revival, pay two spice per extra allied force, up to three extra forces per turn. These are separate from the ally’s normal three-force allowance and may be purchased before or after ordinary revivals.',
'Spice gifts and extra revival uses have Karama response windows. Canceling a use spends neither the Emperor’s spice nor the extra-revival allowance.', 'Spice gifts and extra revival uses have Karama response windows. Canceling a use spends neither the Emperor’s spice nor the extra-revival allowance.',
], ],
@@ -0,0 +1,150 @@
import assert from 'node:assert/strict';
import test from 'node:test';
import {applyAction, createGame, joinGame, newPlayer, viewGame, type Action, type Game} from '../game/engine';
import {botActions, runBots} from '../game/bots';
import {DIFFICULTIES} from '../game/bot-profiles';
import {territory} from '../game/board';
import {takeKullCard} from './fixture-choam-kull';
import {nextStrongholdFactionsNativeStep} from './fixture-stronghold-factions';
import {advanceSemutaNexusTrade} from './fixture-semuta-nexus-trade';
import {beforeIxSpiceDraw, orderIxSpiceCards} from './fixture-ix-spice-cards';
const act=(game:Game,id:string,action:Action)=>applyAction(game,id,action);
const seat=(game:Game,id:string)=>{const p=game.players.find(row=>row.id===id);assert.ok(p);return p;};
function inventory(game:Game) {
const cards=[...game.deck,...game.discard,...(game.richeseCache??[]),...(game.richeseRemoved??[]),
...(game.ixSetupCards??[]),...game.players.flatMap(p=>p.hand)].map(card=>card.id).sort();
assert.equal(new Set(cards).size,cards.length);return cards;
}
function passResponse(game:Game) {
for(let n=0;game.response&&n<20;n++) {
const p=game.players.find(row=>!game.response!.passed.includes(row.id));assert.ok(p);
game=act(game,p.id,{type:'passResponse'});
}
return game;
}
function passSemuta(game:Game) {
for(let n=0;game.pendingTreacheryDiscard?.reaction?.stage==='offer'&&n<game.players.length;n++) {
const pending=game.pendingTreacheryDiscard,reaction=pending.reaction;assert.ok(reaction?.stage==='offer');
const p=game.players.find(row=>!reaction.passed.includes(row.id));assert.ok(p);
game=act(game,p.id,{type:'semutaPass',event:pending.batch.event});
}
return game;
}
/** Public Basic selected-deck setup; stage the alliance, original physical
* hands and wallets after setup. No opening, pass or reaction is invented. */
function fixture(nexus:boolean, independent=false) {
let game=createGame('MIXOPEN',newPlayer('m','Moritani','moritani'),false,['ix','choam','ecaz']);
for(const [id,faction] of [['e','emperor'],['a','atreides'],['c','choam'],['r','richese'],['i','ixians']] as const)
joinGame(game,newPlayer(id,faction,faction));
if(nexus)game=act(game,'m',{type:'moduleOption',module:'nexusCards',enabled:true});
if(independent)game=act(game,'m',{type:'moduleOption',module:'ecazTreachery',enabled:true});
for(const p of game.players)game=act(game,p.id,{type:'ready'});
game=act(game,'m',{type:'start'});
assert.equal(game.kullPreview,true);
assert.equal(independent ? game.semutaRecruitsPreview : game.semutaPreview,true);
for(let n=0;game.status==='setup'&&n<100;n++) {
if(game.decision?.kind==='moritaniSetup')game=act(game,'m',{type:'decision',territory:'sietch_tabr',sector:territory('sietch_tabr').sectors[0]});
else {const step=nextStrongholdFactionsNativeStep(game);assert.ok(step);game=act(game,step.actor,step.action);}
}
assert.equal(game.status,'playing');assert.ok(game.phaseOpening);
const original=inventory(game);
seat(game,'e').ally='a';seat(game,'a').ally='e';seat(game,'e').spice=10;seat(game,'a').spice=3;
for(const p of game.players)game.deck.push(...p.hand.splice(0));
const kull=takeKullCard(game,'ix-kull-wahad');seat(game,'c').hand.push(kull);
const originalKarama=takeKullCard(game,'karama');seat(game,'m').hand.push(originalKarama);
const counter=takeKullCard(game,'karama');seat(game,'i').hand.push(counter);
const semuta=takeKullCard(game,'richese-semuta-drug');seat(game,'r').hand.push(semuta);
assert.deepEqual(inventory(game),original);
for(const id of ['e','a','r','i'])game=act(game,id,{type:'ready'});
assert.deepEqual(viewGame(game,'e').emperorPhaseOpeningGift,{recipient:'a',maximum:10});
return {game,original,kull:kull.id,karama:originalKarama.id,counter:counter.id,semuta:semuta.id};
}
for(const nexus of [false,true]) for(const mode of ['allow','decline','success','counter'] as const) void test(
`Basic mixed-deck${nexus?' Nexus':''} opening gift ${mode} resumes original passes`,()=>{
const f=fixture(nexus),before=structuredClone(f.game.phaseOpening);
let game=act(f.game,'e',{type:'emperorGift',amount:2});
if(mode==='allow')game=passResponse(game);
else {
game=act(game,'m',{type:'card',mode:'cancel',card:f.karama});assert.equal(game.pendingKull?.stage,'offer');
game=act(game,'c',mode==='decline'?{type:'kullDecision',event:game.pendingKull!.event,decline:true}:
{type:'kullDecision',event:game.pendingKull!.event,source:'printed',card:f.kull});
if(mode==='success') {assert.equal(game.pendingKull?.stage,'counter');game=passResponse(game);}
if(mode==='counter') {
assert.equal(game.pendingKull?.stage,'counter');
game=act(game,'i',{type:'card',mode:'cancel',card:f.counter});
}
assert.equal(game.pendingTreacheryDiscard?.reaction?.stage,'offer');
const event=game.pendingTreacheryDiscard!.batch.event;
if(mode==='counter')game=act(game,'r',{type:'semutaCommit',event});else game=passSemuta(game);
if(game.pendingTreacheryDiscard?.reaction?.stage==='offer')game=passSemuta(game);
if(game.response)game=passResponse(game);
}
assert.deepEqual(game.phaseOpening,before);
assert.equal(seat(game,'e').spice,mode==='allow'||mode==='success'?8:10);
assert.equal(seat(game,'a').spice,mode==='allow'||mode==='success'?5:3);
assert.deepEqual(inventory(game),f.original);
});
void test('Basic mixed-deck opening waits for the human Emperor before the final bot pass',()=>{
const f=fixture(true);let game=act(f.game,'m',{type:'ready'});
seat(game,'c').bot='Easy';const priority=viewGame(game,'e').emperorPhaseOpeningPriority;assert.ok(priority);
for(const level of DIFFICULTIES) {
const view=viewGame(game,'c');view.players.find(p=>p.id==='c')!.bot=level;
assert.ok(!botActions(view).some(action=>action.type==='ready'));
}
assert.deepEqual(runBots(game,5).phaseOpening,game.phaseOpening);
game=act(game,'e',{type:'emperorPhaseOpeningContinue',event:priority.event});
game=act(game,'c',{type:'ready'});assert.equal(game.phaseOpening,null);
});
void test('Basic independent Ecaz cards retain the opening gift and Semuta cancellation',()=>{
const f=fixture(false,true),opening=structuredClone(f.game.phaseOpening);
let game=act(f.game,'e',{type:'emperorGift',amount:2});
game=act(game,'m',{type:'card',mode:'cancel',card:f.karama});
assert.equal(game.pendingKull?.stage,'offer');
game=act(game,'c',{type:'kullDecision',event:game.pendingKull!.event,decline:true});
assert.equal(game.pendingTreacheryDiscard?.reaction?.stage,'offer');
game=passSemuta(game);
assert.deepEqual(game.phaseOpening,opening);assert.equal(seat(game,'e').spice,10);
assert.deepEqual(inventory(game),f.original);
});
void test('Basic independent Ecaz cards preserve the original gift through a Kull counter',()=>{
const f=fixture(false,true),opening=structuredClone(f.game.phaseOpening);
let game=act(f.game,'e',{type:'emperorGift',amount:2});
game=act(game,'m',{type:'card',mode:'cancel',card:f.karama});
game=act(game,'c',{type:'kullDecision',event:game.pendingKull!.event,source:'printed',card:f.kull});
game=act(game,'i',{type:'card',mode:'cancel',card:f.counter});
const pending=game.pendingTreacheryDiscard;assert.equal(pending?.reaction?.stage,'offer');
game=act(game,'r',{type:'semutaCommit',event:pending!.batch.event});
if(game.pendingTreacheryDiscard?.reaction?.stage==='offer')game=passSemuta(game);
if(game.response)game=passResponse(game);
assert.deepEqual(game.phaseOpening,opening);assert.equal(seat(game,'e').spice,10);
assert.equal(seat(game,'r').hand.some(card=>card.id===f.counter),true);
assert.deepEqual(inventory(game),f.original);
});
void test('Basic mixed-deck gift keeps an earned Nexus and the later Ix opening',()=>{
const f=fixture(true);let game=f.game;
seat(game,'e').ally=null;seat(game,'a').ally=null;
for(const p of game.players) {
p.reserves+=Object.values(p.forces).reduce((sum,n)=>sum+n,0);p.forces={};
if(p.elites) {p.elites.reserves+=Object.values(p.elites.forces).reduce((sum,n)=>sum+n,0);p.elites.forces={};}
}
game=advanceSemutaNexusTrade(game,beforeIxSpiceDraw);orderIxSpiceCards(game,['land','land']);
game=advanceSemutaNexusTrade(game,state=>state.turn===2&&beforeIxSpiceDraw(state));
orderIxSpiceCards(game,['worm','land','land']);
game=advanceSemutaNexusTrade(game,state=>!!state.nexus&&!state.spiceWindow&&!state.phaseOpening&&!state.response&&!state.decision);
game=act(game,'e',{type:'alliance',target:'a'});game=act(game,'a',{type:'alliance',target:'e'});
game=advanceSemutaNexusTrade(game,state=>state.nexusCards?.phase?.stage==='drawing');
assert.ok(game.nexusCards!.phase!.eligible.includes('i'));
game=act(game,'i',{type:'nexusCardChoice',turn:game.turn,card:null,choice:'draw',ownRedraws:0});
const card=game.nexusCards!.cards!.hands.i;assert.ok(card);
game=advanceSemutaNexusTrade(game,state=>state.phase===3&&!!state.phaseOpening&&!state.response&&!state.decision);
const opening=structuredClone(game.phaseOpening),balance=seat(game,'e').spice;
assert.ok(viewGame(game,'e').emperorPhaseOpeningGift);
game=act(game,'e',{type:'emperorGift',amount:1});game=passResponse(game);
assert.deepEqual(game.phaseOpening,opening);assert.equal(seat(game,'e').spice,balance-1);
assert.equal(game.nexusCards!.cards!.hands.i,card);
});
@@ -1,6 +1,7 @@
import assert from 'node:assert/strict'; import assert from 'node:assert/strict';
import {applyAction,createGame,initializeHarkonnenNexusBetrayalGameForAudit,joinGame,newPlayer,viewGame,type Action,type Game} from '../game/engine'; import {applyAction,createGame,initializeHarkonnenNexusBetrayalGameForAudit,joinGame,newPlayer,viewGame,type Action,type Game} from '../game/engine';
import {botActions} from '../game/bots'; import {botActions} from '../game/bots';
import {botSemutaActions} from '../game/bot-semuta';
import {TERRITORIES} from '../game/board'; import {TERRITORIES} from '../game/board';
export type HarkonnenBetrayalFixtureOptions = {initial?:Game;advanced?:boolean;remote?:boolean;face?:'harkonnen'|'richese';secondFace?:'harkonnen'|'richese'|'guild';receiverCount?:1|2;seatIds?:string[]}; export type HarkonnenBetrayalFixtureOptions = {initial?:Game;advanced?:boolean;remote?:boolean;face?:'harkonnen'|'richese';secondFace?:'harkonnen'|'richese'|'guild';receiverCount?:1|2;seatIds?:string[]};
@@ -24,6 +25,13 @@ export function nextHarkonnenBetrayalNativeStep(game:Game):HarkonnenBetrayalNati
const phase=game.nexusCards.phase,actor=phase.eligible.find(id=>!phase.done.includes(id))!; const phase=game.nexusCards.phase,actor=phase.eligible.find(id=>!phase.done.includes(id))!;
return {actor,action:{type:'nexusCardChoice',turn:phase.turn,card:game.nexusCards.cards!.hands[actor],choice:'keep',ownRedraws:0}}; return {actor,action:{type:'nexusCardChoice',turn:phase.turn,card:game.nexusCards.cards!.hands[actor],choice:'keep',ownRedraws:0}};
} }
if(game.pendingTreacheryDiscard?.reaction) {
for(const player of game.players) {
const action=botSemutaActions(viewGame(game,player.id))[0];
if(action) return {actor:player.id,action};
}
throw new Error('The original Semuta reaction has no legal acknowledgement.');
}
if(game.pendingTreacheryDiscard) return {actor:game.players[0].id,action:{type:'advanceBots'}}; if(game.pendingTreacheryDiscard) return {actor:game.players[0].id,action:{type:'advanceBots'}};
if(game.response) return {actor:game.players.find(p=>!game.response!.passed.includes(p.id))!.id,action:{type:'passResponse'}}; if(game.response) return {actor:game.players.find(p=>!game.response!.passed.includes(p.id))!.id,action:{type:'passResponse'}};
if(game.phaseOpening) return {actor:game.players.find(p=>!game.phaseOpening!.passed.includes(p.id))!.id,action:{type:'ready'}}; if(game.phaseOpening) return {actor:game.players.find(p=>!game.phaseOpening!.passed.includes(p.id))!.id,action:{type:'ready'}};