Core/Spells: implement DoT clipping

* Core/Spells: Implementation of DoT clipping.
* Core/Utilities: Backport "EnumFlags v3.0" from master.
* Core/Spells: Switch AURA_REMOVE_MODE to a flag set.
This commit is contained in:
Warpten authored and GitHub committed 2020-06-04 18:16:03 +02:00
1 parent 6498452dd1
commit 0af44ccc01
72 files changed
+597 -499

No files matched your search

+60 -76
View File
@@ -1920,7 +1920,7 @@ void Unit::CalcAbsorbResist(DamageInfo& damageInfo)
absorbAurEff->SetAmount(absorbAurEff->GetAmount() - currentAbsorb);
// Aura cannot absorb anything more - remove it
if (absorbAurEff->GetAmount() <= 0)
absorbAurEff->GetBase()->Remove(AURA_REMOVE_BY_ENEMY_SPELL);
absorbAurEff->GetBase()->Remove(AuraRemoveFlags::ByEnemySpell);
}
}
@@ -1977,7 +1977,7 @@ void Unit::CalcAbsorbResist(DamageInfo& damageInfo)
{
absorbAurEff->SetAmount(absorbAurEff->GetAmount() - currentAbsorb);
if ((absorbAurEff->GetAmount() <= 0))
absorbAurEff->GetBase()->Remove(AURA_REMOVE_BY_ENEMY_SPELL);
absorbAurEff->GetBase()->Remove(AuraRemoveFlags::ByEnemySpell);
}
}
@@ -2100,7 +2100,7 @@ void Unit::CalcHealAbsorb(HealInfo& healInfo) const
if (auraEff->GetAmount() <= 0)
{
uint32 removedAuras = healInfo.GetTarget()->m_removedAurasCount;
auraEff->GetBase()->Remove(AURA_REMOVE_BY_ENEMY_SPELL);
auraEff->GetBase()->Remove(AuraRemoveFlags::ByEnemySpell);
if (removedAuras + 1 < healInfo.GetTarget()->m_removedAurasCount)
i = vHealAbsorb.begin();
}
@@ -3053,7 +3053,7 @@ void Unit::_UpdateSpells(uint32 time)
for (AuraMap::iterator i = m_ownedAuras.begin(); i != m_ownedAuras.end();)
{
if (i->second->IsExpired())
RemoveOwnedAura(i, AURA_REMOVE_BY_EXPIRE);
RemoveOwnedAura(i, AuraRemoveFlags::Expired);
else
++i;
}
@@ -3139,7 +3139,7 @@ void Unit::SetCurrentCastSpell(Spell* pSpell)
return;
// break same type spell if it is not delayed
InterruptSpell(CSpellType, false);
InterruptSpell(CSpellType, false, true, pSpell);
// special breakage effects:
switch (CSpellType)
@@ -3205,7 +3205,7 @@ void Unit::SetCurrentCastSpell(Spell* pSpell)
pSpell->m_selfContainer = &(m_currentSpells[pSpell->GetCurrentContainer()]);
}
void Unit::InterruptSpell(CurrentSpellTypes spellType, bool withDelayed, bool withInstant)
void Unit::InterruptSpell(CurrentSpellTypes spellType, bool withDelayed, bool withInstant, Spell* interruptingSpell /* = nullptr */)
{
//TC_LOG_DEBUG("entities.unit", "Interrupt spell for unit %u.", GetEntry());
Spell* spell = m_currentSpells[spellType];
@@ -3225,7 +3225,7 @@ void Unit::InterruptSpell(CurrentSpellTypes spellType, bool withDelayed, bool wi
m_currentSpells[spellType] = nullptr;
if (spell->getState() != SPELL_STATE_FINISHED)
spell->cancel();
spell->cancel(interruptingSpell);
if (GetTypeId() == TYPEID_UNIT && IsAIEnabled)
ToCreature()->AI()->OnSpellCastFinished(spell->GetSpellInfo(), SPELL_FINISHED_CANCELED);
@@ -3276,19 +3276,19 @@ bool Unit::IsNonMeleeSpellCast(bool withDelayed, bool skipChanneled, bool skipAu
return false;
}
void Unit::InterruptNonMeleeSpells(bool withDelayed, uint32 spell_id, bool withInstant)
void Unit::InterruptNonMeleeSpells(bool withDelayed, uint32 spell_id, bool withInstant /* = true */, Spell* interruptingSpell /* = nullptr */)
{
// generic spells are interrupted if they are not finished or delayed
if (m_currentSpells[CURRENT_GENERIC_SPELL] && (!spell_id || m_currentSpells[CURRENT_GENERIC_SPELL]->m_spellInfo->Id == spell_id))
InterruptSpell(CURRENT_GENERIC_SPELL, withDelayed, withInstant);
InterruptSpell(CURRENT_GENERIC_SPELL, withDelayed, withInstant, interruptingSpell);
// autorepeat spells are interrupted if they are not finished or delayed
if (m_currentSpells[CURRENT_AUTOREPEAT_SPELL] && (!spell_id || m_currentSpells[CURRENT_AUTOREPEAT_SPELL]->m_spellInfo->Id == spell_id))
InterruptSpell(CURRENT_AUTOREPEAT_SPELL, withDelayed, withInstant);
InterruptSpell(CURRENT_AUTOREPEAT_SPELL, withDelayed, withInstant, interruptingSpell);
// channeled spells are interrupted if they are not finished, even if they are delayed
if (m_currentSpells[CURRENT_CHANNELED_SPELL] && (!spell_id || m_currentSpells[CURRENT_CHANNELED_SPELL]->m_spellInfo->Id == spell_id))
InterruptSpell(CURRENT_CHANNELED_SPELL, true, true);
InterruptSpell(CURRENT_CHANNELED_SPELL, true, true, interruptingSpell);
}
Spell* Unit::FindCurrentSpellBySpellId(uint32 spell_id) const
@@ -3389,7 +3389,7 @@ void Unit::DeMorph()
SetDisplayId(GetNativeDisplayId());
}
Aura* Unit::_TryStackingOrRefreshingExistingAura(SpellInfo const* newAura, uint8 effMask, Unit* caster, int32* baseAmount /*= nullptr*/, Item* castItem /*= nullptr*/, ObjectGuid casterGUID /*= ObjectGuid::Empty*/, bool resetPeriodicTimer /*= true*/)
Aura* Unit::_TryStackingOrRefreshingExistingAura(SpellInfo const* newAura, uint8 effMask, Unit* caster, int32* baseAmount /*= nullptr*/, Item* castItem /*= nullptr*/, ObjectGuid casterGUID /*= ObjectGuid::Empty*/)
{
ASSERT(casterGUID || caster);
@@ -3438,7 +3438,7 @@ Aura* Unit::_TryStackingOrRefreshingExistingAura(SpellInfo const* newAura, uint8
}
// try to increase stack amount
foundAura->ModStackAmount(1, AURA_REMOVE_BY_DEFAULT, resetPeriodicTimer);
foundAura->ModStackAmount(1, AuraRemoveFlags::ByDefault);
return foundAura;
}
}
@@ -3556,14 +3556,14 @@ void Unit::_ApplyAura(AuraApplication * aurApp, uint8 effMask)
_RemoveNoStackAurasDueToAura(aura);
if (aurApp->GetRemoveMode())
if (aurApp->GetRemoveMode().HasAnyFlag())
return;
// Update target aura state flag
if (AuraStateType aState = aura->GetSpellInfo()->GetAuraState())
ModifyAuraState(aState, true);
if (aurApp->GetRemoveMode())
if (aurApp->GetRemoveMode().HasAnyFlag())
return;
// Sitdown on apply aura req seated
@@ -3572,7 +3572,7 @@ void Unit::_ApplyAura(AuraApplication * aurApp, uint8 effMask)
Unit* caster = aura->GetCaster();
if (aurApp->GetRemoveMode())
if (aurApp->GetRemoveMode().HasAnyFlag())
return;
aura->HandleAuraSpecificMods(aurApp, caster, true, false);
@@ -3580,7 +3580,7 @@ void Unit::_ApplyAura(AuraApplication * aurApp, uint8 effMask)
// apply effects of the aura
for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i)
{
if (effMask & 1 << i && (!aurApp->GetRemoveMode()))
if (effMask & 1 << i && !aurApp->GetRemoveMode().HasAnyFlag())
aurApp->_HandleEffect(i, true);
}
@@ -3590,16 +3590,16 @@ void Unit::_ApplyAura(AuraApplication * aurApp, uint8 effMask)
}
// removes aura application from lists and unapplies effects
void Unit::_UnapplyAura(AuraApplicationMap::iterator &i, AuraRemoveMode removeMode)
void Unit::_UnapplyAura(AuraApplicationMap::iterator &i, AuraRemoveFlags removeMode)
{
AuraApplication * aurApp = i->second;
ASSERT(aurApp);
ASSERT(!aurApp->GetRemoveMode());
ASSERT(!aurApp->GetRemoveMode().HasAnyFlag());
ASSERT(aurApp->GetTarget() == this);
aurApp->SetRemoveMode(removeMode);
Aura* aura = aurApp->GetBase();
TC_LOG_DEBUG("spells", "Aura %u now is remove mode %d", aura->GetId(), removeMode);
TC_LOG_DEBUG("spells", "Aura %u now is remove mode %u", aura->GetId(), static_cast<uint32>(removeMode));
// dead loop is killing the server probably
ASSERT(m_removedAurasCount < 0xFFFFFFFF);
@@ -3651,7 +3651,7 @@ void Unit::_UnapplyAura(AuraApplicationMap::iterator &i, AuraRemoveMode removeMo
ASSERT(!aurApp->GetEffectMask());
// Remove totem at next update if totem loses its aura
if (aurApp->GetRemoveMode() == AURA_REMOVE_BY_EXPIRE && GetTypeId() == TYPEID_UNIT && IsTotem())
if (aurApp->GetRemoveMode().HasFlag(AuraRemoveFlags::Expired) && GetTypeId() == TYPEID_UNIT && IsTotem())
{
if (ToTotem()->GetSpell() == aura->GetId() && ToTotem()->GetTotemType() == TOTEM_PASSIVE)
ToTotem()->setDeathState(JUST_DIED);
@@ -3672,7 +3672,7 @@ void Unit::_UnapplyAura(AuraApplicationMap::iterator &i, AuraRemoveMode removeMo
i = m_appliedAuras.begin();
}
void Unit::_UnapplyAura(AuraApplication * aurApp, AuraRemoveMode removeMode)
void Unit::_UnapplyAura(AuraApplication * aurApp, AuraRemoveFlags removeMode)
{
// aura can be removed from unit only if it's applied on it, shouldn't happen
ASSERT(aurApp->GetBase()->GetApplicationOfTarget(GetGUID()) == aurApp);
@@ -3726,7 +3726,7 @@ void Unit::_RemoveNoStackAurasDueToAura(Aura* aura)
if (aura->CanStackWith(i->second->GetBase()))
continue;
RemoveAura(i, AURA_REMOVE_BY_DEFAULT);
RemoveAura(i, AuraRemoveFlags::ByDefault);
if (i == m_appliedAuras.end())
break;
remove = true;
@@ -3742,7 +3742,7 @@ void Unit::_RegisterAuraEffect(AuraEffect* aurEff, bool apply)
}
// All aura base removes should go threw this function!
void Unit::RemoveOwnedAura(AuraMap::iterator &i, AuraRemoveMode removeMode)
void Unit::RemoveOwnedAura(AuraMap::iterator &i, AuraRemoveFlags removeMode)
{
Aura* aura = i->second;
ASSERT(!aura->IsRemoved());
@@ -3763,7 +3763,7 @@ void Unit::RemoveOwnedAura(AuraMap::iterator &i, AuraRemoveMode removeMode)
i = m_ownedAuras.begin();
}
void Unit::RemoveOwnedAura(uint32 spellId, ObjectGuid casterGUID, uint8 reqEffMask, AuraRemoveMode removeMode)
void Unit::RemoveOwnedAura(uint32 spellId, ObjectGuid casterGUID, uint8 reqEffMask, AuraRemoveFlags removeMode)
{
for (AuraMap::iterator itr = m_ownedAuras.lower_bound(spellId); itr != m_ownedAuras.upper_bound(spellId);)
if (((itr->second->GetEffectMask() & reqEffMask) == reqEffMask) && (!casterGUID || itr->second->GetCasterGUID() == casterGUID))
@@ -3775,16 +3775,16 @@ void Unit::RemoveOwnedAura(uint32 spellId, ObjectGuid casterGUID, uint8 reqEffMa
++itr;
}
void Unit::RemoveOwnedAura(Aura* aura, AuraRemoveMode removeMode)
void Unit::RemoveOwnedAura(Aura* aura, AuraRemoveFlags removeMode)
{
if (aura->IsRemoved())
return;
ASSERT(aura->GetOwner() == this);
if (removeMode == AURA_REMOVE_NONE)
if (removeMode == AuraRemoveFlags::None)
{
TC_LOG_ERROR("spells", "Unit::RemoveOwnedAura() called with unallowed removeMode AURA_REMOVE_NONE, spellId %u", aura->GetId());
TC_LOG_ERROR("spells", "Unit::RemoveOwnedAura() called with unallowed removeMode AuraRemoveFlags::None, spellId %u", aura->GetId());
return;
}
@@ -3819,12 +3819,13 @@ Aura* Unit::GetOwnedAura(uint32 spellId, ObjectGuid casterGUID, ObjectGuid itemC
return nullptr;
}
void Unit::RemoveAura(AuraApplicationMap::iterator &i, AuraRemoveMode mode)
void Unit::RemoveAura(AuraApplicationMap::iterator &i, AuraRemoveFlags mode)
{
AuraApplication * aurApp = i->second;
// Do not remove aura which is already being removed
if (aurApp->GetRemoveMode())
if (aurApp->GetRemoveMode().HasAnyFlag())
return;
Aura* aura = aurApp->GetBase();
_UnapplyAura(i, mode);
// Remove aura - for Area and Target auras
@@ -3832,7 +3833,7 @@ void Unit::RemoveAura(AuraApplicationMap::iterator &i, AuraRemoveMode mode)
aura->Remove(mode);
}
void Unit::RemoveAura(uint32 spellId, ObjectGuid caster, uint8 reqEffMask, AuraRemoveMode removeMode)
void Unit::RemoveAura(uint32 spellId, ObjectGuid caster, uint8 reqEffMask, AuraRemoveFlags removeMode)
{
AuraApplicationMapBoundsNonConst range = m_appliedAuras.equal_range(spellId);
for (AuraApplicationMap::iterator iter = range.first; iter != range.second;)
@@ -3849,13 +3850,13 @@ void Unit::RemoveAura(uint32 spellId, ObjectGuid caster, uint8 reqEffMask, AuraR
}
}
void Unit::RemoveAura(AuraApplication * aurApp, AuraRemoveMode mode)
void Unit::RemoveAura(AuraApplication * aurApp, AuraRemoveFlags mode)
{
// we've special situation here, RemoveAura called while during aura removal
// this kind of call is needed only when aura effect removal handler
// or event triggered by it expects to remove
// not yet removed effects of an aura
if (aurApp->GetRemoveMode())
if (aurApp->GetRemoveMode().HasAnyFlag())
{
// remove remaining effects of an aura
for (uint8 itr = 0; itr < MAX_SPELL_EFFECTS; ++itr)
@@ -3884,7 +3885,7 @@ void Unit::RemoveAura(AuraApplication * aurApp, AuraRemoveMode mode)
}
}
void Unit::RemoveAura(Aura* aura, AuraRemoveMode mode)
void Unit::RemoveAura(Aura* aura, AuraRemoveFlags mode)
{
if (aura->IsRemoved())
return;
@@ -3963,7 +3964,7 @@ void Unit::RemoveAurasByType(AuraType auraType, std::function<bool(AuraApplicati
}
}
void Unit::RemoveAurasDueToSpell(uint32 spellId, ObjectGuid casterGUID, uint8 reqEffMask, AuraRemoveMode removeMode)
void Unit::RemoveAurasDueToSpell(uint32 spellId, ObjectGuid casterGUID, uint8 reqEffMask, AuraRemoveFlags removeMode)
{
for (AuraApplicationMap::iterator iter = m_appliedAuras.lower_bound(spellId); iter != m_appliedAuras.upper_bound(spellId);)
{
@@ -3979,7 +3980,7 @@ void Unit::RemoveAurasDueToSpell(uint32 spellId, ObjectGuid casterGUID, uint8 re
}
}
void Unit::RemoveAuraFromStack(uint32 spellId, ObjectGuid casterGUID, AuraRemoveMode removeMode)
void Unit::RemoveAuraFromStack(uint32 spellId, ObjectGuid casterGUID, AuraRemoveFlags removeMode)
{
AuraMapBoundsNonConst range = m_ownedAuras.equal_range(spellId);
for (AuraMap::iterator iter = range.first; iter != range.second;)
@@ -4010,9 +4011,9 @@ void Unit::RemoveAurasDueToSpellByDispel(uint32 spellId, uint32 dispellerSpellId
aura->CallScriptDispel(&dispelInfo);
if (aura->GetSpellInfo()->HasAttribute(SPELL_ATTR7_DISPEL_CHARGES))
aura->ModCharges(-dispelInfo.GetRemovedCharges(), AURA_REMOVE_BY_ENEMY_SPELL);
aura->ModCharges(-dispelInfo.GetRemovedCharges(), AuraRemoveFlags::ByEnemySpell);
else
aura->ModStackAmount(-dispelInfo.GetRemovedCharges(), AURA_REMOVE_BY_ENEMY_SPELL);
aura->ModStackAmount(-dispelInfo.GetRemovedCharges(), AuraRemoveFlags::ByEnemySpell);
// Call AfterDispel hook on AuraScript
aura->CallScriptAfterDispel(&dispelInfo);
@@ -4089,9 +4090,9 @@ void Unit::RemoveAurasDueToSpellBySteal(uint32 spellId, ObjectGuid casterGUID, U
}
if (stealCharge)
aura->ModCharges(-1, AURA_REMOVE_BY_ENEMY_SPELL);
aura->ModCharges(-1, AuraRemoveFlags::ByEnemySpell);
else
aura->ModStackAmount(-1, AURA_REMOVE_BY_ENEMY_SPELL);
aura->ModStackAmount(-1, AuraRemoveFlags::ByEnemySpell);
return;
}
@@ -4197,7 +4198,7 @@ void Unit::RemoveNotOwnLimitedTargetAuras(bool onPhaseChange /*= false*/)
}
}
void Unit::RemoveAurasWithInterruptFlags(uint32 flag, uint32 except)
void Unit::RemoveAurasWithInterruptFlags(uint32 flag, uint32 except, Spell* interruptingSpell /* = nullptr */)
{
if (!(m_interruptMask & flag))
return;
@@ -4223,7 +4224,7 @@ void Unit::RemoveAurasWithInterruptFlags(uint32 flag, uint32 except)
&& (spell->m_spellInfo->ChannelInterruptFlags & flag)
&& spell->m_spellInfo->Id != except
&& !(flag & AURA_INTERRUPT_FLAG_MOVE && HasAuraTypeWithAffectMask(SPELL_AURA_CAST_WHILE_WALKING, spell->GetSpellInfo())))
InterruptNonMeleeSpells(false);
InterruptNonMeleeSpells(false, 0, true, interruptingSpell);
UpdateInterruptMask();
}
@@ -4251,7 +4252,7 @@ void Unit::RemoveMovementImpairingAuras()
RemoveAurasWithMechanic((1<<MECHANIC_SNARE)|(1<<MECHANIC_ROOT));
}
void Unit::RemoveAurasWithMechanic(uint32 mechanic_mask, AuraRemoveMode removemode, uint32 except)
void Unit::RemoveAurasWithMechanic(uint32 mechanic_mask, AuraRemoveFlags removemode, uint32 except)
{
for (AuraApplicationMap::iterator iter = m_appliedAuras.begin(); iter != m_appliedAuras.end();)
{
@@ -4309,7 +4310,7 @@ void Unit::RemoveAllAuras()
{
AuraApplicationMap::iterator aurAppIter;
for (aurAppIter = m_appliedAuras.begin(); aurAppIter != m_appliedAuras.end();)
_UnapplyAura(aurAppIter, AURA_REMOVE_BY_DEFAULT);
_UnapplyAura(aurAppIter, AuraRemoveFlags::ByDefault);
AuraMap::iterator aurIter;
for (aurIter = m_ownedAuras.begin(); aurIter != m_ownedAuras.end();)
@@ -4349,7 +4350,7 @@ void Unit::RemoveAllAurasOnDeath()
{
Aura const* aura = iter->second->GetBase();
if (!aura->IsPassive() && !aura->IsDeathPersistent())
_UnapplyAura(iter, AURA_REMOVE_BY_DEATH);
_UnapplyAura(iter, AuraRemoveFlags::ByDeath);
else
++iter;
}
@@ -4358,7 +4359,7 @@ void Unit::RemoveAllAurasOnDeath()
{
Aura* aura = iter->second;
if (!aura->IsPassive() && !aura->IsDeathPersistent())
RemoveOwnedAura(iter, AURA_REMOVE_BY_DEATH);
RemoveOwnedAura(iter, AuraRemoveFlags::ByDeath);
else
++iter;
}
@@ -4370,7 +4371,7 @@ void Unit::RemoveAllAurasRequiringDeadTarget()
{
Aura const* aura = iter->second->GetBase();
if (!aura->IsPassive() && aura->GetSpellInfo()->IsRequiringDeadTarget())
_UnapplyAura(iter, AURA_REMOVE_BY_DEFAULT);
_UnapplyAura(iter, AuraRemoveFlags::ByDefault);
else
++iter;
}
@@ -4379,7 +4380,7 @@ void Unit::RemoveAllAurasRequiringDeadTarget()
{
Aura* aura = iter->second;
if (!aura->IsPassive() && aura->GetSpellInfo()->IsRequiringDeadTarget())
RemoveOwnedAura(iter, AURA_REMOVE_BY_DEFAULT);
RemoveOwnedAura(iter, AuraRemoveFlags::ByDefault);
else
++iter;
}
@@ -4393,7 +4394,7 @@ void Unit::RemoveAllAurasExceptType(AuraType type)
if (aura->GetSpellInfo()->HasAura(type))
++iter;
else
_UnapplyAura(iter, AURA_REMOVE_BY_DEFAULT);
_UnapplyAura(iter, AuraRemoveFlags::ByDefault);
}
for (AuraMap::iterator iter = m_ownedAuras.begin(); iter != m_ownedAuras.end();)
@@ -4402,7 +4403,7 @@ void Unit::RemoveAllAurasExceptType(AuraType type)
if (aura->GetSpellInfo()->HasAura(type))
++iter;
else
RemoveOwnedAura(iter, AURA_REMOVE_BY_DEFAULT);
RemoveOwnedAura(iter, AuraRemoveFlags::ByDefault);
}
}
@@ -4414,7 +4415,7 @@ void Unit::RemoveAllAurasExceptType(AuraType type1, AuraType type2)
if (aura->GetSpellInfo()->HasAura(type1) || aura->GetSpellInfo()->HasAura(type2))
++iter;
else
_UnapplyAura(iter, AURA_REMOVE_BY_DEFAULT);
_UnapplyAura(iter, AuraRemoveFlags::ByDefault);
}
for (AuraMap::iterator iter = m_ownedAuras.begin(); iter != m_ownedAuras.end();)
@@ -4423,7 +4424,7 @@ void Unit::RemoveAllAurasExceptType(AuraType type1, AuraType type2)
if (aura->GetSpellInfo()->HasAura(type1) || aura->GetSpellInfo()->HasAura(type2))
++iter;
else
RemoveOwnedAura(iter, AURA_REMOVE_BY_DEFAULT);
RemoveOwnedAura(iter, AuraRemoveFlags::ByDefault);
}
}
@@ -6430,10 +6431,10 @@ Unit* Unit::GetMagicHitRedirectTarget(Unit* victim, SpellInfo const* spellInfo)
// Set up missile speed based delay
uint32 delay = uint32(std::floor(std::max<float>(victim->GetDistance(this), 5.0f) / spellInfo->Speed * 1000.0f));
// Schedule charge drop
(*itr)->GetBase()->DropChargeDelayed(delay, AURA_REMOVE_BY_EXPIRE);
(*itr)->GetBase()->DropChargeDelayed(delay, AuraRemoveFlags::Expired);
}
else
(*itr)->GetBase()->DropCharge(AURA_REMOVE_BY_EXPIRE);
(*itr)->GetBase()->DropCharge(AuraRemoveFlags::Expired);
return magnet;
}
@@ -6452,7 +6453,7 @@ Unit* Unit::GetMeleeHitRedirectTarget(Unit* victim, SpellInfo const* spellInfo)
&& spellInfo->CheckTarget(this, magnet, false) == SPELL_CAST_OK)))
if (roll_chance_i((*i)->GetAmount()))
{
(*i)->GetBase()->DropCharge(AURA_REMOVE_BY_EXPIRE);
(*i)->GetBase()->DropCharge(AuraRemoveFlags::Expired);
return magnet;
}
}
@@ -9521,23 +9522,6 @@ int32 Unit::CalculateSpellDamage(Unit const* target, SpellInfo const* spellProto
return spellProto->Effects[effect_index].CalcValue(this, basePoints, target);
}
int32 Unit::CalcSpellDuration(SpellInfo const* spellProto)
{
uint8 comboPoints = m_playerMovingMe ? m_playerMovingMe->GetComboPoints() : 0;
int32 minduration = spellProto->GetDuration();
int32 maxduration = spellProto->GetMaxDuration();
int32 duration;
if (comboPoints && minduration != -1 && minduration != maxduration)
duration = minduration + int32((maxduration - minduration) * comboPoints / 5);
else
duration = minduration;
return duration;
}
int32 Unit::ModSpellDuration(SpellInfo const* spellProto, Unit const* target, int32 duration, bool positive, uint32 effectMask)
{
// don't mod permanent auras duration
@@ -11046,7 +11030,7 @@ void Unit::TriggerAurasProcOnEvent(ProcEventInfo& eventInfo, AuraApplicationProc
uint8 procEffectMask;
std::tie(procEffectMask, aurApp) = aurAppProc;
if (aurApp->GetRemoveMode())
if (aurApp->GetRemoveMode().HasAnyFlag())
continue;
SpellInfo const* spellInfo = aurApp->GetBase()->GetSpellInfo();
@@ -12298,7 +12282,7 @@ bool Unit::SetCharmedBy(Unit* charmer, CharmType type, AuraApplication const* au
// charm is set by aura, and aura effect remove handler was called during apply handler execution
// prevent undefined behaviour
if (aurApp && aurApp->GetRemoveMode())
if (aurApp && aurApp->GetRemoveMode().HasAnyFlag())
return false;
_oldFactionId = GetFaction();
@@ -12333,7 +12317,7 @@ bool Unit::SetCharmedBy(Unit* charmer, CharmType type, AuraApplication const* au
// charm is set by aura, and aura effect remove handler was called during apply handler execution
// prevent undefined behaviour
if (aurApp && aurApp->GetRemoveMode())
if (aurApp && aurApp->GetRemoveMode().HasAnyFlag())
return false;
// Pets already have a properly initialized CharmInfo, don't overwrite it.
@@ -13513,7 +13497,7 @@ void Unit::_EnterVehicle(Vehicle* vehicle, int8 seatId, AuraApplication const* a
}
}
if (aurApp->GetRemoveMode())
if (aurApp->GetRemoveMode().HasAnyFlag())
return;
if (Player* player = ToPlayer())