Created
April 11, 2014 19:57
-
-
Save zabustak/10496736 to your computer and use it in GitHub Desktop.
Can't cast l.o.s/stunned/dead pet
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
src/server/scripts/Spells/spell_hunter.cpp | 34 ++++++++++++++++++++++++++++++ | |
1 file changed, 34 insertions(+) | |
diff --git a/src/server/scripts/Spells/spell_hunter.cpp b/src/server/scripts/Spells/spell_hunter.cpp | |
index 2f8a5da..dea4532 100644 | |
--- a/src/server/scripts/Spells/spell_hunter.cpp | |
+++ b/src/server/scripts/Spells/spell_hunter.cpp | |
@@ -421,6 +421,39 @@ class spell_hun_masters_call : public SpellScriptLoader | |
return true; | |
} | |
+ SpellCastResult CheckCast() | |
+ { | |
+ if (Player* caster = GetCaster()->ToPlayer()) | |
+ { | |
+ | |
+ if (Pet* pet = caster->GetPet()) | |
+ { | |
+ if (!pet->IsAlive()) | |
+ { | |
+ return SPELL_FAILED_NO_PET; | |
+ } | |
+ | |
+ if (pet->HasUnitState(UNIT_STATE_STUNNED) || caster->HasUnitState(UNIT_STATE_STUNNED)) | |
+ { | |
+ return SPELL_FAILED_STUNNED; | |
+ } | |
+ | |
+ if (!pet->IsWithinLOS(caster->GetPositionX(), caster->GetPositionY(), caster->GetPositionZ())) | |
+ { | |
+ return SPELL_FAILED_LINE_OF_SIGHT; | |
+ } | |
+ | |
+ if (Unit* target = GetExplTargetUnit()) | |
+ { | |
+ if (!pet->IsWithinLOS(target->GetPositionX(), target->GetPositionY(), target->GetPositionZ())) | |
+ return SPELL_FAILED_LINE_OF_SIGHT; | |
+ } | |
+ } | |
+ } | |
+ | |
+ return SPELL_CAST_OK; | |
+ } | |
+ | |
void HandleDummy(SpellEffIndex /*effIndex*/) | |
{ | |
if (Unit* ally = GetHitUnit()) | |
@@ -445,6 +478,7 @@ class spell_hun_masters_call : public SpellScriptLoader | |
void Register() OVERRIDE | |
{ | |
+ OnCheckCast += SpellCheckCastFn(spell_hun_masters_call_SpellScript::CheckCast); | |
OnEffectHitTarget += SpellEffectFn(spell_hun_masters_call_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY); | |
OnEffectHitTarget += SpellEffectFn(spell_hun_masters_call_SpellScript::HandleScriptEffect, EFFECT_1, SPELL_EFFECT_SCRIPT_EFFECT); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment