From 52937f3a6781b89f93fc505bef8e73c4cd4334b0 Mon Sep 17 00:00:00 2001 From: wangzhenxing Date: Mon, 13 Dec 2021 11:50:50 +0800 Subject: [PATCH] =?UTF-8?q?[=E6=88=98=E6=96=97]=3D=3D=3D=3D=3D=3D=E6=95=88?= =?UTF-8?q?=E6=9E=9C133=E4=BF=AE=E6=94=B9=EF=BC=8C=E6=B2=BB=E7=96=97?= =?UTF-8?q?=E6=8E=A5=E5=8F=A3=E6=B7=BB=E5=8A=A0=E5=AE=B9=E9=94=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../~Lua/Modules/Battle/Logic/Base/Effect.lua | 3 +++ .../Modules/Battle/Logic/Misc/BattleUtil.lua | 22 +++++++++++++++++-- 2 files changed, 23 insertions(+), 2 deletions(-) diff --git a/Assets/ManagedResources/~Lua/Modules/Battle/Logic/Base/Effect.lua b/Assets/ManagedResources/~Lua/Modules/Battle/Logic/Base/Effect.lua index f41a79f475..0a6268f360 100644 --- a/Assets/ManagedResources/~Lua/Modules/Battle/Logic/Base/Effect.lua +++ b/Assets/ManagedResources/~Lua/Modules/Battle/Logic/Base/Effect.lua @@ -2552,6 +2552,9 @@ local effectList = { BattleUtil.FinalDamageCountShield(nil,caster, target,damage) local hp=floor(damage*f2) local arr = RoleManager.NoOrder(function (r) return r.camp == caster.camp end,false,true) + if arr==nil or #arr==0 then + return + end BattleUtil.SortByHpFactor(arr,sort) BattleUtil.CalTreatNoCrit(caster, arr[1],hp,1,skill) diff --git a/Assets/ManagedResources/~Lua/Modules/Battle/Logic/Misc/BattleUtil.lua b/Assets/ManagedResources/~Lua/Modules/Battle/Logic/Misc/BattleUtil.lua index 9b2cbe10e9..0fcc694281 100644 --- a/Assets/ManagedResources/~Lua/Modules/Battle/Logic/Misc/BattleUtil.lua +++ b/Assets/ManagedResources/~Lua/Modules/Battle/Logic/Misc/BattleUtil.lua @@ -448,6 +448,7 @@ function BattleUtil.ChooseTarget(role, chooseId) --LogError(aaa.position) end aaa.isRealDead=false + arr={} table.insert(arr,aaa) -- return aaa end @@ -1073,6 +1074,9 @@ function BattleUtil.CalDamage(skill, atkRole, defRole, damageType, baseFactor, i end function BattleUtil.CalTreat(castRole, targetRole, value, baseFactor,skill) + if targetRole==nil then + return + end -- 灵兽无效 if targetRole.type == BattleUnitType.Monster or targetRole.type == BattleUnitType.Player then return @@ -1106,6 +1110,9 @@ end --没有暴击得治疗 function BattleUtil.CalTreatNoCrit(castRole, targetRole, value, baseFactor,skill) + if targetRole==nil then + return + end -- 灵兽无效 if targetRole==nil then return @@ -1135,6 +1142,9 @@ end function BattleUtil.FinalTreat(castRole, targetRole, value, baseFactor,skill) + if targetRole==nil then + return + end -- 灵兽无效 if targetRole.type == BattleUnitType.Monster or targetRole.type == BattleUnitType.Player then return @@ -1180,10 +1190,16 @@ end function BattleUtil.ApplyTreat(castRole, targetRole, value, baseFactor,critDamageFactor,addDamageFactor,skill) + if targetRole==nil then + return + end -- 灵兽无效 if targetRole.type == BattleUnitType.Monster then return end + if addDamageFactor==nil then + addDamageFactor=1 + end BattleLogic.Event:DispatchEvent(BattleEventName.DisposeRoleCtrl_noheal, castRole,targetRole) if targetRole.ctrl_noheal or targetRole:IsDead() then --禁疗和死亡无法加血 --禁疗并且没有死亡的单位显示血量+0 不走后面代码,防止触发后面的被动 by:王振兴 2021/1/27 @@ -1193,6 +1209,7 @@ function BattleUtil.ApplyTreat(castRole, targetRole, value, baseFactor,critDamag return end baseFactor = baseFactor or 1 + critDamageFactor = critDamageFactor or 1 local maxHp = targetRole:GetRoleData(RoleDataName.MaxHp) local hp = targetRole:GetRoleData(RoleDataName.Hp) @@ -1204,9 +1221,11 @@ function BattleUtil.ApplyTreat(castRole, targetRole, value, baseFactor,critDamag targetRole.Event:DispatchEvent(BattleEventName.PassiveBeTreatedFactor, treatFactorFunc, castRole) local factor = castRole.isTeam and 1 or castRole:GetRoleData(RoleDataName.TreatFacter) --释放者为team则不计算治疗加成属性 + if factor==0 then + factor=1 + end local factor2 = targetRole:GetRoleData(RoleDataName.CureFacter) local baseTreat = BattleUtil.FP_Mul(value, baseFactor, factor, factor2,critDamageFactor,addDamageFactor) - --加入被动效果 local cl = {} local function treatingFunc(v, ct) @@ -1219,7 +1238,6 @@ function BattleUtil.ApplyTreat(castRole, targetRole, value, baseFactor,critDamag targetRole.Event:DispatchEvent(BattleEventName.PassiveBeTreated, treatingFunc, castRole) baseTreat = BattleUtil.CountChangeList(baseTreat, cl) - -- 取整 local baseTreat = floor(baseTreat + 0.5)