Allow Richese reveal during selected responses
Verify and publish checkpoint container / container (push) Canceled after 0s

This commit is contained in:
Quintine committed 2026-10-29 07:58:48 +11:00
1 parent a1b2aacbac
commit 82d857b667
9 files changed
+518 -4

No files matched your search

@@ -58,6 +58,87 @@ void test('a clean Ix phase opening remains admitted before or after its owner p
game.decision = null; game.amalWindowOpen = false; assert.equal(supported(game), false);
});
void test('supported native responses admit the reveal without changing their original source or passes', () => {
const charity = source(); charity.phase = 2;
charity.response = {kind:'choamCharity', owner:'c', passed:['e']};
const auction = source(); auction.players.push(newPlayer('a','Atreides','atreides'));
auction.auction = {cards:[{id:'lot', name:'Shield', kind:'shield'}], index:0, bid:0,
bidder:null, active:'a', passed:[], opener:0};
auction.response = {kind:'atreidesAuction', owner:'a', passed:['e']};
const declaration = source();
declaration.richeseCache = [];
declaration.richeseBidding = {owner:'r', event:'round', turn:declaration.turn,
stage:'declaration', position:'first', normalCount:1, normalCountBeforeCache:1,
blackMarketSold:false, cacheCanceled:false};
declaration.response = {kind:'richeseAuction',owner:'r',passed:['e']};
const grant = source(); grant.phase = 4;
grant.players.push(newPlayer('f','Fremen','fremen'));
grant.players.find(p => p.id === 'f')!.ally = 'r'; grant.players.find(p => p.id === 'r')!.ally = 'f';
grant.freeRevival = [];
grant.response = {kind:'fremenRevivalGrant', owner:'f', recipient:'r', passed:['e'],
fremenGrant:{turn:grant.turn, owner:'f', recipient:'r'}};
for (const game of [charity, auction, declaration, grant]) {
const before = structuredClone(game);
assert.equal(supported(game), true, game.response!.kind);
assert.deepEqual(game, before);
}
});
void test('response admission requires the original phase, owner, source and no nested interaction', () => {
const charity = source(); charity.phase = 2; charity.response = {kind:'choamCharity',owner:'c',passed:[]};
for (const patch of [
{phase:3}, {decision:{kind:'auctionPayment',player:'e'}}, {phaseOpening:{passed:[],initialize:true}},
{pendingShipment:{}}, {response:{kind:'choamCharity',owner:'e',passed:[]}},
{response:{kind:'choamCharity',owner:'c',passed:['unknown']}},
{response:{kind:'choamCharity',owner:'c',passed:['e','e']}},
{response:{kind:'choamCharity',owner:'c',passed:[],intent:'extra'}},
{choamCharity:{turn:2,canceled:false}},
]) assert.equal(supported(Object.assign(structuredClone(charity), patch)), false, JSON.stringify(patch));
const auction = source(); auction.players.push(newPlayer('a','Atreides','atreides'));
auction.auction = {cards:[{id:'lot',name:'Shield',kind:'shield'}], index:0, bid:0,
bidder:null, active:'a', passed:[], opener:0};
auction.response = {kind:'atreidesAuction',owner:'a',passed:[]};
const missingLot = structuredClone(auction); missingLot.auction!.index = 1;
assert.equal(supported(missingLot), false);
const wrongOwner = structuredClone(auction); wrongOwner.response!.owner = 'e';
assert.equal(supported(wrongOwner), false);
const unsupportedLot = structuredClone(auction);
unsupportedLot.richeseAuction = {} as NonNullable<Game['richeseAuction']>;
assert.equal(supported(unsupportedLot), false);
const otherResponse = structuredClone(auction); otherResponse.response!.kind = 'richeseAuction';
assert.equal(supported(otherResponse), false);
const declaration = source(); declaration.richeseCache = [];
declaration.richeseBidding = {owner:'r',event:'round',turn:declaration.turn,stage:'declaration',
position:'first',normalCount:1,normalCountBeforeCache:1,blackMarketSold:false,cacheCanceled:false};
declaration.response = {kind:'richeseAuction',owner:'r',passed:[]};
for (const patch of [
{phase:4}, {richeseCache:undefined}, {auction:auction.auction},
{richeseBidding:{...declaration.richeseBidding,turn:1}},
{richeseBidding:{...declaration.richeseBidding,owner:'e'}},
{richeseBidding:{...declaration.richeseBidding,stage:'lot'}},
{richeseBidding:{...declaration.richeseBidding,position:undefined}},
{richeseBidding:{...declaration.richeseBidding,normalCount:-1}},
{richeseBidding:{...declaration.richeseBidding,normalCountBeforeCache:3}},
{richeseBidding:{...declaration.richeseBidding,cacheCanceled:true}},
{pendingRevival:{}},
]) assert.equal(supported(Object.assign(structuredClone(declaration), patch)), false, JSON.stringify(patch));
const grant = source(); grant.phase = 4; grant.players.push(newPlayer('f','Fremen','fremen'));
grant.players.find(p => p.id === 'f')!.ally = 'r'; grant.players.find(p => p.id === 'r')!.ally = 'f';
grant.freeRevival = [];
grant.response = {kind:'fremenRevivalGrant',owner:'f',recipient:'r',passed:[],
fremenGrant:{turn:grant.turn,owner:'f',recipient:'r'}};
const stale = structuredClone(grant); stale.response!.fremenGrant!.turn--;
assert.equal(supported(stale), false);
const noAlly = structuredClone(grant); noAlly.players.find(p => p.id === 'r')!.ally = null;
assert.equal(supported(noAlly), false);
const wrongRecipient = structuredClone(grant); wrongRecipient.response!.recipient = 'e';
assert.equal(supported(wrongRecipient), false);
const unrelatedChild = structuredClone(grant); unrelatedChild.pendingRevival = {} as NonNullable<Game['pendingRevival']>;
assert.equal(supported(unrelatedChild), false);
});
void test('a legacy table without public Truthtrance history keeps its earlier interruption behavior', () => {
const game = parent('auctionPayment');
delete game.truthHistory;