Count the hits behind a card's and a power's damage #332

Merged
nelsong6 merged 1 commit from claude/card-targets-hit into main 2026-10-17 09:58:13 -07:00
nelsong6 commented 2026-09-15 23:10:23 -07:00 (Migrated from github.com)

A damage total on its own cannot be read. Plays is not a stand-in, because one
play of a multi-hit or AoE attack lands many hits — so 378 damage on a card
could be six heavy swings or forty chip hits, and nothing in the aggregate said
which.

Every other damage-bearing aggregate already carries that count beside its
totals: EnemyAggregate.DamageInstances, CardOrbAggregate.TargetsHit,
PotionRunHistoryEntry.TargetsHit. CardAggregate had the full damage set with
no hit count, and PowerAggregate acquired the same gap when #329 gave it
damage for Panache.

Approach

Both count one per observed DamageReceivedEntry, incremented on the line next
to the totals themselves so the two cannot drift apart.

The name is inherited from its three siblings rather than exact: it counts
hits, not distinct enemies, so a 3×5 attack on one enemy counts 3. The field
comment says so plainly rather than letting the name imply otherwise. Renaming
the three existing fields would be a persisted-schema change and is out of scope
here.

Surfaces

  • Card tooltip and Panache tooltip: a Damage per hit row showing the ratio
    it came from (78 / 12 → 6.5), the same shape Damage share uses
    directly above it, so the average can be checked rather than trusted.
  • Deck-view sort menu: Hits landed and Damage per hit under Damage.
    These separate the heavy swing from the chip attack that reached the same
    total.

Verification

  • card-targets-hit-run.json fixture covering both aggregates, with
    SchemaLoadingTests assertions historical and resumable.
  • An older-shape case proving a run saved before hits were counted loads with
    its damage intact and zero hits, rather than failing.
  • Full suite: 2144 passed, 0 failed.

No new Harmony targets — both write points are inside handlers that already run,
so hot reload was sufficient (435 classes patched, 0 failed).

🤖 Generated with Claude Code

A damage total on its own cannot be read. `Plays` is not a stand-in, because one play of a multi-hit or AoE attack lands many hits — so 378 damage on a card could be six heavy swings or forty chip hits, and nothing in the aggregate said which. Every other damage-bearing aggregate already carries that count beside its totals: `EnemyAggregate.DamageInstances`, `CardOrbAggregate.TargetsHit`, `PotionRunHistoryEntry.TargetsHit`. `CardAggregate` had the full damage set with no hit count, and `PowerAggregate` acquired the same gap when #329 gave it damage for Panache. ## Approach Both count one per observed `DamageReceivedEntry`, incremented on the line next to the totals themselves so the two cannot drift apart. The name is inherited from its three siblings rather than exact: it counts **hits, not distinct enemies**, so a 3×5 attack on one enemy counts 3. The field comment says so plainly rather than letting the name imply otherwise. Renaming the three existing fields would be a persisted-schema change and is out of scope here. ## Surfaces - Card tooltip and Panache tooltip: a **Damage per hit** row showing the ratio it came from (`78 / 12` → `6.5`), the same shape **Damage share** uses directly above it, so the average can be checked rather than trusted. - Deck-view sort menu: **Hits landed** and **Damage per hit** under Damage. These separate the heavy swing from the chip attack that reached the same total. ## Verification - `card-targets-hit-run.json` fixture covering both aggregates, with `SchemaLoadingTests` assertions historical and resumable. - An older-shape case proving a run saved before hits were counted loads with its damage intact and zero hits, rather than failing. - Full suite: 2144 passed, 0 failed. No new Harmony targets — both write points are inside handlers that already run, so hot reload was sufficient (435 classes patched, 0 failed). 🤖 Generated with [Claude Code](https://claude.com/claude-code)
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
romaine-life/spirelens!332
No description provided.