Preflight Homeworld-sourced AI arrival overlaps

This commit is contained in:
Quintine committed 2026-09-29 20:29:40 +10:00
1 parent 41fd6fe173
commit b9c8b740ca
6 files changed
+106 -15

No files matched your search

+32
View File
@@ -3,6 +3,9 @@ import test from 'node:test';
import { botArrivalBlock } from '../game/bot-arrival';
import { botActions } from '../game/bots';
import { applyAction, viewGame, type Action, type Game } from '../game/engine';
import { createHomeworldCustody } from '../game/homeworld-custody';
import { homeworldContext } from '../game/homeworld-game';
import { createTerrorState } from '../game/moritani-terror';
import {
arrivalMove,
arrivalPlayer,
@@ -52,6 +55,35 @@ void test('all four profiles avoid the reproduced Ambassador/Terror entries and
}
});
void test('Homeworld-sourced AI shipments avoid unsupported paired entry reactions', () => {
const game = movementArrivalGame();
game.homeworlds = { custody: createHomeworldCustody(homeworldContext(game)) };
arrivalPlayer(game, 'tleilaxu').shipped = false;
const action: Action = {
type: 'ship',
territory: 'carthag',
sector: 11,
amount: 1,
elite: 0,
homeworldSources: { 'homeworld:tleilaxu': { normal: 1, elite: 0 } },
};
assert.throws(() => applyAction(game, 'tleilaxu', action), overlap);
const before = JSON.stringify(game);
for (const profile of profiles) {
const view = ownView(game, profile);
assert.match(botArrivalBlock(view, action) ?? '', overlap);
const choices = botActions(view);
assert.ok(choices.length, profile);
assert.equal(choices.some(candidate => candidate.type === 'ship' &&
candidate.territory === 'carthag'), false, profile);
assert.ok(applyAction(game, view.me, choices[0]));
}
assert.equal(JSON.stringify(game), before);
game.moritaniTerror = createTerrorState(() => 0.2);
assert.equal(botArrivalBlock(ownView(game), action), null);
assert.ok(applyAction(game, 'tleilaxu', action));
});
void test('single reactions and matching-faction Ambassador immunity remain playable', () => {
for (const tokens of ['ambassador', 'terror'] as const) {
const game = movementArrivalGame('tleilaxu', tokens);