cr4xzZz
Also known as azwraith_ftL.
- Reaction score
- 51
I created a spell based on Soul Burn and triggered the damage, because it has to be based on the caster's attributes. However, on cast the game bugs and lags for ~10-15 seconds and I can't seem to find the reason.
I'm not sure it's in the code, because it has no bugs at all.
I'm not sure it's in the code, because it has no bugs at all.
JASS:
scope Doom
globals
private constant integer AID_DOOM = 039;A00G039;
private constant integer BID_DOOM = 039;B009039;
endglobals
private struct Data
unit cast
unit targ
integer ticks
endstruct
private function Conditions takes nothing returns boolean
return GetSpellAbilityId() == AID_DOOM
endfunction
private function Callback takes nothing returns boolean
local Data d = ABCT_GetData()
local real dmg = GetHeroStr(d.cast, true)
if GetWidgetLife(d.targ) < 0.405 or d.ticks < 0 or GetUnitAbilityLevel(d.targ, BID_DOOM) < 1 then
call d.destroy()
return true
else
call UnitDamageTarget(d.cast, d.targ, dmg, false, false, ATTACK_TYPE_MAGIC, DAMAGE_TYPE_MAGIC, null)
endif
set d.ticks = d.ticks - 1
return false
endfunction
private function Actions takes nothing returns nothing
local Data d = Data.create()
local integer lvl
set d.cast = GetTriggerUnit()
set d.targ = GetSpellTargetUnit()
set lvl = GetUnitAbilityLevel(d.cast, AID_DOOM)
if GetHeroInt(d.cast, true) > 0 and GetHeroInt(d.cast, true) < 36 then
set d.ticks = 5
elseif GetHeroInt(d.cast, true) > 35 and GetHeroInt(d.cast, true) < 51 then
set d.ticks = 6
elseif GetHeroInt(d.cast, true) > 50 and GetHeroInt(d.cast, true) < 66 then
set d.ticks = 7
elseif GetHeroInt(d.cast, true) > 65 and GetHeroInt(d.cast, true) < 81 then
set d.ticks = 8
elseif GetHeroInt(d.cast, true) > 80 and GetHeroInt(d.cast, true) < 96 then
set d.ticks = 9
else
set d.ticks = 10
endif
call ABCT_Start(function Callback, d, 1.)
endfunction
function InitTrig_Doom takes nothing returns nothing
local trigger trig = CreateTrigger()
call TriggerRegisterAnyUnitEventBJ(trig, EVENT_PLAYER_UNIT_SPELL_EFFECT)
call TriggerAddCondition(trig, Condition(function Conditions))
call TriggerAddAction(trig, function Actions)
endfunction
endscope