// Ancient's Fury
// Made by IncubiProtocoL
// Cooldowns/mana cost have been set to zero for testing purposes.
// You will need to alter Entangling roots (nuetral hostile 1). Just remove mana cost.
// You also need to edit Chain Lightning to how you'd like it. Its casted many times so don't make damage to high.
// 2 dummy units used. A circle of dummies and one is spawned at the edge of the bushes to cast chain lightning.
// Had to make pathing blockers because locusted units don't seem to have collision.
// Can alter treant to whatever you want. Change its damage etc.
// Mana costs and cool downs are effected by level increases. Chain Lightning damage increases with level and treants last longer.
// The rawcode of the custom spell you use must be 'A000' or change it right below this line.
// Might not be fully MUI since I used a wait. Can't figure out how to resolve.
// Since I'm using all locals maybe it is still MUI.
// Did a test that makes many unit cast it at the same time and no problems.
function Conditions takes nothing returns boolean
if ( not ( GetSpellAbilityId() == 'A000' ) ) then
return false
endif
return true
endfunction
function Condition1 takes nothing returns boolean//Conditions for the treants to spawn.
return ( IsUnitAliveBJ(GetFilterUnit()) == true )
endfunction
function Condition2 takes nothing returns boolean
return ( IsPlayerAlly(GetOwningPlayer(GetFilterUnit()), GetOwningPlayer(GetTriggerUnit())) != true )
endfunction
function TreantCondition takes nothing returns boolean
return GetBooleanAnd( Condition1(), Condition2() )
endfunction
//........................................
function Condition3 takes nothing returns boolean
return ( IsUnitAliveBJ(GetFilterUnit()) == true )
endfunction
function Condition4 takes nothing returns boolean
return ( IsPlayerAlly(GetOwningPlayer(GetFilterUnit()), GetOwningPlayer(GetTriggerUnit())) != true )
endfunction
function DummyCondition takes nothing returns boolean
return GetBooleanAnd( Condition3(), Condition4() )
endfunction
function TreantFunction takes nothing returns nothing // Things that happen to any enemy units withing range of the spell.
call CreateNUnitsAtLoc( 1, 'efon', GetTriggerPlayer(), Location(GetLocationX(GetUnitLoc(GetEnumUnit())), GetLocationY(GetUnitLoc(GetEnumUnit()))), bj_UNIT_FACING )
call UnitApplyTimedLifeBJ( ( 10.00 * I2R(GetUnitAbilityLevelSwapped('A000', GetTriggerUnit())) ), 'BEfn', GetLastCreatedUnit() )
call GroupTargetOrder( GetLastCreatedGroup(), "entanglingroots", GetEnumUnit() )
endfunction
function DummyFunction takes nothing returns nothing
local integer array2
local location array loc3
local real real2 = 90
local unit array dummy2
local location loc2 = GetSpellTargetLoc()
loop
exitwhen real2 == -270
call TriggerSleepAction(.25)
set array2 = array2 + 1
set real2 = real2 - 30
set loc3[13] = PolarProjectionBJ(loc2, 300, real2)
call CreateNUnitsAtLoc( 1, 'h001', GetOwningPlayer(GetTriggerUnit()), loc3[13], GetRandomDirectionDeg() )
call SetUnitAbilityLevelSwapped( 'A001', GetLastCreatedUnit(), GetUnitAbilityLevelSwapped('A000', GetTriggerUnit()) )
call IssueTargetOrder( GetLastCreatedUnit(), "chainlightning", GroupPickRandomUnit(GetUnitsInRangeOfLocAll(400.00, loc2)) )
set dummy2[array2] = GetLastCreatedUnit()
endloop
endfunction
function Actions takes nothing returns nothing //Creates all the local variables
local location loc1 = GetSpellTargetLoc()
local location loc2 = GetSpellTargetLoc()
local location array loc3
local real real1 = 60
local real real2 = 90
local integer array1 = 0
local unit array dummy1
local unit array dummy2
local integer count1 = 0
local unit unit1 = GetTriggerUnit()
local destructable array destr1
loop //Creates a circle of dummies
exitwhen real1 == 420
set real1 = real1 + 15
set array1 = array1 + 1
set loc1 = PolarProjectionBJ(loc2, 300, real1)
call CreateNUnitsAtLoc( 1, 'h000', GetOwningPlayer(GetTriggerUnit()), loc1, bj_UNIT_FACING )
call CreateDestructableLoc( 'YTpc', loc1, GetRandomDirectionDeg(), 1, 0 )
set dummy1[array1] = GetLastCreatedUnit()
set destr1[array1] = GetLastCreatedDestructable()
call RemoveLocation(loc1)
set loc1 = null
endloop //Creates the hand of the clock
call ForGroupBJ( GetUnitsInRangeOfLocMatching(300.00, loc2, Condition(function DummyCondition)), function DummyFunction )
loop //If you use another effect make sure it has a death animation. Since the effect is destroyed instantly.
exitwhen real2 == -270
call TriggerSleepAction( .25 )
set real2 = real2 + -30
set loc3[1] = PolarProjectionBJ(loc2, 25, real2)
set loc3[2] = PolarProjectionBJ(loc2, 50, real2)
set loc3[3] = PolarProjectionBJ(loc2, 75, real2)
set loc3[4] = PolarProjectionBJ(loc2, 100, real2)
set loc3[5] = PolarProjectionBJ(loc2, 125, real2)
set loc3[6] = PolarProjectionBJ(loc2, 150, real2)
set loc3[7] = PolarProjectionBJ(loc2, 175, real2)
set loc3[8] = PolarProjectionBJ(loc2, 200, real2)
set loc3[9] = PolarProjectionBJ(loc2, 225, real2)
set loc3[10] = PolarProjectionBJ(loc2, 250, real2)
set loc3[11] = PolarProjectionBJ(loc2, 275, real2)
set loc3[12] = PolarProjectionBJ(loc2, 300, real2)
call DestroyEffect(AddSpecialEffectLocBJ( loc3[1], "Abilities\\Spells\\Undead\\Possession\\PossessionCaster.mdl" ))
call DestroyEffect(AddSpecialEffectLocBJ( loc3[2], "Abilities\\Spells\\Undead\\Possession\\PossessionCaster.mdl" ))
call DestroyEffect(AddSpecialEffectLocBJ( loc3[3], "Abilities\\Spells\\Undead\\Possession\\PossessionCaster.mdl" ))
call DestroyEffect(AddSpecialEffectLocBJ( loc3[4], "Abilities\\Spells\\Undead\\Possession\\PossessionCaster.mdl" ))
call DestroyEffect(AddSpecialEffectLocBJ( loc3[5], "Abilities\\Spells\\Undead\\Possession\\PossessionCaster.mdl" ))
call DestroyEffect(AddSpecialEffectLocBJ( loc3[6], "Abilities\\Spells\\Undead\\Possession\\PossessionCaster.mdl" ))
call DestroyEffect(AddSpecialEffectLocBJ( loc3[7], "Abilities\\Spells\\Undead\\Possession\\PossessionCaster.mdl" ))
call DestroyEffect(AddSpecialEffectLocBJ( loc3[8], "Abilities\\Spells\\Undead\\Possession\\PossessionCaster.mdl" ))
call DestroyEffect(AddSpecialEffectLocBJ( loc3[9], "Abilities\\Spells\\Undead\\Possession\\PossessionCaster.mdl" ))
call DestroyEffect(AddSpecialEffectLocBJ( loc3[10], "Abilities\\Spells\\Undead\\Possession\\PossessionCaster.mdl" ))
call DestroyEffect(AddSpecialEffectLocBJ( loc3[11], "Abilities\\Spells\\Undead\\Possession\\PossessionCaster.mdl" ))
call DestroyEffect(AddSpecialEffectLocBJ( loc3[12], "Abilities\\Spells\\Undead\\Possession\\PossessionCaster.mdl" ))
call RemoveLocation(loc3[1])
call RemoveLocation(loc3[2])
call RemoveLocation(loc3[3])
call RemoveLocation(loc3[4])
call RemoveLocation(loc3[5])
call RemoveLocation(loc3[6])
call RemoveLocation(loc3[7])
call RemoveLocation(loc3[8])
call RemoveLocation(loc3[9])
call RemoveLocation(loc3[10])
call RemoveLocation(loc3[11])
call RemoveLocation(loc3[12])
set loc3[1] = null
set loc3[2] = null
set loc3[3] = null
set loc3[4] = null
set loc3[5] = null
set loc3[6] = null
set loc3[7] = null
set loc3[8] = null
set loc3[9] = null
set loc3[10] = null
set loc3[11] = null
set loc3[12] = null
endloop
loop //Destroys the circle
exitwhen count1 == 30
call RemoveUnit( dummy1[count1] )
call RemoveUnit( dummy2[count1] )
call RemoveDestructable(destr1[count1] )
set destr1[count1] = null
set dummy1[count1] = null
set dummy2[count1] = null
set count1 = count1 + 1
endloop
call ForGroupBJ( GetUnitsInRangeOfLocMatching(300.00, loc2, Condition(function TreantCondition)), function TreantFunction )
set count1 = 0 //Cleanup
call RemoveLocation(loc2)
set loc2 = null
endfunction
//===========================================================================
function InitTrig_Ancients_Fury_Copy takes nothing returns nothing
set gg_trg_Ancients_Fury_Copy = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Ancients_Fury_Copy, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddCondition( gg_trg_Ancients_Fury_Copy, Condition( function Conditions ) )
call TriggerAddAction( gg_trg_Ancients_Fury_Copy, function Actions )
endfunction