Preserve cache promises and support concealed Ambassador collection
Verify and publish checkpoint container / container (push) Successful in 11m9s
Verify and publish checkpoint container / container (push) Successful in 11m9s
This commit is contained in:
1 parent
3ede19c90a
commit
1a65e69932
14 files changed
+594
-9
No files matched your search
@@ -18641,6 +18641,18 @@ function reconcileEarlyRicheseTruth(g: Game,voluntary?: {actor:string;action:Act
|
||||
}
|
||||
}
|
||||
}
|
||||
/** Once another player's cancellation is committed, the cache no longer
|
||||
* exists even if an Atreides inspection or Semuta continuation opens next. */
|
||||
function finishCanceledEarlyRicheseTruth(g: Game): void {
|
||||
if (!g.earlyRicheseBidPromises?.length) return;
|
||||
for (const p of g.players) {
|
||||
const before: EarlyRicheseBidPromise[] = g.earlyRicheseBidPromises ?? [];
|
||||
g.earlyRicheseBidPromises = earlyRicheseBidRule((): EarlyRicheseBidPromise[] => reconcileEarlyRicheseBids(before,p.id,g.turn,
|
||||
{cachePending:false,canBid:false,maximum:0,change:'external'}));
|
||||
if (g.earlyRicheseBidPromises.some((row,index) => row.player === p.id && row.released && !before[index]?.released))
|
||||
log(g, `${p.name} can no longer fulfill the early Richese cache bid answer; it is no longer binding.`);
|
||||
}
|
||||
}
|
||||
function richeseBidWindow(g: Game): boolean {
|
||||
return bidPromiseModeSupported({ ...g, semutaPreview: undefined }) && g.status === 'playing' && g.phase === 3 &&
|
||||
!!g.richeseAuction && ['onceAround','silent'].includes(g.richeseAuction.method) && !g.richeseAuction.outcome &&
|
||||
@@ -20134,12 +20146,37 @@ function karamaCard(g: Game, p: Player, id?: unknown, purpose?: KullPurpose) {
|
||||
);
|
||||
return available.find((c) => c.effect === 'karama') ?? available[0];
|
||||
}
|
||||
/** Only a still-feasible own Yes prevents the player from canceling its
|
||||
* first cache; an externally impossible answer is not revived by this check. */
|
||||
function earlyRicheseCancellationBlocked(g: Game, p: Player, response: ResponseWindow): boolean {
|
||||
if (response.kind !== 'richeseAuction' || response.owner === p.id || !g.richeseBidding || !richeseCacheRuns(g)) return false;
|
||||
const early = liveEarlyRicheseBidPromises(g.earlyRicheseBidPromises ?? [],p.id,g.turn);
|
||||
const phase = livePhaseBidPromises(g.phaseAnyBidPromises ?? [],p.id,g.turn);
|
||||
const maximum = Math.min(earlyRicheseBidMaximum(g,p),
|
||||
...early.filter(row => !row.answer).map(row => row.minimum - 1),
|
||||
...phase.filter(row => !row.answer).map(row => row.minimum - 1));
|
||||
return early.some(row => row.answer && row.minimum <= maximum);
|
||||
}
|
||||
/** A foreign loss can make an answer impossible while the response is open.
|
||||
* Release that already-impossible answer before the respondent acts. */
|
||||
function reconcileEarlyRicheseCancellationAdmission(g: Game, p: Player): void {
|
||||
if (!g.earlyRicheseBidPromises?.length || !g.richeseBidding) return;
|
||||
const phase = livePhaseBidPromises(g.phaseAnyBidPromises ?? [],p.id,g.turn);
|
||||
const maximum = Math.min(earlyRicheseBidMaximum(g,p),
|
||||
...phase.filter(row => !row.answer).map(row => row.minimum - 1));
|
||||
const before = g.earlyRicheseBidPromises;
|
||||
g.earlyRicheseBidPromises = earlyRicheseBidRule(() => reconcileEarlyRicheseBids(before,p.id,g.turn,
|
||||
{cachePending:richeseCacheRuns(g),canBid:p.hand.length < handLimit(p),maximum,change:'external'}));
|
||||
if (g.earlyRicheseBidPromises.some((row,index) => row.player === p.id && row.released && !before[index]?.released))
|
||||
log(g, `${p.name} can no longer fulfill the early Richese cache bid answer; it is no longer binding.`);
|
||||
}
|
||||
function responseCancelCards(
|
||||
g: Game,
|
||||
p: Player,
|
||||
response: ResponseWindow,
|
||||
): string[] {
|
||||
if (p.id === response.owner) return [];
|
||||
if (earlyRicheseCancellationBlocked(g,p,response)) return [];
|
||||
if (g.pendingKull?.stage === 'counter')
|
||||
return kullCounterCards(p.hand, physicalTreacheryCards(g), g.pendingKull.card,
|
||||
card => {
|
||||
@@ -21554,6 +21591,13 @@ function decideKull(g: Game, p: Player, action: Action): void {
|
||||
function spendKarama(g: Game, p: Player, card: Card, use: KaramaUse, kullOffered = false) {
|
||||
const blocked = karamaSpendingBlock(g, p, card, karamaUsePurpose(g, use));
|
||||
requireRule(!blocked, blocked ?? 'This card cannot be spent as Karama.');
|
||||
// A saved Kull attempt has already entered its interruption; preserve that
|
||||
// committed continuation instead of applying a new admission rule to it.
|
||||
if (!kullOffered && use.kind === 'cancel') {
|
||||
requireRule(!earlyRicheseCancellationBlocked(g,p,use.response),
|
||||
'Keep the Richese cache auction needed for your Truthtrance Yes answer.');
|
||||
if (use.response.kind === 'richeseAuction') reconcileEarlyRicheseCancellationAdmission(g,p);
|
||||
}
|
||||
validateKaramaUse(g, p, use, card);
|
||||
if (!kullOffered && !g.pendingKull && g.kullPreview && byFaction(g, 'choam')?.id !== p.id)
|
||||
requireRule(kullOriginalWholeCostAllowed(g, p, card, use),
|
||||
@@ -40107,6 +40151,7 @@ function finishResponse(g: Game, canceled: boolean, settlement?: BureaucratSettl
|
||||
round.normalCount = round.normalCountBeforeCache ??
|
||||
Math.max(0, round.normalCount! + Number(richeseCacheRuns(g)));
|
||||
round.cacheCanceled = true;
|
||||
finishCanceledEarlyRicheseTruth(g);
|
||||
log(
|
||||
g,
|
||||
'The compulsory Richese cache auction was canceled; one ordinary lot is restored.',
|
||||
@@ -51267,6 +51312,9 @@ export function viewGame(state: Game, id: string, now?: number) {
|
||||
? {
|
||||
cancelCards: emperorGuildRatePriority(g) ? [] : responseCancelCards(g, me, g.response),
|
||||
hasPassed: g.response.passed.includes(id),
|
||||
...(earlyRicheseCancellationBlocked(g,me,g.response) ? {
|
||||
blocked: 'Your Truthtrance Yes requires the Richese cache auction to remain available.',
|
||||
} : {}),
|
||||
}
|
||||
: undefined,
|
||||
revivalPrevention:
|
||||
|
||||
Reference in new issue
Block a user