Allow Distrans before Richese bidding starts
This commit is contained in:
1 parent
813a19bb1d
commit
f50e436506
14 files changed
+511
-24
No files matched your search
+33
-3
@@ -1,3 +1,5 @@
|
||||
import type { RicheseAuction } from './richese-auction';
|
||||
|
||||
type DistransAuctionContext = {
|
||||
phase: number;
|
||||
auction: {
|
||||
@@ -8,16 +10,44 @@ type DistransAuctionContext = {
|
||||
passed: readonly string[];
|
||||
allyPayment?: number;
|
||||
} | null;
|
||||
richeseAuction?: unknown;
|
||||
richeseAuction?: RicheseAuction | null;
|
||||
richeseFunding?: Record<string, unknown> | null;
|
||||
currentAuctionSale?: unknown;
|
||||
};
|
||||
|
||||
/** The printed card excludes use during a bid. Provisionally, an ordinary
|
||||
* lot has not begun bidding until its first bid or pass. Inspection and
|
||||
* opening the physical lot do not start that bid or change the dealt pool.
|
||||
* Other unpaid auctions retain their separate timing boundary. */
|
||||
* An untouched Richese lot likewise has no bid yet.
|
||||
* Once any bidder acts, even a pass or a zero sealed bid, it is closed. */
|
||||
export function distransAuctionBlock(g: DistransAuctionContext): string | null {
|
||||
if (g.currentAuctionSale || (!g.auction && !g.richeseAuction)) return null;
|
||||
const special = g.richeseAuction;
|
||||
if (g.phase === 3 && !g.auction && special &&
|
||||
(special.method === 'onceAround' || special.method === 'silent' || special.method === 'normal') &&
|
||||
(special.source === 'cache' || special.source === 'blackMarket') &&
|
||||
(special.source !== 'cache' || special.method !== 'normal') &&
|
||||
typeof special.event === 'string' && special.event.length > 0 &&
|
||||
typeof special.cardId === 'string' && special.cardId.length > 0 &&
|
||||
typeof special.owner === 'string' && special.owner.length > 0 &&
|
||||
special.outcome === null && special.bid === 0 && special.bidder === null &&
|
||||
Array.isArray(special.eligible) && special.eligible.length > 0 &&
|
||||
special.eligible.every(id => typeof id === 'string' && id.length > 0) &&
|
||||
new Set(special.eligible).size === special.eligible.length &&
|
||||
Array.isArray(special.order) && special.order.length === special.eligible.length &&
|
||||
new Set(special.order).size === special.order.length &&
|
||||
special.order.every(id => special.eligible.includes(id)) &&
|
||||
Array.isArray(special.tieOrder) && special.tieOrder.length === special.eligible.length &&
|
||||
new Set(special.tieOrder).size === special.tieOrder.length &&
|
||||
special.tieOrder.every(id => special.eligible.includes(id)) &&
|
||||
(special.method === 'silent' ? special.active === null : special.active === special.order[0]) &&
|
||||
(special.method !== 'onceAround' || special.order.some(id => id !== special.owner)) &&
|
||||
Array.isArray(special.acted) && special.acted.length === 0 &&
|
||||
Array.isArray(special.passed) && special.passed.length === 0 &&
|
||||
special.sealed && typeof special.sealed === 'object' && !Array.isArray(special.sealed) &&
|
||||
Object.keys(special.sealed).length === 0 &&
|
||||
(!g.richeseFunding || (typeof g.richeseFunding === 'object' && !Array.isArray(g.richeseFunding) &&
|
||||
Object.keys(g.richeseFunding).length === 0))) return null;
|
||||
const lot = g.auction;
|
||||
if (
|
||||
g.phase === 3 && !g.richeseAuction && lot &&
|
||||
@@ -26,5 +56,5 @@ export function distransAuctionBlock(g: DistransAuctionContext): string | null {
|
||||
lot.bid === 0 && lot.bidder === null && lot.passed.length === 0 &&
|
||||
(lot.allyPayment ?? 0) === 0
|
||||
) return null;
|
||||
return 'Distrans is unavailable after bidding starts on this lot. Finish its auction first; special-auction timing remains guarded.';
|
||||
return 'Distrans is unavailable after bidding starts on this lot. Finish its auction first; other special-auction timing remains guarded.';
|
||||
}
|
||||
Reference in new issue
Block a user