diff --git a/Assets/ManagedResources/~Lua/Modules/Battle/Logic/Base/Passivity.lua b/Assets/ManagedResources/~Lua/Modules/Battle/Logic/Base/Passivity.lua index f40ea67883..b7a9db8700 100644 --- a/Assets/ManagedResources/~Lua/Modules/Battle/Logic/Base/Passivity.lua +++ b/Assets/ManagedResources/~Lua/Modules/Battle/Logic/Base/Passivity.lua @@ -12315,5 +12315,52 @@ local passivityList = { end role.Event:AddEvent(BattleEventName.SkillCastEnd, onSkillEnd,nil,nil,role) end, + -- 受到致命伤害后,伤害转移给a神将,每场战斗每个武将限1次 + [467] = function(role, args) + local triggerList={} + local onDamShift = function(func,atkRole,damage,defRole,skill) + if BattleUtil.ChecklistIsContainValue(triggerList,defRole.position) then + return + end + if role:IsDead() or role.camp~=defRole.camp or skill==nil then + return + end + local curHp = defRole:GetRoleData(RoleDataName.Hp) + if damage > curHp then + + table.insert(triggerList,defRole.position) + BattleUtil.ApplyDamage(skill, atkRole, role, damage) + func(true) + end + end + BattleLogic.Event:AddEvent(BattleEventName.CheckDamShift, onDamShift,nil,nil,role) + end, + -- 没有受到控制时,每[a]回合清空身上的减益buff,回复[b]属性[c]%生命值,并添加[d]属性[e]%御甲 + -- a[int]b[属性]c[float]d[属性]e[float] + [468] = function(role, args) + local a=args[1] + local b=args[2] + local c=args[3] + local d=args[4] + local e=args[5] + BattleLogic.Event:AddEvent(BattleEventName.BattleRoundChange, function(curRound) + if curRound%a==0 then + --如果处于眩晕 沉默 嘲讽 混乱 放逐状态下不生效 + if BattleLogic.BuffMgr:HasBuff(role, BuffName.Control, function (buff) return buff.ctrlType == 1 or buff.ctrlType == 3 or buff.ctrlType == 8 end) then + return + end + if role.isExile then + return + end + BattleLogic.BuffMgr:ClearBuff(role, function (buff) + return buff.target.camp ~= role.camp + end) + local tv = floor(BattleUtil.ErrorCorrection(role:GetRoleData(BattlePropList[b]) * c)) + BattleUtil.AddBlood(role,tv) + local treat = floor(BattleUtil.FP_Mul(role:GetRoleData(BattlePropList[d]), e)) + BattleUtil.CalTreat(role, role, treat) + end + end,nil,nil,role) + end, } return passivityList \ No newline at end of file diff --git a/Assets/ManagedResources/~Lua/Modules/Battle/Logic/Misc/BattleDefine.lua b/Assets/ManagedResources/~Lua/Modules/Battle/Logic/Misc/BattleDefine.lua index 8e3b72e1b1..dad5d3fa06 100644 --- a/Assets/ManagedResources/~Lua/Modules/Battle/Logic/Misc/BattleDefine.lua +++ b/Assets/ManagedResources/~Lua/Modules/Battle/Logic/Misc/BattleDefine.lua @@ -205,6 +205,7 @@ BattleEventName = { WeaponSkillCast = indexAdd(), --神兵技能释放 CheckFalseNoDead = indexAdd(), --检测伪不灭 CheckTreatVoid = indexAdd(), --检测治疗是否无效 + CheckDamShift=indexAdd(), --检测伤害转移 } BattleMaxFrame = 1000000 diff --git a/Assets/ManagedResources/~Lua/Modules/Battle/Logic/Misc/BattleUtil.lua b/Assets/ManagedResources/~Lua/Modules/Battle/Logic/Misc/BattleUtil.lua index 2d7ed5412b..c0e0dff562 100644 --- a/Assets/ManagedResources/~Lua/Modules/Battle/Logic/Misc/BattleUtil.lua +++ b/Assets/ManagedResources/~Lua/Modules/Battle/Logic/Misc/BattleUtil.lua @@ -921,6 +921,20 @@ function BattleUtil.FinalDamage(skill, atkRole, defRole, damage, bCrit, damageTy damage=realDamage end defRole.Event:DispatchEvent(BattleEventName.CheckFalseNoDead, damagingFunc, atkRole, realDamage, skill, dotType, bCrit, damageType,isDirect) + + local isToDied=false + --检测时空猪八戒格挡致死伤害 + local checkDamageShift = function(isDead) + isToDied=isDead + end + BattleLogic.Event:DispatchEvent(BattleEventName.CheckDamShift, checkDamageShift, atkRole, realDamage, defRole,skill) + + --格挡成功 + if isToDied then + return + end + + --御甲过滤后的伤害只会处理扣血 by: wangzhenxing shihongyi 2021/09/27 local finalDmg = defRole.data:SubValue(RoleDataName.Hp,realDamage) if finalDmg >= 0 then