diff options
author | Shocker <shocker@freakz.ro> | 2012-04-23 17:14:12 -0700 |
---|---|---|
committer | Shocker <shocker@freakz.ro> | 2012-04-23 17:14:12 -0700 |
commit | 70f93a63a21b9901963b29b5d1bec3aacca611f0 (patch) | |
tree | 27c6a4b3cd92a6853968ae4f7775097a82ce60a3 | |
parent | ef64e8d35a004402add1c3050c2102cc90e1396c (diff) | |
parent | ccda7c8a408e6800a161162fa5c4014265a1125e (diff) |
Merge pull request #6304 from Vincent-Michael/shaman
Core/Spells: Fix Earthen Power
Closes #4795
-rw-r--r-- | sql/updates/world/2012_04_22_01_world_spell_script_names.sql | 3 | ||||
-rw-r--r-- | src/server/scripts/Spells/spell_shaman.cpp | 56 |
2 files changed, 51 insertions, 8 deletions
diff --git a/sql/updates/world/2012_04_22_01_world_spell_script_names.sql b/sql/updates/world/2012_04_22_01_world_spell_script_names.sql new file mode 100644 index 00000000000..bd4becdc3f4 --- /dev/null +++ b/sql/updates/world/2012_04_22_01_world_spell_script_names.sql @@ -0,0 +1,3 @@ +DELETE FROM `spell_script_names` WHERE `spell_id`=59566; +INSERT INTO `spell_script_names` (`spell_id`,`ScriptName`) VALUES +(59566,'spell_sha_earthen_power'); diff --git a/src/server/scripts/Spells/spell_shaman.cpp b/src/server/scripts/Spells/spell_shaman.cpp index 84e3bd8d604..f16f663ae2d 100644 --- a/src/server/scripts/Spells/spell_shaman.cpp +++ b/src/server/scripts/Spells/spell_shaman.cpp @@ -215,13 +215,12 @@ class spell_sha_earthbind_totem : public SpellScriptLoader void HandleEffectPeriodic(AuraEffect const* aurEff) { - if (Unit* target = GetTarget()) - if (Unit* caster = aurEff->GetBase()->GetCaster()) - if (TempSummon* summon = caster->ToTempSummon()) - if (Unit* owner = summon->GetOwner()) - if (AuraEffect* aur = owner->GetDummyAuraEffect(SPELLFAMILY_SHAMAN, 2289, 0)) - if (roll_chance_i(aur->GetBaseAmount()) && target->HasAuraWithMechanic(1 << MECHANIC_SNARE)) - caster->CastSpell(caster, SHAMAN_TOTEM_SPELL_EARTHEN_POWER, true, NULL, aurEff); + if (!GetCaster()) + return; + if (Player* owner = GetCaster()->GetCharmerOrOwnerPlayerOrPlayerItself()) + if (AuraEffect* aur = owner->GetDummyAuraEffect(SPELLFAMILY_SHAMAN, 2289, 0)) + if (roll_chance_i(aur->GetBaseAmount())) + GetTarget()->CastSpell((Unit*)NULL, SHAMAN_TOTEM_SPELL_EARTHEN_POWER, true); } void Apply(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) @@ -252,6 +251,46 @@ class spell_sha_earthbind_totem : public SpellScriptLoader } }; +class EarthenPowerTargetSelector +{ + public: + EarthenPowerTargetSelector() { } + + bool operator() (Unit* target) + { + if (!target->HasAuraWithMechanic(1 << MECHANIC_SNARE)) + return true; + + return false; + } +}; + +class spell_sha_earthen_power : public SpellScriptLoader +{ + public: + spell_sha_earthen_power() : SpellScriptLoader("spell_sha_earthen_power") { } + + class spell_sha_earthen_power_SpellScript : public SpellScript + { + PrepareSpellScript(spell_sha_earthen_power_SpellScript); + + void FilterTargets(std::list<Unit*>& unitList) + { + unitList.remove_if(EarthenPowerTargetSelector()); + } + + void Register() + { + OnUnitTargetSelect += SpellUnitTargetFn(spell_sha_earthen_power_SpellScript::FilterTargets, EFFECT_0, TARGET_UNIT_SRC_AREA_ALLY); + } + }; + + SpellScript* GetSpellScript() const + { + return new spell_sha_earthen_power_SpellScript(); + } +}; + class spell_sha_bloodlust : public SpellScriptLoader { public: @@ -270,7 +309,7 @@ class spell_sha_bloodlust : public SpellScriptLoader void RemoveInvalidTargets(std::list<Unit*>& targets) { - targets.remove_if (Trinity::UnitAuraCheck(true, SHAMAN_SPELL_SATED)); + targets.remove_if(Trinity::UnitAuraCheck(true, SHAMAN_SPELL_SATED)); } void ApplyDebuff() @@ -617,6 +656,7 @@ void AddSC_shaman_spell_scripts() new spell_sha_fire_nova(); new spell_sha_mana_tide_totem(); new spell_sha_earthbind_totem(); + new spell_sha_earthen_power(); new spell_sha_bloodlust(); new spell_sha_heroism(); new spell_sha_ancestral_awakening_proc(); |