function Trig_Snowfall_Conditions takes nothing returns boolean
return GetSpellAbilityId() == 'A000'
endfunction
function Trig_Snowfall_Fall takes nothing returns nothing
local timer tt = GetExpiredTimer()
local unit target = GetHandleUnit(tt, "target")
local unit d = GetHandleUnit(tt, "dummy")
call SetUnitPosition(d, GetUnitX(target), GetUnitY(target))
call SetUnitFlyHeight(d, GetUnitFlyHeight(d) - 5, 0)
if GetUnitFlyHeight(d) < 60 then
call IssueTargetOrder(d, "frostnova", target)
call UnitApplyTimedLife(d, 'BTLF', 0.1)
call FlushHandleLocals(tt)
call DestroyTimer(tt)
endif
set tt = null
set target = null
set d = null
endfunction
function Trig_Snowfall_Target takes nothing returns nothing
local timer t = GetExpiredTimer()
local timer tt
local unit caster = GetHandleUnit(t, "caster")
local group g = GetUnitsInRangeOfLocMatching(900, GetUnitLoc(caster), null)
local unit u = null
local unit d = null
loop
set u = FirstOfGroup(g)
call GroupRemoveUnit(g, u)
exitwhen u == null
if IsUnitEnemy(u, GetOwningPlayer(caster)) and IsUnitType(u, UNIT_TYPE_MAGIC_IMMUNE) == false then
set d = CreateUnit(GetOwningPlayer(caster), 'e000', GetUnitX(u), GetUnitY(u), 0)
set tt = = CreateTimer()
call SetHandleHandle(tt, "target", u)
call SetHandleHandle(tt, "dummy", d)
call TimerStart(tt, 0.03, true, function Trig_Snowfall_Fall)
set d = null
set tt = null
endif
endloop
call DestroyGroup(g)
call SetHandleInt(t, "times", GetHandleInt(t, "times") + 1)
if GetHandleInt(t, "times") == 30 then
call PauseTimer(t)
call FlushHandleLocals(t)
call DestroyTimer(t)
endif
set t = null
set caster = null
endfunction
function Trig_Snowfall_Actions takes nothing returns nothing
local unit caster = GetTriggerUnit()
local timer t = CreateTimer()
call SetHandleHandle(t, "caster", caster)
call TimerStart(t, 1, true, function Trig_Snowfall_Target)
set t = null
set caster = null
endfunction
//===========================================================================
function InitTrig_Snowfall takes nothing returns nothing
set gg_trg_Snowfall = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Snowfall, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddCondition( gg_trg_Snowfall, Condition( function Trig_Snowfall_Conditions ) )
call TriggerAddAction( gg_trg_Snowfall, function Trig_Snowfall_Actions )
endfunction