|
发表于 2008-7-31 11:57:49
|
显示全部楼层
[jass]//======================风暴之锤效果=======================
//参数1.目标单位2.施法单位3.移动速度4.伤害5.投射物单位类型6.给予伤害单位
function thunderbolt_2 takes nothing returns nothing
local timer Timer=GetExpiredTimer()
local integer ID = GetTimerIndex(Timer)
local unit U = SYS_TimerData_U00[ID]
local unit JU = SYS_TimerData_U02[ID]
local unit U2 = SYS_TimerData_U01[ID]
local unit LM = SYS_TimerData_U02[ID]
local real S = SYS_TimerData_R00[ID]
local real D = SYS_TimerData_R01[ID]
local real AM = bj_RADTODEG * Atan2(GetUnitY(U) - GetUnitY(LM),GetUnitX(U) - GetUnitX(LM))
local real x = SYS_TimerData_R02[ID]
local real y = SYS_TimerData_R03[ID]
set x = GetUnitX(LM) + S *Cos(AM * bj_DEGTORAD)
set y = GetUnitY(LM) + S *Sin(AM * bj_DEGTORAD)
set SYS_TimerData_R02[ID] = x
set SYS_TimerData_R03[ID] = y
call SetUnitX( LM, x )
call SetUnitY( LM, y )
call SetUnitFacing(LM,AM )
if (SquareRoot((x-GetUnitX(U))*(x-GetUnitX(U))+(y-GetUnitY(U))*(y-GetUnitY(U)))>0)then
call TimerStart(Timer,0.01,false,function thunderbolt_2)
else
call KillUnit( LM )
call UnitDamageTarget(JU,U,D,true,false,ATTACK_TYPE_NORMAL, DAMAGE_TYPE_NORMAL,WEAPON_TYPE_WHOKNOWS)
call ReleaseTimer(Timer)
endif
set U =null
set U2 =null
set Timer =null
set LM =null
set JU = null
endfunction
function thunderbolt takes unit U,unit U2,real S,real D,integer L,unit JU returns nothing
local timer Timer= GetTimer()
local integer ID = GetTimerIndex(Timer)
local real AM = bj_RADTODEG * Atan2(GetUnitY(U) - GetUnitY(U2),GetUnitX(U) - GetUnitX(U2))
local unit LM = CreateUnit(GetOwningPlayer(U2), L, GetUnitX(U2), GetUnitY(U2), AM)
local real x = GetUnitX(U2)
local real y = GetUnitY(U2)
set SYS_TimerData_U00[ID] = U
set SYS_TimerData_U01[ID] = U2
set SYS_TimerData_U02[ID] = JU
set SYS_TimerData_U02[ID] = LM
set SYS_TimerData_R00[ID] = S
set SYS_TimerData_R01[ID] = D
set SYS_TimerData_R02[ID] = x
set SYS_TimerData_R03[ID] = y
call TimerStart(Timer,0.01,false,function thunderbolt_2)
set Timer = null
set LM = null
set JU = null
endfunction[/jass]
以前做的 就是模拟风暴之锤
不过可惜的是...
这里用了数组系统..
所以 看不懂就无视 |
|