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