From cff6c3f21b6ece7873cadf61f0fb618b0350b86c Mon Sep 17 00:00:00 2001 From: wangzhenxing Date: Fri, 14 Jan 2022 13:49:39 +0800 Subject: [PATCH] =?UTF-8?q?[=E6=88=98=E6=96=97]=3D=3D=3D=3D=3D=E8=A2=AB?= =?UTF-8?q?=E5=8A=A8418-421=E6=8F=90=E4=BA=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../~Lua/Modules/Battle/Logic/Base/Effect.lua | 7 +- .../Modules/Battle/Logic/Base/Passivity.lua | 78 ++++++++++++++++++- .../~Lua/Modules/Battle/Logic/Buff/Shield.lua | 6 +- .../Modules/Battle/Logic/Misc/BattleUtil.lua | 4 +- .../Modules/Battle/Logic/Role/RoleManager.lua | 23 ++++++ 5 files changed, 112 insertions(+), 6 deletions(-) diff --git a/Assets/ManagedResources/~Lua/Modules/Battle/Logic/Base/Effect.lua b/Assets/ManagedResources/~Lua/Modules/Battle/Logic/Base/Effect.lua index 70c3c11706..d550a6c5f0 100644 --- a/Assets/ManagedResources/~Lua/Modules/Battle/Logic/Base/Effect.lua +++ b/Assets/ManagedResources/~Lua/Modules/Battle/Logic/Base/Effect.lua @@ -2831,15 +2831,16 @@ local effectList = { target:AddBuff(buff) end) end, - --为我方添加反伤盾,护盾类型为[a],护盾值为[b]%,持续[c]回合 - --a[int],b[float],c[int] + --为我方添加反伤盾,护盾类型为[a],护盾值为[b]%,持续[c]回合,反弹伤害[d]次 + --a[int],b[float],c[int],d[int] [145] = function(caster, target, args, interval, skill) local type = args[1] local v1 = args[2] local r1 = args[3] + local time = args[4] BattleLogic.WaitForTrigger(interval, function () - target:AddBuff(Buff.Create(caster, BuffName.Shield,r1,type,v1)) + target:AddBuff(Buff.Create(caster, BuffName.Shield,r1,type,v1,time)) end) end, --对目标造成自身[a]*[b]%的伤害,目标每减少[c]个伤害增加[d]%, diff --git a/Assets/ManagedResources/~Lua/Modules/Battle/Logic/Base/Passivity.lua b/Assets/ManagedResources/~Lua/Modules/Battle/Logic/Base/Passivity.lua index 49b8597000..d3cf7c8f42 100644 --- a/Assets/ManagedResources/~Lua/Modules/Battle/Logic/Base/Passivity.lua +++ b/Assets/ManagedResources/~Lua/Modules/Battle/Logic/Base/Passivity.lua @@ -7510,7 +7510,7 @@ local passivityList = { if skill then table.insert(skill.triggerPassivityId,id) end - local list=BattleLogic.BuffMgr:GetAllBuffByFunc(function(buff) return buff.target.camp==role.camp and (buff.type==BuffName.Control or buff.type==BuffName.DOT or buff.type==BuffName.Exile ) end) + local list=BattleLogic.BuffMgr:GetAllBuffByFunc(function(buff) return buff.target.camp==role.camp and (buff.type==BuffName.Control or buff.type==BuffName.DOT ) end) local len=BattleUtil.LengthOfTable(list) if list and len>0 then local index=Random.RangeInt(1,len) @@ -10756,6 +10756,82 @@ local passivityList = { end role.Event:AddEvent(BattleEventName.RoleBeDamaged,onRoleBeDamage,nil,nil,role) end, + --御甲消失时,神将未死亡,回复[a]属性[b]%的血量 + --a[int],b[float] + [418]=function(role,args,id,judge) + local p1=args[1] + local v1=args[2] + local onValueChange=function(buff) + if buff.type==BuffName.Blood and not role:IsDead() then + local tv = floor(BattleUtil.ErrorCorrection(role:GetRoleData(BattlePropList[p1]) * v1)) + --BattleUtil.AddBlood(role,tv) + BattleUtil.FinalTreat(role,role,tv) + end + end + role.Event:AddEvent(BattleEventName.BuffEnd,onValueChange,nil,nil,role) + end, + --己方神将死亡时,自身回复[a]属性[b]%的血量,并增加[c]属性[d]%的御甲 + --a[int],b[float],c[int],d[float] + [419]=function(role,args,id,judge) + local onRoleDead=function(target) + local p1=args[1] + local v1=args[2] + local p2=args[3] + local v2=args[4] + if target~=role and target.camp==role.camp and not BattleUtil.CheckIsNoDead(target) then + local tv = floor(BattleUtil.ErrorCorrection(role:GetRoleData(BattlePropList[p1]) * v1)) + local tv2 = floor(BattleUtil.ErrorCorrection(role:GetRoleData(BattlePropList[p2]) * v2)) + BattleUtil.FinalTreat(role,role,tv) + BattleUtil.AddBlood(role,tv2) + end + end + BattleLogic.Event:AddEvent(BattleEventName.BattleRoleDead,onRoleDead,nil,nil,role) + end, + --攻击时额外[a]改变当前存活神将*[b]%的直接伤害 + --a[int],b[float] + [420]=function(role,args,id,judge) + local ct=args[1] + local v1=args[2] + + local finalDamage=function(func, defRole, damage, skill) + if not skill then + return + end + local list = RoleManager.QueryIncludeExileNoNoDead(function(v) return v.camp==role.camp end) + local add=damage-floor(BattleUtil.CountValue(damage,v1*#list,ct)) + if func then + func(add) + end + end + role.Event:AddEvent(BattleEventName.FinalDamage,finalDamage,nil,nil,role) + end, + --释放技能攻击(非追击)有[a]%的概率偷取目标[b]点怒气。 + --a[float],b[int] + [421]=function(role,args,id,judge) + local p1=args[1] + local num=args[2] + + -- 释放技能后 + local onRoleHit = function(target,damage,bCrit,finalDmg,damageType,skill) + if skill==nil or skill.type~= BattleSkillType.Special then + return + end + if skill and not skill.isTriggerJudge and judge==1 then + return + end + if target.Rage>0 and not BattleLogic.BuffMgr:HasBuff(target, BuffName.Shield, function (buff) return buff.shieldType == ShieldTypeName.AllReduce end) then + BattleUtil.RandomAction(p1,function() + BattleLogic.WaitForTrigger(BattleLogic.GameDeltaTime, function () + BattleUtil.CalRage(role,target,num,CountTypeName.Sub) + BattleUtil.CalRage(role,role,num,CountTypeName.Add) + end) + end) + end + + end + role.Event:AddEvent(BattleEventName.RoleHit, onRoleHit,nil,nil,role) + end, + } diff --git a/Assets/ManagedResources/~Lua/Modules/Battle/Logic/Buff/Shield.lua b/Assets/ManagedResources/~Lua/Modules/Battle/Logic/Buff/Shield.lua index 866a5a1c14..5eaa24df3d 100644 --- a/Assets/ManagedResources/~Lua/Modules/Battle/Logic/Buff/Shield.lua +++ b/Assets/ManagedResources/~Lua/Modules/Battle/Logic/Buff/Shield.lua @@ -20,7 +20,7 @@ function Shield:SetData(...) self.cover = self.shieldType ~= ShieldTypeName.NormalReduce -- 除固定减伤盾外都不能叠加 -- 刷新排序等级 self.sort = 4 - + self.triggerTime=0 self.onRoleBeHit=function(atkRole, damage, bCrit, finalDmg, damageType, skill) --damagetype为3 是 舍身济世分摊伤害 if damageType==3 then @@ -29,7 +29,11 @@ function Shield:SetData(...) if skill then --技能造成的直接伤害 local rDamage = math.floor(damage*self.shieldValue) if rDamage ~= 0 then + self.triggerTime=self.triggerTime+1 BattleUtil.ApplyDamage(nil,self.target,atkRole, rDamage) + if self.triggerTime>=self.dmgReboundFactor then + self.disperse=true + end end end end diff --git a/Assets/ManagedResources/~Lua/Modules/Battle/Logic/Misc/BattleUtil.lua b/Assets/ManagedResources/~Lua/Modules/Battle/Logic/Misc/BattleUtil.lua index 4950c1b3c1..15cf4f84f5 100644 --- a/Assets/ManagedResources/~Lua/Modules/Battle/Logic/Misc/BattleUtil.lua +++ b/Assets/ManagedResources/~Lua/Modules/Battle/Logic/Misc/BattleUtil.lua @@ -387,7 +387,7 @@ function BattleUtil.ChooseTarget(role, chooseId) if sort~=0 then BattleUtil.SortByProp(arr, RoleDataName.Hp, sort) end - elseif chooseWeight == 2 then -- 血量百分比 + elseif chooseWeight == 2 then -- 血量百分比(不含不灭) BattleUtil.SortByHpFactor(arr, sort) --选血量百分比最低的 不选择有不灭的,如果伤害要选有不灭的 需处理 BattleUtil.RemoveNoDeadRole(arr) @@ -451,6 +451,8 @@ function BattleUtil.ChooseTarget(role, chooseId) arr={} table.insert(arr,aaa) -- return aaa + elseif chooseWeight ==16 then --(血量百分比 含不灭) + BattleUtil.SortByHpFactor(arr, sort) end local finalArr = {} if num == 0 then diff --git a/Assets/ManagedResources/~Lua/Modules/Battle/Logic/Role/RoleManager.lua b/Assets/ManagedResources/~Lua/Modules/Battle/Logic/Role/RoleManager.lua index e672f1013d..2227cf07a0 100644 --- a/Assets/ManagedResources/~Lua/Modules/Battle/Logic/Role/RoleManager.lua +++ b/Assets/ManagedResources/~Lua/Modules/Battle/Logic/Role/RoleManager.lua @@ -207,6 +207,26 @@ function RoleManager.QueryIncludeExile(func, inCludeDeadRole) end) return list end + +-- 查找角包括放逐目标,不包括触发不灭的 +function RoleManager.QueryIncludeExileNoNoDead(func, inCludeDeadRole) + local list = {} + local index = 1 + if func then + for pos, v in pairs(PosList) do + if func(v) and (inCludeDeadRole or not v:IsRealDead()) and v.deadFilter then + list[index] = v + index = index + 1 + end + end + end + table.sort(list, function(a, b) + return a.position < b.position + end) + return list +end + + -- 查找角色(不包含死亡和拥有不灭的) 2020/11/28 王振兴 function RoleManager.QueryNoDead(func) local list = {} @@ -240,6 +260,9 @@ function RoleManager.NoOrder(func) return list end + + + --对位规则: 1敌方相同对位 2若死亡或不存在,选取相邻阵位最近且阵位索引最小的 function this.GetAggro(role) -- 计算开始位置