function Trig_Ring_Conditions takes nothing returns boolean
return GetSpellAbilityId() == 'A00Q' //Raw code of the ability.
endfunction
function RingUnitRawCode takes nothing returns integer
return 'e002' //Raw code of the ring dummy (blue).
endfunction
function RingHealAmmount takes nothing returns real
local real heal = 100.0 //The ammount of life gained in total.
return (heal-25)/50 //Note: It is not accurate, that's why "-25" is there.
endfunction
function RingCasterDummyRawCode takes nothing returns integer
return 'e001' //Raw code of your spellcaster dummy.
endfunction
function RingDummyAbilityRawCode takes nothing returns integer
return 'A00R' //Raw code of the dummy ability that deals the damage. Must base it on War Stomp!
endfunction
function Ring_Up takes nothing returns nothing
local timer t = GetExpiredTimer()
local unit array d
local unit u = GetHandleUnit(t, "unit")
local real h = GetHandleReal(t, "h")
local real a = GetHandleReal(t, "a")
local real dis = GetHandleReal(t, "d")
local integer A = 1
local real x = GetUnitX(u)
local real y = GetUnitY(u)
local real nx = 0
local real ny = 0
call SetUnitState(u, UNIT_STATE_LIFE, GetUnitState(u, UNIT_STATE_LIFE) + RingHealAmmount())
loop
exitwhen A > 9
set d[A] = GetHandleUnit(t, "dum"+I2S(A))
set nx = x + dis * Cos(a * (3.14159/180))
set ny = y + dis * Sin(a * (3.14159/180))
call SetUnitFlyHeight(d[A], h, 0)
call SetUnitPosition(d[A], nx, ny)
call SetUnitFacing(d[A], A*40)
set d[A] = null
set a = a + 40
set A = A + 1
endloop
set a = GetHandleReal(t, "a")
call SetHandleReal(t, "a", a + 10)
call SetHandleReal(t, "h", h + 7)
set u = null
endfunction
function Ring_Roll takes nothing returns nothing
local timer t = GetExpiredTimer()
local unit array d
local unit u = GetHandleUnit(t, "unit")
local real a = GetHandleReal(t, "a")
local real dis = GetHandleReal(t, "d")
local integer A = 1
local real x = GetUnitX(u)
local real y = GetUnitY(u)
local real nx = 0
local real ny = 0
loop
exitwhen A > 9
set d[A] = GetHandleUnit(t, "dum"+I2S(A))
set nx = x + dis * Cos(a * (3.14159/180))
set ny = y + dis * Sin(a * (3.14159/180))
call SetUnitPosition(d[A], nx, ny)
call SetUnitFacing(d[A], A*40)
set d[A] = null
set a = a + 40
set A = A + 1
endloop
set a = GetHandleReal(t, "a")
call SetHandleReal(t, "a", a + 10)
call SetHandleReal(t, "d", dis - 2)
set t = null
set u = null
endfunction
function Ring_Down takes nothing returns nothing
local timer t = GetExpiredTimer()
local unit array d
local unit u = GetHandleUnit(t, "unit")
local real h = GetHandleReal(t, "h")
local real a = GetHandleReal(t, "a")
local real dis = GetHandleReal(t, "d")
local real c = GetHandleReal(t, "c")
local integer A = 1
local real x = GetUnitX(u)
local real y = GetUnitY(u)
local real nx = 0
local real ny = 0
loop
exitwhen A > 9
set d[A] = GetHandleUnit(t, "dum"+I2S(A))
set nx = x + dis * Cos(a * (3.14159/180))
set ny = y + dis * Sin(a * (3.14159/180))
call SetUnitFlyHeight(d[A], h, 0)
call SetUnitPosition(d[A], nx, ny)
call SetUnitFacing(d[A], A*40)
set d[A] = null
set a = a + 40
set A = A + 1
endloop
set a = GetHandleReal(t, "a")
call SetHandleReal(t, "c", c + 10)
call SetHandleReal(t, "h", h - c)
set t = null
set u = null
endfunction
function Trig_Ring_Actions takes nothing returns nothing
local timer t = CreateTimer()
local unit u = GetTriggerUnit()
local unit array d
local real x = 0
local real y = 0
local integer A = 1
local unit dummy = null
// call DisplayTextToPlayer(Player(0), 0, 0, "start")
call SetHandleHandle(t, "unit", u)
call SetHandleReal(t, "h", 50)
call SetHandleReal(t, "a", 40)
call SetHandleReal(t, "d", 100)
call SetHandleReal(t, "c", 1)
loop
exitwhen A > 9
set x = GetUnitX(u) + 100 * Cos((A*40) * (3.14159/180))
set y = GetUnitY(u) + 100 * Sin((A*40) * (3.14159/180))
set d[A] = CreateUnit(GetOwningPlayer(u), RingUnitRawCode(), x, y, A*40)
call SetHandleHandle(t, "dum"+I2S(A), d[A])
set A = A + 1
endloop
set A = 1
call TimerStart(t, 0.02, true, function Ring_Up)
call TriggerSleepAction(1)
call PauseTimer(t)
call TimerStart(t, 0.02, true, function Ring_Roll)
call TriggerSleepAction(0.1)
call PauseTimer(t)
call TimerStart(t, 0.02, true, function Ring_Down)
call TriggerSleepAction(0.1)
set x = GetUnitX(u)
set y = GetUnitY(u)
call DestroyEffect(AddSpecialEffect("Abilities\\Spells\\Human\\Thunderclap\\ThunderClapCaster.mdl", x, y))
call PauseTimer(t)
set dummy = CreateUnit(GetOwningPlayer(u), RingCasterDummyRawCode(), GetUnitX(u), GetUnitY(u), 0)
call UnitApplyTimedLife(dummy, 'BTLF', 1)
call UnitAddAbility(dummy, RingDummyAbilityRawCode())
call SetUnitAbilityLevel(dummy, RingDummyAbilityRawCode(), GetUnitAbilityLevel(u, GetSpellAbilityId()))
call IssueImmediateOrder(dummy, "stomp")
set dummy = null
loop
exitwhen A > 9
call KillUnit(GetHandleUnit(t, "dum"+I2S(A)))
set A = A + 1
endloop
call FlushHandleLocals(t)
call PauseTimer(t)
call DestroyTimer(t)
set t = null
set u = null
endfunction
//===========================================================================
function InitTrig_Ring takes nothing returns nothing
set gg_trg_Ring = CreateTrigger( )
// call DisableTrigger( gg_trg_Ring )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Ring, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddCondition( gg_trg_Ring, Condition( function Trig_Ring_Conditions ) )
call TriggerAddAction( gg_trg_Ring, function Trig_Ring_Actions )
call Preload("Abilities\\Spells\\Human\\Thunderclap\\ThunderClapCaster.mdl")
endfunction