From 2a23609ed6c50134172d7a5e9d723fa3cbb732ff Mon Sep 17 00:00:00 2001 From: gaoxin Date: Tue, 7 Sep 2021 19:43:08 +0800 Subject: [PATCH] =?UTF-8?q?=E3=80=90=E6=88=98=E6=96=97=E3=80=91=E6=B7=BB?= =?UTF-8?q?=E5=8A=A0=E7=BC=BA=E5=A4=B1=E7=9A=84=E6=96=B9=E6=B3=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Modules/Battle/Logic/Misc/BattleUtil.lua | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/Assets/ManagedResources/~Lua/Modules/Battle/Logic/Misc/BattleUtil.lua b/Assets/ManagedResources/~Lua/Modules/Battle/Logic/Misc/BattleUtil.lua index 058d725fb7..e2bc8a8812 100644 --- a/Assets/ManagedResources/~Lua/Modules/Battle/Logic/Misc/BattleUtil.lua +++ b/Assets/ManagedResources/~Lua/Modules/Battle/Logic/Misc/BattleUtil.lua @@ -8,6 +8,23 @@ local min = math.min --local BattleEventName = BattleEventName BattleUtil.Passivity = require("Modules/Battle/Logic/Base/Passivity") +local function table_removebyvalue(array, value, removeall) + local c, i, max = 0, 1, #array + while i <= max do + if array[i] == value then + table.remove(array, i) + c = c + 1 + i = i - 1 + max = max - 1 + if not removeall then + break + end + end + i = i + 1 + end + return c +end + local function clamp(v, minValue, maxValue) if v < minValue then return minValue @@ -208,7 +225,7 @@ function BattleUtil.RemoveNoDeadRole(arr) for i = 1, #arr do local role=arr[i] if BattleLogic.BuffMgr:HasBuff(role,BuffName.NoDead) then - table.removebyvalue(arr,role) + table_removebyvalue(arr,role) end end end