Resume Richese auctions after Distrans Semuta reaction
Verify and publish checkpoint container / container (push) Successful in 11m24s
Verify and publish checkpoint container / container (push) Successful in 11m24s
This commit is contained in:
1 parent
ccc4c7bb40
commit
f8078ed5e2
9 files changed
+245
-56
No files matched your search
@@ -1,6 +1,8 @@
|
||||
import assert from 'node:assert/strict';
|
||||
import test from 'node:test';
|
||||
import { viewGame, type Action, type Game } from '../game/engine';
|
||||
import { handLimit, viewGame, type Action, type Game } from '../game/engine';
|
||||
import { SEMUTA_DRUG_ID } from '../game/semuta-drug';
|
||||
import { moveSemutaEmperorCard } from './fixture-semuta-emperor-share';
|
||||
import {
|
||||
actDistransPrebid, advanceDistransPrebid, createDistransPrebidFixture,
|
||||
distransPrebidClean, distransPrebidInventory, distransPrebidPlayer as player,
|
||||
@@ -67,13 +69,54 @@ void test('genuine Advanced Black Market normal lot remains unbid through earned
|
||||
});
|
||||
|
||||
for (const amount of [null, 1] as const) {
|
||||
void test(`genuine Advanced Black Market first ${amount === null ? 'pass' : 'bid'} keeps Distrans guarded with the Semuta preview`, () => {
|
||||
void test(`genuine Advanced Black Market first ${amount === null ? 'pass' : 'bid'} allows Distrans while preserving the lot`, () => {
|
||||
const f = source(), lot = f.game.richeseAuction!, actor = lot.active!; assert.ok(actor);
|
||||
const game = actDistransPrebid(f.game, actor, { type: 'richeseBid', event: lot.event, amount, allyPayment: 0 });
|
||||
assert.ok(game.richeseAuction);
|
||||
assert.match(viewGame(game, f.holder).distrans!.blocked!, /Semuta preview/);
|
||||
rejected(game, f.holder, f.action);
|
||||
assert.ok(player(game, f.seller).hand.some(c => c.id === f.physical.id));
|
||||
assert.equal(viewGame(game, f.holder).distrans!.blocked, null);
|
||||
const after = actDistransPrebid(game, f.holder, f.action);
|
||||
assert.deepEqual(after.richeseAuction, game.richeseAuction);
|
||||
assert.deepEqual(after.richeseFunding, game.richeseFunding);
|
||||
assert.ok(player(after, f.seller).hand.some(c => c.id === f.physical.id));
|
||||
assert.ok(player(after, f.recipient).hand.some(c => c.id === f.give));
|
||||
assert.deepEqual(distransPrebidInventory(after), f.originalInventory);
|
||||
});
|
||||
}
|
||||
|
||||
for (const claim of [false, true]) {
|
||||
void test(`Advanced Black Market resumes a started lot after Semuta ${claim ? 'claims' : 'passes'} Distrans`, () => {
|
||||
const f = source(), game = structuredClone(f.game);
|
||||
// Controlled physical custody supplement: move the one existing Semuta to
|
||||
// the seller. The lot, prices, bidders and other hands remain native.
|
||||
assert.notEqual(f.physical.id, SEMUTA_DRUG_ID);
|
||||
assert.ok(player(game, f.seller).hand.length < handLimit(player(game, f.seller)));
|
||||
moveSemutaEmperorCard(game, SEMUTA_DRUG_ID, f.seller);
|
||||
assert.deepEqual(distransPrebidInventory(game), f.originalInventory);
|
||||
const lot = game.richeseAuction!, actor = lot.active!;
|
||||
const started = actDistransPrebid(game, actor, { type: 'richeseBid', event: lot.event, amount: 1, allyPayment: 0 });
|
||||
const originalLot = structuredClone(started.richeseAuction);
|
||||
const originalFunding = structuredClone(started.richeseFunding);
|
||||
const pending = actDistransPrebid(started, f.holder, f.action);
|
||||
const frame = pending.pendingTreacheryDiscard; assert.ok(frame);
|
||||
assert.equal(frame.continuation.kind, 'distransDiscard');
|
||||
assert.equal(frame.reaction?.stage, 'offer');
|
||||
assert.equal(viewGame(pending, f.seller).semutaReaction?.canCommit, true);
|
||||
assert.deepEqual(pending.richeseAuction, originalLot);
|
||||
assert.deepEqual(pending.richeseFunding, originalFunding);
|
||||
let resumed = pending;
|
||||
if (claim) resumed = actDistransPrebid(resumed, f.seller, { type: 'semutaCommit', event: frame.batch.event });
|
||||
else for (const seat of resumed.players)
|
||||
resumed = actDistransPrebid(resumed, seat.id, { type: 'semutaPass', event: frame.batch.event });
|
||||
assert.equal(resumed.pendingTreacheryDiscard, null);
|
||||
assert.deepEqual(resumed.richeseAuction, originalLot);
|
||||
assert.deepEqual(resumed.richeseFunding, originalFunding);
|
||||
assert.equal(player(resumed, f.seller).hand.some(c => c.id === f.card), claim);
|
||||
assert.equal(resumed.discard.some(c => c.id === SEMUTA_DRUG_ID), claim);
|
||||
assert.equal(resumed.discard.some(c => c.id === f.card), !claim);
|
||||
assert.ok(player(resumed, f.seller).hand.some(c => c.id === f.physical.id));
|
||||
assert.ok(player(resumed, f.recipient).hand.some(c => c.id === f.give));
|
||||
assert.deepEqual(distransPrebidInventory(resumed), f.originalInventory);
|
||||
const complete = advanceDistransPrebid(resumed, state => state.richeseAuction?.event !== lot.event);
|
||||
assert.deepEqual(distransPrebidInventory(complete), f.originalInventory);
|
||||
});
|
||||
}
|
||||
Reference in new issue
Block a user