Core/Creature: Allow to disable HP regen in Raids even if the target is unreachable
Port From (https://github.com/TrinityCore/TrinityCore/commit/07863a7a6817dbb16fbd740130149bf727a6a136)
This commit is contained in:
@@ -1666,6 +1666,7 @@ namespace Framework.Constants
|
|||||||
RateXpBoost,
|
RateXpBoost,
|
||||||
RateXpQuest,
|
RateXpQuest,
|
||||||
RealmZone,
|
RealmZone,
|
||||||
|
RegenHpCannotReachTargetInRaid,
|
||||||
ResetDuelCooldowns,
|
ResetDuelCooldowns,
|
||||||
ResetDuelHealthMana,
|
ResetDuelHealthMana,
|
||||||
RespawnDynamicEscortNpc,
|
RespawnDynamicEscortNpc,
|
||||||
|
|||||||
@@ -590,8 +590,24 @@ namespace Game.Entities
|
|||||||
|
|
||||||
if (RegenTimer == 0)
|
if (RegenTimer == 0)
|
||||||
{
|
{
|
||||||
if (!IsInEvadeMode() && (!IsEngaged() || IsPolymorphed() || CanNotReachTarget())) // regenerate health if not in combat or if polymorphed
|
if (!IsInEvadeMode())
|
||||||
RegenerateHealth();
|
{
|
||||||
|
// regenerate health if not in combat or if polymorphed)
|
||||||
|
if (!IsEngaged() || IsPolymorphed())
|
||||||
|
RegenerateHealth();
|
||||||
|
else if (CanNotReachTarget())
|
||||||
|
{
|
||||||
|
// regenerate health if cannot reach the target and the setting is set to do so.
|
||||||
|
// this allows to disable the health regen of raid bosses if pathfinding has issues for whatever reason
|
||||||
|
if (WorldConfig.GetBoolValue(WorldCfg.RegenHpCannotReachTargetInRaid) || !GetMap().IsRaid())
|
||||||
|
{
|
||||||
|
RegenerateHealth();
|
||||||
|
Log.outDebug(LogFilter.Unit, $"RegenerateHealth() enabled because Creature cannot reach the target. Detail: {GetDebugInfo()}");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
Log.outDebug(LogFilter.Unit, $"RegenerateHealth() disabled even if the Creature cannot reach the target. Detail: {GetDebugInfo()}");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (GetPowerType() == PowerType.Energy)
|
if (GetPowerType() == PowerType.Energy)
|
||||||
Regenerate(PowerType.Energy);
|
Regenerate(PowerType.Energy);
|
||||||
@@ -2800,15 +2816,19 @@ namespace Game.Entities
|
|||||||
return range;
|
return range;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SetCannotReachTarget(bool cannotReach)
|
bool CanNotReachTarget() { return m_cannotReachTarget; }
|
||||||
|
|
||||||
|
void SetCannotReachTarget(bool cannotReach)
|
||||||
{
|
{
|
||||||
if (cannotReach == m_cannotReachTarget)
|
if (cannotReach == m_cannotReachTarget)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
m_cannotReachTarget = cannotReach;
|
m_cannotReachTarget = cannotReach;
|
||||||
m_cannotReachTimer = 0;
|
m_cannotReachTimer = 0;
|
||||||
|
|
||||||
|
if (cannotReach)
|
||||||
|
Log.outDebug(LogFilter.Unit, $"Creature::SetCannotReachTarget() called with true. Details: {GetDebugInfo()}");
|
||||||
}
|
}
|
||||||
bool CanNotReachTarget() { return m_cannotReachTarget; }
|
|
||||||
|
|
||||||
public float GetAggroRange(Unit target)
|
public float GetAggroRange(Unit target)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -312,6 +312,8 @@ namespace Game
|
|||||||
/// @todo Add MonsterSight (with meaning) in worldserver.conf or put them as define
|
/// @todo Add MonsterSight (with meaning) in worldserver.conf or put them as define
|
||||||
Values[WorldCfg.SightMonster] = GetDefaultValue("MonsterSight", 50.0f);
|
Values[WorldCfg.SightMonster] = GetDefaultValue("MonsterSight", 50.0f);
|
||||||
|
|
||||||
|
Values[WorldCfg.RegenHpCannotReachTargetInRaid] = GetDefaultValue("Creature.RegenHPCannotReachTargetInRaid", true);
|
||||||
|
|
||||||
if (reload)
|
if (reload)
|
||||||
{
|
{
|
||||||
int val = GetDefaultValue("GameType", 0);
|
int val = GetDefaultValue("GameType", 0);
|
||||||
|
|||||||
@@ -1708,6 +1708,14 @@ Creature.MovingStopTimeForPlayer = 180000
|
|||||||
|
|
||||||
MonsterSight = 50.000000
|
MonsterSight = 50.000000
|
||||||
|
|
||||||
|
#
|
||||||
|
# Creature.RegenHPCannotReachTargetInRaid
|
||||||
|
# Description: Regenerates HP for Creatures in Raids if they cannot reach the target.
|
||||||
|
# Default: 1 - (Enabled)
|
||||||
|
# 0 - (Disabled)
|
||||||
|
|
||||||
|
Creature.RegenHPCannotReachTargetInRaid = 1
|
||||||
|
|
||||||
#
|
#
|
||||||
###################################################################################################
|
###################################################################################################
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user