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..a1525113f 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) @@ -2282,7 +2287,88 @@ local effectList = { end) end, - + --造成[a]%的[b]伤害,目标每减少[c]个伤害提升[d]%,并有[e]%概率附加[f]控制状态,持续[g]回合;魂印添加控制概率[h]%, 减员添加控制概率[i]%,伤害添加[j]% + --a[float],b[伤害类型],c[int],d[float] + [120] = function(caster, target, args, interval, skill) + local f1 = args[1] + local dt = args[2] + local i1 = args[3] + local f2 = args[4] + local p1 = args[5] + local ctrl =args[6] + local r1 = args[7] + --魂印增加 + local v1 = args[8] + local v2 = args[9] + local v3 = args[10] + -- 改变值 = 技能最大目标数 - 当前目标数 + local maxNum = skill:GetMaxTargetNum() + local curNum = #skill:GetDirectTargets() + local lessNum = max(maxNum - curNum, 0) + local level = math.floor(lessNum/i1) + local pro1=p1+v1+level*v2 + f1=f1+level*f2+level*v3 + caster.Event:DispatchEvent(BattleEventName.RoleViewBullet, skill, target) + BattleLogic.WaitForTrigger(interval, function () + BattleUtil.CalDamage(skill, caster, target, dt, f1) + --伤害命中才会给目标上buff + if skill and skill:CheckTargetIsHit(target) then + BattleUtil.RandomControl(pro1,ctrl, caster, target,r1) + end + caster.Event:RemoveEvent(BattleEventName.PassiveDamaging, OnPassiveDamaging) + end) + end, + + --直接斩杀[a] [b]%生命上限的伤害 + --a[int 1:斩杀所有剩余血量 2:斩杀指定百分比血量] b[float] + [121] = function(caster, target, args, interval, skill) + local type = args[1] + local pro = args[2] + --boss不会被斩杀 + local isBoss=BattleUtil.CheckIsBoss(target) + if isBoss then + return + end + + if type==1 then + BattleUtil.SeckillHP(skill,caster,target,pro) + elseif type == 2 then + BattleUtil.Seckill(skill,caster,target) + end + end, + + --给目标上麒麟印记(行动前[a]%几率受到[b]属性[c]%的伤害,生效后[d]%几率消失) + --a[float] b[属性] c[float] d[float] + [122] = function(caster, target, args, interval, skill) + local pro = args[1] + local pro1 = args[2] + local v1 = args[3] + local pro2 = args[4] + --boss不会被上麒麟印记 + local isBoss=BattleUtil.CheckIsBoss(target) + if isBoss then + return + end + target:AddBuff(Buff.Create(caster, BuffName.KylinMark,0,pro,pro1,v1,pro2)) + end, + + --[a]%概率给目标上放逐效果 + --a[float] + [123] = function(caster, target, args, interval, skill) + --boss不会被放逐 + local pro=args[1] + local isBoss=BattleUtil.CheckIsBoss(target) + if isBoss then + return + end + BattleUtil.RandomAction(pro, function () + target:AddBuff(Buff.Create(caster, BuffName.Exile,1)) + end) + + end, + + + } diff --git a/luafight/Modules/Battle/Logic/Base/Passivity.lua b/luafight/Modules/Battle/Logic/Base/Passivity.lua index 9acc343e9..c1a7440e5 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] @@ -2306,7 +2305,7 @@ local passivityList = { local i1 = args[1] local f1 = args[2] local ct = args[3] - + role.isHaveNoDead = true -- 角色死亡时 local onRoleDead = function() -- -- 暂时不能死 @@ -2628,7 +2627,11 @@ local passivityList = { [142] = function(role, args) local dot = args[1] local f1 = args[2] - local onHit = function(target, damage, bCrit, finalDmg) + local onHit = function(target, damage, bCrit, finalDmg,damageType,skill) + --只对技能的直接目标生效,分摊出去的不会回血 2020/12/17 王振兴 + if not skill then + return + end if BattleLogic.BuffMgr:HasBuff(target, BuffName.DOT, function(buff) return buff.damageType == dot end) then --吸血修改 finaldamage 改为 damage by:往王振兴 2020/08/17 BattleUtil.ApplyTreat(role, role, floor(BattleUtil.ErrorCorrection(damage * f1))) @@ -2748,16 +2751,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) @@ -2902,14 +2912,29 @@ local passivityList = { role.Event:AddEvent(BattleEventName.SkillCastEnd, onSkillCastEnd) end, - -- 直接伤害击杀目标回复自身[a]点怒气 - -- a[int] - [153] = function(role, args) + -- 直接伤害击杀目标回复自身[a]点怒气 回复[b]属性[c]的血量 (b,c不填就不会回复血量) + -- a[int] b[int,属性id] c[flaot] + [153] = function(role, args,id,judge) local i1 = args[1] - - local onHit = function(target, damage, bCrit, finalDmg) + local p1 = args[2] + local v1 = args[3] + local onHit = function(target, damage, bCrit, finalDmg,damageType, skill,isDirect) + --不是真实伤害 + if not skill and not isDirect then + return + end + + --白骨精追加普攻不触发特性 + if skill and judge==1 and skill.type== BattleSkillType.Normal and skill.isAdd and skill.owner.roleId==10091 then + return + end if target:IsDead() and not BattleUtil.CheckIsNoDead(target) then role:AddRage(i1, CountTypeName.Add) + -- 回血 + if p1 and v1 then + local dd = floor(BattleUtil.ErrorCorrection(role:GetRoleData(BattlePropList[p1])*v1)) + BattleUtil.ApplyTreat(role, role, dd) + end end end role.Event:AddEvent(BattleEventName.RoleHit, onHit) @@ -3605,9 +3630,19 @@ local passivityList = { local onFinalBeDamage = function(damagingFunc, atkRole, damage, skill, dotType, bCrit, damageType) + --只有直接伤害才可以被分摊,反弹的伤害不会分摊 by:王振兴 2020/12/17 + if not skill then + return + end -- 伤害降低 local finalDamage = BattleUtil.CountValue(damage, f1, ct) local curHp = role:GetRoleData(RoleDataName.Hp) + --如果敌方忽略分摊就只减伤 + if atkRole.ignoreShara then + local dd = damage - finalDamage + damagingFunc(floor(BattleUtil.ErrorCorrection(dd))) + return + end -- 不是致死伤害 if finalDamage < curHp then -- 找到除自身外的血量最高的两人 @@ -3853,7 +3888,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) @@ -3916,6 +3951,10 @@ local passivityList = { local f1 = args[1] local onFinalDamage = function(damagingFunc, atkRole, defRole, damage, skill, dotType, bCrit, damageType) + --如果敌人免疫分摊 + if atkRole and atkRole.ignoreShara then + return + end if not role:IsDead() and skill and role.position ~= defRole.position and defRole.camp == role.camp and defRole.element == role.element then local ff = 1 -- 分摊比 -- 检测被动对分摊比的影响 @@ -3934,7 +3973,7 @@ local passivityList = { damagingFunc(shareDamage) end -- 分担伤害 - BattleUtil.ApplyDamage(nil, atkRole, role, shareDamage,bCrit,damageType,dotType,true) + BattleUtil.FinalDamage(nil, atkRole, role, shareDamage,bCrit,damageType,dotType,true) end end BattleLogic.Event:AddEvent(BattleEventName.FinalDamage, onFinalDamage) @@ -4049,17 +4088,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 +4538,7 @@ local passivityList = { role.Event:AddEvent(BattleEventName.RoleHit, _OnRoleHit) end, - -- + -- 大闹天宫胜利次数 [225] = function(role, args) --王振兴添加 local f1 = args[1] @@ -4503,7 +4546,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 +4795,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) @@ -4850,16 +4893,24 @@ local passivityList = { -- 直接伤害每次击杀目标增加[a]%的[b]可叠加持续至战斗结束[c]改变 重写103效果 每次释放技能只触发一次 -- a[float]b[属性]c[改变类型] - [246] = function(role, args,id) + [246] = function(role, args,id,judge) local f1 = args[1] local pro = args[2] local ct = args[3] -- 释放技能后 - local onRoleHit = function(defRole, damage, bCrit, finalDmg, damageType, skill) - --如果是技能并且这个被动已经被触发过 return + local onRoleHit = function(defRole, damage, bCrit, finalDmg, damageType, skill,isDirect) + --不是真实伤害 + if not skill and not isDirect then + return + end + --如果是技能并且这个被动已经被触发过 return if skill and BattleUtil.ChecklistIsContainValue(skill.triggerPassivityId,id) then return end + --白骨精追加普攻不处罚特性 + if skill and judge==1 and skill.type== BattleSkillType.Normal and skill.isAdd and skill.owner.roleId==10091 then + return + end if defRole:IsDead() and not BattleUtil.CheckIsNoDead(defRole) then local buff = Buff.Create(role, BuffName.PropertyChange, 0, BattlePropList[pro], f1, ct) -- buff.cover = true @@ -5151,7 +5202,7 @@ local passivityList = { if not point then point=list[1] end - BattleUtil.ApplyDamage(nil,role,point,dmg) + BattleUtil.FinalDamage(nil,role,point,dmg) end -- end @@ -5464,7 +5515,546 @@ 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 + return + 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, + + --技能追加的普攻额外造成目标[a][b]%的伤害。技能每成功[c]1个目标,额外造成[d]%生命上限的伤害 + --a[int 属性id] b[float] c[控制状态] d[flaot] + [285]=function(role,args) + local f1 = args[1] + local dt = args[2] + local ctrl = args[3] + local v1 = args[4] + --混乱敌方的数量 + local num=0 + -- 直接伤害后 + local onPassiveDamaging = function(func, defRole, damage,skill) + --如果是boss 并且额外伤害是根据最大生命则返回 + local isBoss=BattleUtil.CheckIsBoss(defRole) + if isBoss and f1==12 then + return + end + if skill and skill.type == BattleSkillType.Normal and skill.isAdd and skill.owner==role then + dt=BattleUtil.CountValue(dt,v1*num,1) + local val = -floor(BattleUtil.FP_Mul(dt, defRole:GetRoleData(BattlePropList[f1]))) + if func then + func(val) + end + end + end + role.Event:AddEvent(BattleEventName.PassiveDamaging, onPassiveDamaging) + --记录技能混乱敌人的数量 + local OnRoleHit = function(skill) + if skill and skill.owner==role and skill.type==BattleSkillType.Special then + local list=skill:GetDirectTargetsNoMiss() + if not list then + num=0 + return + end + for key, value in pairs(list) do + local isHave=BattleLogic.BuffMgr:HasBuff(value, BuffName.Control, function(buff) return buff.ctrlType == ctrl and buff.caster==role and buff.startRound == BattleLogic.GetCurRound() end) + if isHave then + num=num+1 + end + end + end + end + role.Event:AddEvent(BattleEventName.SkillCastEnd, OnRoleHit) + end, + + --必定暴击 + --a[int 默认填1] + [286]=function(role,args) + role.mustCrit = true + end, + + --必定命中 + --a[int 默认填1] + [287]=function(role,args) + role.mustHit=true + end, + + --忽略敌方无敌盾 + --a[int 默认填1] + [288]=function(role,args) + role.isImmuneAllReduceShield = true + end, + + --造成伤害暴击后,将伤害的[a]%转化为自身生命治疗自己 + --a[float] + [289] = function(role, args) + local f1 = args[1] + local OnDamage = function(defRole, damage, bCrit, finalDmg) + BattleUtil.CalTreat(role, role, floor(f1 * finalDmg)) + end + role.Event:AddEvent(BattleEventName.RoleCrit, OnDamage) + end, + + --本次技能中如果有[a]目标,额外回复[b]点怒气 回复[c] [d]血量(c,d不填则不回复血量) + -- a[控制状态]b[int] c[int,属性id] d[flaot] + [290]=function(role,args) + local dot=args[1] + local i1 = args[2] + local p1 = args[3] + local v1 = args[4] + local OnRoleHit = function(skill) + + if skill and skill.owner==role and (skill.type==BattleSkillType.Special or skill.type==BattleSkillType.Extra) then + local list=skill:GetDirectTargetsNoMiss() + if not list then + return + end + local num=0 + for key, value in pairs(list) do + local isHave=BattleLogic.BuffMgr:HasBuff(value, BuffName.Control, function(buff) return buff.ctrlType == dot and buff.caster==role and buff.startRound == BattleLogic.GetCurRound() end) + if isHave then + num=num+1 + end + end + if num>0 then + role:AddRage(i1*num, CountTypeName.Add) + if p1 and v1 then + local dd = floor(BattleUtil.ErrorCorrection(role:GetRoleData(BattlePropList[p1])*v1*num)) + BattleUtil.ApplyTreat(role, role, dd) + end + end + end + end + role.Event:AddEvent(BattleEventName.SkillCastEnd, OnRoleHit) + end, + + --忽略敌方分摊伤害 + --a[int 默认填1] + [291]=function(role,args) + role.ignoreShara=true + 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, + --魂印[a]改变控制概率[b]% ,减员[c]改变控制概率[d]%,减员[e]改变伤害[f]%(只作用于主动技能效果120) + --a[改变类型]b[float] c[改变类型] d[int] e[改变类型] f[flaot] + [293]=function(role, args,id,judge) + local ct = args[1] + local f1 = args[2] + local ct2 = args[3] + local f2 = args[4] + local ct3 = args[5] + local f3 = args[6] + local onSkillEffectBefore = function(skill, e, func) + if skill.type == BattleSkillType.Special then + if e.type == 120 then -- 当前只对技能效果103生效 + local factor = BattleUtil.ErrorCorrection(BattleUtil.CountValue(e.args[8], f1, ct)) + e.args[8] = factor + if ct2 and f2 then + e.args[9] = BattleUtil.ErrorCorrection(BattleUtil.CountValue(e.args[9], f2, ct2)) + end + if ct3 and f3 then + e.args[10] = BattleUtil.ErrorCorrection(BattleUtil.CountValue(e.args[10], f3, ct3)) + end + if func then func(e) end + end + end + end + role.Event:AddEvent(BattleEventName.SkillEffectBefore, onSkillEffectBefore) + 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/Control.lua b/luafight/Modules/Battle/Logic/Buff/Control.lua index 6aea8e25c..1b153565e 100644 --- a/luafight/Modules/Battle/Logic/Buff/Control.lua +++ b/luafight/Modules/Battle/Logic/Buff/Control.lua @@ -26,6 +26,8 @@ function Control:OnStart() elseif self.ctrlType == 7 then --麻痹 self.target.ctrl_palsy = true + elseif self.ctrlType == 8 then --混乱 + self.target.ctrl_chaos = true end end @@ -52,6 +54,8 @@ function Control:OnEnd() elseif self.ctrlType == 7 then --麻痹 self.target.ctrl_palsy = false + elseif self.ctrlType==8 then --混乱 + self.target.ctrl_chaos = false end end diff --git a/luafight/Modules/Battle/Logic/Buff/Curse.lua b/luafight/Modules/Battle/Logic/Buff/Curse.lua index a75ba47d7..fff6e4673 100644 --- a/luafight/Modules/Battle/Logic/Buff/Curse.lua +++ b/luafight/Modules/Battle/Logic/Buff/Curse.lua @@ -24,7 +24,7 @@ function Curse:ShareDamageTrigger(damagingFunc, atkRole, defRole, damage, skill, local f1 = self.args[1] --平分伤害的百分比 local sd = math.floor(BattleUtil.ErrorCorrection(damage * f1 / #sdList)) if sd ~= 0 then - BattleUtil.ApplyDamage(nil, atkRole, self.target, sd) + BattleUtil.FinalDamage(nil, atkRole, self.target, sd) end end end diff --git a/luafight/Modules/Battle/Logic/Buff/Shield.lua b/luafight/Modules/Battle/Logic/Buff/Shield.lua index 0dc511779..06f637b07 100644 --- a/luafight/Modules/Battle/Logic/Buff/Shield.lua +++ b/luafight/Modules/Battle/Logic/Buff/Shield.lua @@ -63,17 +63,22 @@ function Shield:CountShield(damage, atkRole,skill) finalDamage=damage end elseif self.shieldType == ShieldTypeName.AllReduce then - finalDamage = 0 - --TODO 计算吸血 - if self.shieldValue ~= 0 then + --攻击者免疫无敌盾 + if atkRole.isImmuneAllReduceShield and skill then + finalDamage=damage + else + finalDamage = 0 + end + --TODO 计算吸血 + if self.shieldValue ~= 0 then local treatValue = math.floor(BattleUtil.ErrorCorrection(damage * self.shieldValue)) BattleUtil.ApplyTreat(self.target, self.target, treatValue) end end -- - -- self.caster.Event:DispatchEvent(BattleEventName.ShildTrigger, self) - self.target.Event:DispatchEvent(BattleEventName.ShildTrigger, self) + -- self.caster.Event:DispatchEvent(BattleEventName.ShildTrigger, self) + self.target.Event:DispatchEvent(BattleEventName.ShildTrigger, self,atkRole) BattleLogic.Event:DispatchEvent(BattleEventName.ShildTrigger, self) return finalDamage @@ -147,6 +152,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..51e1593b9 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 @@ -200,6 +204,8 @@ BattleSkillType = { Extra = 3, --死亡后释放的技能 DeadSkill = 4, + --混乱后释放的普攻 + ChaosNormal = 5, } --敌人类型 @@ -264,11 +270,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..b599e9152 100644 --- a/luafight/Modules/Battle/Logic/Misc/BattleUtil.lua +++ b/luafight/Modules/Battle/Logic/Misc/BattleUtil.lua @@ -78,7 +78,7 @@ function BattleUtil.SortByProp(arr, prop, sort) end) return arr end --- 按血量排序 +-- 按百分比血量排序 function BattleUtil.SortByHpFactor(arr, sort) BattleUtil.Sort(arr, function(a, b) local r1 = a:GetRoleData(RoleDataName.Hp) / a:GetRoleData(RoleDataName.MaxHp) @@ -88,6 +88,49 @@ function BattleUtil.SortByHpFactor(arr, sort) return arr end +-- 按百分比血量排序 +function BattleUtil.SortByHpFactorAndHp(arr, sort) + BattleUtil.Sort(arr, function(a, b) + local r1 = a:GetRoleData(RoleDataName.Hp) / a:GetRoleData(RoleDataName.MaxHp) + local r2 = b:GetRoleData(RoleDataName.Hp) / b:GetRoleData(RoleDataName.MaxHp) + if sort == 1 then + if r1==r2 then + return a:GetRoleData(RoleDataName.Hp) r2 + end + else + if r1==r2 then + return a:GetRoleData(RoleDataName.Hp)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) local chooseType = floor(chooseId / 100000) % 10 @@ -229,12 +272,15 @@ function BattleUtil.ChooseTarget(role, chooseId) else arr = RoleManager.GetArrAggroList(role, arr) end + -- body -- elseif chooseWeight == 9 then -- 展位距离 -- BattleUtil.Sort(arr, function(a, b) -- local r1 = math.abs(role.position - a.position) * 10 + a.position -- local r2 = math.abs(role.position - b.position) * 10 + b.position -- if sort == 1 then return r1 > r2 else return r1 < r2 end -- end) + elseif chooseWeight == 9 then --血量百分比->血量 + BattleUtil.SortByHpFactorAndHp(arr,sort) end local finalArr = {} if num == 0 then @@ -341,6 +387,36 @@ function BattleUtil.Seckill(skill, atkRole, defRole) end end +-- 秒杀定额血量 +function BattleUtil.SeckillHP(skill, atkRole, defRole,pro) + -- 灵兽无效 + if defRole.type == BattleUnitType.Monster then + return + end + local damage = floor(BattleUtil.FP_Mul(defRole:GetRoleData(RoleDataName.MaxHp),pro)) + local finalDmg = defRole.data:SubValue(RoleDataName.Hp, damage) + if finalDmg >= 0 then + if defRole:GetRoleData(RoleDataName.Hp) <= 0 and not defRole:IsDead() then + defRole:SetDead() + defRole.Event:DispatchEvent(BattleEventName.RoleDead, atkRole) + atkRole.Event:DispatchEvent(BattleEventName.RoleKill, defRole) + BattleLogic.Event:DispatchEvent(BattleEventName.BattleRoleDead, defRole, atkRole) + + atkRole.Event:DispatchEvent(BattleEventName.Seckill, defRole) + defRole.Event:DispatchEvent(BattleEventName.BeSeckill, atkRole) + BattleLogic.Event:DispatchEvent(BattleEventName.Seckill, atkRole, defRole) + end + atkRole.Event:DispatchEvent(BattleEventName.RoleDamage, defRole, damage, false, finalDmg, 0, false, skill) + defRole.Event:DispatchEvent(BattleEventName.RoleBeDamaged, atkRole, damage, false, finalDmg, 0, false, skill) + BattleLogic.Event:DispatchEvent(BattleEventName.RoleDamage, atkRole, defRole, damage, false, finalDmg, 0, false, skill) + BattleLogic.Event:DispatchEvent(BattleEventName.RoleBeDamaged, defRole, atkRole, damage, false, finalDmg, 0, false, skill) + if skill then + atkRole.Event:DispatchEvent(BattleEventName.RoleHit, defRole, damage, nil, finalDmg, nil, skill) + defRole.Event:DispatchEvent(BattleEventName.RoleBeHit, atkRole, damage, nil, finalDmg, nil, skill) + end + end +end + -- 计算真实伤害 function BattleUtil.ApplyDamage(skill, atkRole, defRole, damage, bCrit, damageType, dotType,isDirect) -- 灵兽无效 @@ -390,7 +466,7 @@ end --检测是否有是金翅大鹏有不灭效果 function BattleUtil.CheckIsNoDead(target) if target then - return target:IsAssignHeroAndHeroStar(10086,10) or BattleLogic.BuffMgr:HasBuff(target,BuffName.NoDead) + return target.isHaveNoDead or BattleLogic.BuffMgr:HasBuff(target,BuffName.NoDead) end return false end @@ -446,13 +522,14 @@ function BattleUtil.FinalDamage(skill, atkRole, defRole, damage, bCrit, damageTy defRole.Event:DispatchEvent(BattleEventName.RoleBeCrit, atkRole, damage, bCrit, finalDmg, damageType, skill) 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) + atkRole.Event:DispatchEvent(BattleEventName.RoleHit, defRole, damage, bCrit, finalDmg, damageType, skill,isDirect) + 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) + atkRole.Event:DispatchEvent(BattleEventName.RoleHit, defRole, damage, bCrit, finalDmg, damageType, skill,isDirect) + defRole.Event:DispatchEvent(BattleEventName.RoleBeHit, atkRole, damage, bCrit, finalDmg, damageType, skill,isDirect) end end @@ -518,7 +595,7 @@ function BattleUtil.CalDamage(skill, atkRole, defRole, damageType, baseFactor, i local critRandom = Random.Range01() local critCondition = clamp(atkRole:GetRoleData(RoleDataName.Crit) - defRole:GetRoleData(RoleDataName.Tenacity), 0, 1) bCrit = critRandom <= critCondition - bCrit = bCrit or defRole.isFlagCrit == true -- 必定暴击 + bCrit =atkRole.mustCrit or bCrit or defRole.isFlagCrit == true -- 必定暴击 -- 计算暴伤害系数 local critDamageFactor = 1 @@ -652,6 +729,9 @@ end function BattleUtil.CheckIsHit(atkRole, defRole) -- 是否命中: 命中 = 自身命中率 - 对方闪避率 local isHit = false + if atkRole.mustHit then + return true + end local hitRandom = Random.Range01() local hitCondition = clamp(atkRole:GetRoleData(RoleDataName.Hit) - defRole:GetRoleData(RoleDataName.Dodge), 0, 1) isHit = hitRandom <= hitCondition diff --git a/luafight/Modules/Battle/Logic/Role/RoleLogic.lua b/luafight/Modules/Battle/Logic/Role/RoleLogic.lua index c3c987033..74399be5f 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 @@ -40,7 +39,7 @@ function RoleLogic:Init(uid, data, position) self.exCalDmgList:Clear() --额外计算伤害列表 self.buffFilter:Clear() --buff屏蔽列表 self.proTranList:Clear() --属性转换列表 - + self.isHaveNoDead = false -- 是否有不灭 self.Event:ClearEvent() self.skill = data.skill @@ -59,6 +58,30 @@ function RoleLogic:Init(uid, data, position) -- self.isImmuneReduceRage=false --是否免疫减怒 + self.aiOrder = data.ai + self.aiIndex = 1 + self.aiTempCount = 0 + + self.IsDebug = false + self.enemyType = EnemyType.normal + self.lockTarget = nil --嘲讽 + self.ctrl_dizzy = false --眩晕 不能释放所有技能 + self.ctrl_slient = false --沉默 只能1技能 + self.ctrl_palsy = false --麻痹 只能2技能 + self.ctrl_noheal = false --禁疗 + self.ctrl_blind = false --致盲 + self.ctrl_chaos = false --混乱 + self.deadFilter = true -- 控制死亡,置为false则角色暂时无法死亡 + self.isExile = false --是否放逐 + self.reliveFilter = true -- 控制复活的标志位,置为false角色将不再享受复活效果 + self.reliveHPF = 1 + + self.IsCanAddSkill = true -- 是否可以追加技能 + self.mustHit=false --必定命中 + self.mustCrit=false --必定暴击 + self.isImmuneAllReduceShield = false --免疫敌方无敌盾(敌方无敌盾对自己无效) + self.ignoreShara = false --忽略敌方分摊 + self.type = BattleUnitType.Role self.passiveList = {} if data.passivity and #data.passivity > 0 then for i = 1, #data.passivity do @@ -81,26 +104,6 @@ function RoleLogic:Init(uid, data, position) -- 初始怒气值放在被动之后计算,使被动对初始怒气的影响生效 self.Rage = self.Rage + self:GetRoleData(RoleDataName.InitRage)-- 当前怒气值 - -- - self.aiOrder = data.ai - self.aiIndex = 1 - self.aiTempCount = 0 - - self.IsDebug = false - self.enemyType = EnemyType.normal - self.lockTarget = nil --嘲讽 - self.ctrl_dizzy = false --眩晕 不能释放所有技能 - self.ctrl_slient = false --沉默 只能1技能 - self.ctrl_palsy = false --麻痹 只能2技能 - self.ctrl_noheal = false --禁疗 - self.ctrl_blind = false --致盲 - - self.deadFilter = true -- 控制死亡,置为false则角色暂时无法死亡 - - self.reliveFilter = true -- 控制复活的标志位,置为false角色将不再享受复活效果 - self.reliveHPF = 1 - - self.IsCanAddSkill = true -- 是否可以追加技能 end -- 添加一个被动技能 @@ -160,7 +163,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 +176,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) @@ -298,7 +299,7 @@ function RoleLogic:SkillCast(skill, func) end -- 没有麻痹,释放普通攻击 - if skill.type == BattleSkillType.Normal and not self.ctrl_palsy then + if (skill.type == BattleSkillType.Normal or skill.type ==BattleSkillType.ChaosNormal) and not self.ctrl_palsy then local function _CheckRage() -- 后成长怒气 @@ -361,8 +362,14 @@ end -- isAdd 是否是追加技能 -- isRage 是否正常操作怒气值 function RoleLogic:AddSkill(type, isRage, isAdd, targets) - if not self.IsCanAddSkill and isAdd then return end + if not self.IsCanAddSkill and isAdd then return end local effectData = type == BattleSkillType.Normal and self.skill or self.superSkill + --角色被混乱后 + if self.ctrl_chaos and isRage then + type=BattleSkillType.ChaosNormal + --混乱普攻使用普攻特效 + effectData={self.skill[1],self.skill[2],self.skill[3],self.skill[4],{100001,{1,1,1}}} + end SkillManager.AddSkill(self, effectData, type, targets, isAdd, isRage) -- BattleLogManager.Log( @@ -429,6 +436,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)