function Trig_Chakra_Force_Conditions takes nothing returns boolean
if ( not ( GetSpellAbilityId() == 'A03F' ) ) then
return false
endif
return true
endfunction
function GetEnumDestructablefunction takes nothing returns nothing
call KillDestructable( GetEnumDestructable() )
endfunction
function GetExplodedUnitfunction takes nothing returns nothing
call SetUnitExploded( GetEnumUnit(), true )
endfunction
function UnitType1 takes nothing returns boolean
return ( IsUnitType(GetFilterUnit(), UNIT_TYPE_STRUCTURE) == false )
endfunction
function UnitType2 takes nothing returns boolean
return ( IsUnitType(GetFilterUnit(), UNIT_TYPE_MAGIC_IMMUNE) == false )
endfunction
function UnitType3 takes nothing returns boolean
return ( IsUnitEnemy(GetFilterUnit(), GetOwningPlayer(GetSpellAbilityUnit())) == true )
endfunction
function UnitType4 takes nothing returns boolean
return ( GetUnitStateSwap(UNIT_STATE_LIFE, GetFilterUnit()) <= 230.00 )
endfunction
function UnitTypeLauncher3 takes nothing returns boolean
return GetBooleanAnd ( UnitType3(), UnitType4() )
endfunction
function UnitTypeLauncher2 takes nothing returns boolean
return GetBooleanAnd ( UnitType2(), UnitTypeLauncher3() )
endfunction
function UnitTypeLauncher1 takes nothing returns boolean
return GetBooleanAnd ( UnitType1(), UnitTypeLauncher2() )
endfunction
function Trig_Chakra_Force_Actions takes nothing returns nothing
local integer ChakraForceLevel = GetUnitAbilityLevel( GetSpellAbilityUnit(), 'A03F')
local location ChakraForceTarget = GetSpellTargetLoc()
local unit array ChakraForceBall
set ChakraForceBall[1] = CreateUnitAtLoc( GetOwningPlayer(GetSpellAbilityUnit()), 'n00L', ChakraForceTarget, 270.00)
call UnitApplyTimedLife( ChakraForceBall[1], 'BTLF', 3.00 )
call RemoveLocation(ChakraForceTarget)
loop
exitwhen IsUnitAliveBJ(ChakraForceBall[1]) == true
call SetUnitScalePercent( ChakraForceBall[1], 104.00, 104.00, 104.00 )
endloop
call EnumDestructablesInCircleBJ( 400.00, ChakraForceTarget, function GetEnumDestructablefunction )
set ChakraForceBall[2] = CreateUnitAtLoc( GetOwningPlayer(GetSpellAbilityUnit()), 'n00M', ChakraForceTarget, 270.00)
call UnitApplyTimedLife( ChakraForceBall[2], 'BTLF', 0.50 )
call UnitAddAbility( ChakraForceBall[2], 'A03G' )
call SetUnitAbilityLevel( ChakraForceBall[2], 'A03G', ChakraForceLevel )
call IssueImmediateOrder(ChakraForceBall[2], "fanofknives" )
call ForGroupBJ( GetUnitsInRangeOfLocMatching(500.00, ChakraForceTarget, Condition(function UnitType1 )), function GetExplodedUnitfunction )
call RemoveLocation(ChakraForceTarget)
set ChakraForceBall[1] = null
set ChakraForceBall[2] = null
endfunction
//===========================================================================
function InitTrig_Chakra_Force takes nothing returns nothing
set gg_trg_Chakra_Force = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Chakra_Force, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddCondition( gg_trg_Chakra_Force, Condition( function Trig_Chakra_Force_Conditions ) )
call TriggerAddAction( gg_trg_Chakra_Force, function Trig_Chakra_Force_Actions )
endfunction