Enable HealSelf and widen AI engagement to ability range
- Implement HealSelf execution in DungeonSimulation and mark it as implemented - Add healing log output for ability verification - Use mob engagement range derived from offensive ability ranges in Aggressive/Defensive/Tank behaviors - Allow ranged/projectile abilities to trigger before point-blank melee distance
This commit is contained in:
@@ -516,6 +516,10 @@ public partial class DungeonSimulation
|
||||
case MobAbilityType.HazardZone:
|
||||
SpawnHazardZone(mob, ability.Definition, target.X, target.Y);
|
||||
break;
|
||||
|
||||
case MobAbilityType.HealSelf:
|
||||
ProcessHealSelfAbility(mob, ability.Definition);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -562,10 +566,26 @@ public partial class DungeonSimulation
|
||||
MobAbilityType.Knockback => true,
|
||||
MobAbilityType.Pull => true,
|
||||
MobAbilityType.HazardZone => true,
|
||||
MobAbilityType.HealSelf => true,
|
||||
_ => false
|
||||
};
|
||||
}
|
||||
|
||||
private static void ProcessHealSelfAbility(MobInstance mob, MobAbilityDefinition ability)
|
||||
{
|
||||
if (!mob.IsAlive || mob.MaxHealth <= 0) return;
|
||||
|
||||
// For test coverage and predictable behavior, HealSelf restores BaseDamage HP.
|
||||
// It is capped to MaxHealth.
|
||||
int healAmount = Math.Max(1, ability.BaseDamage);
|
||||
int oldHealth = mob.Health;
|
||||
mob.Health = Math.Min(mob.MaxHealth, mob.Health + healAmount);
|
||||
int actualHealed = mob.Health - oldHealth;
|
||||
|
||||
Console.WriteLine(
|
||||
$"[MobHeal] Mob {mob.Id} ({mob.Name}) HealSelf {ability.Key}: +{actualHealed} (requested={healAmount}) hp={mob.Health}/{mob.MaxHealth}");
|
||||
}
|
||||
|
||||
private void ProcessSummonAbility(MobInstance mob, MobAbilityDefinition ability)
|
||||
{
|
||||
if (!ability.SummonMobId.HasValue)
|
||||
|
||||
Reference in New Issue
Block a user