Skip to content

Commit

Permalink
Increase MIN_HEALTH_PERCENT_FOR_MELEE_SWITCH_ON_INTERRUPT to 80
Browse files Browse the repository at this point in the history
  • Loading branch information
bm01 committed Aug 18, 2024
1 parent d816c5b commit 079ba69
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions GameServer/ECS-Components/Actions/NpcAttackAction.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ namespace DOL.GS
{
public class NpcAttackAction : AttackAction
{
private const int MIN_HEALTH_PERCENT_FOR_MELEE_SWITCH_ON_INTERRUPT = 70;
private const int HEALTH_PERCENT_TRESHOLD_FOR_MELEE_SWITCH_ON_INTERRUPT = 80;
private const double TIME_TO_TARGET_TRESHOLD_BEFORE_MELEE_SWITCH = 250; // NPCs will switch to melee if within melee range + (this * maxSpeed * 0.001).
private const double TIME_TO_TARGET_TRESHOLD_BEFORE_RANGED_SWITCH = 1000; // NPCs will switch to ranged if further than melee range + (this * maxSpeed * 0.001).

Expand All @@ -33,7 +33,7 @@ public override void OnAimInterrupt(GameObject attacker)

// Guard archers and immobile NPCs should ignore the health threshold.
// They will still switch to melee if their target gets in melee range.
if ((!IsGuardArcherOrImmobile && _npcOwner.HealthPercent < MIN_HEALTH_PERCENT_FOR_MELEE_SWITCH_ON_INTERRUPT) ||
if ((!IsGuardArcherOrImmobile && _npcOwner.HealthPercent < HEALTH_PERCENT_TRESHOLD_FOR_MELEE_SWITCH_ON_INTERRUPT) ||
(attacker is GameLiving livingAttacker && livingAttacker.ActiveWeaponSlot is not eActiveWeaponSlot.Distance && livingAttacker.IsWithinRadius(_npcOwner, livingAttacker.attackComponent.AttackRange)))
SwitchToMeleeAndTick();
}
Expand Down

0 comments on commit 079ba69

Please sign in to comment.