Retain independent Ecaz cards with Nexus Kull
Verify and publish checkpoint container / container (push) Canceled after 0s

This commit is contained in:
Quintine committed 2026-11-16 13:50:28 +11:00
1 parent 66c563be71
commit ecc4eb658a
7 files changed
+305 -11

No files matched your search

+8
View File
@@ -17,6 +17,14 @@ open mode gates.
## Current checkpoint and work
**Basic independent Ecaz cards with Nexus and Kull — 16 November. Prototyped /
Partial.** Explicitly selected cards survive public setup; Nexus Kull may spend
each physical Ecaz card, and Richese can claim or pass it with Semuta. Recruits
retains its Revival benefit through Semuta. Leader Skills with Nexus and Kull
now reject rather than silently disappearing. Sixteen related files pass 77
cases, and type checking and lint pass. Wider card/native interactions, Advanced, other modules, complete games
and deployed acceptance remain open. [Scope](NEXUS_CARD_RULES.md#basic-independent-cards-with-nexus-kull--16-november-2026).
**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,
+24
View File
@@ -2,6 +2,30 @@
Original source audit, 10 September 2026, with dated bounded runtime follow-ups below. This document establishes the printed component inventory, source protocol and implementation boundaries; none lifts expansion release gates. The ordinary worm-triggered alliance Nexus already in the engine is distinct from this optional card module.
## Basic independent cards with Nexus Kull — 16 November 2026
**Prototyped / Partial.** A fresh Basic CHOAM game with selected Ix and CHOAM
decks (optionally also Ecaz) can explicitly select independent Ecaz Treachery
cards, Nexus Cards and Kull together. Setup retains the three physical Ecaz
cards instead of silently omitting them. Leader Skills with this Kull/Nexus
composition reject at start with a reason rather than silently disappearing.
Automatic Kull eligibility is unchanged; the host explicitly enables Kull for
this combination.
The existing independent card authority and Nexus Kull's any-Treachery-card
cost apply; no new printed-rule interpretation is introduced. Richese's Semuta
can react to Recruits after its Revival effect, and can claim or pass any of the
three original Ecaz cards spent as a Nexus Kull cost. Its existing normal Nexus
and Kull continuation remains in force. Tests exercise genuine public starts,
real gameplay to the relevant phase and an earned Nexus card, with staged card
locations, board positions and unopened order; they do not establish every
other Ecaz-card, native-faction, or nested Semuta interaction. Wider module
combinations, complete games, Advanced and deployed acceptance remain open.
Evidence: [public selections and physical stock](../tests/kull-nexus-independent-public.test.ts),
[Recruits/Semuta](../tests/semuta-recruits-nexus-kull.test.ts), and
[Nexus fuel/Semuta](../tests/nexus-kull-ecaz-fuel.test.ts).
## Selected decks without independent cards — 29 October 2026
**Prototyped / Partial.** Fresh Basic and Advanced Nexus previews can select
+20 -10
View File
@@ -8415,7 +8415,7 @@ function treacheryDiscardIntegrity(g: Game) {
);
requireRule(
c.effect === 'recruits'
? g.semutaRecruitsPreview === true && basicIndependentRecruitsSemutaProfile(g) &&
? independentRecruitsSemutaEnabled(g) &&
g.phase === 4 && g.recruits?.turn === g.turn && g.recruits.player === c.player &&
g.recruits.card === c.card
: c.effect === 'hajr'
@@ -9813,7 +9813,7 @@ function semutaOfferSupported(
!continuation.resume.pendingKarama && !continuation.resume.phaseOpening;
}
if (continuation.kind === 'ordinaryCardDiscard' && continuation.effect === 'recruits')
return g.semutaRecruitsPreview === true && basicIndependentRecruitsSemutaProfile(g) &&
return independentRecruitsSemutaEnabled(g) &&
g.status === 'playing' && g.phase === 4 && g.recruits?.turn === g.turn &&
g.recruits.player === continuation.player && g.recruits.card === continuation.card &&
entries.length === 1 && entries[0].publicFace && entries[0].discardedBy === continuation.player &&
@@ -11318,7 +11318,11 @@ function startModules(state: Game): Game {
const g = structuredClone(state);
delete g.lobbyOptions;
if (lobbyKullEnabled(state)) {
if (g.nexusCards && g.advanced === false) return initializeNexusKullGameForAudit(g);
if (g.nexusCards && g.advanced === false) {
requireRule(!options.leaderSkills, 'Kull with Nexus and Leader Skills is not supported yet.');
if (options.ecazTreachery) g.ecazTreachery = true;
return initializeNexusKullGameForAudit(g);
}
const supportedBasic = g.advanced === false && (g.expansions.length === 2 ||
g.expansions.length === 3 && g.expansions.includes('ecaz')) && g.expansions.includes('choam') &&
g.expansions.includes('ix') && !!byFaction(g,'choam') &&
@@ -13750,6 +13754,12 @@ function basicIndependentRecruitsSemutaProfile(g: Game): boolean {
!g.discoveryEnabled && !g.discoveries && !g.discoveryStash && !g.greatMaker &&
!g.nexusKullPreview && !g.moritaniAssassinatePreview;
}
/** Nexus Kull already owns the normal Semuta marker; retain its independent
* Recruits reaction without combining the separate legacy preview markers. */
function independentRecruitsSemutaEnabled(g: Game): boolean {
return g.semutaRecruitsPreview === true && basicIndependentRecruitsSemutaProfile(g) ||
g.ecazTreachery === true && basicNexusKullSemutaProfile(g);
}
function semutaCardProducerEnabled(g: Game): boolean {
return g.semutaPreview === true || g.semutaRecruitsPreview === true && basicIndependentRecruitsSemutaProfile(g);
}
@@ -13844,14 +13854,14 @@ export function initializeKullGameForAudit(state: Game): Game {
g.kullPreview = true;
return g;
}
/** Fresh native CHOAM Kull with the physical Ix deck and only Nexus Cards. */
/** Fresh native CHOAM Kull with Nexus and optional independent Ecaz cards. */
export function initializeNexusKullGameForAudit(state: Game): Game {
requireRule(!state.kullPreview && !state.nexusKullPreview && !state.pendingKull &&
state.kullRestrictions === undefined && state.kullSequence === undefined &&
!state.semutaPreview && !state.richeseBetrayalPreview && !state.richeseBetrayal &&
!state.pendingRicheseBetrayal && !state.homeworlds && !state.leaderSkills &&
!state.discoveryEnabled && !state.discoveries && !state.discoveryStash && !state.greatMaker &&
!state.techTokens && !state.strongholdCards && !state.ecazTreachery &&
!state.techTokens && !state.strongholdCards && (!state.ecazTreachery || !state.advanced) &&
state.nexusCards?.cards === null && state.nexusCards.phase === null &&
typeof state.advanced === 'boolean' && (state.expansions.length === 2 || !state.advanced && state.expansions.length === 3 && state.expansions.includes('ecaz')) &&
state.expansions.includes('choam') && state.expansions.includes('ix') &&
@@ -13859,9 +13869,9 @@ export function initializeNexusKullGameForAudit(state: Game): Game {
state.players.every(p => p.faction === 'choam' || faction(p.faction).expansion === 'base' ||
!state.advanced && (p.faction === 'richese' || p.faction === 'ixians' || p.faction === 'tleilaxu' ||
state.expansions.includes('ecaz') && (p.faction === 'ecaz' || p.faction === 'moritani'))),
'Nexus Kull requires a fresh supported CHOAM lobby with selected faction decks and only Nexus Cards.');
'Nexus Kull requires a fresh supported CHOAM lobby with selected faction decks and supported Nexus and Ecaz cards.');
requireFreshBaseRuntime(state);
const g = initializeSetupGameForAudit(state, false, true, false, false, false, false, true);
const g = initializeSetupGameForAudit(state, false, true, false, false, false, false, true, state.ecazTreachery === true);
g.kullPreview = true;
g.nexusKullPreview = true;
if (!g.advanced && byFaction(g, 'richese')) g.semutaPreview = true;
@@ -20289,7 +20299,7 @@ function kullSettledRestriction(g: Game, frame: KullFrame): KullPhaseRestriction
// Independent printed descriptors, assembled once rather than trusting a saved
// hand to define its own identity or rebuilding the physical deck per quote.
const kullCanonicalCards: Readonly<Record<string, Card>> =
Object.fromEntries([...treacheryDeck(['choam', 'ix']), ...richeseCards()].map(card => [card.id, card]));
Object.fromEntries([...treacheryDeck(['choam', 'ix']), ...richeseCards(), ...ecazTreacheryCards()].map(card => [card.id, card]));
function canonicalKullCard(card: Card): boolean {
const expected = Object.hasOwn(kullCanonicalCards, card.id) ? kullCanonicalCards[card.id] : undefined;
return !!expected && card.name === expected.name && card.kind === expected.kind &&
@@ -20473,7 +20483,7 @@ function kullIntegrity(g: Game): void {
g.expansions.includes('ecaz') && (p.faction === 'ecaz' || p.faction === 'moritani'))) &&
!g.homeworlds && !g.leaderSkills && !g.discoveryEnabled && !g.discoveries &&
!g.discoveryStash && !g.greatMaker &&
!g.techTokens && !g.strongholdCards && !g.ecazTreachery &&
!g.techTokens && !g.strongholdCards && (!g.ecazTreachery || !g.advanced) &&
(!g.semutaPreview || !g.advanced && !!byFaction(g, 'richese')) &&
!g.richeseBetrayalPreview && !g.richeseBetrayal && !g.pendingRicheseBetrayal,
'The Nexus Kull profile has lost its supported native inventory and modules.');
@@ -44943,7 +44953,7 @@ function applyActionInner(
`${p.name} played Recruits. Current free revival rates are doubled and the ordinary force revival limit is seven for this turn.`,
{ faction: p.faction, name: 'Recruits' },
);
if (execution === 'live' && g.semutaRecruitsPreview && basicIndependentRecruitsSemutaProfile(g))
if (execution === 'live' && independentRecruitsSemutaEnabled(g))
stageOrdinaryCardDiscard(g, p, card);
return g;
}
+2 -1
View File
@@ -101,7 +101,8 @@ function basicNativeNexusCore(game: NexusCoreConfiguration): boolean {
if (game.advanced !== false || !game.nexusCards || !players || !game.expansions.length ||
!game.expansions.every(id => id === 'ix' || id === 'choam' || id === 'ecaz') ||
game.homeworlds || game.leaderSkills || game.techTokens || game.strongholdCards ||
game.ecazTreachery || game.discoveryEnabled || game.discoveries || game.discoveryStash || game.greatMaker ||
game.ecazTreachery && !(game.kullPreview === true && game.nexusKullPreview === true) ||
game.discoveryEnabled || game.discoveries || game.discoveryStash || game.greatMaker ||
game.advancedPreview || game.richeseBetrayalPreview) return false;
if (game.semutaPreview && (game.semutaPreview !== true ||
!game.expansions.includes('choam') || !players.some(player => player.faction === 'richese'))) return false;
@@ -0,0 +1,67 @@
import assert from 'node:assert/strict';
import test from 'node:test';
import { applyAction, createGame, joinGame, newPlayer, viewGame, type Game } from '../game/engine';
import { treacheryDeck } from '../game/cards';
import { ecazTreacheryCards } from '../game/ecaz-cards';
import { richeseCards } from '../game/richese-cards';
import { advanceSemutaNexusTrade } from './fixture-semuta-nexus-trade';
function lobby(richese: boolean, ecazExpansion: boolean): Game {
const expansions = ecazExpansion ? ['ix', 'choam', 'ecaz'] : ['ix', 'choam'];
const game = createGame('NEXUSKULLINDEPENDENT', newPlayer('c', 'CHOAM', 'choam'), false, expansions);
joinGame(game, newPlayer('r', richese ? 'Richese' : 'Guild', richese ? 'richese' : 'guild'));
joinGame(game, newPlayer('a', 'Atreides', 'atreides'));
return game;
}
function inventory(game: Game): string[] {
return [...game.deck, ...game.discard, ...(game.richeseCache ?? []), ...(game.richeseRemoved ?? []),
...(game.auction?.cards.slice(game.auction.index) ?? []), ...(game.ixAuction?.cards ?? []),
...game.players.flatMap(player => player.hand)].map(card => card.id).sort();
}
for (const richese of [false, true]) for (const ecazExpansion of [false, true]) {
void test(`Public Basic Nexus Kull retains independent Ecaz cards${richese ? ' with Richese' : ''}${ecazExpansion ? ' and selected Ecaz deck' : ''}`, () => {
let game = lobby(richese, ecazExpansion);
// Vary option order: selecting Kull while it is a default and explicitly
// selecting it after the independent module must both retain the choice.
const selections = richese
? ['nexusCards', 'kullPreview', 'ecazTreachery', 'kullPreview']
: ['ecazTreachery', 'nexusCards', 'kullPreview'];
for (const moduleName of selections)
game = applyAction(game, 'c', {type:'moduleOption', module:moduleName, enabled:true});
const options = viewGame(game, 'c').lobbyModules!;
assert.equal(options.ecazTreachery, true); assert.equal(options.nexusCards, true); assert.equal(options.kullPreview, true);
for (const player of game.players) game = applyAction(game, player.id, {type:'ready'});
game = applyAction(game, 'c', {type:'start'});
assert.equal(game.ecazTreachery, true, 'Selected module must reach game state');
assert.equal(game.kullPreview, true); assert.equal(game.nexusKullPreview, true);
assert.ok(game.nexusCards); if (richese) assert.equal(game.semutaPreview, true);
const expected = [...treacheryDeck(game.expansions), ...ecazTreacheryCards(), ...(richese ? richeseCards() : [])].map(card => card.id).sort();
assert.deepEqual(inventory(game), expected, 'Every selected original card is present once');
game = advanceSemutaNexusTrade(game, state => state.status === 'playing');
assert.deepEqual(inventory(game), expected, 'Setup deals preserve every selected original card');
assert.ok(game.nexusCards!.cards, 'Nexus cards are initialized during real setup');
});
}
for (const independent of [false, true]) void test(
`Public Basic Nexus Kull never silently drops selected Leader Skills${independent ? ' with independent Ecaz cards' : ''}`, () => {
let game = lobby(true, true);
for (const moduleName of [...(independent ? ['ecazTreachery'] : []), 'nexusCards', 'leaderSkills', 'kullPreview'])
game = applyAction(game, 'c', {type:'moduleOption', module:moduleName, enabled:true});
const options = viewGame(game, 'c').lobbyModules!;
assert.equal(options.leaderSkills, true); assert.equal(options.nexusCards, true); assert.equal(options.kullPreview, true);
for (const player of game.players) game = applyAction(game, player.id, {type:'ready'});
const before = structuredClone(game);
let started: Game | undefined;
try { started = applyAction(game, 'c', {type:'start'}); }
catch (error) {
assert.ok(error instanceof Error && /skill|module|combination/i.test(error.message), 'Unsupported starts need a readable module reason');
assert.deepEqual(game, before, 'Rejected start cannot change the lobby');
}
if (started) {
assert.ok(started.leaderSkills, 'A successful start must retain selected Leader Skills');
assert.equal(started.kullPreview, true);
}
});
+115
View File
@@ -0,0 +1,115 @@
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 { takeKullCard } from './fixture-choam-kull';
import { advanceSemutaNexusTrade, swapSemutaNexusTradeIdentity } from './fixture-semuta-nexus-trade';
import { beforeIxSpiceDraw, orderIxSpiceCards } from './fixture-ix-spice-cards';
const act = (game: Game, actor: string, action: Action) => applyAction(game, actor, action);
const seat = (game: Game, id: string) => {
const player = game.players.find(row => row.id === id); assert.ok(player); return player;
};
const clean = (game: Game) => !game.phaseOpening && !game.response && !game.decision && !game.truthtrance && !game.pendingGuildBetrayal;
function inventory(game: Game): string[] {
const cards = [...game.deck, ...game.discard, ...(game.richeseCache ?? []), ...(game.richeseRemoved ?? []),
...(game.auction?.cards.slice(game.auction.index + Number(game.currentAuctionSale?.origin === 'normal')) ?? []),
...(game.ixAuction?.cards ?? []), ...game.players.flatMap(player => player.hand)].map(card => card.id).sort();
assert.equal(new Set(cards).size, cards.length, 'Each physical card has one location');
return cards;
}
/** Start through public controls and earn a real Nexus draw. Unopened Spice
* order, the earned identity, board counters and original held cards are staged
* to reach the Karama reaction without inventing components or a transaction. */
function fixture(fuelId: string) {
let game = createGame('NEXKULLECAZ', newPlayer('c', 'CHOAM', 'choam'), false, ['ix', 'choam', 'ecaz']);
for (const [id, faction] of [['r','richese'], ['a','atreides'], ['g','guild'], ['h','harkonnen']] as const)
joinGame(game, newPlayer(id, faction, faction));
for (const moduleName of ['ecazTreachery', 'nexusCards', 'kullPreview'])
game = act(game, 'c', {type:'moduleOption', module:moduleName, enabled:true});
for (const player of game.players) game = act(game, player.id, {type:'ready'});
game = act(game, 'c', {type:'start'});
assert.equal(game.ecazTreachery, true); assert.equal(game.semutaPreview, true);
assert.equal(game.kullPreview, true); assert.equal(game.nexusKullPreview, true);
game = advanceSemutaNexusTrade(game, state => state.status === 'playing');
const original = inventory(game);
assert.ok(original.includes(fuelId));
for (const player of game.players) {
player.reserves += Object.values(player.forces).reduce((sum, amount) => sum + amount, 0); player.forces = {};
if (player.elites) { player.elites.reserves += Object.values(player.elites.forces).reduce((sum, amount) => sum + amount, 0); player.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 && clean(state));
game = act(game, 'a', {type:'alliance', target:'h'}); game = act(game, 'h', {type:'alliance', target:'a'});
game = advanceSemutaNexusTrade(game, state => state.nexusCards?.phase?.stage === 'drawing' && clean(state));
assert.ok(game.nexusCards!.phase!.eligible.includes('c'));
game = act(game, 'c', {type:'nexusCardChoice', turn:game.turn, card:null, choice:'draw', ownRedraws:0});
swapSemutaNexusTradeIdentity(game, 'c', 'choam');
game = advanceSemutaNexusTrade(game, state => state.phase === 5 && state.active === 'g' && clean(state));
assert.equal(game.nexusCards!.cards!.hands.c, 'choam');
for (const player of game.players) game.deck.push(...player.hand.splice(0));
const fuel = takeKullCard(game, fuelId); seat(game, 'c').hand.push(fuel);
const karama = takeKullCard(game, 'karama'); seat(game, 'g').hand.push(karama);
const counter = takeKullCard(game, 'karama'); seat(game, 'h').hand.push(counter);
const semuta = takeKullCard(game, SEMUTA_DRUG_ID); seat(game, 'r').hand.push(semuta);
assert.deepEqual(inventory(game), original);
game = act(game, 'g', {type:'card', mode:'shipment', card:karama.id, target:'g'});
assert.equal(game.pendingKull?.stage, 'offer');
return {game, original, fuel, karama, semuta, event:game.pendingKull!.event};
}
function finishCounter(state: Game): Game {
let game = state;
for (let n = 0; game.pendingKull && n < 20; n++) {
const actor = game.players.find(player => {
const controls = viewGame(game, player.id).responseControls;
return controls && !controls.hasPassed && controls.cancelCards.length > 0;
});
game = actor ? act(game, actor.id, {type:'passResponse'}) : normalizeAutomaticGame(game);
}
assert.equal(game.pendingKull, null); return game;
}
for (const fuelId of ['ecaz-recruits', 'ecaz-reinforcements', 'ecaz-harass-withdraw'])
for (const claim of [false, true]) void test(
`Nexus Kull can privately discard ${fuelId}, then Semuta can ${claim ? 'claim' : 'pass'}`, () => {
const f = fixture(fuelId);
assert.ok(viewGame(f.game, 'c').kullReaction!.plays.some(row => row.source === 'nexus' && row.card.id === fuelId));
const startLog = f.game.log.length;
let game = act(f.game, 'c', {type:'kullDecision', event:f.event, source:'nexus', card:fuelId});
game = finishCounter(game);
const pending = game.pendingTreacheryDiscard; assert.ok(pending);
assert.equal(pending.reaction?.stage, 'offer');
assert.deepEqual(pending.batch.entries.map(entry => ({id:entry.card.id, discardedBy:entry.discardedBy, publicFace:entry.publicFace})),
[{id:fuelId, discardedBy:'c', publicFace:false}]);
assert.equal(game.nexusCards!.cards!.hands.c, null);
assert.equal(game.nexusCards!.cards!.discard.filter(card => card === 'choam').length, 1);
assert.equal(game.nexusChoamHistory!.at(-1)!.stage, 'complete');
assert.equal(game.log.slice(startLog).some(row => row.text.includes(f.fuel.name)), false);
assert.deepEqual(viewGame(game, 'r').semutaReaction!.candidates, []);
assert.deepEqual(viewGame(game, 'g').semutaReaction!.candidates, []);
assert.equal(viewGame(game, 'r').semutaReaction!.canCommit, true);
const event = pending.batch.event;
if (claim) {
game = act(game, 'r', {type:'semutaCommit', event});
if (game.pendingTreacheryDiscard?.reaction?.stage === 'select') {
assert.deepEqual(viewGame(game, 'r').semutaReaction!.candidates.map(card => card.id), [fuelId]);
assert.deepEqual(viewGame(game, 'g').semutaReaction!.candidates, []);
game = act(game, 'r', {type:'semutaSelect', event, card:fuelId});
}
} else while (game.pendingTreacheryDiscard?.batch.event === event && game.pendingTreacheryDiscard.reaction?.stage === 'offer') {
const reaction = game.pendingTreacheryDiscard.reaction;
const actor = game.players.find(player => !reaction.passed.includes(player.id)); assert.ok(actor);
game = act(game, actor.id, {type:'semutaPass', event});
}
assert.equal(game.pendingTreacheryDiscard, null); assert.equal(game.pendingKull, null);
assert.equal(game.karamaShipping, null); assert.ok(seat(game, 'g').hand.some(card => card.id === f.karama.id));
assert.ok(viewGame(game, 'g').karamaBlocked);
assert.equal(seat(game, 'r').hand.some(card => card.id === fuelId), claim);
assert.equal(game.discard.some(card => card.id === fuelId), !claim);
assert.equal(game.discard.some(card => card.id === f.semuta.id), claim);
assert.deepEqual(inventory(game), f.original);
});
+69
View File
@@ -0,0 +1,69 @@
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 } from '../game/bots';
import { DIFFICULTIES } from '../game/bot-profiles';
import { RECRUITS_CARD_ID } from '../game/recruits';
import { SEMUTA_DRUG_ID } from '../game/semuta-drug';
import { takeKullCard } from './fixture-choam-kull';
import { advanceSemutaNexusTrade } from './fixture-semuta-nexus-trade';
import { basicSemutaAmbassadorClean as clean, basicSemutaAmbassadorInventory as inventory,
basicSemutaAmbassadorPlayer as seat } from './fixture-basic-semuta-ambassador';
const act = (game: Game, actor: string, action: Action) => applyAction(game, actor, action);
/** A real public selected-module start and native play up to Revival. Only
* original hand positions are staged at that point; no cards are created. */
function fixture() {
let game = createGame('RECRUITSNEXKULL', newPlayer('c', 'CHOAM', 'choam'), false, ['ix', 'choam']);
for (const [id, faction] of [['r', 'richese'], ['a', 'atreides'], ['g', 'guild']] as const)
joinGame(game, newPlayer(id, faction, faction));
for (const moduleName of ['ecazTreachery', 'nexusCards', 'kullPreview'] as const)
game = act(game, 'c', { type: 'moduleOption', module: moduleName, enabled: true });
for (const player of game.players) game = act(game, player.id, { type: 'ready' });
game = act(game, 'c', { type: 'start' });
assert.equal(game.ecazTreachery, true);
assert.equal(game.kullPreview, true);
assert.equal(game.nexusKullPreview, true);
assert.equal(game.semutaPreview, true);
game = advanceSemutaNexusTrade(game, state => state.status === 'playing');
game = advanceSemutaNexusTrade(game, state => state.phase === 4 && clean(state));
const original = inventory(game);
for (const id of ['a', 'r']) game.deck.push(...seat(game, id).hand.splice(0));
seat(game, 'a').hand.push(takeKullCard(game, RECRUITS_CARD_ID));
seat(game, 'r').hand.push(takeKullCard(game, SEMUTA_DRUG_ID));
assert.deepEqual(inventory(game), original);
return { game, original };
}
for (const claim of [false, true]) {
void test(`Basic independent Nexus Kull Recruits offers Semuta ${claim ? 'claim' : 'pass'} and retains Revival`, () => {
const { game, original } = fixture();
assert.ok(viewGame(game, 'a').recruitsPreview?.play && !viewGame(game, 'a').recruitsPreview!.play!.blocked);
let pending = act(game, 'a', { type: 'card', card: RECRUITS_CARD_ID });
const frame = pending.pendingTreacheryDiscard; assert.ok(frame);
assert.equal(frame.continuation.kind, 'ordinaryCardDiscard');
assert.equal(frame.reaction?.stage, 'offer');
assert.deepEqual(frame.batch.entries.map(entry => entry.card.id), [RECRUITS_CARD_ID]);
assert.equal(pending.recruits?.turn, pending.turn);
for (const difficulty of DIFFICULTIES) {
const view = viewGame(pending, 'r'); view.players.find(player => player.id === 'r')!.bot = difficulty;
assert.ok(botActions(view).some(action => action.type === 'semutaCommit' || action.type === 'semutaPass'));
}
const event = frame.batch.event;
if (claim) {
pending = act(pending, 'r', { type: 'semutaCommit', event });
if (pending.pendingTreacheryDiscard?.reaction?.stage === 'select')
pending = act(pending, 'r', { type: 'semutaSelect', event, card: RECRUITS_CARD_ID });
} else {
for (const player of game.players) pending = act(pending, player.id, { type: 'semutaPass', event });
}
assert.equal(pending.pendingTreacheryDiscard, null);
assert.equal(viewGame(pending, 'a').revival.freeRemaining, 4);
assert.equal(viewGame(pending, 'a').revival.limit, 7);
assert.equal(seat(pending, 'r').hand.some(card => card.id === RECRUITS_CARD_ID), claim);
assert.equal(pending.discard.some(card => card.id === RECRUITS_CARD_ID), !claim);
assert.equal(pending.discard.some(card => card.id === SEMUTA_DRUG_ID), claim);
assert.deepEqual(inventory(pending), original);
});
}