function Trig_Spear_Conditions takes nothing returns boolean
return GetSpellAbilityId()=='A000'
endfunction
function Trig_Spear_Filter takes nothing returns boolean
local unit u=GetFilterUnit()
return IsUnitEnemy(u,udg_Player)==true and GetUnitState(u,UNIT_STATE_LIFE)>0
endfunction
function Trig_Spear_BigDamage takes nothing returns nothing
local unit u=GetEnumUnit()
call UnitDamageTarget(udg_Unit,u,GetUnitState(u,UNIT_STATE_MAX_LIFE)*.25,true,false,ATTACK_TYPE_CHAOS,DAMAGE_TYPE_NORMAL,WEAPON_TYPE_WHOKNOWS)
endfunction
function Trig_Spear_Damage takes nothing returns nothing
local unit u=GetEnumUnit()
call UnitDamageTarget(udg_Unit,u,GetUnitState(u,UNIT_STATE_MAX_LIFE)*.01,true,false,ATTACK_TYPE_CHAOS,DAMAGE_TYPE_NORMAL,WEAPON_TYPE_WHOKNOWS)
endfunction
function Trig_Spear_Actions takes nothing returns nothing
local real array Cord
local unit U=GetSpellAbilityUnit()
local player P=GetOwningPlayer(U)
local integer i=1
local integer I
local unit u
local group g=CreateGroup()
set Cord[0]=GetLocationX(GetSpellTargetLoc())
set Cord[1]=GetLocationY(GetSpellTargetLoc())
//This is the explosion at the epicenter, it's made and is killed 1.5 seconds later then at end of spell is removed.
set u=CreateUnit(P,'h000',Cord[0],Cord[1],0)
call UnitApplyTimedLife(u,'BTLF',1.5)
set udg_Unit=U//These globals pass the owning player and casting unit to check
set udg_Player=P//if the picked unit is an enemy and if so the casting unit deals damage to it.
call GroupEnumUnitsInRange(g,Cord[0],Cord[1],875,Condition(function Trig_Spear_Filter))
call ForGroup(g,function Trig_Spear_BigDamage)//Deals 25% of max unit's hp.
call GroupClear(g)
loop//This loop controls how many steps outward the rings move
exitwhen i>14
set I=1
loop//This loop controls the angle for each part of each ring.
exitwhen I>60
set Cord[4]=2.5
loop//This loop places a peice of all the rings. (2.5,17.5,32.5,47.5,62.5). So five rings. at that distance times i.
exitwhen Cord[4]>62.5
set udg_Unit=U
set udg_Player=P
set Cord[2]=Cord[0]+Cord[4]*i*Cos(6*I*.01745)
set Cord[3]=Cord[1]+Cord[4]*i*Sin(6*I*.01745)
call GroupEnumUnitsInRange(g,Cord[2],Cord[3],100,Condition(function Trig_Spear_Filter))
call ForGroup(g,function Trig_Spear_Damage)//Deals 1% of max unit's hp.
call GroupClear(g)
call DestroyEffect(AddSpecialEffect("Abilities\\Spells\\Human\\Feedback\\SpellBreakerAttack.mdl",Cord[2],Cord[3]))
set Cord[4]=Cord[4]+15
endloop
set I=I+1
endloop
call TriggerSleepAction(0.01)
set i=i+1
endloop
call RemoveUnit(u)
endfunction
function InitTrig_Spear takes nothing returns nothing
set gg_trg_Spear=CreateTrigger()
call TriggerRegisterAnyUnitEventBJ(gg_trg_Spear,EVENT_PLAYER_UNIT_SPELL_EFFECT)
call TriggerAddCondition(gg_trg_Spear,Condition(function Trig_Spear_Conditions))
call TriggerAddAction(gg_trg_Spear,function Trig_Spear_Actions)
endfunction