/** * The mission support planes (gameplay.blk missionSupportPlane, the nuclear carriers: the unit the * action bar launches and the lineup's support plane slot spawns) earn nothing in a battle: online * the time flown in one and its kills are not settled, other aircraft are (player observation of * the live game). Their lives and combat events are taken out of the battle facts before awards * and the settlement; the nuclear strike itself is a separate fact and stays. */ import type { BattleSpawnRulesData } from '../game-data/datasets/battle-spawn-rules.ts'; import type { BattleLife, ReportedCombatEvent } from './battle-report.ts'; export function supportPlaneUnits(rules: Pick): ReadonlySet { return new Set(Object.values(rules.supportPlanes).flatMap((presets) => presets.flatMap((preset) => Object.values(preset.units).map((unit) => unit.unitName)))); } /** The facts without the support planes' lives and combat events. */ export function withoutSupportPlanes( facts: T, supportPlanes: ReadonlySet, ): T { return { ...facts, lives: facts.lives.filter((life) => !supportPlanes.has(life.unit)), events: facts.events.filter((event) => !supportPlanes.has(event.unit)), }; }