[战斗]======效果133修改,治疗接口添加容错

dev_chengFeng
wangzhenxing 2021-12-13 11:50:50 +08:00
parent 6e92bbd082
commit 52937f3a67
2 changed files with 23 additions and 2 deletions

View File

@ -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)

View File

@ -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)