diff options
author | silinoron <none@none> | 2010-07-27 22:12:50 -0700 |
---|---|---|
committer | silinoron <none@none> | 2010-07-27 22:12:50 -0700 |
commit | c173e84f252453397c5360fd74958c3ed135a06f (patch) | |
tree | 7863ef1231a76289f414aaf865e5f07795d84b1d /src | |
parent | e7e49c56cf5b357c1bdcf1e199435dbeec17797e (diff) |
Move dummy effect handlers for all SPELLFAMILY_HUNTER dummy effect handlers but Scatter Shot to spell scripts.
--HG--
branch : trunk
Diffstat (limited to 'src')
-rw-r--r-- | src/server/game/Spells/SpellEffects.cpp | 36 | ||||
-rw-r--r-- | src/server/scripts/Spells/spell_hunter.cpp | 116 | ||||
-rw-r--r-- | src/server/scripts/Spells/spell_rogue.cpp | 2 |
3 files changed, 112 insertions, 42 deletions
diff --git a/src/server/game/Spells/SpellEffects.cpp b/src/server/game/Spells/SpellEffects.cpp index 2d7825cc5c8..f5c590f891a 100644 --- a/src/server/game/Spells/SpellEffects.cpp +++ b/src/server/game/Spells/SpellEffects.cpp @@ -1659,24 +1659,6 @@ void Spell::EffectDummy(uint32 i) case SPELLFAMILY_HUNTER: switch(m_spellInfo->Id) { - case 23989: // Readiness talent - { - if (m_caster->GetTypeId() != TYPEID_PLAYER) - return; - - // immediately finishes the cooldown on your other Hunter abilities except Bestial Wrath - const SpellCooldowns& cm = m_caster->ToPlayer()->GetSpellCooldownMap(); - for (SpellCooldowns::const_iterator itr = cm.begin(); itr != cm.end();) - { - SpellEntry const *spellInfo = sSpellStore.LookupEntry(itr->first); - - if (spellInfo->SpellFamilyName == SPELLFAMILY_HUNTER && spellInfo->Id != 23989 && spellInfo->Id != 19574 && GetSpellRecoveryTime(spellInfo) > 0) - m_caster->ToPlayer()->RemoveSpellCooldown((itr++)->first,true); - else - ++itr; - } - return; - } case 37506: // Scatter Shot { if (m_caster->GetTypeId() != TYPEID_PLAYER) @@ -1688,24 +1670,6 @@ void Spell::EffectDummy(uint32 i) m_caster->ToPlayer()->SendAttackSwingCancelAttack(); return; } - // Last Stand (pet) - case 53478: - { - int32 healthModSpellBasePoints0 = int32(m_caster->GetMaxHealth()*0.3); - m_caster->CastCustomSpell(m_caster, 53479, &healthModSpellBasePoints0, NULL, NULL, true, NULL); - return; - } - // Master's Call - case 53271: - { - if (m_caster->GetTypeId() != TYPEID_PLAYER || !unitTarget) - return; - - if (Pet *pPet = m_caster->ToPlayer()->GetPet()) - if (pPet->isAlive()) - pPet->CastSpell(unitTarget, SpellMgr::CalculateSpellEffectAmount(m_spellInfo, i), true); - return; - } } break; case SPELLFAMILY_PALADIN: diff --git a/src/server/scripts/Spells/spell_hunter.cpp b/src/server/scripts/Spells/spell_hunter.cpp index 1a3ef010cbb..17c5858f00c 100644 --- a/src/server/scripts/Spells/spell_hunter.cpp +++ b/src/server/scripts/Spells/spell_hunter.cpp @@ -23,14 +23,120 @@ #include "ScriptPCH.h" +enum HunterSpells +{ + HUNTER_SPELL_READINESS = 23989, + HUNTER_SPELL_BESTIAL_WRATH = 19574, + HUNTER_PET_SPELL_LAST_STAND_TRIGGERED = 53479, +}; + +class spell_hun_last_stand_pet_SpellScript : public SpellScript +{ + bool Validate(SpellEntry const * spellEntry) + { + if (!sSpellStore.LookupEntry(HUNTER_PET_SPELL_LAST_STAND_TRIGGERED)) + return false; + return true; + } + + void HandleDummy(SpellEffIndex effIndex) + { + Unit *caster = GetCaster(); + int32 healthModSpellBasePoints0 = int32(caster->GetMaxHealth()*0.3); + caster->CastCustomSpell(caster, HUNTER_PET_SPELL_LAST_STAND_TRIGGERED, &healthModSpellBasePoints0, NULL, NULL, true, NULL); + } + + void Register() + { + // add dummy effect spell handler to pet's Last Stand + EffectHandlers += EffectHandlerFn(spell_hun_last_stand_pet_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY); + } +}; + +SpellScript * GetSpellScript_spell_hun_last_stand_pet() +{ + return new spell_hun_last_stand_pet_SpellScript(); +} + +class spell_hun_masters_call_SpellScript : public SpellScript +{ + void HandleDummy(SpellEffIndex effIndex) + { + Unit *caster = GetCaster(); + Unit *unitTarget = GetHitUnit(); + + if (caster->GetTypeId() != TYPEID_PLAYER || !unitTarget) + return; + + if (Pet *pet = caster->ToPlayer()->GetPet()) + if (pet->isAlive()) + pet->CastSpell(unitTarget, SpellMgr::CalculateSpellEffectAmount(GetSpellInfo(), effIndex), true); + } + + void Register() + { + // add dummy effect spell handler to Master's Call + EffectHandlers += EffectHandlerFn(spell_hun_masters_call_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY); + } +}; + +SpellScript * GetSpellScript_spell_hun_masters_call() +{ + return new spell_hun_masters_call_SpellScript(); +} + +class spell_hun_readiness_SpellScript : public SpellScript +{ + void HandleDummy(SpellEffIndex effIndex) + { + Unit *caster = GetCaster(); + if (caster->GetTypeId() != TYPEID_PLAYER) + return; + + // immediately finishes the cooldown on your other Hunter abilities except Bestial Wrath + const SpellCooldowns& cm = caster->ToPlayer()->GetSpellCooldownMap(); + for (SpellCooldowns::const_iterator itr = cm.begin(); itr != cm.end();) + { + SpellEntry const *spellInfo = sSpellStore.LookupEntry(itr->first); + + if (spellInfo->SpellFamilyName == SPELLFAMILY_HUNTER && + spellInfo->Id != HUNTER_SPELL_READINESS && + spellInfo->Id != HUNTER_SPELL_BESTIAL_WRATH && + GetSpellRecoveryTime(spellInfo) > 0) + caster->ToPlayer()->RemoveSpellCooldown((itr++)->first,true); + else + ++itr; + } + } + + void Register() + { + // add dummy effect spell handler to Readiness + EffectHandlers += EffectHandlerFn(spell_hun_readiness_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY); + } +}; + +SpellScript * GetSpellScript_spell_hun_readiness() +{ + return new spell_hun_readiness_SpellScript(); +} + void AddSC_hunter_spell_scripts() { - //Script *newscript; + Script *newscript; + + newscript = new Script; + newscript->Name = "spell_hun_last_stand_pet"; + newscript->GetSpellScript = &GetSpellScript_spell_hun_last_stand_pet; + newscript->RegisterSelf(); + + newscript = new Script; + newscript->Name = "spell_hun_masters_call"; + newscript->GetSpellScript = &GetSpellScript_spell_hun_masters_call; + newscript->RegisterSelf(); - /* newscript = new Script; - newscript->Name = "spell_hun_"; - newscript->GetSpellScript = &GetSpellScript_spell_hun_; + newscript->Name = "spell_hun_readiness"; + newscript->GetSpellScript = &GetSpellScript_spell_hun_readiness; newscript->RegisterSelf(); - */ }
\ No newline at end of file diff --git a/src/server/scripts/Spells/spell_rogue.cpp b/src/server/scripts/Spells/spell_rogue.cpp index c3f581e5539..6a43ea56b90 100644 --- a/src/server/scripts/Spells/spell_rogue.cpp +++ b/src/server/scripts/Spells/spell_rogue.cpp @@ -162,7 +162,7 @@ class spell_rog_shiv_SpellScript : public SpellScript void Register() { - // add dummy effect spell handler to Hunger for Blood + // add dummy effect spell handler to Shiv EffectHandlers += EffectHandlerFn(spell_rog_shiv_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY); } }; |