aboutsummaryrefslogtreecommitdiff
path: root/src/server/scripts/Shadowlands
diff options
context:
space:
mode:
authorShauren <shauren.trinity@gmail.com>2023-06-27 22:22:16 +0200
committerShauren <shauren.trinity@gmail.com>2023-06-27 22:22:16 +0200
commit07d6eb3a5728b0ce1bc0adf2a01aa3ec7193e487 (patch)
treeb57ec4ab84de93fffa1e43a858d5dddfb20aa4de /src/server/scripts/Shadowlands
parentacb7e72470b6ff3e1051ac1a165c6500aab45c3f (diff)
Scripts/Spells: Fixed remaining spells with SPELL_ATTR3_CAN_PROC_FROM_PROCS attribute
Diffstat (limited to 'src/server/scripts/Shadowlands')
-rw-r--r--src/server/scripts/Shadowlands/Torghast/spell_torghast.cpp242
1 files changed, 242 insertions, 0 deletions
diff --git a/src/server/scripts/Shadowlands/Torghast/spell_torghast.cpp b/src/server/scripts/Shadowlands/Torghast/spell_torghast.cpp
index c9c7e681a77..eef3eb0b075 100644
--- a/src/server/scripts/Shadowlands/Torghast/spell_torghast.cpp
+++ b/src/server/scripts/Shadowlands/Torghast/spell_torghast.cpp
@@ -16,12 +16,42 @@
*/
#include "ScriptMgr.h"
+#include "Spell.h"
#include "SpellAuraEffects.h"
#include "SpellHistory.h"
#include "SpellMgr.h"
#include "SpellScript.h"
#include "Unit.h"
+// 297721 - Subjugator's Manacles
+class spell_torghast_subjugators_manacles : public AuraScript
+{
+ PrepareAuraScript(spell_torghast_subjugators_manacles);
+
+ bool CheckProc(AuraEffect const* /*aurEff*/, ProcEventInfo& procInfo)
+ {
+ if (_triggeredTargets.contains(procInfo.GetProcTarget()->GetGUID()))
+ return false;
+
+ _triggeredTargets.insert(procInfo.GetProcTarget()->GetGUID());
+ return true;
+ }
+
+ void ResetMarkedTargets(bool isNowInCombat)
+ {
+ if (!isNowInCombat)
+ _triggeredTargets.clear();
+ }
+
+ void Register() override
+ {
+ DoCheckEffectProc += AuraCheckEffectProcFn(spell_torghast_subjugators_manacles::CheckProc, EFFECT_0, SPELL_AURA_PROC_TRIGGER_SPELL);
+ OnEnterLeaveCombat += AuraEnterLeaveCombatFn(spell_torghast_subjugators_manacles::ResetMarkedTargets);
+ }
+
+ std::unordered_set<ObjectGuid> _triggeredTargets;
+};
+
// 300771 - Blade of the Lifetaker
class spell_torghast_blade_of_the_lifetaker : public AuraScript
{
@@ -137,10 +167,222 @@ class spell_torghast_dimensional_blade : public SpellScript
}
};
+// 341324 - Uncontrolled Darkness
+class spell_torghast_uncontrolled_darkness : public AuraScript
+{
+ PrepareAuraScript(spell_torghast_uncontrolled_darkness);
+
+ void Register() override
+ {
+ // just a value holder, no hooks
+ }
+
+public:
+ int32 KillCounter = 0;
+};
+
+// 343174 - Uncontrolled Darkness
+class spell_torghast_uncontrolled_darkness_proc : public AuraScript
+{
+ PrepareAuraScript(spell_torghast_uncontrolled_darkness_proc);
+
+ static constexpr uint32 SPELL_UNCONTROLLED_DARKNESS = 341324;
+ static constexpr uint32 SPELL_UNCONTROLLED_DARKNESS_BUFF = 341375;
+
+ bool Validate(SpellInfo const* /*spellInfo*/) override
+ {
+ return ValidateSpellEffect({ { SPELL_UNCONTROLLED_DARKNESS, EFFECT_1 } })
+ && ValidateSpellInfo({ SPELL_UNCONTROLLED_DARKNESS_BUFF });
+ }
+
+ void HandleProc(AuraEffect* /*aurEff*/, ProcEventInfo& /*procInfo*/)
+ {
+ Unit* caster = GetCaster();
+ if (!caster)
+ return;
+
+ Aura* uncontrolledDarkness = caster->GetAura(SPELL_UNCONTROLLED_DARKNESS, caster->GetGUID());
+ if (!uncontrolledDarkness)
+ return;
+
+ spell_torghast_uncontrolled_darkness* script = uncontrolledDarkness->GetScript<spell_torghast_uncontrolled_darkness>();
+ if (!script)
+ return;
+
+ if (caster->HasAura(SPELL_UNCONTROLLED_DARKNESS_BUFF))
+ {
+ if (++script->KillCounter >= uncontrolledDarkness->GetSpellInfo()->GetEffect(EFFECT_1).CalcValue())
+ {
+ caster->RemoveAura(SPELL_UNCONTROLLED_DARKNESS_BUFF);
+ script->KillCounter = 0;
+ }
+ }
+ else
+ {
+ if (++script->KillCounter >= uncontrolledDarkness->GetSpellInfo()->GetEffect(EFFECT_0).CalcValue())
+ {
+ caster->CastSpell(caster, SPELL_UNCONTROLLED_DARKNESS_BUFF, true);
+ script->KillCounter = 0;
+ }
+ }
+ }
+
+ void Register() override
+ {
+ OnEffectProc += AuraEffectProcFn(spell_torghast_uncontrolled_darkness_proc::HandleProc, EFFECT_0, SPELL_AURA_DUMMY);
+ }
+};
+
+// 342632 - Malevolent Stitching
+class spell_torghast_fleshcraft_shield_proc : public AuraScript
+{
+ PrepareAuraScript(spell_torghast_fleshcraft_shield_proc);
+
+ static constexpr uint32 SPELL_LABEL_FLESHCRAFT_BUFF = 1103;
+
+ bool CheckProc(ProcEventInfo& procInfo)
+ {
+ return procInfo.GetSpellInfo() && procInfo.GetSpellInfo()->HasLabel(SPELL_LABEL_FLESHCRAFT_BUFF);
+ }
+
+ void Register() override
+ {
+ DoCheckProc += AuraCheckProcFn(spell_torghast_fleshcraft_shield_proc::CheckProc);
+ }
+};
+
+// 342779 - Crystallized Dreams
+class spell_torghast_soulshape_proc : public AuraScript
+{
+ PrepareAuraScript(spell_torghast_soulshape_proc);
+
+ static constexpr uint32 SPELL_LABEL_SOULSHAPE = 1100;
+
+ bool CheckProc(ProcEventInfo& procInfo)
+ {
+ return procInfo.GetSpellInfo() && procInfo.GetSpellInfo()->HasLabel(SPELL_LABEL_SOULSHAPE);
+ }
+
+ void Register() override
+ {
+ DoCheckProc += AuraCheckProcFn(spell_torghast_soulshape_proc::CheckProc);
+ }
+};
+
+// 342793 - Murmuring Shawl
+// 342799 - Gnarled Key
+class spell_torghast_door_of_shadows_proc : public AuraScript
+{
+ PrepareAuraScript(spell_torghast_door_of_shadows_proc);
+
+ static constexpr uint32 SPELL_LABEL_DOOR_OF_SHADOWS = 726;
+
+ bool CheckProc(ProcEventInfo& procInfo)
+ {
+ return procInfo.GetSpellInfo() && procInfo.GetSpellInfo()->HasLabel(SPELL_LABEL_DOOR_OF_SHADOWS);
+ }
+
+ void Register() override
+ {
+ DoCheckProc += AuraCheckProcFn(spell_torghast_door_of_shadows_proc::CheckProc);
+ }
+};
+
+// 348908 - Ethereal Wildseed
+class spell_torghast_flicker_proc : public AuraScript
+{
+ PrepareAuraScript(spell_torghast_flicker_proc);
+
+ static constexpr uint32 SPELL_LABEL_FLICKER = 1105;
+
+ bool CheckProc(ProcEventInfo& procInfo)
+ {
+ return procInfo.GetSpellInfo() && procInfo.GetSpellInfo()->HasLabel(SPELL_LABEL_FLICKER);
+ }
+
+ void Register() override
+ {
+ DoCheckProc += AuraCheckProcFn(spell_torghast_flicker_proc::CheckProc);
+ }
+};
+
+// 354569 - Potent Potion
+class spell_torghast_potent_potion_proc : public AuraScript
+{
+ PrepareAuraScript(spell_torghast_potent_potion_proc);
+
+ static constexpr uint32 SPELL_LABEL_REJUVENATING_SIPHONED_ESSENCE = 1290;
+
+ bool CheckProc(ProcEventInfo& procInfo)
+ {
+ return procInfo.GetSpellInfo() && procInfo.GetSpellInfo()->HasLabel(SPELL_LABEL_REJUVENATING_SIPHONED_ESSENCE);
+ }
+
+ void Register() override
+ {
+ DoCheckProc += AuraCheckProcFn(spell_torghast_potent_potion_proc::CheckProc);
+ }
+};
+
+// 354706 - Spiritual Rejuvenation Potion
+class spell_torghast_potent_potion_calc : public SpellScript
+{
+ PrepareSpellScript(spell_torghast_potent_potion_calc);
+
+ static constexpr uint32 SPELL_LABEL_SPIRITUAL_REJUVENATION_POTION = 354568;
+
+ bool Validate(SpellInfo const* /*spellInfo*/) override
+ {
+ return ValidateSpellEffect({ { SPELL_LABEL_SPIRITUAL_REJUVENATION_POTION, EFFECT_1 } });
+ }
+
+ void SetValue(SpellEffIndex effIndex)
+ {
+ SetEffectValue(sSpellMgr->AssertSpellInfo(SPELL_LABEL_SPIRITUAL_REJUVENATION_POTION, GetCastDifficulty())->GetEffect(effIndex)
+ .CalcValue(GetCaster(), nullptr, GetHitUnit()));;
+ }
+
+ void Register() override
+ {
+ OnEffectLaunchTarget += SpellEffectFn(spell_torghast_potent_potion_calc::SetValue, EFFECT_0, SPELL_EFFECT_HEAL);
+ OnEffectHitTarget += SpellEffectFn(spell_torghast_potent_potion_calc::SetValue, EFFECT_1, SPELL_EFFECT_ENERGIZE);
+ }
+};
+
+// 373761 - Poisonous Spores
+class spell_torghast_poisonous_spores : public AuraScript
+{
+ PrepareAuraScript(spell_torghast_poisonous_spores);
+
+ void HandleProc(AuraEffect* aurEff, ProcEventInfo& procInfo)
+ {
+ PreventDefaultAction();
+
+ Spell const* procSpell = procInfo.GetProcSpell();
+ procInfo.GetActor()->CastSpell(*procSpell->m_targets.GetDst(), aurEff->GetSpellEffectInfo().TriggerSpell,
+ CastSpellExtraArgs(aurEff).SetTriggeringSpell(procSpell));
+ }
+
+ void Register() override
+ {
+ OnEffectProc += AuraEffectProcFn(spell_torghast_poisonous_spores::HandleProc, EFFECT_0, SPELL_AURA_PROC_TRIGGER_SPELL);
+ }
+};
+
void AddSC_torghast_spell_scripts()
{
+ RegisterSpellScript(spell_torghast_subjugators_manacles);
RegisterSpellScript(spell_torghast_blade_of_the_lifetaker);
RegisterSpellScript(spell_torghast_touch_of_the_unseen);
RegisterSpellScript(spell_torghast_yelshirs_powerglove);
RegisterSpellScript(spell_torghast_dimensional_blade);
+ RegisterSpellScript(spell_torghast_uncontrolled_darkness);
+ RegisterSpellScript(spell_torghast_uncontrolled_darkness_proc);
+ RegisterSpellScript(spell_torghast_fleshcraft_shield_proc);
+ RegisterSpellScript(spell_torghast_soulshape_proc);
+ RegisterSpellScript(spell_torghast_door_of_shadows_proc);
+ RegisterSpellScript(spell_torghast_flicker_proc);
+ RegisterSpellScript(spell_torghast_potent_potion_proc);
+ RegisterSpellScript(spell_torghast_potent_potion_calc);
+ RegisterSpellScript(spell_torghast_poisonous_spores);
}