fix(Core/Spell): Handle ClearAllDebuffs (#5006)
This commit is contained in:
@@ -0,0 +1,5 @@
|
|||||||
|
INSERT INTO `version_db_world` (`sql_rev`) VALUES ('1616715058536439500');
|
||||||
|
|
||||||
|
DELETE FROM `spell_script_names` WHERE `ScriptName` = 'spell_gen_clear_debuffs';
|
||||||
|
INSERT INTO `spell_script_names` (`spell_id`, `ScriptName`) VALUES
|
||||||
|
(34098, 'spell_gen_clear_debuffs');
|
||||||
@@ -4427,6 +4427,19 @@ void Unit::RemoveAura(Aura* aura, AuraRemoveMode mode)
|
|||||||
RemoveAura(aurApp, mode);
|
RemoveAura(aurApp, mode);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Unit::RemoveOwnedAuras(std::function<bool(Aura const*)> const& check)
|
||||||
|
{
|
||||||
|
for (AuraMap::iterator iter = m_ownedAuras.begin(); iter != m_ownedAuras.end();)
|
||||||
|
{
|
||||||
|
if (check(iter->second))
|
||||||
|
{
|
||||||
|
RemoveOwnedAura(iter);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
++iter;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void Unit::RemoveAppliedAuras(std::function<bool(AuraApplication const*)> const& check)
|
void Unit::RemoveAppliedAuras(std::function<bool(AuraApplication const*)> const& check)
|
||||||
{
|
{
|
||||||
for (AuraApplicationMap::iterator iter = m_appliedAuras.begin(); iter != m_appliedAuras.end();)
|
for (AuraApplicationMap::iterator iter = m_appliedAuras.begin(); iter != m_appliedAuras.end();)
|
||||||
@@ -4440,6 +4453,19 @@ void Unit::RemoveAppliedAuras(std::function<bool(AuraApplication const*)> const&
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Unit::RemoveOwnedAuras(uint32 spellId, std::function<bool(Aura const*)> const& check)
|
||||||
|
{
|
||||||
|
for (AuraMap::iterator iter = m_ownedAuras.lower_bound(spellId); iter != m_ownedAuras.upper_bound(spellId);)
|
||||||
|
{
|
||||||
|
if (check(iter->second))
|
||||||
|
{
|
||||||
|
RemoveOwnedAura(iter);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
++iter;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void Unit::RemoveAppliedAuras(uint32 spellId, std::function<bool(AuraApplication const*)> const& check)
|
void Unit::RemoveAppliedAuras(uint32 spellId, std::function<bool(AuraApplication const*)> const& check)
|
||||||
{
|
{
|
||||||
for (AuraApplicationMap::iterator iter = m_appliedAuras.lower_bound(spellId); iter != m_appliedAuras.upper_bound(spellId);)
|
for (AuraApplicationMap::iterator iter = m_appliedAuras.lower_bound(spellId); iter != m_appliedAuras.upper_bound(spellId);)
|
||||||
|
|||||||
@@ -1971,6 +1971,14 @@ public:
|
|||||||
void RemoveAura(AuraApplication* aurApp, AuraRemoveMode mode = 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(Aura* aur, AuraRemoveMode mode = AURA_REMOVE_BY_DEFAULT);
|
||||||
|
|
||||||
|
// Convenience methods removing auras by predicate
|
||||||
|
void RemoveAppliedAuras(std::function<bool(AuraApplication const*)> const& check);
|
||||||
|
void RemoveOwnedAuras(std::function<bool(Aura const*)> const& check);
|
||||||
|
|
||||||
|
// Optimized overloads taking advantage of map key
|
||||||
|
void RemoveAppliedAuras(uint32 spellId, std::function<bool(AuraApplication const*)> const& check);
|
||||||
|
void RemoveOwnedAuras(uint32 spellId, std::function<bool(Aura const*)> const& check);
|
||||||
|
|
||||||
void RemoveAurasDueToSpell(uint32 spellId, uint64 casterGUID = 0, uint8 reqEffMask = 0, AuraRemoveMode removeMode = AURA_REMOVE_BY_DEFAULT);
|
void RemoveAurasDueToSpell(uint32 spellId, uint64 casterGUID = 0, uint8 reqEffMask = 0, AuraRemoveMode removeMode = AURA_REMOVE_BY_DEFAULT);
|
||||||
void RemoveAuraFromStack(uint32 spellId, uint64 casterGUID = 0, AuraRemoveMode removeMode = AURA_REMOVE_BY_DEFAULT);
|
void RemoveAuraFromStack(uint32 spellId, uint64 casterGUID = 0, AuraRemoveMode removeMode = AURA_REMOVE_BY_DEFAULT);
|
||||||
void RemoveAurasDueToSpellByDispel(uint32 spellId, uint32 dispellerSpellId, uint64 casterGUID, Unit* dispeller, uint8 chargesRemoved = 1);
|
void RemoveAurasDueToSpellByDispel(uint32 spellId, uint32 dispellerSpellId, uint64 casterGUID, Unit* dispeller, uint8 chargesRemoved = 1);
|
||||||
@@ -1985,12 +1993,6 @@ public:
|
|||||||
void RemoveMovementImpairingAuras(bool withRoot);
|
void RemoveMovementImpairingAuras(bool withRoot);
|
||||||
void RemoveAurasByShapeShift();
|
void RemoveAurasByShapeShift();
|
||||||
|
|
||||||
// Convenience methods removing auras by predicate
|
|
||||||
void RemoveAppliedAuras(std::function<bool(AuraApplication const*)> const& check);
|
|
||||||
|
|
||||||
// Optimized overloads taking advantage of map key
|
|
||||||
void RemoveAppliedAuras(uint32 spellId, std::function<bool(AuraApplication const*)> const& check);
|
|
||||||
|
|
||||||
void RemoveAreaAurasDueToLeaveWorld();
|
void RemoveAreaAurasDueToLeaveWorld();
|
||||||
void RemoveAllAuras();
|
void RemoveAllAuras();
|
||||||
void RemoveArenaAuras();
|
void RemoveArenaAuras();
|
||||||
|
|||||||
@@ -1745,6 +1745,40 @@ public:
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// 34098 - ClearAllDebuffs
|
||||||
|
class spell_gen_clear_debuffs : public SpellScriptLoader
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
spell_gen_clear_debuffs() : SpellScriptLoader("spell_gen_clear_debuffs") { }
|
||||||
|
|
||||||
|
class spell_gen_clear_debuffs_SpellScript : public SpellScript
|
||||||
|
{
|
||||||
|
PrepareSpellScript(spell_gen_clear_debuffs_SpellScript);
|
||||||
|
|
||||||
|
void HandleScript(SpellEffIndex /*effIndex*/)
|
||||||
|
{
|
||||||
|
if (Unit* target = GetHitUnit())
|
||||||
|
{
|
||||||
|
target->RemoveOwnedAuras([](Aura const* aura)
|
||||||
|
{
|
||||||
|
SpellInfo const* spellInfo = aura->GetSpellInfo();
|
||||||
|
return !spellInfo->IsPositive() && !spellInfo->IsPassive();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void Register() override
|
||||||
|
{
|
||||||
|
OnEffectHitTarget += SpellEffectFn(spell_gen_clear_debuffs_SpellScript::HandleScript, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
SpellScript* GetSpellScript() const override
|
||||||
|
{
|
||||||
|
return new spell_gen_clear_debuffs_SpellScript();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
// 63845 - Create Lance
|
// 63845 - Create Lance
|
||||||
enum CreateLanceSpells
|
enum CreateLanceSpells
|
||||||
{
|
{
|
||||||
@@ -5154,6 +5188,7 @@ void AddSC_generic_spell_scripts()
|
|||||||
new spell_gen_av_drekthar_presence();
|
new spell_gen_av_drekthar_presence();
|
||||||
new spell_gen_burn_brutallus();
|
new spell_gen_burn_brutallus();
|
||||||
new spell_gen_cannibalize();
|
new spell_gen_cannibalize();
|
||||||
|
new spell_gen_clear_debuffs();
|
||||||
new spell_gen_create_lance();
|
new spell_gen_create_lance();
|
||||||
new spell_gen_netherbloom();
|
new spell_gen_netherbloom();
|
||||||
new spell_gen_nightmare_vine();
|
new spell_gen_nightmare_vine();
|
||||||
|
|||||||
Reference in New Issue
Block a user