Compose market, early cache and phase bid promises
Verify and publish checkpoint container / container (push) Successful in 12m4s
Verify and publish checkpoint container / container (push) Successful in 12m4s
This commit is contained in:
1 parent
225b2174ad
commit
6a30fdf376
16 files changed
+1183
-21
No files matched your search
@@ -16,15 +16,23 @@ export function MixedRicheseBidPromises(props: { game: GameView; busy: boolean;
|
||||
const live = !!auction && own.some(promise => promise.turn === game.turn && promise.event === auction.event &&
|
||||
!promise.fulfilled && !promise.released);
|
||||
const action = guide?.action, signature = action && JSON.stringify(action);
|
||||
const progress = action?.earlyRicheseBidPromiseId !== undefined && auction ?
|
||||
JSON.stringify([auction.active,auction.bid,auction.bidder,auction.acted,auction.submitted,auction.ownBid]) : null;
|
||||
const isCurrentGuide = () => {
|
||||
if (props.game !== game || !auction || game.richeseAuction !== auction ||
|
||||
!guide || game.richeseBidPromiseGuide !== guide || !action || guide.action !== action ||
|
||||
JSON.stringify(action) !== signature || action.type !== 'richeseBid' || action.event !== auction.event ||
|
||||
(progress !== null && JSON.stringify([auction.active,auction.bid,auction.bidder,
|
||||
auction.acted,auction.submitted,auction.ownBid]) !== progress) ||
|
||||
typeof action.richeseBidPromiseId !== 'string') return false;
|
||||
if (action.phaseAnyBidPromiseEvent !== undefined &&
|
||||
(typeof action.phaseAnyBidPromiseEvent !== 'string' || action.phaseAnyBidLotEvent !== auction.event ||
|
||||
!game.phaseAnyBidPromises.some(promise => promise.event === action.phaseAnyBidPromiseEvent &&
|
||||
promise.player === game.me && promise.turn === game.turn && !promise.fulfilled && !promise.released))) return false;
|
||||
if (action.earlyRicheseBidPromiseId !== undefined &&
|
||||
(typeof action.earlyRicheseBidPromiseId !== 'string' ||
|
||||
!game.ownEarlyRicheseBidPromises.some(promise => promise.id === action.earlyRicheseBidPromiseId &&
|
||||
promise.player === game.me && promise.turn === game.turn && !promise.boundEvent && !promise.fulfilled && !promise.released))) return false;
|
||||
return game.mixedRicheseBidPromises.some(promise => promise.player === game.me &&
|
||||
promise.id === action.richeseBidPromiseId && promise.turn === game.turn &&
|
||||
promise.event === auction.event && !promise.fulfilled && !promise.released);
|
||||
|
||||
@@ -14,7 +14,8 @@ export function PhaseAnyBidGuideButton(props: Props) {
|
||||
const signature = JSON.stringify(action), ordinary = game.auction, special = game.richeseAuction;
|
||||
const ordinarySignature = ordinary && JSON.stringify([ordinary.bid, ordinary.bidder, ordinary.active, ordinary.remaining]);
|
||||
const specialSignature = special && JSON.stringify([special.event, special.method, special.active,
|
||||
special.bid, special.bidder, special.submitted, special.ownBid]);
|
||||
special.bid, special.bidder, special.submitted, special.ownBid,
|
||||
...(action.earlyRicheseBidPromiseId !== undefined ? [special.acted] : [])]);
|
||||
const canAct = () => {
|
||||
const current = props.game, me = current.players.find(player => player.id === actor);
|
||||
if (props.busy || current !== game || current.me !== actor || current.turn !== turn ||
|
||||
@@ -31,6 +32,11 @@ export function PhaseAnyBidGuideButton(props: Props) {
|
||||
promise.id === action.richeseBidPromiseId && promise.player === actor && promise.turn === turn &&
|
||||
promise.event === special.event && !promise.fulfilled && !promise.released)) return false;
|
||||
}
|
||||
if (action.earlyRicheseBidPromiseId !== undefined &&
|
||||
(typeof action.earlyRicheseBidPromiseId !== 'string' ||
|
||||
!current.ownEarlyRicheseBidPromises.some(promise =>
|
||||
promise.id === action.earlyRicheseBidPromiseId && promise.player === actor && promise.turn === turn &&
|
||||
!promise.boundEvent && !promise.fulfilled && !promise.released))) return false;
|
||||
if (action.bidPromiseEvent !== undefined) {
|
||||
if ((action.type !== 'bid' && action.type !== 'passBid') || typeof action.bidPromiseEvent !== 'string' ||
|
||||
typeof action.phaseAnyBidLot !== 'number' || current.bidPromiseLot?.turn !== turn ||
|
||||
@@ -47,7 +53,8 @@ export function PhaseAnyBidGuideButton(props: Props) {
|
||||
if (action.type !== 'richeseBid' || !special || current.richeseAuction !== special ||
|
||||
special.event !== action.event || special.event !== action.phaseAnyBidLotEvent ||
|
||||
JSON.stringify([special.event, special.method, special.active, special.bid, special.bidder,
|
||||
special.submitted, special.ownBid]) !== specialSignature) return false;
|
||||
special.submitted, special.ownBid,
|
||||
...(action.earlyRicheseBidPromiseId !== undefined ? [special.acted] : [])]) !== specialSignature) return false;
|
||||
return special.method === 'silent' ? !special.submitted.includes(actor) : special.active === actor;
|
||||
};
|
||||
return <Button className="game-action min-h-11 whitespace-normal" data-testid="phase-any-bid-guide"
|
||||
|
||||
@@ -17,7 +17,10 @@ export type RicheseBidPromisePanelProps = {
|
||||
guide: { action: Action } | null;
|
||||
game: { turn: number; me?: string;
|
||||
phaseAnyBidPromises?: {event: string; player: string; turn: number; fulfilled?: boolean; released?: boolean}[];
|
||||
richeseAuction: { event: string; method?: 'onceAround' | 'silent' | 'normal' } | null };
|
||||
ownEarlyRicheseBidPromises?: {id: string; player: string; turn: number; boundEvent?: string; fulfilled?: boolean; released?: boolean}[];
|
||||
richeseAuction: { event: string; method?: 'onceAround' | 'silent' | 'normal';
|
||||
active?: string | null; bid?: number; bidder?: string | null; acted?: readonly string[];
|
||||
submitted?: readonly string[]; ownBid?: number | null } | null };
|
||||
act: (action: Action) => void;
|
||||
busy: boolean;
|
||||
};
|
||||
@@ -29,16 +32,24 @@ export function RicheseBidPromiseGuide(props: RicheseBidPromisePanelProps) {
|
||||
const auction = game.richeseAuction, turn = game.turn, action = guide.action;
|
||||
const auctionEvent = action.event, id = action.richeseBidPromiseId;
|
||||
const signature = JSON.stringify(action);
|
||||
const progress = action.earlyRicheseBidPromiseId !== undefined && auction ?
|
||||
JSON.stringify([auction.active,auction.bid,auction.bidder,auction.acted,auction.submitted,auction.ownBid]) : null;
|
||||
const isCurrent = () => props.game === game && props.guide === guide &&
|
||||
props.guide.action === action && JSON.stringify(action) === signature &&
|
||||
game.turn === turn && !!auction && game.richeseAuction === auction &&
|
||||
typeof auctionEvent === 'string' && auction.event === auctionEvent &&
|
||||
(progress === null || JSON.stringify([auction.active,auction.bid,auction.bidder,
|
||||
auction.acted,auction.submitted,auction.ownBid]) === progress) &&
|
||||
typeof id === 'string' && action.type === 'richeseBid' &&
|
||||
(action.phaseAnyBidPromiseEvent === undefined ||
|
||||
typeof action.phaseAnyBidPromiseEvent === 'string' && action.phaseAnyBidLotEvent === auctionEvent &&
|
||||
typeof game.me === 'string' && !!game.phaseAnyBidPromises?.some(promise =>
|
||||
promise.event === action.phaseAnyBidPromiseEvent && promise.player === game.me && promise.turn === turn &&
|
||||
!promise.fulfilled && !promise.released)) &&
|
||||
(action.earlyRicheseBidPromiseId === undefined ||
|
||||
typeof action.earlyRicheseBidPromiseId === 'string' && typeof game.me === 'string' &&
|
||||
!!game.ownEarlyRicheseBidPromises?.some(promise => promise.id === action.earlyRicheseBidPromiseId &&
|
||||
promise.player === game.me && promise.turn === turn && !promise.boundEvent && !promise.fulfilled && !promise.released)) &&
|
||||
props.promises.some(promise => promise.id === id && promise.turn === turn &&
|
||||
promise.event === auctionEvent && !promise.fulfilled && !promise.released);
|
||||
const canAct = () => !props.busy && isCurrent();
|
||||
|
||||
Reference in new issue
Block a user