Files
Dune/game/auction-inspection-source.ts
T
Quintine 4ec4f843a7
Verify and publish checkpoint container / container (push) Canceled after 0s
Honor Caladan auction knowledge in Truthtrance
2026-10-29 19:03:34 +11:00

16 lines
801 B
TypeScript

import type { Game } from './engine';
/** Physical card identity is not a lot identity: the same card can later
* re-enter an ordinary auction. Return null when no current lot exists. */
export function originalAuctionInspectionLot(
game: Pick<Game, 'richeseAuction' | 'auction' | 'turn'>,
): string | null {
if (game.richeseAuction) return typeof game.richeseAuction.event === 'string'
? game.richeseAuction.event : null;
const auction = game.auction;
if (!auction || !Number.isSafeInteger(auction.index) || auction.index < 0 ||
!Array.isArray(auction.cards) || !auction.cards[auction.index] ||
typeof auction.cards[auction.index].id !== 'string') return null;
return JSON.stringify([auction.occupiedEvent ?? game.turn, auction.index, auction.cards[auction.index].id]);
}