diff options
author | Shauren <shauren.trinity@gmail.com> | 2012-03-06 22:05:33 +0100 |
---|---|---|
committer | Shauren <shauren.trinity@gmail.com> | 2012-03-06 22:05:33 +0100 |
commit | bf5c8d7399a7348e05567a6a95b1afce281c4858 (patch) | |
tree | 8a35f952477ae55ae538a5a87f28b14000df08a2 /src | |
parent | f506674ab85107d5866c2f90111e7bf949233711 (diff) |
Scripts/Spells: Fixed target of visual polymorph in Silvermoon city
Diffstat (limited to 'src')
-rw-r--r-- | src/server/scripts/Spells/spell_mage.cpp | 20 |
1 files changed, 13 insertions, 7 deletions
diff --git a/src/server/scripts/Spells/spell_mage.cpp b/src/server/scripts/Spells/spell_mage.cpp index ea1af10816b..b746c37a090 100644 --- a/src/server/scripts/Spells/spell_mage.cpp +++ b/src/server/scripts/Spells/spell_mage.cpp @@ -123,6 +123,12 @@ class spell_mage_cold_snap : public SpellScriptLoader } }; +enum SilvermoonPolymorph +{ + NPC_AUROSALIA = 18744, +}; + +// TODO: move out of here and rename - not a mage spell class spell_mage_polymorph_cast_visual : public SpellScriptLoader { public: @@ -132,22 +138,22 @@ class spell_mage_polymorph_cast_visual : public SpellScriptLoader { PrepareSpellScript(spell_mage_polymorph_cast_visual_SpellScript); - static const uint32 spell_list[6]; + static const uint32 PolymorhForms[6]; bool Validate(SpellInfo const* /*spellEntry*/) { // check if spell ids exist in dbc - for (int i = 0; i < 6; i++) - if (!sSpellMgr->GetSpellInfo(spell_list[i])) + for (uint32 i = 0; i < 6; i++) + if (!sSpellMgr->GetSpellInfo(PolymorhForms[i])) return false; return true; } void HandleDummy(SpellEffIndex /*effIndex*/) { - if (Unit* unitTarget = GetHitUnit()) - if (unitTarget->GetTypeId() == TYPEID_UNIT) - unitTarget->CastSpell(unitTarget, spell_list[urand(0, 5)], true); + if (Unit* target = GetCaster()->FindNearestCreature(NPC_AUROSALIA, 30.0f)) + if (target->GetTypeId() == TYPEID_UNIT) + target->CastSpell(target, PolymorhForms[urand(0, 5)], true); } void Register() @@ -163,7 +169,7 @@ class spell_mage_polymorph_cast_visual : public SpellScriptLoader } }; -const uint32 spell_mage_polymorph_cast_visual::spell_mage_polymorph_cast_visual_SpellScript::spell_list[6] = +const uint32 spell_mage_polymorph_cast_visual::spell_mage_polymorph_cast_visual_SpellScript::PolymorhForms[6] = { SPELL_MAGE_SQUIRREL_FORM, SPELL_MAGE_GIRAFFE_FORM, |