Restore safe Duke grants in early legacy games
Verify and publish checkpoint container / container (push) Successful in 10m31s
Verify and publish checkpoint container / container (push) Successful in 10m31s
This commit is contained in:
1 parent
59cb336c80
commit
22b463a395
10 files changed
+263
-11
No files matched your search
@@ -1,22 +1,40 @@
|
||||
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. */
|
||||
* explicitly begin false; some early legacy states can prove safety publicly. */
|
||||
export type DukeCapturePolicyContext = Omit<Partial<FactionModuleProfile>, 'players'> & {
|
||||
advanced: boolean;
|
||||
players: readonly { faction: string }[];
|
||||
dukeCaptureUncertain?: boolean;
|
||||
status?: string;
|
||||
turn?: number;
|
||||
phase?: number;
|
||||
battle?: unknown;
|
||||
lastBattleContext?: unknown;
|
||||
pendingCapture?: unknown;
|
||||
response?: { kind: string } | null;
|
||||
decision?: { kind: string } | null;
|
||||
};
|
||||
|
||||
export const DUKE_CAPTURE_UNCERTAIN_BLOCK =
|
||||
'Duke Vidal acquisition is unavailable while Harkonnen capture history may be unresolved.';
|
||||
|
||||
/** Before the first battle of the first turn, a legacy game has no capture
|
||||
* history. Use public phase and continuation state only, never Duke custody. */
|
||||
export function legacyDukeCaptureHistoryClear(g: DukeCapturePolicyContext): boolean {
|
||||
return g.dukeCaptureUncertain === undefined && g.status === 'playing' && g.turn === 1 &&
|
||||
typeof g.phase === 'number' && Number.isInteger(g.phase) && g.phase >= 0 && g.phase <= 5 &&
|
||||
g.battle == null && g.lastBattleContext == null && g.pendingCapture == null &&
|
||||
g.response?.kind !== 'capture' && g.decision?.kind !== 'captureOffer' &&
|
||||
g.decision?.kind !== 'capturedLeader';
|
||||
}
|
||||
|
||||
/** 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;
|
||||
g.dukeCaptureUncertain !== false && !legacyDukeCaptureHistoryClear(g)
|
||||
? DUKE_CAPTURE_UNCERTAIN_BLOCK : null;
|
||||
}
|
||||
|
||||
/** Original native faction tables with no selected optional module. Native
|
||||
|
||||
Reference in new issue
Block a user