Connect the Recruits independent-card revival preview

The explicit development initializer now includes the complete three-card Ecaz Treachery variant before genuine Basic/Advanced faction setup. Recruits has owned play/discard controls, full inspection, a public current-rate table, shared authoritative revival quotes, all four AI profiles and persistent exact free-use ledgers. Existing CHOAM/Tleilaxu choices settle before returning forces. Inactive games retain their prior allowance arithmetic.

Clean activation before normal returns or after exactly recorded free returns is connected. Prior-paid/unknown use, later Fremen grants, pending repricing, same-turn recovered-card replay and additional optional modules stay gated. Native unlimited faction advantages remain unlimited. The independent seven-force cap after faction cancellation is explicitly documented as an inference from independent effects, not a direct combined FAQ. Reinforcements and Harass & Withdraw remain unfinished; public starts and publication stay gated.

Independent rules/privacy/persistence review passed. Review fixed auction alias double-counting after a physical card sale, malformed canonical cards, legacy zero-ledger activation, a seat-control validation bypass and an ordinary-start bypass. Focused tests cover readiness and turn expiry as well as authenticated restart, exact free/paid accounting, stale/duplicate requests, competing writes and malformed-save rejection. Types, lint, 4743 offline tests, build and 43 HTTP tests passed with unchanged source.

Eight fixed-seed genuine six-seat samples finish: basic/Easy: 1961 accepted, 0 Recruits plays, 53 JSON restores; basic/Medium: 711 accepted, 0 Recruits plays, 19 JSON restores; basic/Hard: 239 accepted, 0 Recruits plays, 6 JSON restores; basic/Brutal: 1367 accepted, 1 Recruits plays, 36 JSON restores; advanced/Easy: 1402 accepted, 0 Recruits plays, 37 JSON restores; advanced/Medium: 530 accepted, 0 Recruits plays, 14 JSON restores; advanced/Hard: 545 accepted, 1 Recruits plays, 14 JSON restores; advanced/Brutal: 1240 accepted, 1 Recruits plays, 33 JSON restores. Reports retain rejected candidates and earlier harness attempts. All 216 game-source hashes remain identical to the samples; a later presentation-test expectation update changes no game code. Actual card use, custody and periodic/terminal private views are checked; this is bounded playability evidence, not full variant acceptance or AI calibration. A separate conserved browser Revival fixture verifies the full inspector, physical play, public rates, four free returns and active/resolved refresh.

All 902 opening games and original seat/recovery records remain unchanged (936 after checks). All 903 present immediately before broad checks are also preserved. Database integrity and foreign keys pass. The healthy server recovered after the power failure and was reused without restart, reset or recurring automation.

Verified source tree: 1f934f996268b35c8a20d0d617fa962aad878108496fa1a4a05323360757b0e3
This commit is contained in:
Quintine committed 2026-09-14 03:44:21 +10:00
1 parent 9ca17a66a0
commit c04cb93830
21 files changed
+1421 -119

No files matched your search

