mirror of
https://github.com/liyunfan1223/azerothcore-wotlk.git
synced 2026-08-08 15:58:04 +00:00
fix(Core/Unit): update death state before handling RemoveAllAurasOnDeath() (#20124)
fix setDeathState
[PATCH] Don't allow units to enter combat upon death
91ebea4a77.patch
Co-authored-by: trickerer <onlysuffering@gmail.com>
This commit is contained in:
@@ -416,7 +416,7 @@ ThreatMgr::ThreatMgr(Unit* owner) : iCurrentVictim(nullptr), iOwner(owner), iUpd
|
|||||||
|
|
||||||
void ThreatMgr::ClearAllThreat()
|
void ThreatMgr::ClearAllThreat()
|
||||||
{
|
{
|
||||||
if (iOwner->CanHaveThreatList() && !isThreatListEmpty())
|
if (iOwner->CanHaveThreatList(true) && !isThreatListEmpty())
|
||||||
iOwner->SendClearThreatListOpcode();
|
iOwner->SendClearThreatListOpcode();
|
||||||
clearReferences();
|
clearReferences();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1875,7 +1875,7 @@ bool Creature::IsInvisibleDueToDespawn() const
|
|||||||
if (Unit::IsInvisibleDueToDespawn())
|
if (Unit::IsInvisibleDueToDespawn())
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
if (IsAlive() || m_corpseRemoveTime > GameTime::GetGameTime().count())
|
if (IsAlive() || isDying() || m_corpseRemoveTime > GameTime::GetGameTime().count())
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
@@ -14518,6 +14518,7 @@ void Unit::setDeathState(DeathState s, bool despawn)
|
|||||||
{
|
{
|
||||||
// death state needs to be updated before RemoveAllAurasOnDeath() calls HandleChannelDeathItem(..) so that
|
// death state needs to be updated before RemoveAllAurasOnDeath() calls HandleChannelDeathItem(..) so that
|
||||||
// it can be used to check creation of death items (such as soul shards).
|
// it can be used to check creation of death items (such as soul shards).
|
||||||
|
m_deathState = s;
|
||||||
|
|
||||||
if (s != DeathState::Alive && s != DeathState::JustRespawned)
|
if (s != DeathState::Alive && s != DeathState::JustRespawned)
|
||||||
{
|
{
|
||||||
@@ -14567,8 +14568,6 @@ void Unit::setDeathState(DeathState s, bool despawn)
|
|||||||
{
|
{
|
||||||
RemoveFlag (UNIT_FIELD_FLAGS, UNIT_FLAG_SKINNABLE); // clear skinnable for creature and player (at battleground)
|
RemoveFlag (UNIT_FIELD_FLAGS, UNIT_FLAG_SKINNABLE); // clear skinnable for creature and player (at battleground)
|
||||||
}
|
}
|
||||||
|
|
||||||
m_deathState = s;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*########################################
|
/*########################################
|
||||||
@@ -14576,14 +14575,14 @@ void Unit::setDeathState(DeathState s, bool despawn)
|
|||||||
######## AGGRO SYSTEM ########
|
######## AGGRO SYSTEM ########
|
||||||
######## ########
|
######## ########
|
||||||
########################################*/
|
########################################*/
|
||||||
bool Unit::CanHaveThreatList() const
|
bool Unit::CanHaveThreatList(bool skipAliveCheck) const
|
||||||
{
|
{
|
||||||
// only creatures can have threat list
|
// only creatures can have threat list
|
||||||
if (!IsCreature())
|
if (!IsCreature())
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
// only alive units can have threat list
|
// only alive units can have threat list
|
||||||
if (!IsAlive() || isDying())
|
if (!skipAliveCheck && !IsAlive())
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
// totems can not have threat list
|
// totems can not have threat list
|
||||||
|
|||||||
@@ -831,7 +831,7 @@ public:
|
|||||||
void SetCombatTimer(uint32 timer) { m_CombatTimer = timer; }
|
void SetCombatTimer(uint32 timer) { m_CombatTimer = timer; }
|
||||||
|
|
||||||
// Threat related methods
|
// Threat related methods
|
||||||
[[nodiscard]] bool CanHaveThreatList() const;
|
[[nodiscard]] bool CanHaveThreatList(bool skipAliveCheck = false) const;
|
||||||
void AddThreat(Unit* victim, float fThreat, SpellSchoolMask schoolMask = SPELL_SCHOOL_MASK_NORMAL, SpellInfo const* threatSpell = nullptr);
|
void AddThreat(Unit* victim, float fThreat, SpellSchoolMask schoolMask = SPELL_SCHOOL_MASK_NORMAL, SpellInfo const* threatSpell = nullptr);
|
||||||
float ApplyTotalThreatModifier(float fThreat, SpellSchoolMask schoolMask = SPELL_SCHOOL_MASK_NORMAL);
|
float ApplyTotalThreatModifier(float fThreat, SpellSchoolMask schoolMask = SPELL_SCHOOL_MASK_NORMAL);
|
||||||
void TauntApply(Unit* victim);
|
void TauntApply(Unit* victim);
|
||||||
|
|||||||
Reference in New Issue
Block a user