Support Advanced early cache bid promises
Verify and publish checkpoint container / container (push) Successful in 11m48s

This commit is contained in:
Quintine committed 2026-11-16 20:34:43 +11:00
1 parent 1a65e69932
commit 225b2174ad
14 files changed
+1071 -22

No files matched your search

+5 -3
View File
@@ -32,6 +32,8 @@ export type JointEarlyRicheseBidInput = {
freeSlots: number;
/** Slots occupied by a potentially won cache card (including bonuses). */
cacheWinSlots: number;
/** Slots needed by the other bid; paid seller retention adds no card. */
winSlots?: number;
};
};
@@ -76,13 +78,13 @@ export function quoteJointEarlyRicheseBids(input: JointEarlyRicheseBidInput): Jo
let separate: JointEarlyRicheseBidQuote['separate'] = null;
if (input.ordinary && phaseRequired) {
const {opportunity, cashAvailable, aidAvailable, freeSlots, cacheWinSlots} = input.ordinary;
const {opportunity, cashAvailable, aidAvailable, freeSlots, cacheWinSlots, winSlots = 1} = input.ordinary;
if (!opportunity || opportunity.player !== input.player || opportunity.turn !== input.turn ||
!whole(cashAvailable) || !whole(aidAvailable) || !whole(freeSlots) || !whole(cacheWinSlots))
!whole(cashAvailable) || !whole(aidAvailable) || !whole(freeSlots) || !whole(cacheWinSlots) || !whole(winSlots))
throw new EarlyRicheseBidError('Retain the funded separate ordinary bid and hand capacity.');
const reserved = earlyRequired ? cache?.minimum : 0;
if (reserved !== undefined && cashAvailable >= reserved &&
freeSlots > (earlyRequired ? cacheWinSlots : 0)) {
freeSlots >= (earlyRequired ? cacheWinSlots : 0) + winSlots) {
const maximumOrdinary = Math.min(opportunity.maximum, Number.MAX_SAFE_INTEGER,
cashAvailable - reserved + aidAvailable);
if (maximumOrdinary >= opportunity.minimum) {