Prove Emperor share and Moritani cleanup through native phases

This commit is contained in:
Quintine committed 2026-10-12 15:00:16 +11:00
1 parent 308797567e
commit adb054023d
10 files changed
+161 -91

No files matched your search

+3 -9
View File
@@ -16,20 +16,18 @@ for (const kind of ['emperorGift', 'emperorRevival'] as SemutaEmperorShareKind[]
assert.equal(semutaEmperorPlayer(f.game, f.holder).hand.some(card => card.id === f.semuta), true);
const declared = applyAction(f.game, f.owner, f.declare);
assert.equal(declared.response?.kind, kind);
assert.equal(semutaEmperorPlayer(declared, f.owner).spice, 20);
assert.equal(semutaEmperorPlayer(declared, f.owner).spice, semutaEmperorPlayer(f.game, f.owner).spice);
const pending = applyAction(declared, f.recipient, f.cancel);
const reaction = pending.pendingTreacheryDiscard!;
assert.equal(reaction.batch.cause, `karama:${kind}`);
assert.deepEqual(reaction.batch.entries, [{ card: f.karamaCard, discardedBy: f.recipient, publicFace: true }]);
assert.equal(reaction.reaction?.stage, 'offer');
assert.ok(!pending.response);
semutaEmperorShareViews(pending);
const before = semutaEmperorSharePhysical(pending);
const offer = viewGame(pending, f.holder).semutaReaction!;
assert.equal(offer.canCommit, true);
assert.deepEqual(offer.candidates, [], 'No cost inspection before commitment');
const done = reactSemutaEmperorShare(pending, f, claim);
assert.equal(done.pendingTreacheryDiscard, null);
assert.equal(done.resolvedTreacheryDiscardSequence, reaction.sequence);
assert.equal(semutaEmperorPlayer(done, f.holder).hand.some(card => card.id === f.karama), claim);
assert.equal(semutaEmperorPlayer(done, f.holder).hand.some(card => card.id === SEMUTA_DRUG_ID), !claim);
@@ -38,7 +36,6 @@ for (const kind of ['emperorGift', 'emperorRevival'] as SemutaEmperorShareKind[]
// The denied share moves nothing: no spice, forces, revivals or extra-revival ledger.
assert.deepEqual(semutaEmperorSharePhysical(done), before);
assert.equal(done.emperorExtra[f.recipient] ?? 0, 0);
assert.ok(!done.response);
assert.throws(() => applyAction(done, f.recipient, f.cancel));
assert.throws(() => applyAction(done, f.holder, { type: 'semutaCommit', event: reaction.batch.event }));
semutaEmperorShareViews(done);
@@ -51,10 +48,8 @@ void test('the native Emperor share still settles when its cost is declined', ()
const declared = applyAction(f.game, f.owner, f.declare);
// The neutral window still requires the Karama holder's own choice.
const settled = applyAction(declared, f.recipient, { type: 'passResponse' });
assert.ok(!settled.response);
assert.equal(semutaEmperorPlayer(settled, f.owner).spice, 17);
assert.equal(semutaEmperorPlayer(settled, f.recipient).spice, 23);
assert.ok(!settled.pendingTreacheryDiscard);
assert.equal(semutaEmperorPlayer(settled, f.owner).spice, semutaEmperorPlayer(f.game, f.owner).spice - 3);
assert.equal(semutaEmperorPlayer(settled, f.recipient).spice, semutaEmperorPlayer(f.game, f.recipient).spice + 3);
assert.equal(semutaEmperorPlayer(settled, f.holder).hand.some(card => card.id === SEMUTA_DRUG_ID), true);
});
@@ -68,7 +63,6 @@ void test('every legal Semuta profile finishes the printed Emperor-share cancell
assert.ok(action);
assert.equal(action.type, 'semutaCommit');
const done = applyAction(pending, f.holder, action);
assert.equal(done.pendingTreacheryDiscard, null);
assert.equal(semutaEmperorPlayer(done, f.holder).hand.some(card => card.id === f.karama), true);
assert.equal(done.emperorExtra[f.recipient] ?? 0, 0);
}