import assert from 'node:assert/strict'; import { createGame, joinGame, newPlayer, type Action, type Game } 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; /** Fresh public lobby/setup and real turn-one Guild shipment. Existing Ecaz and * Moritani tokens are selected and placed at the clean movement boundary by * their native helpers. The first unopened ordinary or Discovery Spice cards are selected; * no player force, purse, order, pending reaction or receipt is staged. */ export function pairedE3DiscoveryOnlyFixture(advanced: boolean, discoveryBlow = false) { let game = createGame('PAIREDE3DISCOVERY', newPlayer('ecaz', 'Ecaz', 'ecaz'), advanced, ['ecaz']); for (const faction of ['moritani', 'atreides', 'guild'] as const) joinGame(game, newPlayer(faction, faction, faction)); 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 = advanceBasicSemutaAmbassador(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 && discoveryBlow ? card.discovery === 'discovery-hagga-basin' : !card.discovery)); assert.ok(index >= position); [game.spiceDeck[position], game.spiceDeck[index]] = [game.spiceDeck[index], game.spiceDeck[position]]; } game = advanceBasicSemutaAmbassador(game, state => state.turn === 1 && state.phase === 5 && state.active === 'guild' && 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}; } export function reachPairedE3Entry(state: Game, until: (game: Game) => boolean): Game { return advanceBasicSemutaAmbassador(state, until); }