Support Advanced Truthtrance ally funding
Verify and publish checkpoint container / container (push) Successful in 11m4s
Verify and publish checkpoint container / container (push) Successful in 11m4s
This commit is contained in:
1 parent
e1209083e6
commit
b3843bf18e
10 files changed
+383
-11
No files matched your search
+19
-2
@@ -17058,7 +17058,7 @@ function otherPledgeCommitments(g: Game): boolean {
|
||||
});
|
||||
}
|
||||
function pledgePublicWindow(g: Game): boolean {
|
||||
return g.status === 'playing' && !g.advanced && (g.phase === 3 || g.phase === 5) &&
|
||||
return g.status === 'playing' && (g.phase === 3 || g.phase === 5) &&
|
||||
nativePromiseScopeSupported(g) && !g.kullPreview && !g.semutaPreview && !g.nexusKullPreview &&
|
||||
!g.coalitionPreview && !g.coalitionState &&
|
||||
!g.response && !g.decision && !g.phaseOpening && !g.pendingKarama && !g.pendingTreacheryDiscard &&
|
||||
@@ -17078,6 +17078,8 @@ function pledgeCompletion(g: Game, p: Player, promises = g.pledgePromises ?? [])
|
||||
if (!ally || (g.phase !== 3 && g.phase !== 5)) return null;
|
||||
const required = pledgeRule(() => pledgePromiseRequirements(promises, p.id, g.turn, g.phase, ally));
|
||||
if (!required) return null;
|
||||
// A No-only claim is satisfiable by making no qualifying future update;
|
||||
// this sentinel is not a suggestion to withdraw a currently locked pledge.
|
||||
if (!required.minimum) return {type: 'pledgeAid', amount: 0};
|
||||
const current = g.aid[p.id]?.amount ?? 0;
|
||||
const silent = g.richeseAuction?.method === 'silent' && !g.richeseAuction.outcome &&
|
||||
@@ -17087,7 +17089,22 @@ function pledgeCompletion(g: Game, p: Player, promises = g.pledgePromises ?? [])
|
||||
if (required.maximum !== undefined && amount > required.maximum) return null;
|
||||
try {
|
||||
const trial = structuredClone(g);
|
||||
pledgeAid(trial, getPlayer(trial, p.id), amount);
|
||||
const donor = getPlayer(trial, p.id);
|
||||
// A shipment or Guild transport can be declared before another seat's
|
||||
// response. Its approved price is still in the wallet, but cannot also
|
||||
// witness a future pledge if the declaration completes. The pending
|
||||
// record is cleared before actual payment, so reserve this cost only in
|
||||
// the detached completion quote, never in the live wallet.
|
||||
const shipment = trial.pendingShipment;
|
||||
const offer = shipment?.alliedNoField;
|
||||
const shipmentCost = offer
|
||||
? p.id === offer.owner ? (offer.payer === offer.owner ? shipment.cost : offer.payer === 'both' ? 1 : 0)
|
||||
: p.id === offer.recipient ? (offer.payer === offer.recipient ? shipment.cost : offer.payer === 'both' ? 1 : 0) : 0
|
||||
: shipment?.player === p.id ? shipment.cost - shipment.allyPayment : 0;
|
||||
const transport = trial.pendingGuildTransport;
|
||||
const transportCost = transport?.player === p.id ? transport.cost - transport.allyPayment : 0;
|
||||
donor.spice -= shipmentCost + transportCost;
|
||||
pledgeAid(trial, donor, amount);
|
||||
return {type: 'pledgeAid', amount};
|
||||
} catch (error) { if (error instanceof RuleError) return null; throw error; }
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user