Allow Richese reveal during selected responses
Verify and publish checkpoint container / container (push) Canceled after 0s
Verify and publish checkpoint container / container (push) Canceled after 0s
This commit is contained in:
1 parent
a1b2aacbac
commit
82d857b667
9 files changed
+518
-4
No files matched your search
@@ -1,4 +1,5 @@
|
||||
import type { Game } from './engine';
|
||||
import { validateFremenRevivalGrant } from './fremen-revival-grant';
|
||||
|
||||
const factions = new Set([
|
||||
'atreides', 'beneGesserit', 'emperor', 'fremen', 'guild', 'harkonnen',
|
||||
@@ -18,7 +19,7 @@ export function richeseRevealInterruptSupported(g: Game): boolean {
|
||||
g.players.some(player => (player.faction === 'ixians' || player.faction === 'tleilaxu') && !g.expansions.includes('ix')) ||
|
||||
g.coalitionState || g.coalitionPreview || g.techTokens || g.strongholdCards || g.leaderSkills ||
|
||||
g.homeworlds || g.nexusCards || g.discoveryEnabled || g.discoveries || g.discoveryStash ||
|
||||
g.greatMaker || g.sandtrout || g.ecazTreachery || g.truthtrance || g.response ||
|
||||
g.greatMaker || g.sandtrout || 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;
|
||||
@@ -53,6 +54,46 @@ export function richeseRevealInterruptSupported(g: Game): boolean {
|
||||
g.mixedAllianceQuestions, g.mixedMovementQuestions, g.mixedTraitorQuestions, g.mixedBattleQuestions];
|
||||
if (mixed.some(rows => rows?.some(row => row.turn === g.turn && row.binding))) return false;
|
||||
|
||||
if (g.response) {
|
||||
// Only independent, un-nested native responses with a stable original
|
||||
// source are admitted. In particular, shipment and revival transactions
|
||||
// still need their own continuation proofs.
|
||||
const response = g.response;
|
||||
if (g.decision || g.phaseOpening || g.choamMarket ||
|
||||
!Array.isArray(response.passed) || new Set(response.passed).size !== response.passed.length ||
|
||||
response.passed.some(id => !g.players.some(player => player.id === id))) return false;
|
||||
const owner = g.players.find(player => player.id === response.owner);
|
||||
if (!owner) return false;
|
||||
const keys = Object.keys(response).sort().join(',');
|
||||
if (response.kind === 'choamCharity')
|
||||
return keys === 'kind,owner,passed' && g.phase === 2 && owner.faction === 'choam' &&
|
||||
g.choamCharity?.turn !== g.turn;
|
||||
if (response.kind === 'atreidesAuction') {
|
||||
if (keys !== 'kind,owner,passed' || g.phase !== 3 || owner.faction !== 'atreides') return false;
|
||||
return !g.richeseAuction && !!g.auction && Array.isArray(g.auction.cards) && Number.isSafeInteger(g.auction.index) && g.auction.index >= 0 &&
|
||||
!!g.auction.cards[g.auction.index];
|
||||
}
|
||||
if (response.kind === 'richeseAuction') {
|
||||
const round = g.richeseBidding;
|
||||
return keys === 'kind,owner,passed' && g.phase === 3 && owner.faction === 'richese' &&
|
||||
!!round && round.turn === g.turn && round.owner === response.owner && round.stage === 'declaration' &&
|
||||
(round.position === 'first' || round.position === 'last') &&
|
||||
Number.isSafeInteger(round.normalCount) && round.normalCount! >= 0 && round.normalCount! <= g.players.length &&
|
||||
!round.cacheCanceled && !g.auction && !g.richeseAuction && !g.ixAuction && Array.isArray(g.richeseCache) &&
|
||||
(round.normalCountBeforeCache === undefined || Number.isSafeInteger(round.normalCountBeforeCache) &&
|
||||
round.normalCountBeforeCache >= round.normalCount! && round.normalCountBeforeCache <= g.players.length &&
|
||||
round.normalCountBeforeCache - round.normalCount! <= 1);
|
||||
}
|
||||
if (response.kind === 'fremenRevivalGrant') {
|
||||
if (keys !== 'fremenGrant,kind,owner,passed,recipient' || g.phase !== 4 ||
|
||||
owner.faction !== 'fremen' || !response.fremenGrant ||
|
||||
response.fremenGrant.owner !== response.owner || response.fremenGrant.recipient !== response.recipient)
|
||||
return false;
|
||||
try { validateFremenRevivalGrant(g, response.fremenGrant); return true; }
|
||||
catch { return false; }
|
||||
}
|
||||
return false;
|
||||
}
|
||||
if (g.phaseOpening)
|
||||
return g.expansions.includes('ix') && !!g.amalWindowOpen && !g.decision && !g.choamMarket;
|
||||
const decision = g.decision;
|
||||
|
||||
Reference in new issue
Block a user