From 878b12f574812e5502610fd1d01a424f16e18e81 Mon Sep 17 00:00:00 2001 From: wangzhenxing Date: Thu, 4 Nov 2021 10:27:02 +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=3D=3D=3D=3D=3D=3D=3D=3D=3D=E8=A2=AB=E5=8A=A8364-371?= =?UTF-8?q?=20=E6=8F=90=E4=BA=A4=20=20307=20360=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Modules/Battle/Logic/Base/Passivity.lua | 284 ++++++++++++++++-- .../Battle/Logic/Misc/BattleDefine.lua | 1 + .../Modules/Battle/Logic/Role/RoleLogic.lua | 1 + 3 files changed, 266 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 7dde144002..5e324a82f7 100644 --- a/Assets/ManagedResources/~Lua/Modules/Battle/Logic/Base/Passivity.lua +++ b/Assets/ManagedResources/~Lua/Modules/Battle/Logic/Base/Passivity.lua @@ -3223,7 +3223,7 @@ local passivityList = { end counter = counter + 1 if counter <= i1 then - deadRole:SetRelive(f1) + deadRole:SetRelive(f1,role) end end end) @@ -7046,11 +7046,15 @@ local passivityList = { end role.Event:AddEvent(BattleEventName.BuffCaster, OnBuffCaster,nil,nil,role) end, - -- 受到技能伤害时,会为血量属性最低的神将额外回复自身[a]%的[b] - -- 回复a[float] b[int 属性id] + -- 受到技能伤害时,会为血量属性最低的神将额外回复自身[a]%的[b],神将数据量为[c]名 + -- 回复a[float] b[int 属性id],c[int] [307] = function(role, args) local f1 = args[1] local pro=args[2] + local num = args[3] + if num==nil then + num=1 + end local onBeSkillHit = function(caster, damage, bCrit, finalDmg, damageType, skill) --如果角色死亡就不会触发 if role:IsDead() then @@ -7059,12 +7063,14 @@ local passivityList = { if skill and (skill.type==BattleSkillType.Special or skill.type== BattleSkillType.Extra or skill.type== BattleSkillType.DeadSkill) then --技能造成的直接伤害 local list = RoleManager.NoOrder(function(v) return v.camp == role.camp end) BattleUtil.SortByHpFactor(list, 1) - if list[1] then - local val = floor(BattleUtil.FP_Mul(f1, list[1]:GetRoleData(BattlePropList[pro]))) - if pro==12 then - BattleUtil.FinalTreat(role, list[1], val) - else - BattleUtil.CalTreat(role, list[1], val) + for i = 1, #list do + if i<=num then + local val = floor(BattleUtil.FP_Mul(f1, list[i]:GetRoleData(BattlePropList[pro]))) + if pro==12 then + BattleUtil.FinalTreat(role, list[i], val) + else + BattleUtil.CalTreat(role, list[i], val) + end end end end @@ -7678,7 +7684,7 @@ local passivityList = { return end BattleUtil.RandomAction(p1, function () - deadRole:SetRelive(p2) + deadRole:SetRelive(p2,role) BattleUtil.CalRage(role, role,num,CountTypeName.Add) end) end @@ -8613,17 +8619,23 @@ local passivityList = { role.Event:AddEvent(BattleEventName.RoleDamage, OnRoleCrit,nil,nil,role) end, - -- 己方[a]阵营神将(除[b]职业神将外)释放技能(除追击技能),有[c]%概率追加一次普攻 - -- a[int 阵营id],b[int job id],c[float] + -- 己方[a]阵营神将(除[b]职业神将外)释放技能(除追击技能),有[c]%概率追加一次普攻,每回合最多触发[d]次 + -- a[int 阵营id],b[int job id],c[float],d[int] [360] = function(role, args,id,judge) local camp = args[1] local job = args[2] local v1 = args[3] + local num = args[4] + + local time=0 -- 释放技能后 local onSkillEnd = function(skill) if skill and not skill.isTriggerJudge and judge==1 then return end + if time==num then + return + end if role.element~=camp then return end @@ -8633,10 +8645,16 @@ local passivityList = { if skill.type == BattleSkillType.Special then BattleUtil.RandomAction(v1, function () role:AddSkill(BattleSkillType.Normal, false, true, nil) + time=time+1 end) end end role.Event:AddEvent(BattleEventName.SkillCastEnd, onSkillEnd,nil,nil,role) + + local function onRoundChange() + time=0 + end + BattleLogic.Event:AddEvent(BattleEventName.BattleRoundChange,onRoundChange,nil,nil,role) end, -- 释放技能后[a]%概率再次释放技能,伤害为初始技能伤害[b]%,释放次数每增加1,概率是之前的[c]% -- a[float],b[float],c[float] @@ -8690,14 +8708,20 @@ local passivityList = { if not func then return end - -- if type3==1 then - -- return - -- end - if BattleLogic.BuffMgr:HasBuff(trigger, type1, function(buff) return buff.damageType == type2 and buff.caster==role end,role,type2) then - if func then - local dd = BattleUtil.CountValue(value,v1, ct) - value - func(floor(BattleUtil.ErrorCorrection(dd))) + local isPlay=false + + if type1== BuffName.DOT then + if BattleLogic.BuffMgr:HasBuff(trigger, type1, function(buff) return buff.damageType == type2 and buff.caster==role end,role,type2) then + isPlay=true end + elseif type1== BuffName.HOT then + if BattleLogic.BuffMgr:HasBuff(trigger, type1, nil) then + isPlay=true + end + end + if isPlay and func then + local dd = BattleUtil.CountValue(value,v1, ct) - value + func(floor(BattleUtil.ErrorCorrection(dd))) end end BattleLogic.Event:AddEvent(BattleEventName.BloodValuePassiveChange,onPassiveBlood,nil,nil,role) @@ -8707,7 +8731,227 @@ local passivityList = { [363]=function(role, args,id,judge) --用于被动初始化时替换被动数值 end, - + -- 释放技能后给目标增加自身[a][b]%的御甲 + -- a[属性]b[float]c[int] + [364] = function(role, args,id,judge) + local pro = args[1] + local f1 = args[2] + local i1 = args[3] + -- 技能后后 + local onSkillEnd = function(skill) + if skill and not skill.isTriggerJudge and judge==1 then + return + end + if skill.type == BattleSkillType.Special then + local list = skill:GetDirectTargetsNoNoDead() + if list then + local tv = floor(BattleUtil.ErrorCorrection(role:GetRoleData(BattlePropList[pro]) * f1)) + for _, r in ipairs(list) do + if r.bloodShield then + r.bloodShield:AddValue(tv) + else + r:AddBuff(Buff.Create(role, BuffName.Blood,0,tv)) + end + end + end + end + end + role.Event:AddEvent(BattleEventName.SkillCastEnd, onSkillEnd,nil,nil,role) + end, + -- 释放死亡技能,降低目标[a] 改变[b][c]点怒气 + -- a[int 目标选择逻辑数字],b[int 改变类型],c[int] + [365] = function(role, args,id,judge) + local targetsNum = args[1] + local ct = args[2] + local num = args[3] + -- 技能后后 + local onSkillEnd = function(skill) + if skill and not skill.isTriggerJudge and judge==1 then + return + end + if skill.type == BattleSkillType.DeadSkill then + local arr = BattleUtil.ChooseTarget(role,targetsNum) + for i=1, #arr do + BattleUtil.CalRage(role,arr[i],num,ct) + end + end + end + role.Event:AddEvent(BattleEventName.SkillCastEnd, onSkillEnd,nil,nil,role) + end, + -- 复活己方神将,降低目标[a] 改变[b][c]点怒气 + -- a[int 目标选择逻辑数字],b[int 改变类型],c[int] + [366] = function(role, args,id,judge) + local targetsNum = args[1] + local ct = args[2] + local num = args[3] + -- 技能后后 + local onSkillEnd = function(target) + local arr = BattleUtil.ChooseTarget(role,targetsNum) + for i=1, #arr do + BattleUtil.CalRage(role,arr[i],num,ct) + end + end + role.Event:AddEvent(BattleEventName.ReliveRole, onSkillEnd,nil,nil,role) + end, + + -- 受到的伤害[a]改变[b]%,伤害类型[c] + -- a[改变类型]c[float],c[int 0:所有伤害 1:直接伤害 ] + [367] = function(role, args,id,judge) + local ct = args[1] + local f1 = args[2] + local type = args[3] + local onPassiveBeDamaging = function(func, caster, damage,skill) + if skill and not skill.isTriggerJudge and judge==1 then + return + end + + if type==1 and not skill then + return + end + + local dmgDeduction = damage - floor(BattleUtil.ErrorCorrection(BattleUtil.CountValue(damage, f1, ct))) + if func then func(dmgDeduction) end + end + role.Event:AddEvent(BattleEventName.PassiveBeDamaging, onPassiveBeDamaging,nil,nil,role) + end, + --主动治疗己方神将时,溢出的治疗会*[a]后继续治疗生命百分比最[b]的1名单位 + --a[float],b[int 1:低 2 高] + [368] = function(role, args,id,judge) + local count = args[1] + local type = args[2] + local addHp=0 + + + local onRoleTreat=function(target,realTreat,treat) + local hp=treat- realTreat + if hp>0 and realTreat>0 then + addHp=addHp+hp*count + end + end + local OnSkillCast = function(skill) + if skill and not skill.isTriggerJudge and judge==1 then + return + end + + role.Event:AddEvent(BattleEventName.RoleTreat, onRoleTreat,nil,nil,role) + + end + local OnSkillCastEnd = function(skill) + if skill and not skill.isTriggerJudge and judge==1 then + return + end + role.Event:RemoveEvent(BattleEventName.RoleTreat,onRoleTreat,nil,nil,role) + local list = skill:GetDirectTargetsNoNoDead() + if list and #list>0 then + BattleUtil.SortByHpFactor(list,type) + BattleUtil.FinalTreat(role,list[1],floor(addHp)) + end + addHp=0 + end + role.Event:AddEvent(BattleEventName.SkillCast, OnSkillCast,nil,nil,role) + role.Event:AddEvent(BattleEventName.SkillCastEnd, OnSkillCastEnd,nil,nil,role) + end, + + --主动治疗己方神将时,治疗如果溢出使目标[a] 改变[b][c]%,持续[d]回合;叠加伤害为[e]% + --a[int],b[int 改变类型],c[float],d[int],e[float] + [369] = function(role, args,id,judge) + local pro = args[1] + local ct = args[2] + local v1 = args[3] + local round = args[4] + local v2 = args[5] + --存储每个人buff添加数值 + local addHeros={} + local onRoleTreat=function(target,realTreat,treat) + local hp=treat- realTreat + if addHeros[target] and addHeros[target]+v1>v2 then + return + end + if addHeros[target] then + addHeros[target]=addHeros[target]+v1 + else + addHeros[target]=v1 + end + if hp>0 then + target:AddBuff(Buff.Create(role, BuffName.PropertyChange, round, BattlePropList[pro],v1, ct)) + end + end + local OnSkillCast = function(skill) + if skill and not skill.isTriggerJudge and judge==1 then + return + end + + role.Event:AddEvent(BattleEventName.RoleTreat, onRoleTreat,nil,nil,role) + + end + local OnSkillCastEnd = function(skill) + if skill and not skill.isTriggerJudge and judge==1 then + return + end + role.Event:RemoveEvent(BattleEventName.RoleTreat,onRoleTreat,nil,nil,role) + end + role.Event:AddEvent(BattleEventName.SkillCast, OnSkillCast,nil,nil,role) + role.Event:AddEvent(BattleEventName.SkillCastEnd, OnSkillCastEnd,nil,nil,role) + end, + + -- [a]方处于[b]类型[c]状态敌人受到的直接伤害[c]改变[d]% + -- a[int 0:己方 1:敌方],b[int buff类型],c[int buff效果 (0 表示类型下的的所有)], d[int],e[float] + [370] = function(role, args,id,judge) + local camp = args[1] + local type1 = args[2] + local type2 = args[3] + local ct = args[4] + local v1 = args[5] + local onPassiveBeDamaging = function(func, atkRole, defRole, damage, skill) + if not skill then + return + end + if skill and not skill.isTriggerJudge and judge==1 then + return + end + if camp==0 and defRole.camp~=role.camp then + return + end + + if camp==1 and defRole.camp==role.camp then + return + end + + if BattleLogic.BuffMgr:HasBuff(defRole, type1, function(buff) return buff.hotType == type2 or type2==0 end) then + local dmgDeduction = damage - floor(BattleUtil.ErrorCorrection(BattleUtil.CountValue(damage,v1, ct))) + if func then func(dmgDeduction) end + end + end + BattleLogic.Event:AddEvent(BattleEventName.PassiveDamaging, onPassiveBeDamaging,nil,nil,role) + end, + + --释放技能时,为目标增加[a] 改变[b][c]%的效果,持续[d]回合 + --a[int 属性],b[int 改变类型],c[flaot],d[int] + [371]=function(role, args,id,judge) + local pro = args[1] + local ct = args[2] + local v1 = args[3] + local r1 = args[4] + 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 or skill.type~= BattleSkillType.Extra then + return + end + local arr=skill:GetDirectTargetsNoExile() + for i = 1, #arr do + arr[i]:AddBuff(Buff.Create(role, BuffName.PropertyChange,r1, BattlePropList[pro], v1, ct)) + end + + end + + role.Event:AddEvent(BattleEventName.SkillCast, OnSkillCast,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 8fff603296..015ed0c565 100644 --- a/Assets/ManagedResources/~Lua/Modules/Battle/Logic/Misc/BattleDefine.lua +++ b/Assets/ManagedResources/~Lua/Modules/Battle/Logic/Misc/BattleDefine.lua @@ -76,6 +76,7 @@ BattleEventName = { RoleBeControl = indexAdd(), -- 角色被控制 RoleRealDead = indexAdd(), -- 角色真死了 RoleRelive = indexAdd(), -- 角色复活了 + ReliveRole = indexAdd(), -- 复活角色 FinalDamage = indexAdd(), FinalBeDamage = indexAdd(), FinalBeDamageEnd = indexAdd(), --最后被攻击结束 diff --git a/Assets/ManagedResources/~Lua/Modules/Battle/Logic/Role/RoleLogic.lua b/Assets/ManagedResources/~Lua/Modules/Battle/Logic/Role/RoleLogic.lua index b539566ef9..c05e4a100e 100644 --- a/Assets/ManagedResources/~Lua/Modules/Battle/Logic/Role/RoleLogic.lua +++ b/Assets/ManagedResources/~Lua/Modules/Battle/Logic/Role/RoleLogic.lua @@ -656,6 +656,7 @@ function RoleLogic:Relive() -- 发送复活事件 self.Event:DispatchEvent(BattleEventName.RoleRelive, self) --BattleLogic.Event:DispatchEvent(BattleEventName.RoleRelive, self) + self.reliveCaster.Event:DispatchEvent(BattleEventName.ReliveRole,self) -- 复活的血量算做加血 BattleLogic.Event:DispatchEvent(BattleEventName.RecordTreat, self.reliveCaster or self, self, reHp) return true