Support concealed No-Field Guild transport
This commit is contained in:
1 parent
e41abdaf2e
commit
933a9c1379
24 files changed
+1138
-74
No files matched your search
@@ -0,0 +1,36 @@
|
||||
import { gameTerritories } from './board';
|
||||
import type { Action, GameView } from './engine';
|
||||
import { nexusGuildShipmentAvailable } from './nexus-guild-cunning-options';
|
||||
import { nexusGuildSecretAllyAction, nexusGuildSecretAllyCanAct } from './nexus-guild-secret-ally-options';
|
||||
import { guildTransportQuote } from './transport-quote';
|
||||
|
||||
/** Minimal legal choices for the owned concealed marker, before auto-revelation.
|
||||
* The shared quotes own timing, entry, pricing and original source validation.
|
||||
*/
|
||||
export function guildNoFieldTransportActions(g: GameView): Action[] {
|
||||
const own = g.players.find(player => player.id === g.me);
|
||||
const inventory = g.richeseNoField;
|
||||
const marker = inventory?.owner === g.me ? inventory.private?.deployed : null;
|
||||
const publicMarker = inventory?.public.deployed;
|
||||
if (!own || own.shipped || !marker || marker.controller !== own.id || !publicMarker ||
|
||||
publicMarker.controller !== own.id || !inventory?.event ||
|
||||
!nexusGuildShipmentAvailable(g)) return [];
|
||||
const guild = g.players.find(player => player.faction === 'guild');
|
||||
const native = !!guild && own.ally === guild.id && guild.ally === own.id;
|
||||
const secret = nexusGuildSecretAllyCanAct(g);
|
||||
if (!native && !secret) return [];
|
||||
const destinations = gameTerritories(g).flatMap(territory => territory.id === publicMarker.location.territory
|
||||
? [] : territory.sectors.map(sector => ({ territory: territory.id, sector })));
|
||||
if (secret) destinations.push({ territory: 'reserves', sector: 0 });
|
||||
const actions: Action[] = [];
|
||||
for (const destination of destinations) {
|
||||
const packet: Action = { type: 'guildShip', noField: marker.tokenId, event: inventory.event,
|
||||
forces: {}, ...destination };
|
||||
const action = secret ? nexusGuildSecretAllyAction(g, g.nexusGuildSecretAlly!.event, packet) : packet;
|
||||
if (!action) continue;
|
||||
const quote = guildTransportQuote(g, action);
|
||||
if (!quote.unavailableReasons.length && quote.quote)
|
||||
actions.push({ ...action, allyPayment: quote.quote.pledgedPayment });
|
||||
}
|
||||
return actions;
|
||||
}
|
||||
Reference in new issue
Block a user