Record out-of-combat healing and stop Ancient points booking under "?" #342

Merged
nelsong6 merged 1 commit from claude/sad-napier-14962f into main 2026-10-10 21:33:35 -07:00
nelsong6 commented 2026-10-10 21:05:40 -07:00 (Migrated from github.com)

The gap

CreatureCmd.Heal only calls Hook.AfterCurrentHpChanged when
creature.CombatState != null, and the player's creature is detached from
combat state outside a fight (CombatManager.Reset(graceful) →
CombatState.RemoveCreature). SpireLens recorded healing only through that
hook, so the map legend's HpHealed silently missed every out-of-combat heal:
rest-site Rest and Mend, event heals, Ancient arrival heals, Meal Ticket,
Eternal Feather, and potions drunk on the map. No other patch covered them —
the relic-heal patches only feed per-relic stats (via their own before/after HP
fallback), and RunHistoryCampfireSummary reads the game's map-point history
for a different surface.

Second bug of the same shape: in combat the hook receives the requested
amount, not the clamped num the method computed, so a heal near full HP
reported more than it restored. CalculateRelicHealingActualRestored keeps
Max(hook, observed), so that overcount reached relic TotalHealingRestored
too.

The fix

  • New CreatureHealObservationPatch reads CurrentHp around
    Creature.HealInternal — the one caller is CreatureCmd.Heal, the mutation
    is synchronous and ahead of every await, so the delta is the HP actually
    restored in or out of combat. It feeds both RecordRunHpGained and
    RecordRelicHealingHpChanged.
  • HookAfterCurrentHpChangedPatch keeps losses only, so in-combat heals are not
    counted twice. Its other positive source, CreatureCmd.SetCurrentHp, raises
    HP only for monsters in the current game.
  • ResolveMapLegendCategoryKeyLocked no longer falls through to room type when
    the picked icon for the floor has no legend row. Ancient and Boss have none,
    and an Ancient is an EventRoom, so with heals now arriving there Neow's
    run-start heal to full would have landed under "?" every run. Ancient relic
    picks were already landing there; they now land nowhere, which matches Boss.
  • Primer note under the healing-attribution section.

No new persisted fields, so no schema fixture.

Verification

Built, deployed and hot-reloaded: Patch install: 439 classes patched, 0 failed/skipped, Core.Initialize complete, HOT RELOAD DONE, and
Creature.HealInternal present in the patched-method listing. Tests and live
behavioral verification not run (user-owned).

Restart requirement is uncertain: Creature.HealInternal is a newly added
Harmony target and the running process may have compiled CreatureCmd.Heal
with it inlined. Concrete way to learn without a restart: note the Rest Site
"HP restored" row in the map legend, then rest — if it moves, the live path
already reaches the patch.

## The gap `CreatureCmd.Heal` only calls `Hook.AfterCurrentHpChanged` when `creature.CombatState != null`, and the player's creature is detached from combat state outside a fight (`CombatManager.Reset(graceful)` → `CombatState.RemoveCreature`). SpireLens recorded healing only through that hook, so the map legend's `HpHealed` silently missed every out-of-combat heal: rest-site Rest and Mend, event heals, Ancient arrival heals, Meal Ticket, Eternal Feather, and potions drunk on the map. No other patch covered them — the relic-heal patches only feed per-relic stats (via their own before/after HP fallback), and `RunHistoryCampfireSummary` reads the game's map-point history for a different surface. Second bug of the same shape: in combat the hook receives the *requested* `amount`, not the clamped `num` the method computed, so a heal near full HP reported more than it restored. `CalculateRelicHealingActualRestored` keeps `Max(hook, observed)`, so that overcount reached relic `TotalHealingRestored` too. ## The fix - New `CreatureHealObservationPatch` reads `CurrentHp` around `Creature.HealInternal` — the one caller is `CreatureCmd.Heal`, the mutation is synchronous and ahead of every `await`, so the delta is the HP actually restored in or out of combat. It feeds both `RecordRunHpGained` and `RecordRelicHealingHpChanged`. - `HookAfterCurrentHpChangedPatch` keeps losses only, so in-combat heals are not counted twice. Its other positive source, `CreatureCmd.SetCurrentHp`, raises HP only for monsters in the current game. - `ResolveMapLegendCategoryKeyLocked` no longer falls through to room type when the picked icon for the floor has no legend row. Ancient and Boss have none, and an Ancient is an `EventRoom`, so with heals now arriving there Neow's run-start heal to full would have landed under "?" every run. Ancient relic picks were already landing there; they now land nowhere, which matches Boss. - Primer note under the healing-attribution section. No new persisted fields, so no schema fixture. ## Verification Built, deployed and hot-reloaded: `Patch install: 439 classes patched, 0 failed/skipped`, `Core.Initialize complete`, `HOT RELOAD DONE`, and `Creature.HealInternal` present in the patched-method listing. Tests and live behavioral verification not run (user-owned). Restart requirement is **uncertain**: `Creature.HealInternal` is a newly added Harmony target and the running process may have compiled `CreatureCmd.Heal` with it inlined. Concrete way to learn without a restart: note the Rest Site "HP restored" row in the map legend, then rest — if it moves, the live path already reaches the patch.
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!342
No description provided.