Core/Spells: implement DoT clipping

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

No files matched your search

+1 -1
View File
@@ -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
+7 -7
View File
@@ -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
+1 -1
View File
@@ -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);
+1 -1
View File
@@ -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();
}
+1 -1
View File
@@ -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);
}
+4 -5
View File
@@ -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);
}
+1 -1
View File
@@ -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())
+2 -2
View File
@@ -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
+4 -5
View File
@@ -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);
}
+1 -1
View File
@@ -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