| {{ $t('reports.battle.volley') }} | ++ {{ shot[unit] ?? 0 }} + | +
|---|
{{ $t('village.simulator.power', result.power) }}
{{ $t(`reports.battle.${side}`) }}
-{{ $t('reports.battle.no_troops') }}
{{ $t('reports.battle.wall', result.wall) }}
diff --git a/app/mock/server.ts b/app/mock/server.ts index 57399ff..597ea42 100644 --- a/app/mock/server.ts +++ b/app/mock/server.ts @@ -40,6 +40,7 @@ import type { Units, VillageRef, VillageState, + Volley, WorldSummary, } from '~/types/game' import type { MapMovement, MapVillage, MapView } from '~/types/map' @@ -913,6 +914,37 @@ function writeReport(state: MockState, userId: number, worldId: number, at: numb /** Per unit: none of them. */ const noLosses = (units: Units) => Object.fromEntries(unitEntries(units).map(([u]) => [u, 0])) +/** Units that shoot before the melee. */ +const SHOOTERS = new Set(['archer', 'catapult']) + +/** + * Of one side's losses, those the other side's archers and catapults shot before the melee: + * the shooters' share of that side's strength. Crude stand-in for the backend's volley phase. + */ +function shotOf(lost: Record{{ $t('reports.scattered', { from: villageLabel(scattered.attacker.village) }) }}
{{ $t('reports.support.arrived', { to: villageLabel(report.payload.to) }) }}
diff --git a/app/types/game.ts b/app/types/game.ts index f945ded..50dc75b 100644 --- a/app/types/game.ts +++ b/app/types/game.ts @@ -301,8 +301,13 @@ export interface BattleReport { building: { type: BuildingType; before: number; after: number } | null loot: Cost capacity: number - /** Noblemen survived a won attack: loyalty before and after, and whether the village changed hands. */ - loyalty?: { before: number; after: number; conquered: boolean } | null + /** + * Noblemen survived a won attack: loyalty before and after, and whether the village changed + * hands. no_coins: loyalty reached 0 but the attacker's coins pay for no further village. + */ + loyalty?: { before: number; after: number; conquered: boolean; no_coins?: boolean } | null + /** Units shot by archers and catapults before the melee (already counted in `lost`). */ + volley?: Volley | null /** Raiders from a barbarian camp attacked; a beaten band leaves a bounty in the village. */ raid?: boolean bounty?: Cost | null @@ -327,6 +332,16 @@ export interface SimulatedBattle { wall: { before: number; after: number } | null building: { before: number; after: number } | null power: { attack: number; defense: number } + volley?: Volley | null +} + +/** + * Each side's units killed by the other side's archers and catapults before the melee, by unit; + * they are part of that side's `lost`. defender is null in an attacker's report that saw nothing. + */ +export interface Volley { + attacker: Record