24 lines
1.3 KiB
TypeScript
24 lines
1.3 KiB
TypeScript
import type { Game } from './engine';
|
|
import { basicPendingMovement, type MovementPending } from './basic-pending-movement';
|
|
|
|
/**
|
|
* Revealing Richese's existing marker during a different player's ordinary
|
|
* movement cannot add an occupying faction to the declared destination. The
|
|
* caller retains its common profile and Truthtrance/commitment guards.
|
|
*/
|
|
export function richeseRevealForeignMovementPending(g: Game): MovementPending | null {
|
|
if (!Array.isArray(g.players)) return null;
|
|
const richese = g.players.find(player => player.faction === 'richese');
|
|
const deployed = richese?.noField?.deployed;
|
|
if (!richese || !deployed || deployed.controller !== richese.id ||
|
|
!deployed.location || !('territory' in deployed.location)) return null;
|
|
const movement = basicPendingMovement(g, {allowAdvanced:true});
|
|
// A zero marker can remove the only other faction at a BG destination.
|
|
// Preserve the already selected Advanced arrival stance for all hidden
|
|
// marker values until that special continuation can be re-quoted.
|
|
if (g.advanced && movement?.key === 'pendingChoamMove' &&
|
|
g.players.find(player => player.id === movement.player)?.faction === 'beneGesserit' &&
|
|
g.pendingChoamMove?.to === deployed.location.territory) return null;
|
|
return movement && movement.player !== richese.id ? movement.key : null;
|
|
}
|