diff --git a/Assets/ManagedResources/~Lua/Modules/Battle/Logic/Base/Passivity.lua b/Assets/ManagedResources/~Lua/Modules/Battle/Logic/Base/Passivity.lua index 987082eab2..65e09f2260 100644 --- a/Assets/ManagedResources/~Lua/Modules/Battle/Logic/Base/Passivity.lua +++ b/Assets/ManagedResources/~Lua/Modules/Battle/Logic/Base/Passivity.lua @@ -2031,8 +2031,6 @@ local passivityList = { end) end, - - -- 直接伤害击杀目标回复自身[a]%的[b] -- a[float] [116] = function(role, args) @@ -2384,7 +2382,7 @@ local passivityList = { -- 击杀数量累加 local OnRoleHit = function(defRole, damage, bCrit, finalDmg, damageType, skill) if skill and defRole:IsDead() and not BattleUtil.CheckIsNoDead(defRole) then - killNum = killNum + 1 + killNum = killNum + 1 end end role.Event:AddEvent(BattleEventName.RoleHit, OnRoleHit) @@ -4781,5 +4779,272 @@ local passivityList = { role.data.enemyType=f1 BattleUtil.CheckIsBoss(role) end, + -- (直接伤害(目前没有明确定义直接伤害))直接伤害击杀目标自身增加[a]点怒气 重写92被动效果 每次释放技能只触发一次 + -- a[int] + [245] = function(role, args) + local i1 = args[1] + local OnRoleHit = function(defRole, damage, bCrit, finalDmg, damageType, skill) + --如果是技能并且这个被动已经被触发过 return + if skill and skill.isTriggePassivity then + return + end + if skill and not skill.isAdd and defRole:IsDead() and not BattleUtil.CheckIsNoDead(defRole) then + role:AddRage(i1, CountTypeName.Add) + skill.isTriggePassivity=true + end + end + role.Event:AddEvent(BattleEventName.RoleHit, OnRoleHit) + end, + + -- 直接伤害每次击杀目标增加[a]%的[b]可叠加持续至战斗结束[c]改变 重写103效果 每次释放技能只触发一次 + -- a[float]b[属性]c[改变类型] + [246] = function(role, args) + local f1 = args[1] + local pro = args[2] + local ct = args[3] + -- 释放技能后 + local onRoleHit = function(defRole, damage, bCrit, finalDmg, damageType, skill) + --如果是技能并且这个被动已经被触发过 return + if skill and skill.isTriggePassivity 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 + role:AddBuff(buff) + skill.isTriggePassivity=true + end + end + role.Event:AddEvent(BattleEventName.RoleHit, onRoleHit) + end, + -- 直接伤害击杀目标后追加[a]次普攻 重写114 一次技能只触发一次被动 + -- a[int] + [247] = function(role, args) + local i1 = args[1] + -- 释放技能后 + local onRoleHit = function(target,damage, bCrit, finalDmg, damageType, skill) + --如果是技能并且这个被动已经被触发过 return + if skill and skill.isTriggePassivity then + return + end + if target:IsDead() and not BattleUtil.CheckIsNoDead(target) then + for i = 1, i1 do + role:AddSkill(BattleSkillType.Normal, false, true, nil) + end + skill.isTriggePassivity=true + end + end + role.Event:AddEvent(BattleEventName.RoleHit, onRoleHit) + end, + + -- 直接伤害击杀目标回复自身[a]%的[b] 重写116 一次技能只触发一次被动 + -- a[float] + [248] = function(role, args) + local f1 = args[1] + -- 释放技能后 + local onRoleHit = function(target,damage, bCrit, finalDmg, damageType, skill) + --如果是技能并且这个被动已经被触发过 return + if skill and skill.isTriggePassivity then + return + end + if target:IsDead() and not BattleUtil.CheckIsNoDead(target) then + local treat = floor(BattleUtil.FP_Mul(role:GetRoleData(RoleDataName.MaxHp), f1)) + BattleUtil.CalTreat(role, role, treat) + skill.isTriggePassivity=true + end + end + role.Event:AddEvent(BattleEventName.RoleHit, onRoleHit) + end, + + -- 直接伤害击杀目标下回合攻击[a]%暴击(TODO:目前为增加[a]%) 重写125 一次技能只触发一次被动 + -- a[float] + [249] = function(role, args) + local f1 = args[1] + -- 释放技能后 + local onRoleHit = function(target,damage, bCrit, finalDmg, damageType, skill) + --如果是技能并且这个被动已经被触发过 return + if skill and skill.isTriggePassivity then + return + end + if target:IsDead() and not BattleUtil.CheckIsNoDead(target) then + local buff = Buff.Create(role, BuffName.PropertyChange, 1, RoleDataName.Crit, f1, CountTypeName.Add) + role:AddBuff(buff) + skill.isTriggePassivity=true + end + end + role.Event:AddEvent(BattleEventName.RoleHit, onRoleHit) + end, + + -- 直接伤害每次击杀目标增加自身伤害[a]%,[b]改变,可叠加持续至战斗结束 重写132 一次技能只触发一次被动 + -- a[float]b[改变类型] + [250] = function(role, args) + local f1 = args[1] + local ct = args[2] + + local killNum = 0 + local extra = 0 + + -- 击杀数量累加 + local OnRoleHit = function(defRole, damage, bCrit, finalDmg, damageType, skill) + --如果是技能并且这个被动已经被触发过 return + if skill and skill.isTriggePassivity then + return + end + if skill and defRole:IsDead() and not BattleUtil.CheckIsNoDead(defRole) then + killNum = killNum + 1 + skill.isTriggePassivity=true + end + end + role.Event:AddEvent(BattleEventName.RoleHit, OnRoleHit) + + + -- 释放技能时计算额外伤害 + local OnSkillCast = function(skill) + if skill then + extra = f1 * killNum + end + end + role.Event:AddEvent(BattleEventName.SkillCast, OnSkillCast) + + + -- 造成伤害时判断额外伤害 + local passivityDamaging = function(func, caster, damage, skill) + if skill then + if func then + local dd = BattleUtil.CountValue(damage, extra, ct) - damage + func(-floor(BattleUtil.ErrorCorrection(dd))) + end + end + end + role.Event:AddEvent(BattleEventName.PassiveDamaging, passivityDamaging) + end, + + -- 直接伤害击杀[a]目标回复[b]%的最大生命 重写148 一次技能只触发一次被动 + -- a[持续伤害状态]b[float] + [251] = function(role, args) + local dot = args[1] + local f1 = args[2] + local function onHit(target, damage, bCrit, finalDmg, damageType, skill) + --如果是技能并且这个被动已经被触发过 return + if skill and skill.isTriggePassivity then + return + end + if target:IsDead() and not BattleUtil.CheckIsNoDead(target) then + local maxHp = role:GetRoleData(RoleDataName.MaxHp) + local value = floor(BattleUtil.ErrorCorrection(maxHp* f1)) + BattleUtil.ApplyTreat(role, role, value) + skill.isTriggePassivity=true + end + 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 + role.Event:AddEvent(BattleEventName.RoleHit, onHit) + end + end + role.Event:AddEvent(BattleEventName.PassiveDamaging, onDamaging) + end, + + -- 直接伤害击杀目标回复自身[a]点怒气 重写153 一次技能只触发一次被动 + -- a[int] + [252] = function(role, args) + local i1 = args[1] + local onHit = function(target, damage, bCrit, finalDmg,damageType,skill) + --如果是技能并且这个被动已经被触发过 return + if skill and skill.isTriggePassivity then + return + end + if target:IsDead() and not BattleUtil.CheckIsNoDead(target) then + role:AddRage(i1, CountTypeName.Add) + skill.isTriggePassivity=true + end + end + role.Event:AddEvent(BattleEventName.RoleHit, onHit) + end, + + -- 击杀目标后对敌方血量百分比最低两名角色造成[a]%[b]伤害 重写170 一次技能只触发一次被动 + -- a[float]b[伤害类型] + [253] = function(role, args) + local f1 = args[1] + local dt = args[2] + -- 直接伤害后 + local onRoleHit = function(target, damage, bCrit, finalDmg, damageType, skill) + --如果是技能并且这个被动已经被触发过 return + if skill and skill.isTriggePassivity then + return + end + if skill and not skill.isAdd and target:IsDead() and not BattleUtil.CheckIsNoDead(target) then + local list = RoleManager.Query(function(v) return v.camp ~= role.camp end) + BattleUtil.SortByHpFactor(list, 1) + local index = 0 + for i = 1, #list do + if not list[i]:IsDead() and index < 2 then + index = index + 1 + BattleUtil.CalDamage(nil, role, list[i], dt, f1) + end + end + skill.isTriggePassivity=true + end + end + role.Event:AddEvent(BattleEventName.RoleHit, onRoleHit) + end, + + -- 直接伤害击杀目标对仇恨目标造成[a]%物理伤害 重写185 一次技能只触发一次被动 + -- a[float] + [254] = function(role, args) + local f1 = args[1] + local onRoleHit = function(target,damage, bCrit, finalDmg, damageType, skill) + --如果是技能并且这个被动已经被触发过 return + if skill and skill.isTriggePassivity then + return + end + if target:IsDead() and not BattleUtil.CheckIsNoDead(target) then + local target = RoleManager.GetAliveAggro(role) + BattleUtil.CalDamage(nil, role, target, 1, f1) + skill.isTriggePassivity=true + end + end + role.Event:AddEvent(BattleEventName.RoleHit, onRoleHit) + end, + + -- 技能直接击杀敌方目标时有[a]%概率获得目标剩余所有怒气(输出武将佩戴)重写197 一次技能只触发一次被动 + -- a[float] + [255] = function(role, args) + local f1 = args[1] + local onRoleHit = function(target, damage, bCrit, finalDmg, damageType, skill) + --如果是技能并且这个被动已经被触发过 return + if skill and skill.isTriggePassivity then + return + end + if skill and skill.type == BattleSkillType.Special and target:IsDead() and not BattleUtil.CheckIsNoDead(target) then + BattleUtil.RandomAction(f1, function() + role:AddRage(target.Rage, CountTypeName.Add) + skill.isTriggePassivity=true + end) + end + end + role.Event:AddEvent(BattleEventName.RoleHit, onRoleHit) + end, + + -- 直接伤害击杀目标释放[a]技能。 重新243 一次技能只触发一次被动 + -- a[float] + [256] = function(role, args) + local f1 = args[1] + local f2=args[2] + local onRoleHit = function(target, damage, bCrit, finalDmg, damageType, skill) + --如果是技能并且这个被动已经被触发过 return + if skill and skill.isTriggePassivity then + return + end + if target:IsDead() and not BattleUtil.CheckIsNoDead(target) and not role:IsDead() then + -- local target = RoleManager.GetAliveAggro(role) + --BattleUtil.CalDamage(nil, role, target, 1, f1) + --加一个延时操作,防止有的英雄有死亡后再释放一次技能的被动 by:王振兴 + role:InsertExtraSkill(f1,f2) + skill.isTriggePassivity=true + end + end + role.Event:AddEvent(BattleEventName.RoleHit, onRoleHit) + end, } return passivityList \ No newline at end of file diff --git a/Assets/ManagedResources/~Lua/Modules/Battle/Logic/Base/Skill.lua b/Assets/ManagedResources/~Lua/Modules/Battle/Logic/Base/Skill.lua index acc32617a6..86c13debed 100644 --- a/Assets/ManagedResources/~Lua/Modules/Battle/Logic/Base/Skill.lua +++ b/Assets/ManagedResources/~Lua/Modules/Battle/Logic/Base/Skill.lua @@ -35,11 +35,11 @@ function Skill:Init(role, effectData, type, targets, isAdd, isRage) --type 0 异 self.hitTime = effectData[2] -- 效果命中需要的时间 self.continueTime = effectData[3] -- 命中后伤害持续时间 self.attackCount = effectData[4] -- 伤害持续时间内伤害次数 - + self.isTriggePassivity = false -- 是否一个技能只触发一次被动 true:每次释放技能只会触发一次 self.targets = targets or {} self.isAdd = isAdd self.isRage = isRage - + self.isKill = false --是否技能击杀目标 for i=5, #effectData do local v = effectData[i] local effectGroup = effectGroupPool:Get() -- chooseId, {effect1, effect2, ...} @@ -120,6 +120,7 @@ function Skill:Cast(func) self.castDoneFunc = func self.effectTargets = {} self.targetIsHit = {} + self.isTriggePassivity=false -- 先计算出技能的目标 for i=1, self.effectList.size do -- 是否重新选择目标 @@ -211,13 +212,15 @@ function Skill:Cast(func) BattleLogic.WaitForTrigger(duration + 0.4, function() self.owner.Event:DispatchEvent(BattleEventName.SkillCastEnd, self) BattleLogic.Event:DispatchEvent(BattleEventName.SkillCastEnd, self) - + -- 只对效果1的目标发送事件,效果1是技能的直接伤害目标 for _, tr in ipairs(self.effectTargets[1]) do tr.Event:DispatchEvent(BattleEventName.BeSkillCastEnd, self) end -- 技能结束 self:EndSkill() + --技能消息发送完后 iskill 设置为false + self.isKill=false end) end @@ -257,6 +260,7 @@ function Skill:EndSkill() -- 技能结束后摇后结束技能释放 BattleLogic.WaitForTrigger(0.3, function() -- 结束回调 + self.isTriggePassivity=false if self.castDoneFunc then self.castDoneFunc() end end)