Hey, I'm working on a lifebloom type spell that doesn't seem to be working right (basically it's a HoT that when the HoT is either dispelled or wears off from time the unit is healed for a larger amount). Cast_Bloom, setBloomAmount and setBloomTick all work correctly, the issue is that the loop is gone through twice, doing the periodic healing, then is gone through a third time doing the final healing, even though the unit still has the buff. Any ideas?
JASS:
function Trig_Lifebloom_Conditions takes nothing returns boolean
return GetSpellAbilityId()=='A012'
endfunction
function Cast_Bloom takes real h returns nothing
local real l = GetUnitStateSwap(UNIT_STATE_LIFE, GetSpellTargetUnit())
set h = h + l
call SetUnitLifeBJ(GetSpellTargetUnit(),h)
endfunction
function setBloomAmount takes nothing returns real
local real r = I2R(udg_SpellHealing[GetConvertedPlayerId(GetOwningPlayer(GetSpellAbilityUnit()))])
set r = r*(1+.15*I2R(GetUnitAbilityLevel(GetSpellAbilityUnit(),'A012')))+250
return r
endfunction
function setBloomTick takes nothing returns real
local real r = I2R(udg_SpellHealing[GetConvertedPlayerId(GetOwningPlayer(GetSpellAbilityUnit()))])
set r = r * .25+10
return r
endfunction
function Trig_Lifebloom_Actions takes nothing returns nothing
local real h = setBloomAmount()
local real t = setBloomTick()
local integer i = 0
call TriggerSleepAction(1.00)
call Cast_Bloom(t)
loop
exitwhen ( i > 15 )
if ( GetUnitAbilityLevel(GetSpellTargetUnit(),'B004') > 0 ) then
call Cast_Bloom(t)
call TriggerSleepAction(1.00)
else
call Cast_Bloom(h)
return
endif
set i = i + 1
endloop
endfunction
//===========================================================================
function InitTrig_Lifebloom takes nothing returns nothing
set gg_trg_Lifebloom = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ(gg_trg_Lifebloom, EVENT_PLAYER_UNIT_SPELL_CAST)
call TriggerAddCondition( gg_trg_Lifebloom, Condition( function Trig_Lifebloom_Conditions) )
call TriggerAddAction( gg_trg_Lifebloom, function Trig_Lifebloom_Actions )
endfunction
Last edited: