Connect Basic Revival gift and arrival continuations
Verify and publish checkpoint container / container (push) Successful in 11m37s

This commit is contained in:
Quintine committed 2026-11-16 16:52:13 +11:00
1 parent 6acf2c200c
commit 2cea251afd
10 files changed
+520 -6

No files matched your search

+14
View File
@@ -2,6 +2,20 @@
Checked 2026-09-07 for classic GF9 Dune and CHOAM & Richese; preview policy and source-aware Nexus cost boundary updated 30 September 2026. This supplements [CHOAM_KULL_DESIGN.md](CHOAM_KULL_DESIGN.md), [native CHOAM Cunning](NEXUS_CHOAM_RULES.md) and the Kull section of [CHOAM_REMAINING_RULES.md](CHOAM_REMAINING_RULES.md). The source audit itself did not change runtime behavior; later opt-in development implementations follow the explicit selections below. This update does not claim a newly fetched publisher ruling. Checked 2026-09-07 for classic GF9 Dune and CHOAM & Richese; preview policy and source-aware Nexus cost boundary updated 30 September 2026. This supplements [CHOAM_KULL_DESIGN.md](CHOAM_KULL_DESIGN.md), [native CHOAM Cunning](NEXUS_CHOAM_RULES.md) and the Kull section of [CHOAM_REMAINING_RULES.md](CHOAM_REMAINING_RULES.md). The source audit itself did not change runtime behavior; later opt-in development implementations follow the explicit selections below. This update does not claim a newly fetched publisher ruling.
## Basic Richese gift cancellation — 16 November 2026
**Prototyped / Partial.** In a supported Basic Richese/CHOAM/Ix game, CHOAM
may use printed Kull against a Karama attempting to prevent Richese's allied
gift. The same native gift quote and physical reservation remain in force.
Kull success or a distinct counter may offer the fresh cost to Semuta; claim or
pass resumes the original gift response and any later action once. Declining
Kull resumes the attempted cancellation. The existing neutral response and
provisional Kull timing are unchanged; this is not a new publisher ruling.
Focused genuine-start scenarios cover success, decline, counter and Semuta
claim/pass with conserved staged cards and a real alliance. Other nested gift
parents, optional combinations, full games and deployed acceptance remain open.
## Basic printed Kull with Leader Skills — 16 November 2026 ## Basic printed Kull with Leader Skills — 16 November 2026
**Prototyped / Partial.** A supported fresh Basic CHOAM game with selected Ix **Prototyped / Partial.** A supported fresh Basic CHOAM game with selected Ix
+23
View File
@@ -17,6 +17,29 @@ open mode gates.
## Current checkpoint and work ## Current checkpoint and work
**Basic Richese reveal during CHOAM free Revival — 16 November. Prototyped /
Partial.** Supported voluntary reveals retain the original force request and
CHOAM Allow/La La La decision. A Richese recipient reveals from current reserves
before any revived counters return. Other pending parents, optional modules and
deployed acceptance remain open.
[Scope](RICHESE_NO_FIELD_RULES.md#basic-reveal-during-choam-free-revival--16-november-2026).
**Basic Kull/Skills Ambassador and Terror overlap — 16 November. Prototyped /
Partial.** Ordinary entry retains both original reactions in provisional storm
order, including the native Guild Ambassador's child shipment. Printed and Nexus
Kull, independent Ecaz cards and all four legal bot profiles have focused
coverage. Other nested arrivals and deployed acceptance remain open.
[Scope](ECAZ_AMBASSADORS_RULES.md#basic-kullskills-overlapping-entry--16-november-2026).
**Basic Kull against Richese gift cancellation — 16 November. Prototyped /
Partial.** Printed Kull can interrupt the original Karama attempt, and its fresh
cost or distinct counter can offer Semuta while preserving the physical gift
and its existing response. Wider parents and deployed acceptance remain open.
[Scope](CHOAM_KULL_SOURCE_UPDATE.md#basic-richese-gift-cancellation--16-november-2026).
Nine related unit files pass 119 cases; these focused results do not certify
complete modes or full rules combinations.
**Basic Kull/Skills Semuta continuations — 16 November. Prototyped / Partial.** **Basic Kull/Skills Semuta continuations — 16 November. Prototyped / Partial.**
Supported printed and Nexus Kull games now offer Semuta after clean Ixian and Supported printed and Nexus Kull games now offer Semuta after clean Ixian and
CHOAM Ambassador discards, including Fremen worm arrivals; clean Terror discards CHOAM Ambassador discards, including Fremen worm arrivals; clean Terror discards
+16
View File
@@ -2,6 +2,22 @@
Audit: 2026-09-06. Scope: ambassador inventory, setup, placement, triggering, effects, and necessary continuation boundaries. This is a developer audit, not complete Ecaz support. Only this document was written. Audit: 2026-09-06. Scope: ambassador inventory, setup, placement, triggering, effects, and necessary continuation boundaries. This is a developer audit, not complete Ecaz support. Only this document was written.
## Basic Kull/Skills overlapping entry — 16 November 2026
**Prototyped / Partial.** Supported Basic printed and Nexus Kull games with
Leader Skills may use the existing Ecaz/Moritani ordered entry when an entrant
reaches both an Ambassador and a Terror token. The original provisional storm
order is unchanged. A Guild Ambassador's child shipment keeps its own Terror
opportunity; afterward the original entry finishes any remaining reaction and
the entrant continues once. A consumed token is not offered a second time.
Optional independent Ecaz cards retain their original inventory.
Genuine public-start tests cover both original orders, child reveal/decline,
all four legal bot profiles and the original shipment. Token locations and
unopened order are staged. Other nested arrivals, module combinations, full
games and deployed acceptance remain open; this does not establish a publisher
priority ruling.
## Placed Hidden Mobile Stronghold — 24 October 2026 ## Placed Hidden Mobile Stronghold — 24 October 2026
The source permission now composes with the actual placed HMS in Basic and The source permission now composes with the actual placed HMS in Basic and
+16
View File
@@ -2,6 +2,22 @@
Audit date: 2026-09-06. This document distinguishes the printed token lifecycle from engine integration and unresolved combinations. It does not certify Richese, Homeworlds, or any other gated game mode. Audit date: 2026-09-06. This document distinguishes the printed token lifecycle from engine integration and unresolved combinations. It does not certify Richese, Homeworlds, or any other gated game mode.
## Basic reveal during CHOAM free Revival — 16 November 2026
**Prototyped / Partial.** In supported Basic games Richese may reveal its
deployed No-Field while CHOAM considers another player's committed free force
Revival. The existing original Revival quote is checked first; CHOAM retains the
same Allow or La La La decision and the original force return or prevention
resolves once. Richese may itself be the recipient. The marker materializes
using reserves available at the chosen reveal, before any later revived forces
return. This online ordering applies the printed before-Battle permission and
is not a separate publisher timing ruling.
The focused public-start test covers Richese and Atreides recipients, both
CHOAM decisions and all four legal bot profiles with conserved staged casualties
and card locations. Other pending Revival parents, optional modules, full games
and deployed acceptance remain open.
## Basic reveal with public deals — 16 November 2026 ## Basic reveal with public deals — 16 November 2026
**Prototyped / Partial.** An active public agreement no longer independently **Prototyped / Partial.** An active public agreement no longer independently
+14 -2
View File
@@ -7294,6 +7294,7 @@ function kullSemutaParentSupported(g: Game, frame?: NonNullable<Game['pendingKul
let guildSupported = false; let guildSupported = false;
let saleSupported = false; let saleSupported = false;
let marketSupported = false; let marketSupported = false;
let giftSupported = false;
if (nativeResponse && frame && use?.kind === 'cancel') { if (nativeResponse && frame && use?.kind === 'cancel') {
// Success has just installed this very Kull restriction. Validate the // Success has just installed this very Kull restriction. Validate the
// suspended source as it stood before that restriction, without changing // suspended source as it stood before that restriction, without changing
@@ -7305,6 +7306,11 @@ function kullSemutaParentSupported(g: Game, frame?: NonNullable<Game['pendingKul
revivalSupported = !!g.pendingRevival && semutaRevivalKaramaResponse(source, use.response, frame.owner); revivalSupported = !!g.pendingRevival && semutaRevivalKaramaResponse(source, use.response, frame.owner);
guildSupported = (!!g.pendingShipment || !!g.pendingGuildTransport) && guildSupported = (!!g.pendingShipment || !!g.pendingGuildTransport) &&
semutaGuildShipmentKaramaResponse(source, use.response); semutaGuildShipmentKaramaResponse(source, use.response);
if (g.pendingRicheseGift && use.response.kind === 'richeseGift' &&
semutaRicheseKaramaResponse(source, use.response)) {
validateKaramaUse(source, getPlayer(source, frame.owner), use);
giftSupported = true;
}
if (g.pendingChoamMarketGhola && semutaMarketGholaIncome(source, use.response)) { if (g.pendingChoamMarketGhola && semutaMarketGholaIncome(source, use.response)) {
validateKaramaUse(source, getPlayer(source, frame.owner), use); validateKaramaUse(source, getPlayer(source, frame.owner), use);
marketSupported = true; marketSupported = true;
@@ -7336,7 +7342,7 @@ function kullSemutaParentSupported(g: Game, frame?: NonNullable<Game['pendingKul
use?.kind === 'cancel' && ['voice', 'prescience'].includes(use.response.kind) && use?.kind === 'cancel' && ['voice', 'prescience'].includes(use.response.kind) &&
JSON.stringify(use.response) === JSON.stringify(frame.resume.response) && JSON.stringify(use.response) === JSON.stringify(frame.resume.response) &&
!frame.resume.decision && !frame.resume.pendingKarama && !frame.resume.phaseOpening; !frame.resume.decision && !frame.resume.pendingKarama && !frame.resume.phaseOpening;
return battleSupported && !g.truthtrance && !g.pendingRicheseGift && !g.pendingNullentropy && return battleSupported && !g.truthtrance && (!g.pendingRicheseGift || giftSupported) && !g.pendingNullentropy &&
!g.pendingAmbassador && (!g.pendingIxAlly || saleSupported && use?.kind === 'cancel' && !g.pendingAmbassador && (!g.pendingIxAlly || saleSupported && use?.kind === 'cancel' &&
use.response.kind === 'ixAllyCard') && (!g.pendingRevival || revivalSupported) && use.response.kind === 'ixAllyCard') && (!g.pendingRevival || revivalSupported) &&
(!g.pendingShipment || guildSupported) && (!g.pendingGuildTransport || guildSupported) && (!g.pendingShipment || guildSupported) && (!g.pendingGuildTransport || guildSupported) &&
@@ -8345,6 +8351,10 @@ function treacheryDiscardIntegrity(g: Game) {
(continuation?.kind === 'karamaNoFieldDiscard' && continuation.use.response.source === 'ambassadorNoField') || (continuation?.kind === 'karamaNoFieldDiscard' && continuation.use.response.source === 'ambassadorNoField') ||
((continuation?.kind === 'karamaAdvisorFlipDiscard' || continuation?.kind === 'karamaTerminalDiscard') && ((continuation?.kind === 'karamaAdvisorFlipDiscard' || continuation?.kind === 'karamaTerminalDiscard') &&
semutaAdvisorAmbassadorParent(g,continuation.use.response)); semutaAdvisorAmbassadorParent(g,continuation.use.response));
const kullGift = (continuation?.kind === 'kullSuccessDiscard' || continuation?.kind === 'kullCounterDiscard') &&
continuation.frame.intent.kind === 'ordinary' && continuation.frame.intent.use.kind === 'cancel' &&
continuation.frame.intent.use.response.kind === 'richeseGift' &&
kullSemutaParentSupported(kullSource(g, continuation.frame), continuation.frame);
requireRule( requireRule(
(g.status === 'playing' || (truth && g.status === 'setup')) && (g.status === 'playing' || (truth && g.status === 'setup')) &&
pending.sequence === sequence && pending.sequence === sequence &&
@@ -8358,7 +8368,7 @@ function treacheryDiscardIntegrity(g: Game) {
!g.decision && !g.decision &&
!g.truthtrance && !g.truthtrance &&
!g.phaseOpening && !g.phaseOpening &&
(!g.pendingRicheseGift || box || truth || continuation?.kind === 'karamaRicheseGiftDiscard') && (!g.pendingRicheseGift || box || truth || kullGift || continuation?.kind === 'karamaRicheseGiftDiscard') &&
!g.pendingKarama && !g.pendingKarama &&
(!g.pendingNullentropy || continuation?.kind === 'karamaRicheseGiftDiscard') && (!g.pendingNullentropy || continuation?.kind === 'karamaRicheseGiftDiscard') &&
(!g.pendingAmbassador || box || truth || ambassadorTerror || ambassadorCost || continuation?.kind === 'karamaRicheseGiftDiscard') && (!g.pendingAmbassador || box || truth || ambassadorTerror || ambassadorCost || continuation?.kind === 'karamaRicheseGiftDiscard') &&
@@ -25671,6 +25681,8 @@ function ambassadorEffectBlock(
function bareBasicNativeArrivalOverlap(g: Game): boolean { function bareBasicNativeArrivalOverlap(g: Game): boolean {
// Native Basic faction decks share the same ordered arrival queue. A deck // Native Basic faction decks share the same ordered arrival queue. A deck
// selection alone is not an optional phase module or a new arrival effect. // selection alone is not an optional phase module or a new arrival effect.
if (byFaction(g, 'ecaz') && byFaction(g, 'moritani') &&
(basicKullLeaderSkillsProfile(g) || nexusKullLeaderSkillsProfile(g))) return true;
return !g.advanced && selectedPhaseModuleRoster(g) && !!byFaction(g, 'ecaz') && !!byFaction(g, 'moritani') && return !g.advanced && selectedPhaseModuleRoster(g) && !!byFaction(g, 'ecaz') && !!byFaction(g, 'moritani') &&
!g.homeworlds && !g.nexusCards && !g.leaderSkills && !g.techTokens && !g.strongholdCards && !g.homeworlds && !g.nexusCards && !g.leaderSkills && !g.techTokens && !g.strongholdCards &&
!g.discoveryEnabled && !g.discoveries && !g.discoveryStash && !g.greatMaker && !g.discoveryEnabled && !g.discoveries && !g.discoveryStash && !g.greatMaker &&
+3 -2
View File
@@ -1132,6 +1132,7 @@ export const RULE_TOPICS: RuleTopic[] = [
'Richese has three No-Fields, numbered zero, three and five. A concealed token counts as one force. Only one may be deployed on Arrakis, and consecutive own or allied shipments cannot use the same token.', 'Richese has three No-Fields, numbered zero, three and five. A concealed token counts as one force. Only one may be deployed on Arrakis, and consecutive own or allied shipments cannot use the same token.',
'In Basic play, your own single concealed No-Field may provisionally ship into an ally’s territory if it can legally enter; move it and any paid accompanying forces out before your turn ends. Paid companions require the High Richese Homeworld power. If the marker remains, reveal it and send its newly materialized forces to Tanks under the provisional no-departure policy. A zero marker reveals but contributes no casualties. Existing physical forces and the ally are not part of that new-visitor loss. Paired markers keep their separate guards.', 'In Basic play, your own single concealed No-Field may provisionally ship into an ally’s territory if it can legally enter; move it and any paid accompanying forces out before your turn ends. Paid companions require the High Richese Homeworld power. If the marker remains, reveal it and send its newly materialized forces to Tanks under the provisional no-departure policy. A zero marker reveals but contributes no casualties. Existing physical forces and the ally are not part of that new-visitor loss. Paired markers keep their separate guards.',
'A normal No-Field shipment pays the one-force price. The concealed token moves like a force. Before Battle, Richese may reveal it voluntarily; a token involved in battle is revealed with the Battle Plan. Revelation brings the indicated forces from reserves, limited by what remains there.', 'A normal No-Field shipment pays the one-force price. The concealed token moves like a force. Before Battle, Richese may reveal it voluntarily; a token involved in battle is revealed with the Battle Plan. Revelation brings the indicated forces from reserves, limited by what remains there.',
'In supported Basic games the voluntary reveal can also occur while CHOAM decides whether to prevent an already-declared free Revival. Reveal uses current reserves; the original Revival and CHOAM decision then continue once.',
'In supported Basic native games, voluntary revelation is also available during an Ix phase opening or selected auction and market decisions without replacing that decision. Other interruption windows remain unfinished.', 'In supported Basic native games, voluntary revelation is also available during an Ix phase opening or selected auction and market decisions without replacing that decision. Other interruption windows remain unfinished.',
'In supported Basic games, your voluntary reveal can also interrupt a clean Emperor allied spice gift or extra-revival response, Tleilaxu revival-income response, Atreides Movement-phase Spice forecast without Bene Gesserit, or Guild’s own ordinary reserve-shipment rate response when the shipment enters a different territory from the marker. If Richese receives the extra revival, reveal from current reserves before that return. The original response and payment continue once; other interruptions remain guarded.', 'In supported Basic games, your voluntary reveal can also interrupt a clean Emperor allied spice gift or extra-revival response, Tleilaxu revival-income response, Atreides Movement-phase Spice forecast without Bene Gesserit, or Guild’s own ordinary reserve-shipment rate response when the shipment enters a different territory from the marker. If Richese receives the extra revival, reveal from current reserves before that return. The original response and payment continue once; other interruptions remain guarded.',
'An active public agreement does not by itself prevent a supported reveal. Existing current-turn travel and other binding commitments still retain their separate safeguards, and a reveal does not settle or cancel a payment.', 'An active public agreement does not by itself prevent a supported reveal. Existing current-turn travel and other binding commitments still retain their separate safeguards, and a reveal does not settle or cancel a payment.',
@@ -1737,7 +1738,7 @@ export const RULE_TOPICS: RuleTopic[] = [
'Unallied Ecaz may propose an alliance to an unallied entrant. Acceptance activates alliance abilities immediately. Basic then offers an optional Duke loan; Advanced automatically adds an available Duke under supplied PDF p30, without another acknowledgement. The first version releases a surviving loan after one battle, provisionally; an unused living loan is set aside at turn end. Unavailable Duke never prevents consent.', 'Unallied Ecaz may propose an alliance to an unallied entrant. Acceptance activates alliance abilities immediately. Basic then offers an optional Duke loan; Advanced automatically adds an available Duke under supplied PDF p30, without another acknowledgement. The first version releases a surviving loan after one battle, provisionally; an unused living loan is set aside at turn end. Unavailable Duke never prevents consent.',
'In Advanced games with Harkonnen, a public capture that could have involved Duke makes the direct grant and automatic loan unavailable, regardless of which leader was secretly captured. A public event establishing the actual Duke, such as a revealed ordinary Duke battle, named revival or logged occupied-Ecaz displacement of an ordinary grant, clears this uncertainty; a later possible capture can restore it. An older game without the record can also establish clear history through public first-turn pre-battle state; later or ambiguous history remains guarded until a supported resolution. This provisional restriction protects the hidden captive identity and may prevent an otherwise legal grant.', 'In Advanced games with Harkonnen, a public capture that could have involved Duke makes the direct grant and automatic loan unavailable, regardless of which leader was secretly captured. A public event establishing the actual Duke, such as a revealed ordinary Duke battle, named revival or logged occupied-Ecaz displacement of an ordinary grant, clears this uncertainty; a later possible capture can restore it. An older game without the record can also establish clear history through public first-turn pre-battle state; later or ambiguous history remains guarded until a supported resolution. This provisional restriction protects the hidden captive identity and may prevent an otherwise legal grant.',
'When another eligible faction enters a marked stronghold, Ecaz may trigger its Ambassador for itself or its current ally, or leave it in place. Ecaz itself, its ally, advisors and the faction matching the physical Ambassador do not trigger it. Ordinary shipment and native Guild transport settle their own income, BG Intrusion and accompaniment controls before queued entry, without replaying payment or forces. Actual busy controls and unsupported paired or module combinations remain guarded.', 'When another eligible faction enters a marked stronghold, Ecaz may trigger its Ambassador for itself or its current ally, or leave it in place. Ecaz itself, its ally, advisors and the faction matching the physical Ambassador do not trigger it. Ordinary shipment and native Guild transport settle their own income, BG Intrusion and accompaniment controls before queued entry, without replaying payment or forces. Actual busy controls and unsupported paired or module combinations remain guarded.',
'In supported Basic games with Ecaz and Moritani, a single entry that earns both an Ambassador and Terror opportunity retains both in their existing provisional storm order, including selected native factions and the independent Ecaz cards. A Fremen relocation or Guild shipment from the Ambassador resolves its own child arrival before the original queue continues. If that child reveals the same Terror token, it cannot trigger again for the original entrant; if it is left hidden, the original opportunity remains. Unsupported module interactions remain guarded.', 'In supported Basic games with Ecaz and Moritani, a single entry that earns both an Ambassador and Terror opportunity retains both in their existing provisional storm order, including selected native factions, independent Ecaz cards and supported Kull/Leader Skills with or without Nexus. A Fremen relocation or Guild shipment from the Ambassador resolves its own child arrival before the original queue continues. If that child reveals the same Terror token, it cannot trigger again for the original entrant; if it is left hidden, the original opportunity remains. Unsupported module interactions remain guarded.',
'Supported Advanced games with both Ecaz and Moritani and other native faction decks also offer both entry reactions in provisional storm order. CHOAM may prevent an eligible move first; otherwise the move happens once before the token decisions. In the bare native profile, Fremen relocation and Guild shipment may create child arrivals before the original entry resumes. More deeply nested accompaniment and optional modules remain limited.', 'Supported Advanced games with both Ecaz and Moritani and other native faction decks also offer both entry reactions in provisional storm order. CHOAM may prevent an eligible move first; otherwise the move happens once before the token decisions. In the bare native profile, Fremen relocation and Guild shipment may create child arrivals before the original entry resumes. More deeply nested accompaniment and optional modules remain limited.',
'Accompaniment joining retained BG fighters creates a distinct eligible child entry before the original shipper. Declining the child leaves the live token for the original entry; consuming it does not create a token to offer again. Advisors remain exempt. This existing child-first, live-token composition is explicitly provisional, not a publisher priority ruling.', 'Accompaniment joining retained BG fighters creates a distinct eligible child entry before the original shipper. Declining the child leaves the live token for the original entry; consuming it does not create a token to offer again. Advisors remain exempt. This existing child-first, live-token composition is explicitly provisional, not a publisher priority ruling.',
'Emperor grants five bank spice. Atreides records the entrant’s current Treachery hand privately for the beneficiary; Harkonnen records one randomly selected held Traitor identity, or Face Dancer identity for a Tleilaxu entrant. These snapshots remain in the recipient’s private inspection history, identify when they were taken, and do not become a live view of later changes. Opening, enlarging or closing them needs no game acknowledgement.', 'Emperor grants five bank spice. Atreides records the entrant’s current Treachery hand privately for the beneficiary; Harkonnen records one randomly selected held Traitor identity, or Face Dancer identity for a Tleilaxu entrant. These snapshots remain in the recipient’s private inspection history, identify when they were taken, and do not become a live view of later changes. Opening, enlarging or closing them needs no game acknowledgement.',
@@ -4929,7 +4930,7 @@ export const RULE_TOPICS: RuleTopic[] = [
summary: 'React before a Karama is played; a distinct counter can stop Kull before its phase restriction begins.', summary: 'React before a Karama is played; a distinct counter can stop Kull before its phase restriction begins.',
steps: [ steps: [
'In a new supported Basic lobby with CHOAM and the CHOAM and Ix decks, printed Kull is enabled by default as a development preview. The host may turn it off to keep the broader non-Kull Truthtrance options. Basic supports Richese, Ixians, Tleilaxu, Ecaz, Moritani and classic factions with each seated faction’s deck, optionally with independent Ecaz Treachery Cards. The host may explicitly select Kull alongside Leader Skills, with or without those independent cards. Tech Tokens are separately supported with three to six CHOAM and classic factions; other optional modules are excluded. In an Advanced preview lobby, the host may explicitly select printed Kull with CHOAM, classic factions and exactly the CHOAM and Ix decks, without optional modules. Advanced supports Bene Gesserit substitutions and legal special powers. Both previews withhold some structured questions and defer unfunded non-CHOAM Karama-dependent bids. Existing games are not retrofitted, and this warning does not certify complete rules.', 'In a new supported Basic lobby with CHOAM and the CHOAM and Ix decks, printed Kull is enabled by default as a development preview. The host may turn it off to keep the broader non-Kull Truthtrance options. Basic supports Richese, Ixians, Tleilaxu, Ecaz, Moritani and classic factions with each seated faction’s deck, optionally with independent Ecaz Treachery Cards. The host may explicitly select Kull alongside Leader Skills, with or without those independent cards. Tech Tokens are separately supported with three to six CHOAM and classic factions; other optional modules are excluded. In an Advanced preview lobby, the host may explicitly select printed Kull with CHOAM, classic factions and exactly the CHOAM and Ix decks, without optional modules. Advanced supports Bene Gesserit substitutions and legal special powers. Both previews withhold some structured questions and defer unfunded non-CHOAM Karama-dependent bids. Existing games are not retrofitted, and this warning does not certify complete rules.',
'In supported Basic games with independent Ecaz Treachery Cards and Richese, Semuta may claim the discarded successful Kull, a distinct Karama counter, or the original shipment Karama when Kull declines. The original attempt continues under its existing rules; other nested reactions remain incomplete.', 'In supported Basic games with Richese, Kull can interrupt a Karama attempting to cancel Richese’s allied gift. A successful Kull or distinct counter can offer its own discarded card to Semuta before the original gift response continues. In supported independent Ecaz-card games Semuta can also claim the original shipment Karama when Kull declines. Other nested reactions remain incomplete.',
'In the supported Basic printed Kull preview, simple and mixed current-lot ordinary bid, phase-wide bid, ordinary bribe, Revival and alliance questions are available, including with Richese and Semuta. Combined turn-action questions are also available in supported profiles. Some structured questions remain unavailable when Tech Tokens are selected. A pending Kull response holds their controls while the original transaction resolves; some Karama uses remain guarded. Kull and Semuta also retain a paid ordinary or cache sale when Karama targets Harkonnen’s bonus or Emperor income, and an ordinary sale when it targets an Ixian ally’s replacement. Wider interactions remain incomplete.', 'In the supported Basic printed Kull preview, simple and mixed current-lot ordinary bid, phase-wide bid, ordinary bribe, Revival and alliance questions are available, including with Richese and Semuta. Combined turn-action questions are also available in supported profiles. Some structured questions remain unavailable when Tech Tokens are selected. A pending Kull response holds their controls while the original transaction resolves; some Karama uses remain guarded. Kull and Semuta also retain a paid ordinary or cache sale when Karama targets Harkonnen’s bonus or Emperor income, and an ordinary sale when it targets an Ixian ally’s replacement. Wider interactions remain incomplete.',
'Another player’s legal Karama cancellation, shipment-rate use, immediate auction purchase, winning-bid payment or supported special activation pauses before its card and other costs. CHOAM sees the attempted player and purpose and may decline or choose a legal held Kull Wahad. Each Use names its printed source explicitly. The separate Nexus Kull guide covers additional Cunning costs in its new profile only. The same public opportunity appears without Kull in hand, so waiting does not disclose hidden ownership. Invalid attempts never open this window; CHOAM does not receive a self-targeted Kull offer.', 'Another player’s legal Karama cancellation, shipment-rate use, immediate auction purchase, winning-bid payment or supported special activation pauses before its card and other costs. CHOAM sees the attempted player and purpose and may decline or choose a legal held Kull Wahad. Each Use names its printed source explicitly. The separate Nexus Kull guide covers additional Cunning costs in its new profile only. The same public opportunity appears without Kull in hand, so waiting does not disclose hidden ownership. Invalid attempts never open this window; CHOAM does not receive a self-targeted Kull offer.',
'Decline resumes the original attempt once. Declaring Kull opens the ordinary CHOAM-effect response. Kull is still pending: its target may counter with a different eligible physical Karama before any phase ban applies. The interrupted card stays reserved and cannot serve as its own counter. Other eligible responders use their existing response controls.', 'Decline resumes the original attempt once. Declaring Kull opens the ordinary CHOAM-effect response. Kull is still pending: its target may counter with a different eligible physical Karama before any phase ban applies. The interrupted card stays reserved and cannot serve as its own counter. Other eligible responders use their existing response controls.',
+16 -2
View File
@@ -2,6 +2,7 @@ import type { Game } from './engine';
import { validateFremenRevivalGrant } from './fremen-revival-grant'; import { validateFremenRevivalGrant } from './fremen-revival-grant';
import { richeseRevealForeignMovementPending } from './richese-reveal-foreign-movement'; import { richeseRevealForeignMovementPending } from './richese-reveal-foreign-movement';
import { eliteRevivalRemaining, paidForceRevivalCost, revivalPrevented } from './revival'; import { eliteRevivalRemaining, paidForceRevivalCost, revivalPrevented } from './revival';
import { quoteRevivalResume, RevivalResumeError } from './revival-resume';
const factions = new Set([ const factions = new Set([
'atreides', 'beneGesserit', 'emperor', 'fremen', 'guild', 'harkonnen', 'atreides', 'beneGesserit', 'emperor', 'fremen', 'guild', 'harkonnen',
@@ -55,8 +56,21 @@ export function richeseRevealInterruptSupported(g: Game): boolean {
// Each other pending field is an active child/continuation, not a completed // Each other pending field is an active child/continuation, not a completed
// receipt. Empty pending arrays do not represent a live child. // receipt. Empty pending arrays do not represent a live child.
const foreignMovement = richeseRevealForeignMovementPending(g); const foreignMovement = richeseRevealForeignMovementPending(g);
const revival = g.pendingRevival, decision = g.decision;
let choamRevival = false;
if (g.phase === 4 && decision?.kind === 'choamFreeRevival' &&
Object.keys(decision).sort().join(',') === 'kind,player,recipient' &&
g.players.some(player => player.id === decision.player && player.faction === 'choam') &&
revival?.kind === 'forces' && revival.player === decision.recipient &&
decision.player !== revival.player && revival.free > 0 && !revival.emperorExtra &&
!revival.nexusEmperorEvent && !g.response && !g.phaseOpening && !g.choamMarket) {
try { quoteRevivalResume(g, 'stop'); choamRevival = true; }
catch (error) {
if (!(error instanceof RevivalResumeError)) throw error;
}
}
if (Object.entries(g).some(([key, value]) => key.startsWith('pending') && if (Object.entries(g).some(([key, value]) => key.startsWith('pending') &&
!(key === 'pendingShipment' && guildRate) && key !== foreignMovement && !(key === 'pendingShipment' && guildRate) && !(key === 'pendingRevival' && choamRevival) && key !== foreignMovement &&
(Array.isArray(value) ? value.length > 0 : value !== null && value !== undefined && value !== false))) return false; (Array.isArray(value) ? value.length > 0 : value !== null && value !== undefined && value !== false))) return false;
const live = (rows: readonly {turn: number; fulfilled?: boolean; released?: boolean}[] | undefined) => const live = (rows: readonly {turn: number; fulfilled?: boolean; released?: boolean}[] | undefined) =>
@@ -154,8 +168,8 @@ export function richeseRevealInterruptSupported(g: Game): boolean {
} }
if (g.phaseOpening) if (g.phaseOpening)
return g.expansions.includes('ix') && !!g.amalWindowOpen && !g.decision && !g.choamMarket; return g.expansions.includes('ix') && !!g.amalWindowOpen && !g.decision && !g.choamMarket;
const decision = g.decision;
if (!decision) return false; if (!decision) return false;
if (decision.kind === 'choamFreeRevival') return choamRevival;
if (decision.kind === 'auctionPayment') if (decision.kind === 'auctionPayment')
return g.phase === 3 && !!g.auction && g.auction.bidder === decision.player && !g.richeseAuction && !g.choamMarket; return g.phase === 3 && !!g.auction && g.auction.bidder === decision.player && !g.richeseAuction && !g.choamMarket;
if (decision.kind === 'richeseDeclaration' || decision.kind === 'richeseCacheTerms' || if (decision.kind === 'richeseDeclaration' || decision.kind === 'richeseCacheTerms' ||
+133
View File
@@ -0,0 +1,133 @@
import assert from 'node:assert/strict';
import test from 'node:test';
import { applyAction, createGame, joinGame, newPlayer, normalizeAutomaticGame, viewGame, type Action, type Game } from '../game/engine';
import { SEMUTA_DRUG_ID } from '../game/semuta-drug';
import { botActions } from '../game/bots';
import { DIFFICULTIES } from '../game/bot-profiles';
import { takeKullCard } from './fixture-choam-kull';
import { beforeIxSpiceDraw, orderIxSpiceCards } from './fixture-ix-spice-cards';
import { advanceSemutaNexusTrade as advance } from './fixture-semuta-nexus-trade';
const act = (g: Game, actor: string, action: Action) => applyAction(g, actor, action);
function seat(g: Game, id: string) { const player = g.players.find(p => p.id === id); assert.ok(player); return player; }
const clean = (g: Game) => !g.response && !g.phaseOpening && !g.decision && !g.truthtrance && !g.pendingTreacheryDiscard;
function inventory(g: Game) {
const cards = [...g.deck, ...g.discard, ...(g.richeseCache ?? []), ...(g.richeseRemoved ?? []),
...(g.auction?.cards.slice(g.auction.index) ?? []), ...(g.ixAuction?.cards ?? []),
...g.players.flatMap(p => p.hand)].map(card => card.id).sort();
assert.equal(new Set(cards).size, cards.length); return cards;
}
/** Genuine Basic public setup and a real Nexus alliance. Only unopened Spice
* order and conserved held Treachery Card locations are staged. */
function fixture() {
let g = createGame('KULLRICHESEGIFT', newPlayer('r', 'Richese', 'richese'), false, ['choam', 'ix']);
for (const faction of ['choam', 'atreides', 'emperor'] as const) joinGame(g, newPlayer(faction, faction, faction));
for (const p of g.players) g = act(g, p.id, { type: 'ready' });
g = act(g, 'r', { type: 'start' });
assert.equal(g.kullPreview, true); assert.equal(g.semutaPreview, true);
g = advance(g, state => state.status === 'playing');
const originalCards = inventory(g);
// Prevent an incidental stronghold victory during the actual turn-one path.
for (const player of g.players) {
player.reserves += Object.values(player.forces).reduce((sum, n) => sum + n, 0);
player.forces = {};
}
// Keep the two selected Richese cards in their original cache until staging.
for (const id of [SEMUTA_DRUG_ID, 'richese-distrans']) {
const index = g.richeseCache!.findIndex(card => card.id === id); assert.ok(index >= 0);
g.richeseCache!.push(g.richeseCache!.splice(index, 1)[0]);
}
g = advance(g, beforeIxSpiceDraw); orderIxSpiceCards(g, ['land', 'land']);
g = advance(g, state => state.turn === 2 && beforeIxSpiceDraw(state));
orderIxSpiceCards(g, ['worm', 'land', 'land']);
g = advance(g, state => !!state.nexus && !state.spiceWindow && clean(state));
g = act(g, 'r', { type: 'alliance', target: 'emperor' });
g = act(g, 'emperor', { type: 'alliance', target: 'r' });
g = advance(g, state => state.turn === 2 && state.phase === 2 && clean(state));
for (const p of g.players) g.deck.push(...p.hand.splice(0));
seat(g, 'choam').hand.push(takeKullCard(g, 'ix-kull-wahad'));
const karama = takeKullCard(g, 'karama'); seat(g, 'atreides').hand.push(karama);
const counter = takeKullCard(g, 'karama'); seat(g, 'emperor').hand.push(counter);
const semuta = takeKullCard(g, SEMUTA_DRUG_ID); seat(g, 'r').hand.push(semuta);
const gift = takeKullCard(g, 'richese-distrans'); seat(g, 'r').hand.push(gift);
assert.deepEqual(inventory(g), originalCards);
const beforeGift = structuredClone(g);
g = act(g, 'r', { type: 'richeseGift', card: gift.id });
assert.equal(g.response?.kind, 'richeseGift');
g = act(g, 'atreides', { type: 'card', mode: 'cancel', card: karama.id });
assert.ok(g.pendingKull, 'The original cancellation must open the neutral Kull opportunity');
return { g, gift: gift.id, karama: karama.id, counter: counter.id,
kull: 'ix-kull-wahad', semuta: semuta.id, beforeGift, originalCards };
}
function resolveSemuta(g: Game, claim: boolean) {
const pending = g.pendingTreacheryDiscard; assert.ok(pending?.reaction?.stage === 'offer');
const event = pending.batch.event;
if (claim && seat(g, 'r').hand.some(card => card.id === SEMUTA_DRUG_ID)) {
g = act(g, 'r', { type: 'semutaCommit', event });
if (g.pendingTreacheryDiscard?.reaction?.stage === 'select')
g = act(g, 'r', { type: 'semutaSelect', event, card: pending.batch.entries[0].card.id });
} else {
for (const player of g.players) {
if (g.pendingTreacheryDiscard?.batch.event !== event) break;
g = act(g, player.id, { type: 'semutaPass', event });
}
}
assert.notEqual(g.pendingTreacheryDiscard?.batch.event, event);
return g;
}
function allowKull(g: Game) {
for (let n = 0; g.pendingKull && !g.pendingTreacheryDiscard && n < 20; n++) {
const response = g.response;
if (!response) { g = normalizeAutomaticGame(g); continue; }
const actor = g.players.find(p => !response.passed.includes(p.id)); assert.ok(actor);
g = act(g, actor.id, { type: 'passResponse' });
}
return g;
}
for (const result of ['decline', 'success', 'counter'] as const) for (const claim of [false, true]) void test(
`Basic Kull ${result} during a Richese gift retains Semuta ${claim ? 'claim' : 'pass'} and gift continuation`, () => {
const f = fixture(); let g = f.g;
const event = g.pendingKull!.event, offered = viewGame(g, 'choam').kullReaction;
assert.ok(offered?.plays.some(play => play.source === 'printed' && play.card.id === f.kull));
if (result === 'success' && !claim) for (const difficulty of DIFFICULTIES) {
const view = viewGame(g, 'choam'); view.players.find(p => p.id === 'choam')!.bot = difficulty;
const action = botActions(view).find(row => row.type === 'kullDecision'); assert.ok(action);
assert.doesNotThrow(() => act(g, 'choam', action), difficulty);
}
g = act(g, 'choam', result === 'decline' ? { type: 'kullDecision', event, decline: true }
: { type: 'kullDecision', event, source: 'printed', card: f.kull });
if (result === 'counter') {
assert.equal(g.response?.kind, 'choamWorthless');
g = act(g, 'emperor', { type: 'card', mode: 'cancel', card: f.counter });
} else if (result === 'success') g = allowKull(g);
for (let n = 0; n < 6 && (g.pendingTreacheryDiscard || g.pendingKull); n++) {
if (g.pendingTreacheryDiscard?.reaction) g = resolveSemuta(g, claim);
else if (g.pendingKull) g = allowKull(g);
else break;
}
assert.equal(g.pendingKull, null); assert.ok(!g.pendingTreacheryDiscard);
if (result === 'success') {
// Preventing one Karama does not consume the other players' original
// chance to respond to the still-pending Richese alliance gift.
assert.equal(g.response?.kind, 'richeseGift');
assert.equal(g.pendingRicheseGift?.intent.cardId, f.gift);
assert.ok(seat(g, 'r').hand.some(card => card.id === f.gift));
for (let n = 0; g.response?.kind === 'richeseGift' && n < g.players.length; n++) {
const response = g.response;
const actor = g.players.find(p => !response.passed.includes(p.id)); assert.ok(actor);
g = act(g, actor.id, { type: 'passResponse' });
}
assert.notEqual(g.response?.kind, 'richeseGift');
}
assert.equal(g.pendingRicheseGift, null); assert.deepEqual(inventory(g), f.originalCards);
const succeeded = result === 'success';
assert.equal(seat(g, 'emperor').hand.some(card => card.id === f.gift), succeeded);
assert.equal(seat(g, 'r').hand.some(card => card.id === f.gift), !succeeded);
assert.equal(seat(g, 'atreides').hand.some(card => card.id === f.karama), succeeded);
assert.equal(seat(g, 'choam').hand.some(card => card.id === f.kull), !succeeded);
assert.equal(g.turn, f.beforeGift.turn); assert.equal(g.phase, f.beforeGift.phase);
},
);
+124
View File
@@ -0,0 +1,124 @@
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 { placeAmbassador, validateAmbassadors } from '../game/ecaz-ambassadors';
import { placeTerror } from '../game/moritani-terror';
import { guildAmbassadorShipments } from '../game/guild-ambassador';
import { botActions } from '../game/bots';
import { DIFFICULTIES } from '../game/bot-profiles';
import { nextSemutaNexusTradeNativeStep } from './fixture-semuta-nexus-trade';
type First = 'ambassador' | 'terror';
const act = (g: Game, id: string, action: Action) => applyAction(g, id, action);
const seat = (g: Game, id: string) => { const p = g.players.find(row => row.id === id); assert.ok(p); return p; };
const clean = (g: Game) => !g.response && !g.phaseOpening && !g.decision && !g.truthtrance && !g.pendingTreacheryDiscard;
/** Genuine Basic public setup/training and entrant turn. Only one unopened
* Spice card, original Ambassador cohort and legal token locations are staged. */
function fixture(first: First, nexus: boolean, independent: boolean) {
let g = createGame('KULLSKILLSOVERLAP', newPlayer('ecaz', 'Ecaz', 'ecaz'), false, ['ix', 'choam', 'ecaz']);
for (const id of ['choam', 'tleilaxu', 'guild', 'moritani'] as const) joinGame(g, newPlayer(id, id, id));
g = act(g, 'guild', { type: 'seatPosition', position: 6 });
if (first === 'terror') g = act(g, 'moritani', { type: 'seatPosition', position: 4 });
g = act(g, 'ecaz', { type: 'seatPosition', position: first === 'ambassador' ? 4 : 5 });
g = act(g, 'choam', { type: 'seatPosition', position: 1 });
g = act(g, 'tleilaxu', { type: 'seatPosition', position: 2 });
for (const name of [...(nexus ? ['nexusCards'] : []), ...(independent ? ['ecazTreachery'] : []), 'leaderSkills', 'kullPreview'])
g = act(g, 'ecaz', { type: 'moduleOption', module: name, enabled: true });
for (const p of g.players) g = act(g, p.id, { type: 'ready' });
g = act(g, 'ecaz', { type: 'start' });
const reach = (until: (g: Game) => boolean) => {
for (let n = 0; n < 1800; n++) {
if (until(g)) return;
assert.notEqual(g.status, 'finished');
if (g.status === 'setup' && !g.setupStage && g.decision?.kind === 'moritaniSetup')
g = act(g, 'moritani', { type: 'decision', territory: 'oh_gap', sector: 9 });
else if (g.status === 'setup' && g.setupStage === 'forces' && seat(g, 'ecaz').reserves === 20)
g = act(g, 'ecaz', { type: 'ecazSetup', placements: { 'imperial_basin:9': 6 } });
else if (g.decision?.kind === 'ecazPlacement' && !g.response && !g.phaseOpening)
g = act(g, 'ecaz', { type: 'decision', decline: true });
else {
const next = nextSemutaNexusTradeNativeStep(g);
g = act(g, next.actor, next.action);
}
}
throw Error('Native play did not reach the entrant turn');
};
reach(state => state.status === 'playing');
assert.equal(g.leaderSkills?.assignments.length, g.players.length);
assert.equal(g.kullPreview, true); assert.equal(g.nexusKullPreview === true, nexus);
const spice = g.spiceDeck.findIndex(card => 'territory' in card && !card.discovery); assert.ok(spice >= 0);
g.spiceDeck.unshift(g.spiceDeck.splice(spice, 1)[0]);
reach(state => state.turn === 1 && state.phase === 5 && state.active === 'tleilaxu' && clean(state));
assert.equal(g.order.indexOf('ecaz') < g.order.indexOf('moritani'), first === 'ambassador');
const candidates = [{ territory: 'habbanya_ridge_sietch', sector: 17 }, { territory: 'sietch_tabr', sector: 14 }, { territory: 'arrakeen', sector: 10 }];
const target = candidates.find(row => row.sector !== g.storm); assert.ok(target);
const state = g.ecazAmbassadors!;
const token = state.tokens.find(row => row.effect === 'guild'); assert.ok(token);
if (token.zone === 'pool') {
const replaced = state.tokens.find(row => row.zone === 'supply' && row.effect !== 'ecaz'); assert.ok(replaced);
const index = state.cohort.indexOf(replaced.id); assert.ok(index >= 0);
state.cohort[index] = token.id; replaced.zone = 'pool'; token.zone = 'supply';
}
validateAmbassadors(state);
g.ecazAmbassadors = placeAmbassador(state, token.id, { turn: g.turn, availableSpice: seat(g, 'ecaz').spice,
destination: { id: target.territory, stronghold: true, inStorm: false, allowed: true } }).state;
const terror = g.moritaniTerror!.tokens.find(row => row.kind === 'robbery' && row.status === 'available'); assert.ok(terror);
g.moritaniTerror = placeTerror(g.moritaniTerror!, terror.id, target.territory, g.turn);
return { g, target, token: token.id, terror: terror.id };
}
for (const nexus of [false, true]) for (const independent of [false, true])
for (const first of ['ambassador', 'terror'] as const) for (const childReveal of [false, true])
void test(`Basic ${nexus ? 'Nexus' : 'printed'} Kull/Skills ${independent ? 'independent ' : ''}${first} first: Guild child ${childReveal ? 'reveals' : 'declines'} Terror`, () => {
const f = fixture(first, nexus, independent), before = structuredClone(f.g);
const destination = `${f.target.territory}:${f.target.sector}`;
const spice = seat(f.g, 'tleilaxu').spice, reserves = seat(f.g, 'ecaz').reserves;
let g = act(f.g, 'tleilaxu', { type: 'ship', territory: f.target.territory, sector: f.target.sector, amount: 1, elite: 0, allyPayment: 0 });
assert.deepEqual(f.g, before);
// A held Karama can open the ordinary Guild-income response before the
// already committed shipment's ordered entry reactions. Close that real
// response through the existing native driver, without changing the hand.
for (let n = 0; !g.pendingArrivalOverlap && n < 20; n++) {
assert.equal(g.response?.kind, 'guildIncome');
const next = nextSemutaNexusTradeNativeStep(g);
g = act(g, next.actor, next.action);
}
assert.equal(g.pendingArrivalOverlap?.first, first);
assert.equal(seat(g, 'tleilaxu').forces[destination], 1);
const overlap = g.pendingArrivalOverlap!.event;
if (first === 'terror') g = act(g, 'moritani', { type: 'decision', decline: true });
const entry = g.pendingAmbassador; assert.ok(entry); assert.equal(entry.token, f.token);
const ecazView = viewGame(g, 'ecaz'); assert.ok(ecazView.ambassadorEntry);
for (const difficulty of DIFFICULTIES) {
const view = viewGame(g, 'ecaz'); view.players.find(row => row.id === 'ecaz')!.bot = difficulty;
const action = botActions(view)[0]; assert.ok(action, difficulty); assert.doesNotThrow(() => act(g, 'ecaz', action));
}
g = act(g, 'ecaz', { type: 'decision', event: entry.event, trigger: true, beneficiary: 'ecaz' });
assert.equal(g.pendingAmbassador?.stage, 'ship');
const target = guildAmbassadorShipments(g, 'ecaz').destinations.find(row => row.territory === f.target.territory && row.sector === f.target.sector);
assert.ok(target);
g = act(g, 'ecaz', { type: 'decision', event: entry.event, amount: 1, elite: 0, territory: target.territory, sector: target.sector });
assert.equal(seat(g, 'ecaz').reserves, reserves - 1);
assert.equal(g.pendingArrivalOverlap?.event, overlap);
assert.equal(g.pendingTerrorEntry?.entrant, 'ecaz');
assert.equal(g.pendingTerrorEntry?.token, f.terror);
if (childReveal) {
g = act(g, 'moritani', { type: 'decision', reveal: true });
assert.equal(g.pendingTerrorEntry?.stage, 'robbery');
g = act(g, 'moritani', { type: 'decision', choice: 'spice' });
assert.equal(g.moritaniTerror!.tokens.find(row => row.id === f.terror)!.status, 'removed');
} else g = act(g, 'moritani', { type: 'decision', decline: true });
if (first === 'ambassador' && !childReveal) {
assert.equal(g.pendingTerrorEntry?.entrant, 'tleilaxu');
g = act(g, 'moritani', { type: 'decision', decline: true });
}
assert.equal(g.pendingArrivalOverlap, null); assert.equal(g.pendingAmbassador, null); assert.equal(g.pendingTerrorEntry, null);
assert.equal(seat(g, 'tleilaxu').forces[destination], 1);
assert.equal(seat(g, 'tleilaxu').spice, spice - 1);
assert.equal(seat(g, 'ecaz').forces[destination], 1);
assert.equal(g.ecazAmbassadors!.tokens.find(row => row.id === f.token)!.zone, 'used');
assert.equal(g.active, 'tleilaxu');
g = act(g, 'tleilaxu', { type: 'endMovement' });
assert.ok(!g.movementRemaining?.includes('tleilaxu'));
});
@@ -0,0 +1,161 @@
import assert from 'node:assert/strict';
import test from 'node:test';
import { botActions } from '../game/bots';
import { DIFFICULTIES } from '../game/bot-profiles';
import { createGame, joinGame, newPlayer, viewGame, type Action, type Game } from '../game/engine';
import { actTruthMovementNativeEarly as act, nextTruthMovementNativeEarlyStep } from './fixture-truth-movement-native-early';
import { truthMovementInventory as inventory } from './fixture-truth-movement';
const richese = 'richese', choam = 'choam', atreides = 'atreides';
function seat(g: Game, id: string) {
const p = g.players.find(row => row.id === id); assert.ok(p); return p;
}
const clean = (g: Game) => !g.response && !g.decision && !g.phaseOpening &&
!g.truthtrance && !g.pendingRevival && !g.pendingTreacheryDiscard;
function step(g: Game) {
if (g.turn === 1 && g.phase === 5 && g.active === richese && clean(g)) {
const p = seat(g, richese);
if (!p.shipped) {
const token = p.noField!.tokens.find(row => row.value === 3); assert.ok(token);
return {actor:richese, action:{type:'ship', noField:token.id, event:p.noFieldEvent,
territory:'polar_sink', sector:0, allyPayment:0} satisfies Action};
}
return {actor:richese, action:{type:'endMovement'} satisfies Action};
}
if (g.phase === 5 && g.active && clean(g))
return {actor:g.active, action:{type:'endMovement'} satisfies Action};
return nextTruthMovementNativeEarlyStep(g, {position:'first', method:'onceAround', direction:'clockwise'});
}
function reach(g: Game, until: (state: Game) => boolean): Game {
for (let i = 0; i < 2000; i++) {
if (until(g)) return g;
assert.notEqual(g.status, 'finished');
const next = step(g); assert.ok(next, `Supply a native action at ${g.turn}/${g.phase}/${g.decision?.kind}`);
g = act(g, next.actor, next.action);
}
throw Error('Native game did not reach its Revival control');
}
/** Genuine public Basic setup, real paid marker shipment and next-turn Revival.
* Only the original unopened Spice order, Worthless card location and selected
* recipient's physical casualty count are staged; each inventory is conserved. */
function source(recipient: string, oneReserve = false) {
let g = createGame('RICHESECHOAMREVIVAL', newPlayer(richese, 'Richese', 'richese'), false, ['choam']);
joinGame(g, newPlayer(choam, 'CHOAM', 'choam'));
joinGame(g, newPlayer(atreides, 'Atreides', 'atreides'));
for (const p of g.players) g = act(g, p.id, {type:'ready'});
g = act(g, g.host, {type:'start'});
g = reach(g, state => state.status === 'playing');
for (const position of [0, 1]) {
const from = g.spiceDeck.findIndex((card, index) => index >= position && 'territory' in card && !card.discovery);
assert.ok(from >= position);
[g.spiceDeck[position], g.spiceDeck[from]] = [g.spiceDeck[from], g.spiceDeck[position]];
}
g = reach(g, state => state.turn === 2 && state.phase === 4 && clean(state));
const owner = seat(g, richese), marker = owner.noField?.deployed, event = owner.noFieldEvent;
assert.ok(marker); assert.ok(event);
const p = seat(g, recipient); assert.ok(p.reserves >= 3);
p.reserves -= 3; p.tanks += 3;
if (oneReserve) {
assert.equal(recipient, richese); assert.ok(p.reserves > 1);
const staged = p.reserves - 1;
p.reserves -= staged;
p.forces['polar_sink:0'] = (p.forces['polar_sink:0'] ?? 0) + staged;
}
const physical = inventory(g);
const c = seat(g, choam);
if (!c.hand.some(card => card.name === 'La La La')) {
let card = g.deck.findIndex(row => row.name === 'La La La');
if (card >= 0) c.hand.push(g.deck.splice(card, 1)[0]);
else {
const holder = g.players.find(row => row.hand.some(held => held.name === 'La La La'));
if (holder) {
card = holder.hand.findIndex(held => held.name === 'La La La');
c.hand.push(holder.hand.splice(card, 1)[0]);
} else {
card = g.discard.findIndex(held => held.name === 'La La La'); assert.ok(card >= 0);
c.hand.push(g.discard.splice(card, 1)[0]);
}
}
}
assert.deepEqual(inventory(g), physical);
g = act(g, recipient, {type:'revive', amount:2, elite:0});
assert.ok(g.decision?.kind === 'choamFreeRevival');
assert.equal(g.decision.player, choam);
assert.equal(g.decision.recipient, recipient);
assert.equal(g.pendingRevival?.player, recipient);
return {g, token:marker.tokenId, event, physical};
}
for (const recipient of [richese, atreides]) for (const deny of [false, true]) void test(
`Richese reveal preserves ${recipient}'s free Revival while CHOAM ${deny ? 'plays La La La' : 'allows'}`, () => {
const {g, token, event, physical} = source(recipient), before = structuredClone(g);
const reserves = seat(g, richese).reserves, field = seat(g, richese).forces['polar_sink:0'] ?? 0;
const tanks = seat(g, recipient).tanks, revived = seat(g, recipient).revived;
assert.equal(viewGame(g, richese).richeseNoField?.canReveal, true);
let next = act(g, richese, {type:'revealNoField', token, event});
assert.deepEqual(g, before);
assert.deepEqual(next.decision, before.decision);
assert.deepEqual(next.pendingRevival, before.pendingRevival);
assert.equal(seat(next, richese).noField?.deployed, null);
assert.equal(seat(next, richese).reserves, reserves - 3);
assert.equal(seat(next, richese).forces['polar_sink:0'], field + 3);
assert.equal(seat(next, recipient).tanks, tanks);
if (deny) {
const card = seat(next, choam).hand.find(row => row.name === 'La La La'); assert.ok(card);
next = act(next, choam, {type:'card', mode:'choam', card:card.id});
} else next = act(next, choam, {type:'decision', decline:true});
for (let i = 0; (next.response || next.pendingTreacheryDiscard) && i < 40; i++) {
if (next.pendingTreacheryDiscard?.reaction) {
const reaction = next.pendingTreacheryDiscard.reaction;
assert.ok(reaction.stage === 'offer');
const p = next.players.find(row => !reaction.passed.includes(row.id)); assert.ok(p);
next = act(next, p.id, {type:'semutaPass', event:next.pendingTreacheryDiscard.batch.event});
} else if (next.response) {
const p = next.players.find(row => !next.response!.passed.includes(row.id)); assert.ok(p);
next = act(next, p.id, {type:'passResponse'});
} else break;
}
assert.equal(next.pendingRevival, null);
assert.equal(seat(next, recipient).tanks, tanks - (deny ? 0 : 2));
assert.equal(seat(next, recipient).revived, revived + (deny ? 0 : 2));
assert.equal(seat(next, richese).forces['polar_sink:0'], field + 3);
assert.deepEqual(inventory(next), physical);
},
);
void test('a three-marker uses the one current reserve before the pending free return adds two', () => {
const {g, token, event, physical} = source(richese, true), before = seat(g, richese);
const field = before.forces['polar_sink:0'] ?? 0, tanks = before.tanks, revived = before.revived;
const forceCount = (game: Game) => {
const player = seat(game, richese);
return player.reserves + player.tanks + Object.values(player.forces).reduce((sum, n) => sum + n, 0);
};
assert.equal(before.reserves, 1);
assert.equal(forceCount(g), 20);
const pending = structuredClone(g.pendingRevival);
let next = act(g, richese, {type:'revealNoField', token, event});
assert.equal(seat(next, richese).reserves, 0);
assert.equal(seat(next, richese).forces['polar_sink:0'], field + 1);
assert.equal(seat(next, richese).tanks, tanks);
assert.deepEqual(next.pendingRevival, pending);
assert.equal(forceCount(next), 20);
next = act(next, choam, {type:'decision', decline:true});
assert.equal(next.pendingRevival, null);
assert.equal(seat(next, richese).reserves, 2);
assert.equal(seat(next, richese).tanks, tanks - 2);
assert.equal(seat(next, richese).revived, revived + 2);
assert.equal(seat(next, richese).forces['polar_sink:0'], field + 1);
assert.equal(forceCount(next), 20);
assert.deepEqual(inventory(next), physical);
});
void test('all bot profiles can respond to the original CHOAM decision after a voluntary reveal', () => {
const {g, token, event} = source(atreides);
const revealed = act(g, richese, {type:'revealNoField', token, event});
for (const difficulty of DIFFICULTIES) {
const view = viewGame(revealed, choam); view.players.find(p => p.id === choam)!.bot = difficulty;
const action = botActions(view)[0]; assert.ok(action, difficulty);
assert.doesNotThrow(() => act(revealed, choam, action), difficulty);
}
});