Core/Spells: Hunter ability Master's Call should not process effects when pet is dead.

This commit is contained in:
Machiavelli
2011-08-07 16:12:19 +02:00
parent 04c2f2929e
commit 77c0ca3112

View File

@@ -209,50 +209,52 @@ public:
class spell_hun_masters_call : public SpellScriptLoader
{
public:
spell_hun_masters_call() : SpellScriptLoader("spell_hun_masters_call") { }
public:
spell_hun_masters_call() : SpellScriptLoader("spell_hun_masters_call") { }
class spell_hun_masters_call_SpellScript : public SpellScript
{
PrepareSpellScript(spell_hun_masters_call_SpellScript)
bool Validate(SpellInfo const* spellEntry)
class spell_hun_masters_call_SpellScript : public SpellScript
{
if (!sSpellMgr->GetSpellInfo(HUNTER_SPELL_MASTERS_CALL_TRIGGERED))
return false;
if (!sSpellMgr->GetSpellInfo(spellEntry->Effects[EFFECT_0].CalcValue()))
return false;
if (!sSpellMgr->GetSpellInfo(spellEntry->Effects[EFFECT_1].CalcValue()))
return false;
return true;
}
void HandleScriptEffect(SpellEffIndex /*effIndex*/)
{
if (Unit* target = GetHitUnit())
PrepareSpellScript(spell_hun_masters_call_SpellScript)
bool Validate(SpellInfo const* spellEntry)
{
target->CastSpell(target, GetEffectValue(), true);
target->CastSpell(target, HUNTER_SPELL_MASTERS_CALL_TRIGGERED, true);
// there is a possibility that this effect should access effect 0 (dummy) target, but i dubt that
// it's more likely that on on retail it's possible to call target selector based on dbc values
// anyways, we're using GetTargetUnit() here and it's ok
if (Unit* ally = GetTargetUnit())
if (!sSpellMgr->GetSpellInfo(HUNTER_SPELL_MASTERS_CALL_TRIGGERED))
return false;
if (!sSpellMgr->GetSpellInfo(spellEntry->Effects[EFFECT_0].CalcValue()))
return false;
if (!sSpellMgr->GetSpellInfo(spellEntry->Effects[EFFECT_1].CalcValue()))
return false;
return true;
}
void HandleScriptEffect(SpellEffIndex /*effIndex*/)
{
if (Unit* target = GetHitUnit())
{
target->CastSpell(ally, GetEffectValue(), true);
target->CastSpell(ally, GetSpellInfo()->Effects[EFFECT_0].CalcValue(), true);
// Cannot be processed while pet is dead
TriggerCastFlags castMask = TriggerCastFlags(TRIGGERED_FULL_MASK | ~TRIGGERED_IGNORE_CASTER_AURASTATE);
target->CastSpell(target, GetEffectValue(), castMask);
target->CastSpell(target, HUNTER_SPELL_MASTERS_CALL_TRIGGERED, castMask);
// there is a possibility that this effect should access effect 0 (dummy) target, but i dubt that
// it's more likely that on on retail it's possible to call target selector based on dbc values
// anyways, we're using GetTargetUnit() here and it's ok
if (Unit* ally = GetTargetUnit())
{
target->CastSpell(ally, GetEffectValue(), castMask);
target->CastSpell(ally, GetSpellInfo()->Effects[EFFECT_0].CalcValue(), castMask);
}
}
}
}
void Register()
void Register()
{
OnEffect += SpellEffectFn(spell_hun_masters_call_SpellScript::HandleScriptEffect, EFFECT_1, SPELL_EFFECT_SCRIPT_EFFECT);
}
};
SpellScript* GetSpellScript() const
{
OnEffect += SpellEffectFn(spell_hun_masters_call_SpellScript::HandleScriptEffect, EFFECT_1, SPELL_EFFECT_SCRIPT_EFFECT);
return new spell_hun_masters_call_SpellScript();
}
};
SpellScript* GetSpellScript() const
{
return new spell_hun_masters_call_SpellScript();
}
};
class spell_hun_readiness : public SpellScriptLoader