Immolation
Member
- Reaction score
- 20
JASS:
scope LightningStrike
globals
private constant integer ABILITY_ID = 039;A006039;
endglobals
private function Damage takes unit caster returns real
return I2R(GetHeroAgi(caster, true) + GetHeroStr(caster, true)) * (0.8 + 0.2 * GetUnitAbilityLevel(caster, ABILITY_ID))
endfunction
private function Duration takes unit caster returns real
return 10. + 2. * GetUnitAbilityLevel(caster, ABILITY_ID) + I2R(GetHeroInt(caster, true))
endfunction
private struct Spell extends SpellStruct
implement SpellStruct
method onEffect takes nothing returns nothing
local LightningStrike a = LightningStrike.create(caster)
set a.damage = Damage(caster)
call a.destroyTimed(Duration(caster))
endmethod
private static method onInit takes nothing returns nothing
set thistype.abil = ABILITY_ID
endmethod
endstruct
endscope
JASS:
//! runtextmacro BuffType("LightningStrike")
//! runtextmacro SetBuffName("Lightning Strike")
//! runtextmacro SetBuffAlignment("POSITIVE")
//! runtextmacro SetBuffTooltip("This unit is enhanced with lightning; its next attack will deal splashing damage.")
//! runtextmacro SetBuffIcon("ReplaceableTextures\\CommandButtons\\BTNStormHammer.blp")
//! runtextmacro BuffStruct()
private effect e
real damage
method onApply takes nothing returns nothing
set this.e = AddSpecialEffectTarget("Abilities\\Weapons\\FarseerMissile\\FarseerMissile.mdl", this.unit, "weapon")
endmethod
method onDamageDealt takes nothing returns nothing
if Damage_IsAttack() then
call Damage_Spell(this.unit, GetTriggerUnit(), .damage)
call DestroyEffect(AddSpecialEffectTarget("Abilities\\Weapons\\FarseerMissile\\FarseerMissile.mdl", GetTriggerUnit(), "chest"))
call .setUnit(null)
endif
endmethod
method onRemove takes nothing returns nothing
call DestroyEffect(this.e)
endmethod
//! runtextmacro EndBuff()
So I got these two triggers here, but I got two problems with them:
1) The buff doesn't appear on the unit. (EDIT: Restarting NewGen seemed to fix it.)
2) If I use the ability again, the effect is created twice instead of cancelling the other instance. How to solve this?