Support group battle preparation powers
Verify and publish checkpoint container / container (push) Successful in 10m57s

This commit is contained in:
Quintine committed 2026-10-28 23:42:41 +11:00
1 parent d8d2e7207b
commit 83ccd71821
10 files changed
+405 -26

No files matched your search

+4 -4
View File
@@ -1,4 +1,5 @@
import { voiceChoices } from './battle-cards';
import { coalitionBattleBeneficiary, type CoalitionBattlePreparationContext } from './coalition-battle-preparation';
export type NativeBattlePower = 'voice' | 'prescience';
export type BattlePowerClaim =
@@ -15,7 +16,7 @@ export type NativeBattlePowerOpportunity = {
event: string; territory: string; power: NativeBattlePower; owner: string;
beneficiary: string; target: string; ready: boolean;
};
export type NativeBattlePowerGame = {
export type NativeBattlePowerGame = Omit<CoalitionBattlePreparationContext, 'players' | 'status'> & {
status: string;
phase: number;
players: readonly { id: string; faction: string; ally?: string | null }[];
@@ -110,9 +111,8 @@ export function nativeBattlePowerOpportunity(game: NativeBattlePowerGame, actor:
const side = (kind: NativeBattlePower) => {
const owners = game.players.filter(player => player.faction === (kind === 'voice' ? 'beneGesserit' : 'atreides'));
if (owners.length !== 1) return null;
const owner = owners[0], combatants = [battle.attacker, battle.defender];
const beneficiary = combatants.includes(owner.id) ? owner.id : owner.ally && combatants.includes(owner.ally) &&
game.players.some(player => player.id === owner.ally && player.ally === owner.id) ? owner.ally : null;
const owner = owners[0];
const beneficiary = coalitionBattleBeneficiary(game, owner.id, battle.attacker, battle.defender, true);
return beneficiary ? { owner: owner.id, beneficiary,
target: battle.attacker === beneficiary ? battle.defender : battle.attacker } : null;
};