Separate Spiritual Advisor shipment matching and alone conversion

Apply the Advanced retained-fighter target cutover through shared quotes and controls. Preserve committed foreign shipments while handling free-packet shipping, Polar matching, actual placement and original arrival once.
This commit is contained in:
Quintine committed 2026-10-24 22:28:42 +11:00
1 parent 438a5692a6
commit 767bace774
24 files changed
+1536 -69

No files matched your search

+6 -1
View File
@@ -1,5 +1,6 @@
import type { Action, Game, Player } from './engine';
import { arrivalAsAdvisor } from './advisors';
import { spiritualAdvisorTargetBlock, spiritualAdvisorArrival } from './spiritual-advisor';
import {
gameTerritories,
location,
@@ -274,6 +275,7 @@ export function quoteGuildAmbassadorAdvisor(
bgId: string,
shipment: GuildAmbassadorShipment,
action: Action,
recordedLegacy = false,
): GuildAmbassadorAdvisor {
const bg = beneficiary(g, bgId);
const shipper = g.players.find((p) => p.id === shipment?.player);
@@ -343,7 +345,10 @@ export function quoteGuildAmbassadorAdvisor(
to !== MOBILE_STRONGHOLD || (accompanying && shipper.faction === 'ixians'),
'Accompany only an Ixian shipment into the mobile stronghold.',
);
const advisors = arrivalAsAdvisor(g, bg, to, undefined, accompanying);
const targetBlock=recordedLegacy?null:spiritualAdvisorTargetBlock(g,bg.id,to);
requireShipment(!targetBlock,targetBlock??'This Spiritual Advisor target is unavailable.');
const advisors = recordedLegacy ? arrivalAsAdvisor(g, bg, to, undefined, accompanying)
: spiritualAdvisorArrival(g,bg.id,to).advisors;
validateDestinationOccupancy(g, bg, to, advisors);
requireShipment(
count((bg.forces[location(to, sector)] ?? 0) + amount) &&