function Trig_Target_Heal_JASS_Actions takes nothing returns nothing
local real healing
local unit target
local unit caster
local unit dummy
local integer cycle
local effect healeffect
local location casterpoint
local location targetpoint
set udg_HoTCaster = GetSpellAbilityUnit()
set udg_HoTTarget = GetSpellTargetUnit()
set udg_HoTHeal = ( ( ( I2R(GetUnitAbilityLevelSwapped(GetSpellAbilityId(), GetSpellAbilityUnit())) * 0.05 ) * I2R(GetHeroStatBJ(bj_HEROSTAT_INT, GetSpellAbilityUnit(), true)) ) + ( I2R(GetUnitAbilityLevelSwapped(GetSpellAbilityId(), GetSpellAbilityUnit())) * 15.00 ) )
set caster = udg_HoTCaster
set target= udg_HoTTarget
set healing = udg_HoTHeal
set cycle = 1
set casterpoint = GetUnitLoc(caster)
set targetpoint = GetUnitLoc(target)
if ( ( UnitHasBuffBJ(target, 'B002') == true) ) then
call RemoveLocation(casterpoint)
call RemoveLocation(targetpoint)
set caster = null
set target= null
set healing = 0
return
endif
call CreateNUnitsAtLocFacingLocBJ( 1, 'h00A', GetOwningPlayer(caster), casterpoint, targetpoint )
set dummy = GetLastCreatedUnit()
call IssueTargetOrderBJ( dummy, "rejuvination", target)
loop
exitwhen cycle > 100
if ( GetBooleanAnd (IsUnitAliveBJ(target) == true, UnitHasBuffBJ(target, 'B002') == true)) then
call AddSpecialEffectTargetUnitBJ( "chest", target, "Abilities\\Spells\\Human\\Heal\\HealTarget.mdl" )
set healeffect = GetLastCreatedEffectBJ()
call SetUnitLifeBJ( target,( GetUnitStateSwap(UNIT_STATE_LIFE, target)+ healing) )
call PolledWait( 0.5)
call DestroyEffectBJ (healeffect)
set cycle = (cycle + 1)
else
set cycle = 100
endif
endloop
call RemoveUnit( dummy )
call RemoveLocation(casterpoint)
call RemoveLocation(targetpoint)
set caster = null
set target= null
set healing = 0
endfunction