Core/Creatures: Various fixes for creatures, regarding combat conditions, despawning, and few others

Port From (https://github.com/TrinityCore/TrinityCore/commit/fe63cd3dbb66f4fda743858db4284a24bc2bd400)
This commit is contained in:
hondacrx
2019-08-17 10:47:55 -04:00
parent bdfea4ecad
commit d3cbe70f56
10 changed files with 155 additions and 158 deletions
+4 -7
View File
@@ -1047,13 +1047,14 @@ namespace Game.Entities
victim.ModifyHealth(-(int)damage);
if (damagetype == DamageEffectType.Direct || damagetype == DamageEffectType.SpellDirect)
{
victim.RemoveAurasWithInterruptFlags(SpellAuraInterruptFlags.DirectDamage, spellProto != null ? spellProto.Id : 0);
victim.UpdateLastDamagedTime(spellProto);
}
if (!victim.IsTypeId(TypeId.Player))
{
// Part of Evade mechanics. DoT's and Thorns / Retribution Aura do not contribute to this
if (damagetype != DamageEffectType.DOT && damage > 0 && !victim.GetOwnerGUID().IsPlayer() && (spellProto == null || !spellProto.HasAura(GetMap().GetDifficultyID(), AuraType.DamageShield)))
victim.ToCreature().SetLastDamagedTime(Global.WorldMgr.GetGameTime() + SharedConst.MaxAggroResetTime);
victim.AddThreat(this, damage, damageSchoolMask, spellProto);
}
else // victim is a player
@@ -3206,9 +3207,5 @@ namespace Game.Entities
}
return true;
}
// Part of Evade mechanics
public long GetLastDamagedTime() { return _lastDamagedTime; }
public void SetLastDamagedTime(long val) { _lastDamagedTime = val; }
}
}
-1
View File
@@ -65,7 +65,6 @@ namespace Game.Entities
public float m_modMeleeHitChance { get; set; }
public float m_modRangedHitChance { get; set; }
public float m_modSpellHitChance { get; set; }
long _lastDamagedTime;
bool m_canDualWield;
public int m_baseSpellCritChance { get; set; }
public uint m_regenTimer { get; set; }
-11
View File
@@ -4262,17 +4262,6 @@ namespace Game.Entities
return val;
}
void UpdateLastDamagedTime(SpellInfo spellProto)
{
if (!IsTypeId(TypeId.Unit) || IsPet())
return;
if (spellProto != null && spellProto.HasAura(Difficulty.None, AuraType.DamageShield))
return;
SetLastDamagedTime(Time.UnixTime);
}
public bool IsHighestExclusiveAura(Aura aura, bool removeOtherAuraApplications = false)
{
foreach (AuraEffect aurEff in aura.GetAuraEffects())