From 86aee0e6ce9a97b4a8b937c2510eb27ab88b6e5d Mon Sep 17 00:00:00 2001 From: duhui Date: Thu, 10 Dec 2020 16:32:17 +0800 Subject: [PATCH] =?UTF-8?q?=E6=88=98=E6=96=97=E5=90=8C=E6=AD=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- luafight/Modules/Battle/Logic/Base/Buff.lua | 30 +- luafight/Modules/Battle/Logic/Base/Effect.lua | 17 +- .../Modules/Battle/Logic/Base/Passivity.lua | 423 +++++++++++++++++- luafight/Modules/Battle/Logic/BattleLogic.lua | 2 + luafight/Modules/Battle/Logic/Buff/Shield.lua | 1 + .../Battle/Logic/Misc/BattleDefine.lua | 15 +- .../Modules/Battle/Logic/Misc/BattleUtil.lua | 24 +- .../Modules/Battle/Logic/Role/RoleLogic.lua | 11 +- .../Modules/Battle/Logic/Role/RoleManager.lua | 33 +- 9 files changed, 519 insertions(+), 37 deletions(-) diff --git a/luafight/Modules/Battle/Logic/Base/Buff.lua b/luafight/Modules/Battle/Logic/Base/Buff.lua index 84795b418..0fbfdd1fa 100644 --- a/luafight/Modules/Battle/Logic/Base/Buff.lua +++ b/luafight/Modules/Battle/Logic/Base/Buff.lua @@ -310,6 +310,34 @@ function BuffManager:PassUpdate() and buff.caster.camp == curCamp -- 释放者是当前轮到的人 and buff.caster.position == curPos and buff.roundDuration > 0 -- 不是无限存在的buff + and buff.caster.type~=BattleUnitType.Monster --灵兽的buff在这里处理 + then + -- 当前轮释放的buff不结算 + if buff.startRound ~= BattleLogic.GetCurRound() then + buff.roundPass = buff.roundPass + 1 + if buff.roundPass >= buff.roundDuration then + buff.disperse = true + end + buff.target.Event:DispatchEvent(BattleEventName.BuffRoundChange, buff) + end + end + end + end + end +end +--计算灵兽buff更新 +function BuffManager:PassMonsterUpdate() + local curCamp, curPos = BattleLogic.GetCurTurn() + for i=1, self.buffDic.size do + local buffList = self.buffDic.vList[i] + if buffList.size > 0 then + for index = 1, buffList.size do + local buff = buffList.buffer[index] + if not buff.disperse -- 没过期 + --and buff.caster.camp == curCamp -- 释放者是当前轮到的人 + --and buff.caster.position == curPos + and buff.roundDuration > 0 -- 不是无限存在的buff + and buff.caster.type==BattleUnitType.Monster --灵兽的buff在这里处理 then -- 当前轮释放的buff不结算 if buff.startRound ~= BattleLogic.GetCurRound() then @@ -324,8 +352,6 @@ function BuffManager:PassUpdate() end end end - - -- 每一个人的轮次都刷新 function BuffManager:TurnUpdate(sort) local curCamp, curPos = BattleLogic.GetCurTurn() diff --git a/luafight/Modules/Battle/Logic/Base/Effect.lua b/luafight/Modules/Battle/Logic/Base/Effect.lua index 2525f4aad..18d7aade5 100644 --- a/luafight/Modules/Battle/Logic/Base/Effect.lua +++ b/luafight/Modules/Battle/Logic/Base/Effect.lua @@ -1966,22 +1966,27 @@ 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) - local arr = RoleManager.Query(function (r) return r.camp == caster.camp end) + local arr = RoleManager.NoOrder(function (r) return r.camp == caster.camp end,false,true) BattleUtil.SortByHpFactor(arr, 1) - -- 检测技能伤害治疗加成 - f2 = BattleUtil.CheckSkillDamageHeal(f2, caster, arr[1]) + -- 检测技能伤害治疗加成 -- 治疗血量最低队友实际伤害的f2% --之前是finaldag 改成 damage - BattleUtil.ApplyTreat(caster, arr[1], floor(damage*f2)) + for i = 1, #arr do + if i<=num then + f2 = BattleUtil.CheckSkillDamageHeal(f2, caster, arr[i]) + 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/luafight/Modules/Battle/Logic/Base/Passivity.lua b/luafight/Modules/Battle/Logic/Base/Passivity.lua index 9acc343e9..a3d0757b3 100644 --- a/luafight/Modules/Battle/Logic/Base/Passivity.lua +++ b/luafight/Modules/Battle/Logic/Base/Passivity.lua @@ -1529,7 +1529,7 @@ local passivityList = { role.data:CountValue(BattlePropList[pro], f1, ct) end, --- 技能伤害增加[a]%,[b]改变 + -- 技能伤害增加[a]%,[b]改变 -- a[float]b[改变类型] [91] = function(role, args,id,judge) local f1 = args[1] @@ -1705,8 +1705,7 @@ local passivityList = { local function onSkillCastEnd(skill) if skill.type == BattleSkillType.Special then role.Event:RemoveEvent(BattleEventName.RoleHit, OnHit) - - local arr = RoleManager.Query(function (r) return r.camp == role.camp end) + local arr = RoleManager.Query(function (r) return r.camp == role.camp and r.deadFilter end) BattleUtil.SortByHpFactor(arr, 1) -- 检测技能伤害���疗加成 local f = BattleUtil.CheckSkillDamageHeal(f1, role, arr[1]) @@ -2010,7 +2009,7 @@ local passivityList = { end, - -- 战斗第[a]回合增加[c]%的自身伤害持续[e]回合,[f]改变 + -- 战斗第[a]回合增加[c]%的自身伤害持续[e]回合,[f]改变 -- a[int]c[float]e[int]f[改变] [115] = function(role, args,id,judge) local i1 = args[1] @@ -2748,16 +2747,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) @@ -3853,7 +3859,7 @@ local passivityList = { [197] = function(role, args) local f1 = args[1] local onRoleHit = function(target, damage, bCrit, finalDmg, damageType, skill) - if skill and skill.type == BattleSkillType.Special and target:IsDead() and not BattleUtil.CheckIsNoDead(target) then + if skill and (skill.type == BattleSkillType.Special or skill.type==BattleSkillType.Extra) and target:IsDead() and not BattleUtil.CheckIsNoDead(target) then BattleUtil.RandomAction(f1, function() role:AddRage(target.Rage, CountTypeName.Add) end) @@ -4049,17 +4055,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 @@ -4495,7 +4505,7 @@ local passivityList = { role.Event:AddEvent(BattleEventName.RoleHit, _OnRoleHit) end, - -- + -- 大闹天宫胜利次数 [225] = function(role, args) --王振兴添加 local f1 = args[1] @@ -4503,7 +4513,7 @@ local passivityList = { local ct1 = args[3] local maxNum = args[4] -- 紫+橙 - local num = OutDataManager.GetOutData(role.camp, OutDataName.MisteryLiquidUsedTimes) + local num = OutDataManager.GetOutData(role.camp, OutDataName.WinTimes) num = min(maxNum, num) BattleUtil.AddProp(role, pro1, f1 * num, ct1) @@ -4752,7 +4762,7 @@ local passivityList = { local maxNum = args[7] -- 紫+橙 - local num = OutDataManager.GetOutData(role.camp, OutDataName.PerpleGloryItemNum) + OutDataManager.GetOutData(role.camp, OutDataName.OrangeGloryItemNum) + local num = OutDataManager.GetOutData(role.camp, OutDataName.OrangeGloryItemNum) + OutDataManager.GetOutData(role.camp, OutDataName.RedGloryItemNum) num = min(maxNum, num) BattleUtil.AddProp(role, pro1, f1 * num, ct1) BattleUtil.AddProp(role, pro2, f2 * num, ct2) @@ -5464,7 +5474,382 @@ local passivityList = { end end role.Event:AddEvent(BattleEventName.RoleHit, onRoleHit) + end, + -- 受到[a]状态敌人攻击时受到伤害[b]改变[c]怒气 + -- a[持续伤害状态]b[改变类型]c[int] + [271] = function(role, args) + local dot = args[1] + 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 + end + role.Event:AddEvent(BattleEventName.PassiveBeDamaging, onPassiveBeDamaging) + end, + -- 战斗第回合概率无敌,回合数每增加1,概率是之前的[a] + -- a[float] + [272] = function(role, args) + local i1 = args[1] + local buff=nil + local isTrigger=true + BattleLogic.Event:AddEvent(BattleEventName.BattleRoundChange, function(curRound) + local pro=0 + if curRound>0 then + pro=i1^(curRound-1) + end + if isTrigger then + local isAdd=BattleUtil.RandomAction(pro, function () + buff = Buff.Create(role, BuffName.Shield, 1, ShieldTypeName.AllReduce, 0, 0) + buff.clear = false + role:AddBuff(buff) + end) + isTrigger=isAdd + end + end) + end, + -- 释放技能时如目标处于[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 + return + end + if BattleLogic.BuffMgr:HasBuff(target, BuffName.DOT, function(buff) return buff.damageType == dot end) then + local list = RoleManager.GetNeighbor(role, 1) + if list then + for key, value in pairs(list) do + if value and value~=role and value.element==ele then + -- 清除所有负面buff + BattleLogic.BuffMgr:ClearBuff(value, function (buff) + return buff.type == BuffName.Control + end) + end + end + end + end + end + local onSkillCast = function(skill) + if skill.type == BattleSkillType.Special or skill.type == BattleSkillType.Extra then + role.Event:AddEvent(BattleEventName.RoleHit, onHit) + end + end + -- 技能后后 + local onSkillCastEnd = function(skill) + if skill.type == BattleSkillType.Special or skill.type == BattleSkillType.Extra then + role.Event:RemoveEvent(BattleEventName.RoleHit, onHit) + end + end + role.Event:AddEvent(BattleEventName.SkillCast, onSkillCast) + role.Event:AddEvent(BattleEventName.SkillCastEnd, onSkillCastEnd) + end, + + --受到[a]目标攻击时,自身免疫控制和减怒 + --a[int 持续伤害类型] b,c[int 持续伤害类型] + [274] = function(role,args) + local sta1=args[1] + local sta2=args[2] + local sta3=args[3] + local skiller=nil + local immune = function(buff) + return buff.type == BuffName.Control + end + local curBuff=nil + local immuneState=false + local onRoleDamageBefore=function(atkRole, factorFunc, damageType, skill) + if atkRole.camp~= role.camp and BattleLogic.BuffMgr:HasBuff(skill.owner, BuffName.DOT, function (buff) return buff.damageType == sta1 end) then + --curBuff=Buff.Create(role, BuffName.Immune, 1,4,immune) + -- role:AddBuff(curBuff) + role.buffFilter:Add(immune) + immuneState=role.isImmuneReduceRage + if not immuneState then + role.isImmuneReduceRage=true + end + skiller=atkRole + end + end + role.Event:AddEvent(BattleEventName.RoleBeDamagedBefore,onRoleDamageBefore) + + -- 释放技能后 + local onSkillEnd = function(skill) + if skill and skill.owner==skiller then + --if curBuff then + -- BattleLogic.BuffMgr:ClearBuff(role, function (buff) + -- return buff==curBuff + -- end) + for i = 1, role.buffFilter.size do + if role.buffFilter.buffer[i] == immune then + role.buffFilter:Remove(i) + break + end + end + role.isImmuneReduceRage=immuneState + -- end + end + end + BattleLogic.Event:AddEvent(BattleEventName.SkillCastEnd, onSkillEnd) + end, + + + -- 释放技能后[a]方 [b]最高[c]阵营 友方改变[d][e]点怒气 + -- a[int,敌我方] 0:我方 1:敌方,b[int 属性类型], c[int 阵营id], d[int 改变类型], e[int] + [275] = function(role, args) + local camp = args[1] + local pro=args[2] + local ele=args[3] + local ct=args[4] + local num=args[5] + -- 释放技能后 + local onSkillEnd = function(skill) + 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) + elseif camp==1 then + list= RoleManager.Query(function(v) return v.camp ~= role.camp and v.element==ele end) + end + if not list or #list == 0 then + return + end + list = BattleUtil.SortByProp(list, BattlePropList[pro],0) + if not list[1]:IsDead() then + list[1]:AddRage(num,ct) + end + end + end + role.Event:AddEvent(BattleEventName.SkillCastEnd, onSkillEnd) + end, + + -- 释放技能后 生命百分比最少[a]名[b]阵营,附加免疫控制效果,持续[c]回合 + -- a[int],b[int 阵营id],c[int] + [276] = function(role, args) + local num = args[1] + local ele=args[2] + local round=args[3] + -- 释放技能后 + local onSkillEnd = function(skill) + if skill.type == BattleSkillType.Special or skill.type==BattleSkillType.Extra then + local list= RoleManager.NoOrder(function(v) return v.camp == role.camp and v.element==ele end,true) + if not list or #list ==0 then + return + end + list =BattleUtil.SortByHpFactor(list,1) + for i = 1, #list do + if i<=num then + if not list[i]:IsDead() then + local buff=Buff.Create(role, BuffName.Immune,round,1) + list[i]:AddBuff(buff) + end + end + end + end + end + role.Event:AddEvent(BattleEventName.SkillCastEnd, onSkillEnd) + end, + -- 减伤改为[a] 持续回合改为[b](技能效果104专属被动) + -- a[float]b[int] + [277] = function(role, args) + local dot = args[1] + local round=args[2] + local onSkillEffectBefore = function(skill, e, func) + if skill.type == BattleSkillType.Special then + if e.type == 104 then -- 当前只对技能效果104生效 + e.args[1]=dot + e.args[2]=round + if func then func(e) end + end + end + end + 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 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 + 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] + [279] = function(role, args) + local p1=args[1] + local p2=args[2] + local num=args[3] + local ele=args[4] + local p3=args[5] + local ct=args[6] + local v1=args[7] + local r1=args[8] + + 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 and not v:IsDead() end) + if not list or #list ==0 then + return + end + list =BattleUtil.SortByProp(list,BattlePropList[p2],0) + for i = 1, #list do + if i<=num then + local buff=Buff.Create(role, BuffName.PropertyChange,r1,BattlePropList[p3],v1,ct ) + list[i]:AddBuff(buff) + end + end + end) + end + end + role.Event:AddEvent(BattleEventName.SkillCastEnd, OnSkillCastEnd) + end, + --免疫减怒 + [280]=function(role,args) + role.isImmuneReduceRage=true + 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 #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 #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 or 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, + -- 直接伤害击杀目标释放对[a][b]%[c]技能伤害 神女庇佑魂印效果 播放佩戴者的技能动作和特效 + -- a[int 目标选择系数] b[flaot] c[int 伤害类型] + [292] = function(role, args,id,judge) + local targets = args[1] + local f1 = args[2] + local f2=args[3] + local onRoleHit = function(target, damage, bCrit, finalDmg, damageType, skill) + --如果是技能并且这个被动已经被触发过 return + if skill and BattleUtil.ChecklistIsContainValue(skill.triggerPassivityId,id) then + return + end + --处理伏虎觉醒十星附加的额外技能,额外技能不触发这个特性 2020/11/17 wangzhenxing + if skill and skill.type== BattleSkillType.Extra and skill.owner.roleId==10015 and judge==1 then + return + end + if target:IsDead() and not BattleUtil.CheckIsNoDead(target) and not role:IsDead() then + --role:InsertExtraSkill(f1,f2) + local effectData={role.superSkill[1],role.superSkill[2],role.superSkill[3],role.superSkill[4],{targets,{1,f1,f2}}} + SkillManager.InsertSkill(role, effectData,BattleSkillType.Extra, nil, true, false) + if skill then + table.insert(skill.triggerPassivityId,id) + end + end + end + role.Event:AddEvent(BattleEventName.RoleHit, onRoleHit) + end, } return passivityList \ No newline at end of file diff --git a/luafight/Modules/Battle/Logic/BattleLogic.lua b/luafight/Modules/Battle/Logic/BattleLogic.lua index 40b12efd5..699206f41 100644 --- a/luafight/Modules/Battle/Logic/BattleLogic.lua +++ b/luafight/Modules/Battle/Logic/BattleLogic.lua @@ -224,6 +224,8 @@ function BattleLogic.TurnRound(debugTurn) ) -- 轮数变化 BattleLogic.Event:DispatchEvent(BattleEventName.BattleRoundChange, CurRound) + --刷新灵兽buff,回合开始前刷新,如果灵兽技能是在回合后释放,持续1回合,配置的回合数要+1 2020/12/05 by:王振兴 + BattleLogic.BuffMgr:PassMonsterUpdate() -- 开始 BattleLogic.Event:DispatchEvent(BattleEventName.BattleRoundStart, CurRound) diff --git a/luafight/Modules/Battle/Logic/Buff/Shield.lua b/luafight/Modules/Battle/Logic/Buff/Shield.lua index 0dc511779..d621a9955 100644 --- a/luafight/Modules/Battle/Logic/Buff/Shield.lua +++ b/luafight/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/luafight/Modules/Battle/Logic/Misc/BattleDefine.lua b/luafight/Modules/Battle/Logic/Misc/BattleDefine.lua index b502551c3..bb7a2246a 100644 --- a/luafight/Modules/Battle/Logic/Misc/BattleDefine.lua +++ b/luafight/Modules/Battle/Logic/Misc/BattleDefine.lua @@ -127,6 +127,10 @@ BattleEventName = { DebugStop = indexAdd(), --显示提示文字 ShowHintText = indexAdd(), + --角色释放技能之前 + RoleCastSkillBefore = indexAdd(), + --护盾buff消失以后 + ShieldBuffEnd=indexAdd(), } BattleMaxFrame = 1000000 @@ -264,11 +268,12 @@ CurseTypeName = { OutDataName = { - DarkGlowBallNum = 1, - DaNaoTianGongFloor = 2, - PerpleGloryItemNum = 3, - OrangeGloryItemNum = 4, - MisteryLiquidUsedTimes = 5 + DarkGlowBallNum = 1, -- 舍利子数量 + DaNaoTianGongFloor = 2, -- 当前层数 + OrangeGloryItemNum = 3, -- 橙色圣物数量 + RedGloryItemNum = 4, -- 红色圣物数量 + MisteryLiquidUsedTimes = 5, -- 判官笔使用次数 + WinTimes = 6, -- 大闹天宫胜利次数 } BattleUnitType = { diff --git a/luafight/Modules/Battle/Logic/Misc/BattleUtil.lua b/luafight/Modules/Battle/Logic/Misc/BattleUtil.lua index db5088eff..1b9394578 100644 --- a/luafight/Modules/Battle/Logic/Misc/BattleUtil.lua +++ b/luafight/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/luafight/Modules/Battle/Logic/Role/RoleLogic.lua b/luafight/Modules/Battle/Logic/Role/RoleLogic.lua index c3c987033..e7c981213 100644 --- a/luafight/Modules/Battle/Logic/Role/RoleLogic.lua +++ b/luafight/Modules/Battle/Logic/Role/RoleLogic.lua @@ -21,7 +21,6 @@ end function RoleLogic:Init(uid, data, position) data.star = data.star or 1 - self.type = BattleUnitType.Role self.uid = uid self.position = position self.roleData = data @@ -101,6 +100,8 @@ function RoleLogic:Init(uid, data, position) self.reliveHPF = 1 self.IsCanAddSkill = true -- 是否可以追加技能 + + self.type = BattleUnitType.Role end -- 添加一个被动技能 @@ -160,7 +161,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 +174,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 +361,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 +430,10 @@ function RoleLogic:CastSkill(func) if not self:IsAvailable() then return end + --如果当前怒气不足以释放绝技 + if self.Rage= self.SuperSkillRage then -- 释放大技能 diff --git a/luafight/Modules/Battle/Logic/Role/RoleManager.lua b/luafight/Modules/Battle/Logic/Role/RoleManager.lua index e7e2c3b89..00bf59a9e 100644 --- a/luafight/Modules/Battle/Logic/Role/RoleManager.lua +++ b/luafight/Modules/Battle/Logic/Role/RoleManager.lua @@ -154,7 +154,38 @@ function RoleManager.Query(func, inCludeDeadRole) end) return list end - +-- 查找角色(不包含死亡和拥有不灭的) 2020/11/28 王振兴 +function RoleManager.QueryNoDead(func) + local list = {} + local index = 1 + if func then + for pos, v in pairs(PosList) do + if func(v) and 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.NoOrder(func) + local list = {} + local index = 1 + if func then + for pos, v in pairs(PosList) do + if func(v) and not v:IsRealDead() and v.deadFilter then + list[index] = v + index = index + 1 + end + end + end + BattleUtil.RandomList(list) + return list +end --对位规则: 1敌方相同对位 2若死亡或不存在,选取相邻阵位最近且阵位索引最小的 function this.GetAggro(role)