scope EmoBomb initializer Initial
private function Conditions takes nothing returns boolean
return GetSpellAbilityId() == 039;A002039; or GetTriggerEventId() == EVENT_UNIT_TARGET_IN_RANGE
endfunction
private function KillConditions takes nothing returns boolean
return IsUnitEnemy( GetFilterUnit(), GetOwningPlayer( GetTriggerUnit() ) ) == true and GetUnitState( GetFilterUnit(), UNIT_STATE_LIFE ) <= 300
endfunction
private function ExplodeConditions takes nothing returns boolean
return IsUnitEnemy( GetFilterUnit(), GetOwningPlayer( GetTriggerUnit() ) ) == true and GetUnitState( GetFilterUnit(), UNIT_STATE_LIFE ) > 0
endfunction
private function Kill takes nothing returns nothing
call KillUnit( GetEnumUnit() )
endfunction
private function Actions takes nothing returns nothing
local unit Caster = GetTriggerUnit()
local real x
local real y
local unit Dummy
local real Dummyx
local real Dummyy
local group UnitsNear
local integer NOfUnitsNear
local integer NOfUnitsToExplode = 7 - ( GetUnitAbilityLevel( Caster, 039;A002039; ) )
if GetTriggerEventId() == EVENT_UNIT_TARGET_IN_RANGE then
set UnitsNear = GetUnitsInRangeOfLocMatching( 400, GetUnitLoc( Dummy ) , Condition( function ExplodeConditions ) )
set NOfUnitsNear = CountUnitsInGroup2( UnitsNear )
if NOfUnitsNear == NOfUnitsToExplode then
set Dummyx = GetUnitX( Dummy )
set Dummyy = GetUnitY( Dummy )
call KillUnit( Dummy )
set Dummy = CreateUnit( GetOwningPlayer( Caster ), 039;u000039;, Dummyx, Dummyy, 0 )
call SetUnitAnimation( Dummy, 039;birth039; )
call UnitApplyTimedLife( Dummy, 039;BTLF039;, 5.00 )
call UnitAddAbility( Dummy, 039;A001039; )
call IssueTargetOrder( Dummy, "selfdestruct", Dummy )
set UnitsNear = GetUnitsInRangeOfLocMatching( 400, GetUnitLoc( Dummy ) , Condition( function KillConditions ) )
call ForGroup( UnitsNear, function Kill )
endif
else
set Dummy = CreateUnitAtLoc( GetOwningPlayer( Caster ), 039;u000039;, GetSpellTargetLoc(), 0.00 )
call TriggerRegisterUnitInRange( GetTriggeringTrigger(), Dummy, 400.00, BoolexprTrue )
endif
endfunction
private function Initial takes nothing returns nothing
local trigger trig = CreateTrigger()
call TriggerRegisterAnyUnitEventBJ( trig, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddCondition( trig, Condition( function Conditions ) )
call TriggerAddAction( trig, function Actions )
set trig = null
endfunction
endscope
constant unitevent EVENT_UNIT_TARGET_IN_RANGE = ConvertUnitEvent(61)
scope EmoBomb initializer Initial
private function Conditions takes nothing returns boolean
return GetSpellAbilityId() == 039;A002039; or GetTriggerEventId() == ConvertUnitEvent( 61 )
endfunction
private function KillConditions takes nothing returns boolean
return GetUnitState( GetFilterUnit(), UNIT_STATE_LIFE ) <= 300 and IsUnitEnemy( GetFilterUnit(), GetOwningPlayer( GetTriggerUnit() ) ) == true
endfunction
private function ExplodeConditions takes nothing returns boolean
return GetUnitState( GetFilterUnit(), UNIT_STATE_LIFE ) > 0 and IsUnitEnemy( GetFilterUnit(), GetOwningPlayer( GetTriggerUnit() ) ) == true
endfunction
private function Kill takes nothing returns nothing
call KillUnit( GetEnumUnit() )
endfunction
private function Actions takes nothing returns nothing
local unit Caster
local unit Dummy
local real Dummyx
local real Dummyy
local group UnitsNear
local integer NOfUnitsToExplode = 2//7 - ( GetUnitAbilityLevel( Caster, 'A002' ) )
if GetTriggerEventId() == ConvertUnitEvent( 61 ) then
set UnitsNear = GetUnitsInRangeOfLocMatching( 400, GetUnitLoc( Dummy ) , Condition( function ExplodeConditions ) )
if CountUnitsInGroup( UnitsNear ) == NOfUnitsToExplode then
call BJDebugMsg( "Test" )
set Dummyx = GetUnitX( Dummy )
set Dummyy = GetUnitY( Dummy )
call KillUnit( Dummy )
set Dummy = CreateUnit( GetOwningPlayer( Caster ), 039;u001039;, Dummyx, Dummyy, 0 )
call SetUnitAnimation( Dummy, "birth" )
call UnitApplyTimedLife( Dummy, 039;BTLF039;, 10.00 )
set Dummy = CreateUnit( GetOwningPlayer( Caster ), 039;u001039;, Dummyx, Dummyy, 0 )
call UnitAddAbility( Dummy, 039;A001039; )
call IssueTargetOrder( Dummy, "selfdestruct", Dummy )
set UnitsNear = GetUnitsInRangeOfLocMatching( 400, GetUnitLoc( Dummy ) , Condition( function KillConditions ) )
call ForGroup( UnitsNear, function Kill )
endif
else
set Caster = GetTriggerUnit()
set Dummy = CreateUnitAtLoc( GetOwningPlayer( Caster ), 039;u000039;, GetSpellTargetLoc(), 0.00 )
call TriggerRegisterUnitInRange( GetTriggeringTrigger(), Dummy, 400.00, BoolexprTrue )
endif
endfunction
private function Initial takes nothing returns nothing
local trigger trig = CreateTrigger()
call TriggerRegisterAnyUnitEventBJ( trig, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddCondition( trig, Condition( function Conditions ) )
call TriggerAddAction( trig, function Actions )
set trig = null
endfunction
endscope
if CountUnitsInGroup( UnitsNear ) == NOfUnitsToExplode then
call BJDebugMsg( "Test" )
set Dummyx = GetUnitX( Dummy )
set Dummyy = GetUnitY( Dummy )
call KillUnit( Dummy )
set Dummy = CreateUnit( GetOwningPlayer( Caster ), 039;u001039;, Dummyx, Dummyy, 0 )
call SetUnitAnimation( Dummy, "birth" )
call UnitApplyTimedLife( Dummy, 039;BTLF039;, 10.00 )
set Dummy = CreateUnit( GetOwningPlayer( Caster ), 039;u001039;, Dummyx, Dummyy, 0 )
call UnitAddAbility( Dummy, 039;A001039; )
call IssueTargetOrder( Dummy, "selfdestruct", Dummy )
set UnitsNear = GetUnitsInRangeOfLocMatching( 400, GetUnitLoc( Dummy ) , Condition( function KillConditions ) )
call ForGroup( UnitsNear, function Kill )
endif
set Dummy = CreateUnitAtLoc( GetOwningPlayer( Caster ), 039;u000039;, GetSpellTargetLoc(), 0.00 )