function Meteor_Condition takes nothing returns boolean
return GetSpellAbilityId() == 'A000'
endfunction
function ma takes nothing returns nothing
local timer mt = GetExpiredTimer()
local unit mc = GetHandleUnit(mt,"caster")
local location mcl = GetHandleLocation(mt,"location")
local location ml = GetHandleLocation(mt,"location")
local unit md = GetLastCreatedUnit()
local location mdl = GetUnitLoc(md)
local unit mu
call CreateNUnitsAtLoc(1,'m000',GetOwningPlayer(mc),ml,bj_UNIT_FACING)
call UnitApplyTimedLifeBJ(0.9,'BTLF',md)
local group mdg = GetUnitsInRangeOfLocAll(100,mdl)
loop
set mu = FirstOfGroup(mdg)
exitwhen mu==null
if IsUnitEnemy(mu,GetOwningPlayer(mc)) == true then
call GroupRemoveUnit(mdg,mu)
call UnitDamageTargetBJ(mc,mu,50, ATTACK_TYPE_CHAOS,DAMAGE_TYPE_FIRE)
endloop
set mdg = null
set md = null
set mu = null
endfunction
function Meteor_Start takes nothing returns nothing
local timer mt = CreateTimer()
local unit mc = GetSpellAbilityUnit()
local location mcl = GetUnitLoc(mc)
local location ml = GetRandomLocInRect(RectFromCenterSizeBJ(mcl,600 , 600))
local integer mi = 0
call SHHandle(mt , "caster" , mc)
call SHHandle(mt , "location",ml)
call SHHandle(mt , "location",mcl)
call TimerStart(mt,0.04,true,function ma)
call FlushHandleLocal(mt)
if i > 25 then
call PauseTimer(mt)
call DestroyTimer(mt)
endif
set mc = null
call RemoveLocation(mcl)
set mcl = null
call RemoveLocation(mc)
set mc = null
set mi = 0
endfunction
function InitTrig_Meteor takes nothing returns nothing
local trigger mtr = CreateTrigger()
call TriggerRegisterAnyUnitEventBJ(mtr,EVENT_PLAYER_UNIT_SPELL_EFFECT)
call TriggerAddCondition(mtr,Condition(function Meteor_Condition ))
call TriggerAddAction(mtr,function Meteor_Start)
endfunction