需要模拟~
要有个 "攻击函数"
用递归吧..简单的思路... 想一下.. - -
function 获得攻击间隔剩余时间 takes unit u returns real
return TimerGetRemaining ...
endfunction
function 设置攻击间隔剩余时间 takes unit u,real t returns nothing
call TimerStart .....
endfunction
function 播放攻击动画 takes unit u1,unit u2 returns nothing
//播放u1用光棱攻击u2的动画 ...
endfunction
function 协同攻击 takes unit whichUnit returns nothing
local unit u
local group g=新建单位组
call 获得800范围内相同类型的单位添加到g中
loop
set u=FirstOfGroup(g)
exitwhen u==null
if u与whichUnit同盟,并且u攻击间隔时间==0 then
call 设置攻击间隔剩余时间(u,2)
call 播放攻击动画(u,whichUnit)
call 协同攻击(u)
endif
call GroupRemoveUnit(g,u)
endloop
call DestroyGroup(g)
set g=null
endfunction
function 攻击函数 takes unit u1,unit u2 returns nothing
//光棱塔u1攻击u2
if 获得攻击间隔剩余时间(u1)>0 then //无法攻击
跳过
endif
call 设置攻击间隔剩余时间(u1,2) //设置开始2秒的攻击间隔
call 协同攻击(u1)
call 播放攻击动画(u1,u2)
<0.5秒后对单位造成伤害>
endfunction