战斗同步

back_recharge
lvxinran 2020-11-27 16:52:55 +08:00
parent 44a241b52c
commit 0494ff83f2
13 changed files with 592 additions and 155 deletions

View File

@ -2271,7 +2271,7 @@ local effectList = {
BattleUtil.FinalDamage(skill, caster, target, damage, nil, 0, nil, true) BattleUtil.FinalDamage(skill, caster, target, damage, nil, 0, nil, true)
end) end)
end, end,
--瞬间恢复[a]*[b]%生命 --瞬间恢复目标[a]*[b]%生命
--a[属性],b[float] --a[属性],b[float]
[119] = function(caster, target, args, interval, skill) [119] = function(caster, target, args, interval, skill)
local pro1 = args[1] local pro1 = args[1]
@ -2282,6 +2282,8 @@ local effectList = {
end) end)
end, end,
} }
return effectList return effectList

View File

@ -50,7 +50,6 @@ local passivityList = {
local pro1 = args[2] local pro1 = args[2]
local f2 = args[3] local f2 = args[3]
local pro2 = args[4] local pro2 = args[4]
local OnSkillCast = function(skill) local OnSkillCast = function(skill)
BattleUtil.RandomAction(f1, function () BattleUtil.RandomAction(f1, function ()
local duration = 0 local duration = 0
@ -664,7 +663,7 @@ local passivityList = {
local OnPassiveDamaging = function(damagingFunc) local OnPassiveDamaging = function(damagingFunc)
damagingFunc(-f1) damagingFunc(-f1)
end end
role.Event:AddEvent(BattleEventName.PassiveDamaging, OnPassiveDamaging) role.Event:AddEvent(BattleEventName.PassiveDamiaging, OnPassiveDamaging)
end, end,
--进入战斗[a]秒后,造成的伤害提升[b],持续[c]秒 --进入战斗[a]秒后,造成的伤害提升[b],持续[c]秒
@ -1479,7 +1478,6 @@ local passivityList = {
[78] = function(role, args) [78] = function(role, args)
local pro = args[1] local pro = args[1]
local f1 = args[2] local f1 = args[2]
LogBattle("开始治疗")
--这里加一个延时,防止执行时显示层还没有初始化,从而没有表现 --这里加一个延时,防止执行时显示层还没有初始化,从而没有表现
BattleLogic.WaitForTrigger(0.05, function() BattleLogic.WaitForTrigger(0.05, function()
local val = floor(BattleUtil.FP_Mul(f1, role:GetRoleData(BattlePropList[pro]))) local val = floor(BattleUtil.FP_Mul(f1, role:GetRoleData(BattlePropList[pro])))
@ -1533,11 +1531,15 @@ local passivityList = {
-- 技能伤害增加[a]%[b]改变 -- 技能伤害增加[a]%[b]改变
-- a[float]b[改变类型] -- a[float]b[改变类型]
[91] = function(role, args) [91] = function(role, args,id,judge)
local f1 = args[1] local f1 = args[1]
local ct = args[2] local ct = args[2]
local passivityDamaging = function(func, caster, damage) local passivityDamaging = function(func, caster, damage,skill, dotType, bCrit)
if func then --处理伏虎觉醒十星附加的额外技能,额外技能不触发这个特性 2020/11/17 wangzhenxing
if skill and skill.type== BattleSkillType.Extra and skill.owner.roleId==10015 and judge==1 then
return
end
if func and skill and (skill.type == BattleSkillType.Special or skill.type == BattleSkillType.Extra) then
local dd = BattleUtil.CountValue(damage, f1, ct) - damage local dd = BattleUtil.CountValue(damage, f1, ct) - damage
func(-floor(BattleUtil.ErrorCorrection(dd))) func(-floor(BattleUtil.ErrorCorrection(dd)))
end end
@ -1706,7 +1708,7 @@ local passivityList = {
local arr = RoleManager.Query(function (r) return r.camp == role.camp end) local arr = RoleManager.Query(function (r) return r.camp == role.camp end)
BattleUtil.SortByHpFactor(arr, 1) BattleUtil.SortByHpFactor(arr, 1)
-- 检测技能伤害疗加成 -- 检测技能伤害<EFBFBD><EFBFBD><EFBFBD>疗加成
local f = BattleUtil.CheckSkillDamageHeal(f1, role, arr[1]) local f = BattleUtil.CheckSkillDamageHeal(f1, role, arr[1])
-- 治疗血量最低队友实际伤害的f1% -- 治疗血量最低队友实际伤害的f1%
BattleUtil.ApplyTreat(role, arr[1], floor(BattleUtil.ErrorCorrection(allDamage*f))) BattleUtil.ApplyTreat(role, arr[1], floor(BattleUtil.ErrorCorrection(allDamage*f)))
@ -1910,7 +1912,8 @@ local passivityList = {
[109] = function(role, args) [109] = function(role, args)
local i1 = args[1] local i1 = args[1]
local onBeSkillCastEnd = function(skill) local onBeSkillCastEnd = function(skill)
if skill.type == BattleSkillType.Normal then --同阵营普工加血不触发被动
if skill.type == BattleSkillType.Normal and skill.owner and skill.owner.camp~=role.camp then
role:AddRage(i1, CountTypeName.Add) role:AddRage(i1, CountTypeName.Add)
end end
end end
@ -1952,13 +1955,17 @@ local passivityList = {
-- 战斗第[a]回合造成伤害必定暴击 -- 战斗第[a]回合造成伤害必定暴击
-- a[int] -- a[int]
[112] = function(role, args) [112] = function(role, args,id,judge)
local i1 = args[1] local i1 = args[1]
local function onRoleDamageAfter(target) local function onRoleDamageAfter(target)
target.isFlagCrit = false target.isFlagCrit = false
role.Event:RemoveEvent(BattleEventName.RoleDamageAfter, onRoleDamageAfter) role.Event:RemoveEvent(BattleEventName.RoleDamageAfter, onRoleDamageAfter)
end end
local function onRoleDamageBefore(target) local function onRoleDamageBefore(target, factorFunc, damageType, skill)
--处理伏虎觉醒十星附加的额外技能,额外技能不触发这个特性 2020/11/17 wangzhenxing
if skill and skill.type== BattleSkillType.Extra and skill.owner.roleId==10015 and judge==1 then
return
end
if BattleLogic.GetCurRound() == i1 then if BattleLogic.GetCurRound() == i1 then
target.isFlagCrit = true target.isFlagCrit = true
role.Event:AddEvent(BattleEventName.RoleDamageAfter, onRoleDamageAfter) role.Event:AddEvent(BattleEventName.RoleDamageAfter, onRoleDamageAfter)
@ -2005,7 +2012,7 @@ local passivityList = {
-- 战斗第[a]回合增加[c]%的自身伤害持续[e]回合,[f]改变 -- 战斗第[a]回合增加[c]%的自身伤害持续[e]回合,[f]改变
-- a[int]c[float]e[int]f[改变] -- a[int]c[float]e[int]f[改变]
[115] = function(role, args) [115] = function(role, args,id,judge)
local i1 = args[1] local i1 = args[1]
local f1 = args[2] local f1 = args[2]
local i2 = args[3] or 1 local i2 = args[3] or 1
@ -2013,7 +2020,11 @@ local passivityList = {
-- 如果是技能的伤害则判断加成 -- 如果是技能的伤害则判断加成
local onPassiveDamaging = function(func, target, damage, skill) local onPassiveDamaging = function(func, target, damage, skill)
if skill then --处理伏虎觉醒十星附加的额外技能,额外技能不触发这个特性 2020/11/17 wangzhenxing
if skill and skill.type== BattleSkillType.Extra and skill.owner.roleId==10015 and judge==1 then
return
end
if skill and skill.type==BattleSkillType.Special then
local dd = BattleUtil.CountValue(damage, f1, ct) - damage local dd = BattleUtil.CountValue(damage, f1, ct) - damage
if func then func(-floor(BattleUtil.ErrorCorrection(dd))) end if func then func(-floor(BattleUtil.ErrorCorrection(dd))) end
end end
@ -2495,7 +2506,8 @@ local passivityList = {
-- 普攻后 -- 普攻后
local onSkillEnd = function(skill) local onSkillEnd = function(skill)
if skill.type == BattleSkillType.Normal then --己方普攻不会触发被动
if skill.type == BattleSkillType.Normal and skill.owner and skill.owner.camp~=role.camp then
local caster = skill.owner local caster = skill.owner
local attack = role:GetRoleData(RoleDataName.Attack) local attack = role:GetRoleData(RoleDataName.Attack)
local damage = floor(BattleUtil.ErrorCorrection(attack * 0.2)) local damage = floor(BattleUtil.ErrorCorrection(attack * 0.2))
@ -2518,7 +2530,6 @@ local passivityList = {
local list = skill:GetDirectTargetsNoMiss() local list = skill:GetDirectTargetsNoMiss()
if list then if list then
local tv = floor(BattleUtil.ErrorCorrection(role:GetRoleData(BattlePropList[pro]) * f1)) local tv = floor(BattleUtil.ErrorCorrection(role:GetRoleData(BattlePropList[pro]) * f1))
LogBattle(role:GetRoleData(pro).." ".. f1.." " .. tv)
for _, r in ipairs(list) do for _, r in ipairs(list) do
local auraBuff = Buff.Create(role, BuffName.HOT, i1, 1, tv) local auraBuff = Buff.Create(role, BuffName.HOT, i1, 1, tv)
auraBuff.interval = 1 auraBuff.interval = 1
@ -2542,7 +2553,6 @@ local passivityList = {
local list = skill:GetDirectTargetsNoMiss() local list = skill:GetDirectTargetsNoMiss()
if list then if list then
local tv = floor(BattleUtil.ErrorCorrection(role:GetRoleData(BattlePropList[pro]) * f1)) local tv = floor(BattleUtil.ErrorCorrection(role:GetRoleData(BattlePropList[pro]) * f1))
LogBattle(role:GetRoleData(pro).." ".. f1.." " .. tv)
for _, r in ipairs(list) do for _, r in ipairs(list) do
local auraBuff = Buff.Create(role, BuffName.HOT, i1, 1, tv) local auraBuff = Buff.Create(role, BuffName.HOT, i1, 1, tv)
auraBuff.interval = 1 auraBuff.interval = 1
@ -2747,14 +2757,13 @@ local passivityList = {
-- 技能后后 -- 技能后后
local onRoleBeHit = function(caster) local onRoleBeHit = function(caster)
local attack = role:GetRoleData(RoleDataName.Attack) local attack = role:GetRoleData(RoleDataName.Attack)
local damage = floor(BattleUtil.ErrorCorrection(attack * 0.2)) local damage = floor(BattleUtil.ErrorCorrection(attack * 0.2))
BattleUtil.RandomDot(f1, dot, role, caster, i1, 1, damage) BattleUtil.RandomDot(f1, dot, role, caster, i1, 1, damage)
end end
role.Event:AddEvent(BattleEventName.RoleBeHit, onRoleBeHit) role.Event:AddEvent(BattleEventName.RoleBeHit, onRoleBeHit)
end, end,
-- 直接伤害击杀[a]目标回复[b]%的最大生命 -- 直接伤害击杀[a]目标回复[b]%的最大生命
-- a[持续伤害状态]b[float] -- a[持续伤害状态]b[float]
[148] = function(role, args) [148] = function(role, args)
@ -3025,7 +3034,7 @@ local passivityList = {
-- 技能后后 -- 技能后后
local onBeSkillCastEnd = function(skill) local onBeSkillCastEnd = function(skill)
if skill.type == BattleSkillType.Normal then if skill.type == BattleSkillType.Normal and skill.owner and skill.owner.camp~=role.camp then
local attack = role:GetRoleData(RoleDataName.Attack) local attack = role:GetRoleData(RoleDataName.Attack)
local damage = floor(BattleUtil.ErrorCorrection(attack * f2)) local damage = floor(BattleUtil.ErrorCorrection(attack * f2))
BattleUtil.RandomDot(f1, dot, role, skill.owner, i1, 1, damage) BattleUtil.RandomDot(f1, dot, role, skill.owner, i1, 1, damage)
@ -3613,8 +3622,8 @@ local passivityList = {
table.insert(cl, {v, ct}) table.insert(cl, {v, ct})
end end
end end
role.Event:DispatchEvent(BattleEventName.PassiveDamageShare, _CallBack) role.Event:DispatchEvent(BattleEventName.PassiveDamageShare, _CallBack,skill)
atkRole.Event:DispatchEvent(BattleEventName.PassiveDamageBeShare, _CallBack) atkRole.Event:DispatchEvent(BattleEventName.PassiveDamageBeShare, _CallBack,skill)
ff = BattleUtil.CountChangeList(ff, cl) ff = BattleUtil.CountChangeList(ff, cl)
-- 计算分摊伤害 -- 计算分摊伤害
@ -3791,29 +3800,49 @@ local passivityList = {
local immune = function(buff) local immune = function(buff)
return buff.type == BuffName.Control and (BattleUtil.ChecklistIsContainValue(ctrls,buff.ctrlType)) return buff.type == BuffName.Control and (BattleUtil.ChecklistIsContainValue(ctrls,buff.ctrlType))
end end
local curBuff=nil
BattleLogic.Event:AddEvent(BattleEventName.BattleRoundChange, function(curRound) BattleLogic.Event:AddEvent(BattleEventName.BattleRoundChange, function(curRound)
-- 第i1回合开始 -- 第i1回合开始
if curRound == 1 then if curRound == 1 then
role.buffFilter:Add(immune) -- role.buffFilter:Add(immune)
curBuff=Buff.Create(role, BuffName.Immune, 1,4,immune)
role:AddBuff(curBuff)
end end
-- 第i1+i2回合结束 -- 第i1+i2回合结束
if curRound == 2 then if curRound == 2 then
for i = 1, role.buffFilter.size do -- for i = 1, role.buffFilter.size do
if role.buffFilter.buffer[i] == immune then -- if role.buffFilter.buffer[i] == immune then
role.buffFilter:Remove(i) -- role.buffFilter:Remove(i)
break -- break
end -- end
-- end
if curBuff then
BattleLogic.BuffMgr:ClearBuff(role, function (buff)
return buff==curBuff
end)
end end
end end
end) end)
end, end,
-- 对敌方造成伤害如被分摊其分摊比降低[a]% -- 对敌方造成伤害如被分摊其分摊比降低[a]%
-- a[float] -- a[float]
[196] = function(role, args) [196] = function(role, args,id,judge)
local f1 = args[1] local f1 = args[1]
local onDamageBeShare = function(func) local type = args[2]
local onDamageBeShare = function(func,skill)
--普攻不会被降低分摊 2020/11/17 wangzhenxing lihaiyang
if type==1 and skill and skill.type~=BattleSkillType.Normal then
return
end
if type==2 and skill and skill.type~=BattleSkillType.Special and skill.type~=BattleSkillType.Extra 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 func then func(f1, CountTypeName.Sub) end if func then func(f1, CountTypeName.Sub) end
end end
role.Event:AddEvent(BattleEventName.PassiveDamageBeShare, onDamageBeShare) role.Event:AddEvent(BattleEventName.PassiveDamageBeShare, onDamageBeShare)
@ -3888,7 +3917,18 @@ local passivityList = {
local onFinalDamage = function(damagingFunc, atkRole, defRole, damage, skill, dotType, bCrit, damageType) local onFinalDamage = function(damagingFunc, atkRole, defRole, damage, skill, dotType, bCrit, damageType)
if not role:IsDead() and skill and role.position ~= defRole.position and defRole.camp == role.camp and defRole.element == role.element then if not role:IsDead() and skill and role.position ~= defRole.position and defRole.camp == role.camp and defRole.element == role.element then
local shareDamage = floor(BattleUtil.ErrorCorrection(damage * f1)) local ff = 1 -- 分摊比
-- 检测被动对分摊比的影响
local cl = {}
local function _CallBack(v, ct)
if v then
table.insert(cl, {v, ct})
end
end
role.Event:DispatchEvent(BattleEventName.PassiveDamageShare, _CallBack,skill)
atkRole.Event:DispatchEvent(BattleEventName.PassiveDamageBeShare, _CallBack,skill)
ff = BattleUtil.CountChangeList(ff, cl)
local shareDamage = floor(BattleUtil.ErrorCorrection(damage * f1*ff))
-- 被攻击武将自身伤害 -- 被攻击武将自身伤害
if damagingFunc then if damagingFunc then
damagingFunc(shareDamage) damagingFunc(shareDamage)
@ -4009,8 +4049,6 @@ local passivityList = {
role.Event:AddEvent(BattleEventName.PassiveDamaging, passivityDamaging) role.Event:AddEvent(BattleEventName.PassiveDamaging, passivityDamaging)
end, end,
--技能治疗系数[a]改变[b]%(作用于主动技能效果103) --技能治疗系数[a]改变[b]%(作用于主动技能效果103)
--a[改变类型]b[float] --a[改变类型]b[float]
[206] = function(role, args) [206] = function(role, args)
@ -4029,7 +4067,6 @@ local passivityList = {
role.Event:AddEvent(BattleEventName.SkillEffectBefore, onSkillEffectBefore) role.Event:AddEvent(BattleEventName.SkillEffectBefore, onSkillEffectBefore)
end, end,
-- 释放技能有[a]%几率对敌方后排造成[b]%[c]伤害 -- 释放技能有[a]%几率对敌方后排造成[b]%[c]伤害
-- a[float]b[float]c[伤害类型] -- a[float]b[float]c[伤害类型]
[207] = function(role, args) [207] = function(role, args)
@ -4793,18 +4830,18 @@ local passivityList = {
end, end,
-- (直接伤害(目前没有明确定义直接伤害))直接伤害击杀目标自身增加[a]点怒气 重写92被动效果 每次释放技能只触发一次 -- (直接伤害(目前没有明确定义直接伤害))直接伤害击杀目标自身增加[a]点怒气 重写92被动效果 每次释放技能只触发一次
-- a[int] -- a[int]
[245] = function(role, args) [245] = function(role, args,id)
local i1 = args[1] local i1 = args[1]
local OnRoleHit = function(defRole, damage, bCrit, finalDmg, damageType, skill) local OnRoleHit = function(defRole, damage, bCrit, finalDmg, damageType, skill)
--如果是技能并且这个被动已经被触发过 return --如果是技能并且这个被动已经被触发过 return
if skill and BattleUtil.ChecklistIsContainValue(skill.triggerPassivityId,245) then if skill and BattleUtil.ChecklistIsContainValue(skill.triggerPassivityId,id) then
return return
end end
if skill and not skill.isAdd and defRole:IsDead() and not BattleUtil.CheckIsNoDead(defRole) then if skill and not skill.isAdd and defRole:IsDead() and not BattleUtil.CheckIsNoDead(defRole) then
role:AddRage(i1, CountTypeName.Add) role:AddRage(i1, CountTypeName.Add)
if skill then if skill then
-- skill.isTriggePassivity=true -- skill.isTriggePassivity=true
table.insert(skill.triggerPassivityId,245) table.insert(skill.triggerPassivityId,id)
end end
end end
end end
@ -4813,14 +4850,14 @@ local passivityList = {
-- 直接伤害每次击杀目标增加[a]%的[b]可叠加持续至战斗结束[c]改变 重写103效果 每次释放技能只触发一次 -- 直接伤害每次击杀目标增加[a]%的[b]可叠加持续至战斗结束[c]改变 重写103效果 每次释放技能只触发一次
-- a[float]b[属性]c[改变类型] -- a[float]b[属性]c[改变类型]
[246] = function(role, args) [246] = function(role, args,id)
local f1 = args[1] local f1 = args[1]
local pro = args[2] local pro = args[2]
local ct = args[3] local ct = args[3]
-- 释放技能后 -- 释放技能后
local onRoleHit = function(defRole, damage, bCrit, finalDmg, damageType, skill) local onRoleHit = function(defRole, damage, bCrit, finalDmg, damageType, skill)
--如果是技能并且这个被动已经被触发过 return --如果是技能并且这个被动已经被触发过 return
if skill and BattleUtil.ChecklistIsContainValue(skill.triggerPassivityId,246) then if skill and BattleUtil.ChecklistIsContainValue(skill.triggerPassivityId,id) then
return return
end end
if defRole:IsDead() and not BattleUtil.CheckIsNoDead(defRole) then if defRole:IsDead() and not BattleUtil.CheckIsNoDead(defRole) then
@ -4829,7 +4866,7 @@ local passivityList = {
role:AddBuff(buff) role:AddBuff(buff)
if skill then if skill then
--skill.isTriggePassivity=true --skill.isTriggePassivity=true
table.insert(skill.triggerPassivityId,246) table.insert(skill.triggerPassivityId,id)
end end
end end
end end
@ -4837,12 +4874,12 @@ local passivityList = {
end, end,
-- 直接伤害击杀目标后追加[a]次普攻 重写114 一次技能只触发一次被动 -- 直接伤害击杀目标后追加[a]次普攻 重写114 一次技能只触发一次被动
-- a[int] -- a[int]
[247] = function(role, args) [247] = function(role, args,id)
local i1 = args[1] local i1 = args[1]
-- 释放技能后 -- 释放技能后
local onRoleHit = function(target,damage, bCrit, finalDmg, damageType, skill) local onRoleHit = function(target,damage, bCrit, finalDmg, damageType, skill)
--如果是技能并且这个被动已经被触发过 return --如果是技能并且这个被动已经被触发过 return
if skill and BattleUtil.ChecklistIsContainValue(skill.triggerPassivityId,247) then if skill and BattleUtil.ChecklistIsContainValue(skill.triggerPassivityId,id) then
return return
end end
if target:IsDead() and not BattleUtil.CheckIsNoDead(target) then if target:IsDead() and not BattleUtil.CheckIsNoDead(target) then
@ -4851,7 +4888,7 @@ local passivityList = {
end end
if skill then if skill then
-- skill.isTriggePassivity=true -- skill.isTriggePassivity=true
table.insert(skill.triggerPassivityId,247) table.insert(skill.triggerPassivityId,id)
end end
end end
end end
@ -4860,12 +4897,12 @@ local passivityList = {
-- 直接伤害击杀目标回复自身[a]%的[b] 重写116 一次技能只触发一次被动 -- 直接伤害击杀目标回复自身[a]%的[b] 重写116 一次技能只触发一次被动
-- a[float] -- a[float]
[248] = function(role, args) [248] = function(role, args,id)
local f1 = args[1] local f1 = args[1]
-- 释放技能后 -- 释放技能后
local onRoleHit = function(target,damage, bCrit, finalDmg, damageType, skill) local onRoleHit = function(target,damage, bCrit, finalDmg, damageType, skill)
--如果是技能并且这个被动已经被触发过 return --如果是技能并且这个被动已经被触发过 return
if skill and BattleUtil.ChecklistIsContainValue(skill.triggerPassivityId,248) then if skill and BattleUtil.ChecklistIsContainValue(skill.triggerPassivityId,id) then
return return
end end
if target:IsDead() and not BattleUtil.CheckIsNoDead(target) then if target:IsDead() and not BattleUtil.CheckIsNoDead(target) then
@ -4873,7 +4910,7 @@ local passivityList = {
BattleUtil.CalTreat(role, role, treat) BattleUtil.CalTreat(role, role, treat)
if skill then if skill then
-- skill.isTriggePassivity=true -- skill.isTriggePassivity=true
table.insert(skill.triggerPassivityId,248) table.insert(skill.triggerPassivityId,id)
end end
end end
end end
@ -4882,12 +4919,12 @@ local passivityList = {
-- 直接伤害击杀目标下回合攻击[a]%暴击(TODO:目前为增加[a]%) 重写125 一次技能只触发一次被动 -- 直接伤害击杀目标下回合攻击[a]%暴击(TODO:目前为增加[a]%) 重写125 一次技能只触发一次被动
-- a[float] -- a[float]
[249] = function(role, args) [249] = function(role, args,id)
local f1 = args[1] local f1 = args[1]
-- 释放技能后 -- 释放技能后
local onRoleHit = function(target,damage, bCrit, finalDmg, damageType, skill) local onRoleHit = function(target,damage, bCrit, finalDmg, damageType, skill)
--如果是技能并且这个被动已经被触发过 return --如果是技能并且这个被动已经被触发过 return
if skill and BattleUtil.ChecklistIsContainValue(skill.triggerPassivityId,249) then if skill and BattleUtil.ChecklistIsContainValue(skill.triggerPassivityId,id) then
return return
end end
if target:IsDead() and not BattleUtil.CheckIsNoDead(target) then if target:IsDead() and not BattleUtil.CheckIsNoDead(target) then
@ -4895,7 +4932,7 @@ local passivityList = {
role:AddBuff(buff) role:AddBuff(buff)
if skill then if skill then
--skill.isTriggePassivity=true --skill.isTriggePassivity=true
table.insert(skill.triggerPassivityId,249) table.insert(skill.triggerPassivityId,id)
end end
end end
end end
@ -4904,7 +4941,7 @@ local passivityList = {
-- 直接伤害每次击杀目标增加自身伤害[a]%[b]改变,可叠加持续至战斗结束 重写132 一次技能只触发一次被动 -- 直接伤害每次击杀目标增加自身伤害[a]%[b]改变,可叠加持续至战斗结束 重写132 一次技能只触发一次被动
-- a[float]b[改变类型] -- a[float]b[改变类型]
[250] = function(role, args) [250] = function(role, args,id)
local f1 = args[1] local f1 = args[1]
local ct = args[2] local ct = args[2]
@ -4914,14 +4951,14 @@ local passivityList = {
-- 击杀数量累加 -- 击杀数量累加
local OnRoleHit = function(defRole, damage, bCrit, finalDmg, damageType, skill) local OnRoleHit = function(defRole, damage, bCrit, finalDmg, damageType, skill)
--如果是技能并且这个被动已经被触发过 return --如果是技能并且这个被动已经被触发过 return
if skill and BattleUtil.ChecklistIsContainValue(skill.triggerPassivityId,250) then if skill and BattleUtil.ChecklistIsContainValue(skill.triggerPassivityId,id) then
return return
end end
if skill and defRole:IsDead() and not BattleUtil.CheckIsNoDead(defRole) then if skill and defRole:IsDead() and not BattleUtil.CheckIsNoDead(defRole) then
killNum = killNum + 1 killNum = killNum + 1
if skill then if skill then
--skill.isTriggePassivity=true --skill.isTriggePassivity=true
table.insert(skill.triggerPassivityId,250) table.insert(skill.triggerPassivityId,id)
end end
end end
end end
@ -4950,12 +4987,12 @@ local passivityList = {
-- 直接伤害击杀[a]目标回复[b]%的最大生命 重写148 一次技能只触发一次被动 -- 直接伤害击杀[a]目标回复[b]%的最大生命 重写148 一次技能只触发一次被动
-- a[持续伤害状态]b[float] -- a[持续伤害状态]b[float]
[251] = function(role, args) [251] = function(role, args,id)
local dot = args[1] local dot = args[1]
local f1 = args[2] local f1 = args[2]
local function onHit(target, damage, bCrit, finalDmg, damageType, skill) local function onHit(target, damage, bCrit, finalDmg, damageType, skill)
--如果是技能并且这个被动已经被触发过 return --如果是技能并且这个被动已经被触发过 return
if skill and BattleUtil.ChecklistIsContainValue(skill.triggerPassivityId,251) then if skill and BattleUtil.ChecklistIsContainValue(skill.triggerPassivityId,id) then
return return
end end
if target:IsDead() and not BattleUtil.CheckIsNoDead(target) then if target:IsDead() and not BattleUtil.CheckIsNoDead(target) then
@ -4964,7 +5001,7 @@ local passivityList = {
BattleUtil.ApplyTreat(role, role, value) BattleUtil.ApplyTreat(role, role, value)
if skill then if skill then
--skill.isTriggePassivity=true --skill.isTriggePassivity=true
table.insert(skill.triggerPassivityId,251) table.insert(skill.triggerPassivityId,id)
end end
end end
role.Event:RemoveEvent(BattleEventName.RoleHit, onHit) role.Event:RemoveEvent(BattleEventName.RoleHit, onHit)
@ -4979,18 +5016,18 @@ local passivityList = {
-- 直接伤害击杀目标回复自身[a]点怒气 重写153 一次技能只触发一次被动 -- 直接伤害击杀目标回复自身[a]点怒气 重写153 一次技能只触发一次被动
-- a[int] -- a[int]
[252] = function(role, args) [252] = function(role, args,id)
local i1 = args[1] local i1 = args[1]
local onHit = function(target, damage, bCrit, finalDmg,damageType,skill) local onHit = function(target, damage, bCrit, finalDmg,damageType,skill)
--如果是技能并且这个被动已经被触发过 return --如果是技能并且这个被动已经被触发过 return
if skill and BattleUtil.ChecklistIsContainValue(skill.triggerPassivityId,252) then if skill and BattleUtil.ChecklistIsContainValue(skill.triggerPassivityId,id) then
return return
end end
if target:IsDead() and not BattleUtil.CheckIsNoDead(target) then if target:IsDead() and not BattleUtil.CheckIsNoDead(target) then
role:AddRage(i1, CountTypeName.Add) role:AddRage(i1, CountTypeName.Add)
if skill then if skill then
--skill.isTriggePassivity=true --skill.isTriggePassivity=true
table.insert(skill.triggerPassivityId,252) table.insert(skill.triggerPassivityId,id)
end end
end end
end end
@ -4999,13 +5036,13 @@ local passivityList = {
-- 击杀目标后对敌方血量百分比最低两名角色造成[a]%[b]伤害 重写170 一次技能只触发一次被动 -- 击杀目标后对敌方血量百分比最低两名角色造成[a]%[b]伤害 重写170 一次技能只触发一次被动
-- a[float]b[伤害类型] -- a[float]b[伤害类型]
[253] = function(role, args) [253] = function(role, args,id)
local f1 = args[1] local f1 = args[1]
local dt = args[2] local dt = args[2]
-- 直接伤害后 -- 直接伤害后
local onRoleHit = function(target, damage, bCrit, finalDmg, damageType, skill) local onRoleHit = function(target, damage, bCrit, finalDmg, damageType, skill)
--如果是技能并且这个被动已经被触发 return --如果是技能并且这个被动已经被触发<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> return
if skill and BattleUtil.ChecklistIsContainValue(skill.triggerPassivityId,253) then if skill and BattleUtil.ChecklistIsContainValue(skill.triggerPassivityId,id) then
return return
end end
if skill and not skill.isAdd and target:IsDead() and not BattleUtil.CheckIsNoDead(target) then if skill and not skill.isAdd and target:IsDead() and not BattleUtil.CheckIsNoDead(target) then
@ -5020,7 +5057,7 @@ local passivityList = {
end end
if skill then if skill then
--skill.isTriggePassivity=true --skill.isTriggePassivity=true
table.insert(skill.triggerPassivityId,253) table.insert(skill.triggerPassivityId,id)
end end
end end
end end
@ -5029,11 +5066,11 @@ local passivityList = {
-- 直接伤害击杀目标对仇恨目标造成[a]%物理伤害 重写185 一次技能只触发一次被动 -- 直接伤害击杀目标对仇恨目标造成[a]%物理伤害 重写185 一次技能只触发一次被动
-- a[float] -- a[float]
[254] = function(role, args) [254] = function(role, args,id)
local f1 = args[1] local f1 = args[1]
local onRoleHit = function(target,damage, bCrit, finalDmg, damageType, skill) local onRoleHit = function(target,damage, bCrit, finalDmg, damageType, skill)
--如果是技能并且这个被动已经被触发过 return --如果是技能并且这个被动已经被触发过 return
if skill and BattleUtil.ChecklistIsContainValue(skill.triggerPassivityId,254) then if skill and BattleUtil.ChecklistIsContainValue(skill.triggerPassivityId,id) then
return return
end end
if target:IsDead() and not BattleUtil.CheckIsNoDead(target) then if target:IsDead() and not BattleUtil.CheckIsNoDead(target) then
@ -5041,7 +5078,7 @@ local passivityList = {
BattleUtil.CalDamage(nil, role, target, 1, f1) BattleUtil.CalDamage(nil, role, target, 1, f1)
if skill then if skill then
--skill.isTriggePassivity=true --skill.isTriggePassivity=true
table.insert(skill.triggerPassivityId,254) table.insert(skill.triggerPassivityId,id)
end end
end end
end end
@ -5050,11 +5087,11 @@ local passivityList = {
-- 技能直接击杀敌方目标时有[a]%概率获得目标剩余所有怒气输出武将佩戴重写197 一次技能只触发一次被动 -- 技能直接击杀敌方目标时有[a]%概率获得目标剩余所有怒气输出武将佩戴重写197 一次技能只触发一次被动
-- a[float] -- a[float]
[255] = function(role, args) [255] = function(role, args,id)
local f1 = args[1] local f1 = args[1]
local onRoleHit = function(target, damage, bCrit, finalDmg, damageType, skill) local onRoleHit = function(target, damage, bCrit, finalDmg, damageType, skill)
--如果是技能并且这个被动已经被触发过 return --如果是技能并且这个被动已经被触发过 return
if skill and BattleUtil.ChecklistIsContainValue(skill.triggerPassivityId,255) then if skill and BattleUtil.ChecklistIsContainValue(skill.triggerPassivityId,id) then
return return
end end
if skill and skill.type == BattleSkillType.Special and target:IsDead() and not BattleUtil.CheckIsNoDead(target) then if skill and skill.type == BattleSkillType.Special and target:IsDead() and not BattleUtil.CheckIsNoDead(target) then
@ -5062,7 +5099,7 @@ local passivityList = {
role:AddRage(target.Rage, CountTypeName.Add) role:AddRage(target.Rage, CountTypeName.Add)
if skill then if skill then
--skill.isTriggePassivity=true --skill.isTriggePassivity=true
table.insert(skill.triggerPassivityId,255) table.insert(skill.triggerPassivityId,id)
end end
end) end)
end end
@ -5072,12 +5109,16 @@ local passivityList = {
-- 直接伤害击杀目标释放[a]技能。 重新243 一次技能只触发一次被动 -- 直接伤害击杀目标释放[a]技能。 重新243 一次技能只触发一次被动
-- a[float] -- a[float]
[256] = function(role, args) [256] = function(role, args,id,judge)
local f1 = args[1] local f1 = args[1]
local f2=args[2] local f2=args[2]
local onRoleHit = function(target, damage, bCrit, finalDmg, damageType, skill) local onRoleHit = function(target, damage, bCrit, finalDmg, damageType, skill)
--如果是技能并且这个被动已经被触发过 return --如果是技能并且这个被动已经被触发过 return
if skill and BattleUtil.ChecklistIsContainValue(skill.triggerPassivityId,256) then 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 return
end end
if target:IsDead() and not BattleUtil.CheckIsNoDead(target) and not role:IsDead() then if target:IsDead() and not BattleUtil.CheckIsNoDead(target) and not role:IsDead() then
@ -5087,11 +5128,343 @@ local passivityList = {
role:InsertExtraSkill(f1,f2) role:InsertExtraSkill(f1,f2)
if skill then if skill then
--skill.isTriggePassivity=true --skill.isTriggePassivity=true
table.insert(skill.triggerPassivityId,256) table.insert(skill.triggerPassivityId,id)
end end
end end
end end
role.Event:AddEvent(BattleEventName.RoleHit, onRoleHit) role.Event:AddEvent(BattleEventName.RoleHit, onRoleHit)
end, end,
--技能击杀目标溢出伤害的[a]%将对生命百分比最高的攻击目标造成伤害
-- a[float]
[257]=function(role,args)
local f1 = args[1]
local dt = args[2]
local point=nil
-- 直接伤害后
local onRoleHit = function(target, damage, bCrit, finalDmg, damageType, skill)
if skill and skill.owner==role and (skill.type == BattleSkillType.Special or skill.type==BattleSkillType.Extra) and target:IsDead() and not BattleUtil.CheckIsNoDead(target) then
local dmg= floor(BattleUtil.ErrorCorrection((damage-finalDmg)*f1))
local list = RoleManager.Query(function(v) return v.camp ~= role.camp end)
list = BattleUtil.SortByHpFactor(list,0)
-- if not list[1]:IsDead() then
if list then
if not point then
point=list[1]
end
BattleUtil.ApplyDamage(nil,role,point,dmg)
end
-- end
end
end
role.Event:AddEvent(BattleEventName.RoleHit, onRoleHit)
end,
--技能追加的普攻额外造成目标[a][b]%的伤害。
--a[int 属性id] b[float]
[258]=function(role,args)
local f1 = args[1]
local dt = args[2]
-- 直接伤害后
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
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)
end,
-- 释放技能[a][b]%概率命中(必定命中舔100%或200%)
-- a[int], b[float]
[259] = function(role, args)
local pro = args[1]
local f1 = args[2]
local function onSkillCast(skill)
if skill.type ~= BattleSkillType.Normal then
role.data:AddValue(BattlePropList[pro], f1)
end
end
role.Event:AddEvent(BattleEventName.SkillCast, onSkillCast)
local function onSkillCastEnd(skill)
if skill.type ~= BattleSkillType.Normal then
role.data:SubValue(BattlePropList[pro], f1)
end
end
role.Event:AddEvent(BattleEventName.SkillCastEnd, onSkillCastEnd)
end,
--释放技能时,如果目标怒气不足[a]点,技能伤害额外[b] [c]%
-- a[int,怒气值]b[改变类型]c[float]
[260]=function(role,args)
local anger = args[1]
local type = args[2]
local v1 = args[3]
local onPassiveDamaging = function(func, defRole, damage,skill)
--怒气小于规定值
if defRole.Rage>=anger then
return
end
if skill and skill.type~=BattleSkillType.Monster and skill.type~=BattleSkillType.Normal and skill.owner==role then
local dmgDeduction = damage - floor(BattleUtil.ErrorCorrection(BattleUtil.CountValue(damage,v1,type)))
if func then func(dmgDeduction) end
end
end
role.Event:AddEvent(BattleEventName.PassiveDamaging, onPassiveDamaging)
end,
--本次技能中如果有[a]目标,额外回复[b]点怒气
-- a[持续伤害状态]b[int]
[261]=function(role,args)
local dot=args[1]
local i1 = args[2]--defRole, damage, bCrit, finalDmg, damageType, skill
local OnRoleHit = function(skill)
-- if skill and skill.owner==role and (skill.type==BattleSkillType.Special or skill.type==BattleSkillType.Extra) and role.camp~=defRole.camp and defRole and BattleLogic.BuffMgr:HasBuff(defRole, BuffName.DOT, function(buff) return buff.damageType == dot end) then
-- role:AddRage(i1, CountTypeName.Add)
--end
if skill and skill.owner==role and (skill.type==BattleSkillType.Special or skill.type==BattleSkillType.Extra) and skill 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.DOT, function(buff) return buff.damageType == 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, CountTypeName.Add)
end
end
end
role.Event:AddEvent(BattleEventName.SkillCastEnd, OnRoleHit)
end,
-- 每释放[a]次技能,[b]增加[c]%,可叠加[d]次
-- a[int] b[int] c[float] d[int]
[262] = function(role, args)
local num = args[1]
local pro = args[2]
local val = args[3]
local time = args[4]
local releaseNum=0
local addNum=0
-- 释放技能后
local onSkillEnd = function(skill)
if skill and skill.owner==role and (skill.type == BattleSkillType.Special or skill.type == BattleSkillType.Extra ) then
releaseNum=releaseNum+1
--如果能被限制次数整除 and 小于最大叠加次数
if releaseNum>0 and releaseNum%num==0 and addNum<time then
role.data:AddValue(BattlePropList[pro],val)
addNum=addNum+1
end
end
end
role.Event:AddEvent(BattleEventName.SkillCastEnd, onSkillEnd)
end,
--第[a]回合技能命中前有[b]%概率清除对方目标的免疫控制效果(所有控制效果)的护盾(表现上为护盾,清除护盾为直接清除效果)
--a[int] b[float]
[263]=function(role,args)
local round=args[1]
local pro=args[2]
local onRoleDamageBefore=function(defRole, factorFunc, damageType, skill)
--判断是否是规定回合
if BattleLogic.GetCurRound() ~= round then
return
end
if defRole and defRole.camp~=role.camp and skill.owner==role and (skill.type==BattleSkillType.Special or skill.type==BattleSkillType.Extra) then
BattleUtil.RandomAction(pro, function()
BattleLogic.BuffMgr:ClearBuff(defRole, function(buff)
return buff.type == BuffName.Immune and (buff.immuneType == 4 or buff.immuneType == 2)
end)
end)
end
end
role.Event:AddEvent(BattleEventName.RoleDamageBefore,onRoleDamageBefore)
end,
--释放技能时,如果目标怒气大于[a]点,额外降低目标[b]点怒气
--a[int] b[int]
[264]= function(role,args)
local v1 = args[1]
local v2 = args[2]
local onFinalBeDamage = function(damagingFunc, defRole, damage, skill)
if defRole.Rage<=v1 then
return
end
if skill and skill.owner==role and defRole.camp~=role.camp and skill.type~=BattleSkillType.Monster and skill.type~=BattleSkillType.Normal then
defRole:AddRage(v2,CountTypeName.Sub)
end
end
role.Event:AddEvent(BattleEventName.FinalDamage,onFinalBeDamage)
end,
--受技能攻击时有[a]%概率给攻击者及周围没有[b]状态的敌方武将附加[c]状态,造成自身[d] [e]% 的伤害持续[f]回合
-- a[float] b[持续伤害类型] c[持续伤害类型] d[int] e[float] f[int]
[265] = function(role,args)
local pro=args[1]
local state1=args[2]
local state2=args[3]
local pro1=args[4]
local v1 = args[5]
local time= args[6]
local onFinalBeDamage = function(damagingFunc, atkRole, damage, skill)
--受到敌方技能攻击
if atkRole.camp~=role.camp and skill and skill.type~=BattleSkillType.Monster and skill.type~=BattleSkillType.Normal then
BattleUtil.RandomAction(pro, function ()
local list = RoleManager.GetNeighbor(atkRole, 1)
-- table.insert(list,defRole)
for i=1, #list do
--如果目标身上没有灼烧效果
if not BattleLogic.BuffMgr:HasBuff(list[i], BuffName.DOT, function (buff) return buff.type== BuffName.DOT and buff.damageType==state1 end) then
local damage = BattleUtil.ErrorCorrection(v1 * role:GetRoleData(BattlePropList[pro1]))
BattleUtil.RandomDot(1, state2, role, list[i], time, 1, floor(damage))
end
end
end)
end
end
role.Event:AddEvent(BattleEventName.FinalBeDamage,onFinalBeDamage)
end,
--攻击时伤害增加(我方每个存活的其他[a]元素武将伤害增加[b]%
--a[int] b[float]
[266] = function(role,args)
local ele=args[1]
local v1=args[2]
local passiveBeBeDamage=function(damagingFunc, defRole, damage, skill)
if not skill then
return
end
local list = RoleManager.Query(function(v) return role.camp == v.camp end)
local num=0
for _, r in pairs(list) do
if r~=role and r.element==ele and not r:IsDead() then
num=num+1
end
end
if damagingFunc then
local dd = BattleUtil.CountValue(damage,v1*num,2)-damage
damagingFunc(-floor(BattleUtil.ErrorCorrection(dd)))
end
end
role.Event:AddEvent(BattleEventName.PassiveDamaging,passiveBeBeDamage)
end,
--技能击中受到[a,控制效果]的目标,会额外降低[b]点怒气
-- a[int 控制效果]b[int]
[267]=function(role,args)
local dot=args[1]
local i1 = args[2]
--defRole, damage, bCrit, finalDmg, damageType, skill
local OnRoleHit = function(skill)
if skill and (skill.type==BattleSkillType.Special or skill.type==BattleSkillType.Extra) and skill.owner==role 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
value:AddRage(i1, CountTypeName.Sub)
end
end
end
end
role.Event:AddEvent(BattleEventName.SkillCastEnd, OnRoleHit)
end,
--概率额外 [a]敌方血量最少的目标(己方每个上阵的其他妖阵营神将可提供姑获鸟眩晕总概率的[b])。持续[c]回合
-- a[控制状态] b[float] c[int]
[268] = function(role,args)
local con=args[1]
local pro2=args[2]
local time=args[3]
local onSkillCast=function(skill)
if skill and skill.owner==role and (skill.type==BattleSkillType.Special or skill.type==BattleSkillType.Extra) then
local heros=RoleManager.GetRoleByCamp(role.camp)
local num=0
for _, r in pairs(heros) do
if r~=role and r.element==role.element then
num=num+1
end
end
local list = RoleManager.Query(function(v) return v.camp ~= role.camp end)
list=BattleUtil.SortByProp(list, RoleDataName.Hp, 1)
--获取主目标
local targets=skill:GetDirectTargets()
local aaa=nil
for key, value in pairs(list) do
if value and not BattleUtil.ChecklistIsContainValue(targets,value) then
aaa=value
break
end
end
if aaa then
BattleUtil.RandomControl(pro2*num, con, role,aaa,time)
end
end
end
role.Event:AddEvent(BattleEventName.SkillCast,onSkillCast)
end,
--受到[a]目标攻击时,自身免疫[b]和[c]效果
--a[int 持续伤害类型] b,c[int 持续伤害类型]
[269] = 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.DOT and (buff.damageType==sta2 or buff.damageType==sta3)
end
local curBuff=nil
local onRoleDamageBefore=function(atkRole, factorFunc, damageType, skill)
if atkRole.camp~= role.camp and BattleLogic.BuffMgr:HasBuff(skill.owner, BuffName.DOT, function (buff) return buff.damageType == sta1 end) then
--curBuff=Buff.Create(role, BuffName.Immune, 1,4,immune)
-- role:AddBuff(curBuff)
role.buffFilter:Add(immune)
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
-- end
end
end
BattleLogic.Event:AddEvent(BattleEventName.SkillCastEnd, onSkillEnd)
end,
-- 技能直接伤害[a]%转化为生命治疗自己
-- a[float]
[270] = function(role, args)
local f1 = args[1]
local function onRoleHit(defRole, damage, bCrit, finalDmg, damageType, skill)
if skill and skill.type == BattleSkillType.Special then
local treatValue = floor(damage * f1)
BattleUtil.ApplyTreat(role, role, treatValue)
end
end
role.Event:AddEvent(BattleEventName.RoleHit, onRoleHit)
end
} }
return passivityList return passivityList

View File

@ -86,6 +86,7 @@ function this.PrintBattleTable(tb)
return indent_str return indent_str
end end
-- --
this.logList = {}
function this.Init(fightdata, userdata) function this.Init(fightdata, userdata)
this.timestamp = Random.GetSeed() this.timestamp = Random.GetSeed()
this.fightdata = fightdata this.fightdata = fightdata
@ -107,6 +108,7 @@ function this.Log(...)
local value = args[i + 1] local value = args[i + 1]
log = log .. string.format("%s = %s, ", key, value) log = log .. string.format("%s = %s, ", key, value)
end end
LogBattle(log)
table.insert(this.logList, log) table.insert(this.logList, log)
-- 如果log大于100条写一便日志到文件 -- 如果log大于100条写一便日志到文件
if #this.logList > 100 then if #this.logList > 100 then

View File

@ -65,21 +65,20 @@ function BattleLogic.Init(data, _userData, maxRound)
BattleLogic.BuffMgr:Init() BattleLogic.BuffMgr:Init()
BattleLogic.IsEnd = false BattleLogic.IsEnd = false
BattleLogic.Result = -1 BattleLogic.Result = -1
-- 日志管理放到前面初始化
BattleLogManager.Init(fightData, userData)
MonsterManager.Init() MonsterManager.Init()
RoleManager.Init() RoleManager.Init()
SkillManager.Init() SkillManager.Init()
OutDataManager.Init(fightData) OutDataManager.Init(fightData)
PassiveManager.Init() PassiveManager.Init()
BattleLogManager.Init(fightData, userData)
-- 监听英雄受到治疗 -- 监听英雄受到治疗
BattleLogic.Event:AddEvent(BattleEventName.RoleBeTreated,function (castRole, realTreat, treat) BattleLogic.Event:AddEvent(BattleEventName.RoleBeTreated,function (castRole, realTreat, treat)
if castRole.camp==0 then if castRole.camp==0 then
LogBattle("我方 英雄治疗"..treat)
allHeroDamage=allHeroDamage+treat allHeroDamage=allHeroDamage+treat
else else
LogBattle("敌方 英雄治疗"..treat)
allEnemyDamage=allEnemyDamage+treat allEnemyDamage=allEnemyDamage+treat
end end
end) end)
@ -88,11 +87,9 @@ function BattleLogic.Init(data, _userData, maxRound)
--我方阵营总攻击 --我方阵营总攻击
if atkRole.camp==0 then if atkRole.camp==0 then
allHeroDamage=allHeroDamage+damage allHeroDamage=allHeroDamage+damage
LogBattle("我方 英雄攻击"..damage)
--敌方阵营 --敌方阵营
else else
allEnemyDamage=allEnemyDamage+damage allEnemyDamage=allEnemyDamage+damage
LogBattle("敌方 英雄攻击"..damage)
end end
end) end)
@ -205,7 +202,6 @@ end
-- debugTurn 用于判断是否是debug轮转的参数 -- debugTurn 用于判断是否是debug轮转的参数
function BattleLogic.TurnRound(debugTurn) function BattleLogic.TurnRound(debugTurn)
if BattleLogic.GetIsDebug() and not debugTurn then if BattleLogic.GetIsDebug() and not debugTurn then
LogBattle("-------------")
BattleLogic.Event:DispatchEvent(BattleEventName.DebugStop) BattleLogic.Event:DispatchEvent(BattleEventName.DebugStop)
return return
end end
@ -299,28 +295,14 @@ function BattleLogic.CheckBattleLogic()
"position", CurSkillPos[CurCamp] "position", CurSkillPos[CurCamp]
) )
-- buff计算
BattleLogic.BuffMgr:TurnUpdate(1) -- 计算恢复血量
BattleLogic.BuffMgr:TurnUpdate(2) -- 计算持续伤害(除去流血)
-- 如果角色无法释放技能
if not SkillRole:IsAvailable() -- 角色不能释放技能
or (SkillRole:IsDead() and not BattleLogic.BuffMgr:HasBuff(SkillRole,BuffName.NoDead)) --将死但没有不死buff
then
BattleLogic.BuffMgr:TurnUpdate(3) -- 计算持续伤害(流血)
BattleLogic.BuffMgr:TurnUpdate(4) -- 计算其他buff
BattleLogic.BuffMgr:PassUpdate() -- 计算buff轮数
BattleLogic.TurnRoundNextFrame() -- 下一个
return
end
-- 行动 -- 行动
SkillRole.Event:DispatchEvent(BattleEventName.RoleTurnStart, SkillRole) -- 开始行动 SkillRole.Event:DispatchEvent(BattleEventName.RoleTurnStart, SkillRole) -- 开始行动
BattleLogic.Event:DispatchEvent(BattleEventName.RoleTurnStart, SkillRole) -- 开始行动 BattleLogic.Event:DispatchEvent(BattleEventName.RoleTurnStart, SkillRole) -- 开始行动
-- BattleLogic.BuffMgr:TurnUpdate(1) -- 计算恢复血量 -- buff计算
-- BattleLogic.BuffMgr:TurnUpdate(2) -- 计算持续伤害(除去流血) BattleLogic.BuffMgr:TurnUpdate(1) -- 计算恢复血量
-- 释放技能后,递归交换阵营 BattleLogic.BuffMgr:TurnUpdate(2) -- 计算持续伤害(除去流血)
SkillRole:CastSkill(function() -- 设置行动完成回调
SkillManager.SetTurnRoundFunc(function()
BattleLogic.BuffMgr:TurnUpdate(3) -- 计算持续伤害(流血) BattleLogic.BuffMgr:TurnUpdate(3) -- 计算持续伤害(流血)
BattleLogic.BuffMgr:TurnUpdate(4) -- 计算其他buff BattleLogic.BuffMgr:TurnUpdate(4) -- 计算其他buff
BattleLogic.BuffMgr:PassUpdate() -- 计算buff轮数 BattleLogic.BuffMgr:PassUpdate() -- 计算buff轮数
@ -328,6 +310,19 @@ function BattleLogic.CheckBattleLogic()
BattleLogic.Event:DispatchEvent(BattleEventName.RoleTurnEnd, SkillRole) -- 开始行动 BattleLogic.Event:DispatchEvent(BattleEventName.RoleTurnEnd, SkillRole) -- 开始行动
BattleLogic.TurnRoundNextFrame() BattleLogic.TurnRoundNextFrame()
end) end)
-- 如果角色无法释放技能
if not SkillRole:IsAvailable() -- 角色不能释放技能
or (SkillRole:IsDead() -- 将死状态
and not BattleLogic.BuffMgr:HasBuff(SkillRole,BuffName.NoDead) --将死但没有不死buff
and not SkillManager.HaveMySkill(SkillRole)) -- 也没有要释放的技能
then
SkillManager.CheckTurnRound()
return
end
-- 释放技能后,递归交换阵营
SkillRole:CastSkill()
end end
function BattleLogic.WaitForTrigger(delayTime, action) function BattleLogic.WaitForTrigger(delayTime, action)
@ -350,6 +345,12 @@ end
function BattleLogic.Update() function BattleLogic.Update()
curFrame = curFrame + 1 curFrame = curFrame + 1
-- 强制退出
if curFrame > BattleMaxFrame then
assert(false, "Battle Time Out !!!")
BattleLogic.BattleEnd(-1)
return
end
local roleResult = RoleManager.GetResult() local roleResult = RoleManager.GetResult()
if roleResult == 0 then if roleResult == 0 then
BattleLogic.BattleEnd(0) BattleLogic.BattleEnd(0)
@ -357,12 +358,9 @@ function BattleLogic.Update()
end end
if CurRound > MaxRound then if CurRound > MaxRound then
if BattleLogic.Type==9 or BattleLogic.Type== 0 then if BattleLogic.Type==9 or BattleLogic.Type== 0 then
LogBattle("我方总输出"..allHeroDamage.."敌方总输出:"..allEnemyDamage)
if allHeroDamage>allEnemyDamage then if allHeroDamage>allEnemyDamage then
LogBattle("争霸赛我方胜")
BattleLogic.BattleEnd(1) BattleLogic.BattleEnd(1)
else else
LogBattle("争霸赛敌方胜")
BattleLogic.BattleEnd(0) BattleLogic.BattleEnd(0)
end end
else else

View File

@ -13,11 +13,13 @@ end
local immune3 = function(buff) local immune3 = function(buff)
return buff.type == BuffName.Shield and buff.shieldType == ShieldTypeName.AllReduce return buff.type == BuffName.Shield and buff.shieldType == ShieldTypeName.AllReduce
end end
--自定义免疫
local immune4=nil
--初始化Buff通过传入一些自定义参数控制成长相关的数值 --初始化Buff通过传入一些自定义参数控制成长相关的数值
function Immune:SetData(...) function Immune:SetData(type,func)
self.immuneType =type
self.immuneType = ... immune4=func
self.isBuff = true self.isBuff = true
-- 刷新排序等级 -- 刷新排序等级
@ -35,6 +37,13 @@ function Immune:OnStart()
self.target.buffFilter:Add(immune2) self.target.buffFilter:Add(immune2)
elseif self.immuneType == 3 then --免疫无敌盾 elseif self.immuneType == 3 then --免疫无敌盾
self.target.buffFilter:Add(immune3) self.target.buffFilter:Add(immune3)
elseif self.immuneType==4 then--自定义免疫
if immune4 then
self.target.buffFilter:Add(immune4)
end
end
if condition then
-- body
end end
end end
@ -56,6 +65,9 @@ function Immune:OnEnd()
immune = immune2 immune = immune2
elseif self.immuneType == 3 then --免疫无敌盾 elseif self.immuneType == 3 then --免疫无敌盾
immune = immune3 immune = immune3
elseif self.immuneType == 4 then--自定义免疫
immune=immune4
immune4=nil
end end
for i = 1, self.target.buffFilter.size do for i = 1, self.target.buffFilter.size do
if self.target.buffFilter.buffer[i] == immune then if self.target.buffFilter.buffer[i] == immune then

View File

@ -38,7 +38,7 @@ function Shield:OnTrigger()
end end
-- 计算护盾 -- 计算护盾
function Shield:CountShield(damage, atkRole) function Shield:CountShield(damage, atkRole,skill)
self.atk = atkRole self.atk = atkRole
local finalDamage = 0 local finalDamage = 0
if self.shieldType == ShieldTypeName.NormalReduce then if self.shieldType == ShieldTypeName.NormalReduce then
@ -54,10 +54,14 @@ function Shield:CountShield(damage, atkRole)
end end
elseif self.shieldType == ShieldTypeName.RateReduce then elseif self.shieldType == ShieldTypeName.RateReduce then
--减伤盾只减伤直接伤害,和史弘毅对接的 2020/11/14 by王振兴
if skill then
local reduceDamage = math.floor(BattleUtil.ErrorCorrection(damage * self.shieldValue)) local reduceDamage = math.floor(BattleUtil.ErrorCorrection(damage * self.shieldValue))
finalDamage = damage - reduceDamage finalDamage = damage - reduceDamage
self.damageSum = self.damageSum + reduceDamage self.damageSum = self.damageSum + reduceDamage
else
finalDamage=damage
end
elseif self.shieldType == ShieldTypeName.AllReduce then elseif self.shieldType == ShieldTypeName.AllReduce then
finalDamage = 0 finalDamage = 0
--TODO 计算吸血 --TODO 计算吸血

View File

@ -129,6 +129,9 @@ BattleEventName = {
ShowHintText = indexAdd(), ShowHintText = indexAdd(),
} }
BattleMaxFrame = 1000000
index = 0 index = 0
RoleDataName = { RoleDataName = {
Level = indexAdd(), --等级 Level = indexAdd(), --等级
@ -230,6 +233,7 @@ skill1={1012051,1,0,1,{200000,{1,0.41,2}}},
skill2={1132051,0.8,0,1,{200212,{1,0.89,2}}}, skill2={1132051,0.8,0,1,{200212,{1,0.89,2}}},
skill3={1151111,0.05,0,1,{220000,{1,0.86,2}}}, skill3={1151111,0.05,0,1,{220000,{1,0.86,2}}},
skill4={10000351,0.3,0.5,4,{400000,{1,1.75,1}}}, skill4={10000351,0.3,0.5,4,{400000,{1,1.75,1}}},
skill5={12011001,0.3,0.5,4,{400000,{1,2.2,1}}},
} }
@ -278,3 +282,7 @@ BattleRoleElementType = {
YAO = 3, YAO = 3,
DAO = 4 DAO = 4
} }
BattleArtFontType = {
Immune = 1, -- 免疫文字
}

View File

@ -282,10 +282,10 @@ function BattleUtil.CalHit(atkRole, defRole)
end end
-- 计算护盾 -- 计算护盾
function BattleUtil.CalShield(atkRole, defRole, damage) function BattleUtil.CalShield(atkRole, defRole, damage,skill)
for i=1, defRole.shield.size do for i=1, defRole.shield.size do
local buff = defRole.shield.buffer[i] local buff = defRole.shield.buffer[i]
damage = buff:CountShield(damage, atkRole) damage = buff:CountShield(damage, atkRole,skill)
end end
return damage return damage
end end
@ -304,7 +304,7 @@ function BattleUtil.CheckIsBoss(role)
end end
if role.data.enemyType==EnemyType.Boss then if role.data.enemyType==EnemyType.Boss then
--弹免疫 --弹免疫
role.Event:DispatchEvent(BattleEventName.ShowHintText,2, 12391) role.Event:DispatchEvent(BattleEventName.ShowHintText, BattleArtFontType.Immune)
return true return true
else else
return false return false
@ -370,7 +370,8 @@ function BattleUtil.ApplyDamage(skill, atkRole, defRole, damage, bCrit, damageTy
BattleLogic.Event:DispatchEvent(BattleEventName.PassiveDamaging, damagingFunc, atkRole, defRole, damage, skill, dotType, bCrit) BattleLogic.Event:DispatchEvent(BattleEventName.PassiveDamaging, damagingFunc, atkRole, defRole, damage, skill, dotType, bCrit)
-- 计算护盾减伤 -- 计算护盾减伤
damage = BattleUtil.CalShield(atkRole, defRole, damage)
damage = BattleUtil.CalShield(atkRole, defRole, damage,skill)
-- 造成的最终伤害 -- 造成的最终伤害
local damagingFunc = function(dmgDeduction) local damagingFunc = function(dmgDeduction)
@ -416,6 +417,8 @@ function BattleUtil.GetExtraSkillbyId(id)
return ExtraReleaseSkill.skill3 return ExtraReleaseSkill.skill3
elseif id==4 then elseif id==4 then
return ExtraReleaseSkill.skill4 return ExtraReleaseSkill.skill4
elseif id==5 then
return ExtraReleaseSkill.skill5
end end
end end
@ -634,7 +637,7 @@ function BattleUtil.ApplyTreat(castRole, targetRole, value, baseFactor,critDamag
--添加发送到battleLogic的治疗消息用于计算总的战斗伤害值 --添加发送到battleLogic的治疗消息用于计算总的战斗伤害值
BattleLogic.Event:DispatchEvent(BattleEventName.RoleBeTreated, castRole, treat, baseTreat) BattleLogic.Event:DispatchEvent(BattleEventName.RoleBeTreated, castRole, treat, baseTreat)
BattleLogManager.Log( BattleLogManager.Log(
"Final Damage", "Final Treat",
"acamp", castRole.camp, "acamp", castRole.camp,
"apos", castRole.position, "apos", castRole.position,
"tcamp", targetRole.camp, "tcamp", targetRole.camp,

View File

@ -8,7 +8,6 @@ function MSkill:New()
end end
function MSkill:Init(owner, group, index, skillData) function MSkill:Init(owner, group, index, skillData)
LogBattle("MSkill Init")
self.owner = owner self.owner = owner
self.group = group self.group = group
self.groupIndex = index self.groupIndex = index

View File

@ -9,7 +9,6 @@ end
-- 初始化数据 -- 初始化数据
function MSkillGroup:Init(monster, groupData) function MSkillGroup:Init(monster, groupData)
LogBattle("MSkillGroup Init")
self.owner = monster self.owner = monster
self.skillGroupData = groupData self.skillGroupData = groupData
-- 创建技能 -- 创建技能

View File

@ -148,7 +148,6 @@ end
-- 技能加入检测 -- 技能加入检测
function MTrigger.AddSkill(triggerId, condition, skill) function MTrigger.AddSkill(triggerId, condition, skill)
LogBattle("AddSkill "..triggerId)
if not this.TriggerList then if not this.TriggerList then
this.TriggerList = {} this.TriggerList = {}
end end

View File

@ -58,17 +58,20 @@ function RoleLogic:Init(uid, data, position)
self.NoRageRate = 0 -- 不消耗怒气值的概率 self.NoRageRate = 0 -- 不消耗怒气值的概率
-- --
self.isImmuneReduceRage=false --是否免疫减怒
self.passiveList = {} self.passiveList = {}
if data.passivity and #data.passivity > 0 then if data.passivity and #data.passivity > 0 then
for i = 1, #data.passivity do for i = 1, #data.passivity do
local v = data.passivity[i] local v = data.passivity[i]
local id = v[1] local passivityId=v[1]
local judge=v[2]
local id = v[3]
local args = {} local args = {}
for j = 2, #v do for j = 4, #v do
args[j-1] = v[j] args[j-3] = v[j]
end end
if BattleUtil.Passivity[id] then if BattleUtil.Passivity[id] then
BattleUtil.Passivity[id](self, args) BattleUtil.Passivity[id](self, args,passivityId,judge)
-- 加入被动列表 -- 加入被动列表
table.insert(self.passiveList, {id, args}) table.insert(self.passiveList, {id, args})
end end
@ -156,7 +159,7 @@ end
-- 改变怒气值 -- 改变怒气值
function RoleLogic:AddRage(value, type) function RoleLogic:AddRage(value, type)
-- 角色身上有无敌盾,不扣除怒气 by:wangzhenxing 2020/08/10 14:56 -- 角色身上有无敌盾,不扣除怒气 by:wangzhenxing 2020/08/10 14:56
if (type==3 or type==4) and BattleLogic.BuffMgr:HasBuff(self, BuffName.Shield, function (buff) return buff.shieldType and buff.shieldType == ShieldTypeName.AllReduce end) then 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("角色身上有无敌盾,不扣除怒气") LogBattle("角色身上有无敌盾,不扣除怒气")
return return
end end
@ -385,7 +388,7 @@ if effectData then
--和老史,佳琦确认果 附加技能算绝技 被沉默无法释放 可以套娃 递归触发 by:王振兴 --和老史,佳琦确认果 附加技能算绝技 被沉默无法释放 可以套娃 递归触发 by:王振兴
SkillManager.InsertSkill(self, effectData, skillType, nil, true, false) SkillManager.InsertSkill(self, effectData, skillType, nil, true, false)
BattleLogManager.Log( BattleLogManager.Log(
"Add Skill", "Insert Extra Skill",
"camp", self.camp, "camp", self.camp,
"pos", self.position, "pos", self.position,
"type", skillType, "type", skillType,
@ -422,7 +425,10 @@ end
-- 正常触发技能 -- 正常触发技能
function RoleLogic:CastSkill(func) function RoleLogic:CastSkill(func)
-- 设置轮转方法 -- 设置轮转方法
SkillManager.SetTurnRoundFunc(func) -- SkillManager.SetTurnRoundFunc(func)
if not self:IsAvailable() then
return
end
-- 没有沉默 -- 没有沉默
if not self.ctrl_slient and self.Rage >= self.SuperSkillRage then if not self.ctrl_slient and self.Rage >= self.SuperSkillRage then
-- 释放大技能 -- 释放大技能

View File

@ -10,13 +10,30 @@ this.DeadSkillList = {} -- 人物死亡后技能队列,死亡技能优先级
this.MonsterSkillList = {} this.MonsterSkillList = {}
this.SkillList = {} this.SkillList = {}
this.IsSkilling = false this.IsSkilling = false
this.MaxSkillCount = 20 -- 单个回合内最多释放20次技能
-- 初始化 -- 初始化
function this.Init() function this.Init()
this.CurSkillCount = 0
this.Clear() this.Clear()
end end
function this.CheckMaxCount()
if not this.CurSkillCount then
this.CurSkillCount = 0
end
if this.CurSkillCount < this.MaxSkillCount then
this.CurSkillCount = this.CurSkillCount + 1
return true
end
return false
end
-- --
function this.AddMonsterSkill(skill) function this.AddMonsterSkill(skill)
-- 如果超出最大限制则不再追加技能
if not this.CheckMaxCount() then
return
end
if skill.type == BattleSkillType.Monster then if skill.type == BattleSkillType.Monster then
table.insert(this.MonsterSkillList, skill) table.insert(this.MonsterSkillList, skill)
end end
@ -26,6 +43,10 @@ end
-- 向技能列表中追加技能 -- 向技能列表中追加技能
function this.AddSkill(caster, effectData, type, targets, isAdd, isRage) function this.AddSkill(caster, effectData, type, targets, isAdd, isRage)
-- 如果超出最大限制则不再追加技能
if not this.CheckMaxCount() then
return
end
local skill = skillPool:Get() local skill = skillPool:Get()
skill:Init(caster, effectData, type, targets, isAdd, isRage) skill:Init(caster, effectData, type, targets, isAdd, isRage)
if type == BattleSkillType.DeadSkill then -- 死亡技能加入单独的对列 if type == BattleSkillType.DeadSkill then -- 死亡技能加入单独的对列
@ -37,6 +58,10 @@ function this.AddSkill(caster, effectData, type, targets, isAdd, isRage)
end end
-- 插入技能到技能列表首位 -- 插入技能到技能列表首位
function this.InsertSkill(caster, effectData, type, targets, isAdd, isRage) function this.InsertSkill(caster, effectData, type, targets, isAdd, isRage)
-- 如果超出最大限制则不再追加技能
if not this.CheckMaxCount() then
return
end
local skill = skillPool:Get() local skill = skillPool:Get()
skill:Init(caster, effectData, type, targets, isAdd, isRage) skill:Init(caster, effectData, type, targets, isAdd, isRage)
if type == BattleSkillType.DeadSkill then -- 死亡技能加入单独的对列 if type == BattleSkillType.DeadSkill then -- 死亡技能加入单独的对列
@ -75,7 +100,7 @@ function this.CheckTurnRound()
return return
end end
-- 检测一次灵兽技能 -- 检测一次灵兽技能
this.CheckMonsterSkill(this.MonsterCheckFunc) -- this.CheckMonsterSkill(this.MonsterCheckFunc)
-- --
if this.DeadSkillList and #this.DeadSkillList > 0 then if this.DeadSkillList and #this.DeadSkillList > 0 then
@ -87,6 +112,9 @@ function this.CheckTurnRound()
-- 没有技能释放的时候才轮转 -- 没有技能释放的时候才轮转
if this.TurnRoundFunc then if this.TurnRoundFunc then
BattleLogic.WaitForTrigger(0.3, function() BattleLogic.WaitForTrigger(0.3, function()
-- 清除数量限制
this.CurSkillCount = 0
--
this.TurnRoundFunc() this.TurnRoundFunc()
this.TurnRoundFunc = nil this.TurnRoundFunc = nil
end) end)
@ -128,12 +156,16 @@ function this.Update()
skill:Cast(function() skill:Cast(function()
-- 检测一下轮转 -- 检测一下轮转
this.IsSkilling = false this.IsSkilling = false
this.CheckTurnRound() -- this.CheckTurnRound()
-- 检测一次灵兽技能
this.CheckMonsterSkill(this.MonsterCheckFunc)
end) end)
else else
-- 检测一下轮转 -- 检测一下轮转
this.IsSkilling = false this.IsSkilling = false
this.CheckTurnRound() -- this.CheckTurnRound()
-- 检测一次灵兽技能
this.CheckMonsterSkill(this.MonsterCheckFunc)
end end
return return
end end