Preserve travel funding in deal payment quotes
Verify and publish checkpoint container / container (push) Canceled after 0s

This commit is contained in:
Quintine committed 2026-11-16 14:22:26 +11:00
1 parent 5e294215be
commit 0b8a147388
5 files changed
+191 -2

No files matched your search

+12 -2
View File
@@ -6103,6 +6103,10 @@ function publicDealCompletion(g: Game, payer: Player): boolean {
const trial = structuredClone(candidate);
try {
quoteOrdinaryPayments(trial,payer.id,[{recipient:debt.recipient,amount:debt.amount}]);
// A scheduled travel term may have acquired a legal route since
// acceptance. Preserve that route across every hypothetical
// payment, using the actual state immediately before that payment.
reconcileTravelPromises(trial,payer.id,{type:'bribe'},candidate.phase,candidate);
if (visit(trial,remaining.filter((_,position) => position !== index))) return true;
} catch (error) { if (!(error instanceof RuleError)) throw error; }
}
@@ -17783,10 +17787,12 @@ function bribePaymentPreservesPromises(g: Game, p: Player, recipient: string, am
actor.spice -= amount;
const voluntary = { actor: p.id, action: { type: 'bribe' } };
reconcileBattlePromises(trial, voluntary);
reconcileTravelPromises(trial,p.id,voluntary.action,g.phase,g);
reconcileShipmentPromises(trial, voluntary);
if (hasMovementPromises(trial, p.id, true) &&
!groundMovementCompletion(trial, p.id)) return false;
reconcileRevivalPromises(trial, voluntary);
if (publicDealCompletion(g,p) && !publicDealCompletion(trial,actor)) return false;
return liveTurnActionPromises(trial.turnActionPromises ?? [], p.id, trial.turn).length
? !!turnActionCompletion(trial, p.id) : !hasBribePromises(trial, p.id) || !!bribePromiseCompletion(trial, actor);
} catch (error) { if (error instanceof BribeExpressionPromiseError || error instanceof BribePromiseError || error instanceof RuleError) return false; throw error; }
@@ -17860,10 +17866,12 @@ function basicBribeInterrupt(g: Game, p: Player): boolean {
function projectedBribes(g: Game, p: Player): BribeOptions {
const available = Math.max(0, uncommittedSpice(g, p)),
blocked = basicBribeInterrupt(g, p) ? null : bribeTimingBlock(g);
const dueDeals = pendingPublicDealPayments(g.deals ?? [],p.id,g.turn)
.some(debt => !bribeAllied(g,p,debt.recipient));
const constrained = liveTurnActionPromises(g.turnActionPromises ?? [], p.id, g.turn).length > 0 || hasBribePromises(g, p.id) ||
g.battle?.truthPromises?.some(promise => promise.player === p.id && !promise.released && !g.battle?.revealed && !g.battle?.plans[p.id]) ||
liveShipmentPromises(g.shipmentPromises ?? [], p.id, g.turn).length ||
hasMovementPromises(g, p.id, true) ||
hasMovementPromises(g, p.id) || dueDeals ||
liveRevivalPromises(g.revivalPromises ?? [], p.id, g.turn).some(promise => promise.answer) ||
liveLeaderRevivalPromises(g.leaderRevivalPromises ?? [], p.id, g.turn).some(promise => promise.answer) ||
liveRevivalExpressionPromises(g.revivalExpressionPromises ?? [], p.id, g.turn).some(promise => promise.answer);
@@ -17871,7 +17879,9 @@ function projectedBribes(g: Game, p: Player): BribeOptions {
targets: g.players.filter(target => target.id !== p.id && !bribeAllied(g, p, target.id)).map(target => {
let limit = !blocked && constrained ? maximumBribe(available,
amount => bribePaymentPreservesPromises(g, p, target.id, amount)) : available;
let limitation: string | null = limit < available ? 'Your Truthtrance answers limit this recipient’s payment.' : null;
let limitation: string | null = limit < available
? dueDeals || hasPublicDealTravel(g,p.id) ? 'Your accepted commitments limit this recipient’s payment.'
: 'Your Truthtrance answers limit this recipient’s payment.' : null;
if (!blocked && limit >= 5) {
try { checkBureaucratContributors(g, target.id, [{ payer: p.id, amount: limit }]); }
catch (error) {