aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoraquadeus <95978183+aquadeus@users.noreply.github.com>2021-12-26 21:46:07 +0100
committerGitHub <noreply@github.com>2021-12-26 21:46:07 +0100
commitf230af918b3b41c5a2209d4be48c24857028efd1 (patch)
treec8a203940da054d4fe03c514d8ef6fbb3f6c42d4
parentfed9d73f667c0deed6ee201093ffe43746a178f0 (diff)
Scripts/Spells: Fix shaman talent Downpour (#27477)
-rw-r--r--sql/updates/world/master/2021_12_26_02_world_shaman_downpour.sql3
-rw-r--r--src/server/scripts/Spells/spell_shaman.cpp44
2 files changed, 47 insertions, 0 deletions
diff --git a/sql/updates/world/master/2021_12_26_02_world_shaman_downpour.sql b/sql/updates/world/master/2021_12_26_02_world_shaman_downpour.sql
new file mode 100644
index 00000000000..af0e28acfe6
--- /dev/null
+++ b/sql/updates/world/master/2021_12_26_02_world_shaman_downpour.sql
@@ -0,0 +1,3 @@
+DELETE FROM `spell_script_names` WHERE `ScriptName`='spell_sha_downpour';
+INSERT INTO `spell_script_names` (`spell_id`, `ScriptName`) VALUES
+(207778, 'spell_sha_downpour');
diff --git a/src/server/scripts/Spells/spell_shaman.cpp b/src/server/scripts/Spells/spell_shaman.cpp
index 7be24d5aea3..77d2b665bb4 100644
--- a/src/server/scripts/Spells/spell_shaman.cpp
+++ b/src/server/scripts/Spells/spell_shaman.cpp
@@ -312,6 +312,49 @@ class spell_sha_crash_lightning : public SpellScript
size_t _targetsHit = 0;
};
+// 207778 - Downpour
+class spell_sha_downpour : public SpellScript
+{
+ PrepareSpellScript(spell_sha_downpour);
+
+ bool Validate(SpellInfo const* spellInfo) override
+ {
+ return spellInfo->GetEffects().size() > EFFECT_1;
+ }
+
+ void FilterTargets(std::list<WorldObject*>& targets)
+ {
+ uint32 const maxTargets = 6;
+ if (targets.size() > maxTargets)
+ {
+ targets.sort(Trinity::HealthPctOrderPred());
+ targets.resize(maxTargets);
+ }
+ }
+
+ void CountEffectivelyHealedTarget()
+ {
+ // Cooldown increased for each target effectively healed
+ if (GetHitHeal())
+ ++_healedTargets;
+ }
+
+ void HandleCooldown()
+ {
+ SpellHistory::Duration cooldown = Milliseconds(GetSpellInfo()->RecoveryTime) + Seconds(GetEffectInfo(EFFECT_1).CalcValue() * _healedTargets);
+ GetCaster()->GetSpellHistory()->StartCooldown(GetSpellInfo(), 0, GetSpell(), false, cooldown);
+ }
+
+ void Register() override
+ {
+ OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_sha_downpour::FilterTargets, EFFECT_0, TARGET_UNIT_DEST_AREA_ALLY);
+ AfterHit += SpellHitFn(spell_sha_downpour::CountEffectivelyHealedTarget);
+ AfterCast += SpellCastFn(spell_sha_downpour::HandleCooldown);
+ }
+
+ int32 _healedTargets = 0;
+};
+
// 204288 - Earth Shield
class spell_sha_earth_shield : public AuraScript
{
@@ -1327,6 +1370,7 @@ void AddSC_shaman_spell_scripts()
RegisterSpellScript(spell_sha_chain_lightning);
RegisterSpellScript(spell_sha_chain_lightning_overload);
RegisterSpellScript(spell_sha_crash_lightning);
+ RegisterSpellScript(spell_sha_downpour);
RegisterAuraScript(spell_sha_earth_shield);
RegisterAuraScript(spell_sha_earthen_rage_passive);
RegisterAuraScript(spell_sha_earthen_rage_proc_aura);