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:
1 parent
6498452dd1
commit
0af44ccc01
72 files changed
+597
-499
No files matched your search
@@ -1,82 +0,0 @@
|
||||
/*
|
||||
* This file is part of the TrinityCore Project. See AUTHORS file for Copyright information
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by the
|
||||
* Free Software Foundation; either version 2 of the License, or (at your
|
||||
* option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
* more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along
|
||||
* with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef EnumClassFlag_h__
|
||||
#define EnumClassFlag_h__
|
||||
|
||||
#include <type_traits>
|
||||
|
||||
template<typename T>
|
||||
class EnumClassFlag
|
||||
{
|
||||
static_assert(std::is_enum<T>::value, "EnumClassFlag must be used only with enums");
|
||||
|
||||
public:
|
||||
/*implicit*/ EnumClassFlag(T value) : _value(value) { }
|
||||
|
||||
EnumClassFlag& operator&=(EnumClassFlag right)
|
||||
{
|
||||
_value = static_cast<T>(static_cast<std::underlying_type_t<T>>(_value) & static_cast<std::underlying_type_t<T>>(right._value));
|
||||
return *this;
|
||||
}
|
||||
|
||||
friend EnumClassFlag operator&(EnumClassFlag left, EnumClassFlag right)
|
||||
{
|
||||
return left &= right;
|
||||
}
|
||||
|
||||
EnumClassFlag operator|=(EnumClassFlag right)
|
||||
{
|
||||
_value = static_cast<T>(static_cast<std::underlying_type_t<T>>(_value) | static_cast<std::underlying_type_t<T>>(right._value));
|
||||
return *this;
|
||||
}
|
||||
|
||||
friend EnumClassFlag operator|(EnumClassFlag left, EnumClassFlag right)
|
||||
{
|
||||
return left |= right;
|
||||
}
|
||||
|
||||
EnumClassFlag operator~() const
|
||||
{
|
||||
return static_cast<T>(~static_cast<std::underlying_type_t<T>>(_value));
|
||||
}
|
||||
|
||||
void RemoveFlag(EnumClassFlag flag)
|
||||
{
|
||||
_value = static_cast<T>(static_cast<std::underlying_type_t<T>>(_value) & ~static_cast<std::underlying_type_t<T>>(flag._value));
|
||||
}
|
||||
|
||||
bool HasFlag(T flag) const
|
||||
{
|
||||
return (static_cast<std::underlying_type_t<T>>(_value) & static_cast<std::underlying_type_t<T>>(flag)) != 0;
|
||||
}
|
||||
|
||||
operator T() const
|
||||
{
|
||||
return _value;
|
||||
}
|
||||
|
||||
std::underlying_type_t<T> AsUnderlyingType() const
|
||||
{
|
||||
return static_cast<std::underlying_type_t<T>>(_value);
|
||||
}
|
||||
|
||||
private:
|
||||
T _value;
|
||||
};
|
||||
|
||||
#endif // EnumClassFlag_h__
|
||||
@@ -0,0 +1,138 @@
|
||||
/*
|
||||
* This file is part of the TrinityCore Project. See AUTHORS file for Copyright information
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by the
|
||||
* Free Software Foundation; either version 2 of the License, or (at your
|
||||
* option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
* more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along
|
||||
* with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef EnumFlag_h__
|
||||
#define EnumFlag_h__
|
||||
|
||||
#include <type_traits>
|
||||
|
||||
template<typename T>
|
||||
constexpr bool IsEnumFlag(T) { return false; }
|
||||
|
||||
#define DEFINE_ENUM_FLAG(enumType) constexpr bool IsEnumFlag(enumType) { return true; }
|
||||
|
||||
namespace EnumTraits
|
||||
{
|
||||
template<typename T>
|
||||
using IsFlag = std::integral_constant<bool, IsEnumFlag(T{}) > ;
|
||||
}
|
||||
|
||||
template<typename T, std::enable_if_t<EnumTraits::IsFlag<T>::value, std::nullptr_t> = nullptr>
|
||||
inline constexpr T operator&(T left, T right)
|
||||
{
|
||||
return static_cast<T>(static_cast<std::underlying_type_t<T>>(left) & static_cast<std::underlying_type_t<T>>(right));
|
||||
}
|
||||
|
||||
template<typename T, std::enable_if_t<EnumTraits::IsFlag<T>::value, std::nullptr_t> = nullptr>
|
||||
inline constexpr T& operator&=(T& left, T right)
|
||||
{
|
||||
return left = left & right;
|
||||
}
|
||||
|
||||
template<typename T, std::enable_if_t<EnumTraits::IsFlag<T>::value, std::nullptr_t> = nullptr>
|
||||
inline constexpr T operator|(T left, T right)
|
||||
{
|
||||
return static_cast<T>(static_cast<std::underlying_type_t<T>>(left) | static_cast<std::underlying_type_t<T>>(right));
|
||||
}
|
||||
|
||||
template<typename T, std::enable_if_t<EnumTraits::IsFlag<T>::value, std::nullptr_t> = nullptr>
|
||||
inline constexpr T& operator|=(T& left, T right)
|
||||
{
|
||||
return left = left | right;
|
||||
}
|
||||
|
||||
template<typename T, std::enable_if_t<EnumTraits::IsFlag<T>::value, std::nullptr_t> = nullptr>
|
||||
inline constexpr T operator~(T value)
|
||||
{
|
||||
return static_cast<T>(~static_cast<std::underlying_type_t<T>>(value));
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
class EnumFlag
|
||||
{
|
||||
|
||||
static_assert(EnumTraits::IsFlag<T>::value, "EnumFlag must be used only with enums that are specify EnumFlag::IsFlag");
|
||||
|
||||
public:
|
||||
using underlying_type = std::underlying_type_t<T>;
|
||||
|
||||
/*implicit*/ constexpr EnumFlag(T value) : _value(value)
|
||||
{
|
||||
}
|
||||
|
||||
constexpr EnumFlag& operator&=(EnumFlag right)
|
||||
{
|
||||
_value &= right._value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
constexpr friend EnumFlag operator&(EnumFlag left, EnumFlag right)
|
||||
{
|
||||
return left &= right;
|
||||
}
|
||||
|
||||
constexpr EnumFlag& operator|=(EnumFlag right)
|
||||
{
|
||||
_value |= right._value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
constexpr friend EnumFlag operator|(EnumFlag left, EnumFlag right)
|
||||
{
|
||||
return left |= right;
|
||||
}
|
||||
|
||||
constexpr EnumFlag operator~() const
|
||||
{
|
||||
return static_cast<T>(~static_cast<std::underlying_type_t<T>>(_value));
|
||||
}
|
||||
|
||||
constexpr void RemoveFlag(EnumFlag flag)
|
||||
{
|
||||
_value &= ~flag._value;
|
||||
}
|
||||
|
||||
constexpr bool HasFlag(T flag) const
|
||||
{
|
||||
return static_cast<underlying_type>(_value & flag) != static_cast<underlying_type>(0);
|
||||
}
|
||||
|
||||
constexpr bool HasAllFlags(T flags) const
|
||||
{
|
||||
return (_value & flags) == flags;
|
||||
}
|
||||
|
||||
constexpr bool HasAnyFlag() const
|
||||
{
|
||||
return static_cast<underlying_type>(_value) != underlying_type{};
|
||||
}
|
||||
|
||||
constexpr operator T() const
|
||||
{
|
||||
return _value;
|
||||
}
|
||||
|
||||
constexpr underlying_type AsUnderlyingType() const
|
||||
{
|
||||
return static_cast<underlying_type>(_value);
|
||||
}
|
||||
|
||||
private:
|
||||
T _value;
|
||||
};
|
||||
|
||||
#endif // EnumFlag_h__
|
||||
@@ -691,7 +691,7 @@ void PlayerAI::CancelAllShapeshifts()
|
||||
}
|
||||
|
||||
for (Aura* aura : removableShapeshifts)
|
||||
me->RemoveOwnedAura(aura, AURA_REMOVE_BY_CANCEL);
|
||||
me->RemoveOwnedAura(aura, AuraRemoveFlags::ByCancel);
|
||||
}
|
||||
|
||||
Unit* PlayerAI::SelectAttackTarget() const
|
||||
|
||||
@@ -886,7 +886,7 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u
|
||||
if (e.action.removeAura.charges)
|
||||
{
|
||||
if (Aura* aur = target->ToUnit()->GetAura(e.action.removeAura.spell))
|
||||
aur->ModCharges(-static_cast<int32>(e.action.removeAura.charges), AURA_REMOVE_BY_EXPIRE);
|
||||
aur->ModCharges(-static_cast<int32>(e.action.removeAura.charges), AuraRemoveFlags::Expired);
|
||||
}
|
||||
else
|
||||
target->ToUnit()->RemoveAurasDueToSpell(e.action.removeAura.spell);
|
||||
|
||||
@@ -252,7 +252,7 @@ void DynamicObject::RemoveAura()
|
||||
_removedAura = _aura;
|
||||
_aura = nullptr;
|
||||
if (!_removedAura->IsRemoved())
|
||||
_removedAura->_Remove(AURA_REMOVE_BY_DEFAULT);
|
||||
_removedAura->_Remove(AuraRemoveFlags::ByDefault);
|
||||
}
|
||||
|
||||
void DynamicObject::SetCasterViewpoint()
|
||||
|
||||
@@ -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())
|
||||
|
||||
@@ -330,7 +330,7 @@ enum TriggerCastFlags : uint32
|
||||
TRIGGERED_IGNORE_BLOCKED_SPELL_FAMILY = 0x00004000, //! Will ignore blocked casts of SPELL_AURA_BLOCK_SPELL_FAMILY
|
||||
// reuse = 0x00008000,
|
||||
TRIGGERED_IGNORE_CASTER_AURAS = 0x00010000, //! Will ignore caster aura restrictions or requirements
|
||||
TRIGGERED_DONT_RESET_PERIODIC_TIMER = 0x00020000, //! Will allow periodic aura timers to keep ticking (instead of resetting)
|
||||
// reuse = 0x00020000,
|
||||
TRIGGERED_DONT_REPORT_CAST_ERROR = 0x00040000, //! Will return SPELL_FAILED_DONT_REPORT in CheckCast functions
|
||||
TRIGGERED_FULL_MASK = 0x0007FFFF, //! Used when doing CastSpell with triggered == true
|
||||
|
||||
@@ -1450,13 +1450,13 @@ class TC_GAME_API Unit : public WorldObject
|
||||
bool InitTamedPet(Pet* pet, uint8 level, uint32 spell_id);
|
||||
|
||||
// aura apply/remove helpers - you should better not use these
|
||||
Aura* _TryStackingOrRefreshingExistingAura(SpellInfo const* newAura, uint8 effMask, Unit* caster, int32* baseAmount = nullptr, Item* castItem = nullptr, ObjectGuid casterGUID = ObjectGuid::Empty, bool resetPeriodicTimer = true);
|
||||
Aura* _TryStackingOrRefreshingExistingAura(SpellInfo const* newAura, uint8 effMask, Unit* caster, int32* baseAmount = nullptr, Item* castItem = nullptr, ObjectGuid casterGUID = ObjectGuid::Empty);
|
||||
void _AddAura(UnitAura* aura, Unit* caster);
|
||||
AuraApplication * _CreateAuraApplication(Aura* aura, uint8 effMask);
|
||||
void _ApplyAuraEffect(Aura* aura, uint8 effIndex);
|
||||
void _ApplyAura(AuraApplication * aurApp, uint8 effMask);
|
||||
void _UnapplyAura(AuraApplicationMap::iterator &i, AuraRemoveMode removeMode);
|
||||
void _UnapplyAura(AuraApplication * aurApp, AuraRemoveMode removeMode);
|
||||
void _UnapplyAura(AuraApplicationMap::iterator &i, AuraRemoveFlags removeMode);
|
||||
void _UnapplyAura(AuraApplication * aurApp, AuraRemoveFlags removeMode);
|
||||
void _RemoveNoStackAurasDueToAura(Aura* aura);
|
||||
void _RegisterAuraEffect(AuraEffect* aurEff, bool apply);
|
||||
|
||||
@@ -1464,9 +1464,9 @@ class TC_GAME_API Unit : public WorldObject
|
||||
AuraMap & GetOwnedAuras() { return m_ownedAuras; }
|
||||
AuraMap const& GetOwnedAuras() const { return m_ownedAuras; }
|
||||
|
||||
void RemoveOwnedAura(AuraMap::iterator &i, AuraRemoveMode removeMode = AURA_REMOVE_BY_DEFAULT);
|
||||
void RemoveOwnedAura(uint32 spellId, ObjectGuid casterGUID = ObjectGuid::Empty, uint8 reqEffMask = 0, AuraRemoveMode removeMode = AURA_REMOVE_BY_DEFAULT);
|
||||
void RemoveOwnedAura(Aura* aura, AuraRemoveMode removeMode = AURA_REMOVE_BY_DEFAULT);
|
||||
void RemoveOwnedAura(AuraMap::iterator &i, AuraRemoveFlags removeMode = AuraRemoveFlags::ByDefault);
|
||||
void RemoveOwnedAura(uint32 spellId, ObjectGuid casterGUID = ObjectGuid::Empty, uint8 reqEffMask = 0, AuraRemoveFlags removeMode = AuraRemoveFlags::ByDefault);
|
||||
void RemoveOwnedAura(Aura* aura, AuraRemoveFlags removeMode = AuraRemoveFlags::ByDefault);
|
||||
|
||||
Aura* GetOwnedAura(uint32 spellId, ObjectGuid casterGUID = ObjectGuid::Empty, ObjectGuid itemCasterGUID = ObjectGuid::Empty, uint8 reqEffMask = 0, Aura* except = nullptr) const;
|
||||
|
||||
@@ -1474,10 +1474,10 @@ class TC_GAME_API Unit : public WorldObject
|
||||
AuraApplicationMap & GetAppliedAuras() { return m_appliedAuras; }
|
||||
AuraApplicationMap const& GetAppliedAuras() const { return m_appliedAuras; }
|
||||
|
||||
void RemoveAura(AuraApplicationMap::iterator &i, AuraRemoveMode mode = AURA_REMOVE_BY_DEFAULT);
|
||||
void RemoveAura(uint32 spellId, ObjectGuid casterGUID = ObjectGuid::Empty, uint8 reqEffMask = 0, AuraRemoveMode removeMode = AURA_REMOVE_BY_DEFAULT);
|
||||
void RemoveAura(AuraApplication * aurApp, AuraRemoveMode mode = AURA_REMOVE_BY_DEFAULT);
|
||||
void RemoveAura(Aura* aur, AuraRemoveMode mode = AURA_REMOVE_BY_DEFAULT);
|
||||
void RemoveAura(AuraApplicationMap::iterator &i, AuraRemoveFlags mode = AuraRemoveFlags::ByDefault);
|
||||
void RemoveAura(uint32 spellId, ObjectGuid casterGUID = ObjectGuid::Empty, uint8 reqEffMask = 0, AuraRemoveFlags removeMode = AuraRemoveFlags::ByDefault);
|
||||
void RemoveAura(AuraApplication * aurApp, AuraRemoveFlags mode = AuraRemoveFlags::ByDefault);
|
||||
void RemoveAura(Aura* aur, AuraRemoveFlags mode = AuraRemoveFlags::ByDefault);
|
||||
|
||||
// Convenience methods removing auras by predicate
|
||||
void RemoveAppliedAuras(std::function<bool(AuraApplication const*)> const& check);
|
||||
@@ -1489,17 +1489,17 @@ class TC_GAME_API Unit : public WorldObject
|
||||
|
||||
void RemoveAurasByType(AuraType auraType, std::function<bool(AuraApplication const*)> const& check);
|
||||
|
||||
void RemoveAurasDueToSpell(uint32 spellId, ObjectGuid casterGUID = ObjectGuid::Empty, uint8 reqEffMask = 0, AuraRemoveMode removeMode = AURA_REMOVE_BY_DEFAULT);
|
||||
void RemoveAuraFromStack(uint32 spellId, ObjectGuid casterGUID = ObjectGuid::Empty, AuraRemoveMode removeMode = AURA_REMOVE_BY_DEFAULT);
|
||||
void RemoveAurasDueToSpell(uint32 spellId, ObjectGuid casterGUID = ObjectGuid::Empty, uint8 reqEffMask = 0, AuraRemoveFlags removeMode = AuraRemoveFlags::ByDefault);
|
||||
void RemoveAuraFromStack(uint32 spellId, ObjectGuid casterGUID = ObjectGuid::Empty, AuraRemoveFlags removeMode = AuraRemoveFlags::ByDefault);
|
||||
void RemoveAurasDueToSpellByDispel(uint32 spellId, uint32 dispellerSpellId, ObjectGuid casterGUID, Unit* dispeller, uint8 chargesRemoved = 1);
|
||||
void RemoveAurasDueToSpellBySteal(uint32 spellId, ObjectGuid casterGUID, Unit* stealer);
|
||||
void RemoveAurasDueToItemSpell(uint32 spellId, ObjectGuid castItemGuid);
|
||||
void RemoveAurasByType(AuraType auraType, ObjectGuid casterGUID = ObjectGuid::Empty, Aura* except = nullptr, bool negative = true, bool positive = true);
|
||||
void RemoveNotOwnLimitedTargetAuras(bool onPhaseChange = false);
|
||||
void RemoveAurasWithInterruptFlags(uint32 flag, uint32 except = 0);
|
||||
void RemoveAurasWithInterruptFlags(uint32 flag, uint32 except = 0, Spell* interruptingSpell = nullptr);
|
||||
void RemoveAurasWithAttribute(uint32 flags);
|
||||
void RemoveAurasWithFamily(SpellFamilyNames family, uint32 familyFlag1, uint32 familyFlag2, uint32 familyFlag3, ObjectGuid casterGUID);
|
||||
void RemoveAurasWithMechanic(uint32 mechanic_mask, AuraRemoveMode removemode = AURA_REMOVE_BY_DEFAULT, uint32 except = 0);
|
||||
void RemoveAurasWithMechanic(uint32 mechanic_mask, AuraRemoveFlags removemode = AuraRemoveFlags::ByDefault, uint32 except = 0);
|
||||
void RemoveMovementImpairingAuras();
|
||||
|
||||
void RemoveAreaAurasDueToLeaveWorld();
|
||||
@@ -1596,7 +1596,7 @@ class TC_GAME_API Unit : public WorldObject
|
||||
void SetChannelObjectGuid(ObjectGuid guid) { SetGuidValue(UNIT_FIELD_CHANNEL_OBJECT, guid); }
|
||||
|
||||
void SetCurrentCastSpell(Spell* pSpell);
|
||||
void InterruptSpell(CurrentSpellTypes spellType, bool withDelayed = true, bool withInstant = true);
|
||||
void InterruptSpell(CurrentSpellTypes spellType, bool withDelayed = true, bool withInstant = true, Spell* interruptingSpell = nullptr);
|
||||
void FinishSpell(CurrentSpellTypes spellType, bool ok = true);
|
||||
|
||||
// set withDelayed to true to account delayed spells as cast
|
||||
@@ -1606,7 +1606,7 @@ class TC_GAME_API Unit : public WorldObject
|
||||
|
||||
// set withDelayed to true to interrupt delayed spells too
|
||||
// delayed+channeled spells are always interrupted
|
||||
void InterruptNonMeleeSpells(bool withDelayed, uint32 spellid = 0, bool withInstant = true);
|
||||
void InterruptNonMeleeSpells(bool withDelayed, uint32 spellid = 0, bool withInstant = true, Spell* interruptingSpell = nullptr);
|
||||
|
||||
Spell* GetCurrentSpell(CurrentSpellTypes spellType) const { return m_currentSpells[spellType]; }
|
||||
Spell* GetCurrentSpell(uint32 spellType) const { return m_currentSpells[spellType]; }
|
||||
@@ -1788,7 +1788,6 @@ class TC_GAME_API Unit : public WorldObject
|
||||
|
||||
float ApplyEffectModifiers(SpellInfo const* spellProto, uint8 effect_index, float value) const;
|
||||
int32 CalculateSpellDamage(Unit const* target, SpellInfo const* spellProto, uint8 effect_index, int32 const* basePoints = nullptr) const;
|
||||
int32 CalcSpellDuration(SpellInfo const* spellProto);
|
||||
int32 ModSpellDuration(SpellInfo const* spellProto, Unit const* target, int32 duration, bool positive, uint32 effectMask);
|
||||
void ModSpellCastTime(SpellInfo const* spellProto, int32& castTime, Spell* spell = nullptr);
|
||||
void ModSpellDurationTime(SpellInfo const* spellProto, int32& castTime, Spell* spell = nullptr);
|
||||
|
||||
@@ -831,7 +831,7 @@ bool VehicleJoinEvent::Execute(uint64, uint32)
|
||||
ASSERT(itr != vehicleAuras.end());
|
||||
|
||||
AuraApplication const* aurApp = (*itr)->GetBase()->GetApplicationOfTarget(Target->GetBase()->GetGUID());
|
||||
ASSERT(aurApp && !aurApp->GetRemoveMode());
|
||||
ASSERT(aurApp && !aurApp->GetRemoveMode().HasAnyFlag());
|
||||
|
||||
Target->RemovePendingEventsForSeat(Seat->first);
|
||||
Target->RemovePendingEventsForPassenger(Passenger);
|
||||
|
||||
@@ -511,7 +511,7 @@ void WorldSession::HandleCancelAuraOpcode(WorldPacket& recvPacket)
|
||||
return;
|
||||
|
||||
// maybe should only remove one buff when there are multiple?
|
||||
_player->RemoveOwnedAura(spellId, ObjectGuid::Empty, 0, AURA_REMOVE_BY_CANCEL);
|
||||
_player->RemoveOwnedAura(spellId, ObjectGuid::Empty, 0, AuraRemoveFlags::ByCancel);
|
||||
|
||||
// If spell being removed is a resource tracker, see if player was tracking both (herbs / minerals) and remove the other
|
||||
if (sWorld->getBoolConfig(CONFIG_ALLOW_TRACK_BOTH_RESOURCES) && spellInfo->HasAura(SPELL_AURA_TRACK_RESOURCES))
|
||||
@@ -528,7 +528,7 @@ void WorldSession::HandleCancelAuraOpcode(WorldPacket& recvPacket)
|
||||
|
||||
// Remove all auras related to resource tracking (only Herbs and Minerals in 3.3.5a)
|
||||
for (std::list<uint32>::iterator it = spellIDs.begin(); it != spellIDs.end(); ++it)
|
||||
_player->RemoveOwnedAura(*it, ObjectGuid::Empty, 0, AURA_REMOVE_BY_CANCEL);
|
||||
_player->RemoveOwnedAura(*it, ObjectGuid::Empty, 0, AuraRemoveFlags::ByCancel);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -567,7 +567,7 @@ void WorldSession::HandlePetCancelAuraOpcode(WorldPacket& recvPacket)
|
||||
return;
|
||||
}
|
||||
|
||||
pet->RemoveOwnedAura(spellId, ObjectGuid::Empty, 0, AURA_REMOVE_BY_CANCEL);
|
||||
pet->RemoveOwnedAura(spellId, ObjectGuid::Empty, 0, AuraRemoveFlags::ByCancel);
|
||||
}
|
||||
|
||||
void WorldSession::HandleCancelGrowthAuraOpcode(WorldPacket& /*recvPacket*/) { }
|
||||
|
||||
@@ -89,7 +89,7 @@ void PhaseShift::Clear()
|
||||
|
||||
void PhaseShift::ClearPhases()
|
||||
{
|
||||
Flags &= EnumClassFlag<PhaseShiftFlags>(PhaseShiftFlags::AlwaysVisible) | PhaseShiftFlags::Inverse;
|
||||
Flags &= EnumFlag<PhaseShiftFlags>(PhaseShiftFlags::AlwaysVisible) | PhaseShiftFlags::Inverse;
|
||||
Phases.clear();
|
||||
NonCosmeticReferences = 0;
|
||||
CosmeticReferences = 0;
|
||||
@@ -161,7 +161,7 @@ void PhaseShift::ModifyPhasesReferences(PhaseContainer::iterator itr, int32 refe
|
||||
if (CosmeticReferences)
|
||||
Flags |= PhaseShiftFlags::NoCosmetic;
|
||||
else
|
||||
Flags &= ~EnumClassFlag<PhaseShiftFlags>(PhaseShiftFlags::NoCosmetic);
|
||||
Flags &= ~EnumFlag<PhaseShiftFlags>(PhaseShiftFlags::NoCosmetic);
|
||||
|
||||
UpdateUnphasedFlag();
|
||||
}
|
||||
@@ -169,8 +169,8 @@ void PhaseShift::ModifyPhasesReferences(PhaseContainer::iterator itr, int32 refe
|
||||
|
||||
void PhaseShift::UpdateUnphasedFlag()
|
||||
{
|
||||
EnumClassFlag<PhaseShiftFlags> unphasedFlag = !Flags.HasFlag(PhaseShiftFlags::Inverse) ? PhaseShiftFlags::Unphased : PhaseShiftFlags::InverseUnphased;
|
||||
Flags &= ~EnumClassFlag<PhaseShiftFlags>(!Flags.HasFlag(PhaseShiftFlags::Inverse) ? PhaseShiftFlags::InverseUnphased : PhaseShiftFlags::Unphased);
|
||||
EnumFlag<PhaseShiftFlags> unphasedFlag = !Flags.HasFlag(PhaseShiftFlags::Inverse) ? PhaseShiftFlags::Unphased : PhaseShiftFlags::InverseUnphased;
|
||||
Flags &= ~EnumFlag<PhaseShiftFlags>(!Flags.HasFlag(PhaseShiftFlags::Inverse) ? PhaseShiftFlags::InverseUnphased : PhaseShiftFlags::Unphased);
|
||||
if (NonCosmeticReferences && !DefaultReferences)
|
||||
Flags &= ~unphasedFlag;
|
||||
else
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
#define PhaseShift_h__
|
||||
|
||||
#include "Define.h"
|
||||
#include "EnumClassFlag.h"
|
||||
#include "EnumFlag.h"
|
||||
#include "ObjectGuid.h"
|
||||
#include <boost/container/flat_set.hpp>
|
||||
#include <map>
|
||||
@@ -48,6 +48,9 @@ enum class PhaseFlags : uint16
|
||||
Personal = 0x2
|
||||
};
|
||||
|
||||
DEFINE_ENUM_FLAG(PhaseShiftFlags);
|
||||
DEFINE_ENUM_FLAG(PhaseFlags);
|
||||
|
||||
class TC_GAME_API PhaseShift
|
||||
{
|
||||
public:
|
||||
@@ -57,7 +60,7 @@ public:
|
||||
: Id(id), Flags(flags), References(0), AreaConditions(conditions) { }
|
||||
|
||||
uint16 Id;
|
||||
EnumClassFlag<PhaseFlags> Flags;
|
||||
EnumFlag<PhaseFlags> Flags;
|
||||
int32 References;
|
||||
std::vector<Condition*> const* AreaConditions;
|
||||
bool operator<(PhaseRef const& right) const { return Id < right.Id; }
|
||||
@@ -107,7 +110,7 @@ public:
|
||||
protected:
|
||||
friend class PhasingHandler;
|
||||
|
||||
EnumClassFlag<PhaseShiftFlags> Flags;
|
||||
EnumFlag<PhaseShiftFlags> Flags;
|
||||
ObjectGuid PersonalGuid;
|
||||
PhaseContainer Phases;
|
||||
VisibleMapIdContainer VisibleMapIds;
|
||||
|
||||
@@ -434,7 +434,7 @@ void PhasingHandler::InitDbPhaseShift(PhaseShift& phaseShift, uint8 phaseUseFlag
|
||||
phaseShift.ClearPhases();
|
||||
phaseShift.IsDbPhaseShift = true;
|
||||
|
||||
EnumClassFlag<PhaseShiftFlags> flags = PhaseShiftFlags::None;
|
||||
EnumFlag<PhaseShiftFlags> flags = PhaseShiftFlags::None;
|
||||
if (phaseUseFlags & PHASE_USE_FLAGS_ALWAYS_VISIBLE)
|
||||
flags = flags | PhaseShiftFlags::AlwaysVisible | PhaseShiftFlags::Unphased;
|
||||
if (phaseUseFlags & PHASE_USE_FLAGS_INVERSE)
|
||||
@@ -502,7 +502,7 @@ void PhasingHandler::SetAlwaysVisible(PhaseShift& phaseShift, bool apply)
|
||||
if (apply)
|
||||
phaseShift.Flags |= PhaseShiftFlags::AlwaysVisible;
|
||||
else
|
||||
phaseShift.Flags &= ~EnumClassFlag<PhaseShiftFlags>(PhaseShiftFlags::AlwaysVisible);
|
||||
phaseShift.Flags &= ~PhaseShiftFlags::AlwaysVisible;
|
||||
}
|
||||
|
||||
void PhasingHandler::SetInversed(PhaseShift& phaseShift, bool apply)
|
||||
@@ -510,7 +510,7 @@ void PhasingHandler::SetInversed(PhaseShift& phaseShift, bool apply)
|
||||
if (apply)
|
||||
phaseShift.Flags |= PhaseShiftFlags::Inverse;
|
||||
else
|
||||
phaseShift.Flags &= ~EnumClassFlag<PhaseShiftFlags>(PhaseShiftFlags::Inverse);
|
||||
phaseShift.Flags &= ~PhaseShiftFlags::Inverse;
|
||||
|
||||
phaseShift.UpdateUnphasedFlag();
|
||||
}
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
#define TRINITY_SPELLAURADEFINES_H
|
||||
|
||||
#include "Define.h"
|
||||
#include "EnumFlag.h"
|
||||
|
||||
#define MAX_AURAS 64 // client support up to 255, but it will cause problems with group auras updating
|
||||
|
||||
@@ -51,16 +52,20 @@ enum AuraEffectHandleModes
|
||||
AURA_EFFECT_HANDLE_REAL_OR_REAPPLY_MASK = (AURA_EFFECT_HANDLE_REAPPLY | AURA_EFFECT_HANDLE_REAL)
|
||||
};
|
||||
|
||||
enum AuraRemoveMode
|
||||
enum class AuraRemoveFlags : uint32
|
||||
{
|
||||
AURA_REMOVE_NONE = 0,
|
||||
AURA_REMOVE_BY_DEFAULT = 1, // scripted remove, remove by stack with aura with different ids and sc aura remove
|
||||
AURA_REMOVE_BY_CANCEL,
|
||||
AURA_REMOVE_BY_ENEMY_SPELL, // dispel and absorb aura destroy
|
||||
AURA_REMOVE_BY_EXPIRE, // aura duration has ended
|
||||
AURA_REMOVE_BY_DEATH
|
||||
None = 0x00000000,
|
||||
ByDefault = 0x00000001, // scripted remove, remove by stack with aura with different ids and sc aura remove
|
||||
ByCancel = 0x00000002,
|
||||
ByEnemySpell = 0x00000004, // dispel and absorb aura destroy
|
||||
Expired = 0x00000008, // aura duration has ended
|
||||
ByDeath = 0x00000010, // aura owner died
|
||||
|
||||
DontResetPeriodicTimer = 0x00001000, // Do not reset periodic timer. Used by Aura::ModStackAmount.
|
||||
};
|
||||
|
||||
DEFINE_ENUM_FLAG(AuraRemoveFlags)
|
||||
|
||||
//m_schoolAbsorb
|
||||
enum DAMAGE_ABSORB_TYPE
|
||||
{
|
||||
|
||||
@@ -621,8 +621,6 @@ int32 AuraEffect::CalculateAmount(Unit* caster)
|
||||
|
||||
void AuraEffect::CalculatePeriodic(Unit* caster, bool resetPeriodicTimer /*= true*/, bool load /*= false*/)
|
||||
{
|
||||
m_effectPeriodicTimer = m_spellInfo->Effects[m_effIndex].AuraPeriod;
|
||||
|
||||
// prepare periodics
|
||||
switch (GetAuraType())
|
||||
{
|
||||
@@ -639,38 +637,21 @@ void AuraEffect::CalculatePeriodic(Unit* caster, bool resetPeriodicTimer /*= tru
|
||||
case SPELL_AURA_POWER_BURN:
|
||||
case SPELL_AURA_PERIODIC_DUMMY:
|
||||
case SPELL_AURA_PERIODIC_TRIGGER_SPELL_WITH_VALUE:
|
||||
// If no periodic timer is set, fall back to a 1 second interval to match client function
|
||||
if (!m_effectPeriodicTimer)
|
||||
m_effectPeriodicTimer = 1 * IN_MILLISECONDS;
|
||||
|
||||
m_isPeriodic = true;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
GetBase()->CallScriptEffectCalcPeriodicHandlers(this, m_isPeriodic, m_effectPeriodicTimer);
|
||||
int32_t newPeriod = m_spellInfo->Effects[m_effIndex].CalcPeriod(caster, nullptr);
|
||||
|
||||
GetBase()->CallScriptEffectCalcPeriodicHandlers(this, m_isPeriodic, newPeriod);
|
||||
|
||||
m_effectPeriodicTimer = 0;
|
||||
if (!m_isPeriodic)
|
||||
return;
|
||||
|
||||
Player* modOwner = caster ? caster->GetSpellModOwner() : nullptr;
|
||||
// Apply casting time mods
|
||||
if (m_effectPeriodicTimer)
|
||||
{
|
||||
// Apply periodic time mod
|
||||
if (modOwner)
|
||||
modOwner->ApplySpellMod(GetId(), SPELLMOD_ACTIVATION_TIME, m_effectPeriodicTimer);
|
||||
|
||||
if (caster)
|
||||
{
|
||||
// Haste modifies periodic time of channeled spells
|
||||
if (m_spellInfo->IsChanneled())
|
||||
caster->ModSpellDurationTime(m_spellInfo, m_effectPeriodicTimer);
|
||||
else if (m_spellInfo->HasAttribute(SPELL_ATTR5_HASTE_AFFECT_DURATION))
|
||||
m_effectPeriodicTimer = int32(m_effectPeriodicTimer * caster->GetFloatValue(UNIT_MOD_CAST_SPEED));
|
||||
}
|
||||
}
|
||||
m_effectPeriodicTimer = newPeriod;
|
||||
|
||||
if (load) // aura loaded from db
|
||||
{
|
||||
@@ -691,6 +672,11 @@ void AuraEffect::CalculatePeriodic(Unit* caster, bool resetPeriodicTimer /*= tru
|
||||
// Start periodic on next tick or at aura apply
|
||||
if (m_effectPeriodicTimer && !m_spellInfo->HasAttribute(SPELL_ATTR5_START_PERIODIC_AT_APPLY))
|
||||
m_periodicTimer += m_effectPeriodicTimer;
|
||||
|
||||
// If the aura was rolled over, use that timer as the first one to ensure ticks connect properly
|
||||
// in case of a haste proc between this cast and the previous one.
|
||||
//if (GetBase()->GetRolledOverDuration())
|
||||
// m_periodicTimer = GetBase()->GetRolledOverDuration();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -750,7 +736,7 @@ void AuraEffect::ChangeAmount(int32 newAmount, bool mark, bool onStackOrReapply)
|
||||
|
||||
for (AuraApplication* aurApp : effectApplications)
|
||||
{
|
||||
if (aurApp->GetRemoveMode() != AURA_REMOVE_NONE)
|
||||
if (aurApp->GetRemoveMode().HasAnyFlag())
|
||||
continue;
|
||||
|
||||
aurApp->GetTarget()->_RegisterAuraEffect(this, true);
|
||||
@@ -786,13 +772,13 @@ void AuraEffect::HandleEffect(AuraApplication * aurApp, uint8 mode, bool apply)
|
||||
prevented = GetBase()->CallScriptEffectRemoveHandlers(this, aurApp, (AuraEffectHandleModes)mode);
|
||||
|
||||
// check if script events have removed the aura or if default effect prevention was requested
|
||||
if ((apply && aurApp->GetRemoveMode()) || prevented)
|
||||
if ((apply && aurApp->GetRemoveMode().HasAnyFlag()) || prevented)
|
||||
return;
|
||||
|
||||
(*this.*AuraEffectHandler[GetAuraType()])(aurApp, mode, apply);
|
||||
|
||||
// check if script events have removed the aura or if default effect prevention was requested
|
||||
if (apply && aurApp->GetRemoveMode())
|
||||
if (apply && aurApp->GetRemoveMode().HasAnyFlag())
|
||||
return;
|
||||
|
||||
// call scripts triggering additional events after apply/remove
|
||||
@@ -1843,7 +1829,7 @@ void AuraEffect::HandleAuraModShapeshift(AuraApplication const* aurApp, uint8 mo
|
||||
target->RemoveAurasByType(SPELL_AURA_MOD_SHAPESHIFT, ObjectGuid::Empty, GetBase());
|
||||
|
||||
// stop handling the effect if it was removed by linked event
|
||||
if (aurApp->GetRemoveMode())
|
||||
if (aurApp->GetRemoveMode().HasAnyFlag())
|
||||
return;
|
||||
|
||||
if (PowerType != POWER_MANA)
|
||||
@@ -1856,7 +1842,7 @@ void AuraEffect::HandleAuraModShapeshift(AuraApplication const* aurApp, uint8 mo
|
||||
target->SetPower(POWER_ENERGY, 0);
|
||||
}
|
||||
// stop handling the effect if it was removed by linked event
|
||||
if (aurApp->GetRemoveMode())
|
||||
if (aurApp->GetRemoveMode().HasAnyFlag())
|
||||
return;
|
||||
|
||||
ShapeshiftForm prevForm = target->GetShapeshiftForm();
|
||||
@@ -1964,7 +1950,7 @@ void AuraEffect::HandleAuraModShapeshift(AuraApplication const* aurApp, uint8 mo
|
||||
}
|
||||
|
||||
// stop handling the effect if it was removed by linked event
|
||||
if (apply && aurApp->GetRemoveMode())
|
||||
if (apply && aurApp->GetRemoveMode().HasAnyFlag())
|
||||
return;
|
||||
|
||||
if (target->GetTypeId() == TYPEID_PLAYER)
|
||||
@@ -2291,7 +2277,7 @@ void AuraEffect::HandleFeignDeath(AuraApplication const* aurApp, uint8 mode, boo
|
||||
target->getHostileRefManager().deleteReferences();
|
||||
|
||||
// stop handling the effect if it was removed by linked event
|
||||
if (aurApp->GetRemoveMode())
|
||||
if (aurApp->GetRemoveMode().HasAnyFlag())
|
||||
return;
|
||||
|
||||
target->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_UNK_29); // blizz like 2.0.x
|
||||
@@ -4524,7 +4510,7 @@ void AuraEffect::HandleAuraDummy(AuraApplication const* aurApp, uint8 mode, bool
|
||||
break;
|
||||
case 43681: // Inactive
|
||||
{
|
||||
if (target->GetTypeId() != TYPEID_PLAYER || aurApp->GetRemoveMode() != AURA_REMOVE_BY_EXPIRE)
|
||||
if (target->GetTypeId() != TYPEID_PLAYER || !aurApp->GetRemoveMode().HasFlag(AuraRemoveFlags::Expired))
|
||||
return;
|
||||
|
||||
if (target->GetMap()->IsBattleground())
|
||||
@@ -4542,7 +4528,7 @@ void AuraEffect::HandleAuraDummy(AuraApplication const* aurApp, uint8 mode, bool
|
||||
target->CastSpell((Unit*)nullptr, GetAmount(), true, nullptr, this);
|
||||
break;
|
||||
case 91604: // Restricted Flight Area
|
||||
if (aurApp->GetRemoveMode() == AURA_REMOVE_BY_EXPIRE)
|
||||
if (aurApp->GetRemoveMode().HasFlag(AuraRemoveFlags::Expired))
|
||||
target->CastSpell(target, 58601, true);
|
||||
break;
|
||||
}
|
||||
@@ -4760,7 +4746,7 @@ void AuraEffect::HandleChannelDeathItem(AuraApplication const* aurApp, uint8 mod
|
||||
if (!(mode & AURA_EFFECT_HANDLE_REAL))
|
||||
return;
|
||||
|
||||
if (apply || aurApp->GetRemoveMode() != AURA_REMOVE_BY_DEATH)
|
||||
if (apply || !aurApp->GetRemoveMode().HasFlag(AuraRemoveFlags::ByDeath))
|
||||
return;
|
||||
|
||||
Unit* caster = GetCaster();
|
||||
|
||||
@@ -29,7 +29,7 @@ typedef void(AuraEffect::*pAuraEffectHandler)(AuraApplication const* aurApp, uin
|
||||
class TC_GAME_API AuraEffect
|
||||
{
|
||||
friend void Aura::_InitEffects(uint8 effMask, Unit* caster, int32* baseAmount);
|
||||
friend Aura* Unit::_TryStackingOrRefreshingExistingAura(SpellInfo const* newAura, uint8 effMask, Unit* caster, int32* baseAmount, Item* castItem, ObjectGuid casterGUID, bool resetPeriodicTimer);
|
||||
friend Aura* Unit::_TryStackingOrRefreshingExistingAura(SpellInfo const* newAura, uint8 effMask, Unit* caster, int32* baseAmount, Item* castItem, ObjectGuid casterGUID);
|
||||
friend Aura::~Aura();
|
||||
private:
|
||||
~AuraEffect();
|
||||
|
||||
@@ -19,6 +19,7 @@
|
||||
#include "CellImpl.h"
|
||||
#include "Config.h"
|
||||
#include "DynamicObject.h"
|
||||
#include "EnumFlag.h"
|
||||
#include "GridNotifiersImpl.h"
|
||||
#include "Item.h"
|
||||
#include "Log.h"
|
||||
@@ -39,7 +40,7 @@
|
||||
#include "WorldPacket.h"
|
||||
|
||||
AuraApplication::AuraApplication(Unit* target, Unit* caster, Aura* aura, uint8 effMask):
|
||||
_target(target), _base(aura), _removeMode(AURA_REMOVE_NONE), _slot(MAX_AURAS),
|
||||
_target(target), _base(aura), _removeMode(AuraRemoveFlags::None), _slot(MAX_AURAS),
|
||||
_flags(AFLAG_NONE), _effectsToApply(effMask), _needClientUpdate(false)
|
||||
{
|
||||
ASSERT(GetTarget() && GetBase());
|
||||
@@ -260,7 +261,7 @@ uint8 Aura::BuildEffectMaskForOwner(SpellInfo const* spellProto, uint8 available
|
||||
return effMask & availableEffectMask;
|
||||
}
|
||||
|
||||
Aura* Aura::TryRefreshStackOrCreate(SpellInfo const* spellproto, uint8 tryEffMask, WorldObject* owner, Unit* caster, int32* baseAmount /*= nullptr*/, Item* castItem /*= nullptr*/, ObjectGuid casterGUID /*= ObjectGuid::Empty*/, bool* refresh /*= nullptr*/, bool resetPeriodicTimer /*= true*/)
|
||||
Aura* Aura::TryRefreshStackOrCreate(SpellInfo const* spellproto, uint8 tryEffMask, WorldObject* owner, Unit* caster, int32* baseAmount /*= nullptr*/, Item* castItem /*= nullptr*/, ObjectGuid casterGUID /*= ObjectGuid::Empty*/, bool* refresh /*= nullptr*/)
|
||||
{
|
||||
ASSERT(spellproto);
|
||||
ASSERT(owner);
|
||||
@@ -273,7 +274,7 @@ Aura* Aura::TryRefreshStackOrCreate(SpellInfo const* spellproto, uint8 tryEffMas
|
||||
if (!effMask)
|
||||
return nullptr;
|
||||
|
||||
if (Aura* foundAura = owner->ToUnit()->_TryStackingOrRefreshingExistingAura(spellproto, effMask, caster, baseAmount, castItem, casterGUID, resetPeriodicTimer))
|
||||
if (Aura* foundAura = owner->ToUnit()->_TryStackingOrRefreshingExistingAura(spellproto, effMask, caster, baseAmount, castItem, casterGUID))
|
||||
{
|
||||
// we've here aura, which script triggered removal after modding stack amount
|
||||
// check the state here, so we won't create new Aura object
|
||||
@@ -361,6 +362,8 @@ m_procCooldown(std::chrono::steady_clock::time_point::min())
|
||||
|
||||
m_maxDuration = CalcMaxDuration(caster);
|
||||
m_duration = m_maxDuration;
|
||||
m_rolledOverDuration = 0;
|
||||
|
||||
m_procCharges = CalcMaxCharges(caster);
|
||||
m_isUsingCharges = m_procCharges != 0;
|
||||
memset(m_effects, 0, sizeof(m_effects));
|
||||
@@ -442,7 +445,7 @@ void Aura::_ApplyForTarget(Unit* target, Unit* caster, AuraApplication * auraApp
|
||||
void Aura::_UnapplyForTarget(Unit* target, Unit* caster, AuraApplication * auraApp)
|
||||
{
|
||||
ASSERT(target);
|
||||
ASSERT(auraApp->GetRemoveMode());
|
||||
ASSERT(auraApp->GetRemoveMode().HasAnyFlag());
|
||||
ASSERT(auraApp);
|
||||
|
||||
ApplicationMap::iterator itr = m_applications.find(target->GetGUID());
|
||||
@@ -469,9 +472,11 @@ void Aura::_UnapplyForTarget(Unit* target, Unit* caster, AuraApplication * auraA
|
||||
|
||||
// removes aura from all targets
|
||||
// and marks aura as removed
|
||||
void Aura::_Remove(AuraRemoveMode removeMode)
|
||||
void Aura::_Remove(AuraRemoveFlags removeMode)
|
||||
{
|
||||
ASSERT (!m_isRemoved);
|
||||
ASSERT(!m_isRemoved);
|
||||
ASSERT(!EnumFlag<AuraRemoveFlags>{ removeMode }.HasFlag(AuraRemoveFlags::DontResetPeriodicTimer), "Aura must not be removed with AuraRemoveFlags::DontResetPeriodicTimer");
|
||||
|
||||
m_isRemoved = true;
|
||||
ApplicationMap::iterator appItr = m_applications.begin();
|
||||
for (appItr = m_applications.begin(); appItr != m_applications.end();)
|
||||
@@ -605,7 +610,7 @@ void Aura::UpdateTargetMap(Unit* caster, bool apply)
|
||||
// remove auras from units no longer needing them
|
||||
for (Unit* unit : targetsToRemove)
|
||||
if (AuraApplication* aurApp = GetApplicationOfTarget(unit->GetGUID()))
|
||||
unit->_UnapplyAura(aurApp, AURA_REMOVE_BY_DEFAULT);
|
||||
unit->_UnapplyAura(aurApp, AuraRemoveFlags::ByDefault);
|
||||
|
||||
if (!apply)
|
||||
return;
|
||||
@@ -722,25 +727,7 @@ void Aura::Update(uint32 diff, Unit* caster)
|
||||
|
||||
int32 Aura::CalcMaxDuration(Unit* caster) const
|
||||
{
|
||||
Player* modOwner = nullptr;
|
||||
int32 maxDuration;
|
||||
|
||||
if (caster)
|
||||
{
|
||||
modOwner = caster->GetSpellModOwner();
|
||||
maxDuration = caster->CalcSpellDuration(m_spellInfo);
|
||||
}
|
||||
else
|
||||
maxDuration = m_spellInfo->GetDuration();
|
||||
|
||||
if (IsPassive() && !m_spellInfo->DurationEntry)
|
||||
maxDuration = -1;
|
||||
|
||||
// IsPermanent() checks max duration (which we are supposed to calculate here)
|
||||
if (maxDuration != -1 && modOwner)
|
||||
modOwner->ApplySpellMod(GetId(), SPELLMOD_DURATION, maxDuration);
|
||||
|
||||
return maxDuration;
|
||||
return m_spellInfo->CalcDuration(caster);
|
||||
}
|
||||
|
||||
void Aura::SetDuration(int32 duration, bool withMods)
|
||||
@@ -774,23 +761,22 @@ void Aura::RefreshDuration(bool withMods)
|
||||
m_timeCla = 1 * IN_MILLISECONDS;
|
||||
}
|
||||
|
||||
void Aura::RefreshTimers(bool resetPeriodicTimer)
|
||||
void Aura::RefreshTimers()
|
||||
{
|
||||
m_maxDuration = CalcMaxDuration();
|
||||
if (m_spellInfo->HasAttribute(SPELL_ATTR8_DONT_RESET_PERIODIC_TIMER))
|
||||
|
||||
bool resetPeriodicTimer = !m_spellInfo->HasAttribute(SPELL_ATTR8_DONT_RESET_PERIODIC_TIMER);
|
||||
if (!resetPeriodicTimer)
|
||||
{
|
||||
int32 periodic = m_maxDuration;
|
||||
int32 minAmplitude = m_maxDuration;
|
||||
for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i)
|
||||
if (AuraEffect const* eff = GetEffect(i))
|
||||
if (int32 ampl = eff->GetPeriodic())
|
||||
periodic = std::min(ampl, periodic);
|
||||
minAmplitude = std::min(ampl, minAmplitude);
|
||||
|
||||
// If only one tick remaining, roll it over into new duration
|
||||
if (GetDuration() <= periodic)
|
||||
{
|
||||
m_maxDuration += GetDuration();
|
||||
resetPeriodicTimer = false;
|
||||
}
|
||||
// Roll over the time to next tick into the new duration
|
||||
m_rolledOverDuration = GetDuration() % minAmplitude;
|
||||
m_maxDuration += m_rolledOverDuration;
|
||||
}
|
||||
|
||||
RefreshDuration();
|
||||
@@ -824,7 +810,7 @@ uint8 Aura::CalcMaxCharges(Unit* caster) const
|
||||
return uint8(maxProcCharges);
|
||||
}
|
||||
|
||||
bool Aura::ModCharges(int32 num, AuraRemoveMode removeMode)
|
||||
bool Aura::ModCharges(int32 num, AuraRemoveFlags removeMode)
|
||||
{
|
||||
if (IsUsingCharges())
|
||||
{
|
||||
@@ -847,13 +833,13 @@ bool Aura::ModCharges(int32 num, AuraRemoveMode removeMode)
|
||||
return false;
|
||||
}
|
||||
|
||||
void Aura::ModChargesDelayed(int32 num, AuraRemoveMode removeMode)
|
||||
void Aura::ModChargesDelayed(int32 num, AuraRemoveFlags removeMode)
|
||||
{
|
||||
m_dropEvent = nullptr;
|
||||
ModCharges(num, removeMode);
|
||||
}
|
||||
|
||||
void Aura::DropChargeDelayed(uint32 delay, AuraRemoveMode removeMode)
|
||||
void Aura::DropChargeDelayed(uint32 delay, AuraRemoveFlags removeMode)
|
||||
{
|
||||
// aura is already during delayed charge drop
|
||||
if (m_dropEvent)
|
||||
@@ -876,7 +862,7 @@ void Aura::SetStackAmount(uint8 stackAmount)
|
||||
GetApplicationList(applications);
|
||||
|
||||
for (AuraApplication* aurApp : applications)
|
||||
if (!aurApp->GetRemoveMode())
|
||||
if (!aurApp->GetRemoveMode().HasAnyFlag())
|
||||
HandleAuraSpecificMods(aurApp, caster, false, true);
|
||||
|
||||
for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i)
|
||||
@@ -884,13 +870,13 @@ void Aura::SetStackAmount(uint8 stackAmount)
|
||||
aurEff->ChangeAmount(aurEff->CalculateAmount(caster), false, true);
|
||||
|
||||
for (AuraApplication* aurApp : applications)
|
||||
if (!aurApp->GetRemoveMode())
|
||||
if (!aurApp->GetRemoveMode().HasAnyFlag())
|
||||
HandleAuraSpecificMods(aurApp, caster, true, true);
|
||||
|
||||
SetNeedClientUpdateForTargets();
|
||||
}
|
||||
|
||||
bool Aura::ModStackAmount(int32 num, AuraRemoveMode removeMode /*= AURA_REMOVE_BY_DEFAULT*/, bool resetPeriodicTimer /*= true*/)
|
||||
bool Aura::ModStackAmount(int32 num, AuraRemoveFlags removeMode /*= AuraRemoveFlags::ByDefault*/)
|
||||
{
|
||||
int32 stackAmount = m_stackAmount + num;
|
||||
|
||||
@@ -906,18 +892,20 @@ bool Aura::ModStackAmount(int32 num, AuraRemoveMode removeMode /*= AURA_REMOVE_B
|
||||
// we're out of stacks, remove
|
||||
else if (stackAmount <= 0)
|
||||
{
|
||||
Remove(removeMode);
|
||||
Remove(removeMode & ~AuraRemoveFlags::DontResetPeriodicTimer);
|
||||
return true;
|
||||
}
|
||||
|
||||
EnumFlag<AuraRemoveFlags> removeFlags = removeMode;
|
||||
|
||||
bool refresh = stackAmount >= GetStackAmount();
|
||||
|
||||
// Update stack amount
|
||||
SetStackAmount(stackAmount);
|
||||
|
||||
if (refresh)
|
||||
if (refresh && !removeFlags.HasFlag(AuraRemoveFlags::DontResetPeriodicTimer))
|
||||
{
|
||||
RefreshTimers(resetPeriodicTimer);
|
||||
RefreshTimers();
|
||||
|
||||
// reset charges
|
||||
SetCharges(CalcMaxCharges());
|
||||
@@ -1172,7 +1160,8 @@ void Aura::SetNeedClientUpdateForTargets() const
|
||||
void Aura::HandleAuraSpecificMods(AuraApplication const* aurApp, Unit* caster, bool apply, bool onReapply)
|
||||
{
|
||||
Unit* target = aurApp->GetTarget();
|
||||
AuraRemoveMode removeMode = aurApp->GetRemoveMode();
|
||||
EnumFlag<AuraRemoveFlags> removeMode = aurApp->GetRemoveMode();
|
||||
|
||||
// handle spell_area table
|
||||
SpellAreaForAreaMapBounds saBounds = sSpellMgr->GetSpellAreaForAuraMapBounds(GetId());
|
||||
if (saBounds.first != saBounds.second)
|
||||
@@ -1220,7 +1209,7 @@ void Aura::HandleAuraSpecificMods(AuraApplication const* aurApp, Unit* caster, b
|
||||
{
|
||||
if (*itr < 0)
|
||||
target->RemoveAurasDueToSpell(-(*itr));
|
||||
else if (removeMode != AURA_REMOVE_BY_DEATH)
|
||||
else if (!removeMode.HasFlag(AuraRemoveFlags::ByDeath))
|
||||
target->CastSpell(target, *itr, true, nullptr, nullptr, GetCasterGUID());
|
||||
}
|
||||
}
|
||||
@@ -1374,7 +1363,7 @@ void Aura::HandleAuraSpecificMods(AuraApplication const* aurApp, Unit* caster, b
|
||||
switch (GetId())
|
||||
{
|
||||
case 66: // Invisibility
|
||||
if (removeMode != AURA_REMOVE_BY_EXPIRE)
|
||||
if (!removeMode.HasFlag(AuraRemoveFlags::Expired))
|
||||
break;
|
||||
target->CastSpell(target, 32612, true, nullptr, GetEffect(1));
|
||||
target->CombatStop();
|
||||
@@ -1408,7 +1397,7 @@ void Aura::HandleAuraSpecificMods(AuraApplication const* aurApp, Unit* caster, b
|
||||
if (!caster)
|
||||
break;
|
||||
// Power word: shield
|
||||
if (removeMode == AURA_REMOVE_BY_ENEMY_SPELL && GetSpellInfo()->SpellFamilyFlags[0] & 0x00000001)
|
||||
if (removeMode.HasFlag(AuraRemoveFlags::ByEnemySpell) && GetSpellInfo()->SpellFamilyFlags[0] & 0x00000001)
|
||||
{
|
||||
// Rapture
|
||||
if (Aura const* aura = caster->GetAuraOfRankedSpell(47535))
|
||||
@@ -2286,7 +2275,7 @@ void UnitAura::_UnapplyForTarget(Unit* target, Unit* caster, AuraApplication * a
|
||||
target->ApplyDiminishingAura(group, false);
|
||||
}
|
||||
|
||||
void UnitAura::Remove(AuraRemoveMode removeMode)
|
||||
void UnitAura::Remove(AuraRemoveFlags removeMode)
|
||||
{
|
||||
if (IsRemoved())
|
||||
return;
|
||||
@@ -2389,7 +2378,7 @@ bool ChargeDropEvent::Execute(uint64 /*e_time*/, uint32 /*p_time*/)
|
||||
return true;
|
||||
}
|
||||
|
||||
void DynObjAura::Remove(AuraRemoveMode removeMode)
|
||||
void DynObjAura::Remove(AuraRemoveFlags removeMode)
|
||||
{
|
||||
if (IsRemoved())
|
||||
return;
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
#ifndef TRINITY_SPELLAURAS_H
|
||||
#define TRINITY_SPELLAURAS_H
|
||||
|
||||
#include "EnumFlag.h"
|
||||
#include "SpellAuraDefines.h"
|
||||
#include "SpellInfo.h"
|
||||
#include "Unit.h"
|
||||
@@ -41,14 +42,14 @@ class ChargeDropEvent;
|
||||
class TC_GAME_API AuraApplication
|
||||
{
|
||||
friend void Unit::_ApplyAura(AuraApplication * aurApp, uint8 effMask);
|
||||
friend void Unit::_UnapplyAura(AuraApplicationMap::iterator &i, AuraRemoveMode removeMode);
|
||||
friend void Unit::_UnapplyAura(AuraApplicationMap::iterator &i, AuraRemoveFlags removeMode);
|
||||
friend void Unit::_ApplyAuraEffect(Aura* aura, uint8 effIndex);
|
||||
friend void Unit::RemoveAura(AuraApplication * aurApp, AuraRemoveMode mode);
|
||||
friend void Unit::RemoveAura(AuraApplication * aurApp, AuraRemoveFlags mode);
|
||||
friend AuraApplication * Unit::_CreateAuraApplication(Aura* aura, uint8 effMask);
|
||||
private:
|
||||
Unit* const _target;
|
||||
Aura* const _base;
|
||||
AuraRemoveMode _removeMode:8; // Store info for know remove aura reason
|
||||
EnumFlag<AuraRemoveFlags> _removeMode; // Store info for know remove aura reason
|
||||
uint8 _slot; // Aura slot on unit
|
||||
uint8 _flags; // Aura info flag
|
||||
uint8 _effectsToApply; // Used only at spell hit to determine which effect should be applied
|
||||
@@ -72,8 +73,8 @@ class TC_GAME_API AuraApplication
|
||||
bool IsSelfcast() const { return (_flags & AFLAG_CASTER) != 0; }
|
||||
uint8 GetEffectsToApply() const { return _effectsToApply; }
|
||||
|
||||
void SetRemoveMode(AuraRemoveMode mode) { _removeMode = mode; }
|
||||
AuraRemoveMode GetRemoveMode() const {return _removeMode;}
|
||||
void SetRemoveMode(AuraRemoveFlags mode) { _removeMode = mode; }
|
||||
EnumFlag<AuraRemoveFlags> GetRemoveMode() const { return _removeMode; }
|
||||
|
||||
void SetNeedClientUpdate() { _needClientUpdate = true;}
|
||||
bool IsNeedClientUpdate() const { return _needClientUpdate;}
|
||||
@@ -83,12 +84,12 @@ class TC_GAME_API AuraApplication
|
||||
|
||||
class TC_GAME_API Aura
|
||||
{
|
||||
friend Aura* Unit::_TryStackingOrRefreshingExistingAura(SpellInfo const* newAura, uint8 effMask, Unit* caster, int32 *baseAmount, Item* castItem, ObjectGuid casterGUID, bool resetPeriodicTimer);
|
||||
friend Aura* Unit::_TryStackingOrRefreshingExistingAura(SpellInfo const* newAura, uint8 effMask, Unit* caster, int32 *baseAmount, Item* castItem, ObjectGuid casterGUID);
|
||||
public:
|
||||
typedef std::map<ObjectGuid, AuraApplication*> ApplicationMap;
|
||||
|
||||
static uint8 BuildEffectMaskForOwner(SpellInfo const* spellProto, uint8 availableEffectMask, WorldObject* owner);
|
||||
static Aura* TryRefreshStackOrCreate(SpellInfo const* spellproto, uint8 tryEffMask, WorldObject* owner, Unit* caster, int32* baseAmount = nullptr, Item* castItem = nullptr, ObjectGuid casterGUID = ObjectGuid::Empty, bool* refresh = nullptr, bool resetPeriodicTimer = true);
|
||||
static Aura* TryRefreshStackOrCreate(SpellInfo const* spellproto, uint8 tryEffMask, WorldObject* owner, Unit* caster, int32* baseAmount = nullptr, Item* castItem = nullptr, ObjectGuid casterGUID = ObjectGuid::Empty, bool* refresh = nullptr);
|
||||
static Aura* TryCreate(SpellInfo const* spellproto, uint8 effMask, WorldObject* owner, Unit* caster, int32* baseAmount = nullptr, Item* castItem = nullptr, ObjectGuid casterGUID = ObjectGuid::Empty);
|
||||
static Aura* Create(SpellInfo const* spellproto, uint8 effMask, WorldObject* owner, Unit* caster, int32* baseAmount, Item* castItem, ObjectGuid casterGUID);
|
||||
explicit Aura(SpellInfo const* spellproto, WorldObject* owner, Unit* caster, Item* castItem, ObjectGuid casterGUID);
|
||||
@@ -109,8 +110,8 @@ class TC_GAME_API Aura
|
||||
|
||||
virtual void _ApplyForTarget(Unit* target, Unit* caster, AuraApplication * auraApp);
|
||||
virtual void _UnapplyForTarget(Unit* target, Unit* caster, AuraApplication * auraApp);
|
||||
void _Remove(AuraRemoveMode removeMode);
|
||||
virtual void Remove(AuraRemoveMode removeMode = AURA_REMOVE_BY_DEFAULT) = 0;
|
||||
void _Remove(AuraRemoveFlags removeMode);
|
||||
virtual void Remove(AuraRemoveFlags removeMode = AuraRemoveFlags::ByDefault) = 0;
|
||||
|
||||
virtual void FillTargetMap(std::unordered_map<Unit*, uint8>& targets, Unit* caster) = 0;
|
||||
void UpdateTargetMap(Unit* caster, bool apply = true);
|
||||
@@ -129,8 +130,9 @@ class TC_GAME_API Aura
|
||||
int32 CalcMaxDuration(Unit* caster) const;
|
||||
int32 GetDuration() const { return m_duration; }
|
||||
void SetDuration(int32 duration, bool withMods = false);
|
||||
int32_t GetRolledOverDuration() const { return m_rolledOverDuration; }
|
||||
void RefreshDuration(bool withMods = false);
|
||||
void RefreshTimers(bool resetPeriodicTimer);
|
||||
void RefreshTimers();
|
||||
bool IsExpired() const { return !GetDuration() && !m_dropEvent; }
|
||||
bool IsPermanent() const { return GetMaxDuration() == -1; }
|
||||
|
||||
@@ -138,14 +140,14 @@ class TC_GAME_API Aura
|
||||
void SetCharges(uint8 charges);
|
||||
uint8 CalcMaxCharges(Unit* caster) const;
|
||||
uint8 CalcMaxCharges() const { return CalcMaxCharges(GetCaster()); }
|
||||
bool ModCharges(int32 num, AuraRemoveMode removeMode = AURA_REMOVE_BY_DEFAULT);
|
||||
bool DropCharge(AuraRemoveMode removeMode = AURA_REMOVE_BY_DEFAULT) { return ModCharges(-1, removeMode); }
|
||||
void ModChargesDelayed(int32 num, AuraRemoveMode removeMode = AURA_REMOVE_BY_DEFAULT);
|
||||
void DropChargeDelayed(uint32 delay, AuraRemoveMode removeMode = AURA_REMOVE_BY_DEFAULT);
|
||||
bool ModCharges(int32 num, AuraRemoveFlags removeMode = AuraRemoveFlags::ByDefault);
|
||||
bool DropCharge(AuraRemoveFlags removeMode = AuraRemoveFlags::ByDefault) { return ModCharges(-1, removeMode); }
|
||||
void ModChargesDelayed(int32 num, AuraRemoveFlags removeMode = AuraRemoveFlags::ByDefault);
|
||||
void DropChargeDelayed(uint32 delay, AuraRemoveFlags removeMode = AuraRemoveFlags::ByDefault);
|
||||
|
||||
uint8 GetStackAmount() const { return m_stackAmount; }
|
||||
void SetStackAmount(uint8 num);
|
||||
bool ModStackAmount(int32 num, AuraRemoveMode removeMode = AURA_REMOVE_BY_DEFAULT, bool resetPeriodicTimer = true);
|
||||
bool ModStackAmount(int32 num, AuraRemoveFlags removeMode = AuraRemoveFlags::ByDefault);
|
||||
|
||||
uint8 GetCasterLevel() const { return m_casterLevel; }
|
||||
|
||||
@@ -254,6 +256,8 @@ class TC_GAME_API Aura
|
||||
|
||||
int32 m_maxDuration; // Max aura duration
|
||||
int32 m_duration; // Current time
|
||||
int32 m_rolledOverDuration; // Duration remainder, rolled over on refresh, if the spell does not reset its periodic timer.
|
||||
// This is normally the time remaining until the next tick of the dot when refreshed.
|
||||
int32 m_timeCla; // Timer for power per sec calcultion
|
||||
int32 m_updateTargetMapInterval; // Timer for UpdateTargetMapOfEffect
|
||||
|
||||
@@ -285,7 +289,7 @@ class TC_GAME_API UnitAura : public Aura
|
||||
void _ApplyForTarget(Unit* target, Unit* caster, AuraApplication * aurApp) override;
|
||||
void _UnapplyForTarget(Unit* target, Unit* caster, AuraApplication * aurApp) override;
|
||||
|
||||
void Remove(AuraRemoveMode removeMode = AURA_REMOVE_BY_DEFAULT) override;
|
||||
void Remove(AuraRemoveFlags removeMode = AuraRemoveFlags::ByDefault) override;
|
||||
|
||||
void FillTargetMap(std::unordered_map<Unit*, uint8>& targets, Unit* caster) override;
|
||||
|
||||
@@ -303,7 +307,7 @@ class TC_GAME_API DynObjAura : public Aura
|
||||
protected:
|
||||
explicit DynObjAura(SpellInfo const* spellproto, uint8 effMask, WorldObject* owner, Unit* caster, int32 *baseAmount, Item* castItem, ObjectGuid casterGUID);
|
||||
public:
|
||||
void Remove(AuraRemoveMode removeMode = AURA_REMOVE_BY_DEFAULT) override;
|
||||
void Remove(AuraRemoveFlags removeMode = AuraRemoveFlags::ByDefault) override;
|
||||
|
||||
void FillTargetMap(std::unordered_map<Unit*, uint8>& targets, Unit* caster) override;
|
||||
};
|
||||
@@ -312,11 +316,11 @@ class TC_GAME_API ChargeDropEvent : public BasicEvent
|
||||
{
|
||||
friend class Aura;
|
||||
protected:
|
||||
ChargeDropEvent(Aura* base, AuraRemoveMode mode) : _base(base), _mode(mode) { }
|
||||
ChargeDropEvent(Aura* base, AuraRemoveFlags mode) : _base(base), _mode(mode) { }
|
||||
bool Execute(uint64 /*e_time*/, uint32 /*p_time*/) override;
|
||||
|
||||
private:
|
||||
Aura* _base;
|
||||
AuraRemoveMode _mode;
|
||||
AuraRemoveFlags _mode;
|
||||
};
|
||||
#endif
|
||||
@@ -2653,7 +2653,7 @@ void Spell::DoAllEffectOnTarget(TargetInfo* target)
|
||||
// Failed Pickpocket, reveal rogue
|
||||
if (missInfo == SPELL_MISS_RESIST && m_spellInfo->HasAttribute(SPELL_ATTR0_CU_PICKPOCKET) && unitTarget->GetTypeId() == TYPEID_UNIT)
|
||||
{
|
||||
m_caster->RemoveAurasWithInterruptFlags(AURA_INTERRUPT_FLAG_TALK);
|
||||
m_caster->RemoveAurasWithInterruptFlags(AURA_INTERRUPT_FLAG_TALK, 0, this);
|
||||
if (unitTarget->ToCreature()->IsAIEnabled)
|
||||
unitTarget->ToCreature()->AI()->AttackStart(m_caster);
|
||||
}
|
||||
@@ -2742,7 +2742,7 @@ SpellMissInfo Spell::DoSpellHitOnUnit(Unit* unit, uint32 effectMask, bool scaleA
|
||||
return SPELL_MISS_EVADE;
|
||||
|
||||
if (m_caster->_IsValidAttackTarget(unit, m_spellInfo))
|
||||
unit->RemoveAurasWithInterruptFlags(AURA_INTERRUPT_FLAG_HITBYSPELL);
|
||||
unit->RemoveAurasWithInterruptFlags(AURA_INTERRUPT_FLAG_HITBYSPELL, 0, this);
|
||||
else if (m_caster->IsFriendlyTo(unit))
|
||||
{
|
||||
// for delayed spells ignore negative spells (after duel end) for friendly targets
|
||||
@@ -2809,9 +2809,9 @@ SpellMissInfo Spell::DoSpellHitOnUnit(Unit* unit, uint32 effectMask, bool scaleA
|
||||
if (m_originalCaster)
|
||||
{
|
||||
bool refresh = false;
|
||||
bool const resetPeriodicTimer = !(_triggeredCastFlags & TRIGGERED_DONT_RESET_PERIODIC_TIMER);
|
||||
|
||||
m_spellAura = Aura::TryRefreshStackOrCreate(aurSpellInfo, effectMask, unit,
|
||||
m_originalCaster, (aurSpellInfo == m_spellInfo) ? &m_spellValue->EffectBasePoints[0] : &basePoints[0], m_CastItem, ObjectGuid::Empty, &refresh, resetPeriodicTimer);
|
||||
m_originalCaster, (aurSpellInfo == m_spellInfo) ? &m_spellValue->EffectBasePoints[0] : &basePoints[0], m_CastItem, ObjectGuid::Empty, &refresh);
|
||||
if (m_spellAura)
|
||||
{
|
||||
// Set aura stack amount to desired value
|
||||
@@ -2859,44 +2859,26 @@ SpellMissInfo Spell::DoSpellHitOnUnit(Unit* unit, uint32 effectMask, bool scaleA
|
||||
|
||||
duration = m_originalCaster->ModSpellDuration(aurSpellInfo, unit, duration, positive, effectMask);
|
||||
|
||||
if (duration > 0)
|
||||
{
|
||||
// Haste modifies duration of channeled spells
|
||||
if (m_spellInfo->IsChanneled())
|
||||
m_originalCaster->ModSpellDurationTime(aurSpellInfo, duration, this);
|
||||
else if (m_spellInfo->HasAttribute(SPELL_ATTR5_HASTE_AFFECT_DURATION))
|
||||
{
|
||||
int32 origDuration = duration;
|
||||
duration = 0;
|
||||
for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i)
|
||||
{
|
||||
if (AuraEffect const* eff = m_spellAura->GetEffect(i))
|
||||
{
|
||||
if (int32 periodic = eff->GetPeriodic()) // amplitude is hastened by UNIT_MOD_CAST_SPEED
|
||||
{
|
||||
float preciseTicks = (float)origDuration / float(periodic);
|
||||
int32 ticks = origDuration / periodic;
|
||||
|
||||
// additional ticks are being added by rounding up
|
||||
if (preciseTicks - ticks >= 0.5f)
|
||||
ticks = int32(std::ceil(preciseTicks));
|
||||
|
||||
duration = std::max(ticks * periodic, duration);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// if there is no periodic effect
|
||||
if (!duration)
|
||||
duration = int32(origDuration * m_originalCaster->GetFloatValue(UNIT_MOD_CAST_SPEED));
|
||||
}
|
||||
}
|
||||
|
||||
if (duration != m_spellAura->GetMaxDuration())
|
||||
{
|
||||
m_spellAura->SetMaxDuration(duration);
|
||||
m_spellAura->SetDuration(duration);
|
||||
}
|
||||
|
||||
if (DynamicObject* dynObj = m_originalCaster->GetDynObject(m_spellInfo->Id))
|
||||
dynObj->SetDuration(duration);
|
||||
|
||||
if (m_spellInfo->IsChanneled() && refresh && m_spellInfo->HasAttribute(SPELL_ATTR8_DONT_RESET_PERIODIC_TIMER))
|
||||
{
|
||||
SendChannelStart(m_spellAura->GetMaxDuration() - m_spellAura->GetRolledOverDuration());
|
||||
SendChannelUpdate(m_spellAura->GetMaxDuration());
|
||||
|
||||
// A side-effect of SendChannelStart() is to set the spell's timer to the value passed as parameter.
|
||||
// However for channeled dot clipping to work properly, we need to roll over the duration.
|
||||
// So we need to re-update timer with a proper value.
|
||||
m_timer = m_spellAura->GetMaxDuration();
|
||||
}
|
||||
|
||||
m_spellAura->_RegisterForTargets();
|
||||
}
|
||||
}
|
||||
@@ -3265,11 +3247,11 @@ void Spell::prepare(SpellCastTargets const* targets, AuraEffect const* triggered
|
||||
// skip triggered spell (item equip spell casting and other not explicit character casts/item uses)
|
||||
if (!(_triggeredCastFlags & TRIGGERED_IGNORE_AURA_INTERRUPT_FLAGS) && m_spellInfo->IsBreakingStealth())
|
||||
{
|
||||
m_caster->RemoveAurasWithInterruptFlags(AURA_INTERRUPT_FLAG_CAST);
|
||||
m_caster->RemoveAurasWithInterruptFlags(AURA_INTERRUPT_FLAG_CAST, 0, this);
|
||||
for (uint32 i = 0; i < MAX_SPELL_EFFECTS; ++i)
|
||||
if (m_spellInfo->Effects[i].GetUsedTargetObjectType() == TARGET_OBJECT_TYPE_UNIT)
|
||||
{
|
||||
m_caster->RemoveAurasWithInterruptFlags(AURA_INTERRUPT_FLAG_SPELL_ATTACK);
|
||||
m_caster->RemoveAurasWithInterruptFlags(AURA_INTERRUPT_FLAG_SPELL_ATTACK, 0, this);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -3291,7 +3273,7 @@ void Spell::prepare(SpellCastTargets const* targets, AuraEffect const* triggered
|
||||
}
|
||||
}
|
||||
|
||||
void Spell::cancel()
|
||||
void Spell::cancel(Spell* interruptingSpell /* = nullptr */)
|
||||
{
|
||||
if (m_spellState == SPELL_STATE_FINISHED)
|
||||
return;
|
||||
@@ -3299,6 +3281,8 @@ void Spell::cancel()
|
||||
uint32 oldState = m_spellState;
|
||||
m_spellState = SPELL_STATE_FINISHED;
|
||||
|
||||
bool sendChannelUpdate = m_spellInfo->IsChanneled();
|
||||
|
||||
m_autoRepeat = false;
|
||||
switch (oldState)
|
||||
{
|
||||
@@ -3312,13 +3296,33 @@ void Spell::cancel()
|
||||
|
||||
case SPELL_STATE_CASTING:
|
||||
for (std::list<TargetInfo>::const_iterator ihit = m_UniqueTargetInfo.begin(); ihit != m_UniqueTargetInfo.end(); ++ihit)
|
||||
if ((*ihit).missCondition == SPELL_MISS_NONE)
|
||||
if (Unit* unit = m_caster->GetGUID() == ihit->targetGUID ? m_caster : ObjectAccessor::GetUnit(*m_caster, ihit->targetGUID))
|
||||
unit->RemoveOwnedAura(m_spellInfo->Id, m_originalCasterGUID, 0, AURA_REMOVE_BY_CANCEL);
|
||||
{
|
||||
// Remove if no miss.
|
||||
bool removeOwnedAura = (*ihit).missCondition == SPELL_MISS_NONE;
|
||||
if (interruptingSpell != nullptr)
|
||||
{
|
||||
// However if we are refreshing a channeled spell, only removed owned aura
|
||||
// if the new target isn't the old one.
|
||||
if (m_spellInfo->Id == interruptingSpell->m_spellInfo->Id && m_spellInfo->IsChanneled())
|
||||
{
|
||||
// Different target, ease up on the core and already remove auras
|
||||
// if same target, do nothing. If we miss with the new spell, auras will get removed anyways
|
||||
removeOwnedAura = (*ihit).targetGUID != interruptingSpell->m_targets.GetUnitTargetGUID();
|
||||
}
|
||||
}
|
||||
|
||||
SendChannelUpdate(0);
|
||||
SendInterrupted(0);
|
||||
SendCastResult(SPELL_FAILED_INTERRUPTED);
|
||||
if (removeOwnedAura)
|
||||
if (Unit* unit = m_caster->GetGUID() == ihit->targetGUID ? m_caster : ObjectAccessor::GetUnit(*m_caster, ihit->targetGUID))
|
||||
unit->RemoveOwnedAura(m_spellInfo->Id, m_originalCasterGUID, 0, AuraRemoveFlags::ByCancel);
|
||||
}
|
||||
|
||||
// Only send channel updates if we are interrupt with a spell that is not the one currently channeled.
|
||||
sendChannelUpdate &= interruptingSpell == nullptr || m_spellInfo->Id != interruptingSpell->m_spellInfo->Id;
|
||||
if (sendChannelUpdate)
|
||||
{
|
||||
SendInterrupted(0);
|
||||
SendCastResult(SPELL_FAILED_INTERRUPTED);
|
||||
}
|
||||
|
||||
m_appliedMods.clear();
|
||||
break;
|
||||
@@ -3338,7 +3342,7 @@ void Spell::cancel()
|
||||
//set state back so finish will be processed
|
||||
m_spellState = oldState;
|
||||
|
||||
finish(false);
|
||||
finish(false, sendChannelUpdate);
|
||||
}
|
||||
|
||||
void Spell::cast(bool skipCheck)
|
||||
@@ -3626,17 +3630,9 @@ void Spell::handle_immediate()
|
||||
// start channeling if applicable
|
||||
if (m_spellInfo->IsChanneled())
|
||||
{
|
||||
int32 duration = m_spellInfo->GetDuration();
|
||||
int32 duration = m_spellInfo->CalcDuration(m_caster);
|
||||
if (duration > 0)
|
||||
{
|
||||
// First mod_duration then haste - see Missile Barrage
|
||||
// Apply duration mod
|
||||
if (Player* modOwner = m_caster->GetSpellModOwner())
|
||||
modOwner->ApplySpellMod(m_spellInfo->Id, SPELLMOD_DURATION, duration);
|
||||
|
||||
// Apply haste mods
|
||||
m_caster->ModSpellDurationTime(m_spellInfo, duration, this);
|
||||
|
||||
m_spellState = SPELL_STATE_CASTING;
|
||||
m_caster->AddInterruptMask(m_spellInfo->ChannelInterruptFlags);
|
||||
m_channeledDuration = duration;
|
||||
@@ -3896,7 +3892,7 @@ void Spell::update(uint32 difftime)
|
||||
// Also remove applied auras
|
||||
for (TargetInfo const& target : m_UniqueTargetInfo)
|
||||
if (Unit* unit = m_caster->GetGUID() == target.targetGUID ? m_caster : ObjectAccessor::GetUnit(*m_caster, target.targetGUID))
|
||||
unit->RemoveOwnedAura(m_spellInfo->Id, m_originalCasterGUID, 0, AURA_REMOVE_BY_CANCEL);
|
||||
unit->RemoveOwnedAura(m_spellInfo->Id, m_originalCasterGUID, 0, AuraRemoveFlags::ByCancel);
|
||||
}
|
||||
|
||||
if (m_timer > 0)
|
||||
@@ -3924,7 +3920,7 @@ void Spell::update(uint32 difftime)
|
||||
}
|
||||
}
|
||||
|
||||
void Spell::finish(bool ok)
|
||||
void Spell::finish(bool ok, bool sendChannelUpdate /* = false */)
|
||||
{
|
||||
if (!m_caster)
|
||||
return;
|
||||
@@ -3936,6 +3932,9 @@ void Spell::finish(bool ok)
|
||||
if (m_spellInfo->IsChanneled())
|
||||
m_caster->UpdateInterruptMask();
|
||||
|
||||
if (sendChannelUpdate)
|
||||
SendChannelUpdate(0);
|
||||
|
||||
if (m_caster->HasUnitState(UNIT_STATE_CASTING) && !m_caster->IsNonMeleeSpellCast(false, false, true))
|
||||
m_caster->ClearUnitState(UNIT_STATE_CASTING);
|
||||
|
||||
|
||||
@@ -434,10 +434,10 @@ class TC_GAME_API Spell
|
||||
GameObject* SearchSpellFocus();
|
||||
|
||||
void prepare(SpellCastTargets const* targets, AuraEffect const* triggeredByAura = nullptr);
|
||||
void cancel();
|
||||
void cancel(Spell* interruptingSpell = nullptr);
|
||||
void update(uint32 difftime);
|
||||
void cast(bool skipCheck = false);
|
||||
void finish(bool ok = true);
|
||||
void finish(bool ok = true, bool sendChannelUpdate = false);
|
||||
void TakePower();
|
||||
void TakeAmmo();
|
||||
|
||||
|
||||
@@ -4577,7 +4577,7 @@ void Spell::EffectDispelMechanic(SpellEffIndex effIndex)
|
||||
}
|
||||
|
||||
for (auto itr = dispel_list.begin(); itr != dispel_list.end(); ++itr)
|
||||
unitTarget->RemoveAura(itr->first, itr->second, 0, AURA_REMOVE_BY_ENEMY_SPELL);
|
||||
unitTarget->RemoveAura(itr->first, itr->second, 0, AuraRemoveFlags::ByEnemySpell);
|
||||
}
|
||||
|
||||
void Spell::EffectResurrectPet(SpellEffIndex /*effIndex*/)
|
||||
|
||||
@@ -434,6 +434,25 @@ bool SpellEffectInfo::IsUnitOwnedAuraEffect() const
|
||||
return IsAreaAuraEffect() || Effect == SPELL_EFFECT_APPLY_AURA || Effect == SPELL_EFFECT_APPLY_AURA_2;
|
||||
}
|
||||
|
||||
uint32 SpellEffectInfo::CalcPeriod(Unit* caster, Spell* spell /* = nullptr */) const
|
||||
{
|
||||
// Default value found in client.
|
||||
uint32 period = AuraPeriod;
|
||||
if (period == 0)
|
||||
period = 5200;
|
||||
|
||||
if (caster != nullptr)
|
||||
{
|
||||
if (Player* modOwner = caster->GetSpellModOwner())
|
||||
modOwner->ApplySpellMod(_spellInfo->Id, SPELLMOD_ACTIVATION_TIME, period, spell);
|
||||
|
||||
if (_spellInfo->HasAttribute(SPELL_ATTR5_HASTE_AFFECT_DURATION) && !_spellInfo->HasAttribute(SPELL_ATTR3_NO_DONE_BONUS))
|
||||
period = int32(period * caster->GetFloatValue(UNIT_MOD_CAST_HASTE));
|
||||
}
|
||||
|
||||
return period;
|
||||
}
|
||||
|
||||
int32 SpellEffectInfo::CalcValue(Unit const* caster, int32 const* bp, Unit const* target) const
|
||||
{
|
||||
float basePointsPerLevel = RealPointsPerLevel;
|
||||
@@ -3043,7 +3062,7 @@ void SpellInfo::ApplyAllSpellImmunitiesTo(Unit* target, uint8 effIndex, bool app
|
||||
target->ApplySpellImmune(Id, IMMUNITY_MECHANIC, i, apply);
|
||||
|
||||
if (apply && HasAttribute(SPELL_ATTR1_DISPEL_AURAS_ON_IMMUNITY))
|
||||
target->RemoveAurasWithMechanic(mechanicImmunity, AURA_REMOVE_BY_DEFAULT, Id);
|
||||
target->RemoveAurasWithMechanic(mechanicImmunity, AuraRemoveFlags::ByDefault, Id);
|
||||
}
|
||||
|
||||
if (uint32 dispelImmunity = immuneInfo->DispelImmune)
|
||||
@@ -3246,6 +3265,79 @@ int32 SpellInfo::GetMaxDuration() const
|
||||
return (DurationEntry->MaxDuration == -1) ? -1 : abs(DurationEntry->MaxDuration);
|
||||
}
|
||||
|
||||
int32 SpellInfo::CalcDuration(Unit* caster, Spell* spell) const
|
||||
{
|
||||
if (IsPassive() && !DurationEntry)
|
||||
return -1;
|
||||
|
||||
if (!DurationEntry)
|
||||
return 0;
|
||||
|
||||
int32 duration = GetMaxDuration();
|
||||
if (duration == -1)
|
||||
return -1;
|
||||
|
||||
if (caster != nullptr)
|
||||
{
|
||||
uint32 level = caster->getLevel();
|
||||
if (MaxLevel > 0 && level > MaxLevel)
|
||||
level = MaxLevel;
|
||||
if (BaseLevel > 0)
|
||||
level -= BaseLevel;
|
||||
|
||||
duration = DurationEntry->Duration + DurationEntry->DurationPerLevel * level;
|
||||
duration = std::min(GetMaxDuration(), duration);
|
||||
}
|
||||
|
||||
if (duration == -1)
|
||||
return -1;
|
||||
|
||||
// This is ***not** in client code, but is very much needed for, ie, Slice and Dice.
|
||||
uint8 comboPoints = caster != nullptr && caster->m_playerMovingMe ? caster->m_playerMovingMe->GetComboPoints() : 0;
|
||||
if (comboPoints != 0)
|
||||
{
|
||||
if (GetDuration() != GetMaxDuration() && GetDuration() != -1)
|
||||
duration += int32((GetMaxDuration() - GetDuration()) * comboPoints / 5);
|
||||
}
|
||||
|
||||
if (caster != nullptr)
|
||||
if (Player* modOwner = caster->GetSpellModOwner())
|
||||
modOwner->ApplySpellMod(Id, SPELLMOD_DURATION, duration, spell);
|
||||
|
||||
bool hasUnk17 = HasAttribute(SPELL_ATTR8_UNK17);
|
||||
bool hasAffectDuration = HasAttribute(SPELL_ATTR5_HASTE_AFFECT_DURATION);
|
||||
// That aura is not used as of 4.3.4, but just include it, as it still is technically supported by the client, and so should we.
|
||||
bool hasPeriodicHasteAuras = caster != nullptr && caster->HasAuraTypeWithAffectMask(SPELL_AURA_PERIODIC_HASTE, this);
|
||||
|
||||
if (hasAffectDuration || hasUnk17)
|
||||
{
|
||||
// This is just a stupid way to find the first periodic effect.
|
||||
int32 periodicEffectIndex = 0;
|
||||
while ((Effects[periodicEffectIndex].Effect == 0 || Effects[periodicEffectIndex].AuraPeriod == 0))
|
||||
{
|
||||
++periodicEffectIndex;
|
||||
if (periodicEffectIndex >= MAX_SPELL_EFFECTS)
|
||||
return duration;
|
||||
}
|
||||
|
||||
if ((hasAffectDuration || hasPeriodicHasteAuras) && !HasAttribute(SPELL_ATTR3_NO_DONE_BONUS))
|
||||
{
|
||||
float hasteValue = caster ? caster->GetFloatValue(UNIT_MOD_CAST_HASTE) : 0.0f;
|
||||
if (hasteValue > 0.0f)
|
||||
{
|
||||
if (hasUnk17)
|
||||
return int32(duration * hasteValue);
|
||||
|
||||
int32 effectPeriod = Effects[periodicEffectIndex].CalcPeriod(caster, spell);
|
||||
if (effectPeriod > 0)
|
||||
duration = std::floor(float(duration) / float(effectPeriod)) * effectPeriod;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return duration;
|
||||
}
|
||||
|
||||
uint32 SpellInfo::CalcCastTime(uint8 level, Spell* spell /*= nullptr*/) const
|
||||
{
|
||||
int32 castTime = 0;
|
||||
|
||||
@@ -295,6 +295,8 @@ public:
|
||||
SpellEffectImplicitTargetTypes GetImplicitTargetType() const;
|
||||
SpellTargetObjectTypes GetUsedTargetObjectType() const;
|
||||
|
||||
uint32 CalcPeriod(Unit* caster, Spell* spell = nullptr) const;
|
||||
|
||||
private:
|
||||
struct StaticData
|
||||
{
|
||||
@@ -552,6 +554,8 @@ class TC_GAME_API SpellInfo
|
||||
int32 GetDuration() const;
|
||||
int32 GetMaxDuration() const;
|
||||
|
||||
int32 CalcDuration(Unit* caster, Spell* spell = nullptr) const;
|
||||
|
||||
uint32 GetMaxTicks() const;
|
||||
|
||||
uint32 CalcCastTime(uint8 level = 0, Spell* spell = nullptr) const;
|
||||
|
||||
@@ -1057,7 +1057,7 @@ DynamicObject* AuraScript::GetDynobjOwner() const
|
||||
return m_aura->GetDynobjOwner();
|
||||
}
|
||||
|
||||
void AuraScript::Remove(AuraRemoveMode removeMode)
|
||||
void AuraScript::Remove(AuraRemoveFlags removeMode)
|
||||
{
|
||||
m_aura->Remove(removeMode);
|
||||
}
|
||||
@@ -1132,12 +1132,12 @@ uint8 AuraScript::CalcMaxCharges() const
|
||||
return m_aura->CalcMaxCharges();
|
||||
}
|
||||
|
||||
bool AuraScript::ModCharges(int8 num, AuraRemoveMode removeMode /*= AURA_REMOVE_BY_DEFAULT*/)
|
||||
bool AuraScript::ModCharges(int8 num, AuraRemoveFlags removeMode /*= AuraRemoveFlags::ByDefault*/)
|
||||
{
|
||||
return m_aura->ModCharges(num, removeMode);
|
||||
}
|
||||
|
||||
bool AuraScript::DropCharge(AuraRemoveMode removeMode)
|
||||
bool AuraScript::DropCharge(AuraRemoveFlags removeMode)
|
||||
{
|
||||
return m_aura->DropCharge(removeMode);
|
||||
}
|
||||
@@ -1152,7 +1152,7 @@ void AuraScript::SetStackAmount(uint8 num)
|
||||
m_aura->SetStackAmount(num);
|
||||
}
|
||||
|
||||
bool AuraScript::ModStackAmount(int32 num, AuraRemoveMode removeMode)
|
||||
bool AuraScript::ModStackAmount(int32 num, AuraRemoveFlags removeMode)
|
||||
{
|
||||
return m_aura->ModStackAmount(num, removeMode);
|
||||
}
|
||||
|
||||
@@ -865,8 +865,8 @@ class TC_GAME_API AuraScript : public _SpellScript
|
||||
// returns owner if it's dynobj, nullptr otherwise
|
||||
DynamicObject* GetDynobjOwner() const;
|
||||
|
||||
// removes aura with remove mode (see AuraRemoveMode enum)
|
||||
void Remove(AuraRemoveMode removeMode = AURA_REMOVE_BY_DEFAULT);
|
||||
// removes aura with remove mode (see AuraRemoveFlags enum)
|
||||
void Remove(AuraRemoveFlags removeMode = AuraRemoveFlags::ByDefault);
|
||||
// returns aura object of script
|
||||
Aura* GetAura() const;
|
||||
|
||||
@@ -891,14 +891,14 @@ class TC_GAME_API AuraScript : public _SpellScript
|
||||
uint8 GetCharges() const;
|
||||
void SetCharges(uint8 charges);
|
||||
uint8 CalcMaxCharges() const;
|
||||
bool ModCharges(int8 num, AuraRemoveMode removeMode = AURA_REMOVE_BY_DEFAULT);
|
||||
bool ModCharges(int8 num, AuraRemoveFlags removeMode = AuraRemoveFlags::ByDefault);
|
||||
// returns true if last charge dropped
|
||||
bool DropCharge(AuraRemoveMode removeMode = AURA_REMOVE_BY_DEFAULT);
|
||||
bool DropCharge(AuraRemoveFlags removeMode = AuraRemoveFlags::ByDefault);
|
||||
|
||||
// stack amount manipulation
|
||||
uint8 GetStackAmount() const;
|
||||
void SetStackAmount(uint8 num);
|
||||
bool ModStackAmount(int32 num, AuraRemoveMode removeMode = AURA_REMOVE_BY_DEFAULT);
|
||||
bool ModStackAmount(int32 num, AuraRemoveFlags removeMode = AuraRemoveFlags::ByDefault);
|
||||
|
||||
// passive - "working in background", not saved, not removed by immunities, not seen by player
|
||||
bool IsPassive() const;
|
||||
|
||||
@@ -2540,7 +2540,7 @@ class spell_terrastra_harden_skin : public AuraScript
|
||||
|
||||
void OnAuraRemoveHandler(AuraEffect const* aurEff, AuraEffectHandleModes /*mode*/)
|
||||
{
|
||||
if (GetTargetApplication()->GetRemoveMode() == AURA_REMOVE_BY_ENEMY_SPELL)
|
||||
if (GetTargetApplication()->GetRemoveMode().HasFlag(AuraRemoveFlags::ByEnemySpell))
|
||||
if (Unit* target = GetTarget())
|
||||
target->CastCustomSpell(SPELL_SHATTER, SPELLVALUE_BASE_POINT0, _absorbedDamage, nullptr, true, nullptr, aurEff);
|
||||
}
|
||||
|
||||
@@ -1274,8 +1274,7 @@ class spell_valiona_blackout: public SpellScriptLoader
|
||||
|
||||
void OnAuraRemoveHandler(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
|
||||
{
|
||||
if (GetTargetApplication()->GetRemoveMode() == AURA_REMOVE_BY_ENEMY_SPELL
|
||||
|| GetTargetApplication()->GetRemoveMode() == AURA_REMOVE_BY_EXPIRE)
|
||||
if (GetTargetApplication()->GetRemoveMode().HasFlag(AuraRemoveFlags::ByEnemySpell | AuraRemoveFlags::Expired))
|
||||
if (Unit* target = GetTarget())
|
||||
target->CastSpell(target, SPELL_BLACKOUT_DAMAGE, true);
|
||||
}
|
||||
|
||||
+3
-3
@@ -797,7 +797,7 @@ struct boss_nefarians_end : public BossAI
|
||||
|
||||
if (Creature* onyxia = instance->GetCreature(DATA_ONYXIA))
|
||||
if (Aura* charge = onyxia->GetAura(SPELL_ELECTRICAL_CHARGE_ONYXIA))
|
||||
charge->ModStackAmount(17, AURA_REMOVE_BY_DEFAULT, false);
|
||||
charge->ModStackAmount(17, AuraRemoveFlags::ByDefault | AuraRemoveFlags::DontResetPeriodicTimer);
|
||||
break;
|
||||
case EVENT_DOMINION:
|
||||
DoCastAOE(SPELL_DOMINION_DUMMY);
|
||||
@@ -1402,7 +1402,7 @@ class spell_nefarians_end_electrical_charge : public AuraScript
|
||||
if (Creature* onyxia = instance->GetCreature(DATA_ONYXIA))
|
||||
{
|
||||
if (Aura* charge = onyxia->GetAura(SPELL_ELECTRICAL_CHARGE_ONYXIA))
|
||||
charge->ModStackAmount(1, AURA_REMOVE_BY_DEFAULT, false);
|
||||
charge->ModStackAmount(1, AuraRemoveFlags::Expired | AuraRemoveFlags::DontResetPeriodicTimer);
|
||||
}
|
||||
}
|
||||
break;
|
||||
@@ -2064,7 +2064,7 @@ class spell_nefarians_end_explosive_cinders : public AuraScript
|
||||
|
||||
void AfterRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
|
||||
{
|
||||
if (GetTargetApplication()->GetRemoveMode() == AURA_REMOVE_BY_EXPIRE)
|
||||
if (GetTargetApplication()->GetRemoveMode().HasFlag(AuraRemoveFlags::Expired))
|
||||
GetTarget()->CastSpell(GetTarget(), SPELL_EXPLOSIVE_CINDERS_EXPLOSION, true);
|
||||
}
|
||||
|
||||
|
||||
+2
-2
@@ -1287,7 +1287,7 @@ class spell_omnotron_recharging : public AuraScript
|
||||
|
||||
void AfterRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
|
||||
{
|
||||
if (GetTargetApplication()->GetRemoveMode() == AURA_REMOVE_BY_EXPIRE)
|
||||
if (GetTargetApplication()->GetRemoveMode().HasFlag(AuraRemoveFlags::Expired))
|
||||
if (Creature* golem = GetTarget()->ToCreature())
|
||||
if (golem->IsAIEnabled)
|
||||
golem->AI()->DoAction(ACTION_ACTIVATE_GOLEM);
|
||||
@@ -1495,7 +1495,7 @@ class spell_omnotron_barrier : public AuraScript
|
||||
|
||||
void HandleAbsorbRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
|
||||
{
|
||||
if (GetTargetApplication()->GetRemoveMode() == AURA_REMOVE_BY_ENEMY_SPELL)
|
||||
if (GetTargetApplication()->GetRemoveMode().HasFlag(AuraRemoveFlags::ByEnemySpell))
|
||||
if (Unit* caster = GetCaster())
|
||||
caster->CastSpell(caster, SPELL_BACKDRAFT, true);
|
||||
}
|
||||
|
||||
@@ -335,7 +335,7 @@ class spell_cookie_satiated : public SpellScriptLoader
|
||||
{
|
||||
if (Unit* caster = GetCaster())
|
||||
if (Aura* nauseatedAura = caster->GetAura(GetSpellInfo()->Effects[effIndex].BasePoints))
|
||||
nauseatedAura->ModStackAmount(-1, AURA_REMOVE_BY_DEFAULT, false);
|
||||
nauseatedAura->ModStackAmount(-1, AuraRemoveFlags::ByDefault | AuraRemoveFlags::DontResetPeriodicTimer);
|
||||
}
|
||||
|
||||
void Register() override
|
||||
|
||||
@@ -553,7 +553,7 @@ class spell_erudax_twilight_corruption: public SpellScriptLoader
|
||||
|
||||
void OnAuraRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
|
||||
{
|
||||
if (GetTargetApplication()->GetRemoveMode() == AURA_REMOVE_BY_DEATH)
|
||||
if (GetTargetApplication()->GetRemoveMode().HasFlag(AuraRemoveFlags::ByDeath))
|
||||
{
|
||||
if (Unit* caster = GetCaster())
|
||||
if (Creature* creature = caster->ToCreature())
|
||||
|
||||
@@ -63,7 +63,7 @@ class spell_sfk_shield_of_bones : public AuraScript
|
||||
|
||||
void OnAuraRemoveHandler(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
|
||||
{
|
||||
if (GetTargetApplication()->GetRemoveMode() == AURA_REMOVE_BY_ENEMY_SPELL)
|
||||
if (GetTargetApplication()->GetRemoveMode().HasFlag(AuraRemoveFlags::ByEnemySpell))
|
||||
if (Unit* caster = GetCaster())
|
||||
caster->CastSpell(caster, SPELL_SHIELD_OF_BONES_TRIGGERED, true);
|
||||
}
|
||||
|
||||
@@ -647,7 +647,7 @@ class spell_dark_fiend_skin : public SpellScriptLoader
|
||||
|
||||
void OnRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
|
||||
{
|
||||
if (GetTargetApplication()->GetRemoveMode() != AURA_REMOVE_BY_ENEMY_SPELL)
|
||||
if (!GetTargetApplication()->GetRemoveMode().HasFlag(AuraRemoveFlags::ByEnemySpell))
|
||||
return;
|
||||
|
||||
if (Creature* target = GetTarget()->ToCreature())
|
||||
|
||||
@@ -473,7 +473,7 @@ class spell_countdown_p2 : public SpellScriptLoader
|
||||
|
||||
void OnRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
|
||||
{
|
||||
if (GetTargetApplication()->GetRemoveMode() == AURA_REMOVE_BY_EXPIRE)
|
||||
if (GetTargetApplication()->GetRemoveMode().HasFlag(AuraRemoveFlags::Expired))
|
||||
GetTarget()->CastSpell((Unit*)nullptr, SPELL_COUNTDOWN_4, true);
|
||||
GetTarget()->ToPlayer()->RemoveAurasDueToSpell(SPELL_COUNTDOWN_5);
|
||||
}
|
||||
@@ -742,7 +742,7 @@ class spell_baleroc_tormented : public SpellScriptLoader
|
||||
|
||||
void OnRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
|
||||
{
|
||||
if (GetTargetApplication()->GetRemoveMode() != AURA_REMOVE_BY_DEATH)
|
||||
if (!GetTargetApplication()->GetRemoveMode().HasFlag(AuraRemoveFlags::ByDeath))
|
||||
{
|
||||
if (GetTarget()->GetMap()->IsHeroic())
|
||||
GetTarget()->CastSpell(GetTarget(), SPELL_TORMENTED_40, true);
|
||||
|
||||
@@ -388,7 +388,7 @@ class spell_anhuur_reverberating_hymn : public AuraScript
|
||||
|
||||
void AfterRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
|
||||
{
|
||||
if (GetTargetApplication()->GetRemoveMode() == AURA_REMOVE_BY_EXPIRE)
|
||||
if (GetTargetApplication()->GetRemoveMode().HasFlag(AuraRemoveFlags::Expired))
|
||||
if (Creature * anhuur = GetCaster()->ToCreature())
|
||||
if (anhuur->IsAIEnabled)
|
||||
anhuur->AI()->DoAction(ACTION_HYMN_EXPIRED);
|
||||
|
||||
@@ -1078,7 +1078,7 @@ class spell_conclave_of_wind_winds_pre_effect_warning : public AuraScript
|
||||
|
||||
void OnAuraRemoveHandler(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
|
||||
{
|
||||
if (GetTargetApplication()->GetRemoveMode() == AURA_REMOVE_BY_EXPIRE)
|
||||
if (GetTargetApplication()->GetRemoveMode().HasFlag(AuraRemoveFlags::Expired))
|
||||
if (Unit* caster = GetCaster())
|
||||
if (Creature* conclave = caster->ToCreature())
|
||||
if (conclave->IsAIEnabled)
|
||||
|
||||
@@ -296,7 +296,7 @@ class spell_ozruk_paralyze_stun : public AuraScript
|
||||
|
||||
void OnAuraRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
|
||||
{
|
||||
if (GetTargetApplication()->GetRemoveMode() == AURA_REMOVE_BY_EXPIRE)
|
||||
if (GetTargetApplication()->GetRemoveMode().HasFlag(AuraRemoveFlags::Expired))
|
||||
if (Unit* target = GetUnitOwner())
|
||||
target->CastSpell(target, SPELL_PARALYZE_DAMAGE, true);
|
||||
}
|
||||
|
||||
@@ -1058,7 +1058,7 @@ class spell_hadronox_leeching_poison : public SpellScriptLoader
|
||||
|
||||
void HandleEffectRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
|
||||
{
|
||||
if (GetTargetApplication()->GetRemoveMode() != AURA_REMOVE_BY_DEATH)
|
||||
if (!GetTargetApplication()->GetRemoveMode().HasFlag(AuraRemoveFlags::ByDeath))
|
||||
return;
|
||||
|
||||
if (GetTarget()->IsGuardian())
|
||||
|
||||
+1
-1
@@ -1009,7 +1009,7 @@ class spell_gatewatcher_web_wrap : public SpellScriptLoader
|
||||
|
||||
void HandleEffectRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
|
||||
{
|
||||
if (GetTargetApplication()->GetRemoveMode() != AURA_REMOVE_BY_EXPIRE)
|
||||
if (!GetTargetApplication()->GetRemoveMode().HasFlag(AuraRemoveFlags::Expired))
|
||||
return;
|
||||
|
||||
if (Unit* target = GetTarget())
|
||||
|
||||
@@ -1416,7 +1416,7 @@ class spell_halion_meteor_strike_marker : public SpellScriptLoader
|
||||
if (!GetCaster())
|
||||
return;
|
||||
|
||||
if (GetTargetApplication()->GetRemoveMode() == AURA_REMOVE_BY_EXPIRE)
|
||||
if (GetTargetApplication()->GetRemoveMode().HasFlag(AuraRemoveFlags::Expired))
|
||||
if (Creature* creCaster = GetCaster()->ToCreature())
|
||||
creCaster->AI()->DoAction(ACTION_METEOR_STRIKE_AOE);
|
||||
}
|
||||
@@ -1452,11 +1452,11 @@ class spell_halion_combustion_consumption : public SpellScriptLoader
|
||||
|
||||
void OnRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
|
||||
{
|
||||
if (GetTargetApplication()->GetRemoveMode() == AURA_REMOVE_BY_DEATH)
|
||||
if (GetTargetApplication()->GetRemoveMode().HasFlag(AuraRemoveFlags::ByDeath))
|
||||
return;
|
||||
|
||||
if (GetTarget()->HasAura(_markSpell))
|
||||
GetTarget()->RemoveAurasDueToSpell(_markSpell, ObjectGuid::Empty, 0, AURA_REMOVE_BY_EXPIRE);
|
||||
GetTarget()->RemoveAurasDueToSpell(_markSpell, ObjectGuid::Empty, 0, AuraRemoveFlags::Expired);
|
||||
}
|
||||
|
||||
void OnApply(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
|
||||
@@ -1554,12 +1554,12 @@ class spell_halion_marks : public SpellScriptLoader
|
||||
|
||||
if (Unit* dispelledUnit = GetUnitOwner())
|
||||
if (dispelledUnit->HasAura(_removeSpellId))
|
||||
dispelledUnit->RemoveAurasDueToSpell(_removeSpellId, ObjectGuid::Empty, 0, AURA_REMOVE_BY_EXPIRE);
|
||||
dispelledUnit->RemoveAurasDueToSpell(_removeSpellId, ObjectGuid::Empty, 0, AuraRemoveFlags::Expired);
|
||||
}
|
||||
|
||||
void OnRemove(AuraEffect const* aurEff, AuraEffectHandleModes /*mode*/)
|
||||
{
|
||||
if (GetTargetApplication()->GetRemoveMode() != AURA_REMOVE_BY_EXPIRE)
|
||||
if (!GetTargetApplication()->GetRemoveMode().HasFlag(AuraRemoveFlags::Expired))
|
||||
return;
|
||||
|
||||
// Stacks marker
|
||||
@@ -1655,7 +1655,7 @@ class spell_halion_twilight_realm_handlers : public SpellScriptLoader
|
||||
if (!target)
|
||||
return;
|
||||
|
||||
target->RemoveAurasDueToSpell(_beforeHitSpellId, ObjectGuid::Empty, 0, AURA_REMOVE_BY_ENEMY_SPELL);
|
||||
target->RemoveAurasDueToSpell(_beforeHitSpellId, ObjectGuid::Empty, 0, AuraRemoveFlags::ByEnemySpell);
|
||||
if (InstanceScript* instance = target->GetInstanceScript())
|
||||
instance->SendEncounterUnit(ENCOUNTER_FRAME_UNK7);
|
||||
}
|
||||
|
||||
@@ -144,7 +144,7 @@ class spell_marwyn_shared_suffering : public SpellScriptLoader
|
||||
|
||||
void HandleEffectRemove(AuraEffect const* aurEff, AuraEffectHandleModes /*mode*/)
|
||||
{
|
||||
if (GetTargetApplication()->GetRemoveMode() != AURA_REMOVE_BY_ENEMY_SPELL)
|
||||
if (!GetTargetApplication()->GetRemoveMode().HasFlag(AuraRemoveFlags::ByEnemySpell))
|
||||
return;
|
||||
|
||||
if (Unit* caster = GetCaster())
|
||||
|
||||
@@ -246,7 +246,7 @@ class spell_trash_npc_glacial_strike : public SpellScriptLoader
|
||||
{
|
||||
if (GetTarget()->IsFullHealth())
|
||||
{
|
||||
GetTarget()->RemoveAura(GetId(), ObjectGuid::Empty, 0, AURA_REMOVE_BY_ENEMY_SPELL);
|
||||
GetTarget()->RemoveAura(GetId(), ObjectGuid::Empty, 0, AuraRemoveFlags::ByEnemySpell);
|
||||
PreventDefaultAction();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -502,7 +502,7 @@ class spell_blood_queen_vampiric_bite : public SpellScriptLoader
|
||||
return;
|
||||
|
||||
uint32 spellId = sSpellMgr->GetSpellIdForDifficulty(SPELL_FRENZIED_BLOODTHIRST, GetCaster());
|
||||
GetCaster()->RemoveAura(spellId, ObjectGuid::Empty, 0, AURA_REMOVE_BY_ENEMY_SPELL);
|
||||
GetCaster()->RemoveAura(spellId, ObjectGuid::Empty, 0, AuraRemoveFlags::ByEnemySpell);
|
||||
GetCaster()->CastSpell(GetCaster(), SPELL_ESSENCE_OF_THE_BLOOD_QUEEN_PLR, TRIGGERED_FULL_MASK);
|
||||
|
||||
// Shadowmourne questline
|
||||
@@ -561,7 +561,7 @@ class spell_blood_queen_frenzied_bloodthirst : public SpellScriptLoader
|
||||
void OnRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
|
||||
{
|
||||
Unit* target = GetTarget();
|
||||
if (GetTargetApplication()->GetRemoveMode() == AURA_REMOVE_BY_EXPIRE)
|
||||
if (GetTargetApplication()->GetRemoveMode().HasFlag(AuraRemoveFlags::Expired))
|
||||
if (InstanceScript* instance = target->GetInstanceScript())
|
||||
if (Creature* bloodQueen = ObjectAccessor::GetCreature(*target, instance->GetGuidData(DATA_BLOOD_QUEEN_LANA_THEL)))
|
||||
{
|
||||
|
||||
@@ -1826,7 +1826,7 @@ class spell_igb_rocket_pack : public SpellScriptLoader
|
||||
void HandlePeriodic(AuraEffect const* /*aurEff*/)
|
||||
{
|
||||
if (GetTarget()->movespline->Finalized())
|
||||
Remove(AURA_REMOVE_BY_EXPIRE);
|
||||
Remove(AuraRemoveFlags::Expired);
|
||||
}
|
||||
|
||||
void HandleRemove(AuraEffect const* aurEff, AuraEffectHandleModes /*mode*/)
|
||||
|
||||
@@ -1078,7 +1078,7 @@ class spell_putricide_ooze_eruption_searcher : public SpellScriptLoader
|
||||
uint32 adhesiveId = sSpellMgr->GetSpellIdForDifficulty(SPELL_VOLATILE_OOZE_ADHESIVE, GetCaster());
|
||||
if (GetHitUnit()->HasAura(adhesiveId))
|
||||
{
|
||||
GetHitUnit()->RemoveAurasDueToSpell(adhesiveId, GetCaster()->GetGUID(), 0, AURA_REMOVE_BY_ENEMY_SPELL);
|
||||
GetHitUnit()->RemoveAurasDueToSpell(adhesiveId, GetCaster()->GetGUID(), 0, AuraRemoveFlags::ByEnemySpell);
|
||||
GetCaster()->CastSpell(GetHitUnit(), SPELL_OOZE_ERUPTION, true);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1241,7 +1241,7 @@ class spell_sindragosa_instability : public SpellScriptLoader
|
||||
|
||||
void OnRemove(AuraEffect const* aurEff, AuraEffectHandleModes /*mode*/)
|
||||
{
|
||||
if (GetTargetApplication()->GetRemoveMode() == AURA_REMOVE_BY_EXPIRE)
|
||||
if (GetTargetApplication()->GetRemoveMode().HasFlag(AuraRemoveFlags::Expired))
|
||||
GetTarget()->CastCustomSpell(SPELL_BACKLASH, SPELLVALUE_BASE_POINT0, aurEff->GetAmount(), GetTarget(), true, nullptr, aurEff, GetCasterGUID());
|
||||
}
|
||||
|
||||
|
||||
@@ -1676,7 +1676,7 @@ class npc_strangulate_vehicle : public CreatureScript
|
||||
else
|
||||
{
|
||||
summoner->CastSpell(summoner, SPELL_HARVEST_SOULS_TELEPORT, true);
|
||||
summoner->RemoveAurasDueToSpell(HARVEST_SOUL, ObjectGuid::Empty, 0, AURA_REMOVE_BY_EXPIRE);
|
||||
summoner->RemoveAurasDueToSpell(HARVEST_SOUL, ObjectGuid::Empty, 0, AuraRemoveFlags::Expired);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2064,7 +2064,7 @@ class spell_the_lich_king_infest : public SpellScriptLoader
|
||||
if (GetUnitOwner()->HealthAbovePct(90))
|
||||
{
|
||||
PreventDefaultAction();
|
||||
Remove(AURA_REMOVE_BY_ENEMY_SPELL);
|
||||
Remove(AuraRemoveFlags::ByEnemySpell);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2106,15 +2106,8 @@ class spell_the_lich_king_necrotic_plague : public SpellScriptLoader
|
||||
|
||||
void OnRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
|
||||
{
|
||||
switch (GetTargetApplication()->GetRemoveMode())
|
||||
{
|
||||
case AURA_REMOVE_BY_ENEMY_SPELL:
|
||||
case AURA_REMOVE_BY_EXPIRE:
|
||||
case AURA_REMOVE_BY_DEATH:
|
||||
break;
|
||||
default:
|
||||
return;
|
||||
}
|
||||
if (!GetTargetApplication()->GetRemoveMode().HasFlag(AuraRemoveFlags::ByEnemySpell | AuraRemoveFlags::Expired | AuraRemoveFlags::ByDeath))
|
||||
return;
|
||||
|
||||
CustomSpellValues values;
|
||||
//values.AddSpellMod(SPELLVALUE_AURA_STACK, 2);
|
||||
@@ -2169,7 +2162,7 @@ class spell_the_lich_king_necrotic_plague_jump : public SpellScriptLoader
|
||||
|
||||
void AddMissingStack()
|
||||
{
|
||||
if (GetHitAura() && !_hadAura && GetSpellValue()->EffectBasePoints[EFFECT_1] != AURA_REMOVE_BY_ENEMY_SPELL)
|
||||
if (GetHitAura() && !_hadAura && GetSpellValue()->EffectBasePoints[EFFECT_1] != static_cast<uint32>(AuraRemoveFlags::ByEnemySpell))
|
||||
GetHitAura()->ModStackAmount(1);
|
||||
}
|
||||
|
||||
@@ -2204,20 +2197,15 @@ class spell_the_lich_king_necrotic_plague_jump : public SpellScriptLoader
|
||||
void OnRemove(AuraEffect const* aurEff, AuraEffectHandleModes /*mode*/)
|
||||
{
|
||||
_lastAmount = aurEff->GetAmount();
|
||||
switch (GetTargetApplication()->GetRemoveMode())
|
||||
{
|
||||
case AURA_REMOVE_BY_EXPIRE:
|
||||
case AURA_REMOVE_BY_DEATH:
|
||||
break;
|
||||
default:
|
||||
return;
|
||||
}
|
||||
|
||||
CustomSpellValues values;
|
||||
values.AddSpellMod(SPELLVALUE_AURA_STACK, GetStackAmount());
|
||||
GetTarget()->CastCustomSpell(SPELL_NECROTIC_PLAGUE_JUMP, values, nullptr, TRIGGERED_FULL_MASK, nullptr, nullptr, GetCasterGUID());
|
||||
if (Unit* caster = GetCaster())
|
||||
caster->CastSpell(caster, SPELL_PLAGUE_SIPHON, true);
|
||||
if (GetTargetApplication()->GetRemoveMode().HasFlag(AuraRemoveFlags::Expired | AuraRemoveFlags::ByDeath))
|
||||
{
|
||||
CustomSpellValues values;
|
||||
values.AddSpellMod(SPELLVALUE_AURA_STACK, GetStackAmount());
|
||||
GetTarget()->CastCustomSpell(SPELL_NECROTIC_PLAGUE_JUMP, values, nullptr, TRIGGERED_FULL_MASK, nullptr, nullptr, GetCasterGUID());
|
||||
if (Unit* caster = GetCaster())
|
||||
caster->CastSpell(caster, SPELL_PLAGUE_SIPHON, true);
|
||||
}
|
||||
}
|
||||
|
||||
void OnDispel(AuraEffect const* aurEff, AuraEffectHandleModes /*mode*/)
|
||||
@@ -2233,12 +2221,12 @@ class spell_the_lich_king_necrotic_plague_jump : public SpellScriptLoader
|
||||
|
||||
CustomSpellValues values;
|
||||
values.AddSpellMod(SPELLVALUE_AURA_STACK, GetStackAmount());
|
||||
values.AddSpellMod(SPELLVALUE_BASE_POINT1, AURA_REMOVE_BY_ENEMY_SPELL); // add as marker (spell has no effect 1)
|
||||
values.AddSpellMod(SPELLVALUE_BASE_POINT1, static_cast<uint32>(AuraRemoveFlags::ByEnemySpell)); // add as marker (spell has no effect 1)
|
||||
GetTarget()->CastCustomSpell(SPELL_NECROTIC_PLAGUE_JUMP, values, nullptr, TRIGGERED_FULL_MASK, nullptr, nullptr, GetCasterGUID());
|
||||
if (Unit* caster = GetCaster())
|
||||
caster->CastSpell(caster, SPELL_PLAGUE_SIPHON, true);
|
||||
|
||||
Remove(AURA_REMOVE_BY_ENEMY_SPELL);
|
||||
Remove(AuraRemoveFlags::ByEnemySpell);
|
||||
}
|
||||
|
||||
void Register() override
|
||||
@@ -2274,7 +2262,7 @@ class spell_the_lich_king_shadow_trap_visual : public SpellScriptLoader
|
||||
|
||||
void OnRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
|
||||
{
|
||||
if (GetTargetApplication()->GetRemoveMode() == AURA_REMOVE_BY_EXPIRE)
|
||||
if (GetTargetApplication()->GetRemoveMode().HasFlag(AuraRemoveFlags::Expired))
|
||||
GetTarget()->CastSpell(GetTarget(), SPELL_SHADOW_TRAP_AURA, TRIGGERED_NONE);
|
||||
}
|
||||
|
||||
@@ -2844,7 +2832,7 @@ class spell_the_lich_king_harvest_soul : public SpellScriptLoader
|
||||
void OnRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
|
||||
{
|
||||
// m_originalCaster to allow stacking from different casters, meh
|
||||
if (GetTargetApplication()->GetRemoveMode() == AURA_REMOVE_BY_DEATH)
|
||||
if (GetTargetApplication()->GetRemoveMode().HasFlag(AuraRemoveFlags::ByDeath))
|
||||
GetTarget()->CastSpell((Unit*)nullptr, SPELL_HARVESTED_SOUL, true, nullptr, nullptr, GetTarget()->GetInstanceScript()->GetGuidData(DATA_THE_LICH_KING));
|
||||
}
|
||||
|
||||
@@ -3040,7 +3028,7 @@ class spell_the_lich_king_in_frostmourne_room : public SpellScriptLoader
|
||||
void OnRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
|
||||
{
|
||||
// m_originalCaster to allow stacking from different casters, meh
|
||||
if (GetTargetApplication()->GetRemoveMode() == AURA_REMOVE_BY_DEATH)
|
||||
if (GetTargetApplication()->GetRemoveMode().HasFlag(AuraRemoveFlags::ByDeath))
|
||||
GetTarget()->CastSpell((Unit*)nullptr, SPELL_HARVESTED_SOUL, true, nullptr, nullptr, GetTarget()->GetInstanceScript()->GetGuidData(DATA_THE_LICH_KING));
|
||||
}
|
||||
|
||||
|
||||
@@ -156,8 +156,8 @@ class spell_grobbulus_mutating_injection : public SpellScriptLoader
|
||||
|
||||
void HandleRemove(AuraEffect const* aurEff, AuraEffectHandleModes /*mode*/)
|
||||
{
|
||||
AuraRemoveMode removeMode = GetTargetApplication()->GetRemoveMode();
|
||||
if (removeMode != AURA_REMOVE_BY_ENEMY_SPELL && removeMode != AURA_REMOVE_BY_EXPIRE)
|
||||
if (!GetTargetApplication()->GetRemoveMode().HasFlag(AuraRemoveFlags::ByEnemySpell)
|
||||
&& !GetTargetApplication()->GetRemoveMode().HasFlag(AuraRemoveFlags::Expired))
|
||||
return;
|
||||
|
||||
if (Unit* caster = GetCaster())
|
||||
|
||||
@@ -178,7 +178,7 @@ class spell_loatheb_deathbloom : public SpellScriptLoader
|
||||
|
||||
void AfterRemove(AuraEffect const* eff, AuraEffectHandleModes /*mode*/)
|
||||
{
|
||||
if (GetTargetApplication()->GetRemoveMode() != AURA_REMOVE_BY_EXPIRE)
|
||||
if (!GetTargetApplication()->GetRemoveMode().HasFlag(AuraRemoveFlags::Expired))
|
||||
return;
|
||||
|
||||
GetTarget()->CastSpell(nullptr, SPELL_DEATHBLOOM_FINAL_DAMAGE, true, nullptr, eff, GetCasterGUID());
|
||||
|
||||
@@ -527,7 +527,7 @@ class spell_oculus_shock_lance : public SpellScriptLoader
|
||||
if (AuraEffect const* shockCharges = target->GetAuraEffect(SPELL_AMBER_SHOCK_CHARGE, EFFECT_0, GetCaster()->GetGUID()))
|
||||
{
|
||||
damage += shockCharges->GetAmount();
|
||||
shockCharges->GetBase()->Remove(AURA_REMOVE_BY_ENEMY_SPELL);
|
||||
shockCharges->GetBase()->Remove(AuraRemoveFlags::ByEnemySpell);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1072,7 +1072,7 @@ class spell_algalon_phase_punch : public SpellScriptLoader
|
||||
GetTarget()->RemoveAurasDueToSpell(PhasePunchAlphaId[GetStackAmount() - 2]);
|
||||
GetTarget()->CastSpell(GetTarget(), PhasePunchAlphaId[GetStackAmount() - 1], TRIGGERED_FULL_MASK);
|
||||
if (GetStackAmount() == 5)
|
||||
Remove(AURA_REMOVE_BY_DEFAULT);
|
||||
Remove(AuraRemoveFlags::ByDefault);
|
||||
}
|
||||
|
||||
void OnRemove(AuraEffect const*, AuraEffectHandleModes)
|
||||
|
||||
@@ -664,7 +664,7 @@ class spell_shield_of_runes : public SpellScriptLoader
|
||||
void OnRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
|
||||
{
|
||||
if (Unit* caster = GetCaster())
|
||||
if (GetTargetApplication()->GetRemoveMode() != AURA_REMOVE_BY_EXPIRE)
|
||||
if (!GetTargetApplication()->GetRemoveMode().HasFlag(AuraRemoveFlags::Expired))
|
||||
caster->CastSpell(caster, SPELL_SHIELD_OF_RUNES_BUFF, false);
|
||||
}
|
||||
|
||||
|
||||
@@ -532,7 +532,7 @@ class spell_ulduar_stone_grip_absorb : public SpellScriptLoader
|
||||
//! What we do here is remove all harmful aura's related and teleport to safe spot.
|
||||
void OnRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
|
||||
{
|
||||
if (GetTargetApplication()->GetRemoveMode() != AURA_REMOVE_BY_ENEMY_SPELL)
|
||||
if (!GetTargetApplication()->GetRemoveMode().HasFlag(AuraRemoveFlags::ByEnemySpell))
|
||||
return;
|
||||
|
||||
if (!GetOwner()->ToCreature())
|
||||
|
||||
@@ -2121,7 +2121,7 @@ class spell_iron_ring_guard_impale : public SpellScriptLoader
|
||||
{
|
||||
if (GetTarget()->HealthAbovePct(GetSpellInfo()->Effects[EFFECT_1].CalcValue()))
|
||||
{
|
||||
Remove(AURA_REMOVE_BY_ENEMY_SPELL);
|
||||
Remove(AuraRemoveFlags::ByEnemySpell);
|
||||
PreventDefaultAction();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1979,7 +1979,7 @@ class SanityReduction : public SpellScript
|
||||
{
|
||||
if (Unit* target = GetHitUnit())
|
||||
if (Aura* sanity = target->GetAura(SPELL_SANITY))
|
||||
sanity->ModStackAmount(-int32(_stacks), AURA_REMOVE_BY_ENEMY_SPELL);
|
||||
sanity->ModStackAmount(-int32(_stacks), AuraRemoveFlags::ByEnemySpell);
|
||||
}
|
||||
|
||||
protected:
|
||||
@@ -2077,15 +2077,8 @@ class spell_yogg_saron_malady_of_the_mind : public SpellScriptLoader // 63830
|
||||
|
||||
void OnRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
|
||||
{
|
||||
switch (GetTargetApplication()->GetRemoveMode())
|
||||
{
|
||||
case AURA_REMOVE_BY_ENEMY_SPELL:
|
||||
case AURA_REMOVE_BY_EXPIRE:
|
||||
case AURA_REMOVE_BY_DEATH:
|
||||
break;
|
||||
default:
|
||||
return;
|
||||
}
|
||||
if (!GetTargetApplication()->GetRemoveMode().HasFlag(AuraRemoveFlags::ByEnemySpell | AuraRemoveFlags::Expired | AuraRemoveFlags::ByDeath))
|
||||
return;
|
||||
|
||||
GetTarget()->CastSpell(GetTarget(), SPELL_MALADY_OF_THE_MIND_JUMP);
|
||||
}
|
||||
@@ -2153,7 +2146,7 @@ class spell_yogg_saron_brain_link : public SpellScriptLoader // 63802
|
||||
|
||||
if (SaraAI* ai = CAST_AI(SaraAI, caster->GetAI()))
|
||||
{
|
||||
if (GetTargetApplication()->GetRemoveMode() == AURA_REMOVE_BY_EXPIRE)
|
||||
if (GetTargetApplication()->GetRemoveMode().HasFlag(AuraRemoveFlags::Expired))
|
||||
ai->RemoveLinkFrom(GetTarget()->GetGUID());
|
||||
else
|
||||
{
|
||||
@@ -2772,7 +2765,7 @@ class spell_yogg_saron_induce_madness : public SpellScriptLoader // 64059
|
||||
if (Unit* target = GetHitUnit())
|
||||
{
|
||||
target->CastSpell(target, SPELL_TELEPORT_BACK_TO_MAIN_ROOM);
|
||||
target->RemoveAurasDueToSpell(SPELL_SANITY, ObjectGuid::Empty, 0, AURA_REMOVE_BY_ENEMY_SPELL);
|
||||
target->RemoveAurasDueToSpell(SPELL_SANITY, ObjectGuid::Empty, 0, AuraRemoveFlags::ByEnemySpell);
|
||||
target->RemoveAurasDueToSpell(uint32(GetEffectValue()));
|
||||
}
|
||||
}
|
||||
@@ -2841,7 +2834,7 @@ class spell_yogg_saron_sanity : public SpellScriptLoader // 63050
|
||||
|
||||
void OnRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
|
||||
{
|
||||
if (GetTargetApplication()->GetRemoveMode() != AURA_REMOVE_BY_ENEMY_SPELL)
|
||||
if (!GetTargetApplication()->GetRemoveMode().HasFlag(AuraRemoveFlags::ByEnemySpell))
|
||||
return;
|
||||
|
||||
if (InstanceScript* instance = GetTarget()->GetInstanceScript())
|
||||
|
||||
@@ -346,7 +346,7 @@ class spell_frost_tomb : public SpellScriptLoader
|
||||
|
||||
void OnRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
|
||||
{
|
||||
if (GetTargetApplication()->GetRemoveMode() != AURA_REMOVE_BY_DEATH)
|
||||
if (!GetTargetApplication()->GetRemoveMode().HasFlag(AuraRemoveFlags::ByDeath))
|
||||
if (Unit* caster = GetCaster())
|
||||
if (caster->IsAlive())
|
||||
if (Creature* creature = caster->ToCreature())
|
||||
|
||||
@@ -183,7 +183,7 @@ class boss_ichoron : public CreatureScript
|
||||
BossAI::SummonedCreatureDespawn(summon);
|
||||
|
||||
if (summons.empty())
|
||||
me->RemoveAurasDueToSpell(SPELL_DRAINED, ObjectGuid::Empty, 0, AURA_REMOVE_BY_EXPIRE);
|
||||
me->RemoveAurasDueToSpell(SPELL_DRAINED, ObjectGuid::Empty, 0, AuraRemoveFlags::Expired);
|
||||
}
|
||||
|
||||
void UpdateAI(uint32 diff) override
|
||||
@@ -323,7 +323,7 @@ class spell_ichoron_drained : public SpellScriptLoader
|
||||
GetTarget()->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE | UNIT_FLAG_UNK_31);
|
||||
GetTarget()->RemoveFlag(UNIT_FIELD_FLAGS_2, UNIT_FLAG2_FEIGN_DEATH);
|
||||
|
||||
if (GetTargetApplication()->GetRemoveMode() == AURA_REMOVE_BY_EXPIRE)
|
||||
if (GetTargetApplication()->GetRemoveMode().HasFlag(AuraRemoveFlags::Expired))
|
||||
if (GetTarget()->IsAIEnabled)
|
||||
GetTarget()->GetAI()->DoAction(ACTION_DRAINED);
|
||||
}
|
||||
@@ -396,7 +396,7 @@ class spell_ichoron_protective_bubble : public SpellScriptLoader
|
||||
|
||||
void HandleShatter(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
|
||||
{
|
||||
//if (GetTargetApplication()->GetRemoveMode() == AURA_REMOVE_BY_ENEMY_SPELL)
|
||||
//if (GetTargetApplication()->GetRemoveMode().HasFlag(AuraRemoveFlags::ByEnemySpell))
|
||||
if (GetAura()->GetCharges() <= 1)
|
||||
if (GetTarget()->IsAIEnabled)
|
||||
GetTarget()->GetAI()->DoAction(ACTION_PROTECTIVE_BUBBLE_SHATTERED);
|
||||
@@ -445,7 +445,7 @@ class spell_ichoron_splatter : public SpellScriptLoader
|
||||
|
||||
void HandleRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
|
||||
{
|
||||
if (GetTargetApplication()->GetRemoveMode() == AURA_REMOVE_BY_EXPIRE)
|
||||
if (GetTargetApplication()->GetRemoveMode().HasFlag(AuraRemoveFlags::Expired))
|
||||
if (Aura* aura = GetTarget()->GetAura(SPELL_SHRINK))
|
||||
aura->ModStackAmount(10);
|
||||
}
|
||||
|
||||
@@ -714,7 +714,7 @@ public:
|
||||
|
||||
void HandleEffectRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
|
||||
{
|
||||
if (GetTargetApplication()->GetRemoveMode() != AURA_REMOVE_BY_EXPIRE || !GetCaster())
|
||||
if (!GetTargetApplication()->GetRemoveMode().HasFlag(AuraRemoveFlags::Expired) || !GetCaster())
|
||||
return;
|
||||
|
||||
Creature* owner = GetOwner()->ToCreature();
|
||||
|
||||
@@ -1126,7 +1126,7 @@ class spell_grip : public SpellScriptLoader
|
||||
|
||||
// while we could do ModStackAmount(-stacksToRemove), this is how it's done in sniffs :)
|
||||
for (uint32 i = 0; i < stacksToRemove; ++i)
|
||||
ModStackAmount(-1, AURA_REMOVE_BY_EXPIRE);
|
||||
ModStackAmount(-1, AuraRemoveFlags::Expired);
|
||||
|
||||
if (GetStackAmount() < 15 && !_warning)
|
||||
{
|
||||
@@ -1139,7 +1139,7 @@ class spell_grip : public SpellScriptLoader
|
||||
|
||||
void HandleDrop(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
|
||||
{
|
||||
if (GetTargetApplication()->GetRemoveMode() != AURA_REMOVE_BY_EXPIRE)
|
||||
if (!GetTargetApplication()->GetRemoveMode().HasFlag(AuraRemoveFlags::Expired))
|
||||
return;
|
||||
|
||||
GetTarget()->GetAI()->DoAction(ACTION_GRIP_LOST);
|
||||
@@ -1177,7 +1177,7 @@ class spell_grab_on : public SpellScriptLoader
|
||||
void HandleScript(SpellEffIndex /*effIndex*/)
|
||||
{
|
||||
if (Aura* grip = GetCaster()->GetAura(SPELL_GRIP, GetCaster()->GetGUID()))
|
||||
grip->ModStackAmount(GetEffectValue(), AURA_REMOVE_BY_DEFAULT/*, false*/);
|
||||
grip->ModStackAmount(GetEffectValue(), AuraRemoveFlags::ByDefault);
|
||||
}
|
||||
|
||||
void Register() override
|
||||
@@ -1208,7 +1208,7 @@ class spell_loosen_grip : public SpellScriptLoader
|
||||
void HandleScript(SpellEffIndex /*effIndex*/)
|
||||
{
|
||||
if (Aura* grip = GetCaster()->GetAura(SPELL_GRIP))
|
||||
grip->ModStackAmount(-StacksLost, AURA_REMOVE_BY_EXPIRE);
|
||||
grip->ModStackAmount(-StacksLost, AuraRemoveFlags::Expired);
|
||||
}
|
||||
|
||||
void Register() override
|
||||
|
||||
@@ -882,7 +882,7 @@ class spell_fetch_ingredient_aura : public SpellScriptLoader
|
||||
void OnRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
|
||||
{
|
||||
Unit* target = GetTarget();
|
||||
if (GetTargetApplication()->GetRemoveMode() == AURA_REMOVE_BY_EXPIRE)
|
||||
if (GetTargetApplication()->GetRemoveMode().HasFlag(AuraRemoveFlags::Expired))
|
||||
if (target->HasAura(SPELL_ALCHEMIST_APPRENTICE_INVISBUFF))
|
||||
if (Creature* finklestein = GetClosestCreatureWithEntry(target, NPC_FINKLESTEIN, 100.0f))
|
||||
{
|
||||
|
||||
@@ -917,8 +917,7 @@ class spell_illidari_dampen_magic : public SpellScriptLoader
|
||||
{
|
||||
if (Creature* target = GetTarget()->ToCreature())
|
||||
{
|
||||
AuraRemoveMode mode = GetTargetApplication()->GetRemoveMode();
|
||||
if (mode == AURA_REMOVE_BY_ENEMY_SPELL || mode == AURA_REMOVE_BY_EXPIRE)
|
||||
if (GetTargetApplication()->GetRemoveMode().HasFlag(AuraRemoveFlags::ByEnemySpell | AuraRemoveFlags::Expired))
|
||||
target->AI()->DoAction(ACTION_REFRESH_DAMPEN);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -414,7 +414,7 @@ class spell_teron_gorefiend_shadow_of_death : public SpellScriptLoader
|
||||
|
||||
void OnRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
|
||||
{
|
||||
if (GetTargetApplication()->GetRemoveMode() == AURA_REMOVE_BY_EXPIRE)
|
||||
if (GetTargetApplication()->GetRemoveMode().HasFlag(AuraRemoveFlags::Expired))
|
||||
{
|
||||
Unit* target = GetTarget();
|
||||
target->CastSpell(target, SPELL_SUMMON_SPIRIT, true);
|
||||
|
||||
@@ -520,7 +520,7 @@ class spell_astromancer_wrath_of_the_astromancer : public SpellScriptLoader
|
||||
void AfterRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
|
||||
{
|
||||
// Final heal only on duration end
|
||||
if (GetTargetApplication()->GetRemoveMode() != AURA_REMOVE_BY_EXPIRE)
|
||||
if (!GetTargetApplication()->GetRemoveMode().HasFlag(AuraRemoveFlags::Expired))
|
||||
return;
|
||||
|
||||
Unit* target = GetUnitOwner();
|
||||
|
||||
@@ -667,7 +667,7 @@ class spell_dru_lifebloom : public AuraScript
|
||||
void AfterRemove(AuraEffect const* aurEff, AuraEffectHandleModes /*mode*/)
|
||||
{
|
||||
// Final heal only on duration end
|
||||
if (GetTargetApplication()->GetRemoveMode() != AURA_REMOVE_BY_EXPIRE)
|
||||
if (!GetTargetApplication()->GetRemoveMode().HasFlag(AuraRemoveFlags::Expired))
|
||||
return;
|
||||
|
||||
// final heal
|
||||
|
||||
@@ -717,11 +717,11 @@ class spell_gen_break_shield: public SpellScriptLoader
|
||||
SpellInfo const* auraInfo = aura->GetSpellInfo();
|
||||
if (auraInfo && auraInfo->SpellIconID == 2007 && aura->HasEffectType(SPELL_AURA_MOD_DAMAGE_PERCENT_TAKEN))
|
||||
{
|
||||
aura->ModStackAmount(-1, AURA_REMOVE_BY_ENEMY_SPELL);
|
||||
aura->ModStackAmount(-1, AuraRemoveFlags::ByEnemySpell);
|
||||
// Remove dummys from rider (Necessary for updating visual shields)
|
||||
if (Unit* rider = target->GetCharmer())
|
||||
if (Aura* defend = rider->GetAura(aura->GetId()))
|
||||
defend->ModStackAmount(-1, AURA_REMOVE_BY_ENEMY_SPELL);
|
||||
defend->ModStackAmount(-1, AuraRemoveFlags::ByEnemySpell);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -2088,7 +2088,7 @@ class spell_gen_lifebloom : public SpellScriptLoader
|
||||
void AfterRemove(AuraEffect const* aurEff, AuraEffectHandleModes /*mode*/)
|
||||
{
|
||||
// Final heal only on duration end
|
||||
if (GetTargetApplication()->GetRemoveMode() != AURA_REMOVE_BY_EXPIRE && GetTargetApplication()->GetRemoveMode() != AURA_REMOVE_BY_ENEMY_SPELL)
|
||||
if (!GetTargetApplication()->GetRemoveMode().HasAllFlags(AuraRemoveFlags::Expired | AuraRemoveFlags::ByEnemySpell))
|
||||
return;
|
||||
|
||||
// final heal
|
||||
@@ -2215,11 +2215,11 @@ class spell_gen_mounted_charge: public SpellScriptLoader
|
||||
SpellInfo const* auraInfo = aura->GetSpellInfo();
|
||||
if (auraInfo && auraInfo->SpellIconID == 2007 && aura->HasEffectType(SPELL_AURA_MOD_DAMAGE_PERCENT_TAKEN))
|
||||
{
|
||||
aura->ModStackAmount(-1, AURA_REMOVE_BY_ENEMY_SPELL);
|
||||
aura->ModStackAmount(-1, AuraRemoveFlags::ByEnemySpell);
|
||||
// Remove dummys from rider (Necessary for updating visual shields)
|
||||
if (Unit* rider = target->GetCharmer())
|
||||
if (Aura* defend = rider->GetAura(aura->GetId()))
|
||||
defend->ModStackAmount(-1, AURA_REMOVE_BY_ENEMY_SPELL);
|
||||
defend->ModStackAmount(-1, AuraRemoveFlags::ByEnemySpell);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -2622,7 +2622,7 @@ class spell_gen_paralytic_poison : public SpellScriptLoader
|
||||
|
||||
void HandleStun(AuraEffect const* aurEff, AuraEffectHandleModes /*mode*/)
|
||||
{
|
||||
if (GetTargetApplication()->GetRemoveMode() != AURA_REMOVE_BY_EXPIRE)
|
||||
if (!GetTargetApplication()->GetRemoveMode().HasFlag(AuraRemoveFlags::Expired))
|
||||
return;
|
||||
|
||||
GetTarget()->CastSpell((Unit*)nullptr, SPELL_PARALYSIS, true, nullptr, aurEff);
|
||||
@@ -3505,7 +3505,7 @@ class spell_gen_turkey_marker : public SpellScriptLoader
|
||||
|
||||
// pop stack if it expired for us
|
||||
if (_applyTimes.front() + GetMaxDuration() < GameTime::GetGameTimeMS())
|
||||
ModStackAmount(-1, AURA_REMOVE_BY_EXPIRE);
|
||||
ModStackAmount(-1, AuraRemoveFlags::Expired);
|
||||
}
|
||||
|
||||
void Register() override
|
||||
|
||||
@@ -1131,7 +1131,7 @@ class spell_brewfest_giddyup : public SpellScriptLoader
|
||||
break;
|
||||
}
|
||||
|
||||
if (GetTargetApplication()->GetRemoveMode() == AURA_REMOVE_BY_DEFAULT)
|
||||
if (GetTargetApplication()->GetRemoveMode().HasFlag(AuraRemoveFlags::ByDefault))
|
||||
{
|
||||
target->RemoveAura(SPELL_RAM_TROT);
|
||||
target->CastSpell(target, SPELL_RAM_LEVEL_NEUTRAL, true);
|
||||
|
||||
@@ -557,7 +557,7 @@ class spell_hun_misdirection : public SpellScriptLoader
|
||||
|
||||
void OnRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
|
||||
{
|
||||
if (GetTargetApplication()->GetRemoveMode() != AURA_REMOVE_BY_DEFAULT || !GetTarget()->HasAura(SPELL_HUNTER_MISDIRECTION_PROC))
|
||||
if (!GetTargetApplication()->GetRemoveMode().HasFlag(AuraRemoveFlags::ByDefault) || !GetTarget()->HasAura(SPELL_HUNTER_MISDIRECTION_PROC))
|
||||
GetTarget()->ResetRedirectThreat();
|
||||
}
|
||||
|
||||
|
||||
@@ -4711,7 +4711,7 @@ class spell_item_egg_shell : public AuraScript
|
||||
|
||||
void HandleEffectRemove(AuraEffect const* aurEff, AuraEffectHandleModes /*mode*/)
|
||||
{
|
||||
if (GetTargetApplication()->GetRemoveMode() == AURA_REMOVE_BY_CANCEL)
|
||||
if (GetTargetApplication()->GetRemoveMode().HasFlag(AuraRemoveFlags::ByCancel))
|
||||
GetTarget()->CastSpell(GetTarget(), GetSpellInfo()->Id == SPELL_EGG_SHELL_NORMAL ? SPELL_EGG_SHELL_PERIODIC_NORMAL : SPELL_EGG_SHELL_PERIODIC_HEROIC, true, nullptr, aurEff);
|
||||
}
|
||||
|
||||
|
||||
@@ -787,8 +787,7 @@ class spell_mage_living_bomb : public AuraScript
|
||||
|
||||
void AfterRemove(AuraEffect const* aurEff, AuraEffectHandleModes /*mode*/)
|
||||
{
|
||||
AuraRemoveMode removeMode = GetTargetApplication()->GetRemoveMode();
|
||||
if (removeMode != AURA_REMOVE_BY_ENEMY_SPELL && removeMode != AURA_REMOVE_BY_EXPIRE)
|
||||
if (!GetTargetApplication()->GetRemoveMode().HasFlag(AuraRemoveFlags::Expired))
|
||||
return;
|
||||
|
||||
if (Unit* caster = GetCaster())
|
||||
@@ -821,7 +820,7 @@ class spell_mage_ice_barrier : public SpellScriptLoader
|
||||
|
||||
void AfterRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
|
||||
{
|
||||
if (GetTargetApplication()->GetRemoveMode() != AURA_REMOVE_BY_ENEMY_SPELL)
|
||||
if (!GetTargetApplication()->GetRemoveMode().HasFlag(AuraRemoveFlags::ByEnemySpell))
|
||||
return;
|
||||
|
||||
if (GetTarget()->HasAura(SPELL_MAGE_SHATTERED_BARRIER_R1))
|
||||
@@ -984,7 +983,7 @@ class spell_mage_mana_shield : public SpellScriptLoader
|
||||
void AfterRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
|
||||
{
|
||||
if (GetTarget()->GetAuraEffect(SPELL_AURA_DUMMY, SPELLFAMILY_GENERIC, ICON_MAGE_INCANTER_S_ABSORPTION, EFFECT_0))
|
||||
if (GetTargetApplication()->GetRemoveMode() == AURA_REMOVE_BY_ENEMY_SPELL)
|
||||
if (GetTargetApplication()->GetRemoveMode().HasFlag(AuraRemoveFlags::ByEnemySpell))
|
||||
GetTarget()->CastSpell(GetTarget(), SPELL_MAGE_INCANTERS_ABSORBTION_KNOCKBACK, true);
|
||||
}
|
||||
|
||||
@@ -1380,7 +1379,7 @@ class spell_mage_ring_of_frost_freeze : public SpellScriptLoader
|
||||
|
||||
void OnRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
|
||||
{
|
||||
if (GetTargetApplication()->GetRemoveMode() != AURA_REMOVE_BY_EXPIRE)
|
||||
if (!GetTargetApplication()->GetRemoveMode().HasFlag(AuraRemoveFlags::Expired))
|
||||
if (GetCaster())
|
||||
GetCaster()->CastSpell(GetTarget(), SPELL_MAGE_RING_OF_FROST_DUMMY, true);
|
||||
}
|
||||
|
||||
@@ -2544,7 +2544,7 @@ class spell_q10929_fumping : SpellScriptLoader
|
||||
|
||||
void HandleEffectRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
|
||||
{
|
||||
if (GetTargetApplication()->GetRemoveMode() != AURA_REMOVE_BY_EXPIRE)
|
||||
if (!GetTargetApplication()->GetRemoveMode().HasFlag(AuraRemoveFlags::Expired))
|
||||
return;
|
||||
|
||||
if (Unit* caster = GetCaster())
|
||||
|
||||
@@ -941,7 +941,7 @@ class spell_rog_tricks_of_the_trade : public SpellScriptLoader
|
||||
|
||||
void OnRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
|
||||
{
|
||||
if (GetTargetApplication()->GetRemoveMode() != AURA_REMOVE_BY_DEFAULT)
|
||||
if (!GetTargetApplication()->GetRemoveMode().HasFlag(AuraRemoveFlags::ByDefault))
|
||||
GetTarget()->ResetRedirectThreat();
|
||||
}
|
||||
|
||||
@@ -958,7 +958,7 @@ class spell_rog_tricks_of_the_trade : public SpellScriptLoader
|
||||
Unit* target = GetTarget();
|
||||
target->CastSpell(_redirectTarget, SPELL_ROGUE_TRICKS_OF_THE_TRADE_DMG_BOOST, true);
|
||||
target->CastSpell(target, SPELL_ROGUE_TRICKS_OF_THE_TRADE_PROC, true);
|
||||
Remove(AURA_REMOVE_BY_DEFAULT); // maybe handle by proc charges
|
||||
Remove(AuraRemoveFlags::ByDefault); // maybe handle by proc charges
|
||||
}
|
||||
|
||||
void Register() override
|
||||
|
||||
@@ -304,8 +304,7 @@ class spell_warl_bane_of_doom : public SpellScriptLoader
|
||||
if (!GetCaster())
|
||||
return;
|
||||
|
||||
AuraRemoveMode removeMode = GetTargetApplication()->GetRemoveMode();
|
||||
if (removeMode != AURA_REMOVE_BY_DEATH || !IsExpired())
|
||||
if (!GetTargetApplication()->GetRemoveMode().HasFlag(AuraRemoveFlags::ByDeath) || !IsExpired())
|
||||
return;
|
||||
|
||||
if (GetCaster()->ToPlayer()->isHonorOrXPTarget(GetTarget()))
|
||||
@@ -1065,7 +1064,7 @@ class spell_warl_seed_of_corruption : public AuraScript
|
||||
|
||||
Unit* target = GetTarget();
|
||||
|
||||
if (GetTargetApplication()->GetRemoveMode() == AURA_REMOVE_BY_DEATH)
|
||||
if (GetTargetApplication()->GetRemoveMode().HasFlag(AuraRemoveFlags::ByDeath))
|
||||
{
|
||||
if (_affectedBySoulburn)
|
||||
{
|
||||
@@ -1643,7 +1642,7 @@ class spell_warl_drain_soul : public SpellScriptLoader
|
||||
|
||||
void OnAuraRemoveHandler(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
|
||||
{
|
||||
if (GetTargetApplication()->GetRemoveMode() == AURA_REMOVE_BY_DEATH)
|
||||
if (GetTargetApplication()->GetRemoveMode().HasFlag(AuraRemoveFlags::ByDeath))
|
||||
if (Unit* caster = GetCaster())
|
||||
if (GetOwner() && caster->ToPlayer() && caster->ToPlayer()->isHonorOrXPTarget(GetOwner()->ToUnit()))
|
||||
caster->CastSpell(caster, SPELL_WARLOCK_SOUL_SHARD_ENERGIZE, true);
|
||||
@@ -1839,7 +1838,7 @@ class spell_warl_shadowburn : public AuraScript
|
||||
if (!caster || !caster->IsPlayer())
|
||||
return;
|
||||
|
||||
if (GetTargetApplication()->GetRemoveMode() == AURA_REMOVE_BY_DEATH)
|
||||
if (GetTargetApplication()->GetRemoveMode().HasFlag(AuraRemoveFlags::ByDeath))
|
||||
if (caster->ToPlayer()->isHonorOrXPTarget(GetTarget()))
|
||||
caster->CastCustomSpell(SPELL_WARLOCK_SOUL_SHARD, SPELLVALUE_BASE_POINT0, aurEff->GetAmount(), caster, true, nullptr, aurEff);
|
||||
}
|
||||
|
||||
@@ -484,7 +484,7 @@ class spell_warr_shattering_throw : public SpellScript
|
||||
|
||||
// remove shields, will still display immune to damage part
|
||||
if (Unit* target = GetHitUnit())
|
||||
target->RemoveAurasWithMechanic(1 << MECHANIC_IMMUNE_SHIELD, AURA_REMOVE_BY_ENEMY_SPELL);
|
||||
target->RemoveAurasWithMechanic(1 << MECHANIC_IMMUNE_SHIELD, AuraRemoveFlags::ByEnemySpell);
|
||||
}
|
||||
|
||||
void Register() override
|
||||
|
||||
Reference in new issue
Block a user