Support phase-wide bidding across all auctions
Verify and publish checkpoint container / container (push) Successful in 12m14s
Verify and publish checkpoint container / container (push) Successful in 12m14s
This commit is contained in:
1 parent
12060f3112
commit
38f1684e03
17 files changed
+1070
-18
No files matched your search
@@ -0,0 +1,61 @@
|
||||
import assert from 'node:assert/strict';
|
||||
import test from 'node:test';
|
||||
import { viewGame } from '../game/engine';
|
||||
import {
|
||||
actTruthtranceRichesePromises as act,
|
||||
advanceTruthtranceRichesePromises as advance,
|
||||
askTruthtranceRichesePromises as ask,
|
||||
createTruthtranceRichesePromisesFixture as fixture,
|
||||
passTruthRicheseFreshDiscard,
|
||||
truthtranceRichesePromisesClean as clean,
|
||||
truthtranceRichesePromisesInventory as inventory,
|
||||
truthtranceRichesePromisesPlayer as player,
|
||||
} from './fixture-truthtrance-richese-promises';
|
||||
|
||||
/** Real Advanced setup and early question; the shared source selects only
|
||||
* unopened deal/Spice cards and native scalar rolls. No purse, answer, lot,
|
||||
* commitment, card location or force is injected for this scenario. */
|
||||
void test('Richese all-auction Yes survives an unbid Black Market and is fulfilled in its actual later cache', () => {
|
||||
const f = fixture({advanced:true});
|
||||
const asked = ask(structuredClone(f.earlySource),f,
|
||||
{kind:'phaseAnyBid',target:f.richese,turn:f.earlySource.turn,minimum:4});
|
||||
assert.ok(viewGame(asked,f.richese).truthPhaseAnyBidAnswers?.includes('yes'));
|
||||
let game = passTruthRicheseFreshDiscard(act(asked,f.richese,{type:'truthAnswer',answer:'yes'}));
|
||||
const receipt = game.phaseAnyBidPromises?.find(row => row.player === f.richese); assert.ok(receipt);
|
||||
const event = receipt.event, originalSpice = player(game,f.richese).spice;
|
||||
const before = inventory(game);
|
||||
game = advance(game,state => state.decision?.kind === 'richeseBlackMarket');
|
||||
assert.ok(player(game,f.richese).hand.some(card => card.id === f.targetCard));
|
||||
game = act(game,f.richese,{type:'decision',event:game.richeseBidding!.event,
|
||||
card:f.targetCard,method:'onceAround',direction:'clockwise'});
|
||||
while (game.response) {
|
||||
const responder = game.players.find(row => !game.response!.passed.includes(row.id)); assert.ok(responder);
|
||||
game = act(game,responder.id,{type:'passResponse'});
|
||||
}
|
||||
assert.equal(game.richeseAuction?.source,'blackMarket');
|
||||
const lot = game.richeseAuction!.event;
|
||||
while (game.richeseAuction?.event === lot && !game.richeseAuction.outcome) {
|
||||
const active = game.richeseAuction.active; assert.ok(active);
|
||||
assert.notEqual(active,f.richese,'Once Around seller has no turn when everyone else passes');
|
||||
game = act(game,active,{type:'richeseBid',event:lot,amount:null,allyPayment:0});
|
||||
}
|
||||
const waiting = game.phaseAnyBidPromises?.find(row => row.event === event); assert.ok(waiting);
|
||||
assert.equal(!!waiting.fulfilled,false);
|
||||
assert.equal(!!waiting.released,false,'The mandatory cache remains a real future bid opportunity');
|
||||
assert.ok(player(game,f.richese).hand.some(card => card.id === f.targetCard));
|
||||
assert.equal(player(game,f.richese).spice,originalSpice);
|
||||
assert.deepEqual(inventory(game),before);
|
||||
game = advance(game,state => clean(state) && !!state.richeseAuction &&
|
||||
state.richeseAuction.source === 'cache' && !state.richeseAuction.outcome,
|
||||
[], {position:'first',method:'silent'});
|
||||
assert.equal(game.phaseAnyBidPromises?.find(row => row.event === event)?.released,undefined);
|
||||
const cacheEvent = game.richeseAuction!.event;
|
||||
const guide = viewGame(game,f.richese).phaseAnyBidGuide; assert.ok(guide);
|
||||
assert.equal(guide.action.type,'richeseBid'); assert.equal(guide.action.event,cacheEvent);
|
||||
assert.equal(guide.action.amount,4);
|
||||
game = act(game,f.richese,guide.action);
|
||||
assert.equal(!!game.phaseAnyBidPromises?.find(row => row.event === event)?.fulfilled,true);
|
||||
assert.equal(player(game,f.richese).spice,originalSpice,'A sealed declaration does not pay early');
|
||||
assert.equal(viewGame(game,f.emperor).richeseAuction?.revealedBids,null);
|
||||
assert.deepEqual(inventory(game),before);
|
||||
});
|
||||
Reference in new issue
Block a user