From d00d69ff6830b00bc8c4948e99f0a29a5ff72a1a Mon Sep 17 00:00:00 2001 From: wangzhenxing Date: Fri, 2 Jul 2021 09:56:06 +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=3D=E7=AC=AC=E4=BA=8C=E6=9C=9F=E7=B4=AB=E5=BA=9C=E7=A5=9E?= =?UTF-8?q?=E5=8D=B0=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/Buff.lua | 6 +- .../~Lua/Modules/Battle/Logic/Base/Effect.lua | 16 +- .../Modules/Battle/Logic/Base/Passivity.lua | 273 +++++++++++++----- .../Battle/Logic/Misc/BattleDefine.lua | 3 +- .../Modules/Battle/Logic/Misc/BattleUtil.lua | 10 +- .../Modules/Battle/Logic/Role/RoleLogic.lua | 4 +- .../~Lua/Modules/Battle/Logic/Role/Skill.lua | 2 +- 7 files changed, 234 insertions(+), 80 deletions(-) diff --git a/Assets/ManagedResources/~Lua/Modules/Battle/Logic/Base/Buff.lua b/Assets/ManagedResources/~Lua/Modules/Battle/Logic/Base/Buff.lua index bfb76eb37a..8273577a6a 100644 --- a/Assets/ManagedResources/~Lua/Modules/Battle/Logic/Base/Buff.lua +++ b/Assets/ManagedResources/~Lua/Modules/Battle/Logic/Base/Buff.lua @@ -218,7 +218,11 @@ function BuffManager:GetAllBuffByFunc(checkFunc) end -function BuffManager:HasBuff(target, type, checkFunc) +function BuffManager:HasBuff(target, type, checkFunc,caster,dotType) + --如果当前是判断燃烧buff and 当前目标是攻击的主目标则直接返回true + if type== BuffName.DOT and caster and dotType and dotType==1 and caster.curMainTarget==target then + return true + end if self.buffDic.kvList[type] then local buffList = self.buffDic.kvList[type] for i=1, buffList.size do diff --git a/Assets/ManagedResources/~Lua/Modules/Battle/Logic/Base/Effect.lua b/Assets/ManagedResources/~Lua/Modules/Battle/Logic/Base/Effect.lua index b58f7ff010..3e200bc1f9 100644 --- a/Assets/ManagedResources/~Lua/Modules/Battle/Logic/Base/Effect.lua +++ b/Assets/ManagedResources/~Lua/Modules/Battle/Logic/Base/Effect.lua @@ -391,7 +391,7 @@ local effectList = { local f3 = args[6] BattleLogic.WaitForTrigger(interval, function () BattleUtil.CalDamage(skill, caster, target, dt, f1) - if BattleLogic.BuffMgr:HasBuff(target, BuffName.DOT, function (buff) return dot == 0 or buff.damageType == dot end) then + if BattleLogic.BuffMgr:HasBuff(target, BuffName.DOT, function (buff) return dot == 0 or buff.damageType == dot end,caster,dot) then BattleUtil.RandomControl(f1, ct, caster, target, f3) end end) @@ -404,7 +404,7 @@ local effectList = { local dot = args[3] local f2 = args[4] BattleLogic.WaitForTrigger(interval, function () - if BattleLogic.BuffMgr:HasBuff(target, BuffName.DOT, function (buff) return dot == 0 or buff.damageType == dot end) then + if BattleLogic.BuffMgr:HasBuff(target, BuffName.DOT, function (buff) return dot == 0 or buff.damageType == dot end,caster,dot) then f1 = f1*(1+f2) end BattleUtil.CalDamage(skill, caster, target, dt, f1) @@ -445,7 +445,7 @@ local effectList = { local trigger = function(defRole, damageFunc, damage) if BattleLogic.BuffMgr:HasBuff(target, BuffName.DOT, function (buff) return dot == 0 or buff.damageType == dot - end) then + end,caster,dot) then damage = damage + floor(damage * f1) end damageFunc(damage) @@ -486,7 +486,7 @@ local effectList = { local f2 = args[4] caster.Event:DispatchEvent(BattleEventName.RoleViewBullet, skill, target) BattleLogic.WaitForTrigger(interval, function () - if BattleLogic.BuffMgr:HasBuff(target, BuffName.DOT, function (buff) return dot == 0 or buff.damageType == dot end) then + if BattleLogic.BuffMgr:HasBuff(target, BuffName.DOT, function (buff) return dot == 0 or buff.damageType == dot end,caster,dot) then f1 = f1*(1+f2) end BattleUtil.CalDamage(skill, caster, target, dt, f1) @@ -2027,7 +2027,7 @@ local effectList = { caster.Event:DispatchEvent(BattleEventName.RoleViewBullet, skill, target) BattleLogic.WaitForTrigger(interval, function () local OnPassiveDamaging = function(damagingFunc, defRole, damage) - if BattleLogic.BuffMgr:HasBuff(target, BuffName.DOT, function (buff) return dot == 0 or buff.damageType == dot end) then + if BattleLogic.BuffMgr:HasBuff(target, BuffName.DOT, function (buff) return dot == 0 or buff.damageType == dot end,caster,dot) then if damagingFunc then damagingFunc(-floor(damage * f2)) end @@ -2072,7 +2072,7 @@ local effectList = { caster.Event:DispatchEvent(BattleEventName.RoleViewBullet, skill, target) BattleLogic.WaitForTrigger(interval, function () local isSecKill = false - if BattleLogic.BuffMgr:HasBuff(target, BuffName.DOT, function (buff) return dot == 0 or buff.damageType == dot end) then + if BattleLogic.BuffMgr:HasBuff(target, BuffName.DOT, function (buff) return dot == 0 or buff.damageType == dot end,caster,dot) then -- 检测被动技能对秒杀参数得影响 f2, f3 = BattleUtil.CheckSeckill(f2, f3, caster, target) -- @@ -2204,7 +2204,7 @@ local effectList = { -- caster.Event:DispatchEvent(BattleEventName.RoleViewBullet, skill, target) BattleLogic.WaitForTrigger(interval, function () BattleUtil.CalDamage(skill, caster, target, dt, f1) - if BattleLogic.BuffMgr:HasBuff(target, BuffName.DOT, function (buff) return dot == 0 or buff.damageType == dot end) then + if BattleLogic.BuffMgr:HasBuff(target, BuffName.DOT, function (buff) return dot == 0 or buff.damageType == dot end,caster,dot) then BattleUtil.RandomControl(f2, ct, caster, target, f3) end end) @@ -2220,7 +2220,7 @@ local effectList = { caster.Event:DispatchEvent(BattleEventName.RoleViewBullet, skill, target) BattleLogic.WaitForTrigger(interval, function () local index, tran - if BattleLogic.BuffMgr:HasBuff(target, BuffName.DOT, function(buff) return buff.damageType == dot end) then + if BattleLogic.BuffMgr:HasBuff(target, BuffName.DOT, function(buff) return buff.damageType == dot end,caster,dot) then index, tran = caster:AddPropertyTransfer(RoleDataName.Crit, f2, RoleDataName.Crit, 1) end 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 1bdb4874d0..f006849fb5 100644 --- a/Assets/ManagedResources/~Lua/Modules/Battle/Logic/Base/Passivity.lua +++ b/Assets/ManagedResources/~Lua/Modules/Battle/Logic/Base/Passivity.lua @@ -528,40 +528,28 @@ local passivityList = { role.Event:AddEvent(BattleEventName.BuffCaster, OnBuffCaster,nil,nil,role) end, - --造成的伤害暴击后,[a]%概率恢复[b]点怒气,阵营限制[c](c不填不做限制) + --造成的伤害暴击后,[a]施加攻击*[c]的[d]持续伤害,持续[e]秒。 --a[float],c[float],d[伤害类型],e[int] [26] = function(role, args,id,judge) - local p1 = args[1] - local v1 = args[2] - local ele = args[3] - --被爆击的人数 - local num=0 - local OnRoleCrit = function(defRole, damage, bCrit, finalDmg, damageType, skill) - if ele and ele~=role.element then - return - end - num=num+1 - end - - local onSkillCast = function(skill) - if skill and not skill.isTriggerJudge and judge==1 then - return - end - role.Event:AddEvent(BattleEventName.RoleCrit, OnRoleCrit,nil,nil,role) - end + local f1 = args[1] + local f2 = args[2] + local dt = args[3] + local f3 = args[4] - -- 技能后后 - local onSkillCastEnd = function(skill) - if skill and not skill.isTriggerJudge and judge==1 then + local triggerUid = {} + local OnRoleCrit = function(defRole, damage, bCrit, finalDmg, damageType, skill) + if triggerUid[defRole.uid] then --加入限定避免循环触发 return end - role.Event:RemoveEvent(BattleEventName.RoleCrit, OnRoleCrit,nil,nil,role) - BattleUtil.RandomAction(p1*num,function() - BattleUtil.CalRage(role, role,v1, CountTypeName.Add) + BattleUtil.RandomAction(f1, function () + defRole:AddBuff(Buff.Create(role, BuffName.DOT, f3, 1, 0, dt, f2)) + triggerUid[defRole.uid] = defRole.uid + BattleLogic.WaitForTrigger(f3+1, function () + triggerUid[defRole.uid] = nil + end) end) end - role.Event:AddEvent(BattleEventName.SkillCast, onSkillCast,nil,nil,role) - role.Event:AddEvent(BattleEventName.SkillCastEnd, onSkillCastEnd,nil,nil,role) + role.Event:AddEvent(BattleEventName.RoleCrit, OnRoleCrit,nil,nil,role) end, --造成的伤害暴击后,[a]的概率回复自身[b]*[c]的血量 @@ -1931,28 +1919,34 @@ local passivityList = { role.Event:AddEvent(BattleEventName.RoleBeHit, onBeHit,nil,nil,role) end, - -- 释放技能后自身回[a]点怒气,回怒概率[b]%(不填为100%),阵营限制为[c](不填不限制阵营) - -- a[int],b[float],c[int 阵营id] + -- 释放技能后自身回[a]点怒气,回怒概率[b]%(不填为100%),阵营限制为[c](不填/填0为不限制阵营),[d]为技能类型(不填默认只有绝技) + -- a[int],b[float],c[int 阵营id],d[int 1:绝技.额外技能 ] [107] = function(role, args,id,judge) local i1 = args[1] local p1 = args[2] local ele= args[3] + local type=args[4] if not p1 then p1=1 end + -- 释放技能后 local onSkillEnd = function(skill) if skill and not skill.isTriggerJudge and judge==1 then return end - if ele and role.element~=ele then + if ele and ele~=0 and role.element~=ele then + return + end + if not type and skill.type~= BattleSkillType.Special then + return + end + if type==1 and skill.type~=BattleSkillType.Special and skill.type~=BattleSkillType.Extra then return end - if skill.type == BattleSkillType.Special then BattleUtil.RandomAction(p1, function () BattleUtil.CalRage(role, role, i1, CountTypeName.Add) end) - end end role.Event:AddEvent(BattleEventName.SkillCastEnd, onSkillEnd,nil,nil,role) end, @@ -2504,7 +2498,7 @@ local passivityList = { end end end - BattleLogic.Event:AddEvent(BattleEventName.BattleRoleDead, OnDead,nil,nil,role) + BattleLogic.Event:AddEvent(BattleEventName.RoleRealDead, OnDead,nil,nil,role) -- local passivityDamaging = function(func, caster, damage, skill) -- if skill and not skill.isTriggerJudge and judge==1 then @@ -2584,7 +2578,7 @@ local passivityList = { local index, tran local OnRoleDamageBefore = function(target,factorFunc,damageType,skill) - if BattleLogic.BuffMgr:HasBuff(target, BuffName.DOT, function(buff) return buff.damageType == dot end) then + if BattleLogic.BuffMgr:HasBuff(target, BuffName.DOT, function(buff) return buff.damageType == dot end,role,dot) then index, tran = role:AddPropertyTransfer(BattlePropList[pro], f1, BattlePropList[pro], ct) end end @@ -2765,7 +2759,7 @@ local passivityList = { local f1 = args[3] local onPassiveBeDamaging = function(func, caster, damage) - if BattleLogic.BuffMgr:HasBuff(caster, BuffName.DOT, function(buff) return buff.damageType == dot end) then + if BattleLogic.BuffMgr:HasBuff(caster, BuffName.DOT, function(buff) return buff.damageType == dot end,role,dot) then local dmgDeduction = damage - floor(BattleUtil.ErrorCorrection(BattleUtil.CountValue(damage, f1, ct))) if func then func(dmgDeduction) end end @@ -2808,7 +2802,7 @@ local passivityList = { if not skill then return end - if BattleLogic.BuffMgr:HasBuff(target, BuffName.DOT, function(buff) return buff.damageType == dot end) then + if BattleLogic.BuffMgr:HasBuff(target, BuffName.DOT, function(buff) return buff.damageType == dot end,role,dot) then --吸血修改 finaldamage 改为 damage by:往王振兴 2020/08/17 BattleUtil.ApplyTreat(role, role, floor(BattleUtil.ErrorCorrection(damage * f1))) end @@ -2845,7 +2839,7 @@ local passivityList = { local onSkillControl = function(func, ctrl2, target) if ctrl2 == ctrl then - if BattleLogic.BuffMgr:HasBuff(target, BuffName.DOT, function(b) return b.damageType == dot end) then + if BattleLogic.BuffMgr:HasBuff(target, BuffName.DOT, function(b) return b.damageType == dot end,role,dot) then if func then func(f1, ct) end end end @@ -2900,7 +2894,7 @@ local passivityList = { return end if skill and skill.type == BattleSkillType.Special and - BattleLogic.BuffMgr:HasBuff(target, BuffName.DOT, function(buff) return buff.damageType == dot end) then + BattleLogic.BuffMgr:HasBuff(target, BuffName.DOT, function(buff) return buff.damageType == dot end,role,dot) then index, tran = role:AddPropertyTransfer(BattlePropList[pro], f1, BattlePropList[pro], ct) end end @@ -2924,7 +2918,7 @@ local passivityList = { local ct = args[3] local onPassiveDamaging = function(damagingFunc, defRole, damage) - if BattleLogic.BuffMgr:HasBuff(defRole, BuffName.DOT, function(buff) return buff.damageType == dot end) then + if BattleLogic.BuffMgr:HasBuff(defRole, BuffName.DOT, function(buff) return buff.damageType == dot end,role,dot) then if damagingFunc then local dd = BattleUtil.CountValue(damage, f1, ct) - damage damagingFunc(-floor(BattleUtil.ErrorCorrection(dd))) @@ -2988,7 +2982,7 @@ local passivityList = { role.Event:RemoveEvent(BattleEventName.RoleHit, onHit) end local onDamaging = function(func, target,damage,skill) - if BattleLogic.BuffMgr:HasBuff(target, BuffName.DOT, function(buff) return buff.damageType == dot end) then + if BattleLogic.BuffMgr:HasBuff(target, BuffName.DOT, function(buff) return buff.damageType == dot end,role,dot) then role.Event:AddEvent(BattleEventName.RoleHit, onHit,nil,nil,role) end end @@ -3024,7 +3018,7 @@ local passivityList = { end if attor[target.position] and skill and skill.type == BattleSkillType.Special and func then local df = f1 - if BattleLogic.BuffMgr:HasBuff(target, BuffName.DOT, function(buff) return buff.damageType == dot end) then + if BattleLogic.BuffMgr:HasBuff(target, BuffName.DOT, function(buff) return buff.damageType == dot end,role,dot) then df = f2 end local dd = BattleUtil.CountValue(damage, df, ct) - damage @@ -3043,7 +3037,7 @@ local passivityList = { local ct = args[3] local onPassiveDamaging = function(damagingFunc, defRole, damage) - if BattleLogic.BuffMgr:HasBuff(defRole, BuffName.DOT, function(buff) return buff.damageType == dot end) then + if BattleLogic.BuffMgr:HasBuff(defRole, BuffName.DOT, function(buff) return buff.damageType == dot end,role,dot) then if damagingFunc then local dd = BattleUtil.CountValue(damage, f1, ct) - damage damagingFunc(-floor(BattleUtil.ErrorCorrection(dd))) @@ -3080,7 +3074,7 @@ local passivityList = { -- local onRoleHit = function(defRole, damage, bCrit, finalDmg, damageType, skill) if skill and skill.type == BattleSkillType.Normal and not defRole:IsDead() then - if BattleLogic.BuffMgr:HasBuff(defRole, BuffName.DOT, function (buff) return dot == 0 or buff.damageType == dot end) then + if BattleLogic.BuffMgr:HasBuff(defRole, BuffName.DOT, function (buff) return dot == 0 or buff.damageType == dot end,role,dot) then local isBoss=BattleUtil.CheckIsBoss(defRole) if isBoss then return @@ -3444,7 +3438,7 @@ local passivityList = { local dot = args[1] local f1 = args[2] local onHit = function(target, damage, bCrit, finalDmg) - if BattleLogic.BuffMgr:HasBuff(target, BuffName.DOT, function(buff) return buff.damageType == dot end) then + if BattleLogic.BuffMgr:HasBuff(target, BuffName.DOT, function(buff) return buff.damageType == dot end,role,dot) then --吸血修改 finaldamage 改为 damage by:往王振兴 2020/08/17 BattleUtil.ApplyTreat(role, role, floor(BattleUtil.ErrorCorrection(damage * f1))) end @@ -4002,12 +3996,15 @@ local passivityList = { end role.Event:AddEvent(BattleEventName.RoleHit, onHit,nil,nil,role) end, - -- 武将怒气小于[a]点时不会释放技能,释放技能消耗当前所有怒气超过4怒气部分每额外消耗1点怒气技能伤害增加[b]% + -- 武将怒气小于[a]点时不会释放技能,释放技能消耗当前所有 怒气超过[c]怒气部分每额外消耗1点怒气技能伤害增加[b]%(c不填默认为4) -- a[int]b[float] [192] = function(role, args) local i1 = args[1] local f1 = args[2] - + local num = args[3] + if not num then + num=4 + end -- 提高技能释放怒气值 role.SuperSkillRage = i1 @@ -4026,9 +4023,10 @@ local passivityList = { -- 释放技能后 local onPassiveDamaging = function(damagingFunc, defRole, damage, skill, dotType) if skill and skill.type == BattleSkillType.Special then - local deltaRage = allRage - 4 + local deltaRage = allRage - num if deltaRage > 0 then local dd = BattleUtil.CountValue(damage, f1 * deltaRage, 2) - damage + LogError(" add damage=="..dd.."dddelta rage=="..deltaRage) damagingFunc(-floor(BattleUtil.ErrorCorrection(dd))) end end @@ -4272,8 +4270,7 @@ local passivityList = { [201] = function(role, args) local i1 = args[1] local f1 = args[2] - role:AddRage(i1, CountTypeName.Add) - + BattleUtil.CalRage(role,role,i1,CountTypeName.Add) local function onPassiveSeckill(func) local isBoss=BattleUtil.CheckIsBoss(defRole) if isBoss then @@ -4302,7 +4299,7 @@ local passivityList = { -- 直接伤害概率无法复活 local function onRoleHit(target,damage,bCrit,finalDmg,damageType,skill) if target:IsDead() then - if not BattleLogic.BuffMgr:HasBuff(role, BuffName.DOT, function (buff) return buff.damageType == dot or dot == 0 end) then + if not BattleLogic.BuffMgr:HasBuff(role, BuffName.DOT, function (buff) return buff.damageType == dot or dot == 0 end,role,dot) then BattleUtil.RandomAction(f2, function() target:SetReliveFilter(false) end) @@ -4328,8 +4325,7 @@ local passivityList = { local f1 = args[2] local i2 = args[3] -- 初始怒气增加 - role:AddRage(i1, CountTypeName.Add) - + BattleUtil.CalRage(role,role,i1,CountTypeName.Add) -- 死亡数量 local onRoleTurnEnd = function(target) if not target:IsDead() and BattleLogic.BuffMgr:HasBuff(target, BuffName.Curse, function(buff) return buff.curseType == CurseTypeName.ShareDamage end) then @@ -5434,7 +5430,7 @@ local passivityList = { role.Event:RemoveEvent(BattleEventName.RoleHit, onHit) end local onDamaging = function(func, target) - if BattleLogic.BuffMgr:HasBuff(target, BuffName.DOT, function(buff) return buff.damageType == dot end) then + if BattleLogic.BuffMgr:HasBuff(target, BuffName.DOT, function(buff) return buff.damageType == dot end,role,dot) then role.Event:AddEvent(BattleEventName.RoleHit, onHit,nil,nil,role) end end @@ -5686,7 +5682,7 @@ local passivityList = { end local num=0 for key, value in pairs(list) do - local isHave=BattleLogic.BuffMgr:HasBuff(value, BuffName.DOT, function(buff) return buff.damageType == dot and buff.caster==role and buff.startRound == BattleLogic.GetCurRound() end) + local isHave=BattleLogic.BuffMgr:HasBuff(value, BuffName.DOT, function(buff) return buff.damageType == dot and buff.caster==role and buff.startRound == BattleLogic.GetCurRound() end,role,dot) if isHave then num=num+1 end @@ -5788,7 +5784,7 @@ local passivityList = { -- table.insert(list,defRole) for i=1, #list do --如果目标身上没有灼烧效果 - if not BattleLogic.BuffMgr:HasBuff(list[i], BuffName.DOT, function (buff) return buff.type== BuffName.DOT and buff.damageType==state1 end) then + if not BattleLogic.BuffMgr:HasBuff(list[i], BuffName.DOT, function (buff) return buff.type== BuffName.DOT and buff.damageType==state1 end,role,state1) then local damage = BattleUtil.ErrorCorrection(v1 * role:GetRoleData(BattlePropList[pro1])) BattleUtil.RandomDot(1, state2, role, list[i], time, 1, floor(damage)) end @@ -5902,7 +5898,7 @@ local passivityList = { local curBuff=nil 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 + if atkRole.camp~= role.camp and BattleLogic.BuffMgr:HasBuff(skill.owner, BuffName.DOT, function (buff) return buff.damageType == sta1 end,role,sta1) then --curBuff=Buff.Create(role, BuffName.Immune, 1,4,immune) -- role:AddBuff(curBuff) role.buffFilter:Add(immune) @@ -5956,7 +5952,7 @@ local passivityList = { 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 + if BattleLogic.BuffMgr:HasBuff(caster, BuffName.DOT, function(buff) return buff.damageType == dot end,role,dot) then BattleUtil.CalRage(role, role, f1, ct) end end @@ -5997,7 +5993,7 @@ local passivityList = { 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 + if BattleLogic.BuffMgr:HasBuff(target, BuffName.DOT, function(buff) return buff.damageType == dot end,role,dot) then local list = RoleManager.GetNeighbor(role, 1) if list then for key, value in pairs(list) do @@ -6045,7 +6041,7 @@ local passivityList = { 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 + if atkRole.camp~= role.camp and BattleLogic.BuffMgr:HasBuff(skill.owner, BuffName.DOT, function (buff) return buff.damageType == sta1 end,role,sta1) then --curBuff=Buff.Create(role, BuffName.Immune, 1,4,immune) -- role:AddBuff(curBuff) role.buffFilter:Add(immune) @@ -6237,7 +6233,7 @@ local passivityList = { if num>=0 then --精卫转移怒气不算减怒 role.Rage=role.Rage-lessRage - caster:AddRage(lessRage, CountTypeName.Add) + BattleUtil.CalRage(role,caster,lessRage,CountTypeName.Add) -- 用于记录统计 BattleLogic.Event:DispatchEvent(BattleEventName.RecordTransRage, role, caster, lessRage) end @@ -6308,7 +6304,7 @@ local passivityList = { local arr=skill:GetDirectTargets() -- local arr=RoleManager.Query(function (v) return v.camp~=role.camp end) for i = 1, #arr do - local aaa=BattleLogic.BuffMgr:HasBuff(arr[i], BuffName.DOT, function (buff) return buff.damageType==1 end) + local aaa=BattleLogic.BuffMgr:HasBuff(arr[i], BuffName.DOT, function (buff) return buff.damageType==1 end,role,1) if aaa then num=num+1 end @@ -6608,7 +6604,7 @@ local passivityList = { local onRoundChange=function() if aa>=time then local ange= floor(aa/time) - role:AddRage(ange*num, CountTypeName.Add) + BattleUtil.CalRage(role,role,ange*num,CountTypeName.Add) aa=0 end end @@ -6634,7 +6630,7 @@ local passivityList = { end end if isHave then - role:AddRage(num, CountTypeName.Add) + BattleUtil.CalRage(role,role,num,CountTypeName.Add) end end end @@ -7078,7 +7074,7 @@ local passivityList = { end -- LogYellow("312 4 endAddNum: "..endAddNum) curRoundAddValue = curRoundAddValue + endAddNum - role:AddRage(endAddNum, CountTypeName.Add) + BattleUtil.CalRage(role,role,endAddNum,CountTypeName.Add) return end end @@ -7376,7 +7372,7 @@ local passivityList = { if skill and not skill.isTriggerJudge and judge==1 then return end - if BattleLogic.BuffMgr:HasBuff(defRole, BuffName.DOT, function(buff) return buff.damageType == dt end) then + if BattleLogic.BuffMgr:HasBuff(defRole, BuffName.DOT, function(buff) return buff.damageType == dt end,role,dt) then BattleUtil.RandomControl(p1,ct,role,defRole,round) end end @@ -7551,6 +7547,153 @@ local passivityList = { end BattleLogic.Event:AddEvent(BattleEventName.RoleTurnStart, onRoleRealDead,nil,nil,role) end, + --技能击中受到[a,持续伤害]的目标,会有[b]%概率[c]改变[d]点怒气(概率随人数增加),阵营限制为[e]阵营(e不填则没有限制) + -- a[int 持续伤害],b[float],c[int],d[int],e[int] + [332]=function(role,args,id,judge) + local dot=args[1] + local p1 = args[2] + local ct=args[3] + local num=args[4] + local ele=args[5] + local burnList={} + local OnRoleHit = function(skill) + if skill and not skill.isTriggerJudge and judge==1 then + return + end + if not skill then + return + end + if ele and ele~=role.element then + return + end + local list=skill:GetDirectTargetsNoMiss() + if not list then + return + end + for key, value in pairs(list) do + local isHave=BattleLogic.BuffMgr:HasBuff(value, BuffName.DOT, function(buff) return buff.damageType == dot and buff.caster==role end,role,dot) + if isHave then + if not BattleUtil.ChecklistIsContainValue(burnList,value.position) then + table.insert(burnList,value.position) + end + end + end + LogError("list len=="..#list.." len=="..#burnList ) + BattleUtil.RandomAction(p1*#burnList,function() + BattleUtil.CalRage(role,role,num,ct) + end) + burnList={} + end + local onSkillCast=function(skill,defRole) + if skill and not skill.isTriggerJudge and judge==1 then + return + end + if not skill then + return + end + LogError("111111111111") + if not BattleUtil.ChecklistIsContainValue(burnList,defRole.position) then + table.insert(burnList,defRole.position) + end + end + role.Event:AddEvent(BattleEventName.HitRoleInBurn,onSkillCast,nil,nil,role) + role.Event:AddEvent(BattleEventName.SkillCastEnd, OnRoleHit,nil,nil,role) + end, + --技能攻击使目标怒气清零时,[a]%概率恢复[b]点怒气(概率随人数增加),阵营限制[c](c不填不做限制) + --a[float],c[float],d[伤害类型],e[int] + [333] = function(role, args,id,judge) + local p1 = args[1] + local v1 = args[2] + local ele = args[3] + --被爆击的人数 + local count=0 + + local OnRoleCrit = function(caster, target, deltaRage,countType,value,lastRage) + if ele and ele~=role.element then + return + end + if target.camp==role.camp then + return + end + if countType==CountTypeName.Sub and target.Rage==0 and lastRage~=0 then + count=count+1 + end + end + + -- 技能后后 + local onSkillCastEnd = function(skill) + if skill and not skill.isTriggerJudge and judge==1 then + return + end + if skill.owner~=role then + return + end + BattleUtil.RandomAction(p1*count,function() + BattleUtil.CalRage(role, role,v1, CountTypeName.Add) + end) + end + + local onSkillCast = function(skill) + count=0 + end + role.Event:AddEvent(BattleEventName.SkillCast, onSkillCast,nil,nil,role) + BattleLogic.Event:AddEvent(BattleEventName.RecordRageChange, OnRoleCrit,nil,nil,role) + BattleLogic.Event:AddEvent(BattleEventName.SkillCastEnd, onSkillCastEnd,nil,nil,role) + end, + + --获取当前技能的主目标 + [334]=function(role, args,id,judge) + local onSkillCast = function(skill) + if not skill then + return + end + if skill and not skill.isTriggerJudge and judge==1 then + return + end + local list=skill:GetDirectTargets() + local target=RoleManager.GetAggroHero(role,list) + if target and BattleUtil.LengthOfTable(target)>0 then + LogError("target=="..target[1].position) + role.curMainTarget=target[1] + end + end + role.Event:AddEvent(BattleEventName.SkillCastBefore, onSkillCast,nil,nil,role) + end, + --造成的伤害暴击后,[a]%概率恢复[b]点怒气,阵营限制[c](c不填不做限制) + --a[float],b[int],c[int] + [335] = function(role, args,id,judge) + local p1 = args[1] + local v1 = args[2] + local ele = args[3] + --被爆击的人数 + local num=0 + local OnRoleCrit = function(defRole, damage, bCrit, finalDmg, damageType, skill) + if ele and ele~=role.element then + return + end + num=num+1 + end + + local onSkillCast = function(skill) + if skill and not skill.isTriggerJudge and judge==1 then + return + end + role.Event:AddEvent(BattleEventName.RoleCrit, OnRoleCrit,nil,nil,role) + end + + -- 技能后后 + local onSkillCastEnd = function(skill) + if skill and not skill.isTriggerJudge and judge==1 then + return + end + role.Event:RemoveEvent(BattleEventName.RoleCrit, OnRoleCrit,nil,nil,role) + BattleUtil.RandomAction(p1*num,function() + BattleUtil.CalRage(role, role,v1, CountTypeName.Add) + end) + end + role.Event:AddEvent(BattleEventName.SkillCast, onSkillCast,nil,nil,role) + role.Event:AddEvent(BattleEventName.SkillCastEnd, onSkillCastEnd,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 84591d2f0c..7127593274 100644 --- a/Assets/ManagedResources/~Lua/Modules/Battle/Logic/Misc/BattleDefine.lua +++ b/Assets/ManagedResources/~Lua/Modules/Battle/Logic/Misc/BattleDefine.lua @@ -81,7 +81,7 @@ BattleEventName = { BeHitMiss = indexAdd(), CritDamageReduceFactor = indexAdd(), -- 暴击伤害减免系数 - + SkillCastBefore = indexAdd(), -- 技能攻击前再往前 SkillCast = indexAdd(), -- 技能攻击前 SkillCastEnd = indexAdd(), -- 技能攻击结束 BeSkillCast = indexAdd(), -- 被技能攻击前 @@ -169,6 +169,7 @@ BattleEventName = { RoleAddBuffFail = indexAdd(),--角色添加buff失败 RecordRageChange = indexAdd(), -- 怒气改变时 ActionOperateAngerAfter =indexAdd(),--角色行动操作怒气后 + HitRoleInBurn = 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 12e0d19752..a434289bd3 100644 --- a/Assets/ManagedResources/~Lua/Modules/Battle/Logic/Misc/BattleUtil.lua +++ b/Assets/ManagedResources/~Lua/Modules/Battle/Logic/Misc/BattleUtil.lua @@ -327,7 +327,7 @@ function BattleUtil.ChooseTarget(role, chooseId) elseif chooseLimit == 4 then -- 处于灼烧状态 local tempArr = {} for i = 1, #arr do - if BattleLogic.BuffMgr:HasBuff(arr[i], BuffName.DOT, function (buff) return buff.damageType == DotType.Burn end) then + if BattleLogic.BuffMgr:HasBuff(arr[i], BuffName.DOT, function (buff) return buff.damageType == DotType.Burn end,role,1) then table.insert(tempArr, arr[i]) end end @@ -624,10 +624,10 @@ function BattleUtil.CalRage(caster, target, value, countType) then return end - + local lastRage=target.Rage -- 操作怒气 local deltaRage = target:AddRage(value, countType) - BattleLogic.Event:DispatchEvent(BattleEventName.RecordRageChange, caster, target, deltaRage,countType,value) + BattleLogic.Event:DispatchEvent(BattleEventName.RecordRageChange, caster, target, deltaRage,countType,value,lastRage) -- 用于记录统计 BattleLogic.Event:DispatchEvent(BattleEventName.RecordRage, caster, target, deltaRage) end @@ -696,6 +696,10 @@ function BattleUtil.FinalDamage(skill, atkRole, defRole, damage, bCrit, damageTy if skill then atkRole.Event:DispatchEvent(BattleEventName.RoleHit, defRole, damage, bCrit, finalDmg, damageType, skill,isDirect) defRole.Event:DispatchEvent(BattleEventName.RoleBeHit, atkRole, damage, bCrit, finalDmg, damageType, skill,isDirect) + --如果目标是主燃烧目标 or 目标身上有燃烧效果 + if atkRole.curMainTarget==defRole or BattleLogic.BuffMgr:HasBuff(defRole, BuffName.DOT,function(buff) return buff.damageType == 1 end) then + atkRole.Event:DispatchEvent(BattleEventName.HitRoleInBurn,skill,defRole) + end end --如果不是技能带的伤害,并且是直接伤害就,,,,, --用于处理不触发特性并且是直接伤害的伤害 isDirect 暂时先为bool值,后期可根据需求做修改扩展 by:王振兴 2020/10/12 16:18 diff --git a/Assets/ManagedResources/~Lua/Modules/Battle/Logic/Role/RoleLogic.lua b/Assets/ManagedResources/~Lua/Modules/Battle/Logic/Role/RoleLogic.lua index 71bb5ed3c9..2698cb66e9 100644 --- a/Assets/ManagedResources/~Lua/Modules/Battle/Logic/Role/RoleLogic.lua +++ b/Assets/ManagedResources/~Lua/Modules/Battle/Logic/Role/RoleLogic.lua @@ -83,6 +83,7 @@ function RoleLogic:Init(uid, data, position) self.ignoreShara = false --忽略敌方分摊 self.type = BattleUnitType.Role self.isNormalAttackAddRage=true --普攻是否回复怒气 + self.curMainTarget=nil --当前主目标 self.passiveList = {} if data.passivity and #data.passivity > 0 then table.sort(data.passivity,function(a,b)return a[1] < b[1] end) @@ -214,7 +215,7 @@ function RoleLogic:AddRage(value, type) elseif type == 4 then --乘减算(百分比属性减算) delta = -floor(value * self.SuperSkillRage) end - self.Event:DispatchEvent(BattleEventName.RoleRageChange, delta) + self.Event:DispatchEvent(BattleEventName.RoleRageChange, delta,self.Rage) --怒气值不可为负值 self.Rage = max(self.Rage + delta, 0) @@ -545,6 +546,7 @@ function RoleLogic:GoDead() if self:IsCanDead() then self.isRealDead = true self.Rage = 0 + self.curMainTarget=nil BattleLogic.BuffMgr:ClearBuff(self) self.Event:DispatchEvent(BattleEventName.RoleRealDead, self) BattleLogic.Event:DispatchEvent(BattleEventName.RoleRealDead, self) diff --git a/Assets/ManagedResources/~Lua/Modules/Battle/Logic/Role/Skill.lua b/Assets/ManagedResources/~Lua/Modules/Battle/Logic/Role/Skill.lua index 641b0233fa..3976f4d9c4 100644 --- a/Assets/ManagedResources/~Lua/Modules/Battle/Logic/Role/Skill.lua +++ b/Assets/ManagedResources/~Lua/Modules/Battle/Logic/Role/Skill.lua @@ -76,7 +76,7 @@ function Skill:Cast(func) --end self.effectCaster:Cast() end - + self.owner.Event:DispatchEvent(BattleEventName.SkillCastBefore, self) -- 释放技能开始 self.owner.Event:DispatchEvent(BattleEventName.SkillCast, self) BattleLogic.Event:DispatchEvent(BattleEventName.SkillCast, self)