Support phase-wide bidding across all auctions
Verify and publish checkpoint container / container (push) Successful in 12m14s

This commit is contained in:
Quintine committed 2026-11-16 19:17:36 +11:00
1 parent 12060f3112
commit 38f1684e03
17 files changed
+1070 -18

No files matched your search

+26
View File
@@ -89,6 +89,7 @@ import { parseNoFieldValueFact, noFieldValueFactMatches, noFieldValueFactText, t
import { parseFaceDancerFact, faceDancerFactMatches, faceDancerFactText, type FaceDancerFact } from './truthtrance-face-dancer';
import { parseBidClaim, bidClaimText, bidPromiseModeSupported, currentBidPromiseModeSupported, type BidClaim } from './bid-promises';
import { parsePhaseBidClaim, phaseBidClaimText, phaseBidPromiseModeSupported, type PhaseBidClaim } from './turn-bid-promises';
import { parsePhaseAnyBidClaim, phaseAnyBidClaimText, phaseAnyBidPromiseModeSupported, type PhaseAnyBidClaim } from './phase-any-bid-promises';
import { parseRicheseBidClaim, richeseBidClaimText, type RicheseBidClaim } from './richese-bid-promises';
import { parseEarlyRicheseBidClaim, earlyRicheseBidClaimText, type EarlyRicheseBidClaim } from './early-richese-bid';
@@ -128,6 +129,7 @@ export type TruthQuestion =
| ({ kind: 'revival'; target: string } & RevivalClaim)
| ({ kind: 'bid'; target: string } & BidClaim)
| ({ kind: 'phaseBid'; target: string } & PhaseBidClaim)
| ({ kind: 'phaseAnyBid'; target: string } & PhaseAnyBidClaim)
| ({ kind: 'richeseBid'; target: string } & RicheseBidClaim)
| ({ kind: 'earlyRicheseBid'; target: string } & EarlyRicheseBidClaim)
| { kind: 'traitorCall'; target: string; battle: string; territory: string }
@@ -488,6 +490,19 @@ function parseQuestion(g: Game, asker: string, value: unknown): TruthQuestion {
'Choose the current turn and a quiet supported ordinary Bidding opportunity.');
return { kind: 'phaseBid', target: v.target, ...claim };
}
if (v.kind === 'phaseAnyBid') {
check(Object.keys(v).sort().join(',') === 'kind,minimum,target,turn',
'Supply the current turn, phase bid minimum and respondent.');
const claim = parsePhaseAnyBidClaim(v), lot = g.richeseAuction;
check(phaseAnyBidPromiseModeSupported(g) && g.status === 'playing' && Number.isInteger(g.phase) &&
g.phase >= 0 && g.phase <= 3 && claim.turn === g.turn && !g.currentAuctionSale && !g.ixAuction &&
(g.phase < 3 || !!g.auction && !lot || !!lot && !lot.outcome && !g.auction &&
(lot.method === 'normal' || lot.method === 'onceAround' || lot.method === 'silent')) &&
!g.response && !g.decision && !g.phaseOpening && !g.pendingRevival && !g.pendingKull &&
!g.pendingKarama && !g.pendingTreacheryDiscard,
'Choose a quiet supported current-turn Bidding opportunity.');
return {kind:'phaseAnyBid',target:v.target,...claim};
}
if (v.kind === 'mixedBid') {
check(Object.keys(v).sort().join(',') === 'kind,lot,mixed,target,turn',
'Supply the current ordinary lot, turn, complete mixed bid question and respondent.');
@@ -949,6 +964,7 @@ export function truthQuestionText(
if (q.kind === 'revival') return `Will you ${revivalClaimText(q)}?`;
if (q.kind === 'bid') return `Will you ${bidClaimText(q)}?`;
if (q.kind === 'phaseBid') return `Will you ${phaseBidClaimText(q)}?`;
if (q.kind === 'phaseAnyBid') return `Will you ${phaseAnyBidClaimText(q)}?`;
if (q.kind === 'richeseBid') return `Will you ${richeseBidClaimText(q)}?`;
if (q.kind === 'earlyRicheseBid') return `Will you ${earlyRicheseBidClaimText(q)}?`;
if (q.kind === 'traitorCall') return `In this revealed battle in ${locationName(q.territory)}, will you declare the opposing leader a Traitor?`;
@@ -1114,6 +1130,8 @@ export function resolveTruthAction(
bindEarlyRicheseBid?: (g: Game, p: Player, claim: EarlyRicheseBidClaim, answer: boolean, asker: string) => void;
phaseBidAnswers?: (g: Game, p: Player, claim: PhaseBidClaim) => TruthAnswer[];
bindPhaseBid?: (g: Game, p: Player, claim: PhaseBidClaim, answer: boolean, asker: string) => void;
phaseAnyBidAnswers?: (g: Game, p: Player, claim: PhaseAnyBidClaim) => TruthAnswer[];
bindPhaseAnyBid?: (g: Game, p: Player, claim: PhaseAnyBidClaim, answer: boolean, asker: string) => void;
travelAnswers?: (g: Game, p: Player, claim: TravelClaim) => TruthAnswer[];
bindTravel?: (g: Game, p: Player, claim: TravelClaim, answer: boolean, asker: string) => void;
turnActionAnswers?: (g: Game, p: Player, claim: TurnActionClaim) => TruthAnswer[];
@@ -1361,6 +1379,9 @@ export function resolveTruthAction(
if (w.question.kind === 'phaseBid')
check(effects.phaseBidAnswers?.(g, g.players.find(other => other.id === w.question!.target)!, w.question).length,
'Choose a phase bid question compatible with supported native opportunities and earlier answers.');
if (w.question.kind === 'phaseAnyBid')
check(effects.phaseAnyBidAnswers?.(g, g.players.find(other => other.id === w.question!.target)!, w.question).length,
'Choose a phase bid question compatible with supported native opportunities and earlier answers.');
if (w.question.kind === 'travel')
check(effects.travelAnswers?.(g, g.players.find(other => other.id === w.question!.target)!, w.question).length,
'Choose an unused or active native Shipment and Movement opportunity.');
@@ -1526,6 +1547,11 @@ export function resolveTruthAction(
'Choose an answer consistent with native bids and earlier phase commitments.');
if (a.answer !== 'unknown') effects.bindPhaseBid(g, p, q, a.answer === 'yes', current.player);
}
if (q.kind === 'phaseAnyBid') {
check(effects.phaseAnyBidAnswers && effects.bindPhaseAnyBid && effects.phaseAnyBidAnswers(g, p, q).includes(a.answer),
'Choose an answer consistent with native bids and earlier phase commitments.');
if (a.answer !== 'unknown') effects.bindPhaseAnyBid(g, p, q, a.answer === 'yes', current.player);
}
if (q.kind === 'travel') {
check(effects.travelAnswers && effects.bindTravel && effects.travelAnswers(g, p, q).includes(a.answer),
'Choose a whole travel answer compatible with native actions and earlier commitments.');