Death source tracking + combat threat/jitter fixes

- Adventure characters now record DeathSource ("adventure"|"arena") and
  DeathLocation when killed. Threaded through Kill() and transitionDeath.
  Daily report uses the recorded death location instead of misattributing
  arena deaths to the day's adventure log: when DeathSource != "adventure",
  the adventure block shows the alive icon and a separate "Later fell in
  {location}." line. Standout-loss flavor uses DeathLocation. Empty
  DeathSource (legacy rows) falls back to current behavior.
- calcDamage applies a ±15% per-hit jitter, so successive hits in a phase
  no longer produce identical numbers. Previously every hit in a phase was
  flat (e.g. 17, 17, 17, 17) and mirror-symmetric between player/enemy,
  reading as scripted.
- assessThreat rewritten to use the engine's actual penetration formula:
  damage-per-round each direction, then rounds-to-kill ratio. The old
  additive HP+Attack*3 model ignored Defense, so even fights could be
  rated trivial — players died after consumables were skipped with the
  "threat assessed as manageable" message.
- SelectConsumables never skips on trivial when arenaRound > 0. Arena
  losses cost real money and equipment, so the cost of a wrong assessment
  is too high to gamble on; adventure-side fights still skip trivial
  threats to avoid wasting items on chump enemies.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
prosolis
2026-05-03 11:42:00 -07:00
parent a00987e75c
commit 8e0fe0230c
9 changed files with 93 additions and 19 deletions

View File

@@ -323,6 +323,8 @@ type DeathTransitionParams struct {
Equip map[EquipmentSlot]*AdvEquipment
ChatLevel int
Location string // set as GrudgeLocation; empty = don't set
Source string // death source: "adventure" | "arena" — recorded on Kill()
DeathLocation string // human-readable death location for the daily report; falls back to Location
AllowPardon bool // chat level pardon (adventure only)
AllowSovereign bool // probability-band Sovereign reprieve (non-engine path)
EngineSaved bool // combat engine used Sovereign death save
@@ -371,7 +373,11 @@ func transitionDeath(p DeathTransitionParams) DeathTransitionResult {
return r
}
p.Char.Kill()
deathLoc := p.DeathLocation
if deathLoc == "" {
deathLoc = p.Location
}
p.Char.Kill(p.Source, deathLoc)
if p.Location != "" {
p.Char.GrudgeLocation = p.Location
}