Fix HealSelf magnitude handling for negative base damage
- Use absolute BaseDamage for HealSelf so test abilities using negative damage values heal correctly - Preserve minimum heal of 1 and max-health cap
This commit is contained in:
@@ -575,9 +575,9 @@ public partial class DungeonSimulation
|
|||||||
{
|
{
|
||||||
if (!mob.IsAlive || mob.MaxHealth <= 0) return;
|
if (!mob.IsAlive || mob.MaxHealth <= 0) return;
|
||||||
|
|
||||||
// For test coverage and predictable behavior, HealSelf restores BaseDamage HP.
|
// HealSelf uses the magnitude of BaseDamage so test rows can use negative
|
||||||
// It is capped to MaxHealth.
|
// values (for "negative damage = heal" semantics) without being clamped to 1.
|
||||||
int healAmount = Math.Max(1, ability.BaseDamage);
|
int healAmount = Math.Max(1, Math.Abs(ability.BaseDamage));
|
||||||
int oldHealth = mob.Health;
|
int oldHealth = mob.Health;
|
||||||
mob.Health = Math.Min(mob.MaxHealth, mob.Health + healAmount);
|
mob.Health = Math.Min(mob.MaxHealth, mob.Health + healAmount);
|
||||||
int actualHealed = mob.Health - oldHealth;
|
int actualHealed = mob.Health - oldHealth;
|
||||||
|
|||||||
Reference in New Issue
Block a user