function Trig_Stun_AOE_Actions takes nothing returns nothing
local unit Caster = GetTriggerUnit()
local player Owner = GetOwningPlayer(Caster)
local unit Dummy
local real DummyX = GetUnitX(Caster)
local real DummyY = GetUnitY(Caster)
local real DummyFlyHeight = GetUnitFlyHeight(Caster)
local group G = CreateGroup()
local unit EnumUnit
local integer AbilityLevel = GetUnitAbilityLevel(Caster,'A07E')
call GroupEnumUnitsInRange(G, DummyX,DummyY, 500, null)
loop
set EnumUnit = FirstOfGroup(G)
exitwhen EnumUnit==null
if GetUnitState(EnumUnit, UNIT_STATE_LIFE) > 0 and IsUnitEnemy(EnumUnit, Owner) then
if IsUnitVisible(EnumUnit, Owner) and GetUnitAbilityLevel(EnumUnit, 'Avul') == 0 then
set Dummy = CreateUnit(Owner,'h01B',DummyX,DummyY,0)
call UnitAddAbility(Dummy, 'A07F')
call SetUnitAbilityLevel(Dummy, 'A07F', AbilityLevel)
call SetUnitFlyHeight(Dummy,DummyFlyHeight,0)
call IssueTargetOrder( Dummy, "thunderbolt", EnumUnit )
endif
endif
call GroupRemoveUnit(G, EnumUnit)
endloop
call DestroyGroup(G)
set G = null
set Caster = null
set Owner = null
set Dummy = null
endfunction