constant function Boomer_SpellId takes nothing returns integer
return 'A023'
endfunction
constant function Boomer_Speed takes nothing returns real
return 1000.0
endfunction
constant function Boomer_Angle takes nothing returns real
return 18.0
endfunction
constant function Boomer_Range takes nothing returns real
return 600.0
endfunction
constant function Boomer_Radius takes nothing returns real
return 250.0
endfunction
constant function Boomer_Collision takes nothing returns real
return 80.0
endfunction
constant function Boomer_AnimTimer takes nothing returns real
return 0.025
endfunction
constant function Boomer_Damage takes real level returns real
return 50*level
endfunction
function Boomer_DamageOptions takes nothing returns integer
return DamageTypes(ATTACK_TYPE_NORMAL,DAMAGE_TYPE_FORCE)+DamageOnlyEnemies()
endfunction
function Boomer_Conditions takes nothing returns boolean
return GetSpellAbilityId() == Boomer_SpellId()
endfunction
function BoomerTimer2Loc takes timer t, string s returns location
return Location(GetAttachedReal(t,"X"+s),GetAttachedReal(t,"Y"+s))
endfunction
function BoomerAbsoluteAngle takes real a returns real
if (a<0) then
return a + 360
endif
return a
endfunction
function Boomer_AxeMove takes nothing returns nothing
local timer t = GetExpiredTimer()
local timer tx = GetAttachedTimer(t,"tx")
local unit c = GetAttachedUnit(t,"c")
local unit u = GetAttachedUnit(t,"u")
local unit picked
local integer i = GetUnitAbilityLevel(u,Boomer_SpellId())
local integer mode = GetAttachedInt(t,"mode")
local integer direction = GetAttachedInt(t,"dir")
local group victim = GetAttachedGroup(t,"g")
local group inrange = CreateGroup()
local location l
local location lc = GetUnitLoc(c)
local location lu = GetUnitLoc(u)
local location t1 = BoomerTimer2Loc(t,"1")
local location t2 = BoomerTimer2Loc(t,"2")
local location t3 = BoomerTimer2Loc(t,"3")
local location o = PolarProjectionBJ(lu,80,GetUnitFacing(u)+(Boomer_Angle()*-direction))
local real a = GetAttachedReal(t,"a")
local real d = (Boomer_Speed()*Boomer_AnimTimer()*(2*a+180))/((Boomer_Radius()*bj_PI)*(a/90+1))
local real dist
local boolean end = false
if mode == 1 then
if (DistanceBetweenPoints(lc,t2) >= Boomer_Speed()*Boomer_AnimTimer()) then
set dist = Boomer_Speed()*Boomer_AnimTimer()
else
set dist = DistanceBetweenPoints(lc,t2)
call AttachInt(t,"mode",2)
endif
set l = PolarProjectionBJ(lc,dist,AngleBetweenPoints(lc,t2))
call SetUnitPositionLoc(c,l)
elseif mode == 2 then
if (direction == 1) then
set a = BoomerAbsoluteAngle(AngleBetweenPoints(t1,t3)+AngleBetweenPoints(t1,t2))-BoomerAbsoluteAngle(AngleBetweenPoints(t1,lc)+d+AngleBetweenPoints(t1,t2))
set end = (a >= 0) or ((a < -40) and (a > -360))
else
set a = BoomerAbsoluteAngle(AngleBetweenPoints(t1,t3)-AngleBetweenPoints(t1,t2))-BoomerAbsoluteAngle(AngleBetweenPoints(t1,lc)-d-AngleBetweenPoints(t1,t2))
set end = (a <= 0) or ((a > 40) and (a < 360))
endif
if end then
if (direction == 1) then
set l = PolarProjectionBJ(t1,Boomer_Radius(),AngleBetweenPoints(t1,lc)+d)
else
set l = PolarProjectionBJ(t1,Boomer_Radius(),AngleBetweenPoints(t1,lc)-d)
endif
else
set l = t3
call AttachInt(t,"mode",3)
call AttachInt(tx,"mode",3)
endif
call SetUnitPositionLoc(c,l)
set end = false
elseif mode == 3 then
if (DistanceBetweenPoints(lc,o) >= Boomer_Speed()*Boomer_AnimTimer()) then
set dist = Boomer_Speed()*Boomer_AnimTimer()
else
set dist = DistanceBetweenPoints(lc,o)
set end = true
endif
set l = PolarProjectionBJ(lc,dist,AngleBetweenPoints(lc,o))
call SetUnitPositionLoc(c,l)
endif
call DamageTreesInCircleLoc(l,Boomer_Collision())
call GroupEnumUnitsInRangeOfLoc(inrange,l,Boomer_Collision(),null)
loop
set picked = FirstOfGroup(inrange)
exitwhen picked == null
if IsUnitInGroup(picked,victim) == false then
call GroupAddUnit(victim,picked)
set a=GetDamageFactorByOptions(u,picked,Boomer_DamageOptions())
if a!=0 then
call UnitDamageTarget(u,picked,Boomer_Damage(i)*a,true,false,null,null,null)
call DestroyEffect(AddSpellEffectByIdLoc(Boomer_SpellId(),EFFECT_TYPE_SPECIAL,l))
endif
endif
call GroupRemoveUnit(inrange,picked)
endloop
call DestroyGroup(inrange)
call RemoveLocation(o)
call RemoveLocation(l)
call RemoveLocation(lc)
call RemoveLocation(lu)
call RemoveLocation(t1)
call RemoveLocation(t2)
call RemoveLocation(t3)
if end then
call DestroyGroup(victim)
call DestroyEffect(GetAttachedEffect(c,"fx"))
call AttachObject(c,"fx",null)
call ExplodeUnitBJ(c)
call CleanAttachedVars(t)
call DestroyTimer(t)
endif
endfunction
function Boomer_Init takes nothing returns nothing
local unit u = GetTriggerUnit()
local unit array c
local effect array e
local location array l
local timer t1 = CreateTimer()
local timer t2 = CreateTimer()
local real a
local integer i = 1
set l[0] = GetUnitLoc(u)
set l[1] = PolarProjectionBJ(l[0],80,GetUnitFacing(u)-Boomer_Angle())
set l[2] = PolarProjectionBJ(l[0],80,GetUnitFacing(u)+Boomer_Angle())
set l[3] = PolarProjectionBJ(l[0],Boomer_Range(),GetUnitFacing(u)-Boomer_Angle())
set l[4] = PolarProjectionBJ(l[0],Boomer_Range(),GetUnitFacing(u)+Boomer_Angle())
set l[5] = PolarProjectionBJ(l[3],Boomer_Radius(),GetUnitFacing(u)-90)
set a = AngleBetweenPoints(l[0],l[3])-AngleBetweenPoints(l[0],l[5])
set l[6] = PolarProjectionBJ(l[3],Boomer_Radius(),GetUnitFacing(u)-90-a)
set l[7] = PolarProjectionBJ(l[4],Boomer_Radius(),GetUnitFacing(u)+90+a)
set l[8] = PolarProjectionBJ(l[3],Boomer_Radius(),GetUnitFacing(u)+90+a)
set l[9] = PolarProjectionBJ(l[4],Boomer_Radius(),GetUnitFacing(u)-90-a)
loop
exitwhen i > 2
set c=AddCaster()
call SetUnitOwner(c,GetOwningPlayer(u),true)
call SetUnitFlyHeight(c,S2R(GetAbilityEffectById(Boomer_SpellId(),EFFECT_TYPE_SPECIAL,1)),0)
call SetUnitPositionLoc(c,l)
call AttachObject(c,"fx",AddSpellEffectTargetById(Boomer_SpellId(),EFFECT_TYPE_SPECIAL,c,"origin"))
set i=i+1
endloop
call AttachInt(t1,"dir",1)
call AttachInt(t2,"dir",-1)
call AttachInt(t1,"mode",1)
call AttachInt(t2,"mode",1)
call AttachObject(t1,"c",c[1])
call AttachObject(t2,"c",c[2])
call AttachObject(t1,"u",u)
call AttachObject(t2,"u",u)
call AttachObject(t1,"g",CreateGroup())
call AttachObject(t2,"g",CreateGroup())
call AttachObject(t1,"tx",t2)
call AttachObject(t2,"tx",t1)
call AttachReal(t1,"X1",GetLocationX(l[3]))
call AttachReal(t2,"X1",GetLocationX(l[4]))
call AttachReal(t1,"X2",GetLocationX(l[6]))
call AttachReal(t2,"X2",GetLocationX(l[7]))
call AttachReal(t1,"X3",GetLocationX(l[8]))
call AttachReal(t2,"X3",GetLocationX(l[9]))
call AttachReal(t1,"Y1",GetLocationY(l[3]))
call AttachReal(t2,"Y1",GetLocationY(l[4]))
call AttachReal(t1,"Y2",GetLocationY(l[6]))
call AttachReal(t2,"Y2",GetLocationY(l[7]))
call AttachReal(t1,"Y3",GetLocationY(l[8]))
call AttachReal(t2,"Y3",GetLocationY(l[9]))
call AttachReal(t1,"a",a)
call AttachReal(t2,"a",a)
call TimerStart(t1,0,false,function Boomer_AxeMove)
call TimerStart(t2,0,false,function Boomer_AxeMove)
call TimerStart(t1,Boomer_AnimTimer(),true,function Boomer_AxeMove)
call TimerStart(t2,Boomer_AnimTimer(),true,function Boomer_AxeMove)
set i = 0
loop
exitwhen i > 9
call RemoveLocation(l)
set l = null
set i = i + 1
endloop
endfunction
function InitTrig_Boomer takes nothing returns nothing
set gg_trg_Boomer=CreateTrigger()
call TriggerRegisterAnyUnitEventBJ(gg_trg_Boomer,EVENT_PLAYER_UNIT_SPELL_EFFECT)
call TriggerAddCondition(gg_trg_Boomer,Condition(function Boomer_Conditions))
call TriggerAddAction(gg_trg_Boomer,function Boomer_Init)
endfunction
i need help importing this boomerang ability cause i'm really bad with jass!!! can someone pleaaassse help??!?!
return 'A023'
endfunction
constant function Boomer_Speed takes nothing returns real
return 1000.0
endfunction
constant function Boomer_Angle takes nothing returns real
return 18.0
endfunction
constant function Boomer_Range takes nothing returns real
return 600.0
endfunction
constant function Boomer_Radius takes nothing returns real
return 250.0
endfunction
constant function Boomer_Collision takes nothing returns real
return 80.0
endfunction
constant function Boomer_AnimTimer takes nothing returns real
return 0.025
endfunction
constant function Boomer_Damage takes real level returns real
return 50*level
endfunction
function Boomer_DamageOptions takes nothing returns integer
return DamageTypes(ATTACK_TYPE_NORMAL,DAMAGE_TYPE_FORCE)+DamageOnlyEnemies()
endfunction
function Boomer_Conditions takes nothing returns boolean
return GetSpellAbilityId() == Boomer_SpellId()
endfunction
function BoomerTimer2Loc takes timer t, string s returns location
return Location(GetAttachedReal(t,"X"+s),GetAttachedReal(t,"Y"+s))
endfunction
function BoomerAbsoluteAngle takes real a returns real
if (a<0) then
return a + 360
endif
return a
endfunction
function Boomer_AxeMove takes nothing returns nothing
local timer t = GetExpiredTimer()
local timer tx = GetAttachedTimer(t,"tx")
local unit c = GetAttachedUnit(t,"c")
local unit u = GetAttachedUnit(t,"u")
local unit picked
local integer i = GetUnitAbilityLevel(u,Boomer_SpellId())
local integer mode = GetAttachedInt(t,"mode")
local integer direction = GetAttachedInt(t,"dir")
local group victim = GetAttachedGroup(t,"g")
local group inrange = CreateGroup()
local location l
local location lc = GetUnitLoc(c)
local location lu = GetUnitLoc(u)
local location t1 = BoomerTimer2Loc(t,"1")
local location t2 = BoomerTimer2Loc(t,"2")
local location t3 = BoomerTimer2Loc(t,"3")
local location o = PolarProjectionBJ(lu,80,GetUnitFacing(u)+(Boomer_Angle()*-direction))
local real a = GetAttachedReal(t,"a")
local real d = (Boomer_Speed()*Boomer_AnimTimer()*(2*a+180))/((Boomer_Radius()*bj_PI)*(a/90+1))
local real dist
local boolean end = false
if mode == 1 then
if (DistanceBetweenPoints(lc,t2) >= Boomer_Speed()*Boomer_AnimTimer()) then
set dist = Boomer_Speed()*Boomer_AnimTimer()
else
set dist = DistanceBetweenPoints(lc,t2)
call AttachInt(t,"mode",2)
endif
set l = PolarProjectionBJ(lc,dist,AngleBetweenPoints(lc,t2))
call SetUnitPositionLoc(c,l)
elseif mode == 2 then
if (direction == 1) then
set a = BoomerAbsoluteAngle(AngleBetweenPoints(t1,t3)+AngleBetweenPoints(t1,t2))-BoomerAbsoluteAngle(AngleBetweenPoints(t1,lc)+d+AngleBetweenPoints(t1,t2))
set end = (a >= 0) or ((a < -40) and (a > -360))
else
set a = BoomerAbsoluteAngle(AngleBetweenPoints(t1,t3)-AngleBetweenPoints(t1,t2))-BoomerAbsoluteAngle(AngleBetweenPoints(t1,lc)-d-AngleBetweenPoints(t1,t2))
set end = (a <= 0) or ((a > 40) and (a < 360))
endif
if end then
if (direction == 1) then
set l = PolarProjectionBJ(t1,Boomer_Radius(),AngleBetweenPoints(t1,lc)+d)
else
set l = PolarProjectionBJ(t1,Boomer_Radius(),AngleBetweenPoints(t1,lc)-d)
endif
else
set l = t3
call AttachInt(t,"mode",3)
call AttachInt(tx,"mode",3)
endif
call SetUnitPositionLoc(c,l)
set end = false
elseif mode == 3 then
if (DistanceBetweenPoints(lc,o) >= Boomer_Speed()*Boomer_AnimTimer()) then
set dist = Boomer_Speed()*Boomer_AnimTimer()
else
set dist = DistanceBetweenPoints(lc,o)
set end = true
endif
set l = PolarProjectionBJ(lc,dist,AngleBetweenPoints(lc,o))
call SetUnitPositionLoc(c,l)
endif
call DamageTreesInCircleLoc(l,Boomer_Collision())
call GroupEnumUnitsInRangeOfLoc(inrange,l,Boomer_Collision(),null)
loop
set picked = FirstOfGroup(inrange)
exitwhen picked == null
if IsUnitInGroup(picked,victim) == false then
call GroupAddUnit(victim,picked)
set a=GetDamageFactorByOptions(u,picked,Boomer_DamageOptions())
if a!=0 then
call UnitDamageTarget(u,picked,Boomer_Damage(i)*a,true,false,null,null,null)
call DestroyEffect(AddSpellEffectByIdLoc(Boomer_SpellId(),EFFECT_TYPE_SPECIAL,l))
endif
endif
call GroupRemoveUnit(inrange,picked)
endloop
call DestroyGroup(inrange)
call RemoveLocation(o)
call RemoveLocation(l)
call RemoveLocation(lc)
call RemoveLocation(lu)
call RemoveLocation(t1)
call RemoveLocation(t2)
call RemoveLocation(t3)
if end then
call DestroyGroup(victim)
call DestroyEffect(GetAttachedEffect(c,"fx"))
call AttachObject(c,"fx",null)
call ExplodeUnitBJ(c)
call CleanAttachedVars(t)
call DestroyTimer(t)
endif
endfunction
function Boomer_Init takes nothing returns nothing
local unit u = GetTriggerUnit()
local unit array c
local effect array e
local location array l
local timer t1 = CreateTimer()
local timer t2 = CreateTimer()
local real a
local integer i = 1
set l[0] = GetUnitLoc(u)
set l[1] = PolarProjectionBJ(l[0],80,GetUnitFacing(u)-Boomer_Angle())
set l[2] = PolarProjectionBJ(l[0],80,GetUnitFacing(u)+Boomer_Angle())
set l[3] = PolarProjectionBJ(l[0],Boomer_Range(),GetUnitFacing(u)-Boomer_Angle())
set l[4] = PolarProjectionBJ(l[0],Boomer_Range(),GetUnitFacing(u)+Boomer_Angle())
set l[5] = PolarProjectionBJ(l[3],Boomer_Radius(),GetUnitFacing(u)-90)
set a = AngleBetweenPoints(l[0],l[3])-AngleBetweenPoints(l[0],l[5])
set l[6] = PolarProjectionBJ(l[3],Boomer_Radius(),GetUnitFacing(u)-90-a)
set l[7] = PolarProjectionBJ(l[4],Boomer_Radius(),GetUnitFacing(u)+90+a)
set l[8] = PolarProjectionBJ(l[3],Boomer_Radius(),GetUnitFacing(u)+90+a)
set l[9] = PolarProjectionBJ(l[4],Boomer_Radius(),GetUnitFacing(u)-90-a)
loop
exitwhen i > 2
set c=AddCaster()
call SetUnitOwner(c,GetOwningPlayer(u),true)
call SetUnitFlyHeight(c,S2R(GetAbilityEffectById(Boomer_SpellId(),EFFECT_TYPE_SPECIAL,1)),0)
call SetUnitPositionLoc(c,l)
call AttachObject(c,"fx",AddSpellEffectTargetById(Boomer_SpellId(),EFFECT_TYPE_SPECIAL,c,"origin"))
set i=i+1
endloop
call AttachInt(t1,"dir",1)
call AttachInt(t2,"dir",-1)
call AttachInt(t1,"mode",1)
call AttachInt(t2,"mode",1)
call AttachObject(t1,"c",c[1])
call AttachObject(t2,"c",c[2])
call AttachObject(t1,"u",u)
call AttachObject(t2,"u",u)
call AttachObject(t1,"g",CreateGroup())
call AttachObject(t2,"g",CreateGroup())
call AttachObject(t1,"tx",t2)
call AttachObject(t2,"tx",t1)
call AttachReal(t1,"X1",GetLocationX(l[3]))
call AttachReal(t2,"X1",GetLocationX(l[4]))
call AttachReal(t1,"X2",GetLocationX(l[6]))
call AttachReal(t2,"X2",GetLocationX(l[7]))
call AttachReal(t1,"X3",GetLocationX(l[8]))
call AttachReal(t2,"X3",GetLocationX(l[9]))
call AttachReal(t1,"Y1",GetLocationY(l[3]))
call AttachReal(t2,"Y1",GetLocationY(l[4]))
call AttachReal(t1,"Y2",GetLocationY(l[6]))
call AttachReal(t2,"Y2",GetLocationY(l[7]))
call AttachReal(t1,"Y3",GetLocationY(l[8]))
call AttachReal(t2,"Y3",GetLocationY(l[9]))
call AttachReal(t1,"a",a)
call AttachReal(t2,"a",a)
call TimerStart(t1,0,false,function Boomer_AxeMove)
call TimerStart(t2,0,false,function Boomer_AxeMove)
call TimerStart(t1,Boomer_AnimTimer(),true,function Boomer_AxeMove)
call TimerStart(t2,Boomer_AnimTimer(),true,function Boomer_AxeMove)
set i = 0
loop
exitwhen i > 9
call RemoveLocation(l)
set l = null
set i = i + 1
endloop
endfunction
function InitTrig_Boomer takes nothing returns nothing
set gg_trg_Boomer=CreateTrigger()
call TriggerRegisterAnyUnitEventBJ(gg_trg_Boomer,EVENT_PLAYER_UNIT_SPELL_EFFECT)
call TriggerAddCondition(gg_trg_Boomer,Condition(function Boomer_Conditions))
call TriggerAddAction(gg_trg_Boomer,function Boomer_Init)
endfunction
i need help importing this boomerang ability cause i'm really bad with jass!!! can someone pleaaassse help??!?!