From e705049135725cc28cf80e18cbcd505de89f6df1 Mon Sep 17 00:00:00 2001 From: wangzhenxing Date: Thu, 18 Nov 2021 16:02:16 +0800 Subject: [PATCH] =?UTF-8?q?=E3=80=90=E6=88=98=E6=96=97=E3=80=91=3D=3D=3D?= =?UTF-8?q?=3D=3D=3D=3D362=E4=BF=AE=E6=94=B9=20=20=E5=A1=AB=E5=8A=A0388-39?= =?UTF-8?q?1=E8=A2=AB=E5=8A=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Modules/Battle/Logic/Base/Passivity.lua | 90 +++++++++++++++++++ .../Battle/Logic/Misc/BattleDefine.lua | 1 + .../Modules/Battle/Logic/Misc/BattleUtil.lua | 28 ++++-- .../Modules/Battle/Logic/Role/RoleLogic.lua | 32 ++++--- 4 files changed, 131 insertions(+), 20 deletions(-) diff --git a/Assets/ManagedResources/~Lua/Modules/Battle/Logic/Base/Passivity.lua b/Assets/ManagedResources/~Lua/Modules/Battle/Logic/Base/Passivity.lua index 4a67091a27..a3db20f4f5 100644 --- a/Assets/ManagedResources/~Lua/Modules/Battle/Logic/Base/Passivity.lua +++ b/Assets/ManagedResources/~Lua/Modules/Battle/Logic/Base/Passivity.lua @@ -9635,7 +9635,97 @@ local passivityList = { end BattleLogic.Event:AddEvent(BattleEventName.RecordRageChange, onRageChange,nil,nil,role) end, + --暴击时[a]%概率使爆伤改变[b][c]% + --a[float],b[int],c[float] + [389]=function(role,args,id,judge) + local pro=args[1] + local ct = args[2] + local v1 = args[3] + local addCritDamageFa=function(func) + BattleUtil.RandomAction(pro,function() + if func then + func(v1,ct) + end + end) + end + role.Event:AddEvent(BattleEventName.PassiveAddCritDamageFactor,addCritDamageFa,nil,nil,role) + end, + --释放技能时[a]%概率 改变[b]无视目标的[c]buff免疫 + --a[float],b[int],c[int] + [390]=function(role,args,id,judge) + local pro=args[1] + local ct = args[2] + local v1 = args[3] + local addCritDamageFa=function(func,buff) + + if buff and buff.type~=v1 then + return + end + if func then + func(pro,ct) + end + end + + local OnSkillCast = function(skill) + if skill and not skill.isTriggerJudge and judge==1 then + return + end + if skill.type == BattleSkillType.Special or skill.type==BattleSkillType.Extra or skill.type==BattleSkillType.DeadSkill then + role.Event:AddEvent(BattleEventName.PassiveChangeIgnoreImmuneValue,addCritDamageFa,nil,nil,role) + end + end + local OnSkillCastEnd = function(skill) + if skill and not skill.isTriggerJudge and judge==1 then + return + end + if skill.type == BattleSkillType.Special or skill.type==BattleSkillType.Extra or skill.type==BattleSkillType.DeadSkill then + role.Event:RemoveEvent(BattleEventName.PassiveChangeIgnoreImmuneValue,addCritDamageFa,nil,nil,role) + end + end + role.Event:AddEvent(BattleEventName.SkillCast, OnSkillCast,nil,nil,role) + role.Event:AddEvent(BattleEventName.SkillCastEnd, OnSkillCastEnd,nil,nil,role) + end, + + --释放技能时[a]%概率 清除目标一个减异效果 + --a[float] + [391]=function(role,args,id,judge) + local pro=args[1] + local onRoleTreat=function(targetRole, treat, baseTreat,skill) + if not skill then + return + end + BattleUtil.RandomAction(pro, function() + local list=BattleLogic.BuffMgr:GetAllBuffByFunc(function(buff) return buff.caster.camp~=targetRole.camp and buff.target==targetRole end) + local len=BattleUtil.LengthOfTable(list) + if list and len>0 then + local index=Random.RangeInt(1,len) + BattleLogic.BuffMgr:ClearBuff(targetRole, function (buff) + return buff==list[index] + end) + end + end) + end + + local OnSkillCast = function(skill) + if skill and not skill.isTriggerJudge and judge==1 then + return + end + if skill.type == BattleSkillType.Special or skill.type==BattleSkillType.Extra or skill.type==BattleSkillType.DeadSkill then + role.Event:AddEvent(BattleEventName.RoleTreat,onRoleTreat,nil,nil,role) + end + end + local OnSkillCastEnd = function(skill) + if skill and not skill.isTriggerJudge and judge==1 then + return + end + if skill.type == BattleSkillType.Special or skill.type==BattleSkillType.Extra or skill.type==BattleSkillType.DeadSkill then + role.Event:RemoveEvent(BattleEventName.RoleTreat,onRoleTreat,nil,nil,role) + end + end + role.Event:AddEvent(BattleEventName.SkillCast, OnSkillCast,nil,nil,role) + role.Event:AddEvent(BattleEventName.SkillCastEnd, OnSkillCastEnd,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 cfc14b2bd0..51a10a37a2 100644 --- a/Assets/ManagedResources/~Lua/Modules/Battle/Logic/Misc/BattleDefine.lua +++ b/Assets/ManagedResources/~Lua/Modules/Battle/Logic/Misc/BattleDefine.lua @@ -184,6 +184,7 @@ BattleEventName = { RoleAddCtrlBuff = indexAdd(),--角色添加控制类buff CastRageBrfore = indexAdd(),--扣除怒气之前 PassiveAddCritDamageFactor = indexAdd(), --被动增加爆伤系数 + PassiveChangeIgnoreImmuneValue = 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 389fcb7613..88f1941739 100644 --- a/Assets/ManagedResources/~Lua/Modules/Battle/Logic/Misc/BattleUtil.lua +++ b/Assets/ManagedResources/~Lua/Modules/Battle/Logic/Misc/BattleUtil.lua @@ -979,12 +979,22 @@ function BattleUtil.CalDamage(skill, atkRole, defRole, damageType, baseFactor, i defRole.Event:DispatchEvent(BattleEventName.CritDamageReduceFactor, onCritDamageReduceFactor, atkRole, defRole) BattleLogic.Event:DispatchEvent(BattleEventName.CritDamageReduceFactor, onCritDamageReduceFactor, atkRole, defRole) critDamageReduceFactor = max(BattleUtil.CountChangeList(critDamageReduceFactor, cl), 0) - - -- 计算额外暴击伤害 - critDamageFactor = 1.3 + atkRole:GetRoleData(RoleDataName.CritDamageBonus) - defRole:GetRoleData(RoleDataName.CritDamageReduce) - critDamageReduceFactor + + local critDamageAddFactor=0 --加入被动效果 触发暴击被动 - local critFunc = function(critEx) critDamageFactor = critEx end - atkRole.Event:DispatchEvent(BattleEventName.PassiveCriting, critFunc,skill) + local cl2 = {} + local onCritDamageAddFactor = function(v, ct) + if v then + table.insert(cl2, {v, ct}) + end + end + atkRole.Event:DispatchEvent(BattleEventName.PassiveAddCritDamageFactor, onCritDamageAddFactor, atkRole, defRole) + critDamageAddFactor = max(BattleUtil.CountChangeList(critDamageAddFactor, cl2), 0) + -- 计算额外暴击伤害 + critDamageFactor = 1.3 + atkRole:GetRoleData(RoleDataName.CritDamageBonus) - defRole:GetRoleData(RoleDataName.CritDamageReduce)+critDamageAddFactor - critDamageReduceFactor + --加入被动效果 触发暴击被动 废弃不用 + -- local critFunc = function(critEx) critDamageFactor = critEx end + -- atkRole.Event:DispatchEvent(BattleEventName.PassiveCriting, critFunc,skill) end -- 计算克制伤害系数 @@ -1066,8 +1076,8 @@ function BattleUtil.FinalTreat(castRole, targetRole, value, baseFactor,skill) targetRole.data:AddValue(RoleDataName.Hp, treat) end - castRole.Event:DispatchEvent(BattleEventName.RoleTreat, targetRole, treat, baseTreat) - targetRole.Event:DispatchEvent(BattleEventName.RoleBeTreated, castRole, treat, baseTreat) + castRole.Event:DispatchEvent(BattleEventName.RoleTreat, targetRole, treat, baseTreat,skill) + targetRole.Event:DispatchEvent(BattleEventName.RoleBeTreated, castRole, treat, baseTreat,skill) --添加发送到battleLogic的治疗消息,用于计算总的战斗伤害值 BattleLogic.Event:DispatchEvent(BattleEventName.RoleBeTreated, castRole, treat, baseTreat) -- 战斗记录用 @@ -1131,8 +1141,8 @@ function BattleUtil.ApplyTreat(castRole, targetRole, value, baseFactor,critDamag if treat > 0 then targetRole.data:AddValue(RoleDataName.Hp, treat) end - castRole.Event:DispatchEvent(BattleEventName.RoleTreat, targetRole, treat, baseTreat) - targetRole.Event:DispatchEvent(BattleEventName.RoleBeTreated, castRole, treat, baseTreat) + castRole.Event:DispatchEvent(BattleEventName.RoleTreat, targetRole, treat, baseTreat,skill) + targetRole.Event:DispatchEvent(BattleEventName.RoleBeTreated, castRole, treat, baseTreat,skill) --添加发送到battleLogic的治疗消息,用于计算总的战斗伤害值 BattleLogic.Event:DispatchEvent(BattleEventName.RoleBeTreated, castRole, treat, baseTreat) -- 战斗记录用 diff --git a/Assets/ManagedResources/~Lua/Modules/Battle/Logic/Role/RoleLogic.lua b/Assets/ManagedResources/~Lua/Modules/Battle/Logic/Role/RoleLogic.lua index 142674f7df..e9b2f74337 100644 --- a/Assets/ManagedResources/~Lua/Modules/Battle/Logic/Role/RoleLogic.lua +++ b/Assets/ManagedResources/~Lua/Modules/Battle/Logic/Role/RoleLogic.lua @@ -346,17 +346,27 @@ function RoleLogic:AddBuff(buff) "missF", missF) -- 如果概率为0 或者没有miss if missF == 0 or not BattleUtil.RandomAction(missF, function() BattleLogic.BuffMgr:PutBuff(buff) end) then - for i=1, self.buffFilter.size do - if self.buffFilter.buffer[i](buff,self) then - BattleLogManager.Log( - "Buff Filter", - "camp", buff.caster.camp, - "position", buff.caster.position, - "id", buff.id, - "type", buff.type) - BattleLogic.BuffMgr:PutBuff(buff) - BattleLogic.Event:DispatchEvent(BattleEventName.RoleAddBuffFail,buff,self) - return + + --概率忽略免疫 + local ignoreProb=0 + local changeIgnore=function(v1,ct) + ignoreProb=BattleUtil.CountValue(ignoreProb,v1,ct) + end + buff.caster.Event:DispatchEvent(BattleEventName.PassiveChangeIgnoreImmuneValue,changeIgnore,buff) + local isIgnor=BattleUtil.RandomAction(ignoreProb,function()end) + if not isIgnor then + for i=1, self.buffFilter.size do + if self.buffFilter.buffer[i](buff,self) then + BattleLogManager.Log( + "Buff Filter", + "camp", buff.caster.camp, + "position", buff.caster.position, + "id", buff.id, + "type", buff.type) + BattleLogic.BuffMgr:PutBuff(buff) + BattleLogic.Event:DispatchEvent(BattleEventName.RoleAddBuffFail,buff,self) + return + end end end BattleLogic.BuffMgr:AddBuff(self, buff)