mirror of
https://github.com/araxiaonline/TrinityCore.git
synced 2026-06-16 21:20:01 -04:00
Don't allow units to enter combat upon death
This commit is contained in:
@@ -1337,7 +1337,7 @@ bool Creature::IsInvisibleDueToDespawn() const
|
||||
if (Unit::IsInvisibleDueToDespawn())
|
||||
return true;
|
||||
|
||||
if (IsAlive() || m_corpseRemoveTime > time(NULL))
|
||||
if (IsAlive() || isDying() || m_corpseRemoveTime > time(NULL))
|
||||
return false;
|
||||
|
||||
return true;
|
||||
|
||||
@@ -12393,6 +12393,9 @@ void Unit::SetSpeed(UnitMoveType mtype, float rate, bool forced)
|
||||
|
||||
void Unit::setDeathState(DeathState s)
|
||||
{
|
||||
// Death state needs to be updated before RemoveAllAurasOnDeath() is called, to prevent entering combat
|
||||
m_deathState = s;
|
||||
|
||||
if (s != ALIVE && s != JUST_RESPAWNED)
|
||||
{
|
||||
CombatStop();
|
||||
@@ -12441,8 +12444,6 @@ void Unit::setDeathState(DeathState s)
|
||||
}
|
||||
else if (s == JUST_RESPAWNED)
|
||||
RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_SKINNABLE); // clear skinnable for creature and player (at battleground)
|
||||
|
||||
m_deathState = s;
|
||||
}
|
||||
|
||||
/*########################################
|
||||
@@ -12450,14 +12451,14 @@ void Unit::setDeathState(DeathState s)
|
||||
######## AGGRO SYSTEM ########
|
||||
######## ########
|
||||
########################################*/
|
||||
bool Unit::CanHaveThreatList() const
|
||||
bool Unit::CanHaveThreatList(bool skipAliveCheck) const
|
||||
{
|
||||
// only creatures can have threat list
|
||||
if (GetTypeId() != TYPEID_UNIT)
|
||||
return false;
|
||||
|
||||
// only alive units can have threat list
|
||||
if (!IsAlive() || isDying())
|
||||
if (!skipAliveCheck && !IsAlive())
|
||||
return false;
|
||||
|
||||
// totems can not have threat list
|
||||
@@ -12500,7 +12501,7 @@ void Unit::AddThreat(Unit* victim, float fThreat, SpellSchoolMask schoolMask, Sp
|
||||
|
||||
void Unit::DeleteThreatList()
|
||||
{
|
||||
if (CanHaveThreatList() && !m_ThreatManager.isThreatListEmpty())
|
||||
if (CanHaveThreatList(true) && !m_ThreatManager.isThreatListEmpty())
|
||||
SendClearThreatListOpcode();
|
||||
m_ThreatManager.clearReferences();
|
||||
}
|
||||
|
||||
@@ -1894,7 +1894,7 @@ class Unit : public WorldObject
|
||||
uint32 m_lastSanctuaryTime;
|
||||
|
||||
// Threat related methods
|
||||
bool CanHaveThreatList() const;
|
||||
bool CanHaveThreatList(bool skipAliveCheck = false) const;
|
||||
void AddThreat(Unit* victim, float fThreat, SpellSchoolMask schoolMask = SPELL_SCHOOL_MASK_NORMAL, SpellInfo const* threatSpell = NULL);
|
||||
float ApplyTotalThreatModifier(float fThreat, SpellSchoolMask schoolMask = SPELL_SCHOOL_MASK_NORMAL);
|
||||
void DeleteThreatList();
|
||||
|
||||
Reference in New Issue
Block a user