diff --git a/components/moritani-terror.tsx b/components/moritani-terror.tsx index 04b48905..2d7af44a 100644 --- a/components/moritani-terror.tsx +++ b/components/moritani-terror.tsx @@ -15,12 +15,11 @@ import { } from '@/components/ui/dialog'; import type { Action, GameView } from '@/game/engine'; import { territory } from '@/game/board'; +import { moritaniPlacementChoices, nexusMoritaniAction } from '@/game/nexus-moritani-options'; import { TERROR_COMMON_GAMEPLAY, TERROR_DEFINITIONS, - TERROR_STRONGHOLDS, type TerrorKind, - type TerrorToken, } from '@/game/moritani-terror'; type ProjectedToken = NonNullable['tokens'][number]; @@ -266,6 +265,7 @@ export function MoritaniPlacement({ busy: boolean; }) { const formId = useId(); + const [useNexus, setUseNexus] = useState(false); const [selectedToken, setSelectedToken] = useState(''); const [selectedTerritory, setSelectedTerritory] = useState(''); const decision = game.decision; @@ -276,34 +276,32 @@ export function MoritaniPlacement({ !game.moritaniTerror ) return null; - const tokens = game.moritaniTerror.tokens.filter( - (token): token is TerrorToken => - 'kind' in token && - (token.status === 'available' || token.status === 'placed'), - ); - const token = - tokens.find((candidate) => candidate.id === selectedToken) ?? tokens[0]; - const destinations = TERROR_STRONGHOLDS.filter( - (to) => - to !== token?.location && - !game.moritaniTerror!.tokens.some( - (candidate) => - candidate.status === 'placed' && candidate.location === to, - ), - ); + const nexus = useNexus && !!game.nexusMoritani; + const { tokens, token, destinations } = moritaniPlacementChoices(game, nexus, selectedToken); const destination = destinations.includes(selectedTerritory) ? selectedTerritory : destinations[0]; const waiting = Boolean(game.response); const disabled = busy || waiting; + const nexusAction = nexus && token && destination ? nexusMoritaniAction(game, game.nexusMoritani!.event, token.id, destination) : null; return (

Place or relocate Terror

- Choose one token and a stronghold without a Terror token for this Mentat - Pause. Storm does not prevent placement. Choose privately; the token’s - face stays hidden from opponents. + {nexus + ? 'Choose one available supply token and a projected Arrakis territory for this Mentat Pause. Existing Terror tokens may remain there.' + : 'Choose one token and a stronghold without a Terror token for this Mentat Pause.'}{' '} + Storm does not prevent placement. Choose privately; the token’s face stays hidden from opponents.

+ {game.nexusMoritani && <> + +

Cunning places one available supply token in an Arrakis territory, including one with Terror already present. It spends the Nexus card and this Mentat placement opportunity. Relocation, Grumman use, Homeworlds and the Hidden Mobile Stronghold are unavailable.

+ {game.nexusMoritani.blocked &&

{game.nexusMoritani.blocked}

} + }