50 lines
3.1 KiB
TypeScript
50 lines
3.1 KiB
TypeScript
import assert from 'node:assert/strict';
|
|
import { createGame, joinGame, newPlayer, type Action } from '../game/engine';
|
|
import { placeAmbassador } from '../game/ecaz-ambassadors';
|
|
import { placeTerror } from '../game/moritani-terror';
|
|
import { actBasicSemutaAmbassador, advanceBasicSemutaAmbassador,
|
|
basicSemutaAmbassadorClean, basicSemutaAmbassadorPlayer } from './fixture-basic-semuta-ambassador';
|
|
|
|
export const act = actBasicSemutaAmbassador;
|
|
export const player = basicSemutaAmbassadorPlayer;
|
|
export const advance = advanceBasicSemutaAmbassador;
|
|
|
|
/** Public mixed-family lobby and native setup. Only the unopened Spice order
|
|
* and the original Ambassador/Terror token placements are controlled; no
|
|
* resources, force positions, decision or phase are staged. */
|
|
export function mixedDiscoveryOnlyFixture(advanced: boolean, active: 'guild' | 'ixians') {
|
|
let game = createGame('MIXEDDISCOVERY', newPlayer('ecaz', 'Ecaz', 'ecaz'), advanced, ['ecaz', 'ix', 'choam']);
|
|
for (const faction of ['moritani', 'ixians', 'choam', 'guild'] as const)
|
|
joinGame(game, newPlayer(faction, faction, faction));
|
|
game = act(game, 'ecaz', {type:'moduleOption', module:'kullPreview', enabled:false});
|
|
game = act(game, 'ecaz', {type:'moduleOption', module:'discoveries', enabled:true});
|
|
for (const seat of game.players) game = act(game, seat.id, {type:'ready'});
|
|
const lobby = structuredClone(game);
|
|
game = act(game, 'ecaz', {type:'start', ...(advanced ? {advancedPreview:true} : {})});
|
|
const setup = structuredClone(game);
|
|
game = advance(game, state => state.status === 'playing');
|
|
assert.equal(game.advanced, advanced);
|
|
assert.ok(game.discoveries && game.ecazAmbassadors && game.moritaniTerror);
|
|
assert.ok(!game.nexusCards && !game.ecazTreachery && !game.leaderSkills);
|
|
for (const position of advanced ? [0, 1] : [0]) {
|
|
const index = game.spiceDeck.findIndex((card, i) => i >= position && 'territory' in card &&
|
|
(position === 0 ? card.discovery === 'discovery-hagga-basin' : !card.discovery));
|
|
assert.ok(index >= position);
|
|
[game.spiceDeck[position], game.spiceDeck[index]] = [game.spiceDeck[index], game.spiceDeck[position]];
|
|
}
|
|
game = advance(game, state => state.turn === 1 && state.phase === 5 &&
|
|
state.active === active && basicSemutaAmbassadorClean(state));
|
|
const beforeMarkers = structuredClone(game);
|
|
const token = game.ecazAmbassadors!.tokens.find(row => row.effect === 'ecaz' && row.zone === 'supply');
|
|
const terror = game.moritaniTerror!.tokens.find(row => row.kind === 'robbery' && row.status === 'available');
|
|
assert.ok(token && terror);
|
|
const destination = 'habbanya_ridge_sietch', sector = 17;
|
|
game.ecazAmbassadors = placeAmbassador(game.ecazAmbassadors!, token.id, {
|
|
turn:game.turn, availableSpice:player(game,'ecaz').spice,
|
|
destination:{id:destination,stronghold:true,inStorm:false,allowed:true},
|
|
}).state;
|
|
game.moritaniTerror = placeTerror(game.moritaniTerror!, terror.id, destination, game.turn);
|
|
const shipment: Action = {type:'ship', territory:destination, sector, amount:1, elite:0, allyPayment:0};
|
|
return {game, lobby, setup, beforeMarkers, destination, sector, token:token.id, terror:terror.id, shipment};
|
|
}
|