library UniMissileSystem3D initializer Init
globals
private real array SP
private real array RA
private real array DM
private real array DI
private real array AN
private real array ANZ
private real array HE
private real array HEMax
private real array SH
private real array US
private real array MX
private real array MY
private real array MZ
private real array ARC
private real array HP
private real array OF
private real array OS
private real array TIM
private real array LT
private real array SZ
private real array RI
private real array R01
private real array R02
private real array MGra
private real array LOC
private real array OH
private real Gravity=0.40
private unit array MU
private unit array MT
private unit DamageUnit
private string array EF
private effect array EFL
private real array ACC
private real array MaxS
private real array SPX
private real array SPY
private real array LastX
private real array LastY
private real array MKs
private integer array IN
private integer Top=-1
private real TIMOut=0.03
private group DamageGroup
private timer TIMr
private location HeroLoc
private location array MLoc
private player array LastOwner
boolean MissileTimerPause=false
private real map_max_X
private real map_max_Y
private real map_min_X
private real map_min_Y
endglobals
private function DistanceBetweenXY takes real x1,real x2,real y1,real y2 returns real
return SquareRoot((x1-x2)*(x1-x2)+(y1-y2)*(y1-y2))
endfunction
private function AngleBetweenXY takes real x1, real x2, real y1, real y2 returns real
return bj_RADTODEG*Atan2(y2-y1,x2-x1)
endfunction
private function GetAngleBetweenUnits takes unit A,unit B returns real
return Atan2(GetUnitY(B)-GetUnitY(A),GetUnitX(B)-GetUnitX(A))
endfunction
private function DistanceBetweenUnits takes unit A,unit B returns real
local real x1=GetUnitX(A)
local real x2=GetUnitX(B)
local real y1=GetUnitY(A)
local real y2=GetUnitY(B)
return SquareRoot((x1-x2)*(x1-x2)+(y1-y2)*(y1-y2))
endfunction
private function GetAcceleratedTime takes real dis, real originspeed, real accel returns real
local real t1=0.0
local real t2=0.0
set t1=(-1*originspeed+SquareRoot(Pow(originspeed,2.0)+2*accel*dis))/accel
set t2=(-1*originspeed-SquareRoot(Pow(originspeed,2.0)+2*accel*dis))/accel
if t1==0. then
set t1=0.01
endif
if t2==0. then
set t2=0.01
endif
if t1>t2 then
return t1
endif
return t2
endfunction
private function MRegister takes unit missile returns nothing
call UnitAddAbility(missile,'Arav')
call UnitRemoveAbility(missile,'Arav')
call SetUnitPosition(missile,GetUnitX(missile),GetUnitY(missile))
call SetUnitAnimationByIndex(missile, 90 )
endfunction
private function MPop takes integer i returns nothing
if GetUnitState(MU[i],UNIT_STATE_LIFE)>0.4 then
call KillUnit(MU[i])
endif
call DestroyEffect(EFL[i])
set MU[i]=MU[Top]
set SP[i]=SP[Top]
set RA[i]=RA[Top]
set DM[i]=DM[Top]
set DI[i]=DI[Top]
set AN[i]=AN[Top]
set HE[i]=HE[Top]
set HEMax[i]=HEMax[Top]
set US[i]=US[Top]
set ARC[i]=ARC[Top]
set HP[i]=HP[Top]
set EF[i]=EF[Top]
set EFL[i]=EFL[Top]
set SH[i]=SH[Top]
set MGra[i]=MGra[Top]
set LOC[i]=LOC[Top]
set TIM[i]=TIM[Top]
set LT[i]=LT[Top]
set SZ[i]=SZ[Top]
set RI[i]=RI[Top]
set R01[i]=R01[Top]
set R02[i]=R02[Top]
set MT[i]=MT[Top]
set OH[i]=OH[Top]
set OS[i]=OS[Top]
set OF[i]=OF[Top]
set ACC[i]=ACC[Top]
set MaxS[i]=MaxS[Top]
set MKs[i]=MKs[Top]
set SPX[i]=SPX[Top]
set SPY[i]=SPY[Top]
set LastX[i]=LastX[Top]
set LastY[i]=LastY[Top]
set IN[i]=IN[Top]
set LastOwner[i]=LastOwner[Top]
set MU[Top]=null
set MT[Top]=null
set Top=Top-1
endfunction
private function MLimit takes real x, real y returns boolean
if x>map_max_X or x<map_min_X or y>map_max_Y or y<map_min_Y then//边界判定
return true
else
return false
endif
endfunction
globals
private real array SP
private real array RA
private real array DM
private real array DI
private real array AN
private real array ANZ
private real array HE
private real array HEMax
private real array SH
private real array US
private real array MX
private real array MY
private real array MZ
private real array ARC
private real array HP
private real array OF
private real array OS
private real array TIM
private real array LT
private real array SZ
private real array RI
private real array R01
private real array R02
private real array MGra
private real array LOC
private real array OH
private real Gravity=0.40
private unit array MU
private unit array MT
private unit DamageUnit
private string array EF
private effect array EFL
private real array ACC
private real array MaxS
private real array SPX
private real array SPY
private real array LastX
private real array LastY
private real array MKs
private integer array IN
private integer Top=-1
private real TIMOut=0.03
private group DamageGroup
private timer TIMr
private location HeroLoc
private location array MLoc
private player array LastOwner
boolean MissileTimerPause=false
private real map_max_X
private real map_max_Y
private real map_min_X
private real map_min_Y
endglobals
private function DistanceBetweenXY takes real x1,real x2,real y1,real y2 returns real
return SquareRoot((x1-x2)*(x1-x2)+(y1-y2)*(y1-y2))
endfunction
private function AngleBetweenXY takes real x1, real x2, real y1, real y2 returns real
return bj_RADTODEG*Atan2(y2-y1,x2-x1)
endfunction
private function GetAngleBetweenUnits takes unit A,unit B returns real
return Atan2(GetUnitY(B)-GetUnitY(A),GetUnitX(B)-GetUnitX(A))
endfunction
private function DistanceBetweenUnits takes unit A,unit B returns real
local real x1=GetUnitX(A)
local real x2=GetUnitX(B)
local real y1=GetUnitY(A)
local real y2=GetUnitY(B)
return SquareRoot((x1-x2)*(x1-x2)+(y1-y2)*(y1-y2))
endfunction
private function GetAcceleratedTime takes real dis, real originspeed, real accel returns real
local real t1=0.0
local real t2=0.0
set t1=(-1*originspeed+SquareRoot(Pow(originspeed,2.0)+2*accel*dis))/accel
set t2=(-1*originspeed-SquareRoot(Pow(originspeed,2.0)+2*accel*dis))/accel
if t1==0. then
set t1=0.01
endif
if t2==0. then
set t2=0.01
endif
if t1>t2 then
return t1
endif
return t2
endfunction
private function MRegister takes unit missile returns nothing
call UnitAddAbility(missile,'Arav')
call UnitRemoveAbility(missile,'Arav')
call SetUnitPosition(missile,GetUnitX(missile),GetUnitY(missile))
call SetUnitAnimationByIndex(missile, 90 )
endfunction
private function MPop takes integer i returns nothing
if GetUnitState(MU[i],UNIT_STATE_LIFE)>0.4 then
call KillUnit(MU[i])
endif
call DestroyEffect(EFL[i])
set MU[i]=MU[Top]
set SP[i]=SP[Top]
set RA[i]=RA[Top]
set DM[i]=DM[Top]
set DI[i]=DI[Top]
set AN[i]=AN[Top]
set HE[i]=HE[Top]
set HEMax[i]=HEMax[Top]
set US[i]=US[Top]
set ARC[i]=ARC[Top]
set HP[i]=HP[Top]
set EF[i]=EF[Top]
set EFL[i]=EFL[Top]
set SH[i]=SH[Top]
set MGra[i]=MGra[Top]
set LOC[i]=LOC[Top]
set TIM[i]=TIM[Top]
set LT[i]=LT[Top]
set SZ[i]=SZ[Top]
set RI[i]=RI[Top]
set R01[i]=R01[Top]
set R02[i]=R02[Top]
set MT[i]=MT[Top]
set OH[i]=OH[Top]
set OS[i]=OS[Top]
set OF[i]=OF[Top]
set ACC[i]=ACC[Top]
set MaxS[i]=MaxS[Top]
set MKs[i]=MKs[Top]
set SPX[i]=SPX[Top]
set SPY[i]=SPY[Top]
set LastX[i]=LastX[Top]
set LastY[i]=LastY[Top]
set IN[i]=IN[Top]
set LastOwner[i]=LastOwner[Top]
set MU[Top]=null
set MT[Top]=null
set Top=Top-1
endfunction
private function MLimit takes real x, real y returns boolean
if x>map_max_X or x<map_min_X or y>map_max_Y or y<map_min_Y then//边界判定
return true
else
return false
endif
endfunction