Core/Creature: regenerate health
Port From (https://github.com/TrinityCore/TrinityCore/commit/9a5e2b80b39d3c0a466aec1ab3a6dbccf938f570)
This commit is contained in:
@@ -1896,7 +1896,7 @@ namespace Game.AI
|
||||
{
|
||||
foreach (var target in targets)
|
||||
if (IsCreature(target))
|
||||
target.ToCreature().SetRegeneratingHealth(e.Action.setHealthRegen.regenHealth != 0 ? true : false);
|
||||
target.ToCreature().SetRegenerateHealth(e.Action.setHealthRegen.regenHealth != 0 ? true : false);
|
||||
break;
|
||||
}
|
||||
case SmartActions.SetRoot:
|
||||
|
||||
@@ -36,6 +36,10 @@ namespace Game.Entities
|
||||
long _lastDamagedTime; // Part of Evade mechanics
|
||||
MultiMap<byte, byte> m_textRepeat = new MultiMap<byte, byte>();
|
||||
|
||||
// Regenerate health
|
||||
bool _regenerateHealth; // Set on creation
|
||||
bool _regenerateHealthLock; // Dynamically set
|
||||
|
||||
public ulong m_PlayerDamageReq;
|
||||
public float m_SightDistance;
|
||||
public float m_CombatDistance;
|
||||
@@ -49,7 +53,6 @@ namespace Game.Entities
|
||||
|
||||
bool m_AlreadyCallAssistance;
|
||||
bool m_AlreadySearchedAssistance;
|
||||
bool m_regenHealth;
|
||||
bool m_cannotReachTarget;
|
||||
uint m_cannotReachTimer;
|
||||
bool m_AI_locked;
|
||||
|
||||
@@ -42,7 +42,7 @@ namespace Game.Entities
|
||||
m_boundaryCheckTime = 2500;
|
||||
reactState = ReactStates.Aggressive;
|
||||
DefaultMovementType = MovementGeneratorType.Idle;
|
||||
m_regenHealth = true;
|
||||
_regenerateHealth = true;
|
||||
m_meleeDamageSchoolMask = SpellSchoolMask.Normal;
|
||||
triggerJustAppeared = true;
|
||||
|
||||
@@ -329,7 +329,7 @@ namespace Game.Entities
|
||||
|
||||
CreatureTemplate cInfo = GetCreatureTemplate();
|
||||
|
||||
m_regenHealth = cInfo.RegenHealth;
|
||||
_regenerateHealth = cInfo.RegenHealth;
|
||||
|
||||
// creatures always have melee weapon ready if any unless specified otherwise
|
||||
if (GetCreatureAddon() == null)
|
||||
@@ -671,7 +671,7 @@ namespace Game.Entities
|
||||
|
||||
void RegenerateHealth()
|
||||
{
|
||||
if (!IsRegeneratingHealth())
|
||||
if (!CanRegenerateHealth())
|
||||
return;
|
||||
|
||||
ulong curValue = GetHealth();
|
||||
@@ -1436,12 +1436,11 @@ namespace Game.Entities
|
||||
|
||||
public void SetSpawnHealth()
|
||||
{
|
||||
if (m_creatureData == null)
|
||||
if (_regenerateHealthLock)
|
||||
return;
|
||||
|
||||
ulong curhealth;
|
||||
|
||||
if (!m_regenHealth)
|
||||
if (m_creatureData != null && !_regenerateHealth)
|
||||
{
|
||||
curhealth = m_creatureData.curhealth;
|
||||
if (curhealth != 0)
|
||||
@@ -3178,8 +3177,8 @@ namespace Game.Entities
|
||||
m_combatPulseTime = delay;
|
||||
}
|
||||
|
||||
public bool IsRegeneratingHealth() { return m_regenHealth; }
|
||||
public void SetRegeneratingHealth(bool regenHealth) { m_regenHealth = regenHealth; }
|
||||
public bool CanRegenerateHealth() { return !_regenerateHealthLock && _regenerateHealth; }
|
||||
public void SetRegenerateHealth(bool value) { _regenerateHealthLock = !value; }
|
||||
|
||||
public void SetHomePosition(float x, float y, float z, float o)
|
||||
{
|
||||
|
||||
@@ -47,11 +47,7 @@ namespace Game.AI
|
||||
owner.SetWalk(true);
|
||||
owner.LoadCreaturesAddon();
|
||||
owner.GetAI().JustReachedHome();
|
||||
if (owner.IsRegeneratingHealth())
|
||||
{
|
||||
owner.SetFullHealth();
|
||||
owner.SetPower(PowerType.Mana, owner.GetMaxPower(PowerType.Mana));
|
||||
}
|
||||
owner.SetSpawnHealth();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -227,7 +227,6 @@ namespace Game.Movement
|
||||
|
||||
// inform formation
|
||||
creature.SignalFormationMovement(formationDest, waypoint.id, waypoint.moveType, (waypoint.orientation != 0 && waypoint.delay != 0) ? true : false);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -245,7 +244,6 @@ namespace Game.Movement
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
if (!_nextMoveTime.Passed())
|
||||
{
|
||||
_nextMoveTime.Update((int)diff);
|
||||
|
||||
@@ -554,7 +554,7 @@ namespace Scripts.Northrend.IcecrownCitadel
|
||||
Index = 0xFFFFFFFF;
|
||||
|
||||
BurningPitchId = Instance.GetData(DataTypes.TeamInInstance) == (uint)Team.Horde ? GunshipSpells.BurningPitchA : GunshipSpells.BurningPitchH;
|
||||
me.SetRegeneratingHealth(false);
|
||||
me.SetRegenerateHealth(false);
|
||||
}
|
||||
|
||||
public override void SetData(uint type, uint data)
|
||||
@@ -680,7 +680,7 @@ namespace Scripts.Northrend.IcecrownCitadel
|
||||
_summonedFirstMage = false;
|
||||
_died = false;
|
||||
|
||||
me.SetRegeneratingHealth(false);
|
||||
me.SetRegenerateHealth(false);
|
||||
}
|
||||
|
||||
public override void DamageTaken(Unit source, ref uint damage)
|
||||
@@ -844,7 +844,7 @@ namespace Scripts.Northrend.IcecrownCitadel
|
||||
|
||||
_controller.ResetSlots(Team.Horde);
|
||||
_controller.SetTransport(creature.GetTransport());
|
||||
me.SetRegeneratingHealth(false);
|
||||
me.SetRegenerateHealth(false);
|
||||
me.m_CombatDistance = 70.0f;
|
||||
}
|
||||
|
||||
@@ -1104,7 +1104,7 @@ namespace Scripts.Northrend.IcecrownCitadel
|
||||
|
||||
_controller.ResetSlots(Team.Alliance);
|
||||
_controller.SetTransport(creature.GetTransport());
|
||||
me.SetRegeneratingHealth(false);
|
||||
me.SetRegenerateHealth(false);
|
||||
me.m_CombatDistance = 70.0f;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user