diff --git a/Assets/ManagedResources/~Lua/Modules/Battle/Logic/Base/Effect.lua b/Assets/ManagedResources/~Lua/Modules/Battle/Logic/Base/Effect.lua index 7d5eed4a52..6461adf37f 100644 --- a/Assets/ManagedResources/~Lua/Modules/Battle/Logic/Base/Effect.lua +++ b/Assets/ManagedResources/~Lua/Modules/Battle/Logic/Base/Effect.lua @@ -1966,12 +1966,13 @@ local effectList = { caster:AddPassive(167, {i1, i2}, false) -- 不可叠加 end, - --造成[a]%的[b]伤害,造成伤害的[c]%用于医疗生命值最低队友。 - --a[float],b[伤害类型],c[float] + --造成[a]%的[b]伤害,造成伤害的[c]%用于医疗生命值最低[d]名队友。 + --a[float],b[伤害类型],c[float] ,d[int] [103] = function(caster, target, args, interval, skill) local f1 = args[1] local dt = args[2] local f2 = args[3] + local num = args[4] caster.Event:DispatchEvent(BattleEventName.RoleViewBullet, skill, target) BattleLogic.WaitForTrigger(interval, function () local OnBeHit = function(atkRole, damage, bCrit, finalDmg, damageType) @@ -1981,7 +1982,11 @@ local effectList = { f2 = BattleUtil.CheckSkillDamageHeal(f2, caster, arr[1]) -- 治疗血量最低队友实际伤害的f2% --之前是finaldag 改成 damage - BattleUtil.ApplyTreat(caster, arr[1], floor(damage*f2)) + for i = 1, LengthOfTable(arr) do + if i<=num then + BattleUtil.ApplyTreat(caster, arr[i], floor(damage*f2)) + end + end end target.Event:AddEvent(BattleEventName.RoleBeHit, OnBeHit) BattleUtil.CalDamage(skill, caster, target, dt, f1) diff --git a/Assets/ManagedResources/~Lua/Modules/Battle/Logic/Base/Passivity.lua b/Assets/ManagedResources/~Lua/Modules/Battle/Logic/Base/Passivity.lua index 8aba1c6739..e148dc2f3b 100644 --- a/Assets/ManagedResources/~Lua/Modules/Battle/Logic/Base/Passivity.lua +++ b/Assets/ManagedResources/~Lua/Modules/Battle/Logic/Base/Passivity.lua @@ -2748,16 +2748,23 @@ local passivityList = { role.Event:AddEvent(BattleEventName.SkillCastEnd, onSkillCastEnd) end, - -- 受到攻击有[a]%概率使攻击者[b](每回合造成被击者自身20%攻击力的伤害)持续[c]回合 - -- a[float]b[持续伤害状态]c[int] + -- 受到[a]攻击有[b]%概率使攻击者[c](每回合造成被击者自身20%攻击力的伤害)持续[d]回合 + -- a[int 攻击类型] b[float]c[持续伤害状态]d[int] a:0 所有攻击 1:只限制技能伤害 [147] = function(role, args) - local f1 = args[1] - local dot = args[2] - local i1 = args[3] - + local type=args[1] + local f1 = args[2] + local dot = args[3] + local i1 = args[4] -- 技能后后 - local onRoleBeHit = function(caster) - + local onRoleBeHit = function(caster,damage, bCrit, finalDmg, damageType, skill) + --屏蔽相同阵营 + if caster.camp==role.camp then + return + end + --检测技能 + if type==1 and (not skill or skill.type==BattleSkillType.Normal)then + return + end local attack = role:GetRoleData(RoleDataName.Attack) local damage = floor(BattleUtil.ErrorCorrection(attack * 0.2)) BattleUtil.RandomDot(f1, dot, role, caster, i1, 1, damage) @@ -4049,17 +4056,21 @@ local passivityList = { role.Event:AddEvent(BattleEventName.PassiveDamaging, passivityDamaging) end, - --技能治疗系数[a]改变[b]%(作用于主动技能效果103) - --a[改变类型]b[float] + --技能治疗系数[a]改变[b]% ,技能目标改变[c] [d]名(作用于主动技能效果103) + --a[改变类型]b[float] c[改变类型] d[int] [206] = function(role, args) local ct = args[1] local f1 = args[2] - + local ct2 = args[3] + local f2 = args[4] local onSkillEffectBefore = function(skill, e, func) if skill.type == BattleSkillType.Special then if e.type == 103 then -- 当前只对技能效果103生效 local factor = BattleUtil.ErrorCorrection(BattleUtil.CountValue(e.args[3], f1, ct)) e.args[3] = factor + if ct2 and f2 then + e.args[4] = BattleUtil.ErrorCorrection(BattleUtil.CountValue(e.args[4], f2, ct2)) + end if func then func(e) end end end @@ -5472,6 +5483,9 @@ local passivityList = { local ct = args[2] local f1 = args[3] local onPassiveBeDamaging = function(func, caster, damage) + if caster and caster.camp==role.camp then + return + end if BattleLogic.BuffMgr:HasBuff(caster, BuffName.DOT, function(buff) return buff.damageType == dot end) then role:AddRage(f1,ct) end @@ -5488,7 +5502,6 @@ local passivityList = { local pro=0 if curRound>0 then pro=i1^(curRound-1) - LogError("cur round pro "..pro) end if isTrigger then local isAdd=BattleUtil.RandomAction(pro, function () @@ -5500,11 +5513,12 @@ local passivityList = { end end) end, - -- 释放技能时如目标处于[a]状态,解除周围人系神将的异常状态 - -- a[持续伤害状态]b[float] + -- 释放技能时如目标处于[a]状态,解除周围[c]系神将的控制状态 + -- a[持续伤害状态]b[float] c[int] [273] = function(role, args) local dot = args[1] local f1 = args[2] + local ele =args[3] local onHit = function(target, damage, bCrit, finalDmg) --屏蔽相同阵应 if target and target.camp==role.camp then @@ -5514,10 +5528,10 @@ local passivityList = { local list = RoleManager.GetNeighbor(role, 1) if list then for key, value in pairs(list) do - if value and value~=role and value.element==role.element then + if value and value~=role and value.element==ele then -- 清除所有负面buff - BattleLogic.BuffMgr:ClearBuff(self.target, function (buff) - return buff.type == BuffName.Control or buff.type == BuffName.DOT + BattleLogic.BuffMgr:ClearBuff(value, function (buff) + return buff.type == BuffName.Control end) end end @@ -5658,16 +5672,17 @@ local passivityList = { role.Event:AddEvent(BattleEventName.SkillEffectBefore, onSkillEffectBefore) end, --为己方神将附加的护盾消失后,回复被保护的神将[a][b]%的血量 + --a[int 属性id] b[flaot] [278]=function(role,args) local pro=args[1] local v1=args[2] local OnBuffEnd=function(buff) - if buff and buff.caster==role and buff.type==BuffName.Shield then + if buff and not buff.target:IsDead() and buff.caster==role and buff.type==BuffName.Shield then local val = floor(BattleUtil.FP_Mul(v1, role:GetRoleData(BattlePropList[pro]))) BattleUtil.CalTreat(role,buff.target, val) end end - role.Event:AddEvent(BattleEventName.BuffEnd, OnBuffEnd) + BattleLogic.Event:AddEvent(BattleEventName.ShieldBuffEnd, OnBuffEnd) end, --发动技能后,[a]概率给我方[b]最高[c]名[d]阵营 [e]属性[f]改变[g],持续[h]回合 --a[float],b[int 属性],c[int], d[int],e[int 属性],f[int 改变类型],g[float] h[int] @@ -5684,17 +5699,15 @@ local passivityList = { local OnSkillCastEnd = function(skill) 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 end) + local list= RoleManager.Query(function(v) return v.camp == role.camp and v.element==ele and not v:IsDead() end) if not list or LengthOfTable(list)==0 then return end list =BattleUtil.SortByProp(list,BattlePropList[p2],0) for i = 1,LengthOfTable(list) do - if i<=num then - if not list[i]:IsDead() then - local buff=Buff.Create(role, BuffName.PropertyChange,r1,BattlePropList[p3],v1,ct ) - list[i]:AddBuff(buff) - end + if i<=num then + local buff=Buff.Create(role, BuffName.PropertyChange,r1,BattlePropList[p3],v1,ct ) + list[i]:AddBuff(buff) end end end) @@ -5705,8 +5718,113 @@ local passivityList = { --免疫减怒 [280]=function(role,args) role.isImmuneReduceRage=true - LogError("角色免疫减怒") end, - + --当己方[a]阵营神将释放技能怒气不足时,将从精卫身上额外转移怒气释放技能(转移的怒气首先可以保证精卫释放技能) + --a[int 阵营id] + [281]=function(role,args) + local ele=args[1] + local onRoleCastSkillBrfore=function(caster) + -- 施法者不是自身/自身不足已释放技能/不是己方英雄/不是a 阵营 + if caster==role or role.Rage <= role.SuperSkillRage or caster.camp~=role.camp or caster.element~=role.element then + return + end + --释放者死亡或释放着被沉默 + if caster:IsDead() or caster.ctrl_slient then + return + end + local moreRage=role.Rage-role.SuperSkillRage + local lessRage=caster.SuperSkillRage-caster.Rage + local num=moreRage-lessRage + if num>=0 then + --精卫转移怒气不算减怒 + role.Rage=role.Rage-lessRage + caster:AddRage(lessRage, CountTypeName.Add) + end + end + BattleLogic.Event:AddEvent(BattleEventName.RoleCastSkillBefore, onRoleCastSkillBrfore) + end, + --上阵[a]方[b]阵营神将[c] [d]改变[e] 持续[f]回合 + --a[int 0:己方 1:敌方], b[int 阵营id], c[int 属性id], d[int 改变类型] e[float] f[int] + [282]=function(role,args) + local camp=args[1] + local ele=args[2] + local pro=args[3] + local ct=args[4] + local v1=args[5] + --回合数默认为0,永久生效 + local r1=0 + if args[6] then + r1=args[6] + end + local OnRoundChange=function(round) + if round==1 then + local list=nil + if camp==0 then + list= RoleManager.Query(function(v) return v.camp == role.camp and v.element==ele end) + elseif camp==1 then + list= RoleManager.Query(function(v) return v.camp ~= role.camp and v.element==ele end) + end + if not list or LengthOfTable(list)==0 then + return + end + for key, value in pairs(list) do + -- value.data:CountValue(BattlePropList[pro], v1, ct) + local buff=Buff.Create(role, BuffName.PropertyChange,r1,BattlePropList[pro],v1,ct ) + value:AddBuff(buff) + end + end + end + BattleLogic.Event:AddEvent(BattleEventName.BattleRoundChange, OnRoundChange) + end, + --释放技能后,额外[a]改变[b]方怒气最少的[c]阵营目标[d]点怒气 + --a[int 改变类型],b[int 0:己方 1:敌方],c[int],d[int] + [283]=function(role,args) + local ct=args[1] + local camp=args[2] + local ele=args[3] + local v1=args[4] + local onSkillCastEnd=function(skill) + if skill and skill.type== BattleSkillType.Special then + local list=nil + if camp==0 then + list= RoleManager.Query(function(v) return v.camp == role.camp and v.element==ele end) + elseif camp==1 then + list= RoleManager.Query(function(v) return v.camp ~= role.camp and v.element==ele end) + end + if not list or LengthOfTable(list)==0 then + return + end + list=BattleUtil.SortByRage(list,0) + list[1]:AddRage(v1,ct) + end + end + role.Event:AddEvent(BattleEventName.SkillCastEnd, onSkillCastEnd) + end, + --受到[a]类型伤害的[b]%转化为血量,治疗自己 + -- a[int 1:普攻 2:技能 ] b[flaot] + [284]=function(role,args) + local type=args[1] + local v1=args[2] + local onRoleBeHit=function(atkRole, damage, bCrit, finalDmg, damageType, skill,isDirect) + if type==1 then--普攻 + if not skill or skill.type~= BattleSkillType.Normal then + return + end + elseif type==2 then--技能 + if skill then + if skill.type==BattleSkillType.Normal and skill.type==BattleSkillType.Monster then + return + end + else + if not isDirect then + return + end + end + end + BattleUtil.ApplyTreat(role, role, floor(BattleUtil.ErrorCorrection(damage * v1))) + end + role.Event:AddEvent(BattleEventName.RoleBeHit,onRoleBeHit) + end, + } return passivityList \ No newline at end of file diff --git a/Assets/ManagedResources/~Lua/Modules/Battle/Logic/Buff/Shield.lua b/Assets/ManagedResources/~Lua/Modules/Battle/Logic/Buff/Shield.lua index 1e65a206ea..eb6f17e96a 100644 --- a/Assets/ManagedResources/~Lua/Modules/Battle/Logic/Buff/Shield.lua +++ b/Assets/ManagedResources/~Lua/Modules/Battle/Logic/Buff/Shield.lua @@ -147,6 +147,7 @@ function Shield:OnEnd() end end end + BattleLogic.Event:DispatchEvent(BattleEventName.ShieldBuffEnd, self) end --只有当cover字段为true时触发,返回true则被新效果覆盖 diff --git a/Assets/ManagedResources/~Lua/Modules/Battle/Logic/Misc/BattleDefine.lua b/Assets/ManagedResources/~Lua/Modules/Battle/Logic/Misc/BattleDefine.lua index 3800b3f948..1c8d7fd93d 100644 --- a/Assets/ManagedResources/~Lua/Modules/Battle/Logic/Misc/BattleDefine.lua +++ b/Assets/ManagedResources/~Lua/Modules/Battle/Logic/Misc/BattleDefine.lua @@ -127,6 +127,10 @@ BattleEventName = { DebugStop = indexAdd(), --显示提示文字 ShowHintText = indexAdd(), + --角色释放技能之前 + RoleCastSkillBefore = indexAdd(), + --护盾buff消失以后 + ShieldBuffEnd=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 7227b1ebbf..f2898f0f5d 100644 --- a/Assets/ManagedResources/~Lua/Modules/Battle/Logic/Misc/BattleUtil.lua +++ b/Assets/ManagedResources/~Lua/Modules/Battle/Logic/Misc/BattleUtil.lua @@ -87,6 +87,27 @@ function BattleUtil.SortByHpFactor(arr, sort) end) return arr end +--按怒气排序 +function BattleUtil.SortByRage(arr, sort) + BattleUtil.Sort(arr, function(a, b) + local r1 = a.Rage + local r2 = b.Rage + if sort == 1 then + if r1==r2 then + return a.position>b.position + else + return r1 < r2 + end + else + if r1==r2 then + return a.position>b.position + else + return r1 > r2 + end + end + end) + return arr +end -- 获取技能最大目标数 function BattleUtil.GetMaxTargetNum(chooseId) @@ -447,12 +468,13 @@ function BattleUtil.FinalDamage(skill, atkRole, defRole, damage, bCrit, damageTy end if skill then atkRole.Event:DispatchEvent(BattleEventName.RoleHit, defRole, damage, bCrit, finalDmg, damageType, skill) - defRole.Event:DispatchEvent(BattleEventName.RoleBeHit, atkRole, damage, bCrit, finalDmg, damageType, skill) + defRole.Event:DispatchEvent(BattleEventName.RoleBeHit, atkRole, damage, bCrit, finalDmg, damageType, skill,isDirect) end --如果不是技能带的伤害,并且是直接伤害就,,,,, --用于处理不触发特性并且是直接伤害的伤害 isDirect 暂时先为bool值,后期可根据需求做修改扩展 by:王振兴 2020/10/12 16:18 if isDirect and not skill then atkRole.Event:DispatchEvent(BattleEventName.RoleHit, defRole, damage, bCrit, finalDmg, damageType, skill) + defRole.Event:DispatchEvent(BattleEventName.RoleBeHit, atkRole, damage, bCrit, finalDmg, damageType, skill,isDirect) end end diff --git a/Assets/ManagedResources/~Lua/Modules/Battle/Logic/Role/RoleLogic.lua b/Assets/ManagedResources/~Lua/Modules/Battle/Logic/Role/RoleLogic.lua index 0b5795071d..117eb85809 100644 --- a/Assets/ManagedResources/~Lua/Modules/Battle/Logic/Role/RoleLogic.lua +++ b/Assets/ManagedResources/~Lua/Modules/Battle/Logic/Role/RoleLogic.lua @@ -160,7 +160,6 @@ end function RoleLogic:AddRage(value, type) -- 角色身上有无敌盾,不扣除怒气 by:wangzhenxing 2020/08/10 14:56 if (type==3 or type==4) and (self.isImmuneReduceRage or BattleLogic.BuffMgr:HasBuff(self, BuffName.Shield, function (buff) return buff.shieldType and buff.shieldType == ShieldTypeName.AllReduce end)) then - LogBattle("角色身上有无敌盾,不扣除怒气") return end @@ -174,7 +173,6 @@ function RoleLogic:AddRage(value, type) elseif type == 4 then --乘减算(百分比属性减算) delta = -floor(value * self.SuperSkillRage) end - -- self.Event:DispatchEvent(BattleEventName.RoleRageChange, delta) --怒气值不可为负值 self.Rage = max(self.Rage + delta, 0) @@ -362,7 +360,9 @@ end -- isRage 是否正常操作怒气值 function RoleLogic:AddSkill(type, isRage, isAdd, targets) if not self.IsCanAddSkill and isAdd then return end + local effectData = type == BattleSkillType.Normal and self.skill or self.superSkill + SkillManager.AddSkill(self, effectData, type, targets, isAdd, isRage) -- BattleLogManager.Log( @@ -429,6 +429,10 @@ function RoleLogic:CastSkill(func) if not self:IsAvailable() then return end + --如果当前怒气不足以释放绝技 + if self.Rage= self.SuperSkillRage then -- 释放大技能