|
这个是循环提供的几个函数(附带演示地图)
伤害函数在1楼
function SYS_MassCycleInit takes integer TypeId,boolean EndRemove, unit ou,real time,real r,real d,real ad,real inv,integer MaxUnitNum returns timer
为一个单位初始化一个特征码为i的循环并自动运行,如果单位存在该特征循环则重新新设置该循环持续时间和最大单位数量
function SYS_MassCycleLoop takes nothing returns nothing
转圈的主函数,和某个Timer绑定并运行即可
function GetMassCycleTimer takes unit ou,integer i returns timer
可以用来获取单位ou特征码为i的循环用计时器
function SYS_MassCycleGetUnitNum takes unit ou,integer TypeId returns integer
可以用来获取单位ou特征码为i的循环单位数量
function SYS_MassCycleGetUnit takes unit ou,integer TypeId returns unit
从单位ou特征码为i的循环中取出一个单位
function SYS_MassCycleAddUnit takes unit ou,integer TypeId,unit u returns boolean
为单位ou特征码为i的循环增加一个单位u
[jass]//================
function SYS_MassCycleLoop takes nothing returns nothing
local integer tmIndex = GetTimerIndex(GetExpiredTimer())
local unit u
local unit ou = SYS_TimerData_U00[tmIndex]
local integer uIndex = GetUnitUserData(ou)
local real x
local real y
local real ox = GetUnitX(ou)
local real oy = GetUnitY(ou)
local real angleTemp = 0.00
local real angleCurrent = SYS_TimerData_R00[tmIndex]
local real angleAdd = SYS_TimerData_R01[tmIndex]
local real r = SYS_TimerData_R02[tmIndex]
local real inv = SYS_TimerData_R03[tmIndex]
local real timeLeft = SYS_TimerData_R04[tmIndex]
local real FacingConfig = 0.00
local integer uNum = SYS_TimerData_I01[tmIndex]
local boolean EndRemove = SYS_TimerData_B00[tmIndex]
local integer i = 1
local boolean Invisable = IsUnitInvisible(ou,Player(PLAYER_NEUTRAL_PASSIVE))
if(angleAdd>0.00)then
set FacingConfig = 90.00
elseif(angleAdd<0.00)then
set FacingConfig = -90.00
else
return
endif
set angleCurrent = angleCurrent + angleAdd
set timeLeft = timeLeft - inv
if(angleCurrent>=360.00)then
set angleCurrent = I2R(ModuloInteger(R2I(angleCurrent),360))
elseif(angleCurrent<=-360.00)then
set angleCurrent = -I2R(ModuloInteger(-R2I(angleCurrent),360))
endif
if(uNum==0 or GetUnitState(ou,UNIT_STATE_LIFE)<=0.00)then
set timeLeft = 0.00
endif
set SYS_TimerData_R00[tmIndex] = angleCurrent
set SYS_TimerData_R04[tmIndex] = timeLeft
loop
exitwhen(i>uNum)
set u = TimerDataConfig_Unit(tmIndex,i,false,null)
if(u!=null)then
set angleTemp = angleCurrent + (360.00*(I2R(i-1)/I2R(uNum)))
set x = ox + Cos(angleTemp*bj_DEGTORAD)*r
set y = oy + Sin(angleTemp*bj_DEGTORAD)*r
call SetUnitX(u,x)
call SetUnitY(u,y)
call SetUnitFacing(u,angleTemp+FacingConfig)
if(not(Invisable) and GetUnitAbilityLevel(u,'Agho')>0 and GetUnitTypeId(u)!='ushd')then
call UnitRemoveAbility(u,'Agho')
elseif(Invisable and GetUnitAbilityLevel(u,'Agho')<=0)then
call UnitAddAbility(u,'Agho')
endif
if(timeLeft<=0.00 and EndRemove)then
call DeadUnitConfig(u)
call ReleaseUnitInfo_EX(u)
call RemoveUnit_EX(u)
endif
endif
set i = i + 1
endloop
if(timeLeft<=0.00)then
if(uIndex>0)then
if(RPG_UnitData_OrbLoopTimer_00[uIndex]==GetExpiredTimer())then
set RPG_UnitData_OrbLoopTimer_00[uIndex] = null
elseif(RPG_UnitData_OrbLoopTimer_01[uIndex]==GetExpiredTimer())then
set RPG_UnitData_OrbLoopTimer_01[uIndex] = null
elseif(RPG_UnitData_OrbLoopTimer_02[uIndex]==GetExpiredTimer())then
set RPG_UnitData_OrbLoopTimer_02[uIndex] = null
endif
endif
call ReleaseTimer(GetExpiredTimer())
endif
set u = null
set ou = null
endfunction
function GetMassCycleTimer takes unit ou,integer i returns timer
local integer uIndex = GetUnitUserData(ou)
if(uIndex>0)then
if(i==0)then
return RPG_UnitData_OrbLoopTimer_00[uIndex]
elseif(i==1)then
return RPG_UnitData_OrbLoopTimer_01[uIndex]
elseif(i==2)then
return RPG_UnitData_OrbLoopTimer_02[uIndex]
endif
endif
return null
endfunction
function SYS_MassCycleGetTypeId takes unit ou,integer i returns integer
local integer tmIndex
local timer tm = GetMassCycleTimer(ou,i)
local integer TypeId
if(tm!=null)then
set tmIndex = GetTimerIndex(tm)
set tm = null
return SYS_TimerData_I00[tmIndex]
endif
set tm = null
return 0
endfunction
function SYS_MassCycleGetUnitNum takes unit ou,integer TypeId returns integer
local integer tmIndex
local timer tm
local integer i = 0
local integer CurrentUnitNum
loop
exitwhen(i>2)
set tm = GetMassCycleTimer(ou,i)
if(tm!=null)then
set tmIndex = GetTimerIndex(tm)
if(SYS_TimerData_I00[tmIndex]==TypeId)then
set tm = null
set CurrentUnitNum = SYS_TimerData_I01[tmIndex]
return CurrentUnitNum
endif
endif
set i = i + 1
endloop
set tm = null
return 0
endfunction
function SYS_IsMassCycleFull takes unit ou,integer TypeId returns boolean
local integer tmIndex
local timer tm
local integer i = 0
local integer CurrentUnitNum
local integer MaxUnitNum
loop
exitwhen(i>2)
set tm = GetMassCycleTimer(ou,i)
if(tm!=null)then
set tmIndex = GetTimerIndex(tm)
if(SYS_TimerData_I00[tmIndex]==TypeId)then
set tm = null
set CurrentUnitNum = SYS_TimerData_I01[tmIndex]
set MaxUnitNum = SYS_TimerData_I02[tmIndex]
if(CurrentUnitNum>=MaxUnitNum)then
return true
else
return false
endif
endif
endif
set i = i + 1
endloop
set tm = null
return false
endfunction
function SYS_MassCycleAddUnit takes unit ou,integer TypeId,unit u returns boolean
local integer tmIndex
local timer tm
local integer i = 0
local integer CurrentUnitNum
local integer MaxUnitNum
loop
exitwhen(i>2)
set tm = GetMassCycleTimer(ou,i)
if(tm!=null)then
set tmIndex = GetTimerIndex(tm)
if(SYS_TimerData_I00[tmIndex]==TypeId)then
set CurrentUnitNum = SYS_TimerData_I01[tmIndex]
set MaxUnitNum = SYS_TimerData_I02[tmIndex]
if(CurrentUnitNum<MaxUnitNum)then
set CurrentUnitNum = CurrentUnitNum + 1
set SYS_TimerData_I01[tmIndex] = CurrentUnitNum
call TimerDataConfig_Unit(tmIndex,CurrentUnitNum,true,u)
set tm = null
return true
endif
endif
endif
set i = i + 1
endloop
set tm = null
return false
endfunction
function SYS_MassCycleGetUnit takes unit ou,integer TypeId returns unit
local integer tmIndex
local timer tm
local integer i = 0
local integer CurrentUnitNum
loop
exitwhen(i>2)
set tm = GetMassCycleTimer(ou,i)
if(tm!=null)then
set tmIndex = GetTimerIndex(tm)
if(SYS_TimerData_I00[tmIndex]==TypeId)then
set CurrentUnitNum = SYS_TimerData_I01[tmIndex]
if(CurrentUnitNum>0)then
set SYS_TempUnit[1020] = TimerDataConfig_Unit(tmIndex,CurrentUnitNum,false,null)
call TimerDataConfig_Unit(tmIndex,CurrentUnitNum,true,null)
set CurrentUnitNum = CurrentUnitNum - 1
set SYS_TimerData_I01[tmIndex] = CurrentUnitNum
set tm = null
return SYS_TempUnit[1020]
endif
endif
endif
set i = i + 1
endloop
set tm = null
return null
endfunction
function SYS_MassCycleInit takes integer TypeId,boolean EndRemove, unit ou,real time,real r,real d,real ad,real inv,integer MaxUnitNum returns timer
local timer tm = GetTimer()
local integer tmIndex = GetTimerIndex(tm)
local integer uIndex = GetUnitUserData(ou)
local real inv_ex = RConfig(inv,0.01,1.00)
local real angleCurrent = RConfig(d,-360.00,360.00)
local real angleAdd = ad
local real rad = RConfig(r,100.00,2000.00)
local integer i = 0
local integer tempInt = 0
if(uIndex>0 and tmIndex>0 and GetUnitState(ou,UNIT_STATE_LIFE)>0.00)then
loop
exitwhen(i>2)
set tempInt = SYS_MassCycleGetTypeId(ou,i)
if(tempInt==TypeId)then
call ReleaseTimer(tm)
set tm = GetMassCycleTimer(ou,i)
set tmIndex = GetTimerIndex(tm)
set SYS_TimerData_R04[tmIndex] = time
set SYS_TimerData_I02[tmIndex] = MaxUnitNum
set tm = null
return SYS_Timer[tmIndex]
endif
set i = i + 1
endloop
set SYS_TimerData_U00[tmIndex] = ou
set SYS_TimerData_R00[tmIndex] = angleCurrent
set SYS_TimerData_R01[tmIndex] = angleAdd
set SYS_TimerData_R02[tmIndex] = rad
set SYS_TimerData_R03[tmIndex] = inv_ex
set SYS_TimerData_R04[tmIndex] = time
set SYS_TimerData_I00[tmIndex] = TypeId
set SYS_TimerData_I01[tmIndex] = 0
set SYS_TimerData_I02[tmIndex] = MaxUnitNum
set SYS_TimerData_B00[tmIndex] = EndRemove
if(RPG_UnitData_OrbLoopTimer_00[uIndex]==null)then
set RPG_UnitData_OrbLoopTimer_00[uIndex] = tm
elseif(RPG_UnitData_OrbLoopTimer_01[uIndex]==null)then
set RPG_UnitData_OrbLoopTimer_01[uIndex] = tm
elseif(RPG_UnitData_OrbLoopTimer_02[uIndex]==null)then
set RPG_UnitData_OrbLoopTimer_02[uIndex] = tm
else
call ReleaseTimer(tm)
set tm = null
return null
endif
else
return null
endif
call TimerStart(tm,inv_ex,true,function SYS_MassCycleLoop)
set tm = null
return SYS_Timer[tmIndex]
endfunction[/jass] |
评分
-
查看全部评分
|