Hola guys, i am a rookie but would like to learn a bit on spells. In this case “Ice Lance” it “works” but i cant handle triple damage on frozen target.
// Ice Lance - 30455
class spell_mage_ice_lance : public SpellScriptLoader
{
public:
spell_mage_ice_lance() : SpellScriptLoader(“spell_mage_ice_lance”) { }
class spell_mage_ice_lance_SpellScript : public SpellScript
{
PrepareSpellScript(spell_mage_ice_lance_SpellScript);
bool Validate(SpellInfo const* /*spellInfo*/) override
{
return ValidateSpellInfo
({
SPELL_MAGE_ICE_LANCE, // 30455
SPELL_MAGE_ICE_LANCE_TRIGGER // 228598
});
}
void HandleOnHit(SpellEffIndex /*effIndex*/)
{
Unit* caster = GetCaster();
Unit* target = GetHitUnit();
if (!caster && !target)
return;
caster->CastSpell(target, SPELL_MAGE_ICE_LANCE_TRIGGER, true);
// TODO damage x 3 on frozen target
int32 damage = GetHitDamage();
/if(target->HasAuraState(AURA_STATE_FROZEN)) {
damage = damage * 3;
//}
SetHitDamage(damage);
}
void Register() override
{
OnEffectHitTarget += SpellEffectFn(spell_mage_ice_lance_SpellScript::HandleOnHit, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT);
}
};
I cant understand how to do triple the damage:
if i use SetHitDamage( GetHitDamage()*3 ) i always deal only GetHitDamage()
if i use SetHitDamage( GetHitDamage() + 1000 ); i deal two damage numbers, the spell’s base one and another number of 1000 damage
if i use SetHitDamage( 4000 ); i deal exactly 4000 damage as i expect
Any tips? Thanks!