Enable paired Ecaz and Moritani Discovery preview
Verify and publish checkpoint container / container (push) Successful in 10m37s
Verify and publish checkpoint container / container (push) Successful in 10m37s
This commit is contained in:
1 parent
2ad7f127ec
commit
9ca68c9ff8
11 files changed
+212
-11
No files matched your search
@@ -0,0 +1,72 @@
|
||||
import assert from 'node:assert/strict';
|
||||
import test from 'node:test';
|
||||
import { viewGame } from '../game/engine';
|
||||
import { botActions } from '../game/bots';
|
||||
import { DIFFICULTIES } from '../game/bot-profiles';
|
||||
import { reserveShipmentCost } from '../game/shipment-price';
|
||||
import { act, pairedE3DiscoveryOnlyFixture, player, reachPairedE3Entry } from './fixture-paired-e3-discovery-only';
|
||||
|
||||
for (const advanced of [false, true]) void test(
|
||||
`${advanced ? 'Advanced' : 'Basic'} paired Ecaz/Moritani Discovery-only public setup preserves the original entry`, () => {
|
||||
const f = pairedE3DiscoveryOnlyFixture(advanced);
|
||||
assert.equal(f.lobby.discoveryEnabled, true);
|
||||
assert.equal(f.setup.discoveryEnabled, true);
|
||||
assert.ok(f.setup.discoveries);
|
||||
assert.equal(f.setup.discoveries!.tokens.length, 8);
|
||||
assert.equal(f.setup.spiceDeck.filter(card => 'discovery' in card && card.discovery).length, 6);
|
||||
assert.ok(!f.setup.nexusCards && !f.setup.ecazTreachery);
|
||||
const price = reserveShipmentCost({faction:'guild', halfRate:true}, 'stronghold', 1);
|
||||
const originalSpice = player(f.game, 'guild').spice;
|
||||
const originalMoritaniSpice = player(f.game, 'moritani').spice;
|
||||
const stolen = Math.ceil((originalSpice - price) / 2);
|
||||
const originalDuke = structuredClone(f.game.dukeVidal!.leader);
|
||||
let game = act(f.game, 'guild', f.shipment);
|
||||
game = reachPairedE3Entry(game, state => !!state.pendingArrivalOverlap);
|
||||
assert.equal(player(game, 'guild').spice, originalSpice - price);
|
||||
assert.equal(player(game, 'guild').forces[`${f.destination}:${f.sector}`], 1);
|
||||
const first = game.pendingArrivalOverlap!.first;
|
||||
const responder = first === 'ambassador' ? 'ecaz' : 'moritani';
|
||||
for (const difficulty of DIFFICULTIES) {
|
||||
const view = viewGame(game, responder);
|
||||
view.players.find(row => row.id === responder)!.bot = difficulty;
|
||||
const choice = botActions(view)[0]; assert.ok(choice, difficulty);
|
||||
assert.doesNotThrow(() => act(game, responder, choice), difficulty);
|
||||
}
|
||||
if (first === 'ambassador') {
|
||||
const entry = game.pendingAmbassador; assert.ok(entry);
|
||||
assert.equal(entry.token, f.token);
|
||||
game = act(game, 'ecaz', {type:'decision', event:entry.event, trigger:true, beneficiary:'ecaz', choice:'duke'});
|
||||
assert.equal(game.pendingTerrorEntry?.token, f.terror);
|
||||
game = act(game, 'moritani', {type:'decision', reveal:true});
|
||||
assert.equal(game.pendingTerrorEntry?.stage, 'robbery');
|
||||
game = act(game, 'moritani', {type:'decision', choice:'spice'});
|
||||
} else {
|
||||
assert.equal(game.pendingTerrorEntry?.token, f.terror);
|
||||
game = act(game, 'moritani', {type:'decision', reveal:true});
|
||||
assert.equal(game.pendingTerrorEntry?.stage, 'robbery');
|
||||
game = act(game, 'moritani', {type:'decision', choice:'spice'});
|
||||
const entry = game.pendingAmbassador; assert.ok(entry);
|
||||
assert.equal(entry.token, f.token);
|
||||
game = act(game, 'ecaz', {type:'decision', event:entry.event, trigger:true, beneficiary:'ecaz', choice:'duke'});
|
||||
}
|
||||
assert.equal(game.pendingArrivalOverlap ?? null, null);
|
||||
assert.equal(game.pendingAmbassador ?? null, null);
|
||||
assert.equal(game.pendingTerrorEntry ?? null, null);
|
||||
assert.equal(player(game, 'guild').spice, originalSpice - price - stolen);
|
||||
assert.equal(player(game, 'moritani').spice, originalMoritaniSpice + stolen);
|
||||
assert.equal(player(game, 'guild').forces[`${f.destination}:${f.sector}`], 1);
|
||||
assert.equal(game.moritaniTerror!.tokens.find(row => row.id === f.terror)?.status, 'removed');
|
||||
assert.equal(game.ecazAmbassadors!.tokens.find(row => row.id === f.token)?.zone, 'supply');
|
||||
assert.deepEqual([game.dukeVidal?.controller, game.dukeVidal?.source], ['ecaz', 'ecaz']);
|
||||
assert.deepEqual(game.dukeVidal?.leader, originalDuke);
|
||||
});
|
||||
|
||||
for (const advanced of [false, true]) void test(
|
||||
`${advanced ? 'Advanced' : 'Basic'} paired Discovery-only table resolves a real Discovery Spice Blow`, () => {
|
||||
const f = pairedE3DiscoveryOnlyFixture(advanced, true);
|
||||
assert.ok(f.beforeMarkers.spiceDiscard.flat().some(card =>
|
||||
'territory' in card && card.discovery === 'discovery-hagga-basin'));
|
||||
assert.equal(f.beforeMarkers.discoveries!.tokens.filter(token => token.status === 'placed').length, 1);
|
||||
assert.equal(f.beforeMarkers.phase, 5);
|
||||
assert.ok(!f.beforeMarkers.nexusCards && !f.beforeMarkers.ecazTreachery);
|
||||
});
|
||||
Reference in new issue
Block a user