[战斗]============= 获取数组的长度方法修改
parent
f81e8ecaab
commit
27e4ab6e1a
|
@ -931,7 +931,14 @@ function BattleUtil.CheckIsHit(atkRole, defRole,skill)
|
|||
end
|
||||
|
||||
|
||||
|
||||
--获取table的长度
|
||||
function BattleUtil.LengthOfTable(table)
|
||||
local length = 0
|
||||
for i, v in pairs(table) do
|
||||
length = length + 1
|
||||
end
|
||||
return length
|
||||
end
|
||||
|
||||
function BattleUtil.RandomAction(rand, action)
|
||||
if Random.Range01() <= rand and action then
|
||||
|
|
|
@ -66,7 +66,7 @@ function MSkill:Cast(func)
|
|||
--放技能前判断是否有目标,没有就不会放技能,直接执行技能回调 by 王振兴 2021/03/26
|
||||
--为解决攻击目标只剩被放逐的单位导致技能播放异常
|
||||
self.effectCaster:ChooseTarget()
|
||||
local targets=LengthOfTable(self:GetDirectTargetsNoExile())
|
||||
local targets=BattleUtil.LengthOfTable(self:GetDirectTargetsNoExile())
|
||||
if targets==0 and self.castDoneFunc then
|
||||
self.castDoneFunc()
|
||||
return
|
||||
|
|
|
@ -67,7 +67,7 @@ function Skill:Cast(func)
|
|||
--放技能前判断是否有目标,没有就不会放技能,直接执行技能回调 by 王振兴 2021/03/26
|
||||
--为解决攻击目标只剩被放逐的单位导致技能播放异常
|
||||
self.effectCaster:ChooseTarget()
|
||||
local targets=LengthOfTable(self:GetDirectTargetsNoExile())
|
||||
local targets=BattleUtil.LengthOfTable(self:GetDirectTargetsNoExile())
|
||||
if targets==0 and self.castDoneFunc then
|
||||
self.isRage=false
|
||||
self.castDoneFunc()
|
||||
|
|
Loading…
Reference in New Issue