From 00c5976c38c86c411b855b234f661ac5fe4dd166 Mon Sep 17 00:00:00 2001 From: lvxinran Date: Thu, 23 Apr 2020 20:08:25 +0800 Subject: [PATCH] =?UTF-8?q?=E6=88=98=E6=96=97=E5=90=8C=E6=AD=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- luafight/Modules/Battle/Logic/Base/Buff.lua | 15 + luafight/Modules/Battle/Logic/Base/Effect.lua | 122 ++++---- .../Modules/Battle/Logic/Base/Passivity.lua | 279 +++++++++++------- luafight/Modules/Battle/Logic/BattleLogic.lua | 13 + luafight/Modules/Battle/Logic/Buff/Brand.lua | 4 + .../Modules/Battle/Logic/Buff/Control.lua | 6 + luafight/Modules/Battle/Logic/Buff/DOT.lua | 5 + luafight/Modules/Battle/Logic/Buff/Immune.lua | 5 + .../Battle/Logic/Buff/PropertyChange.lua | 5 + luafight/Modules/Battle/Logic/Buff/Shield.lua | 5 + .../Battle/Logic/Misc/BattleDefine.lua | 21 ++ 11 files changed, 321 insertions(+), 159 deletions(-) diff --git a/luafight/Modules/Battle/Logic/Base/Buff.lua b/luafight/Modules/Battle/Logic/Base/Buff.lua index 04255baee..8b9b82a9e 100644 --- a/luafight/Modules/Battle/Logic/Base/Buff.lua +++ b/luafight/Modules/Battle/Logic/Base/Buff.lua @@ -70,6 +70,21 @@ function Buff:ChangeBuffDuration(type, value) self.caster.Event:DispatchEvent(BattleEventName.BuffDurationChange, self) end + + +function Buff:CompareWith(buff) + + if self.type == buff.type then + if self.OnCompare then + return self:OnCompare(buff) + else + return true + end + else + return false + end +end + BuffManager = {} BuffManager.__index = BuffManager diff --git a/luafight/Modules/Battle/Logic/Base/Effect.lua b/luafight/Modules/Battle/Logic/Base/Effect.lua index 56993b7ca..a7df15ce2 100644 --- a/luafight/Modules/Battle/Logic/Base/Effect.lua +++ b/luafight/Modules/Battle/Logic/Base/Effect.lua @@ -6,24 +6,24 @@ local max = math.max --local BattleUtil = BattleUtil --属性编号 -local propertyList = { - RoleDataName.Attack, - RoleDataName.PhysicalDefence, - RoleDataName.MagicDefence, - RoleDataName.Speed, - RoleDataName.DamageBocusFactor, - RoleDataName.DamageReduceFactor, - RoleDataName.Hit, - RoleDataName.Dodge, - RoleDataName.Crit, - RoleDataName.CritDamageFactor, - RoleDataName.TreatFacter, - RoleDataName.MaxHp, - RoleDataName.Hp, - RoleDataName.CureFacter, - RoleDataName.Tenacity, - RoleDataName.InitRage, -} +-- local BattlePropList = { +-- RoleDataName.Attack, +-- RoleDataName.PhysicalDefence, +-- RoleDataName.MagicDefence, +-- RoleDataName.Speed, +-- RoleDataName.DamageBocusFactor, +-- RoleDataName.DamageReduceFactor, +-- RoleDataName.Hit, +-- RoleDataName.Dodge, +-- RoleDataName.Crit, +-- RoleDataName.CritDamageFactor, +-- RoleDataName.TreatFacter, +-- RoleDataName.MaxHp, +-- RoleDataName.Hp, +-- RoleDataName.CureFacter, +-- RoleDataName.Tenacity, +-- RoleDataName.InitRage, +-- } local function buffRandomAction(random, target, buff) @@ -112,7 +112,7 @@ local effectList = { local f2 = args[3] local ct = args[4] BattleLogic.WaitForTrigger(interval, function () - local buff = Buff.Create(caster, BuffName.PropertyChange, f2, propertyList[pro1], f1, ct) + local buff = Buff.Create(caster, BuffName.PropertyChange, f2, BattlePropList[pro1], f1, ct) if f2 == 0 then buff.cover = true end @@ -126,7 +126,7 @@ local effectList = { local f1 = args[2] local f2 = args[3] BattleLogic.WaitForTrigger(interval, function () - local val = floor(BattleUtil.FP_Mul(f1, caster:GetRoleData(propertyList[pro1]))) + local val = floor(BattleUtil.FP_Mul(f1, caster:GetRoleData(BattlePropList[pro1]))) target:AddBuff(Buff.Create(caster, BuffName.HOT, f2, 1, val)) end) end, @@ -187,7 +187,7 @@ local effectList = { local f2 = args[3] local f3 = args[4] BattleLogic.WaitForTrigger(interval, function () - local val = floor(BattleUtil.FP_Mul(f1, caster:GetRoleData(propertyList[pro1]))) + local val = floor(BattleUtil.FP_Mul(f1, caster:GetRoleData(BattlePropList[pro1]))) target:AddBuff(Buff.Create(caster, BuffName.Shield, f2, ShieldTypeName.NormalReduce, val, f3)) end) end, @@ -294,15 +294,15 @@ local effectList = { local f3 = args[4] BattleLogic.WaitForTrigger(interval, function () --计算上限值 - local total = caster.data:GetOrginData(propertyList[pro]) * (1 + f3) + local total = caster.data:GetOrginData(BattlePropList[pro]) * (1 + f3) --计算预期吸取后的值 - local targetValue = caster:GetRoleData(propertyList[pro]) + target:GetRoleData(propertyList[pro]) * f1 + local targetValue = caster:GetRoleData(BattlePropList[pro]) + target:GetRoleData(BattlePropList[pro]) * f1 --计算有效吸收值 - local delta = min(targetValue, total) - caster:GetRoleData(propertyList[pro]) + local delta = min(targetValue, total) - caster:GetRoleData(BattlePropList[pro]) if delta > 0 then - target:AddBuff(Buff.Create(caster, BuffName.PropertyChange, f2, propertyList[pro], delta, 3)) - caster:AddBuff(Buff.Create(caster, BuffName.PropertyChange, f2, propertyList[pro], delta, 1)) + target:AddBuff(Buff.Create(caster, BuffName.PropertyChange, f2, BattlePropList[pro], delta, 3)) + caster:AddBuff(Buff.Create(caster, BuffName.PropertyChange, f2, BattlePropList[pro], delta, 1)) end end) end, @@ -431,7 +431,7 @@ local effectList = { local pro1 = args[1] local f1 = args[2] BattleLogic.WaitForTrigger(interval, function () - local val = floor(BattleUtil.FP_Mul(caster:GetRoleData(propertyList[pro1]), f1)) + local val = floor(BattleUtil.FP_Mul(caster:GetRoleData(BattlePropList[pro1]), f1)) BattleUtil.CalTreat(caster, target, val) end) end, @@ -607,7 +607,7 @@ local effectList = { local ct = args[5] BattleLogic.WaitForTrigger(interval, function () if target.roleData.professionId == pt then - target:AddBuff(Buff.Create(caster, BuffName.PropertyChange, f2, propertyList[pro1], f1, ct)) + target:AddBuff(Buff.Create(caster, BuffName.PropertyChange, f2, BattlePropList[pro1], f1, ct)) end end) end, @@ -641,7 +641,7 @@ local effectList = { local i1 = args[3] local ct = args[4] BattleLogic.WaitForTrigger(interval, function () - local changeBuff = Buff.Create(caster, BuffName.PropertyChange, 0, propertyList[pro1], f1, ct) + local changeBuff = Buff.Create(caster, BuffName.PropertyChange, 0, BattlePropList[pro1], f1, ct) changeBuff.cover = true changeBuff.maxLayer = i1 @@ -759,8 +759,8 @@ local effectList = { caster.Event:DispatchEvent(BattleEventName.RoleViewBullet, skill, target) BattleLogic.WaitForTrigger(interval, function () - local proTran1 = {proName = propertyList[pro1], tranProName = propertyList[pro1], tranFactor = f2, changeType = ct1} - local proTran2 = {proName = propertyList[pro2], tranProName = propertyList[pro2], tranFactor = f3, changeType = ct2} + local proTran1 = {proName = BattlePropList[pro1], tranProName = BattlePropList[pro1], tranFactor = f2, changeType = ct1} + local proTran2 = {proName = BattlePropList[pro2], tranProName = BattlePropList[pro2], tranFactor = f3, changeType = ct2} caster.proTranList:Add(proTran1) caster.proTranList:Add(proTran2) BattleUtil.CalDamage(skill, caster, target, dt, f1) @@ -777,7 +777,7 @@ local effectList = { local f2 = args[4] local ct = args[5] BattleLogic.WaitForTrigger(interval, function () - buffRandomAction(f3, target, Buff.Create(caster, BuffName.PropertyChange, f2, propertyList[pro1], f1, ct)) + buffRandomAction(f3, target, Buff.Create(caster, BuffName.PropertyChange, f2, BattlePropList[pro1], f1, ct)) end) end, --造成[a]%的[b]伤害,如果击杀,则永久增加[c]%的[d],最大[e]层(0为无限) @@ -792,7 +792,7 @@ local effectList = { BattleLogic.WaitForTrigger(interval, function () local dmg, crit = BattleUtil.CalDamage(skill, caster, target, dt, f1) if target.isDead then - local buff = Buff.Create(caster, BuffName.PropertyChange, 0, propertyList[pro1], f2, 2) + local buff = Buff.Create(caster, BuffName.PropertyChange, 0, BattlePropList[pro1], f2, 2) buff.cover = true buff.maxLayer = i1 caster:AddBuff(buff) @@ -823,7 +823,7 @@ local effectList = { local d = args[2] caster.Event:DispatchEvent(BattleEventName.RoleViewBullet, skill, target) BattleLogic.WaitForTrigger(interval, function () - local v1 = BattleUtil.FP_Mul(caster:GetRoleData(propertyList[pro]), d) + local v1 = BattleUtil.FP_Mul(caster:GetRoleData(BattlePropList[pro]), d) local v2 = BattleUtil.FP_Mul(caster:GetRoleData(RoleDataName.Attack), 2.5) BattleUtil.ApplyDamage(skill, caster, target, floor(min(v1, v2))) end) @@ -966,8 +966,8 @@ local effectList = { local f2 = args[4] local ct = args[5] BattleLogic.WaitForTrigger(interval, function () - local val = floor(BattleUtil.FP_Mul(caster:GetRoleData(propertyList[pro1], f1))) - target:AddBuff(Buff.Create(caster, BuffName.PropertyChange, f2, propertyList[pro2], val, ct)) + local val = floor(BattleUtil.FP_Mul(caster:GetRoleData(BattlePropList[pro1], f1))) + target:AddBuff(Buff.Create(caster, BuffName.PropertyChange, f2, BattlePropList[pro2], val, ct)) end) end, --清除[a]状态 @@ -1023,7 +1023,7 @@ local effectList = { local pro1 = args[4] caster.Event:DispatchEvent(BattleEventName.RoleViewBullet, skill, target) BattleLogic.WaitForTrigger(interval, function () - local proTran1 = {proName = propertyList[pro1], tranProName = propertyList[pro1], tranFactor = f2, changeType = 4} + local proTran1 = {proName = BattlePropList[pro1], tranProName = BattlePropList[pro1], tranFactor = f2, changeType = 4} target.proTranList:Add(proTran1) BattleUtil.CalDamage(skill, caster, target, dt, f1) target.proTranList:Remove(target.proTranList.size) @@ -1263,7 +1263,7 @@ local effectList = { local f1 = args[1] local pro1 = args[2] BattleLogic.WaitForTrigger(interval, function () - local hp = min(floor(BattleUtil.FP_Mul(target:GetRoleData(propertyList[pro1]), f1)), target:GetRoleData(RoleDataName.Hp)-1) + local hp = min(floor(BattleUtil.FP_Mul(target:GetRoleData(BattlePropList[pro1]), f1)), target:GetRoleData(RoleDataName.Hp)-1) target.data:SubValue(RoleDataName.Hp, hp) end) end, @@ -1356,7 +1356,7 @@ local effectList = { local f1 = args[3] BattleLogic.WaitForTrigger(interval, function () BattleUtil.RandomAction(f2, function () - local val = floor(BattleUtil.FP_Mul(caster:GetRoleData(propertyList[pro1]), f1)) + local val = floor(BattleUtil.FP_Mul(caster:GetRoleData(BattlePropList[pro1]), f1)) BattleUtil.CalTreat(caster, target, val) end) end) @@ -1372,7 +1372,7 @@ local effectList = { local f3 = args[6] caster.Event:DispatchEvent(BattleEventName.RoleViewBullet, skill, target) BattleLogic.WaitForTrigger(interval, function () - local proTran = {proName = propertyList[pro1], tranProName = propertyList[pro1], tranFactor = f2, changeType = ct} + local proTran = {proName = BattlePropList[pro1], tranProName = BattlePropList[pro1], tranFactor = f2, changeType = ct} caster.proTranList:Add(proTran) BattleUtil.CalDamage(skill, caster, target, dt, f1) caster.proTranList:Remove(caster.proTranList.size) @@ -1484,7 +1484,7 @@ local effectList = { end return b end) - local val = floor(BattleUtil.FP_Mul(caster:GetRoleData(propertyList[pro1]), f1, 1+layer*f3)) + local val = floor(BattleUtil.FP_Mul(caster:GetRoleData(BattlePropList[pro1]), f1, 1+layer*f3)) local shield = Buff.Create(caster, BuffName.Shield, f2, ShieldTypeName.NormalReduce, val, 0) target:AddBuff(shield) @@ -1508,7 +1508,7 @@ local effectList = { BattleUtil.CalDamage(skill, caster, target, dt, f1) local OnBuffStart = function(buff) if buff.type == BuffName.Control then - local val = floor(BattleUtil.FP_Mul(buff.target:GetRoleData(propertyList[pro1]), f2)) + local val = floor(BattleUtil.FP_Mul(buff.target:GetRoleData(BattlePropList[pro1]), f2)) BattleUtil.CalTreat(buff.caster, buff.target, val) end end @@ -1582,7 +1582,7 @@ local effectList = { local f2 = args[3] local f3 = args[4] BattleLogic.WaitForTrigger(interval, function () - local val = floor(BattleUtil.FP_Mul(caster:GetRoleData(propertyList[pro1]), f1)) + local val = floor(BattleUtil.FP_Mul(caster:GetRoleData(BattlePropList[pro1]), f1)) local shield = Buff.Create(caster, BuffName.Shield, f2, ShieldTypeName.NormalReduce, val, 0) local OnBuffEnd = function(buff) if buff == shield and buff.roundPass < buff.roundDuration then --护盾被击破 @@ -1612,10 +1612,10 @@ local effectList = { local f4 = args[8] local ct2 = args[9] BattleLogic.WaitForTrigger(interval, function () - local val = floor(BattleUtil.FP_Mul(caster:GetRoleData(propertyList[pro1]), f1)) + local val = floor(BattleUtil.FP_Mul(caster:GetRoleData(BattlePropList[pro1]), f1)) local shield = Buff.Create(caster, BuffName.Shield, f2, ShieldTypeName.NormalReduce, val, 0) - local buff1 = Buff.Create(caster, BuffName.PropertyChange, f2, propertyList[pro2], f3, ct1) - local buff2 = Buff.Create(caster, BuffName.PropertyChange, f2, propertyList[pro3], f4, ct2) + local buff1 = Buff.Create(caster, BuffName.PropertyChange, f2, BattlePropList[pro2], f3, ct1) + local buff2 = Buff.Create(caster, BuffName.PropertyChange, f2, BattlePropList[pro3], f4, ct2) local OnBuffEnd = function(buff) if buff == shield and buff.roundPass < buff.roundDuration then --护盾被击破 @@ -1644,15 +1644,15 @@ local effectList = { BattleLogic.WaitForTrigger(interval, function () BattleUtil.RandomAction(f4, function () --计算上限值 - local total = caster.data:GetOrginData(propertyList[pro]) * (1 + f3) + local total = caster.data:GetOrginData(BattlePropList[pro]) * (1 + f3) --计算预期吸取后的值 - local targetValue = caster:GetRoleData(propertyList[pro]) + target:GetRoleData(propertyList[pro]) * f1 + local targetValue = caster:GetRoleData(BattlePropList[pro]) + target:GetRoleData(BattlePropList[pro]) * f1 --计算有效吸收值 - local delta = min(targetValue, total) - caster:GetRoleData(propertyList[pro]) + local delta = min(targetValue, total) - caster:GetRoleData(BattlePropList[pro]) if delta > 0 then - target:AddBuff(Buff.Create(caster, BuffName.PropertyChange, f2, propertyList[pro], delta, 3)) - caster:AddBuff(Buff.Create(caster, BuffName.PropertyChange, f2, propertyList[pro], delta, 1)) + target:AddBuff(Buff.Create(caster, BuffName.PropertyChange, f2, BattlePropList[pro], delta, 3)) + caster:AddBuff(Buff.Create(caster, BuffName.PropertyChange, f2, BattlePropList[pro], delta, 1)) end end) end) @@ -1710,7 +1710,7 @@ local effectList = { local f2 = args[4] local f3 = args[5] BattleLogic.WaitForTrigger(interval, function () - local val = floor(BattleUtil.FP_Mul(caster:GetRoleData(propertyList[pro1]), f1)) + local val = floor(BattleUtil.FP_Mul(caster:GetRoleData(BattlePropList[pro1]), f1)) buffRandomAction(f4, target, Buff.Create(caster, BuffName.HOT, f2, f2/f3, val)) end) end, @@ -1765,7 +1765,7 @@ local effectList = { BattleUtil.RandomAction(f3, function () local arr = BattleUtil.ChooseTarget(caster, 10001) if arr[1] then - arr[1]:AddBuff(Buff.Create(caster, BuffName.PropertyChange, f2, propertyList[pro1], f1, ct)) + arr[1]:AddBuff(Buff.Create(caster, BuffName.PropertyChange, f2, BattlePropList[pro1], f1, ct)) end end) end @@ -1904,10 +1904,12 @@ local effectList = { local i1 = args[3] local f2 = args[4] - local roleList =BattleLogic.Query(function (r) return r.camp == target.camp end) - local deadNum = 6 - #roleList - local level = math.floor(deadNum/i1) - local extra = level * f2 + 1 + -- 改变值 = 技能最大目标数 - 当前目标数 + local maxNum = skill:GetMaxTargetNum() + local curNum = #skill:GetDirectTargets() + local lessNum = max(maxNum - curNum, 0) + local level = math.floor(lessNum/i1) + local extra = BattleUtil.ErrorCorrection(level * f2) caster.Event:DispatchEvent(BattleEventName.RoleViewBullet, skill, target) BattleLogic.WaitForTrigger(interval, function () @@ -2082,7 +2084,7 @@ local effectList = { BattleLogic.WaitForTrigger(interval, function () local OnBeHit = function(atkRole, damage, bCrit, finalDmg, damageType) if target.isDead then - caster:AddBuff(Buff.Create(caster, BuffName.PropertyChange, 0, propertyList[pro1], f2, ct)) + caster:AddBuff(Buff.Create(caster, BuffName.PropertyChange, 0, BattlePropList[pro1], f2, ct)) end end target.Event:AddEvent(BattleEventName.RoleBeHit, OnBeHit) @@ -2103,7 +2105,7 @@ local effectList = { caster.Event:DispatchEvent(BattleEventName.RoleViewBullet, skill, target) BattleLogic.WaitForTrigger(interval, function () - local damage = BattleUtil.ErrorCorrection(f2 * caster:GetRoleData(propertyList[pro])) + local damage = BattleUtil.ErrorCorrection(f2 * caster:GetRoleData(BattlePropList[pro])) local buff = Buff.Create(caster, BuffName.DOT, i1, 1, dot, damage) buff.isRealDamage = true @@ -2121,7 +2123,7 @@ local effectList = { local i1 = args[3] local ct = args[4] BattleLogic.WaitForTrigger(interval, function () - caster:AddBuff(Buff.Create(caster, BuffName.PropertyChange, i1, propertyList[pro], f1, ct)) + caster:AddBuff(Buff.Create(caster, BuffName.PropertyChange, i1, BattlePropList[pro], f1, ct)) end) end, diff --git a/luafight/Modules/Battle/Logic/Base/Passivity.lua b/luafight/Modules/Battle/Logic/Base/Passivity.lua index 84c5a6e67..85a5e76d8 100644 --- a/luafight/Modules/Battle/Logic/Base/Passivity.lua +++ b/luafight/Modules/Battle/Logic/Base/Passivity.lua @@ -8,24 +8,24 @@ local min = math.min --local BuffName = BuffName --属性编号 -local propertyList = { - RoleDataName.Attack, - RoleDataName.PhysicalDefence, - RoleDataName.MagicDefence, - RoleDataName.Speed, - RoleDataName.DamageBocusFactor, - RoleDataName.DamageReduceFactor, - RoleDataName.Hit, - RoleDataName.Dodge, - RoleDataName.Crit, - RoleDataName.CritDamageFactor, - RoleDataName.TreatFacter, - RoleDataName.MaxHp, - RoleDataName.Hp, - RoleDataName.CureFacter, - RoleDataName.Tenacity, - RoleDataName.InitRage, -} +-- local BattlePropList = { +-- RoleDataName.Attack, +-- RoleDataName.PhysicalDefence, +-- RoleDataName.MagicDefence, +-- RoleDataName.Speed, +-- RoleDataName.DamageBocusFactor, +-- RoleDataName.DamageReduceFactor, +-- RoleDataName.Hit, +-- RoleDataName.Dodge, +-- RoleDataName.Crit, +-- RoleDataName.CritDamageFactor, +-- RoleDataName.TreatFacter, +-- RoleDataName.MaxHp, +-- RoleDataName.Hp, +-- RoleDataName.CureFacter, +-- RoleDataName.Tenacity, +-- RoleDataName.InitRage, +-- } --被动技能表 local passivityList = { @@ -43,7 +43,7 @@ local passivityList = { for i=1, skill.effectList.size do duration = max(duration, skill.effectList.buffer[i].duration) end - role:AddPropertyTransfer(propertyList[pro1], f2, propertyList[pro2], 2, duration + BattleLogic.GameDeltaTime * 2) + role:AddPropertyTransfer(BattlePropList[pro1], f2, BattlePropList[pro2], 2, duration + BattleLogic.GameDeltaTime * 2) end) end role.Event:AddEvent(BattleEventName.SkillCast, OnSkillCast) @@ -94,7 +94,7 @@ local passivityList = { local ct = args[4] local OnSkillCastEnd = function(skill) - role:AddBuff(Buff.Create(role, BuffName.PropertyChange, f2, propertyList[pro], f1, ct)) + role:AddBuff(Buff.Create(role, BuffName.PropertyChange, f2, BattlePropList[pro], f1, ct)) end role.Event:AddEvent(BattleEventName.SkillCastEnd, OnSkillCastEnd) end, @@ -111,7 +111,7 @@ local passivityList = { BattleUtil.RandomAction(f1, function () local arr = BattleUtil.ChooseTarget(role, 10321) if arr[1] then - local val = floor(BattleUtil.FP_Mul(f2, role:GetRoleData(propertyList[pro]))) + local val = floor(BattleUtil.FP_Mul(f2, role:GetRoleData(BattlePropList[pro]))) arr[1]:AddBuff(Buff.Create(role, BuffName.HOT, f3, 1, val)) end end) @@ -132,8 +132,8 @@ local passivityList = { BattleUtil.RandomAction(f1, function () local arr = BattleUtil.ChooseTarget(role, 10001) if arr[1] then - local val = floor(BattleUtil.FP_Mul(f2, role:GetRoleData(propertyList[pro1]))) - arr[1]:AddBuff(Buff.Create(role, BuffName.PropertyChange, f3, propertyList[pro2], val, 1)) + local val = floor(BattleUtil.FP_Mul(f2, role:GetRoleData(BattlePropList[pro1]))) + arr[1]:AddBuff(Buff.Create(role, BuffName.PropertyChange, f3, BattlePropList[pro2], val, 1)) end end) end @@ -163,7 +163,7 @@ local passivityList = { local OnBeHit = function(treatingFunc) BattleUtil.RandomAction(f1, function () - local val = floor(BattleUtil.FP_Mul(f2, role:GetRoleData(propertyList[pro]))) + local val = floor(BattleUtil.FP_Mul(f2, role:GetRoleData(BattlePropList[pro]))) BattleUtil.CalTreat(role, role, val) end) end @@ -208,7 +208,7 @@ local passivityList = { local OnRoleBeDamagedBefore = function(atkRole, func, damageType) if damageType == dt then BattleUtil.RandomAction(f1, function () - role:AddPropertyTransfer(propertyList[pro1], f2, propertyList[pro2], 2, BattleLogic.GameDeltaTime) + role:AddPropertyTransfer(BattlePropList[pro1], f2, BattlePropList[pro2], 2, BattleLogic.GameDeltaTime) end) end end @@ -224,7 +224,7 @@ local passivityList = { local OnPassiveDamaging = function(damagingFunc, atkRole, damage) BattleUtil.RandomAction(f1, function () - damagingFunc(floor(BattleUtil.FP_Mul(f2, role:GetRoleData(propertyList[pro])))) + damagingFunc(floor(BattleUtil.FP_Mul(f2, role:GetRoleData(BattlePropList[pro])))) end) end role.Event:AddEvent(BattleEventName.PassiveBeDamaging, OnPassiveDamaging) @@ -276,7 +276,7 @@ local passivityList = { BattleUtil.RandomAction(f1, function () local arr = BattleUtil.ChooseTarget(role, 20001) if arr[1] then - local val = floor(BattleUtil.FP_Mul(f2, role:GetRoleData(propertyList[pro]))) + local val = floor(BattleUtil.FP_Mul(f2, role:GetRoleData(BattlePropList[pro]))) BattleUtil.ApplyDamage(nil, role, arr[1], val) end end) @@ -298,7 +298,7 @@ local passivityList = { local OnBeHit = function(atkRole, damage, bCrit, finalDmg, damageType) if damageType == dt then BattleUtil.RandomAction(f1, function () - role:AddPropertyTransfer(propertyList[pro1], f2, propertyList[pro2], 2, f3) + role:AddPropertyTransfer(BattlePropList[pro1], f2, BattlePropList[pro2], 2, f3) end) end end @@ -337,7 +337,7 @@ local passivityList = { local OnSkillCastEnd = function(skill) BattleUtil.RandomAction(f1, function () - role:AddPropertyTransfer(propertyList[pro1], f2, propertyList[pro2], 2, f3) + role:AddPropertyTransfer(BattlePropList[pro1], f2, BattlePropList[pro2], 2, f3) end) end role.Event:AddEvent(BattleEventName.SkillCastEnd, OnSkillCastEnd) @@ -354,7 +354,7 @@ local passivityList = { local OnSkillCastEnd = function(skill) local arr = BattleUtil.ChooseTarget(role, 40000) if arr[1] then - arr[1]:AddBuff(Buff.Create(role, BuffName.PropertyChange, f2, propertyList[pro1], f1, ct)) + arr[1]:AddBuff(Buff.Create(role, BuffName.PropertyChange, f2, BattlePropList[pro1], f1, ct)) end end role.Event:AddEvent(BattleEventName.SkillCastEnd, OnSkillCastEnd) @@ -371,7 +371,7 @@ local passivityList = { local OnSkillCastEnd = function(skill) local arr = BattleUtil.ChooseTarget(role, 10000) for i=1, #arr do - arr[i]:AddBuff(Buff.Create(role, BuffName.PropertyChange, f2, propertyList[pro1], f1, ct)) + arr[i]:AddBuff(Buff.Create(role, BuffName.PropertyChange, f2, BattlePropList[pro1], f1, ct)) end end role.Event:AddEvent(BattleEventName.SkillCastEnd, OnSkillCastEnd) @@ -471,7 +471,7 @@ local passivityList = { local OnDead = function(atkRole) local arr = BattleUtil.ChooseTarget(role, 10000) for i=1, #arr do - local val = floor(BattleUtil.FP_Mul(f1, role:GetRoleData(propertyList[pro]))) + local val = floor(BattleUtil.FP_Mul(f1, role:GetRoleData(BattlePropList[pro]))) BattleUtil.CalTreat(role, arr[i], val) end end @@ -548,7 +548,7 @@ local passivityList = { local OnRoleCrit = function(defRole) BattleUtil.RandomAction(f1, function () - local val = floor(BattleUtil.FP_Mul(f2, role:GetRoleData(propertyList[pro]))) + local val = floor(BattleUtil.FP_Mul(f2, role:GetRoleData(BattlePropList[pro]))) BattleUtil.CalTreat(role, role, val) end) end @@ -594,7 +594,7 @@ local passivityList = { local OnSkillCastEnd = function(skill) local arr = BattleUtil.ChooseTarget(role, 20000) for i=1, #arr do - arr[i]:AddBuff(Buff.Create(role, BuffName.PropertyChange, f2, propertyList[pro], f1, ct)) + arr[i]:AddBuff(Buff.Create(role, BuffName.PropertyChange, f2, BattlePropList[pro], f1, ct)) end end role.Event:AddEvent(BattleEventName.SkillCastEnd, OnSkillCastEnd) @@ -627,7 +627,7 @@ local passivityList = { local OnBuffCaster = function(buff) if buff.type == BuffName.DOT then - role:AddBuff(Buff.Create(role, BuffName.PropertyChange, f2, propertyList[pro], f1, ct)) + role:AddBuff(Buff.Create(role, BuffName.PropertyChange, f2, BattlePropList[pro], f1, ct)) end end role.Event:AddEvent(BattleEventName.BuffCaster, OnBuffCaster) @@ -641,7 +641,7 @@ local passivityList = { local f2 = args[3] local ct = args[4] - role:AddBuff(Buff.Create(role, BuffName.PropertyChange, f2, propertyList[pro], f1, ct)) + role:AddBuff(Buff.Create(role, BuffName.PropertyChange, f2, BattlePropList[pro], f1, ct)) end, --造成伤害时,额外增加[a]点伤害。 @@ -677,7 +677,7 @@ local passivityList = { local f3 = args[5] BattleLogic.WaitForTrigger(f1, function () - role:AddBuff(Buff.Create(role, BuffName.PropertyChange, f3, propertyList[pro], f2, ct)) + role:AddBuff(Buff.Create(role, BuffName.PropertyChange, f3, BattlePropList[pro], f2, ct)) end) end, @@ -705,11 +705,11 @@ local passivityList = { local i1 = args[8] local auraBuff = Buff.Create(role, BuffName.Aura, 0, function (r) - local changeBuff1 = Buff.Create(r, BuffName.PropertyChange, 0, propertyList[pro1], f2, ct1) + local changeBuff1 = Buff.Create(r, BuffName.PropertyChange, 0, BattlePropList[pro1], f2, ct1) changeBuff1.cover = true changeBuff1.maxLayer = i1 - local changeBuff2 = Buff.Create(r, BuffName.PropertyChange, 0, propertyList[pro2], f3, ct2) + local changeBuff2 = Buff.Create(r, BuffName.PropertyChange, 0, BattlePropList[pro2], f3, ct2) changeBuff2.cover = true changeBuff2.maxLayer = i1 @@ -786,7 +786,7 @@ local passivityList = { local OnSkillCastEnd = function(skill) local arr = BattleUtil.ChooseTarget(role, 40000) if arr[1] then - local buff = Buff.Create(role, BuffName.PropertyChange, 0, propertyList[pro], f1, ct) + local buff = Buff.Create(role, BuffName.PropertyChange, 0, BattlePropList[pro], f1, ct) buff.cover = true buff.maxLayer = i1 arr[1]:AddBuff(buff) @@ -806,7 +806,7 @@ local passivityList = { local OnSkillCastEnd = function(skill) BattleUtil.RandomAction(f1, function () - role:AddBuff(Buff.Create(role, BuffName.PropertyChange, f3, propertyList[pro], f2, ct)) + role:AddBuff(Buff.Create(role, BuffName.PropertyChange, f3, BattlePropList[pro], f2, ct)) end) end role.Event:AddEvent(BattleEventName.SkillCastEnd, OnSkillCastEnd) @@ -846,13 +846,13 @@ local passivityList = { local ct = args[3] if ct == 1 then --加算 - role.data:AddValue(propertyList[pro], f1) + role.data:AddValue(BattlePropList[pro], f1) elseif ct == 2 then --乘加算(百分比属性加算) - role.data:AddPencentValue(propertyList[pro], f1) + role.data:AddPencentValue(BattlePropList[pro], f1) elseif ct == 3 then --减算 - role.data:SubValue(propertyList[pro], f1) + role.data:SubValue(BattlePropList[pro], f1) elseif ct == 4 then --乘减算(百分比属性减算) - role.data:SubPencentValue(propertyList[pro], f1) + role.data:SubPencentValue(BattlePropList[pro], f1) end end, @@ -867,23 +867,23 @@ local passivityList = { local ct2 = args[6] if ct == 1 then --加算 - role.data:AddValue(propertyList[pro], f1) + role.data:AddValue(BattlePropList[pro], f1) elseif ct == 2 then --乘加算(百分比属性加算) - role.data:AddPencentValue(propertyList[pro], f1) + role.data:AddPencentValue(BattlePropList[pro], f1) elseif ct == 3 then --减算 - role.data:SubValue(propertyList[pro], f1) + role.data:SubValue(BattlePropList[pro], f1) elseif ct == 4 then --乘减算(百分比属性减算) - role.data:SubPencentValue(propertyList[pro], f1) + role.data:SubPencentValue(BattlePropList[pro], f1) end if ct2 == 1 then --加算 - role.data:AddValue(propertyList[pro2], f2) + role.data:AddValue(BattlePropList[pro2], f2) elseif ct2 == 2 then --乘加算(百分比属性加算) - role.data:AddPencentValue(propertyList[pro2], f2) + role.data:AddPencentValue(BattlePropList[pro2], f2) elseif ct2 == 3 then --减算 - role.data:SubValue(propertyList[pro2], f2) + role.data:SubValue(BattlePropList[pro2], f2) elseif ct2 == 4 then --乘减算(百分比属性减算) - role.data:SubPencentValue(propertyList[pro2], f2) + role.data:SubPencentValue(BattlePropList[pro2], f2) end end, @@ -900,7 +900,7 @@ local passivityList = { BattleUtil.RandomAction(f1, function () local arr = BattleUtil.ChooseTarget(role, 20000) for i=1, #arr do - arr[i]:AddBuff(Buff.Create(role, BuffName.PropertyChange, f3, propertyList[pro], f2, ct)) + arr[i]:AddBuff(Buff.Create(role, BuffName.PropertyChange, f3, BattlePropList[pro], f2, ct)) end end) end @@ -1167,7 +1167,7 @@ local passivityList = { BattleUtil.RandomAction(f1, function () local list = BattleLogic.GetNeighbor(role, 1) for i=1, #list do - local val = floor(BattleUtil.FP_Mul(role:GetRoleData(propertyList[pro]), f2)) + local val = floor(BattleUtil.FP_Mul(role:GetRoleData(BattlePropList[pro]), f2)) list[i]:AddBuff(Buff.Create(role, BuffName.Shield, f3, ShieldTypeName.NormalReduce, val, 0)) end end) @@ -1187,7 +1187,7 @@ local passivityList = { if skill.owner.camp == role.camp then if BattleLogic.BuffMgr:HasBuff(role, BuffName.Shield, function (buff) return true end) then BattleUtil.RandomAction(f1, function () - local val = floor(BattleUtil.FP_Mul(role:GetRoleData(propertyList[pro1]), f2)) + local val = floor(BattleUtil.FP_Mul(role:GetRoleData(BattlePropList[pro1]), f2)) BattleUtil.CalTreat(role, skill.owner, val) end) end @@ -1268,7 +1268,7 @@ local passivityList = { local OnBeHit = function(atkRole, damage, bCrit, finalDmg, damageType) BattleUtil.RandomAction(f1, function () - local val = floor(BattleUtil.FP_Mul(role:GetRoleData(propertyList[pro1]), f2)) + local val = floor(BattleUtil.FP_Mul(role:GetRoleData(BattlePropList[pro1]), f2)) role:AddBuff(Buff.Create(role, BuffName.Shield, f3, ShieldTypeName.NormalReduce, val, 0)) end) end @@ -1309,7 +1309,7 @@ local passivityList = { local f2 = args[3] local OnKill = function(defRole) - local buff = Buff.Create(role, BuffName.PropertyChange, f2, propertyList[pro], f1, 2) + local buff = Buff.Create(role, BuffName.PropertyChange, f2, BattlePropList[pro], f1, 2) buff.cover = true buff.clear = false role:AddBuff(buff) @@ -1387,7 +1387,7 @@ local passivityList = { local OnDead = function(atkRole) local arr = BattleUtil.ChooseTarget(role, 10000) for i=1, #arr do - arr[i]:AddBuff(Buff.Create(role, BuffName.PropertyChange, f2, propertyList[pro], f1, 2)) + arr[i]:AddBuff(Buff.Create(role, BuffName.PropertyChange, f2, BattlePropList[pro], f1, 2)) end end role.Event:AddEvent(BattleEventName.RoleDead, OnDead) @@ -1412,17 +1412,17 @@ local passivityList = { count = count + 1 end if count > 0 then - local buff1 = Buff.Create(role, BuffName.PropertyChange, 0, propertyList[1], i2 * count, 1) + local buff1 = Buff.Create(role, BuffName.PropertyChange, 0, BattlePropList[1], i2 * count, 1) buff1.cover = true buff1.layer = count buff1.clear = false - local buff2 = Buff.Create(role, BuffName.PropertyChange, 0, propertyList[2], i3 * count, 1) + local buff2 = Buff.Create(role, BuffName.PropertyChange, 0, BattlePropList[2], i3 * count, 1) buff2.cover = true buff2.layer = count buff2.clear = false - local buff3 = Buff.Create(role, BuffName.PropertyChange, 0, propertyList[3], i4 * count, 1) + local buff3 = Buff.Create(role, BuffName.PropertyChange, 0, BattlePropList[3], i4 * count, 1) buff3.cover = true buff3.layer = count buff3.clear = false @@ -1444,13 +1444,13 @@ local passivityList = { if role.roleData.professionId == i1 then if ct == 1 then --加算 - role.data:AddValue(propertyList[pro], f1) + role.data:AddValue(BattlePropList[pro], f1) elseif ct == 2 then --乘加算(百分比属性加算) - role.data:AddPencentValue(propertyList[pro], f1) + role.data:AddPencentValue(BattlePropList[pro], f1) elseif ct == 3 then --减算 - role.data:SubValue(propertyList[pro], f1) + role.data:SubValue(BattlePropList[pro], f1) elseif ct == 4 then --乘减算(百分比属性减算) - role.data:SubPencentValue(propertyList[pro], f1) + role.data:SubPencentValue(BattlePropList[pro], f1) end end end, @@ -1461,7 +1461,7 @@ local passivityList = { local f1 = args[2] local f2 = args[3] - local val = floor(BattleUtil.FP_Mul(f1, role:GetRoleData(propertyList[pro1]))) + local val = floor(BattleUtil.FP_Mul(f1, role:GetRoleData(BattlePropList[pro1]))) role:AddBuff(Buff.Create(role, BuffName.Shield, f2, ShieldTypeName.NormalReduce, val, 0)) end, --战斗开始时,为自身回复[a]*[b]的血量。 @@ -1470,7 +1470,7 @@ local passivityList = { local pro = args[1] local f1 = args[2] - local val = floor(BattleUtil.FP_Mul(f1, role:GetRoleData(propertyList[pro]))) + local val = floor(BattleUtil.FP_Mul(f1, role:GetRoleData(BattlePropList[pro]))) BattleUtil.CalTreat(role, role, val) end, --战斗结束时,为自身回复[a]*[b]的血量。 @@ -1481,7 +1481,7 @@ local passivityList = { local OnEnd = function(order) if order == BattleLogic.TotalOrder then - local val = floor(BattleUtil.FP_Mul(f1, role:GetRoleData(propertyList[pro]))) + local val = floor(BattleUtil.FP_Mul(f1, role:GetRoleData(BattlePropList[pro]))) BattleUtil.CalTreat(role, role, val) end end @@ -1497,13 +1497,13 @@ local passivityList = { if role.roleData.element == i1 then if ct == 1 then --加算 - role.data:AddValue(propertyList[pro], f1) + role.data:AddValue(BattlePropList[pro], f1) elseif ct == 2 then --乘加算(百分比属性加算) - role.data:AddPencentValue(propertyList[pro], f1) + role.data:AddPencentValue(BattlePropList[pro], f1) elseif ct == 3 then --减算 - role.data:SubValue(propertyList[pro], f1) + role.data:SubValue(BattlePropList[pro], f1) elseif ct == 4 then --乘减算(百分比属性减算) - role.data:SubPencentValue(propertyList[pro], f1) + role.data:SubPencentValue(BattlePropList[pro], f1) end end end, @@ -1515,7 +1515,7 @@ local passivityList = { local pro = args[1] local f1 = args[2] local ct = args[3] - role.data:CountValue(propertyList[pro], f1, ct) + role.data:CountValue(BattlePropList[pro], f1, ct) end, -- 技能伤害增加[a]%,[b]改变 @@ -1549,7 +1549,7 @@ local passivityList = { local i1 = args[1] local OnRoleHit = function(defRole) - -- local buff = Buff.Create(role, BuffName.PropertyChange, 0, propertyList[pro], i1, 1) + -- local buff = Buff.Create(role, BuffName.PropertyChange, 0, BattlePropList[pro], i1, 1) -- buff.cover = true -- 可以叠加 -- buff.clear = false -- 不可驱散 -- role:AddBuff(buff) @@ -1590,7 +1590,7 @@ local passivityList = { local ct = args[3] local list = BattleLogic.Query(function(v) return role.camp == v.camp end) for _, r in pairs(list) do - r.data:CountValue(propertyList[pro], f1, ct) + r.data:CountValue(BattlePropList[pro], f1, ct) end end, @@ -1749,7 +1749,7 @@ local passivityList = { -- 释放技能后 local onRoleHit = function(defRole) if defRole.isDead then - local buff = Buff.Create(role, BuffName.PropertyChange, 0, propertyList[pro], f1, ct) + local buff = Buff.Create(role, BuffName.PropertyChange, 0, BattlePropList[pro], f1, ct) -- buff.cover = true role:AddBuff(buff) end @@ -1812,7 +1812,7 @@ local passivityList = { local onBeHit = function(caster, damage) local list = BattleLogic.Query(function(v) return v.camp == role.camp end) - list = BattleUtil.SortByProp(list, propertyList[pro], 1) + list = BattleUtil.SortByProp(list, BattlePropList[pro], 1) for i = 1, i1 do local r = list[i] if r and not r.isDead then @@ -2071,7 +2071,7 @@ local passivityList = { -- 释放技能后 local onSkillEnd = function(skill) if skill.type == BattleSkillType.Normal then - local buff = Buff.Create(role, BuffName.PropertyChange, i1, propertyList[pro], f1, ct) + local buff = Buff.Create(role, BuffName.PropertyChange, i1, BattlePropList[pro], f1, ct) buff.cover = true role:AddBuff(buff) end @@ -2122,7 +2122,7 @@ local passivityList = { local list = BattleLogic.Query(function(v) return v.camp == role.camp and v.position <= 3 end) for _, role in ipairs(list) do BattleLogic.BuffMgr:QueryBuff(role, function(buff) - if buff.type == BuffName.Shield and buff.ShieldType == ShieldTypeName.RateReduce then + if buff.type == BuffName.Shield and buff.shieldType == ShieldTypeName.RateReduce then buff:ChangeBuffDuration(ct, i1) end end) @@ -2145,7 +2145,9 @@ local passivityList = { local list = BattleLogic.Query(function(v) return v.camp == role.camp and v.position <= 3 end) for _, role in ipairs(list) do BattleLogic.BuffMgr:QueryBuff(role, function(buff) - if buff.type == BuffName.Shield and buff.ShieldType == ShieldTypeName.RateReduce then + Log(tostring(buff.type == BuffName.Shield)) + Log(tostring(buff.ShieldType == ShieldTypeName.RateReduce)) + if buff.type == BuffName.Shield and buff.shieldType == ShieldTypeName.RateReduce then buff:ChangeShieldValue(ct, f1) end end) @@ -2193,15 +2195,17 @@ local passivityList = { local dt = args[3] local f2 = args[4] - local levelDamage = floor(role:GetRoleData(RoleDataName.MaxHp)*f1) - local curDamage = 0 + local curLevel = 0 -- 释放技能后 local onRoleBeDamaged = function(caster, damage) - curDamage = curDamage + damage - if curDamage >= levelDamage then - curDamage = curDamage - levelDamage - local buff = Buff.Create(role, BuffName.PropertyChange, 0, propertyList[pro], f2, dt) + local levelDamage = floor(role:GetRoleData(RoleDataName.MaxHp)*f1) + local lostDamage = role:GetRoleData(RoleDataName.MaxHp) - role:GetRoleData(RoleDataName.Hp) + local level = floor(lostDamage/levelDamage) + if level > curLevel then + local dl = level - curLevel + local buff = Buff.Create(role, BuffName.PropertyChange, 0, BattlePropList[pro], f2*dl, dt) role:AddBuff(buff) + curLevel = level end end role.Event:AddEvent(BattleEventName.RoleBeDamaged, onRoleBeDamaged) @@ -2260,7 +2264,7 @@ local passivityList = { if deadNum >= i1 then deadNum = 0 extra = extra + f1 - -- local buff = Buff.Create(role, BuffName.PropertyChange, 0, propertyList[pro], f1, ct2) + -- local buff = Buff.Create(role, BuffName.PropertyChange, 0, BattlePropList[pro], f1, ct2) -- role:AddBuff(buff) end end @@ -2332,7 +2336,7 @@ local passivityList = { local index, tran local OnRoleDamageBefore = function(target) if BattleLogic.BuffMgr:HasBuff(target, BuffName.DOT, function(buff) return buff.damageType == dot end) then - index, tran = role:AddPropertyTransfer(propertyList[pro], f1, propertyList[pro], ct) + index, tran = role:AddPropertyTransfer(BattlePropList[pro], f1, BattlePropList[pro], ct) end end local OnRoleDamageAfter = function() @@ -2508,10 +2512,26 @@ local passivityList = { role.Event:AddEvent(BattleEventName.PassiveBeDamaging, onPassiveBeDamaging) end, - -- TODO 无敌盾未实现 + -- 战斗第[a]回合无敌 -- a[int] - -- [141] = {}, + [141] = function(role, args) + local i1 = args[1] + local buff + BattleLogic.Event:AddEvent(BattleEventName.BattleRoundChange, function(curRound) + -- 第i1回合开始 + if curRound == i1 then + buff = Buff.Create(role, BuffName.Shield, 0, ShieldTypeName.AllReduce, 0, 0) + buff.clear = false + role:AddBuff(buff) + end + if curRound == i1 + 1 then + if buff then + buff.disperse = true + end + end + end) + end, -- 释放技能时如目标处于[a]状态则伤害的[b]%转化为生命治疗自己 @@ -2589,7 +2609,7 @@ local passivityList = { local OnRoleDamageBefore = function(target, factorFunc, damageType, skill) if skill and skill.type == BattleSkillType.Special and BattleLogic.BuffMgr:HasBuff(target, BuffName.DOT, function(buff) return buff.damageType == dot end) then - index, tran = role:AddPropertyTransfer(propertyList[pro], f1, propertyList[pro], ct) + index, tran = role:AddPropertyTransfer(BattlePropList[pro], f1, BattlePropList[pro], ct) end end local OnRoleDamageAfter = function() @@ -2824,7 +2844,7 @@ local passivityList = { local onSkillCastEnd = function(skill) if skill.type == BattleSkillType.Special then local list = BattleLogic.Query(function(v) return v.camp == role.camp end) - list = table.sort(list, function(a, b) + table.sort(list, function(a, b) return a.position < b.position end) for i= 1, #list do @@ -2840,10 +2860,26 @@ local passivityList = { - -- TODO - -- 每回合(不累加)[a]伤害[b]改变[c]% + -- [a]伤害[b]改变[c]%(技能效果111专属被动) -- a[持续伤害状态]b[改变类型]c[float] - -- [159] + [159] = function(role, args) + local dot = args[1] + local ct = args[2] + local f1 = args[3] + + local onSkillEffectBefore = function(skill, e, func) + if skill.type == BattleSkillType.Special then + if e.type == 111 then -- 当前只对技能效果103生效 + if e.args[2] == dot then + local factor = BattleUtil.ErrorCorrection(BattleUtil.CountValue(e.args[3], f1, ct)) + e.args[3] = factor + if func then func(e) end + end + end + end + end + role.Event:AddEvent(BattleEventName.SkillEffectBefore, onSkillEffectBefore) + end, -- 受到普攻是有[a]%概率给攻击者附加[b],每回合对目标造成自身攻击的[c]%伤害,持续[d]回合 @@ -2871,8 +2907,26 @@ local passivityList = { - -- 无165 - -- [165] + -- 战斗中生命每减少[a]%,自身伤害就[b]改变[c]%,减少为[d]改变 + -- a[float]b[改变类型]c[float]d[改变类型] + [165] = function(role, args) + local f1 = args[1] + local ct = args[2] + local f2 = args[3] + local ct2 = args[4] + + -- 释放技能后 + local onPassiveDamaging = function(damagingFunc, defRole, damage, skill) + local levelDamage = floor(role:GetRoleData(RoleDataName.MaxHp)*f1) + local lostDamage = role:GetRoleData(RoleDataName.MaxHp) - role:GetRoleData(RoleDataName.Hp) + local level = floor(lostDamage/levelDamage) + + local dd = BattleUtil.CountValue(damage, f2*level, ct) - damage + damagingFunc(-floor(BattleUtil.ErrorCorrection(dd))) + + end + role.Event:AddEvent(BattleEventName.PassiveDamaging, onPassiveDamaging) + end, -- 普通攻击时如目标处于[a]状态则伤害的[b]%转化为生命治疗自己 -- a[持续伤害状态]b[float] @@ -2945,7 +2999,7 @@ local passivityList = { local pro = args[2] -- 行动结束后 local onTurnEnd = function() - local buff = Buff.Create(role, BuffName.PropertyChange, 0, propertyList[pro], f1, CountTypeName.AddPencent) + local buff = Buff.Create(role, BuffName.PropertyChange, 0, BattlePropList[pro], f1, CountTypeName.AddPencent) role:AddBuff(buff) end role.Event:AddEvent(BattleEventName.RoleTurnEnd, onTurnEnd) @@ -2994,5 +3048,32 @@ local passivityList = { role.Event:AddEvent(BattleEventName.SkillEffectBefore, onSkillEffectBefore) end, + + -- 释放技能有[a]%几率对敌方后排造成[b]%[c]伤害 + -- a[float]b[float]c[伤害类型] + [207] = function(role, args) + + local f1 = args[1] + local f2 = args[2] + local dt = args[3] + -- 释放技能后 + local onSkillEnd = function(skill) + if skill.type == BattleSkillType.Special then + BattleUtil.RandomAction(f1, function() + BattleLogic.WaitForTrigger(0.1, function() + local list = BattleLogic.Query(function(v) + return v.camp == (role.camp + 1) % 2 and v.position > 3 + end) + for _, r in ipairs(list) do + BattleUtil.CalDamage(nil, role, r, dt, f2) + end + end) + end) + end + end + role.Event:AddEvent(BattleEventName.SkillCastEnd, onSkillEnd) + + end, + } return passivityList diff --git a/luafight/Modules/Battle/Logic/BattleLogic.lua b/luafight/Modules/Battle/Logic/BattleLogic.lua index 477745b2d..a33d96e59 100644 --- a/luafight/Modules/Battle/Logic/BattleLogic.lua +++ b/luafight/Modules/Battle/Logic/BattleLogic.lua @@ -284,6 +284,19 @@ function BattleLogic.TurnRound(debugTurn) return end + + -- 如果角色无法释放技能 + if not SkillRole:IsAvailable() then + BattleLogic.BuffMgr:TurnUpdate(1) -- 计算恢复血量 + BattleLogic.BuffMgr:TurnUpdate(2) -- 计算持续伤害(除去流血) + BattleLogic.BuffMgr:TurnUpdate(3) -- 计算持续伤害(流血) + BattleLogic.BuffMgr:TurnUpdate(4) -- 计算其他buff + BattleLogic.BuffMgr:PassUpdate() -- 计算buff轮数 + BattleLogic.TurnRoundNextFrame() -- 下一个 + return + end + + -- 行动 SkillRole.Event:DispatchEvent(BattleEventName.RoleTurnStart) -- 开始行动 BattleLogic.BuffMgr:TurnUpdate(1) -- 计算恢复血量 BattleLogic.BuffMgr:TurnUpdate(2) -- 计算持续伤害(除去流血) diff --git a/luafight/Modules/Battle/Logic/Buff/Brand.lua b/luafight/Modules/Battle/Logic/Buff/Brand.lua index 8a9e1889e..ebffd24d3 100644 --- a/luafight/Modules/Battle/Logic/Buff/Brand.lua +++ b/luafight/Modules/Battle/Logic/Buff/Brand.lua @@ -49,4 +49,8 @@ function Brand:OnCover(newBuff) return b end +-- 比较buff +function Brand:OnCompare(buff) + return buff.flag == self.flag +end return Brand diff --git a/luafight/Modules/Battle/Logic/Buff/Control.lua b/luafight/Modules/Battle/Logic/Buff/Control.lua index 20194708e..6aea8e25c 100644 --- a/luafight/Modules/Battle/Logic/Buff/Control.lua +++ b/luafight/Modules/Battle/Logic/Buff/Control.lua @@ -61,4 +61,10 @@ function Control:OnCover(newBuff) return newBuff.ctrlType == self.ctrlType end +-- 比较buff +function Control:OnCompare(buff) + return self.ctrlType == buff.ctrlType +end + + return Control diff --git a/luafight/Modules/Battle/Logic/Buff/DOT.lua b/luafight/Modules/Battle/Logic/Buff/DOT.lua index 5ecb9f43b..8bfdde234 100644 --- a/luafight/Modules/Battle/Logic/Buff/DOT.lua +++ b/luafight/Modules/Battle/Logic/Buff/DOT.lua @@ -56,4 +56,9 @@ function DOT:OnCover(newBuff) return true end +-- 比较buff +function DOT:OnCompare(buff) + return buff.damageType == self.damageType +end + return DOT diff --git a/luafight/Modules/Battle/Logic/Buff/Immune.lua b/luafight/Modules/Battle/Logic/Buff/Immune.lua index 8c09f5a0e..0504e3e9f 100644 --- a/luafight/Modules/Battle/Logic/Buff/Immune.lua +++ b/luafight/Modules/Battle/Logic/Buff/Immune.lua @@ -64,4 +64,9 @@ function Immune:OnCover(newBuff) return true end +-- 比较buff +function Immune:OnCompare(buff) + return buff.immuneType == self.immuneType +end + return Immune diff --git a/luafight/Modules/Battle/Logic/Buff/PropertyChange.lua b/luafight/Modules/Battle/Logic/Buff/PropertyChange.lua index 7485ed21e..7a4f342bf 100644 --- a/luafight/Modules/Battle/Logic/Buff/PropertyChange.lua +++ b/luafight/Modules/Battle/Logic/Buff/PropertyChange.lua @@ -73,4 +73,9 @@ function PropertyChange:OnCover(newBuff) return b end +-- 比较buff +function PropertyChange:OnCompare(buff) + return self.changeType == buff.changeType and self.propertyName == buff.propertyName +end + return PropertyChange diff --git a/luafight/Modules/Battle/Logic/Buff/Shield.lua b/luafight/Modules/Battle/Logic/Buff/Shield.lua index 10abac4a9..ad599bc20 100644 --- a/luafight/Modules/Battle/Logic/Buff/Shield.lua +++ b/luafight/Modules/Battle/Logic/Buff/Shield.lua @@ -122,4 +122,9 @@ function Shield:OnCover(newBuff) return true end +-- 比较buff +function Shield:OnCompare(buff) + return self.shieldType == buff.shieldType +end + return Shield diff --git a/luafight/Modules/Battle/Logic/Misc/BattleDefine.lua b/luafight/Modules/Battle/Logic/Misc/BattleDefine.lua index 2b148d8e7..122d1be64 100644 --- a/luafight/Modules/Battle/Logic/Misc/BattleDefine.lua +++ b/luafight/Modules/Battle/Logic/Misc/BattleDefine.lua @@ -147,4 +147,25 @@ ShieldTypeName = { NormalReduce = 1, -- 固定值减伤 RateReduce = 2, -- 百分比减伤 AllReduce = 3, -- 无敌护盾 +} + + +-- 战斗表属性id对应战斗中属性数据 +BattlePropList = { + RoleDataName.Attack, + RoleDataName.PhysicalDefence, + RoleDataName.MagicDefence, + RoleDataName.Speed, + RoleDataName.DamageBocusFactor, + RoleDataName.DamageReduceFactor, + RoleDataName.Hit, + RoleDataName.Dodge, + RoleDataName.Crit, + RoleDataName.CritDamageFactor, + RoleDataName.TreatFacter, + RoleDataName.MaxHp, + RoleDataName.Hp, + RoleDataName.CureFacter, + RoleDataName.Tenacity, + RoleDataName.InitRage, } \ No newline at end of file