function Trig_Chaos_Bolt_Conditions takes nothing returns boolean
return GetSpellAbilityId()=='A07H'
endfunction
function Trig_Chaos_Bolt_Actions takes nothing returns nothing
local location liD=GetUnitLoc(GetSpellTargetUnit())
local integer lmZ=GetUnitAbilityLevel(GetTriggerUnit(),'A07H')
local integer lRL=GetRandomInt(1,lmZ)
local unit lfo=GetTriggerUnit()
local unit lFB=GetSpellTargetUnit()
local real lf7=GetRandomReal(1,300)
call CreateNUnitsAtLoc(1,'h006',GetOwningPlayer(lfo),liD,bj_UNIT_FACING)
call UnitAddAbility(bj_lastCreatedUnit,'A07F')
call SetUnitAbilityLevel(bj_lastCreatedUnit,'A07F',lRL)
call IssueTargetOrderById(bj_lastCreatedUnit,OrderId("thunderbolt"),lFB)
call UnitDamageTargetBJ(lfo,lFB,lf7,ATTACK_TYPE_NORMAL,DAMAGE_TYPE_DEATH)
call CreateTextTagUnitBJ( ( "|cff0080FF" + ( I2S(R2I(lRL)) + "!|r" ) ), GetSpellTargetUnit(), 0, 10, 100, 100, 100, 0 )
call SetTextTagPermanentBJ( GetLastCreatedTextTag(), false )
call SetTextTagVelocityBJ( GetLastCreatedTextTag(), 128.00, 90 )
call SetTextTagFadepointBJ( GetLastCreatedTextTag(), 1.00 )
call SetTextTagLifespanBJ( GetLastCreatedTextTag(), 2.00 )
endfunction
//===========================================================================
function InitTrig_Chaos_Bolt takes nothing returns nothing
set gg_trg_Chaos_Bolt=CreateTrigger()
call TriggerRegisterAnyUnitEventBJ(gg_trg_Chaos_Bolt,EVENT_PLAYER_UNIT_SPELL_EFFECT)
call TriggerAddCondition(gg_trg_Chaos_Bolt,Condition(function Trig_Chaos_Bolt_Conditions))
call TriggerAddAction(gg_trg_Chaos_Bolt,function Trig_Chaos_Bolt_Actions)
endfunction