Support deferred payments with travel deals
Verify and publish checkpoint container / container (push) Successful in 11m29s
Verify and publish checkpoint container / container (push) Successful in 11m29s
This commit is contained in:
1 parent
9536c77062
commit
5e294215be
16 files changed
+603
-100
No files matched your search
+11
-14
@@ -6127,6 +6127,7 @@ function publicDealCompletion(g: Game, payer: Player): boolean {
|
||||
!turnActionCompletion(trial,payer.id)) return false;
|
||||
const voluntary = {actor:payer.id,action:{type:'bribe'}};
|
||||
reconcileBattlePromises(trial,voluntary);
|
||||
reconcileTravelPromises(trial,payer.id,voluntary.action,g.phase);
|
||||
reconcileShipmentPromises(trial,voluntary);
|
||||
reconcileGroundMovementPromises(trial,payer.id,voluntary.action,g.phase);
|
||||
reconcileBidPromises(trial,voluntary);
|
||||
@@ -24323,9 +24324,6 @@ function bindPublicDealTravel(g: Game, deal: PublicDeal) {
|
||||
const action = { kind: term.kind, territory: term.territory, minimum: term.minimum };
|
||||
const claim: TravelClaim = { turn: due, mixed: { kind: 'action', action } };
|
||||
if (due > g.turn) {
|
||||
requireRule(!g.deals?.some(other => other.payment?.kind === 'deferredBribe' &&
|
||||
other.paymentStatus === 'pending' && other.payment.payer === player.id && other.payment.dueTurn === due),
|
||||
'This traveler already has a payment due in the same turn.');
|
||||
// These are public, physical contradictions, not a forecast of future
|
||||
// funds: there is one shipment, and a required action cannot also be
|
||||
// forbidden at an equal or lower threshold in that same territory.
|
||||
@@ -24342,8 +24340,7 @@ function bindPublicDealTravel(g: Game, deal: PublicDeal) {
|
||||
requireRule(!conflicts, 'This future travel term conflicts with an already accepted public travel agreement.');
|
||||
}
|
||||
if (due === g.turn) {
|
||||
requireRule(travelTargetAvailable(g, player.id) && !g.truthtrance && !hasBribePromises(g, player.id) &&
|
||||
!g.deals?.some(other => other.payment?.kind === 'deferredBribe' && other.paymentStatus === 'pending'),
|
||||
requireRule(travelTargetAvailable(g, player.id) && !g.truthtrance && !hasBribePromises(g, player.id),
|
||||
'This travel agreement needs a supported quiet Basic opportunity in its due turn.');
|
||||
requireRule(travelTruthAnswers(g, player, claim).includes(term.answer ? 'yes' : 'no'),
|
||||
'This travel agreement cannot be accepted at the current opportunity.');
|
||||
@@ -38349,7 +38346,7 @@ function projectedTypedRevivalPromiseGuide(g: Game, player: string, kind: 'force
|
||||
// The separate bid guide owns a jointly binding Yes declaration. Passing
|
||||
// cannot evade it merely because Revival comes later in this turn.
|
||||
const lot = g.phase === 3 && !ownPayment && !g.richeseAuction && !g.ixAuction ? bidOpportunity(g) : null;
|
||||
if (lot && bidRequired(g.bidPromises ?? [], player, lot)) return null;
|
||||
if (lot && (bidRequired(g.bidPromises ?? [], player, lot) || projectedPhaseBidGuide(g,player))) return null;
|
||||
const grouped = liveRevivalExpressionPromises(g.revivalExpressionPromises ?? [], player, g.turn);
|
||||
const named = liveLeaderRevivalPromises(g.leaderRevivalPromises ?? [], player, g.turn);
|
||||
const promise = kind === 'expression' ? grouped[0] : grouped.length ? null : kind === 'leader' ? named[0]
|
||||
@@ -43732,16 +43729,16 @@ function applyActionWithInitiator(state: Game, id: string, action: Action, initi
|
||||
}
|
||||
}
|
||||
g.deals = deals.map((deal, position) => position === index ? next : deal);
|
||||
if (current.status === 'offered' && next.status === 'active' && next.travel &&
|
||||
publicDealTravelDueTurn(next) === g.turn) {
|
||||
const traveler = getPlayer(g,publicDealTravelActor(next));
|
||||
requireRule(publicDealCompletion(g,traveler),
|
||||
'The traveler needs a funded completion for the travel and their payments due this turn.');
|
||||
}
|
||||
if (current.status === 'offered' && next.status === 'active' && next.payment?.kind === 'deferredBribe') {
|
||||
const payer = getPlayer(g,next.payment.payer), dueTurn = next.payment.dueTurn;
|
||||
requireRule(!(g.travelPromises ?? []).some(row => row.sourceDeal && row.player === payer.id &&
|
||||
row.turn === dueTurn && !row.fulfilled && !row.released),
|
||||
'The payer already has a public travel commitment in the payment’s due turn.');
|
||||
requireRule(next.payment.dueTurn !== g.turn ||
|
||||
!liveTravelPromises(g.travelPromises ?? [], payer.id, g.turn).some(row => !!row.sourceDeal),
|
||||
'Finish the current public travel commitment before accepting a payment due this turn.');
|
||||
requireRule(next.payment.dueTurn >= g.turn &&
|
||||
(next.payment.dueTurn > g.turn || publicDealCompletion(g,payer)),
|
||||
requireRule(dueTurn >= g.turn &&
|
||||
(dueTurn > g.turn || publicDealCompletion(g,payer)),
|
||||
'The agreed payment needs an unexpired deadline and, when due now, a legal funded completion.');
|
||||
if (next.payment.dueTurn === g.turn &&
|
||||
(g.phase === 2 && !g.charityOrder || g.phase === 8 || g.phase === 7 && bribesCloseBeforeNextMentat(g)) &&
|
||||
|
||||
Reference in new issue
Block a user