+16 -1
View File
@@ -1,4 +1,5 @@
import { discoveryBotActions } from './discovery-options';
import { recruitsPlayAction } from './recruits';
import type { Card } from './cards';
import { bureaucratBattlePenalty, canUsePlanetologistBattleSpecial, leaderSkillBattleBonus, validLeaderSkillBattleCardPair } from './leader-skill-combat';
import { leaderSkillStrongholdCount } from './leader-skill-battle-board';
@@ -2870,7 +2871,8 @@ function policyActions(g: GameView): Action[] {
actions.push({ type: 'requestLeaderRevival', leader: dead.id });
}
}
if (me.faction === 'fremen' && me.ally && !g.freeRevival.includes(me.ally))
if (me.faction === 'fremen' && me.ally && !g.freeRevival.includes(me.ally) &&
!g.recruitsPreview?.grantRevivalBlocked)
actions.push({ type: 'grantRevival' });
if (me.faction === 'emperor' && me.ally && level > 0) {
const ally = g.players.find((p) => p.id === me.ally)!;
@@ -3722,6 +3724,19 @@ export function botActions(g: GameView): Action[] {
? policyActions({ ...g, decision: null })
: nexusTraitorBotActions(g);
if (g.automaticContinuationPending) return [];
const recruits = recruitsPlayAction(g.recruitsPreview);
if (recruits) {
const own = g.players.find((player) => player.id === g.me)!;
const rates = g.recruitsPreview!.rates;
const ownRate = rates.find((rate) => rate.player === own.id)!;
const ally = g.players.find((player) => player.id === own.ally);
const allyRate = rates.find((rate) => rate.player === ally?.id);
const freeBenefit = ownRate.freeRate > 0 && own.tanks > g.revival.freeRemaining;
const paidBenefit = ownRate.limit < 7 && own.tanks > g.revival.forcesRemaining &&
(own.spice ?? 0) >= 2;
const allyBenefit = ally && allyRate && allyRate.freeRate > 0 && ally.tanks > allyRate.freeRate;
if (freeBenefit || paidBenefit || allyBenefit) return [recruits];
}
if (g.nexusCards?.waiting.length) return nexusCardBotActions(g);
const discoveryEntry = discoveryEntryBotActions(g);
if (discoveryEntry.length) return discoveryEntry;
+4 -1
View File
@@ -109,7 +109,10 @@ export function cardPresentation(card: VisibleCard): CardPresentation {
role: 'utility',
guidance: ecaz.summary,
gameplay: ecaz.gameplay,
topics: [],
availability: ecaz.card.effect === 'recruits'
? 'Recruits has development controls during Revival. Earlier paid revivals, pending transactions, later free-rate changes and repeated use this turn remain guarded pending their rulings.'
: 'This battle effect is still being implemented.',
topics: RULE_TOPICS.filter((topic) => topic.id === 'card-recruits'),
};
const topicIds =
card.kind === 'special'
+5 -4
View File
@@ -26,7 +26,7 @@ export type EcazTreacheryDefinition = Readonly<{
verification: Readonly<{
inventory: 'verified';
sourceRules: 'verified';
runtime: 'not-implemented';
runtime: 'prototype' | 'not-implemented';
combinedInteractions: 'incomplete';
unresolved: readonly string[];
}>;
@@ -39,7 +39,7 @@ export const ECAZ_TREACHERY_VARIANT = Object.freeze({
physicalCards: 3,
independentOfFactions: true,
independentOfOtherVariants: true,
activation: 'not-implemented',
activation: 'audit-prototype',
audit: 'docs/ECAZ_TREACHERY_RULES.md',
} as const);
@@ -86,7 +86,7 @@ export const ECAZ_TREACHERY_DEFINITIONS: readonly EcazTreacheryDefinition[] =
verification: {
inventory: 'verified',
sourceRules: 'verified',
runtime: 'not-implemented',
runtime: 'prototype',
combinedInteractions: 'incomplete',
unresolved: [
'Timing after earlier completed revivals, refunds, reopening opportunities and any already pending transaction.',
@@ -170,11 +170,12 @@ export function ecazTreacheryCards(): EcazTreacheryCard[] {
/** Resolve a canonical physical identity, not an arbitrary special with a similar name. */
export function ecazTreacheryDefinition(
card: Pick<Card, 'id' | 'kind' | 'effect'>,
card: Pick<Card, 'id' | 'name' | 'kind' | 'effect'>,
): EcazTreacheryDefinition | undefined {
return ECAZ_TREACHERY_DEFINITIONS.find(
(definition) =>
definition.card.id === card.id &&
definition.card.name === card.name &&
definition.card.kind === card.kind &&
definition.card.effect === card.effect,
);
+185 -4
View File
@@ -470,6 +470,7 @@ import {
forceRevivalQuote,
forceRevivalRemaining,
freeRevivalRemaining,
normalRevivalAllowance,
leaderRevivalOptions,
type RevivalRules,
type PendingRevival,
@@ -509,6 +510,11 @@ import {
type Leader,
type SpiceCard,
} from './cards';
import { ecazTreacheryCards, ecazTreacheryDefinition } from './ecaz-cards';
import {
RECRUITS_CARD_ID,
type RecruitsPreview,
} from './recruits';
import {
TERRITORIES,
MOBILE_STRONGHOLD,
@@ -1594,6 +1600,14 @@ export type Game = {
spiceResolution: { skipped: SpiceCard[] } | null;
spiceSequence: { pile: 0 | 1; skipped: SpiceCard[] } | null;
freeRevival: string[];
/** Presence enables the independently selected three-card Ecaz variant. */
ecazTreachery?: true;
/** Public, turn-scoped receipt for the discarded Recruits card. */
recruits?: {
turn: number;
player: string;
card: typeof RECRUITS_CARD_ID;
} | null;
emperorExtra: Record<string, number>;
aid: Record<string, { recipient: string; amount: number }>;
};
@@ -5589,7 +5603,10 @@ function initializeSetup(g: Game) {
stormOrder(g);
g.stormDialers = [g.order[0], g.order.at(-1)!];
g.lastBattle = [...g.stormDialers];
g.deck = shuffle(treacheryDeck(g.expansions));
g.deck = shuffle([
...treacheryDeck(g.expansions),
...(g.ecazTreachery ? ecazTreacheryCards() : []),
]);
g.spiceDeck = shuffle([...spiceDeck(g.expansions.includes('ix')), ...(g.discoveryEnabled ? [...DISCOVERY_SPICE_CARDS, {worm:true as const, greatMaker:true as const}] : [])]);
g.sandtrout = false;
g.status = 'setup';
@@ -5830,7 +5847,14 @@ export function initializeLeaderSkillsGameForAudit(state: Game): Game {
g.leaderSkills = createLeaderSkills(random);
return initializeSetupGameForAudit(g, false, false, false, false, true, g.expansions.length === 1 && g.expansions[0] === 'choam');
}
function initializeSetupGameForAudit(state: Game, homeworlds: boolean, nexus = false, ix = false, discovery = false, leaderSkills = false, choam = false, factions = false): Game {
/** Gated development setup for the independent three-card Ecaz variant. */
export function initializeEcazTreacheryGameForAudit(state: Game): Game {
requireRule(!state.ecazTreachery, 'Ecaz Treachery Cards cannot redeal an existing inventory.');
const g = structuredClone(state);
g.ecazTreachery = true;
return initializeSetupGameForAudit(g, false, false, false, false, false, false, true, true);
}
function initializeSetupGameForAudit(state: Game, homeworlds: boolean, nexus = false, ix = false, discovery = false, leaderSkills = false, choam = false, factions = false, ecazTreachery = false): Game {
nexusCardsIntegrity(state);
homeworldRule(() => homeworldGameIntegrity(state));
homeworldBattleLossIntegrity(state);
@@ -5858,6 +5882,7 @@ function initializeSetupGameForAudit(state: Game, homeworlds: boolean, nexus = f
(leaderSkills || !g.leaderSkills) &&
(discovery || !g.discoveryEnabled) &&
(nexus || !g.nexusCards) &&
(ecazTreachery || !g.ecazTreachery) &&
!g.techTokens &&
!g.strongholdCards &&
(homeworlds || !g.homeworlds) &&
@@ -8033,9 +8058,135 @@ function physicalTreacheryCards(g: Game) {
...(g.ixSetupCards ?? []),
...(g.ixAuction?.cards ?? []),
...(g.ornithopter ? [g.ornithopter.card] : []),
...(g.auction?.cards.slice(g.auction.index) ?? []),
...(g.auction?.cards.slice(
g.auction.index + Number(g.currentAuctionSale?.origin === 'normal'),
) ?? []),
];
}
function ecazTreacheryIntegrity(g: Game) {
if (!g.ecazTreachery) {
requireRule(!g.recruits, 'Recruits requires the independent Ecaz Treachery Cards variant.');
return;
}
requireRule(g.ecazTreachery === true, 'Invalid Ecaz Treachery Cards module marker.');
if (g.status === 'lobby') {
throw new RuleError(
'Ecaz Treachery Cards can begin only through their gated audit initializer.',
);
}
const physical = physicalTreacheryCards(g);
for (const expected of ecazTreacheryCards()) {
const matching = physical.filter((card) => card.id === expected.id);
requireRule(
matching.length === 1 &&
!!ecazTreacheryDefinition(matching[0]) &&
Object.keys(matching[0]).sort().join(',') === 'effect,id,kind,name',
'The Ecaz Treachery Cards inventory is missing, duplicated or malformed.',
);
}
requireRule(
physical.filter((card) => card.id.startsWith('ecaz-')).length === 3,
'The Ecaz Treachery Cards inventory contains an unknown physical card.',
);
if (g.recruits) {
requireRule(
Object.keys(g.recruits).sort().join(',') === 'card,player,turn' &&
g.recruits.card === RECRUITS_CARD_ID &&
g.recruits.turn === g.turn &&
g.players.some((player) => player.id === g.recruits!.player),
'The Recruits effect has a malformed or expired receipt.',
);
requireRule(
g.players.every(
(player) =>
Number.isSafeInteger(player.revived) &&
player.revived >= 0 &&
Number.isSafeInteger(player.freeForcesRevived) &&
player.freeForcesRevived! >= 0 &&
player.freeForcesRevived! <= player.revived,
),
'The active Recruits effect has inconsistent normal revival ledgers.',
);
}
}
function recruitsModeSupported(g: Game) {
return (
!g.homeworlds &&
!g.nexusCards &&
!g.leaderSkills &&
!g.techTokens &&
!g.strongholdCards &&
!g.discoveryEnabled
);
}
function recruitsInteractionPending(g: Game) {
return !!(
g.response ||
g.decision ||
g.truthtrance ||
g.phaseOpening ||
g.pendingRevival ||
g.pendingKarama ||
g.pendingTreacheryDiscard ||
g.pendingNullentropy ||
g.pendingExchange ||
g.pendingRicheseGift ||
g.pendingRichesePurchaseIncome ||
g.pendingAmbassador ||
g.pendingCapture ||
g.battle
);
}
function recruitsPlayBlock(g: Game, owner: Player, card: Card): string | null {
if (!g.ecazTreachery || !ecazTreacheryDefinition(card) || card.id !== RECRUITS_CARD_ID)
return 'Choose the physical Recruits card from the enabled Ecaz Treachery Cards variant.';
if (!recruitsModeSupported(g))
return 'This Recruits prototype currently requires a faction-only game without other optional modules.';
if (g.status !== 'playing' || g.phase !== 4)
return 'Play Recruits during Revival.';
if (g.recruits?.turn === g.turn)
return 'Recruits is already active this turn; a recovered copy cannot be played again.';
const reserved = transferCardBlock(g, owner, card);
if (reserved) return reserved;
if (recruitsInteractionPending(g))
return 'Finish the current transaction or priority window before playing Recruits.';
for (const player of g.players) {
if (
player.freeForcesRevived !== undefined &&
(!Number.isSafeInteger(player.freeForcesRevived) ||
player.freeForcesRevived < 0 ||
player.freeForcesRevived > player.revived)
)
return 'Normal force revival history is inconsistent; Recruits cannot safely reprice it.';
if (player.revived > 0 && player.freeForcesRevived === undefined)
return 'Earlier normal force revival history is incomplete; Recruits cannot safely reprice it.';
if (player.revived > (player.freeForcesRevived ?? 0))
return 'Recruits after a paid normal force revival awaits a rules ruling.';
}
return null;
}
function recruitsPreview(g: Game, viewer: Player): RecruitsPreview | null {
if (!g.ecazTreachery) return null;
ecazTreacheryIntegrity(g);
const held = viewer.hand.find((card) => card.id === RECRUITS_CARD_ID);
const play = held
? { type: 'card' as const, card: RECRUITS_CARD_ID, blocked: recruitsPlayBlock(g, viewer, held) }
: null;
const active = g.recruits?.turn === g.turn;
return {
active,
...(active ? { playedTurn: g.recruits!.turn, playedBy: g.recruits!.player } : {}),
play,
rates: g.order.map((player) => {
const target = getPlayer(g, player);
const allowance = normalRevivalAllowance(g, target);
return { player, freeRate: allowance.freeRate, limit: allowance.limit };
}),
grantRevivalBlocked: active
? 'Grant Fremen ally revival before Recruits; changing the free rate after activation awaits a rules ruling.'
: null,
};
}
/** Pure normal-lot prerequisites; free payment deliberately does not require spice. */
function normalKaramaAuction(
g: Game,
@@ -12553,6 +12704,7 @@ function completePhase(g: Game) {
if (g.dukeVidal) g.dukeVidal = expireDuke(g.dukeVidal, g.turn);
observeOccupation(g, 'turnEnd');
g.turn++;
g.recruits = null;
g.phase = 0;
observeOccupation(g, 'turnStart');
}
@@ -19930,6 +20082,7 @@ function normalizeCardNames(g: Game) {
]);
}
export function applyAction(state: Game, id: string, action: Action): Game {
ecazTreacheryIntegrity(state);
ixRicheseTechnologyIntegrity(state);
leaderSkillsIntegrity(state);
discoveryIntegrity(state);
@@ -20192,6 +20345,7 @@ function settleAutomaticContinuations(g: Game) {
}
/** Internal authoritative continuation. Callers must persist with their usual CAS fence. */
export function normalizeAutomaticGame(state: Game): Game {
ecazTreacheryIntegrity(state);
ixRicheseTechnologyIntegrity(state);
leaderSkillsIntegrity(state);
discoveryIntegrity(state);
@@ -20243,6 +20397,7 @@ function applyActionInner(
action: Action,
execution: 'live' | 'shipmentPreparation' = 'live',
): Game {
ecazTreacheryIntegrity(state);
const g = structuredClone(state);
if (g.biddingEnd && action.type !== 'advanceBots' &&
!(action.type === 'biddingEnd' && action.mode === 'ready'))
@@ -20354,6 +20509,25 @@ function applyActionInner(
throw error;
}
requireRule(!pendingNexusTraitors(g), 'Finish the private Nexus card return before continuing play.');
if (t === 'card' && action.card === RECRUITS_CARD_ID) {
requireRule(
Object.keys(action).sort().join(',') === 'card,type',
'Play Recruits without an additional mode or selection.',
);
const card = p.hand.find((held) => held.id === RECRUITS_CARD_ID);
requireRule(card, 'The physical Recruits card is not in your hand.');
const blocked = recruitsPlayBlock(g, p, card);
requireRule(!blocked, blocked ?? 'Recruits is unavailable.');
discard(g, p, card.id);
for (const player of g.players) player.freeForcesRevived ??= 0;
g.recruits = { turn: g.turn, player: p.id, card: RECRUITS_CARD_ID };
log(
g,
`${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' },
);
return g;
}
if (t === 'card' && action.card === 'richese-juice-of-sapho') {
playSapho(g, p, action);
return g;
@@ -22396,6 +22570,10 @@ function applyActionInner(
!g.freeRevival.includes(p.ally),
'Free revival has already been granted.',
);
requireRule(
g.recruits?.turn !== g.turn,
'Grant Fremen ally revival before Recruits; changing the free rate after activation awaits a rules ruling.',
);
g.freeRevival.push(p.ally);
log(
g,
@@ -22593,7 +22771,8 @@ function applyActionInner(
requireRule(quote.cost <= p.spice, 'Not enough spice for revival.');
const checks: PendingRevival['checks'] = [];
const choamBenefit = p.faction === 'choam' && !g.revivalRules?.choamBlocked;
const uncancelableLimit = Math.max(3, freeRevivalRate(g, p));
const uncancelableLimit =
g.recruits?.turn === g.turn ? 7 : Math.max(3, freeRevivalRate(g, p));
if (choamBenefit && (n > quote.free || p.revived + n > uncancelableLimit))
checks.push('choamRevival');
if (!choamBenefit && p.revived + n > uncancelableLimit)
@@ -23715,6 +23894,7 @@ function applyActionInner(
throw new RuleError('That action is not available.');
}
export function viewGame(state: Game, id: string) {
ecazTreacheryIntegrity(state);
ixRicheseTechnologyIntegrity(state);
leaderSkillsIntegrity(state);
discoveryFlightIntegrity(state);
@@ -24303,6 +24483,7 @@ export function viewGame(state: Game, id: string) {
g.revivalPrevention?.turn === g.turn ? g.revivalPrevention : null,
emperorExtra: g.emperorExtra ?? {},
freeRevival: g.freeRevival ?? [],
recruitsPreview: recruitsPreview(g, me),
revivalRules: {
...(g.revivalRules ?? newRevivalRules()),
earlyBlocked: (g.revivalRules?.earlyBlocked ?? []).filter(
+22
View File
@@ -1,5 +1,27 @@
/** A global card effect expires when the authoritative turn changes. */
export type RecruitsEffect = Readonly<{ turn: number }>;
export const RECRUITS_CARD_ID = 'ecaz-recruits' as const;
export type RecruitsPlay = Readonly<{
type: 'card';
card: typeof RECRUITS_CARD_ID;
blocked: string | null;
}>;
export type RecruitsPreview = Readonly<{
active: boolean;
playedTurn?: number;
playedBy?: string;
play: RecruitsPlay | null;
rates: ReadonlyArray<Readonly<{ player: string; freeRate: number; limit: number }>>;
grantRevivalBlocked: string | null;
}>;
/** A single shared control adapter for UI and bots; blocked details stay display-only. */
export function recruitsPlayAction(
preview?: Pick<RecruitsPreview, 'play'> | null,
): { type: 'card'; card: typeof RECRUITS_CARD_ID } | null {
const play = preview?.play;
return play && !play.blocked ? { type: 'card', card: play.card } : null;
}
export type RecruitsScope = Readonly<{
turn: number;
recruits?: RecruitsEffect | null;
+24 -1
View File
@@ -3669,6 +3669,29 @@ export const RULE_TOPICS: RuleTopic[] = [
{ area:'Verification',status:'Partial',detail:'Focused inventory, scoring, Voice, capture, saved private setup/revival Planetologist movement/cancellation and Suk Graduate casualty/SQLite checks, plus Rihani privacy/concurrent recovery battle-effect regressions and Smuggler quote/decision/legacy recovery and Banker funding, death, traitor, privacy and concurrent settlement checks cover this boundary. Diplomat checks cover self-protection, mandatory discard, public-choice privacy, concurrent saved decisions and legacy continuation. Bureaucrat checks cover once-per-phase use, private source receipts and resumed payment custody. Sample games and browser continuation are recorded separately; full module acceptance remains open.',evidence:['tests/leader-skills-engine.test.ts','tests/leader-skills-capture.test.ts','tests/leader-skills-recovery.test.ts','tests/leader-skills-controls.test.ts','tests/suk-graduate.test.ts','tests/suk-graduate-recovery.test.ts','tests/leader-battle-effects.test.ts','tests/leader-battle-effects-recovery.test.ts','tests/leader-battle-effects-controls.test.tsx','tests/mentat-question.test.ts','tests/mentat-question-bots.test.ts','tests/mentat-question-controls.test.tsx','tests/mentat-question-recovery.test.ts','tests/bureaucrat-payment.test.ts','tests/bureaucrat-payment-controls.test.tsx','tests/bureaucrat-payment-bots.test.ts','tests/bureaucrat-payment-recovery.test.ts','tests/smuggler-shipment.test.ts','tests/smuggler-shipment-controls.test.tsx','tests/smuggler-shipment-recovery.test.ts','tests/smuggler-no-field.test.ts','tests/smuggler-no-field-controls.test.tsx','tests/smuggler-no-field-recovery.test.ts','tests/spice-banker.test.ts','tests/spice-banker-recovery.test.ts','tests/spice-banker-controls.test.tsx','tests/sandmaster-movement.test.ts','tests/sandmaster-movement-recovery.test.ts','tests/sandmaster-movement-controls.test.tsx','tests/diplomat-defense.test.ts','tests/diplomat-defense-controls.test.tsx','tests/diplomat-defense-recovery.test.ts'] },
],
},
{
id: 'card-recruits',
title: 'Recruits and the Ecaz Treachery Cards variant',
category: 'Cards',
coverage: 'Partial',
developmentStage: 'Prototyped',
summary: 'During Revival, Recruits doubles every faction’s current free rate and raises the ordinary force limit to seven for this turn.',
steps: [
'The separate three-card variant includes Recruits, Reinforcements and Harass & Withdraw. It does not require the Ecaz faction. A development preview includes all three physical cards before setup; the other two battle effects remain unfinished.',
'The holder may play Recruits from its Revival panel. Discard the card once, then all players use the increased rates while this Revival phase remains open, including players who had already marked themselves ready. Completed returns still count toward their turn totals.',
'Atreides rises from two free forces to four; Fremen from three to six; Guild from one to two. The ordinary force limit becomes seven. Native unlimited CHOAM and Tleilaxu allowances remain unlimited, and their free rates become zero and four. Paid prices and separate elite limits still apply.',
'Free-revival prevention still prevents free returns. A Fremen ally grant completed before Recruits doubles from three to six. A later grant, play after a paid ordinary return, unresolved transactions and a second use in the same turn remain guarded pending their rules decisions.',
'The preview supports Basic or Advanced faction games without additional optional modules. Public activation, the other two card effects and complete combined-game acceptance remain unfinished.',
],
related: ['revival', 'ecaz-modules', 'expansion-faction-games', 'implementation-checklist'],
checklist: [
{ area: 'Implementation', status: 'Partial', detail: 'Genuine independent three-card setup, physical Recruits play/discard, public turn effect, shared revival quotes, preserved use and guarded timing are connected. Reinforcements and Harass & Withdraw remain missing.', evidence: ['game/ecaz-cards.ts', 'game/recruits.ts', 'game/revival.ts', 'game/engine.ts'] },
{ area: 'Player controls', status: 'Implemented', detail: 'The owned physical card has full inspection, a Revival action and explicit unavailable reasons. All seats see the effective public rates after play.', evidence: ['components/recruits.tsx', 'components/game-table.tsx', 'game/card-presentation.ts'] },
{ area: 'AI', status: 'Partial', detail: 'All four profiles use the same legal owned offer for useful own or allied revival, then existing authoritative revival choices. Complete card strategy and calibration remain unfinished.', evidence: ['game/bots.ts'] },
{ area: 'Documentation', status: 'Implemented', detail: 'The card guide records examples, current prototype limits and the independent-cap inference; late-paid and late-rate questions remain explicit.', evidence: ['docs/RECRUITS_RULES.md', 'docs/RECRUITS_RUNTIME.md'] },
{ area: 'Verification', status: 'Partial', detail: 'Focused rules, controls, AI and authenticated recovery checks cover the bounded preview. Sample and browser evidence is recorded separately; full variant acceptance remains open.', evidence: ['tests/recruits.test.ts', 'tests/recruits-engine.test.ts', 'tests/recruits-controls.test.tsx', 'tests/recruits-recovery.test.ts', 'tests/prototype-room.test.ts'] },
],
},
{
id: 'expansion-faction-games',
title: 'Expansion faction development games',
@@ -3680,7 +3703,7 @@ export const RULE_TOPICS: RuleTopic[] = [
'Development setup supports two through six distinct seats from the base factions and selected expansion sets. Expansion selection and optional modules are separate; public expansion starts remain disabled.',
'Ecaz places six starting forces in Imperial Basin, allocated among sectors 9, 10 and 11, and keeps fourteen in reserve. Finish Fremen placement first; Bene Gesserit then places its Advanced starting advisor. Moritani places its six forces in an unoccupied territory after all other setup is complete.',
'Ixians keep their private starting-card selection and physical cyborg/suboid forces. Tleilaxu receives three private Face Dancers. Advanced CHOAM receives its Auditor. Richese has a separate ten-card cache and three private No-Fields. Ecaz and Moritani receive their Ambassador and Terror inventories and share one Duke Vidal disc.',
'Without Ix, CHOAM adds Poison Tooth and Artillery Strike to the 33-card ordinary deck. With Ix, its 47-card deck contains those physical cards once. Ecaz faction selection adds no Treachery Cards: Recruits, Reinforcements and Harass & Withdraw form a separate unfinished optional variant.',
'Without Ix, CHOAM adds Poison Tooth and Artillery Strike to the 33-card ordinary deck. With Ix, its 47-card deck contains those physical cards once. Ecaz faction selection adds no Treachery Cards: the separate three-card variant has a Recruits development preview; Reinforcements and Harass & Withdraw remain unfinished.',
'Advanced Ixians may explicitly decline Technology for one Richese special lot. Their once-per-round use remains available later. The special-lot exchange itself is unfinished pending replacement-card custody interpretation.',
'Fresh unsupported movement arrivals reject before opening prevention choices or reserving a new movement card. A saved CHOAM allow choice can return an uncommitted unsupported move for another choice, preserving its existing reserved Ornithopter. Simultaneous Ambassador/Terror order remains unresolved.',
'Ordinary shipment checks unfinished arrival combinations before saving the Guild interception choice. An already saved ordinary shipment may return unspent to its shipper when allowance encounters that arrival guard, so the shipper can choose another destination. Older No-Field, Smuggler, Nexus and Ambassador shipments are excluded from this recovery. Simultaneous arrival order remains unfinished.',
+30 -7
View File
@@ -2,9 +2,16 @@ import type { Game, Player } from './engine';
import { faction, type FactionId } from './catalog';
import { isAuditorLeader } from './choam-auditor';
import { homeworldLowBonus } from './homeworld-benefits';
import { recruitsRevivalAllowance } from './recruits';
type RevivalRateContext = Pick<
Game,
'advanced' | 'players' | 'homeworlds' | 'revivalRules' | 'freeRevival'
| 'advanced'
| 'players'
| 'homeworlds'
| 'revivalRules'
| 'freeRevival'
| 'turn'
| 'recruits'
>;
export type RevivalRules = {
expanded: string[];
@@ -57,19 +64,35 @@ export function freeRevivalRate(
* the extra free rate never creates an additional paid allowance. */
export function normalForceRevivalLimit(
g: RevivalRateContext,
p: Pick<Player, 'id' | 'faction'>,
p: Pick<Player, 'id' | 'faction' | 'revived' | 'freeForcesRevived'>,
) {
return Math.max(forceRevivalLimit(g, p), freeRevivalRate(g, p));
return normalRevivalAllowance(g, p).limit;
}
export function normalRevivalAllowance(
g: RevivalRateContext,
p: Pick<Player, 'id' | 'faction' | 'revived' | 'freeForcesRevived'>,
) {
const currentFreeRate = freeRevivalRate(g, p);
return recruitsRevivalAllowance(g, {
currentFreeRate,
currentLimit: Math.max(forceRevivalLimit(g, p), currentFreeRate),
revived: p.revived,
// A Recruits activation is rejected when this ledger is absent and use is
// nonzero. The fallback preserves old-room behavior while the card is idle.
freeAllowanceUsed:
g.recruits?.turn === g.turn ? (p.freeForcesRevived ?? p.revived) : p.revived,
freeRateCap: 20,
});
}
export function freeRevivalRemaining(
g: RevivalRateContext,
p: Pick<Player, 'id' | 'faction' | 'revived'>,
p: Pick<Player, 'id' | 'faction' | 'revived' | 'freeForcesRevived'>,
) {
return Math.max(0, freeRevivalRate(g, p) - p.revived);
return normalRevivalAllowance(g, p).freeRemaining;
}
export function forceRevivalQuote(
g: RevivalRateContext,
p: Pick<Player, 'id' | 'faction' | 'revived'>,
p: Pick<Player, 'id' | 'faction' | 'revived' | 'freeForcesRevived'>,
amount: number,
elite = 0,
freeElite?: number,
@@ -89,7 +112,7 @@ export function forceRevivalQuote(
/** Normal force returns only; Emperor-funded extra revivals and card effects are separate. */
export function forceRevivalRemaining(
g: RevivalRateContext,
p: Pick<Player, 'id' | 'faction' | 'revived' | 'tanks'>,
p: Pick<Player, 'id' | 'faction' | 'revived' | 'freeForcesRevived' | 'tanks'>,
) {
return Math.max(
0,