Files
Dune/game/alliance-victory-option.ts
T
Quintine ef92ddf2b9
Verify and publish checkpoint container / container (push) Canceled after 0s
Add three-member short alliance prototype
2026-10-29 02:31:50 +11:00

23 lines
901 B
TypeScript

import {
controllerStrongholdTarget,
physicalControllerCount,
type TwoPlayerControllers,
} from './two-player-controllers';
/** GF9's shorter alliance target, also used by the staged three-member and
* unlimited variants. The two-person four-stronghold rule still applies, as
* do ordinary solo targets. Callers add any agreed increase afterward. */
export function allianceVictoryTarget(
seats: readonly string[],
controllers: TwoPlayerControllers | null | undefined,
allied: boolean,
shortAlliance?: boolean,
): 3 | 4 {
if (shortAlliance !== undefined && typeof shortAlliance !== 'boolean')
throw new TypeError('Choose whether the shorter alliance victory option is enabled.');
const target = controllerStrongholdTarget(seats, controllers, allied);
if (shortAlliance === true && allied && physicalControllerCount(seats, controllers) >= 3)
return 3;
return target;
}