36 lines
2.0 KiB
TypeScript
36 lines
2.0 KiB
TypeScript
import { selectedPhaseModuleRoster, type FactionModuleProfile } from './faction-module-profile';
|
|
|
|
/** Public uncertainty about a possible concealed Duke capture. Fresh games
|
|
* explicitly begin false; only a public resolution may restore false. True,
|
|
* absent, or malformed values never establish safety. */
|
|
export type DukeCapturePolicyContext = Omit<Partial<FactionModuleProfile>, 'players'> & {
|
|
advanced: boolean;
|
|
players: readonly { faction: string }[];
|
|
dukeCaptureUncertain?: boolean;
|
|
};
|
|
|
|
export const DUKE_CAPTURE_UNCERTAIN_BLOCK =
|
|
'Duke Vidal acquisition is unavailable while Harkonnen capture history may be unresolved.';
|
|
|
|
/** This result depends only on public table configuration and the public
|
|
* uncertainty receipt, never on actual Duke custody or capture identity. */
|
|
export function dukeCaptureUncertaintyBlock(g: DukeCapturePolicyContext): string | null {
|
|
return g.advanced && g.players.some(player => player.faction === 'harkonnen') &&
|
|
g.dukeCaptureUncertain !== false ? DUKE_CAPTURE_UNCERTAIN_BLOCK : null;
|
|
}
|
|
|
|
/** Original native faction tables with no selected optional module. Native
|
|
* Ecaz Occupy and Moritani assassination stamps are faction rules, not modules. */
|
|
export function plainAdvancedEcazDukeProfile(g: DukeCapturePolicyContext): boolean {
|
|
return g.advanced === true && Array.isArray(g.expansions) && g.expansions.includes('ecaz') &&
|
|
selectedPhaseModuleRoster({ expansions: g.expansions, players: g.players }) &&
|
|
g.players.some(player => player.faction === 'ecaz') &&
|
|
g.players.some(player => player.faction === 'harkonnen') &&
|
|
!g.leaderSkills && !g.homeworlds && !g.nexusCards && !g.techTokens && !g.strongholdCards &&
|
|
!g.discoveryEnabled && !g.discoveries && !g.discoveryStash && !g.greatMaker &&
|
|
!g.ecazTreachery && !g.semutaPreview && !g.advancedPreview && !g.kullPreview &&
|
|
!g.nexusKullPreview && !g.guildBetrayalPreview && !g.richeseBetrayalPreview &&
|
|
!g.nexusIxianReplacementPreview && !g.nexusIxianBetrayalPreview && !g.nexusHarkonnenBetrayalPreview &&
|
|
!g.spiceBankerIncomePreview;
|
|
}
|