Files
Dune/tests/truth-tleilaxu-joint-revival.test.ts
T
Quintine cfccfe5acb
Verify and publish checkpoint container / container (push) Successful in 11m6s
Prototype Tleilaxu special Karama Truthtrance
2026-10-29 18:35:24 +11:00

37 lines
2.4 KiB
TypeScript

import assert from 'node:assert/strict';
import test from 'node:test';
import { viewGame } from '../game/engine';
import { createTleilaxuSpecialKaramaFixture, actTleilaxuSpecialKarama as act, tleilaxuSpecialKaramaPlayer as player } from './fixture-tleilaxu-special-karama';
void test('Tleilaxu cannot prevent their own revival while committed to reviving forces and using special Karama', () => {
const f = createTleilaxuSpecialKaramaFixture(), game = structuredClone(f.game), owner = player(game, f.owner), asker = f.observer;
// Controlled casualty; conserve Tleilaxu's physical force counters.
assert.ok(owner.reserves > 0); owner.reserves--; owner.tanks++;
const hand = player(game, asker).hand;
if (!hand.some(card => card.effect === 'truthtrance')) {
const zones = [game.deck, game.discard, player(game, f.target).hand];
const zone = zones.find(cards => cards.some(card => card.effect === 'truthtrance')); assert.ok(zone);
const index = zone.findIndex(card => card.effect === 'truthtrance');
[hand[0], zone[index]] = [zone[index], hand[0]];
}
const truth = hand.find(card => card.effect === 'truthtrance'); assert.ok(truth);
let state = act(game, asker, { type: 'card', card: truth.id });
for (let count = 0; state.truthtrance?.stage === 'priority' && count < state.players.length; count++) {
const actor = state.players.find(seat => !state.truthtrance!.passed.includes(seat.id)); assert.ok(actor);
state = act(state, actor.id, { type: 'truthPass' });
}
state = act(state, asker, { type: 'truthAsk', question: { kind: 'turnActions', target: f.owner, turn: state.turn,
mixed: { kind: 'and', terms: [
{ kind: 'action', action: { kind: 'forces', counter: 'total', minimum: 1 } },
{ kind: 'action', action: { kind: 'windowCardPlay', effect: 'karamaTleilaxuSpecial', source: JSON.stringify(['karamaTleilaxuSpecial', state.turn, f.owner]) } },
] } } });
assert.ok(viewGame(state, f.owner).truthTurnActionAnswers?.includes('yes'));
state = act(state, f.owner, { type: 'truthAnswer', answer: 'yes' });
const before = structuredClone(state);
assert.throws(() => act(state, f.owner, { ...f.special, target: f.owner }));
assert.deepEqual(state, before);
state = act(state, f.owner, f.special);
assert.deepEqual(state.revivalPrevention, { player: f.target, turn: state.turn });
assert.ok(state.turnActionPromises!.some(promise => promise.player === f.owner && !promise.fulfilled && !promise.released));
});