From f71bbbdf95eabae3a3df2236de30b339956b5d77 Mon Sep 17 00:00:00 2001 From: wangzhenxing Date: Thu, 11 Nov 2021 14:01:32 +0800 Subject: [PATCH] =?UTF-8?q?[=E6=88=98=E6=96=97]=3D=3D=3D=3D=3D=3D=3D=3D=3D?= =?UTF-8?q?=3D=3D=E7=AC=AC=E4=BA=8C=E6=9C=9F=E7=A5=9E=E9=AD=82=E8=A2=AB?= =?UTF-8?q?=E5=8A=A8=E6=8F=90=E4=BA=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Modules/Battle/Logic/Base/Passivity.lua | 333 ++++++++++++++++-- .../~Lua/Modules/Battle/Logic/Buff/Blood.lua | 5 +- .../Modules/Battle/Logic/Misc/BattleUtil.lua | 4 +- 3 files changed, 317 insertions(+), 25 deletions(-) diff --git a/Assets/ManagedResources/~Lua/Modules/Battle/Logic/Base/Passivity.lua b/Assets/ManagedResources/~Lua/Modules/Battle/Logic/Base/Passivity.lua index 85bfd325ab..3dae1a7af1 100644 --- a/Assets/ManagedResources/~Lua/Modules/Battle/Logic/Base/Passivity.lua +++ b/Assets/ManagedResources/~Lua/Modules/Battle/Logic/Base/Passivity.lua @@ -167,17 +167,24 @@ local passivityList = { role.Event:AddEvent(BattleEventName.PassiveTreating, OnPassiveTreating,nil,nil,role) end, - --受击后,[a]的概率,回复自身的[b]*[c]的血量 - --a[float],b[属性],c[float] + --受击后,[a]的概率,回复自身的[b]*[c]的血量,伤害类型[d](1:直接伤害 0/不填:所有伤害) + --a[float],b[属性],c[float],d[int] [8] = function(role, args,id,judge) local f1 = args[1] local pro = args[2] local f2 = args[3] - + local type = args[4] local OnBeHit = function(atkRole,damage, bCrit, finalDmg, damageType,skill) + if type and not skill then + return + end BattleUtil.RandomAction(f1, function () local val = floor(BattleUtil.FP_Mul(f2, role:GetRoleData(BattlePropList[pro]))) - BattleUtil.CalTreat(role, role, val) + if pro==12 then + BattleUtil.FinalTreat(role, role, val) + else + BattleUtil.CalTreat(role, role, val) + end end) end role.Event:AddEvent(BattleEventName.RoleBeHit, OnBeHit,nil,nil,role) @@ -3249,15 +3256,22 @@ local passivityList = { role.Event:AddEvent(BattleEventName.PassiveTreatingFactor, onPassiveTreatingFactor,nil,nil,role) end, - -- 受到普攻后降低攻击自己武将的[c]点怒气 - -- c[int] + -- 受到普攻后降低攻击自己武将的[a]点怒气,攻击类型为[b](b:不填或0 为普攻 1:为技能) + -- a[int],b[int] [156] = function(role, args) local i1 = args[1] + local type = args[2] + if not type then + type=0 + end local onBeSkillCastEnd = function(skill) - --同阵营给自己普攻加血不扣除怒气 - if skill.owner.camp~=role.camp and skill.type == BattleSkillType.Normal then - BattleUtil.CalRage(role, skill.owner, i1, CountTypeName.Sub) - end + if type==0 and skill.type~=BattleSkillType.Normal then + return + end + if type==1 and skill.type~=BattleSkillType.Special and skill.type~=BattleSkillType.Extra and skill.type~=BattleSkillType.DeadSkill then + return + end + BattleUtil.CalRage(role, skill.owner, i1, CountTypeName.Sub) end role.Event:AddEvent(BattleEventName.BeSkillCastEnd, onBeSkillCastEnd,nil,nil,role) end, @@ -5923,11 +5937,13 @@ local passivityList = { role.Event:AddEvent(BattleEventName.PassiveDamaging,passiveBeBeDamage,nil,nil,role) end, - --技能击中受到[a,控制效果]的目标,会额外降低[b]点怒气 - -- a[int 控制效果]b[int] + --技能击中受到[a,控制效果]的目标,会额外降低[b]点怒气,额外造成其[c]属性[d]%的间接伤害 + -- a[int 控制效果]b[int],c[int 属性],d[float] [267]=function(role,args,id,judge) local dot=args[1] local i1 = args[2] + local pro = args[3] + local v1 = args[4] --defRole, damage, bCrit, finalDmg, damageType, skill local OnRoleHit = function(skill) if skill and not skill.isTriggerJudge and judge==1 then @@ -5942,7 +5958,18 @@ local passivityList = { for key, value in pairs(list) do local isHave=BattleLogic.BuffMgr:HasBuff(value, BuffName.Control, function(buff) return buff.ctrlType == dot end) if isHave then - BattleUtil.CalRage(role, value, i1, CountTypeName.Sub) + if i1>0 then + BattleUtil.CalRage(role, value, i1, CountTypeName.Sub) + end + if pro and v1 then + --如果是boss 并且额外伤害是根据最大生命则返回 + local isBoss=BattleUtil.CheckIsBoss(value) + if isBoss and pro==12 then + return + end + local val = floor(BattleUtil.FP_Mul(v1, value:GetRoleData(BattlePropList[pro]))) + BattleUtil.FinalDamageCountShield(nil,role, value, val) + end end end end @@ -6181,7 +6208,7 @@ local passivityList = { end, - -- 释放技能后[a]方 [b]最高[c]阵营 友方改变[d][e]点怒气 + -- 释放技能后[a]方 [b]最高[c]阵营 友方改变[d][e]点怒气 (c 填0为所有阵营) -- a[int,敌我方] 0:我方 1:敌方,b[int 属性类型], c[int 阵营id], d[int 改变类型], e[int] [275] = function(role, args,id,judge) local camp = args[1] @@ -6197,9 +6224,9 @@ local passivityList = { if skill.type == BattleSkillType.Special or skill.type==BattleSkillType.Extra then local list=nil if camp==0 then - list= RoleManager.Query(function(v) return v.camp == role.camp and v.element==ele end) + list= RoleManager.Query(function(v) return v.camp == role.camp and (ele==0 or v.element==ele) end) elseif camp==1 then - list= RoleManager.Query(function(v) return v.camp ~= role.camp and v.element==ele end) + list= RoleManager.Query(function(v) return v.camp ~= role.camp and (ele==0 or v.element==ele) end) end if not list or #list == 0 then return @@ -6284,7 +6311,7 @@ local passivityList = { end BattleLogic.Event:AddEvent(BattleEventName.ShieldBuffEnd, OnBuffEnd,nil,nil,role) end, - --发动技能后,[a]概率给我方[b]最高[c]名[d]阵营 [e]属性[f]改变[g],持续[h]回合 + --发动技能后,[a]概率给我方[b]最高[c]名[d]阵营 [e]属性[f]改变[g],持续[h]回合(d 填0为所有阵营) --a[float],b[int 属性],c[int], d[int],e[int 属性],f[int 改变类型],g[float] h[int] [279] = function(role, args,id,judge) local p1=args[1] @@ -6302,7 +6329,7 @@ local passivityList = { end if skill and (skill.type==BattleSkillType.Special or skill.type==BattleSkillType.Extra) then BattleUtil.RandomAction(p1, function () - local list= RoleManager.Query(function(v) return v.camp == role.camp and v.element==ele and not v:IsDead() end) + local list= RoleManager.Query(function(v) return v.camp == role.camp and (ele==0 or v.element==ele) and not v:IsDead() end) if not list or #list ==0 then return end @@ -6322,10 +6349,14 @@ local passivityList = { [280]=function(role,args) role.isImmuneReduceRage=true end, - --当己方[a]阵营神将释放技能怒气不足时,将从精卫身上额外转移怒气释放技能(转移的怒气首先可以保证精卫释放技能) - --a[int 阵营id] + --当己方[a]阵营神将释放技能怒气不足时,将从精卫身上额外转移怒气释放技能,精卫转移有[b]%的概率不减怒 (转移的怒气首先可以保证精卫释放技能) + --a[int 阵营id],b[flaot] [281]=function(role,args) local ele=args[1] + local pro=args[2] + if not pro then + pro=0 + end local onRoleCastSkillBrfore=function(caster) -- 施法者不是自身/自身不足已释放技能/不是己方英雄/不是a 阵营 if caster==role or role.Rage <= role.SuperSkillRage or caster.camp~=role.camp or caster.element~=role.element then @@ -6340,7 +6371,9 @@ local passivityList = { local num=moreRage-lessRage if num>=0 then --精卫转移怒气不算减怒 - role.Rage=role.Rage-lessRage + BattleUtil.RandomAction(1-pro,function() + role.Rage=role.Rage-lessRage + end) BattleUtil.CalRage(role,caster,lessRage,CountTypeName.Add,true) -- 用于记录统计 BattleLogic.Event:DispatchEvent(BattleEventName.RecordTransRage, role, caster, lessRage) @@ -8979,5 +9012,263 @@ local passivityList = { role.Event:AddEvent(BattleEventName.SkillCast, OnSkillCast,nil,nil,role) end, + --释放技能后有[a]%/[b]%/[c]%概率为[d]方属性[e]最[f]的目标改变[g] [h]/[i]/[j]点怒气 + --a[float],b[float],c[float],d[int 0:我方 1:敌方],e[int ],f[int 1:低 0:高],g[int 改变类型],h[int],i[int],j[int] + [372]=function(role, args,id,judge) + local p1=args[1] + local p2=args[2] + local p3=args[3] + local camp=args[4] + local pro=args[5] + local sort=args[6] + local ct=args[7] + local v1=args[8] + local v2=args[9] + local v3=args[10] + local onSkillCast=function(skill) + if skill and not skill.isTriggerJudge and judge==1 then + return + end + if not skill then + return + end + if skill.type~=BattleSkillType.Special then + return + end + local seed=Random.Range01() + local addNum=0 + if p3 and seed<=p3 and v3 then + addNum=v3 + end + if addNum==0 and p2 and v2 and seed<=p2 then + addNum=v2 + end + if addNum==0 and p1 and v1 then + addNum=v1 + end + local list=nil + if camp==0 then + list= RoleManager.Query(function(v) return v.camp == role.camp end) + elseif camp==1 then + list= RoleManager.Query(function(v) return v.camp ~= role.camp end) + end + if not list or #list == 0 then + return + end + list = BattleUtil.SortByProp(list, BattlePropList[pro],sort) + BattleUtil.CalRage(role,list[1],addNum,ct) + end + role.Event:AddEvent(BattleEventName.SkillCastEnd,onSkillCast,nil,nil,role) + end, + --己方神将被动附加[a]效果,有[b]%概率立即为其清除,每回合最多生效[c]次,单场战斗最多[d]次;具体效果类型为[e],[f],[g],[h] + --a[int],b[float],c[int],d[int],e[int],f[int],g[int],h[int] + [373]=function(role, args,id,judge) + local type=args[1] + local pro=args[2] + local num=args[3] + local maxNum=args[4] + local v1=args[5] + local v2=args[6] + local v3=args[7] + local v4=args[8] + local ctrls={} + local maxTime=0 + local roundTime=0 + if v1 then + table.insert(ctrls,v1) + end + if v2 then + table.insert(ctrls,v2) + end + if v3 then + table.insert(ctrls,v3) + end + if v4 then + table.insert(ctrls,v4) + end + + local onBuffRecord=function(buff) + if maxTime==maxNum then + return + end + if roundTime==num then + return + end + if buff.caster.camp==role.camp then + return + end + if buff.type~=type then + return + end + local isCon=false + if type==BuffName.Control then + isCon=BattleUtil.ChecklistIsContainValue(ctrls,buff.ctrlType) + end + if isCon then + BattleUtil.RandomAction(pro,function() + --LogError("111111111") + BattleLogic.BuffMgr:ClearBuff(buff.target,function(buff1) + return buff1==buff + end) + roundTime=roundTime+1 + maxTime=maxTime+1 + end) + end + end + BattleLogic.Event:AddEvent(BattleEventName.BuffStart,onBuffRecord,nil,nil,role) + + local onRoundChange=function() + roundTime=0 + end + BattleLogic.Event:AddEvent(BattleEventName.BattleRoundStart,onRoundChange,nil,nil,role) + end, + --技能伤害的[a]%转化为御甲 + --a[float] + [374]=function(role, args,id,judge) + local f1 = args[1] + + local allDamage = 0 + local OnHit = function(atkRole, damage, bCrit, finalDmg, damageType, skill) + if skill and skill.type == BattleSkillType.Special then + --吸血修改,finaldag 改成 damage by:王振兴 2020/08/17 + allDamage = allDamage + damage + end + end + local function onSkillCast(skill) + if skill and not skill.isTriggerJudge and judge==1 then + return + end + if skill.type == BattleSkillType.Special then + allDamage = 0 + role.Event:AddEvent(BattleEventName.RoleHit, OnHit,nil,nil,role) + end + end + local function onSkillCastEnd(skill) + if skill and not skill.isTriggerJudge and judge==1 then + return + end + if skill.type == BattleSkillType.Special then + role.Event:RemoveEvent(BattleEventName.RoleHit, OnHit) + local value=floor(BattleUtil.ErrorCorrection(allDamage*f1)) + if role.bloodShield then + role.bloodShield:AddValue(value) + else + role:AddBuff(Buff.Create(role, BuffName.Blood,0,value)) + end + -- 清空伤害记录 + allDamage = 0 + end + end + role.Event:AddEvent(BattleEventName.SkillCast, onSkillCast,nil,nil,role) + role.Event:AddEvent(BattleEventName.SkillCastEnd, onSkillCastEnd,nil,nil,role) + end, + --御甲破除时,对攻击者反弹其[a]属性[b]%的伤害 + --a[int],b[float] + [375]=function(role, args,id,judge) + local p1 = args[1] + local v1 = args[2] + local onValueChange=function(pro,caster) + if pro==0 and caster then + --如果是boss 并且额外伤害是根据最大生命则返回 + local isBoss=BattleUtil.CheckIsBoss(caster) + if isBoss and p1==12 then + return + end + local tv = floor(BattleUtil.ErrorCorrection(caster:GetRoleData(BattlePropList[p1]) * v1)) + BattleUtil.FinalDamageCountShield(nil,role,caster,tv) + end + end + role.Event:AddEvent(BattleEventName.BloodValueChange,onValueChange,nil,nil,role) + end, + --自身生命[a]次低于[b]%时,为[c]目标改变[d][e]属性[f]%的效果,持续[g]回合 + --a[int],b[flaot],c[int 查找目标系数],d[int 改变类型],e[int 属性id],f[flaot],g[int] + [376]=function(role, args,id,judge) + local time=args[1] + local pro=args[2] + local targets=args[3] + local ct = args[4] + local p1 = args[5] + local v1 = args[6] + local round = args[7] + + local triggerTime= 0 + local onBeDanage=function() + if triggerTime==time then + return + end + local hp=BattleUtil.GetHPPencent(role) + if hp>=pro or hp==0 then + return + end + local arr = BattleUtil.ChooseTarget(role,targets) + for i=1, #arr do + arr[i]:AddBuff(Buff.Create(arr[i], BuffName.PropertyChange, round, BattlePropList[p1],v1, ct)) + end + triggerTime=triggerTime+1 + end + role.Event:AddEvent(BattleEventName.RoleBeDamaged,onBeDanage,nil,nil,role) + end, + --释放技能时,同时给[a]目标增加减伤[b]%的减伤盾,持续[c]回合。 + --a[int 技能目标参数],b[float],c[int] + [377]=function(role, args,id,judge) + local targets=args[1] + local pro = args[2] + local v1 = args[3] + local onSkillCast=function(skill) + if skill and not skill.isTriggerJudge and judge==1 then + return + end + if not skill then + return + end + local cl = {} + local arr = BattleUtil.ChooseTarget(role,targets) + if not arr or #arr==0 then + return + end + if arr[1].position<=3 then + return + end + local function _CallBack(v, ct) + if v then + table.insert(cl, {v, ct}) + end + end + + role.Event:DispatchEvent(BattleEventName.PassiveShield, _CallBack, ShieldTypeName.RateReduce) + arr[1].Event:DispatchEvent(BattleEventName.PassiveBeShield, _CallBack, ShieldTypeName.RateReduce) + pro = BattleUtil.CountChangeList(pro, cl) + + arr[1]:AddBuff(Buff.Create(role, BuffName.Shield, v1, ShieldTypeName.RateReduce,pro, 0)) + end + role.Event:AddEvent(BattleEventName.SkillCastEnd,onSkillCast,nil,nil,role) + end, + --释放技能时,如对方位处于[a]类型[b]效果,则该次攻击[c]%概率附加[d]类型[e]效果(每回合对目标造成自身[f]属性[g]%的伤害,持续[h]回合) + --a[int],b[int],c[float],d[int],e[int],f[int],g[float],h[int] + [378]=function(role, args,id,judge) + local t1=args[1] + local t2=args[2] + local pro=args[3] + local t3=args[4] + local t4=args[5] + local p1=args[6] + local v1=args[7] + local round=args[8] + + local onRoleHit=function(defRole, damage, bCrit, finalDmg, damageType, skill) + if not skill or skill.type~=BattleSkillType.Special then + return + end + if skill and not skill.isTriggerJudge and judge==1 then + return + end + if not BattleLogic.BuffMgr:HasBuff(defRole, t1, function (buff) return buff.type== t1 and buff.damageType==t2 end,role,1) then + local damage = BattleUtil.ErrorCorrection(v1 * role:GetRoleData(BattlePropList[p1])) + BattleUtil.RandomDot(pro,t4, role, defRole,round, 1, floor(damage)) + end + end + role.Event:AddEvent(BattleEventName.RoleHit,onRoleHit,nil,nil,role) + end, + } return passivityList \ No newline at end of file diff --git a/Assets/ManagedResources/~Lua/Modules/Battle/Logic/Buff/Blood.lua b/Assets/ManagedResources/~Lua/Modules/Battle/Logic/Buff/Blood.lua index 7970d4ec17..be25c277d4 100644 --- a/Assets/ManagedResources/~Lua/Modules/Battle/Logic/Buff/Blood.lua +++ b/Assets/ManagedResources/~Lua/Modules/Battle/Logic/Buff/Blood.lua @@ -46,7 +46,7 @@ function Blood:OnEnd() self.bloodValue=0 end --计算血甲 -function Blood:CountBloodValue(damage) +function Blood:CountBloodValue(damage,atkRole) local finalDamage=0 self.bloodValue=self.bloodValue-damage if self.bloodValue<=0 then @@ -56,8 +56,9 @@ function Blood:CountBloodValue(damage) local value=0 if self.bloodValue<=0 then value=0 + self.bloodValue=0 end - self.target.Event:DispatchEvent(BattleEventName.BloodValueChange,self.bloodValue/self.target:GetRoleData(RoleDataName.MaxHp)) + self.target.Event:DispatchEvent(BattleEventName.BloodValueChange,self.bloodValue/self.target:GetRoleData(RoleDataName.MaxHp),atkRole) return finalDamage end diff --git a/Assets/ManagedResources/~Lua/Modules/Battle/Logic/Misc/BattleUtil.lua b/Assets/ManagedResources/~Lua/Modules/Battle/Logic/Misc/BattleUtil.lua index f760c4297d..893c70686d 100644 --- a/Assets/ManagedResources/~Lua/Modules/Battle/Logic/Misc/BattleUtil.lua +++ b/Assets/ManagedResources/~Lua/Modules/Battle/Logic/Misc/BattleUtil.lua @@ -747,7 +747,7 @@ function BattleUtil.FinalDamage(skill, atkRole, defRole, damage, bCrit, damageTy local realDamage=damage --血量防护只会防直接伤害 if defRole.bloodShield and skill then - realDamage=math.abs(defRole.bloodShield:CountBloodValue(damage)) + realDamage=math.abs(defRole.bloodShield:CountBloodValue(damage,atkRole)) -- damage=realDamage end --检测历战之躯 @@ -825,7 +825,7 @@ function BattleUtil.FinalDamageCountShield(skill, atkRole, defRole, damage, bCri local realDamage=damage --血量防护只会防直接伤害 if defRole.bloodShield and skill then - realDamage=math.abs(defRole.bloodShield:CountBloodValue(damage)) + realDamage=math.abs(defRole.bloodShield:CountBloodValue(damage,atkRole)) -- damage=realDamage end --检测历战之躯