feat(Core/Unit): don't allow additions threat in evade mode and implement AURA_INTERRUPT_FLAG_LEAVE_COMBAT (#3381)

This commit is contained in:
Stefano Borzì
2020-10-23 22:12:37 +02:00
committed by GitHub
parent 90a10a9b88
commit d07a34c1d5
2 changed files with 7 additions and 11 deletions

View File

@@ -12796,8 +12796,11 @@ void Unit::ClearInCombat()
void Unit::ClearInPetCombat()
{
RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PET_IN_COMBAT);
RemoveAurasWithInterruptFlags(AURA_INTERRUPT_FLAG_LEAVE_COMBAT);
if (Unit* owner = GetOwner())
{
owner->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PET_IN_COMBAT);
}
}
bool Unit::isTargetableForAttack(bool checkFakeDeath, Unit const* byWho) const
@@ -13600,8 +13603,10 @@ float Unit::ApplyTotalThreatModifier(float fThreat, SpellSchoolMask schoolMask)
void Unit::AddThreat(Unit* victim, float fThreat, SpellSchoolMask schoolMask, SpellInfo const* threatSpell)
{
// Only mobs can manage threat lists
if (CanHaveThreatList())
if (CanHaveThreatList() && !HasUnitState(UNIT_STATE_EVADE))
{
m_ThreatManager.addThreat(victim, fThreat, schoolMask, threatSpell);
}
}
//======================================================================
@@ -19482,11 +19487,6 @@ bool Unit::SetDisableGravity(bool disable, bool /*packetOnly = false*/)
else
{
RemoveUnitMovementFlag(MOVEMENTFLAG_DISABLE_GRAVITY);
if (!HasUnitMovementFlag(MOVEMENTFLAG_CAN_FLY))
{
m_movementInfo.SetFallTime(0);
//AddUnitMovementFlag(MOVEMENTFLAG_FALLING); // pussywizard: ZOMG!
}
}
return true;
@@ -19518,11 +19518,6 @@ bool Unit::SetCanFly(bool enable, bool /*packetOnly = false */)
else
{
RemoveUnitMovementFlag(MOVEMENTFLAG_CAN_FLY | MOVEMENTFLAG_MASK_MOVING_FLY);
if (!IsLevitating())
{
m_movementInfo.SetFallTime(0);
//AddUnitMovementFlag(MOVEMENTFLAG_FALLING); // pussywizard: ZOMG!
}
}
return true;