aboutsummaryrefslogtreecommitdiff
path: root/src/server/scripts/Spells
diff options
context:
space:
mode:
Diffstat (limited to 'src/server/scripts/Spells')
-rw-r--r--src/server/scripts/Spells/spell_hunter.cpp11
-rw-r--r--src/server/scripts/Spells/spell_rogue.cpp119
-rw-r--r--src/server/scripts/Spells/spell_warlock.cpp8
3 files changed, 65 insertions, 73 deletions
diff --git a/src/server/scripts/Spells/spell_hunter.cpp b/src/server/scripts/Spells/spell_hunter.cpp
index 45a8e390b9c..ed8f1eb38d5 100644
--- a/src/server/scripts/Spells/spell_hunter.cpp
+++ b/src/server/scripts/Spells/spell_hunter.cpp
@@ -38,6 +38,7 @@ enum HunterSpells
SPELL_HUNTER_EXHILARATION_R2 = 231546,
SPELL_HUNTER_LONE_WOLF = 155228,
SPELL_HUNTER_MASTERS_CALL_TRIGGERED = 62305,
+ SPELL_HUNTER_MISDIRECTION = 34477,
SPELL_HUNTER_MISDIRECTION_PROC = 35079,
SPELL_HUNTER_MULTI_SHOT_FOCUS = 213363,
SPELL_HUNTER_PET_LAST_STAND_TRIGGERED = 53479,
@@ -297,12 +298,7 @@ class spell_hun_misdirection : public SpellScriptLoader
return;
if (!GetTarget()->HasAura(SPELL_HUNTER_MISDIRECTION_PROC))
- GetTarget()->ResetRedirectThreat();
- }
-
- bool CheckProc(ProcEventInfo& /*eventInfo*/)
- {
- return GetTarget()->GetRedirectThreatTarget() != nullptr;
+ GetTarget()->GetThreatManager().UnregisterRedirectThreat(SPELL_HUNTER_MISDIRECTION);
}
void HandleProc(AuraEffect* aurEff, ProcEventInfo& /*eventInfo*/)
@@ -314,7 +310,6 @@ class spell_hun_misdirection : public SpellScriptLoader
void Register() override
{
AfterEffectRemove += AuraEffectRemoveFn(spell_hun_misdirection_AuraScript::OnRemove, EFFECT_1, SPELL_AURA_DUMMY, AURA_EFFECT_HANDLE_REAL);
- DoCheckProc += AuraCheckProcFn(spell_hun_misdirection_AuraScript::CheckProc);
OnEffectProc += AuraEffectProcFn(spell_hun_misdirection_AuraScript::HandleProc, EFFECT_1, SPELL_AURA_DUMMY);
}
};
@@ -337,7 +332,7 @@ class spell_hun_misdirection_proc : public SpellScriptLoader
void OnRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
{
- GetTarget()->ResetRedirectThreat();
+ GetTarget()->GetThreatManager().UnregisterRedirectThreat(SPELL_HUNTER_MISDIRECTION);
}
void Register() override
diff --git a/src/server/scripts/Spells/spell_rogue.cpp b/src/server/scripts/Spells/spell_rogue.cpp
index 003b55c260e..25ba6f0006d 100644
--- a/src/server/scripts/Spells/spell_rogue.cpp
+++ b/src/server/scripts/Spells/spell_rogue.cpp
@@ -51,6 +51,7 @@ enum RogueSpells
SPELL_ROGUE_STEALTH_STEALTH_AURA = 158185,
SPELL_ROGUE_STEALTH_SHAPESHIFT_AURA = 158188,
SPELL_ROGUE_VANISH_AURA = 11327,
+ SPELL_ROGUE_TRICKS_OF_THE_TRADE = 57934,
SPELL_ROGUE_TRICKS_OF_THE_TRADE_PROC = 59628,
SPELL_ROGUE_HONOR_AMONG_THIEVES_ENERGIZE = 51699,
SPELL_ROGUE_T5_2P_SET_BONUS = 37169
@@ -507,82 +508,78 @@ class spell_rog_vanish_aura : public SpellScriptLoader
};
// 57934 - Tricks of the Trade
-class spell_rog_tricks_of_the_trade : public SpellScriptLoader
+class spell_rog_tricks_of_the_trade_aura : public AuraScript
{
- public:
- spell_rog_tricks_of_the_trade() : SpellScriptLoader("spell_rog_tricks_of_the_trade") { }
+ PrepareAuraScript(spell_rog_tricks_of_the_trade_aura);
- class spell_rog_tricks_of_the_trade_AuraScript : public AuraScript
- {
- PrepareAuraScript(spell_rog_tricks_of_the_trade_AuraScript);
+ bool Validate(SpellInfo const* /*spellInfo*/) override
+ {
+ return ValidateSpellInfo({ SPELL_ROGUE_TRICKS_OF_THE_TRADE_PROC });
+ }
- bool Validate(SpellInfo const* /*spellInfo*/) override
- {
- return ValidateSpellInfo({ SPELL_ROGUE_TRICKS_OF_THE_TRADE_PROC });
- }
+ void OnRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
+ {
+ if (GetTargetApplication()->GetRemoveMode() != AURA_REMOVE_BY_DEFAULT || !GetTarget()->HasAura(SPELL_ROGUE_TRICKS_OF_THE_TRADE_PROC))
+ GetTarget()->GetThreatManager().UnregisterRedirectThreat(SPELL_ROGUE_TRICKS_OF_THE_TRADE);
+ }
- void OnRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
- {
- if (GetTargetApplication()->GetRemoveMode() != AURA_REMOVE_BY_DEFAULT)
- GetTarget()->ResetRedirectThreat();
- }
+ void HandleProc(AuraEffect* aurEff, ProcEventInfo& /*eventInfo*/)
+ {
+ PreventDefaultAction();
- bool CheckProc(ProcEventInfo& /*eventInfo*/)
- {
- _redirectTarget = GetTarget()->GetRedirectThreatTarget();
- return _redirectTarget != nullptr;
- }
+ Unit* rogue = GetTarget();
+ if (ObjectAccessor::GetUnit(*rogue, _redirectTarget))
+ rogue->CastSpell(rogue, SPELL_ROGUE_TRICKS_OF_THE_TRADE_PROC, aurEff);
+ Remove(AURA_REMOVE_BY_DEFAULT);
+ }
- void HandleProc(AuraEffect* /*aurEff*/, ProcEventInfo& /*eventInfo*/)
- {
- PreventDefaultAction();
+ void Register() override
+ {
+ AfterEffectRemove += AuraEffectRemoveFn(spell_rog_tricks_of_the_trade_aura::OnRemove, EFFECT_1, SPELL_AURA_DUMMY, AURA_EFFECT_HANDLE_REAL);
+ OnEffectProc += AuraEffectProcFn(spell_rog_tricks_of_the_trade_aura::HandleProc, EFFECT_1, SPELL_AURA_DUMMY);
+ }
- Unit* target = GetTarget();
- target->CastSpell(target, SPELL_ROGUE_TRICKS_OF_THE_TRADE_PROC, true);
- Remove(AURA_REMOVE_BY_DEFAULT); // maybe handle by proc charges
- }
+ ObjectGuid _redirectTarget;
+public:
+ void SetRedirectTarget(ObjectGuid guid) { _redirectTarget = guid; }
+};
- void Register() override
+class spell_rog_tricks_of_the_trade : public SpellScript
+{
+ PrepareSpellScript(spell_rog_tricks_of_the_trade);
+
+ void DoAfterHit()
+ {
+ if (Aura* aura = GetHitAura())
+ if (auto* script = aura->GetScript<spell_rog_tricks_of_the_trade_aura>("spell_rog_tricks_of_the_trade"))
{
- AfterEffectRemove += AuraEffectRemoveFn(spell_rog_tricks_of_the_trade_AuraScript::OnRemove, EFFECT_1, SPELL_AURA_DUMMY, AURA_EFFECT_HANDLE_REAL);
- DoCheckProc += AuraCheckProcFn(spell_rog_tricks_of_the_trade_AuraScript::CheckProc);
- OnEffectProc += AuraEffectProcFn(spell_rog_tricks_of_the_trade_AuraScript::HandleProc, EFFECT_1, SPELL_AURA_DUMMY);
+ if (Unit* explTarget = GetExplTargetUnit())
+ script->SetRedirectTarget(explTarget->GetGUID());
+ else
+ script->SetRedirectTarget(ObjectGuid::Empty);
}
+ }
- Unit* _redirectTarget = nullptr;
- };
-
- AuraScript* GetAuraScript() const override
- {
- return new spell_rog_tricks_of_the_trade_AuraScript();
- }
+ void Register() override
+ {
+ AfterHit += SpellHitFn(spell_rog_tricks_of_the_trade::DoAfterHit);
+ }
};
// 59628 - Tricks of the Trade (Proc)
-class spell_rog_tricks_of_the_trade_proc : public SpellScriptLoader
+class spell_rog_tricks_of_the_trade_proc : public AuraScript
{
- public:
- spell_rog_tricks_of_the_trade_proc() : SpellScriptLoader("spell_rog_tricks_of_the_trade_proc") { }
+ PrepareAuraScript(spell_rog_tricks_of_the_trade_proc);
- class spell_rog_tricks_of_the_trade_proc_AuraScript : public AuraScript
- {
- PrepareAuraScript(spell_rog_tricks_of_the_trade_proc_AuraScript);
-
- void HandleRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
- {
- GetTarget()->ResetRedirectThreat();
- }
-
- void Register() override
- {
- AfterEffectRemove += AuraEffectRemoveFn(spell_rog_tricks_of_the_trade_proc_AuraScript::HandleRemove, EFFECT_0, SPELL_AURA_DUMMY, AURA_EFFECT_HANDLE_REAL);
- }
- };
+ void HandleRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
+ {
+ GetTarget()->GetThreatManager().UnregisterRedirectThreat(SPELL_ROGUE_TRICKS_OF_THE_TRADE);
+ }
- AuraScript* GetAuraScript() const override
- {
- return new spell_rog_tricks_of_the_trade_proc_AuraScript();
- }
+ void Register() override
+ {
+ AfterEffectRemove += AuraEffectRemoveFn(spell_rog_tricks_of_the_trade_proc::HandleRemove, EFFECT_0, SPELL_AURA_DUMMY, AURA_EFFECT_HANDLE_REAL);
+ }
};
// 198031 - Honor Among Thieves
@@ -704,8 +701,8 @@ void AddSC_rogue_spell_scripts()
new spell_rog_stealth();
new spell_rog_vanish();
new spell_rog_vanish_aura();
- new spell_rog_tricks_of_the_trade();
- new spell_rog_tricks_of_the_trade_proc();
+ RegisterSpellAndAuraScriptPair(spell_rog_tricks_of_the_trade, spell_rog_tricks_of_the_trade_aura);
+ RegisterAuraScript(spell_rog_tricks_of_the_trade_proc);
new spell_rog_honor_among_thieves();
new spell_rog_eviscerate();
new spell_rog_envenom();
diff --git a/src/server/scripts/Spells/spell_warlock.cpp b/src/server/scripts/Spells/spell_warlock.cpp
index 163c867d71d..1740f3291f9 100644
--- a/src/server/scripts/Spells/spell_warlock.cpp
+++ b/src/server/scripts/Spells/spell_warlock.cpp
@@ -51,7 +51,7 @@ enum WarlockSpells
SPELL_WARLOCK_RAIN_OF_FIRE_DAMAGE = 42223,
SPELL_WARLOCK_SEED_OF_CORRUPTION_DAMAGE = 27285,
SPELL_WARLOCK_SEED_OF_CORRUPTION_GENERIC = 32865,
- SPELL_WARLOCK_SOULSHATTER = 32835,
+ SPELL_WARLOCK_SOULSHATTER_EFFECT = 32835,
SPELL_WARLOCK_SOUL_SWAP_CD_MARKER = 94229,
SPELL_WARLOCK_SOUL_SWAP_OVERRIDE = 86211,
SPELL_WARLOCK_SOUL_SWAP_MOD_COST = 92794,
@@ -815,15 +815,15 @@ class spell_warl_soulshatter : public SpellScriptLoader
bool Validate(SpellInfo const* /*spellInfo*/) override
{
- return ValidateSpellInfo({ SPELL_WARLOCK_SOULSHATTER });
+ return ValidateSpellInfo({ SPELL_WARLOCK_SOULSHATTER_EFFECT });
}
void HandleDummy(SpellEffIndex /*effIndex*/)
{
Unit* caster = GetCaster();
if (Unit* target = GetHitUnit())
- if (target->CanHaveThreatList() && target->GetThreatManager().IsThreatenedBy(caster, true))
- caster->CastSpell(target, SPELL_WARLOCK_SOULSHATTER, true);
+ if (target->GetThreatManager().IsThreatenedBy(caster, true))
+ caster->CastSpell(target, SPELL_WARLOCK_SOULSHATTER_EFFECT, true);
}
void Register() override