import { MOBILE_STRONGHOLD, splitLocation, validLocation } from './board'; /** The mobile stronghold's interior is encoded as sector 0, but a worm ride * enters through its actual pointed sector. Ordinary sectors and the Polar * Sink keep their existing independent entry checks. */ export function wormRideDestinationBlock( g: {storm: number; mobileStronghold?: {location: string | null} | null}, territory: string, _sector: number, ): string | null { if (territory !== MOBILE_STRONGHOLD || !g.mobileStronghold?.location || !Number.isSafeInteger(g.storm) || g.storm < 1 || g.storm > 18) return null; const pointer = g.mobileStronghold.location; const parts = pointer.split(':'); if (parts.length !== 2) return null; const at = splitLocation(pointer); if (!validLocation(at.territory, at.sector) || at.sector < 1) return null; return at.sector === g.storm ? 'The Hidden Mobile Stronghold points into the storm; a worm ride cannot enter it.' : null; }