mirror of
https://github.com/prosolis/gogobee.git
synced 2026-07-15 08:32:41 +00:00
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:
@@ -644,12 +644,17 @@ func applyAbility(st *combatState, player, enemy *Combatant, phase *CombatPhase,
|
||||
// reduction rather than flat subtraction, so damage is never fully negated.
|
||||
// Formula: rawAtk * reduction where reduction = K / (K + effectiveDef).
|
||||
// K=40 means 40 defense halves incoming damage; 80 defense reduces by 67%.
|
||||
//
|
||||
// A ±15% per-hit jitter is applied so successive hits in the same phase don't
|
||||
// produce identical numbers — the previous flat-damage output read as scripted.
|
||||
func calcDamage(attack int, atkWeight, dmgBonus float64, defense int, defWeight, dmgReduct float64) int {
|
||||
const K = 40.0
|
||||
rawAtk := float64(attack) * atkWeight * (1 + dmgBonus)
|
||||
effectiveDef := float64(defense) * defWeight * dmgReduct
|
||||
reduction := K / (K + effectiveDef)
|
||||
dmg := rawAtk * reduction
|
||||
jitter := 0.85 + rand.Float64()*0.30 // 0.85 .. 1.15
|
||||
dmg *= jitter
|
||||
if dmg < 1 {
|
||||
return 1
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user