From b1425236afe73dd90b760b55f720bf4c88dff5f5 Mon Sep 17 00:00:00 2001 From: wangzhenxing Date: Wed, 16 Jun 2021 10:27:56 +0800 Subject: [PATCH] =?UTF-8?q?[=E6=88=98=E6=96=97]=3D=3D=3D=3D=3D=3D=3D=3D?= =?UTF-8?q?=E8=A7=89=E9=86=92=E6=8A=80=E8=83=BD=E6=8F=90=E4=BA=A4=EF=BC=8C?= =?UTF-8?q?=E5=9B=B0=E9=9A=BE=E5=89=AF=E6=9C=AC=E6=98=9F=E7=BA=A7=E6=9D=A1?= =?UTF-8?q?=E4=BB=B6=E6=8F=90=E4=BA=A4=EF=BC=8C=E5=85=B3=E5=8D=A1=E8=A2=AB?= =?UTF-8?q?=E5=8A=A8=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 | 9 +- .../Modules/Battle/Logic/Base/Passivity.lua | 580 +++++++++++++++--- .../~Lua/Modules/Battle/Logic/Buff/NoDead.lua | 22 +- .../Battle/Logic/HardStageCondition.lua | 71 ++- .../Battle/Logic/HardStageEventManager.lua | 76 +++ .../Modules/Battle/Logic/Misc/BattleUtil.lua | 10 +- .../Modules/Battle/Test/BattleTestPanel.lua | 4 +- .../Modules/Battle/Test/View/RoleSetView.lua | 10 +- 8 files changed, 701 insertions(+), 81 deletions(-) diff --git a/Assets/ManagedResources/~Lua/Modules/Battle/Logic/Base/Buff.lua b/Assets/ManagedResources/~Lua/Modules/Battle/Logic/Base/Buff.lua index 8859bf7f93..efbe07f68e 100644 --- a/Assets/ManagedResources/~Lua/Modules/Battle/Logic/Base/Buff.lua +++ b/Assets/ManagedResources/~Lua/Modules/Battle/Logic/Base/Buff.lua @@ -243,14 +243,15 @@ function BuffManager:ClearBuff(target, func) local buff = list.buffer[idx] if buff.target == target and (not func or (func and buff.clear and func(buff))) then if func and func(buff) then - if buff.type== BuffName.Shield then + if buff.type== BuffName.Shield then buff.target.Event:DispatchEvent(BattleEventName.ShowHintText, BattleArtFontType.Shield) - elseif buff.type== BuffName.DOT or buff.type==BuffName.Control or buff.type==BuffName.Immune then + elseif buff.type== BuffName.DOT or buff.type==BuffName.Control or buff.type==BuffName.Immune then buff.target.Event:DispatchEvent(BattleEventName.ShowHintText, BattleArtFontType.clear) - end + end end buff:OnEnd() buff.target.Event:DispatchEvent(BattleEventName.BuffEnd, buff) + BattleLogic.Event:DispatchEvent(BattleEventName.BuffEnd, buff) putBuff(buff) list:Remove(idx) else @@ -319,6 +320,7 @@ function BuffManager:Update() buffList:Add(buff) buff:OnStart() buff.target.Event:DispatchEvent(BattleEventName.BuffStart, buff) + BattleLogic.Event:DispatchEvent(BattleEventName.BuffStart, buff) end -- 清除过期buff @@ -331,6 +333,7 @@ function BuffManager:Update() if buff.disperse then buff:OnEnd() buff.target.Event:DispatchEvent(BattleEventName.BuffEnd, buff) + BattleLogic.Event:DispatchEvent(BattleEventName.BuffEnd, buff) putBuff(buff) buffList:Remove(index) else diff --git a/Assets/ManagedResources/~Lua/Modules/Battle/Logic/Base/Passivity.lua b/Assets/ManagedResources/~Lua/Modules/Battle/Logic/Base/Passivity.lua index 1ef8693802..da3d148bdc 100644 --- a/Assets/ManagedResources/~Lua/Modules/Battle/Logic/Base/Passivity.lua +++ b/Assets/ManagedResources/~Lua/Modules/Battle/Logic/Base/Passivity.lua @@ -1019,7 +1019,7 @@ local passivityList = { end role.Event:AddEvent(BattleEventName.RoleHit, OnDamage,nil,nil,role) end, - --造成暴击时,额外造成目标最大生命值[a]%的伤害。(目标最大生命值伤害总上限为施法者2.5倍攻击) + --造成暴击时,额外造成目标最大生命值[a]%的伤害。 --a[float] [56] = function(role, args,id,judge) local f1 = args[1] @@ -1030,9 +1030,9 @@ local passivityList = { if lastTrigger > 1 then --加入限定避免循环触发 return end - local ar1 = BattleUtil.FP_Mul(defRole:GetRoleData(RoleDataName.MaxHp), f1) - local ar2 = BattleUtil.FP_Mul(role:GetRoleData(RoleDataName.Attack), 2.5) - BattleUtil.ApplyDamage(nil, role, defRole, floor(min(ar1, ar2))) + local ar1 = floor(BattleUtil.FP_Mul(defRole:GetRoleData(RoleDataName.MaxHp), f1)) + --local ar2 = BattleUtil.FP_Mul(role:GetRoleData(RoleDataName.Attack), 2.5) + BattleUtil.FinalDamage(nil, role, defRole, ar1) lastTrigger = 0 end role.Event:AddEvent(BattleEventName.RoleCrit, OnRoleCrit,nil,nil,role) @@ -1875,7 +1875,7 @@ local passivityList = { - -- 释放技能后增加友方全体[a]点怒气 + -- 释放技能后增加友方全体[a]点怒气,是否 -- a[int] [105] = function(role, args,id,judge) local i1 = args[1] @@ -2250,16 +2250,20 @@ local passivityList = { role.Event:AddEvent(BattleEventName.RoleBeHit, onBeHit,nil,nil,role) end, - -- 普攻后回复[a]点怒气 - -- a[int] + -- 普攻后回复[a]点怒气,普攻类型为[b](b不填默认为所有普攻) + -- a[int],b[int 1:追加的普攻 ] [121] = function(role, args,id,judge) local i1 = args[1] + local type =args[2] -- 释放技能后 local onSkillEnd = function(skill) if skill and not skill.isTriggerJudge and judge==1 then return end if skill.type == BattleSkillType.Normal then + if type and type==1 and not skill.isAdd then + return + end BattleUtil.CalRage(role, role, i1, CountTypeName.Add) end end @@ -2349,14 +2353,16 @@ local passivityList = { role.Event:AddEvent(BattleEventName.RoleHit, onRoleHit,nil,nil,role) end, - -- 战斗中生命每减少[c]%,[d]就[e]改变[f]% - -- c[float]d[属性]e[改变类型]f[float] + -- 战斗中生命每减少[a]%,[b]就[c]改变[d]%,[e]属性[f]改变[g]% (e f g 不填就不会加) + -- a[float],b[属性],c[改变类型],d[float],e[int],f[int],g[float] [126] = function(role, args) local f1 = args[1] local pro = args[2] local dt = args[3] local f2 = args[4] - + local pro2 = args[5] + local dt2 = args[6] + local f3 = args[7] local curLevel = 0 -- 释放技能后 local onRoleBeDamaged = function(caster, damage) @@ -2369,6 +2375,10 @@ local passivityList = { local buff = Buff.Create(role, BuffName.PropertyChange, 0, BattlePropList[pro], f2, dt) buff.cover = true role:AddBuff(buff) + if pro2 and dt2 and f3 then + local buff = Buff.Create(role, BuffName.PropertyChange, 0, BattlePropList[pro2], f3, dt2) + role:AddBuff(buff) + end end curLevel = level end @@ -3072,23 +3082,30 @@ local passivityList = { role.Event:AddEvent(BattleEventName.RoleHit, onRoleHit,nil,nil,role) end, - -- 释放技能有[a]%概率附加[b]效果持续[c]回合 - -- a[float]b[控制状态]c[int] + -- 释放技能有[a]%概率附加[b]效果持续[c]回合,查找目标条件[d](填技能查找目标逻辑,不填按照技能目标查找) + -- a[float]b[控制状态]c[int],d[int] [152] = function(role, args,id,judge) local f1 = args[1] local ctrl = args[2] local i1 = args[3] - + local con = args[4] -- 技能后后 local onSkillCastEnd = function(skill) if skill and not skill.isTriggerJudge and judge==1 then return end - if skill.type == BattleSkillType.Special then - local targets = skill:GetDirectTargetsNoMiss() - if targets then - for _, r in ipairs(targets) do - BattleUtil.RandomControl(f1, ctrl, role, r, i1) + if skill.type == BattleSkillType.Special or skill.type == BattleSkillType.Extra then + if con then + local arr=BattleUtil.ChooseTarget(role,con) + for i = 1, #arr do + BattleUtil.RandomControl(f1, ctrl, role, arr[i], i1) + end + else + local targets = skill:GetDirectTargetsNoMiss() + if targets then + for _, r in ipairs(targets) do + BattleUtil.RandomControl(f1, ctrl, role, r, i1) + end end end end @@ -3361,7 +3378,6 @@ local passivityList = { end end BattleLogic.Event:AddEvent(BattleEventName.PassiveDamaging, onPassiveDamaging,nil,nil,role) - end, -- 爆伤减免增加[a]%,[b]改变 @@ -3528,7 +3544,7 @@ local passivityList = { end, -- 攻击目标越少[a]对每个目标提升概率越高,提升概率为[b]%除以被击者的总数,提升为[c]改变 - -- a[控制状态]b[float]c[改变类型] + -- a[控制状态],b[float],c[改变类型] [172] = function(role, args,id,judge) local ctrl = args[1] local f1 = args[2] @@ -4193,15 +4209,11 @@ local passivityList = { -- 同阵营武将受到直接伤害时该伤害[a]%转移给有此锦囊的武将转移伤害属于直接伤害(无法触发任何特性) -- a[float] [200] = function(role, args) - if PassiveManager.passiveCountList[role.camp][200] and PassiveManager.passiveCountList[role.camp][200] > 0 then - return + if PassiveManager.passiveCountList[role.camp][200] and PassiveManager.passiveCountList[role.camp][200] > 0 then + return end PassiveManager.passiveCountList[role.camp][200] = 1 local f1 = args[1] - -- if PassiveManager.passiveCountList[role.camp][200] and PassiveManager.passiveCountList[role.camp][200] > 0 then - -- return - -- end - -- PassiveManager.passiveCountList[role.camp][200] = 1 local onFinalDamage = function(damagingFunc, atkRole, defRole, damage, skill, dotType, bCrit, damageType) local ignoreShara=atkRole.ignoreShara --特殊处理 白骨精附加的普攻不会忽略分摊 @@ -5638,7 +5650,7 @@ local passivityList = { role.Event:AddEvent(BattleEventName.PassiveDamaging, onPassiveDamaging,nil,nil,role) end, --本次技能中如果有[a]目标,额外回复[b]点怒气 - -- a[持续伤害状态]b[int] + -- a[持续伤害状态],b[int] [261]=function(role,args,id,judge) local dot=args[1] local i1 = args[2]--defRole, damage, bCrit, finalDmg, damageType, skill @@ -5711,7 +5723,8 @@ local passivityList = { if defRole and defRole.camp~=role.camp and skill.owner==role and (skill.type==BattleSkillType.Special or skill.type==BattleSkillType.Extra) then BattleUtil.RandomAction(pro, function() BattleLogic.BuffMgr:ClearBuff(defRole, function(buff) - if buff.type == BuffName.Immune and (buff.immuneType == 4 or buff.immuneType == 2) then + --之前写的 buff.immuneType == 2 不知道为什么清除免疫燃烧 改成==1 了 by:王振兴 2021/06/09 + if buff.type == BuffName.Immune and (buff.immuneType == 4 or buff.immuneType == 1) then -- buff.target.Event:DispatchEvent(BattleEventName.ShowHintText, BattleArtFontType.clear) return true end @@ -6125,13 +6138,24 @@ local passivityList = { end role.Event:AddEvent(BattleEventName.SkillEffectBefore, onSkillEffectBefore,nil,nil,role) end, - --为己方神将附加的护盾消失后,回复被保护的神将[a][b]%的血量 - --a[int 属性id] b[flaot] + --为己方神将附加的护盾消失后,回复被保护的神将[a][b]%的血量,盾的类型为[c],己方神将为[d]阵营 (不填c,默认为所有盾;不填d,默认所有阵营) + --a[int 属性id] b[flaot] c[int] d[int] [278]=function(role,args) local pro=args[1] local v1=args[2] + local shieldType = args[3] + local ele =args[4] local OnBuffEnd=function(buff) - if buff and not buff.target:IsDead() and buff.caster==role and buff.type==BuffName.Shield then + if buff.caster~=role then + return + end + if ele and buff.target.element~=ele then + return + end + if shieldType and buff and buff.type==BuffName.Shield and buff.shieldType~=shieldType then + return + end + if buff and not buff.target:IsDead() and buff.type==BuffName.Shield then local val = floor(BattleUtil.FP_Mul(v1, buff.target:GetRoleData(BattlePropList[pro]))) BattleUtil.CalTreat(role,buff.target, val) end @@ -6235,13 +6259,17 @@ local passivityList = { end BattleLogic.Event:AddEvent(BattleEventName.BattleRoundChange, OnRoundChange,nil,nil,role) end, - --释放技能后,额外[a]改变[b]方怒气最少的[c]阵营目标[d]点怒气 - --a[int 改变类型],b[int 0:己方 1:敌方],c[int],d[int] + --释放技能后,额外[a]改变[b]方怒气最少的[c]阵营目标[d]点怒气,目标人数[e](e 不填默认为 1人 填10为敌方燃烧数 ) + --a[int 改变类型],b[int 0:己方 1:敌方],c[int],d[int],e[int] [283]=function(role,args,id,judge) local ct=args[1] local camp=args[2] local ele=args[3] local v1=args[4] + local num= args[5] + if not num then + num=1 + end local onSkillCastEnd=function(skill) if skill and not skill.isTriggerJudge and judge==1 then return @@ -6251,13 +6279,28 @@ local passivityList = { 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) + 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 + --查找敌方燃烧数量 + if num==10 then + num=0 + 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) + if aaa then + num=num+1 + end + end + end list=BattleUtil.SortByRage(list,0) - BattleUtil.CalRage(role, list[1], v1, ct) + for i = 1, #list do + if i<=num then + BattleUtil.CalRage(role, list[i], v1, ct) + end + end end end role.Event:AddEvent(BattleEventName.SkillCastEnd, onSkillCastEnd,nil,nil,role) @@ -6583,41 +6626,45 @@ local passivityList = { -- 技能,普攻治疗治疗的目标为[a]阵营,资料量额外提升[b]%,并解除[c]效果 -- a[int], b[flaot], c[持续伤害type类型] [298] = function(role, args,id,judge) - local ele = args[1] - local v1 = args[2] - local type = args[3] - local curSkill = nil - local passiveTreating = function(func,target) - if curSkill and curSkill.isTriggerJudge==false and judge==1 then - return - end - if target and target.roleData.element ==ele then - BattleLogic.BuffMgr:ClearBuff(target, function (buff) - return buff.type == BuffName.DOT and buff.damageType==type - end) - if func then func(v1, CountTypeName.AddPencent) end - end - end - local disposeCtrlNoHeal = function(caster,target) - if caster==role and target.ctrl_noheal and target.roleData.element==ele then - BattleLogic.BuffMgr:ClearBuff(target, function (buff) - return buff.type == BuffName.Control and buff.ctrlType==4 - end) + local ele = args[1] + local v1 = args[2] + local type = args[3] + local curSkill = nil + local passiveTreating = function(func,target) + if curSkill and curSkill.isTriggerJudge==false and judge==1 then + return + end + if target and target.roleData.element ==ele then + if type then + BattleLogic.BuffMgr:ClearBuff(target, function (buff) + return buff.type == BuffName.DOT and buff.damageType==type + end) + end + if func then func(v1, CountTypeName.AddPencent) end + end + end + local disposeCtrlNoHeal = function(caster,target) + if caster==role and target.ctrl_noheal and target.roleData.element==ele then + if type then + BattleLogic.BuffMgr:ClearBuff(target, function (buff) + return buff.type == BuffName.Control and buff.ctrlType==4 + end) end - end - local OnSkillCast = function(skill) - curSkill=skill - role.Event:AddEvent(BattleEventName.PassiveTreatingFactor, passiveTreating,nil,nil,role) - BattleLogic.Event:AddEvent(BattleEventName.DisposeRoleCtrl_noheal,disposeCtrlNoHeal,nil,nil,role) - end - local OnSkillCastEnd = function(skill) - curSkill=nil - role.Event:RemoveEvent(BattleEventName.PassiveTreatingFactor, passiveTreating) - BattleLogic.Event:RemoveEvent(BattleEventName.DisposeRoleCtrl_noheal,disposeCtrlNoHeal) - end - role.Event:AddEvent(BattleEventName.SkillCast, OnSkillCast,nil,nil,role) - role.Event:AddEvent(BattleEventName.SkillCastEnd, OnSkillCastEnd,nil,nil,role) - end, + end + end + local OnSkillCast = function(skill) + curSkill=skill + role.Event:AddEvent(BattleEventName.PassiveTreatingFactor, passiveTreating) + BattleLogic.Event:AddEvent(BattleEventName.DisposeRoleCtrl_noheal,disposeCtrlNoHeal) + end + local OnSkillCastEnd = function(skill) + curSkill=nil + role.Event:RemoveEvent(BattleEventName.PassiveTreatingFactor, passiveTreating) + BattleLogic.Event:RemoveEvent(BattleEventName.DisposeRoleCtrl_noheal,disposeCtrlNoHeal) + end + role.Event:AddEvent(BattleEventName.SkillCast, OnSkillCast) + role.Event:AddEvent(BattleEventName.SkillCastEnd, OnSkillCastEnd) + end, --死亡时,立即回复己方全体自身[a]*[b]的血量。 --a[属性],b[float] @@ -6847,6 +6894,184 @@ local passivityList = { end role.Event:AddEvent(BattleEventName.BuffCaster, OnBuffCaster,nil,nil,role) end, + -- 受到技能伤害时,会为血量属性最低的神将额外回复自身[a]%的[b] + -- 回复a[float] b[int 属性id] + [307] = function(role, args) + local f1 = args[1] + local pro=args[2] + local onBeSkillHit = function(caster, damage, bCrit, finalDmg, damageType, skill) + --如果角色死亡就不会触发 + if role:IsDead() then + return + end + -- if skill and not skill.isTriggerJudge and judge==1 then + -- return + -- end + -- LogYellow("307 1") + if skill and (skill.type==BattleSkillType.Special or skill.type== BattleSkillType.Extra or skill.type== BattleSkillType.Monster) then --技能造成的直接伤害 + local list = RoleManager.Query(function(v) return v.camp == role.camp end) + BattleUtil.SortByHpFactor(list, 1) + -- LogYellow("307 2") + if list[1] then + -- LogYellow("307 3") + local val = floor(BattleUtil.FP_Mul(f1, list[1]:GetRoleData(BattlePropList[pro]))) + BattleUtil.CalTreat(role, list[1], val) + end + end + end + role.Event:AddEvent(BattleEventName.RoleBeHit, onBeSkillHit,nil,nil,role) + end, + -- 普攻后目标附加1个免疫控制的效果[a][b][c](眩晕、沉默、麻痹)的护盾,持续[d]]回合 + -- 免疫控制的效果a[int]b[int]c[int] d[int,回合] + [308] = function(role, args,id,judge) + local ctrl = args[1] + local ctr2 = args[2] + local ctr3 = args[3] + local round = args[4] + local ctrls={} + if ctrl then + table.insert(ctrls,ctrl) + end + if ctr2 then + table.insert(ctrls,ctr2) + end + if ctr3 then + table.insert(ctrls,ctr3) + end + local immune = function(buff) + return buff.type == BuffName.Control and (BattleUtil.ChecklistIsContainValue(ctrls,buff.ctrlType)) + end + -- 释放技能后 + local onSkillEnd = function(skill) + -- if skill and not skill.isTriggerJudge and judge==1 then + -- return + -- end + -- LogYellow("308 1") + if skill.type == BattleSkillType.Normal then + local targets = skill:GetDirectTargetsNoMiss() + -- LogYellow("308 2") + if targets then + -- LogYellow("308 3: "..#targets) + local curBuff=nil + for _, r in ipairs(targets) do + curBuff=Buff.Create(r, BuffName.Immune, round,4,immune) + r:AddBuff(curBuff) + end + end + end + end + role.Event:AddEvent(BattleEventName.SkillCastEnd, onSkillEnd,nil,nil,role) + end, + --释放技能时,如果当前血量最少的神将为[a]系神将,清除控制效果(眩晕、沉默、麻痹、混乱) + --a[int,角色职业] 控制效果b[int]c[int]d[int]e[int] + [309] = function(role, args) + local ele = args[1] + local ctrl = args[2] + local ctr2 = args[3] + local ctr3 = args[4] + local ctr4 = args[5] + local SkillCast = function(damagingFunc, defRole, damage, skill) + local list = RoleManager.Query(function(v) return v.camp == role.camp end) + BattleUtil.SortByHpFactor(list, 1) + local target = nil + -- LogYellow("309 1: "..#list) + for i = 1, #list do + if not list[i]:IsRealDead() then + target = list[i] + break + end + end + if target and target.roleData.element==ele then + -- LogYellow("309 2") + BattleLogic.BuffMgr:ClearBuff(target, function(buff) + -- LogYellow("309 3: "..buff.type.." "..buff.ctrlType) + return buff.type == BuffName.Control and (buff.ctrlType == ctrl or buff.immuneType == ctr2 or buff.immuneType == ctr3 or buff.immuneType == ctr4) + end) + end + end + role.Event:AddEvent(BattleEventName.SkillCast,SkillCast,nil,nil,role) + end, + -- 敌方暴毙时,将会对周围的目标造成[a]%的[b]属性伤害 + -- a[float] b[int,属性id] + [310] = function(role, args,id,judge) + local f1 = args[1] + local pro =args[2] + local onRoleHit = function(target, damage, bCrit, finalDmg) + -- --屏蔽相同阵应 + -- if target and target.camp==role.camp then + -- return + -- end + -- LogYellow("310 1 "..target.position) + if target:IsDead() then + local list = RoleManager.GetNeighbor(target, 1) + if list then + for key, value in pairs(list) do + if value and value ~= target then + -- LogYellow("310 2 周围的目标造成[a]%的[b]属性伤害 value:"..value.position) + local val = floor(BattleUtil.FP_Mul(f1, role:GetRoleData(BattlePropList[pro]))) + -- LogYellow("310 end pro: "..pro.." val: "..val) + BattleUtil.FinalDamage(role, value, val) + end + end + end + end + end + role.Event:AddEvent(BattleEventName.RoleHit, onRoleHit,nil,nil,role) + end, + -- 触发追击技能时,该追击技能的伤害[a]% 提高[b]改变类型 + -- a[float] b[int,改变类型] + [311] = function(role, args) + local f1 = args[1] + local ct = args[2] + local OnPassiveDamaging = function(damagingFunc, defRole, damage, skill) + -- LogYellow("311 1 ") + -- if skill then + -- LogYellow("311 2 "..skill.type.." "..tostring(skill.isAdd)) + -- end + if skill and skill.type == BattleSkillType.Extra and skill.isAdd then + local dd = BattleUtil.CountValue(damage, f1, ct) - damage + -- LogYellow("311 3 end f1: "..f1.." ct: "..ct.." dd "..dd) + damagingFunc(-floor(BattleUtil.ErrorCorrection(dd))) + end + end + role.Event:AddEvent(BattleEventName.PassiveDamaging, OnPassiveDamaging,nil,nil,role) + end, + + -- 敌方处于链接符状态的目标如果受到回怒效果,阎罗王也同时受到回怒效果,每回合回复不超过[a]点怒气。 + -- a[int] + [312] = function(role, args) + local n1 = args[1] + local curRoundAddValue = 0--当前回合加的所有怒气点数 + local onRecordRageChange = function(caster, target, deltaRage,countType,value) + -- LogYellow("312 1") + if countType == CountTypeName.Add then + -- LogYellow("312 2") + local list=BattleLogic.BuffMgr:GetBuff(target) + for i = 1, #list do + local buff=list[i] + -- 有连接符 + if BattleLogic.BuffMgr:HasBuff(target, BuffName.Curse, function(buff) return buff.curseType == CurseTypeName.ShareDamage end) then + -- LogYellow("312 3") + if curRoundAddValue <= n1 then + local endAddNum = value + if (curRoundAddValue + endAddNum) > n1 then + endAddNum = n1 - curRoundAddValue + end + -- LogYellow("312 4 endAddNum: "..endAddNum) + curRoundAddValue = curRoundAddValue + endAddNum + role:AddRage(endAddNum, CountTypeName.Add) + return + end + end + end + end + end + BattleLogic.Event:AddEvent(BattleEventName.RecordRageChange, onRecordRageChange,nil,nil,role) + BattleLogic.Event:AddEvent(BattleEventName.BattleRoundChange, function(curRound) + -- LogYellow("312 5 curRoundAddValue = 0") + curRoundAddValue = 0 + end,nil,nil,role) + end, -- 根据生命百分比添加被动 血量百分比[a],被动id[b],...(后面没有的不配) -- a[float],b[int],c[float],d[int],e[float],f[int],g[float],h[int] [313] = function(role, args,id,judge) @@ -7070,6 +7295,223 @@ local passivityList = { end role.Event:AddEvent(BattleEventName.FinalBeDamageEnd, onFinalBeDamage,nil,nil,role) end, + --技能击杀目标溢出伤害的[a]%将对生命百分比最[b]的 攻击目标造成伤害 + -- a[float],b[int 0:最高 1:最低] + [322]=function(role,args,id,judge) + local f1 = args[1] + local type = args[2] + local point=nil + local allDamage=0 + -- 直接伤害后 + local onRoleHit = function(target, damage, bCrit, finalDmg, damageType, skill) + if skill and not skill.isTriggerJudge and judge==1 then + return + end + if skill and skill.owner==role and (skill.type == BattleSkillType.Special or skill.type==BattleSkillType.Extra) and target:IsDead() and not BattleUtil.CheckIsNoDead(target) then + local dmg= floor(BattleUtil.ErrorCorrection((damage-finalDmg)*f1)) + if target:IsDead() then + allDamage=allDamage+dmg + end + end + end + role.Event:AddEvent(BattleEventName.RoleHit, onRoleHit,nil,nil,role) + + local onSkillCastEnd=function (skill) + if not skill then + return + end + if allDamage>0 then + local list = skill:GetDirectTargets() + list = BattleUtil.SortByHpFactor(list,type) + if list then + for i = 1, #list do + if list[i] and not list[i]:IsDead() then + BattleUtil.FinalDamage(nil,role,list[i],allDamage) + allDamage=0 + break + end + end + end + end + + end + + + role.Event:AddEvent(BattleEventName.SkillCastEnd,onSkillCastEnd,nil,nil,role) + end, + --[a]攻击时,如果目标处于持续伤害[b]状态,则有[c]%的概率使目标[d][e]回合 + --a[int 攻击类型 1:普攻 4:死亡技能] + [323]=function(role,args,id,judge) + local st = args[1] + local dt = args[2] + local p1 = args[3] + local ct = args[4] + local round=args[5] + local onRoleBeDamage=function (defRole, atkRole, damage, bCrit, finalDmg, damageType, dotType, skill) + if atkRole and atkRole~=role then + return + end + if not skill or skill.type~=st then + return + end + 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 + BattleUtil.RandomControl(p1,ct,role,defRole,round) + end + end + BattleLogic.Event:AddEvent(BattleEventName.RoleBeDamaged,onRoleBeDamage,nil,nil,role) + end, + --释放技能怒气不足时,损失自身([a]-我方活着的[b]系神将数)%生命*不足怒气数 后释放技能 + --a[int],b[int] + [324]=function(role,args) + local max=args[1] + local ele=args[2] + local onRoleCastSkillBrfore=function(caster) + if caster~=role then + return + end + --释放者死亡或释放着被沉默 + if caster:IsDead() or caster.ctrl_slient then + return + end + local num=role.SuperSkillRage-role.Rage + local list = RoleManager.Query(function(v) return v.camp == role.camp and v.element==ele and v~=role end) + local curHp=role:GetRoleData(RoleDataName.Hp) + local aaa=(max-#list)/100*num + local removeHp= floor(role:GetRoleData(RoleDataName.MaxHp)*aaa) + --如果血量不足抵扣就只剩1点血 + if removeHp>=curHp then + removeHp=curHp-1 + end + BattleUtil.CalRage(role,role,num,CountTypeName.Add) + BattleUtil.FinalDamage(nil,role,role,removeHp) + end + BattleLogic.Event:AddEvent(BattleEventName.RoleCastSkillBefore, onRoleCastSkillBrfore,nil,nil,role) + end, + -- 被自身控制[a]的敌方目标,己方[b]阵营神将对其造成伤害增加[c]% + -- a[int 控制状态] b[int] c[float] + [325] = function(role, args) + local f1 = args[1] + local ele = args[2] + local f2 = args[3] + + local function onPassiveDamaging(damagingFunc, atkRole, defRole, damage,skill,skilldotType, bCrit,damageType, dotType,isDirect) + --不是真实伤害 + if not skill and not isDirect then + return + end + if atkRole.camp==role.camp and atkRole.element==ele and BattleLogic.BuffMgr:HasBuff(defRole, BuffName.Control, function (buff) return buff.ctrlType == f1 and buff.caster==role end) then + local dd = BattleUtil.CountValue(damage, f2, CountTypeName.AddPencent) - damage + damagingFunc(-floor(BattleUtil.ErrorCorrection(dd))) + end + end + BattleLogic.Event:AddEvent(BattleEventName.PassiveDamaging, onPassiveDamaging,nil,nil,role) + end, + --自身添加的控制[a]结束时,被控制的目标改变[b][c]点怒气 + --a[int], b[int], c[int] + [326]=function(role,args) + local ctrl=args[1] + local ct =args[2] + local num =args[3] + local OnBuffEnd=function(buff) + if buff.caster~=role or buff.type~= BuffName.Control or buff.ctrlType~=ctrl then + return + end + BattleUtil.CalRage(role,buff.target,num,ct) + end + BattleLogic.Event:AddEvent(BattleEventName.BuffEnd, OnBuffEnd,nil,nil,role) + end, + --释放技能后,我方怒气最少的[a]阵营目标行动一回合(释放一次技能) + --a[int] + [327]=function(role,args,id,judge) + local ele=args[1] + + local onSkillCastEnd=function(skill) + if skill and not skill.isTriggerJudge and judge==1 then + return + end + if skill and (skill.type== BattleSkillType.Special or skill.type==BattleSkillType.Extra ) then + local list= RoleManager.Query(function(v) return v.camp == role.camp and v.element==ele end) + if not list or #list ==0 then + return + end + list=BattleUtil.SortByRage(list,0) + list[1]:CastSkill() + end + end + role.Event:AddEvent(BattleEventName.SkillCastEnd, onSkillCastEnd,nil,nil,role) + end, + --[a]排敌人获取无法消除的无敌盾,无敌盾击杀全部另外一排后消失 + --a[int 1:前排 2:后排] + [328]=function(role,args,id,judge) + local pos=args[1] + local buff=nil + --给我方前/后排上无敌盾 + if pos==BattleUtil.GetRolePosType(role.position) then + --无敌盾 + buff=Buff.Create(role, BuffName.Shield, 0, ShieldTypeName.AllReduce, 0, 0) + buff.clear=false + role:AddBuff(buff) + end + + local onBattleRoleDead = function(defRole) + --如果死的是敌方 or 死亡的是有无敌盾的那排 + if defRole.camp~=role.camp or pos==BattleUtil.GetRolePosType(defRole.position) then + return + end + local list = RoleManager.Query(function(v) return v.camp == role.camp and pos~=BattleUtil.GetRolePosType(v.position) end) + BattleLogic.WaitForTrigger(BattleLogic.GameDeltaTime*3, function ()--加个延时,防止击杀的角色复活计算不准确 + if #list>0 then + return + end + if BattleLogic.BuffMgr:HasBuff(role, BuffName.Shield, function(buff1) return buff1==buff end) then + buff.disperse=true + end + end) + end + BattleLogic.Event:AddEvent(BattleEventName.RoleRealDead, onBattleRoleDead,nil,nil,role) + end, + --死亡后有[a]%概率[b]%血量复活,并回复[c]点怒气 + --a[float],b[float],c[int] + [329]=function (role,args,id,judge) + local p1=args[1] + local p2=args[2] + local num=args[3] + local onRoleRealDead = function(deadRole) + --如果死亡的不是自身 + if deadRole~=role then + return + end + BattleUtil.RandomAction(p1, function () + deadRole:SetRelive(p2) + BattleUtil.CalRage(role, role,num,CountTypeName.Add) + end) + end + BattleLogic.Event:AddEvent(BattleEventName.RoleRealDead, onRoleRealDead,nil,nil,role) + end, + --死亡后有[a]%概率随机击杀敌方一个神将 + --a[float] + [330]=function (role,args,id,judge) + local p1=args[1] + local onRoleRealDead = function(deadRole) + --如果死亡的不是自身 + if deadRole~=role then + return + end + BattleUtil.RandomAction(p1, function () + local list = RoleManager.Query(function(r) + return r.camp ~= role.camp + end) + if #list < 1 then return end + local index = Random.RangeInt(1, #list) + local target = list[index] + BattleUtil.Seckill(nil,role,target) + end) + end + BattleLogic.Event:AddEvent(BattleEventName.RoleRealDead, onRoleRealDead,nil,nil,role) + end, } return passivityList \ No newline at end of file diff --git a/Assets/ManagedResources/~Lua/Modules/Battle/Logic/Buff/NoDead.lua b/Assets/ManagedResources/~Lua/Modules/Battle/Logic/Buff/NoDead.lua index 058d3a16ed..40c2c93752 100644 --- a/Assets/ManagedResources/~Lua/Modules/Battle/Logic/Buff/NoDead.lua +++ b/Assets/ManagedResources/~Lua/Modules/Battle/Logic/Buff/NoDead.lua @@ -8,13 +8,24 @@ function NoDead:SetData(...) self.cover = true --控制效果可被覆盖 -- 刷新排序等级 self.sort = 4 + self.recordDamage=0 end -- 伤害降低 function NoDead:onPassiveDamaging(func, target, damage, skill) if skill and skill.type == BattleSkillType.Special then local dd = BattleUtil.CountValue(damage, self.damageFactor, self.factorCT) - damage - if func then func(-math.floor(BattleUtil.ErrorCorrection(dd))) end + if func then + func(-math.floor(BattleUtil.ErrorCorrection(dd))-self.recordDamage) + self.recordDamage=0 + end + end +end + +-- 记录承受伤害 +function NoDead:OnRoleBeHit(atkRole, damage, bCrit, finalDmg, damageType, skill,isDirect) + if skill and (skill.type == BattleSkillType.Special or skill.type==BattleSkillType.Extra ) and atkRole.camp~=self.target.camp then + self.recordDamage=self.recordDamage+math.floor(damage*0.1) end end @@ -22,6 +33,9 @@ end function NoDead:OnStart() -- self.target.Event:AddEvent(BattleEventName.PassiveDamaging, self.onPassiveDamaging, self) + if self.target.star>=11 then + self.target.Event:AddEvent(BattleEventName.RoleBeHit,self.OnRoleBeHit,self) + end self.target:SetDeadFilter(false) self.target:SetReliveFilter(self.isCanRelive) @@ -36,7 +50,11 @@ end --效果结束时调用一次 function NoDead:OnEnd() - self.target.Event:AddEvent(BattleEventName.PassiveDamaging, self.onPassiveDamaging, self) + self.target.Event:RemoveEvent(BattleEventName.PassiveDamaging, self.onPassiveDamaging, self) + if self.target.star>=11 then + self.target.Event:RemoveEvent(BattleEventName.RoleBeHit,self.OnRoleBeHit,self) + end + --self.target.Event self.target:SetDeadFilter(true) -- self.target:SetIsCanAddSkill(false) diff --git a/Assets/ManagedResources/~Lua/Modules/Battle/Logic/HardStageCondition.lua b/Assets/ManagedResources/~Lua/Modules/Battle/Logic/HardStageCondition.lua index b71a0434f4..3a9f864594 100644 --- a/Assets/ManagedResources/~Lua/Modules/Battle/Logic/HardStageCondition.lua +++ b/Assets/ManagedResources/~Lua/Modules/Battle/Logic/HardStageCondition.lua @@ -134,7 +134,76 @@ local _ConditionConfig = { end return 0 end, - + --持续伤害[a]杀死[b]人 + --a[int 0:所有 1:燃烧 2:毒死] + [14]=function(condition) + local v1 = condition[1] + local v2 = condition[2] + local firing,poison=HardStageEventManager.GetDotDieNum() + if v1==0 then + if firing+poison>=v2 then + return 1 + end + end + if v1==1 then + if firing>=v2 then + return 1 + end + elseif v1==2 then + if poison>=v2 then + return 1 + end + end + return 0 + end, + --追击击杀[a]人,击杀[b]号位敌方(填b 就不会判断 a) + --a[int] b[int] + [15]=function(condition) + local v1 = condition[1] + local v2 = condition[2] + local list=HardStageEventManager.GetAddSkillDieList() + if v2 then + local isHave=BattleUtil.ChecklistIsContainValue(list,v2) + if isHave then + return 1 + else + return 0 + end + else + local num=BattleUtil.LengthOfTable(list) + if num>=v1 then + return 1 + end + end + return 0 + end, + --回复血量[a]次 + [16]=function(condition) + local v1=condition[1] + local time=HardStageEventManager.GetAllTreatTime() + if time>=v1 then + return 1 + end + return 0 + end, + --第[a]个击杀敌方[b]号位 + --a[int 0:是最后],b[int] + [17]=function(condition) + local v1=condition[1] + local v2=condition[2] + local list=HardStageEventManager.GetDeadSortList() + local isHave=BattleUtil.ChecklistIsContainValue(list,v2) + if not isHave then + return 0 + end + if v1==0 then + v1=#list + end + if list[v1]==v2 then + return 1 + end + return 0 + end, } diff --git a/Assets/ManagedResources/~Lua/Modules/Battle/Logic/HardStageEventManager.lua b/Assets/ManagedResources/~Lua/Modules/Battle/Logic/HardStageEventManager.lua index b70d8db2e0..fd5b206ee1 100644 --- a/Assets/ManagedResources/~Lua/Modules/Battle/Logic/HardStageEventManager.lua +++ b/Assets/ManagedResources/~Lua/Modules/Battle/Logic/HardStageEventManager.lua @@ -12,18 +12,35 @@ local recordAddKill local seckKillNum=0 --控制次数集合 local ctrlNumList +--毒死的人数 +local poisonDieNum=0 +--烧死的人数 +local firingDieNum=0 +local allTreatTime=0 +--追击技能击杀任务集合 +local addSkillDieList +--死亡顺序集合 +local deadSortList function this.Init() recordRound=1 roundDamage=0 seckKillNum=0 CurRound=0 + poisonDieNum=0 + firingDieNum=0 + allTreatTime=0 recordRoundDamage={} recordAddKill={} ctrlNumList={} + addSkillDieList={} + deadSortList={} BattleLogic.Event:AddEvent(BattleEventName.RecordDamage,this.OnRecordDamage) BattleLogic.Event:AddEvent(BattleEventName.Seckill,this.OnSeckill) BattleLogic.Event:AddEvent(BattleEventName.BuffRoundChange,this.OnRoundChange) BattleLogic.Event:AddEvent(BattleEventName.RecordBuff,this.OnBuffAdd) + BattleLogic.Event:AddEvent(BattleEventName.BattleRoleDead,this.OnRoleDead) + BattleLogic.Event:AddEvent(BattleEventName.BuffStart,this.OnBuffStar) + BattleLogic.Event:AddEvent(BattleEventName.RecordTreat,this.OnRecordTreat) end function this.ClearEvent() @@ -31,6 +48,65 @@ function this.ClearEvent() BattleLogic.Event:RemoveEvent(BattleEventName.Seckill,this.OnSeckill) BattleLogic.Event:RemoveEvent(BattleEventName.BuffRoundChange,this.OnRoundChange) BattleLogic.Event:RemoveEvent(BattleEventName.RecordBuff,this.OnBuffAdd) + BattleLogic.Event:RemoveEvent(BattleEventName.BattleRoleDead,this.OnRoleDead) + BattleLogic.Event:RemoveEvent(BattleEventName.BuffStart,this.OnBuffStar) + BattleLogic.Event:AddEvent(BattleEventName.RecordTreat,this.OnRecordTreat) +end + +--记录治疗 +function this.OnRecordTreat(castRole,targetRole,baseTreat) + if targetRole.camp~=0 then + return + end + allTreatTime=allTreatTime+1 +end + +function this.GetAllTreatTime() + return allTreatTime +end + + +--buff被添加 +function this.OnBuffStar(buff) + if not buff then + return + end + +end + + +--某人死亡 +function this.OnRoleDead(defRole, atkRole,skill,damageType) + if defRole.camp==0 then + return + end + table.insert(deadSortList,defRole.position) + --追击击杀敌方数据 + if skill and skill.isAdd then + table.insert(addSkillDieList,defRole.position) + end + + if defRole.camp==1 and damageType and damageType~=0 then + if damageType==1 then + firingDieNum=firingDieNum+1 + elseif damageType==2 then + poisonDieNum=poisonDieNum+1 + end + end +end + +--获取死亡顺序集合 +function this.GetDeadSortList() + return deadSortList +end +--获取追加技能击杀的敌方集合 +function this.GetAddSkillDieList() + return addSkillDieList +end + +--获取持续伤害死亡的人数 +function this.GetDotDieNum() + return firingDieNum,poisonDieNum end --buff添加成功 diff --git a/Assets/ManagedResources/~Lua/Modules/Battle/Logic/Misc/BattleUtil.lua b/Assets/ManagedResources/~Lua/Modules/Battle/Logic/Misc/BattleUtil.lua index 2516232a67..12e0d19752 100644 --- a/Assets/ManagedResources/~Lua/Modules/Battle/Logic/Misc/BattleUtil.lua +++ b/Assets/ManagedResources/~Lua/Modules/Battle/Logic/Misc/BattleUtil.lua @@ -592,9 +592,9 @@ function BattleUtil.ApplyDamage(skill, atkRole, defRole, damage, bCrit, damageTy local damagingFunc = function(dmgDeduction) damage = damage - dmgDeduction end - atkRole.Event:DispatchEvent(BattleEventName.PassiveDamaging, damagingFunc, defRole, damage, skill, dotType, bCrit) + atkRole.Event:DispatchEvent(BattleEventName.PassiveDamaging, damagingFunc, defRole, damage, skill, dotType, bCrit,damageType, dotType,isDirect) defRole.Event:DispatchEvent(BattleEventName.PassiveBeDamaging, damagingFunc, atkRole, damage, skill, dotType, bCrit) - BattleLogic.Event:DispatchEvent(BattleEventName.PassiveDamaging, damagingFunc, atkRole, defRole, damage, skill, dotType, bCrit) + BattleLogic.Event:DispatchEvent(BattleEventName.PassiveDamaging, damagingFunc, atkRole, defRole, damage, skill, dotType, bCrit,damageType, dotType,isDirect) -- 计算护盾减伤 @@ -627,6 +627,7 @@ function BattleUtil.CalRage(caster, target, value, countType) -- 操作怒气 local deltaRage = target:AddRage(value, countType) + BattleLogic.Event:DispatchEvent(BattleEventName.RecordRageChange, caster, target, deltaRage,countType,value) -- 用于记录统计 BattleLogic.Event:DispatchEvent(BattleEventName.RecordRage, caster, target, deltaRage) end @@ -681,7 +682,7 @@ function BattleUtil.FinalDamage(skill, atkRole, defRole, damage, bCrit, damageTy defRole:SetDead() defRole.Event:DispatchEvent(BattleEventName.RoleDead, atkRole) atkRole.Event:DispatchEvent(BattleEventName.RoleKill, defRole,skill) - BattleLogic.Event:DispatchEvent(BattleEventName.BattleRoleDead, defRole, atkRole,skill) + BattleLogic.Event:DispatchEvent(BattleEventName.BattleRoleDead, defRole, atkRole,skill,dotType) end atkRole.Event:DispatchEvent(BattleEventName.RoleDamage, defRole, damage, bCrit, finalDmg, damageType, dotType, skill) @@ -933,6 +934,9 @@ end --获取table的长度 function BattleUtil.LengthOfTable(table) + if not table then + return 0 + end local length = 0 for i, v in pairs(table) do length = length + 1 diff --git a/Assets/ManagedResources/~Lua/Modules/Battle/Test/BattleTestPanel.lua b/Assets/ManagedResources/~Lua/Modules/Battle/Test/BattleTestPanel.lua index 2eb0a5fb23..1dbc1e09a8 100644 --- a/Assets/ManagedResources/~Lua/Modules/Battle/Test/BattleTestPanel.lua +++ b/Assets/ManagedResources/~Lua/Modules/Battle/Test/BattleTestPanel.lua @@ -305,9 +305,9 @@ function this.RefreshFightData(type) data.element = roleData.PropertyName data.professionId = roleData.Profession data.quality = roleData.Quality - data.star = 10 + data.star = role.star data.skinId=role.skinId - LogError("skinId==="..role.skinId) + --LogError("skinId==="..role.skinId) data.type = 1 data.job=roleData.Job local paskill = string.split(role.passivity, "#") diff --git a/Assets/ManagedResources/~Lua/Modules/Battle/Test/View/RoleSetView.lua b/Assets/ManagedResources/~Lua/Modules/Battle/Test/View/RoleSetView.lua index 95c63a34aa..2f72487f98 100644 --- a/Assets/ManagedResources/~Lua/Modules/Battle/Test/View/RoleSetView.lua +++ b/Assets/ManagedResources/~Lua/Modules/Battle/Test/View/RoleSetView.lua @@ -13,7 +13,8 @@ function RoleSetView:Init(root) self.skin = Util.GetGameObject(root, "skin/input"):GetComponent("InputField") self.skin.text="0" self.superSkill = Util.GetGameObject(root, "superSkill/input"):GetComponent("InputField") - + self.star = Util.GetGameObject(root, "star/input"):GetComponent("InputField") + self.star.text="0" self.props = Util.GetGameObject(root, "props") self.propList = {} for i = 1, self.props.transform.childCount do @@ -56,6 +57,7 @@ function RoleSetView:LoadFromConfig() local skill = config.SkillList[1] or "" local superSkill = config.SkillList[2] or "" local skinId=tonumber(self.skin.text) + local star = tonumber(self.star.text) self.localData = { monsterId, config.MonsterId, -- roleId @@ -78,6 +80,7 @@ function RoleSetView:LoadFromConfig() config.AntiCritDamageFactor, config.TreatFacter, config.CureFacter, + star, } @@ -87,6 +90,7 @@ function RoleSetView:LoadFromConfig() self.skill.text = self:GetLocalData(4) self.superSkill.text = self:GetLocalData(5) self.skin.text = self:GetLocalData(6) + self.star.text = self:GetLocalData(23) for propIndex, prop in ipairs(self.propList) do prop.text = self:GetLocalData(propIndex + 6) end @@ -139,6 +143,7 @@ function RoleSetView:GetLocalData(index) 0, -- 抗暴率 1, -- 治疗系数 1, -- 治愈系数 + 10, } if not self.localData[index] or self.localData[index] == "" then return (defaultData[index] or 0) @@ -162,6 +167,7 @@ function RoleSetView:Show(camp, pos, data, func) self.skill.text = data.skill or self:GetLocalData(4) self.superSkill.text = data.superSkill or self:GetLocalData(5) self.skin.text = data.skinId or self:GetLocalData(6) + self.star.text = data.star or self:GetLocalData(23) for propIndex, prop in ipairs(self.propList) do prop.text = data.props[propIndex] or self:GetLocalData(propIndex + 6) end @@ -175,6 +181,8 @@ function RoleSetView:ApplyData() self.data.skill = tonumber(self.skill.text) self.data.superSkill = tonumber(self.superSkill.text) self.data.skinId=tonumber(self.skin.text) + LogError("star text:"..self.star.text) + self.data.star = tonumber(self.star.text) for propIndex, prop in ipairs(self.propList) do local value = prop.text == "" and 0 or tonumber(prop.text) self.data.props[propIndex] = tonumber(value)