Hi, i ’ m using the latest Rev of TC for Wotlk. I was trying to fix the Death Grip spell of Dk, the spell can be used when the caster is jumping or falling and that its wrong.
The problem in my code is that i cannot make that the code check if the caster is jumping or not, i try with :
if (!player->HasUnitState(UNIT_STATE_JUMPING))
But not success, also i was tried with if (!player->IsFalling()) and i have the same result.
What i m doing wrong?
Sorry if its a noob question but i m learning.
Sorry about the bad english.
Thanks in advance, regards.
Path: TrinitysrcserverscriptsSpellsspell_dk.cpp
[CODE]
// 49560 - Death Grip
class spell_dk_death_grip : public SpellScriptLoader
{
public:
spell_dk_death_grip() : SpellScriptLoader(“spell_dk_death_grip”) { }
class spell_dk_death_grip_SpellScript : public SpellScript
{
PrepareSpellScript(spell_dk_death_grip_SpellScript);
//CRT03
SpellCastResult CheckCast()
{
Player* player = GetCaster()->ToPlayer();
//check if player is jumping
if (!player->HasUnitState(UNIT_STATE_JUMPING))
{
player->AddAura(74396, player); // Remove later just for check in game
return SPELL_CAST_OK;
}
else
{
player->AddAura(70753, player); // Remove later just for check in game
return SPELL_FAILED_SPELL_UNAVAILABLE;
}
return SPELL_CAST_OK;
}
// CRT03
void HandleDummy(SpellEffIndex /effIndex/)
{
int32 damage = GetEffectValue();
Position const* pos = GetExplTargetDest();
if (Unit* target = GetHitUnit())
{
if (!target->HasAuraType(SPELL_AURA_DEFLECT_SPELLS)) // Deterrence
target->CastSpell(pos->GetPositionX(), pos->GetPositionY(), pos->GetPositionZ(), damage, true);
}
}
void Register()
{
OnCheckCast += SpellCheckCastFn(spell_dk_death_grip_SpellScript::CheckCast); // CRT03
OnEffectHitTarget += SpellEffectFn(spell_dk_death_grip_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY);
}
};
SpellScript* GetSpellScript() const
{
return new spell_dk_death_grip_SpellScript();
}
};[/CODE]