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; }
}
}