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);
+2 -2
View File
@@ -882,10 +882,10 @@ void test('Guild groups from several sectors pay one rounded shipment cost', ()
type: 'guildShip',
forces: { 'pasty_mesa:5': 1, 'pasty_mesa:6': 2 },
};
const returned = applyAction(g, 'p0', { ...action, territory: 'reserves' });
const returned = passResponses(applyAction(g, 'p0', { ...action, territory: 'reserves' }));
assert.equal(returned.players[0].spice, before - 2);
assert.equal(returned.players[0].reserves, 18);
g = applyAction(g, 'p0', { ...action, territory: 'sietch_tabr', sector: 14 });
g = passResponses(applyAction(g, 'p0', { ...action, territory: 'sietch_tabr', sector: 14 }));
assert.equal(g.players[0].spice, before - 2);
assert.equal(g.players[0].forces['sietch_tabr:14'], 3);
conservation(g);