function Trig_Corruption_Conditions takes nothing returns boolean
if ( not ( GetSpellAbilityId() == 'A01B' ) ) then
return false
endif
return true
endfunction
function Trig_Corruption_Actions takes nothing returns nothing
local unit caster = GetTriggerUnit()
local unit target = GetSpellTargetUnit()
local player owner = GetOwningPlayer(target)
local integer range = (( GetUnitAbilityLevelSwapped('A01B', caster) ) * 500)
local trigger t = CreateTrigger()
local integer level = ( GetUnitAbilityLevelSwapped('A01B', caster) )
local integer x = 1
local integer expire
local effect fx
call TriggerSleepAction(0.25)
call PauseUnitBJ( true, caster )
call SetUnitAnimation( caster, "spell looping" )
call AddSpecialEffectTargetUnitBJ( "origin", caster, "Abilities\\Spells\\Orc\\Voodoo\\VoodooAura.mdl" )
set fx = GetLastCreatedEffectBJ()
call SetUnitOwner( target, GetOwningPlayer(caster), true )
if (level == 1) then
set expire = 30
elseif (level == 2) then
set expire = 40
elseif (level == 3) then
set expire = 50
else
set expire = 60
endif
loop
exitwhen ( IsUnitDeadBJ(target) == true )
exitwhen ( IsUnitDeadBJ(caster) == true )
exitwhen ( DistanceBetweenPoints(GetUnitLoc(caster), GetUnitLoc(target)) > I2R(range) )
exitwhen (x > expire)
set x = x+1
call TriggerSleepAction(0.10)
endloop
call SetUnitOwner( target, owner, true )
call PauseUnitBJ( false, caster )
call ResetUnitAnimation( caster )
call DestroyEffectBJ( fx )
set target = null
set caster = null
set t = null
set fx = null
endfunction
//===========================================================================
function InitTrig_Corruption takes nothing returns nothing
set gg_trg_Corruption = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Corruption, EVENT_PLAYER_UNIT_SPELL_CAST )
call TriggerAddCondition( gg_trg_Corruption, Condition( function Trig_Corruption_Conditions ) )
call TriggerAddAction( gg_trg_Corruption, function Trig_Corruption_Actions )
endfunction