Support Atreides special Karama truth commitments
Verify and publish checkpoint container / container (push) Successful in 10m46s
Verify and publish checkpoint container / container (push) Successful in 10m46s
This commit is contained in:
1 parent
add8e1d51a
commit
5079ab556f
16 files changed
+408
-19
No files matched your search
@@ -153,3 +153,48 @@ void test('special-Karama OR Hajr preserves either alternative and No forbids th
|
||||
assert.ok(player(no, f.owner).hand.some(card => card.id === f.karama));
|
||||
assert.deepEqual(inventory(no), f.cards);
|
||||
});
|
||||
|
||||
void test('Harkonnen special guide uses its own promise event after an earlier unrelated whole-turn answer', () => {
|
||||
const f = fixture(), game = structuredClone(f.game);
|
||||
// Move the second original Truthtrance from Harkonnen to the asker; no card
|
||||
// is created or removed and Harkonnen retains the real Karama.
|
||||
const owner = player(game, f.owner), asker = player(game, f.asker);
|
||||
const index = owner.hand.findIndex(card => card.effect === 'truthtrance'); assert.ok(index >= 0);
|
||||
const second = owner.hand.splice(index, 1)[0]; asker.hand.push(second);
|
||||
assert.deepEqual(inventory(game), f.cards);
|
||||
let current = act(game, f.asker, { type: 'card', card: f.truth, cards: [second.id] });
|
||||
while (current.truthtrance?.stage === 'priority') {
|
||||
const seat = current.players.find(p => !current.truthtrance!.passed.includes(p.id)); assert.ok(seat);
|
||||
current = act(current, seat.id, { type: 'truthPass' });
|
||||
}
|
||||
assert.equal(current.truthtrance?.stage, 'ask');
|
||||
current = act(current, f.asker, { type: 'truthAsk', question: {
|
||||
kind: 'turnActions', target: f.owner, turn: current.turn,
|
||||
mixed: { kind: 'action', action: { kind: 'cardPlay', effect: 'hajr' } },
|
||||
} });
|
||||
assert.ok(viewGame(current, f.owner).truthTurnActionAnswers?.includes('no'));
|
||||
current = act(current, f.owner, { type: 'truthAnswer', answer: 'no' });
|
||||
assert.equal(current.truthtrance?.stage, 'ask');
|
||||
current = act(current, f.asker, { type: 'truthAsk', question: question(f) });
|
||||
assert.ok(viewGame(current, f.owner).truthTurnActionAnswers?.includes('yes'));
|
||||
current = act(current, f.owner, { type: 'truthAnswer', answer: 'yes' });
|
||||
const rows = current.turnActionPromises!.filter(row => row.player === f.owner && !row.fulfilled && !row.released);
|
||||
assert.equal(rows.length, 2);
|
||||
const specialRow = rows.find(row => row.windowCards?.karamaHarkonnenSpecial); assert.ok(specialRow);
|
||||
const guide = viewGame(current, f.owner).turnActionGuide; assert.ok(guide);
|
||||
assert.equal(guide.event, specialRow.event);
|
||||
assert.equal(guide.action.turnActionPromiseEvent, specialRow.event);
|
||||
assert.equal(guide.action.mode, 'special');
|
||||
current = act(current, f.owner, guide.action);
|
||||
assert.ok(current.turnActionPromises!.find(row => row.event === specialRow.event)?.fulfilled);
|
||||
if (current.decision?.kind === 'handExchange') {
|
||||
const returned = player(current, f.owner).hand[0]; assert.ok(returned);
|
||||
current = act(current, f.owner, { type: 'decision', returnCards: [returned.id] });
|
||||
} else {
|
||||
// After spending the only held card, the native exchange automatically
|
||||
// returns the one unseen card because it is the entire remaining hand.
|
||||
assert.equal(current.pendingExchange, null);
|
||||
assert.ok(current.log.some(entry => entry.text.includes('returned 1 cards') && entry.text.includes('automatically')));
|
||||
}
|
||||
assert.deepEqual(inventory(current), f.cards);
|
||||
});
|
||||
Reference in new issue
Block a user