Guard Duke grants using public capture uncertainty
Verify and publish checkpoint container / container (push) Successful in 11m21s
Verify and publish checkpoint container / container (push) Successful in 11m21s
This commit is contained in:
1 parent
5f4eeee4f1
commit
57e7611468
15 files changed
+500
-19
No files matched your search
@@ -0,0 +1,33 @@
|
||||
import { DUKE_VIDAL_ID } from './duke-vidal';
|
||||
|
||||
/** Only facts already public when an uncanceled capture is completed. `null`
|
||||
* means a known absent controller or leader; `undefined` means unknown. */
|
||||
export type DukeCapturePublicSource = {
|
||||
publicController: string | null | undefined;
|
||||
loser: string | undefined;
|
||||
revealedLeader: string | null | undefined;
|
||||
publicPlanKnown: boolean;
|
||||
};
|
||||
|
||||
/** Called for every completed Harkonnen capture, regardless of its concealed
|
||||
* selection. Once the public cannot rule out Duke, keep the uncertainty until
|
||||
* a separate public resolution. An unstamped legacy game remains unstamped:
|
||||
* its past capture history cannot be reconstructed from current state. */
|
||||
export function nextDukeCaptureUncertainty(
|
||||
marker: boolean | undefined,
|
||||
source: DukeCapturePublicSource,
|
||||
): boolean | undefined {
|
||||
if (marker === undefined || marker === true) return marker;
|
||||
if (marker !== false || !source || source.publicPlanKnown !== true ||
|
||||
typeof source.loser !== 'string' || !source.loser.trim() ||
|
||||
source.publicController === undefined ||
|
||||
(source.publicController !== null &&
|
||||
(typeof source.publicController !== 'string' || !source.publicController.trim())) ||
|
||||
source.revealedLeader === undefined ||
|
||||
(source.revealedLeader !== null &&
|
||||
(typeof source.revealedLeader !== 'string' || !source.revealedLeader.trim()))) return true;
|
||||
// An unused Duke in the loser's control or the Duke just released after
|
||||
// that revealed battle is part of the possible public capture pool. No
|
||||
// choice, private candidate list, or actual capture identity is consulted.
|
||||
return source.publicController === source.loser || source.revealedLeader === DUKE_VIDAL_ID;
|
||||
}
|
||||
Reference in new issue
Block a user