function StormEffect takes nothing returns nothing
local timer t = GetExpiredTimer()
local integer id = GetHandleId(t)
local integer max = LoadInteger(udg_Table, id, 'maxh')
local integer already_ran = LoadInteger(udg_Table, id, 'used')
local real x = LoadReal(udg_Table, id, 'tarx')
local real y = LoadReal(udg_Table, id, 'tary')
local unit d = LoadUnitHandle(udg_Table, id, 'dumy')
local real radius = LoadReal(udg_Table, id, 'rang')
local integer lvl = LoadInteger(udg_Table, id, 'levl')
local group g = CreateGroup()
local unit FoG
call GroupEnumUnitsInRange(g,x,y,radius,null)
loop
set FoG = FirstOfGroup(g)
exitwhen FoG == null
if IsUnitEnemy(FoG, GetOwningPlayer(d)) and not IsUnitType(FoG, UNIT_TYPE_MAGIC_IMMUNE) and IsUnitAliveBJ(FoG) then
call ChangeUnitSpeed2( FoG, 0.4, 1.5, false, 'A01A', false )
call DestroyEffect(AddSpecialEffectTarget("Abilities\\Spells\\Other\\Monsoon\\MonsoonBoltTarget.mdl", FoG, "origin"))
call UnitDamageTargetBJ( d , FoG, (40.00+(10.00*I2R(lvl))), ATTACK_TYPE_NORMAL, DAMAGE_TYPE_LIGHTNING )
endif
call GroupRemoveUnit(g, FoG)
endloop
call DestroyGroup(g)
if already_ran == max then
call RecTimer(t)
else
call SaveInteger(udg_Table, id, 'used', already_ran+1)
endif
set t = null
set d = null
set g = null
endfunction
function Trig_Call_Storm takes nothing returns nothing
local unit c = GetTriggerUnit()
local real x = GetSpellTargetX()
local real y = GetSpellTargetY()
local weathereffect rain
local weathereffect wind
/////////////////////////////////////////////
local timer t = GetFreeTimer()
local integer id = GetHandleId(t)
/////////////////////////////////////////////
local unit d = CreateUnit(GetOwningPlayer(c),'h00C',x,y,0.00)
local integer lvl = GetUnitAbilityLevel(c,'A019')
local real spell_radius = 325.00+(25.00*I2R(lvl))
local rect r = Rect(x-spell_radius, y-spell_radius, x+spell_radius, y+spell_radius)
set rain = AddWeatherEffect( r , 'RAhr' )
set wind = AddWeatherEffect( r , 'WNcw' )
call EnableWeatherEffect( rain , true )
call EnableWeatherEffect( wind , true )
/////////////////////////////////////////////////////////////
call SaveInteger(udg_Table, id, 'maxh' , 6+lvl)
call SaveInteger(udg_Table, id, 'used' , 1)
call SaveReal(udg_Table, id, 'tarx' , x)
call SaveReal(udg_Table, id, 'tary' , y)
call SaveUnitHandle(udg_Table, id, 'dumy' , d)
call SaveReal(udg_Table, id, 'rang' , spell_radius)
call SaveInteger(udg_Table, id, 'levl' , lvl)
call TimerStart( t, 1.10 - (lvl*0.1), true, function StormEffect)
set t = null
////////////////////////////////////////////////////////////
call TriggerSleepAction((1.10 - (lvl*0.10))*(7+lvl))
call UnitApplyTimedLife(d, 'BTLF', 0.01)
call EnableWeatherEffect( rain , false )
call EnableWeatherEffect( wind , false )
call RemoveWeatherEffect( rain )
call RemoveWeatherEffect( wind )
call RemoveRect(r)
set d = null
set r = null
endfunction
function Trig_Call_Storm_Conditions takes nothing returns boolean
if GetSpellAbilityId() == 'A019' then
return true
endif
return false
endfunction
//===========================================================================
function InitTrig_Call_Storm takes nothing returns nothing
set gg_trg_Call_Storm = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Call_Storm, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddCondition( gg_trg_Call_Storm, Condition( function Trig_Call_Storm_Conditions ) )
call TriggerAddAction( gg_trg_Call_Storm, function Trig_Call_Storm )
endfunction