Hello every people. Please help me to find some leak. Sorry for my English. I hope you.
JASS:
function Dec takes nothing returns nothing
if (GetDestructableLife(GetEnumDestructable()) >0 ) then
set udg_Decoration = true
endif
endfunction
function GroupPick takes nothing returns boolean
local unit f=GetFilterUnit()
local real r=GetUnitState(f, UNIT_STATE_LIFE)
local boolean b=false
set b=GetBooleanAnd( (r>0), ( IsUnitEnemy(f, GetOwningPlayer(udg_MissileUnit[udg_loopIndex])) == true ) )
set f=null
set r=0
return b
endfunction
function PickUnitDamage takes nothing returns nothing
local unit p=GetEnumUnit()
if ( IsUnitInGroup(p, udg_MissileGroupFire[udg_loopIndex]) == false) then
call UnitDamageTarget( udg_MissileUnit[udg_loopIndex], p, udg_MissileDamage[udg_loopIndex], true, false, ATTACK_TYPE_CHAOS, DAMAGE_TYPE_UNIVERSAL, WEAPON_TYPE_WHOKNOWS )
call GroupAddUnit( udg_MissileGroupFire[udg_loopIndex],p )
endif
set p = null
endfunction
function DamageType1 takes nothing returns nothing
local group G =CreateGroup()
local group G1=CreateGroup()
local location l=udg_MisslePoint
set udg_MisslePoint = PolarLocation(l, udg_MissileSpeed[udg_loopIndex], udg_MissileAngle[udg_loopIndex])
call GroupEnumUnitsInRangeOfLoc(G,udg_MisslePoint,udg_MissileAOE[udg_loopIndex],Condition(function GroupPick) )
call GroupEnumUnitsInRangeOfLoc(G1,udg_MisslePoint,udg_MissileAOED[udg_loopIndex],Condition(function GroupPick) )
if ( FirstOfGroup(G)!= null ) then
call ForGroup( G1, function PickUnitDamage)
endif
call DestroyGroup (G)
set G=null
call DestroyGroup (G1)
set G1=null
call RemoveLocation(l)
set l=null
endfunction
function DamageType2 takes nothing returns nothing
local group G =CreateGroup()
local location l=udg_MisslePoint
call GroupEnumUnitsInRangeOfLoc(G, udg_MisslePoint, udg_MissileAOE[udg_loopIndex], Condition(function GroupPick))
call DestroyBoolExpr(Condition(function GroupPick))
set udg_MisslePoint = PolarLocation(l, udg_MissileSpeed[udg_loopIndex], udg_MissileAngle[udg_loopIndex])
if ( FirstOfGroup(G)!= null ) then
set udg_MissileDistanse[udg_loopIndex]=0
endif
set udg_Decoration = false
call EnumDestructablesInRectAll( RectFromCenterSizeBJ(udg_MisslePoint, 200.00, 200.00), function Dec )
if ( udg_Decoration== true ) then
set udg_MissileDistanse[udg_loopIndex]=0
endif
call DestroyGroup (G)
set G=null
call RemoveLocation(l)
set l=null
endfunction
function DamageFinal takes nothing returns nothing
local group G =CreateGroup()
call GroupEnumUnitsInRangeOfLoc(G, udg_MisslePoint, udg_MissileAOED[udg_loopIndex], Condition(function GroupPick))
if ( FirstOfGroup(G)!= null ) then
call ForGroup( G, function PickUnitDamage)
set udg_MissileDistanse[udg_loopIndex]=0
endif
call DestroyGroup (G)
set G=null
endfunction
function Trig_Shot2_Actions takes nothing returns nothing
local real LifeTarget
local real alfa
local real Sinus
set udg_loopIndex = 1
loop
exitwhen udg_loopIndex > udg_Index
set LifeTarget=GetUnitState(udg_MissileUnit[udg_loopIndex], UNIT_STATE_LIFE)
if (LifeTarget> 0) then
set udg_MisslePoint = GetUnitLoc(udg_MissileUnit[udg_loopIndex])
if (udg_MissileTypeDamage[udg_loopIndex]== 1) then
call DamageType1()
endif
if (udg_MissileTypeDamage[udg_loopIndex]== 2) then
call DamageType2()
endif
call SetUnitPositionLoc( udg_MissileUnit[udg_loopIndex], udg_MisslePoint)
call SetUnitFacing( udg_MissileUnit[udg_loopIndex], udg_MissileAngle[udg_loopIndex])
set udg_MissileDistanse[udg_loopIndex]= udg_MissileDistanse[udg_loopIndex]-udg_MissileSpeed[udg_loopIndex]
if (udg_MissileH[udg_loopIndex]>0) then
set alfa = ( ( 180.00 * udg_MissileDistanse[udg_loopIndex] ) / udg_MissileDistanseO[udg_loopIndex])
set Sinus= ( Sin(alfa*(3.14159/180.00)) * udg_MissileH[udg_loopIndex] )
call SetUnitFlyHeight( udg_MissileUnit[udg_loopIndex], Sinus, 0.00 )
endif
if (udg_MissileDistanse[udg_loopIndex]<=0 ) then
call DamageFinal()
call KillUnit( udg_MissileUnit[udg_loopIndex] )
call DestroyGroup (udg_MissileGroupFire[udg_loopIndex])
set udg_IndexZero = ( udg_IndexZero - 1 )
if ( udg_IndexZero == 0 ) then
call DisableTrigger( gg_trg_Shot2)
endif
endif
endif
call RemoveLocation(udg_MisslePoint)
set udg_loopIndex = udg_loopIndex + 1
endloop
endfunction
//===========================================================================
function InitTrig_Shot2 takes nothing returns nothing
set gg_trg_Shot2 = CreateTrigger( )
call TriggerRegisterTimerEventPeriodic( gg_trg_Shot2, 0.01 )
call TriggerAddAction( gg_trg_Shot2, function Trig_Shot2_Actions )
endfunction