Support mixed Truthtrance questions in Richese auctions
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
1f3bc349ba
commit
6ce9a4b4a7
16 files changed
+504
-10
No files matched your search
@@ -13,6 +13,7 @@ import { parseBattleActionClaim, MIXED_BATTLE_MAX_NODES, MIXED_BATTLE_MAX_TERMS,
|
||||
import { parseAllianceExpressionClaim, allianceExpressionText, type AllianceExpressionClaim } from './alliance-expression-promises';
|
||||
import { parseAllianceActionClaim, type MixedAllianceClaim } from './mixed-alliance-question';
|
||||
import { parseBidActionClaim, MIXED_BID_MAX_DEPTH, MIXED_BID_MAX_LEAVES, type MixedBidClaim } from './mixed-bid-question';
|
||||
import type { MixedRicheseBidClaim } from './mixed-richese-bid-question';
|
||||
import { parseRevivalActionClaim, type MixedRevivalClaim } from './mixed-revival-question';
|
||||
import { parseBribePaymentClaim, type MixedBribeClaim } from './mixed-bribe-question';
|
||||
import { parseMixedActionExpression, mixedActionExpressionText, type MixedActionExpression } from './mixed-action-question';
|
||||
@@ -112,6 +113,7 @@ export type TruthQuestion =
|
||||
| ({ kind: 'allianceExpression'; target: string } & AllianceExpressionClaim)
|
||||
| ({ kind: 'mixedAlliance'; target: string } & MixedAllianceClaim)
|
||||
| ({ kind: 'mixedBid'; target: string } & MixedBidClaim)
|
||||
| ({ kind: 'mixedRicheseBid'; target: string } & MixedRicheseBidClaim)
|
||||
| ({ kind: 'mixedRevival'; target: string } & MixedRevivalClaim)
|
||||
| ({ kind: 'mixedBribe'; target: string } & MixedBribeClaim)
|
||||
| ({ kind: 'mixedMovement'; target: string } & MixedMovementClaim)
|
||||
@@ -461,6 +463,19 @@ function parseQuestion(g: Game, asker: string, value: unknown): TruthQuestion {
|
||||
'Choose a quiet supported Once Around or Silent auction and its current public event.');
|
||||
return { kind: 'richeseBid', target: v.target, ...claim };
|
||||
}
|
||||
if (v.kind === 'mixedRicheseBid') {
|
||||
check(Object.keys(v).sort().join(',') === 'event,kind,mixed,target,turn',
|
||||
'Supply the current Richese lot, turn, complete mixed bid question and respondent.');
|
||||
const claim = parseRicheseBidClaim({turn:v.turn,event:v.event,minimum:1}), lot = g.richeseAuction;
|
||||
check(bidPromiseModeSupported({ ...g, semutaPreview: undefined }) && g.status === 'playing' && g.phase === 3 && lot &&
|
||||
(lot.method === 'onceAround' || lot.method === 'silent') && !lot.outcome && lot.event === claim.event && claim.turn === g.turn &&
|
||||
!g.response && !g.decision && !g.phaseOpening && !g.pendingKarama && !g.pendingTreacheryDiscard,
|
||||
'Choose a quiet supported Once Around or Silent auction and its current public event.');
|
||||
const respondent = g.players.find(player => player.id === v.target)!;
|
||||
return {kind:'mixedRicheseBid', target:v.target as string, turn:claim.turn, event:claim.event,
|
||||
mixed:parseMixedActionExpression(v.mixed, fact => parseFact(g,fact,respondent), parseBidActionClaim,
|
||||
{maxLeaves:MIXED_BID_MAX_LEAVES,maxDepth:MIXED_BID_MAX_DEPTH})};
|
||||
}
|
||||
if (v.kind === 'phaseBid') {
|
||||
check(Object.keys(v).sort().join(',') === 'kind,minimum,target,turn',
|
||||
'Supply the current turn, phase bid minimum and respondent.');
|
||||
@@ -1023,6 +1038,8 @@ export function truthQuestionText(
|
||||
action => `you ${allianceClaimText({ turn: q.turn, partner: action.partner }, playerName)}`)}?`;
|
||||
if (q.kind === 'mixedBid') return `Is it true that ${mixedActionExpressionText(q.mixed, clause,
|
||||
action => `you ${bidClaimText({ turn: q.turn, lot: q.lot, minimum: action.minimum })}`)}?`;
|
||||
if (q.kind === 'mixedRicheseBid') return `Is it true that ${mixedActionExpressionText(q.mixed, clause,
|
||||
action => `you ${richeseBidClaimText({turn:q.turn,event:q.event,minimum:action.minimum})}`)}?`;
|
||||
if (q.kind === 'mixedRevival') return `Is it true that ${mixedActionExpressionText(q.mixed, clause,
|
||||
action => `you ${revivalExpressionText(action, id => id === 'kwisatz' ? 'Kwisatz Haderach' : leaderName(id))} before your Revival opportunity ends`)}?`;
|
||||
if (q.kind === 'mixedBribe') return `Is it true that ${mixedActionExpressionText(q.mixed, clause,
|
||||
@@ -1085,6 +1102,8 @@ export function resolveTruthAction(
|
||||
bindRevival?: (g: Game, p: Player, claim: RevivalClaim, answer: boolean, asker: string) => void;
|
||||
mixedBidAnswers?: (g: Game, p: Player, claim: MixedBidClaim) => TruthAnswer[];
|
||||
bindMixedBid?: (g: Game, p: Player, claim: MixedBidClaim, answer: boolean, asker: string) => void;
|
||||
mixedRicheseBidAnswers?: (g: Game, p: Player, claim: MixedRicheseBidClaim) => TruthAnswer[];
|
||||
bindMixedRicheseBid?: (g: Game, p: Player, claim: MixedRicheseBidClaim, answer: boolean, asker: string) => void;
|
||||
bidAnswers?: (g: Game, p: Player, claim: BidClaim) => TruthAnswer[];
|
||||
bindBid?: (g: Game, p: Player, claim: BidClaim, answer: boolean, asker: string) => void;
|
||||
charityAnswers?: (g: Game, p: Player, turn: number) => TruthAnswer[];
|
||||
@@ -1324,6 +1343,9 @@ export function resolveTruthAction(
|
||||
if (w.question.kind === 'mixedBid')
|
||||
check(effects.mixedBidAnswers?.(g, g.players.find(other => other.id === w.question!.target)!, w.question).length,
|
||||
'Choose a mixed current-fact and bid question with an available ordinary-lot opportunity.');
|
||||
if (w.question.kind === 'mixedRicheseBid')
|
||||
check(effects.mixedRicheseBidAnswers?.(g, g.players.find(other => other.id === w.question!.target)!, w.question).length,
|
||||
'Choose a mixed current-fact and bid question with an available Richese auction opportunity.');
|
||||
if (w.question.kind === 'bid')
|
||||
check(effects.bidAnswers?.(g, g.players.find(other => other.id === w.question!.target)!, w.question).length,
|
||||
'Choose a bidder with a remaining ordinary opportunity in this lot.');
|
||||
@@ -1474,6 +1496,11 @@ export function resolveTruthAction(
|
||||
'Choose a whole mixed-bid answer compatible with current facts and native ordinary declarations.');
|
||||
if (a.answer !== 'unknown') effects.bindMixedBid(g, p, q, a.answer === 'yes', current.player);
|
||||
}
|
||||
if (q.kind === 'mixedRicheseBid') {
|
||||
check(effects.mixedRicheseBidAnswers && effects.bindMixedRicheseBid && effects.mixedRicheseBidAnswers(g, p, q).includes(a.answer),
|
||||
'Choose a whole mixed-bid answer compatible with current facts and native Richese declarations.');
|
||||
if (a.answer !== 'unknown') effects.bindMixedRicheseBid(g, p, q, a.answer === 'yes', current.player);
|
||||
}
|
||||
if (q.kind === 'bid') {
|
||||
check(effects.bidAnswers && effects.bindBid && effects.bidAnswers(g, p, q).includes(a.answer),
|
||||
'Choose an answer consistent with this lot, your legal bids and earlier answers.');
|
||||
|
||||
Reference in new issue
Block a user