Preserve revealed traitor income and No-Field timing
Verify and publish checkpoint container / container (push) Successful in 11m12s

This commit is contained in:
Quintine committed 2026-11-16 21:19:53 +11:00
1 parent a2e7029a72
commit e81725e4b2
12 files changed
+497 -4

No files matched your search

+37 -1
View File
@@ -1,14 +1,49 @@
import type { Game } from './engine';
import { selectedPhaseModuleRoster } from './faction-module-profile';
import { validateFremenRevivalGrant } from './fremen-revival-grant';
import { richeseRevealForeignMovementPending } from './richese-reveal-foreign-movement';
import { eliteRevivalRemaining, paidForceRevivalCost, revivalPrevented } from './revival';
import { quoteRevivalResume, RevivalResumeError } from './revival-resume';
import { STRONGHOLD_CARDS } from './stronghold-cards';
import { TECH_TOKENS } from './tech-tokens';
const factions = new Set([
'atreides', 'beneGesserit', 'emperor', 'fremen', 'guild', 'harkonnen',
'richese', 'choam', 'ixians', 'tleilaxu', 'ecaz', 'moritani',
]);
/** Selected original phase modules do not spend reserves or add an arrival
* when a marker already on the board is voluntarily materialized. Keep their
* actual current custody intact rather than accepting a fabricated module. */
function phaseModulesSupported(g: Game): boolean {
if (!g.techTokens && !g.strongholdCards) return true;
if (typeof g.advanced !== 'boolean' || !selectedPhaseModuleRoster(g) ||
(g.techTokens && g.players.length < 3) || (g.strongholdCards && !g.advanced)) return false;
const owner = (id: unknown) => id === null ||
typeof id === 'string' && g.players.some(player => player.id === id);
if (g.techTokens) {
const tokens = g.techTokens;
if (typeof tokens !== 'object' || Array.isArray(tokens) ||
Object.keys(tokens).length !== TECH_TOKENS.length ||
TECH_TOKENS.some(({id}) => {
const token = tokens[id];
return !token || typeof token !== 'object' || Array.isArray(token) ||
!owner(token.owner) || !Number.isSafeInteger(token.spice) || token.spice < 0 ||
(token.triggeredTurn !== undefined && (!Number.isSafeInteger(token.triggeredTurn) ||
token.triggeredTurn < 1 || token.triggeredTurn > g.turn));
})) return false;
}
if (g.strongholdCards) {
const cards = g.strongholdCards;
if (typeof cards !== 'object' || Array.isArray(cards) ||
!Number.isSafeInteger(cards.claimedTurn) || cards.claimedTurn < 0 || cards.claimedTurn > g.turn ||
!cards.owners || typeof cards.owners !== 'object' || Array.isArray(cards.owners) ||
Object.keys(cards.owners).length !== STRONGHOLD_CARDS.length ||
STRONGHOLD_CARDS.some(({id}) => !owner(cards.owners[id]))) return false;
}
return true;
}
/** A deliberately bounded admission for an existing before-Battle parent.
* This does not authorize a seat, marker or event, and does not mutate the
* game. The normal No-Field action and view own those checks. */
@@ -21,12 +56,13 @@ export function richeseRevealInterruptSupported(g: Game): boolean {
!Array.isArray(g.players) || !g.players.every(player => factions.has(player.faction)) ||
g.players.some(player => (player.faction === 'ixians' || player.faction === 'tleilaxu') && !g.expansions.includes('ix')) ||
g.players.some(player => (player.faction === 'ecaz' || player.faction === 'moritani') && !g.expansions.includes('ecaz')) ||
g.coalitionState || g.coalitionPreview || g.techTokens || g.strongholdCards || g.leaderSkills ||
g.coalitionState || g.coalitionPreview || g.leaderSkills ||
g.homeworlds || g.nexusCards || g.discoveryEnabled || g.discoveries || g.discoveryStash ||
g.greatMaker || g.ecazTreachery || g.truthtrance ||
g.biddingEnd || g.battle || g.stormResolution || g.spiceResolution || g.spiceSequence ||
g.victoryContinuation || g.currentAuctionSale || g.richeseAllyOffer ||
g.bureaucratPayments?.pending) return false;
if (!phaseModulesSupported(g)) return false;
// A mixed Truthtrance answer can create a private residual only for some
// hidden facts. Fence non-fact questions uniformly before examining those