战斗同步
parent
7ced543cb1
commit
2aaf089db6
|
@ -1944,8 +1944,8 @@ local effectList = {
|
|||
BattleLogic.WaitForTrigger(interval, function ()
|
||||
-- 对仇恨目标追加一次技能
|
||||
for i = 1, i1 do
|
||||
caster:AddSkill(BattleSkillType.Normal, false, true, {{target}})
|
||||
end
|
||||
caster:AddSkill(BattleSkillType.Normal, false, true, {{target}})
|
||||
end
|
||||
end)
|
||||
end,
|
||||
|
||||
|
@ -1980,7 +1980,8 @@ local effectList = {
|
|||
-- 检测技能伤害治疗加成
|
||||
f2 = BattleUtil.CheckSkillDamageHeal(f2, caster, arr[1])
|
||||
-- 治疗血量最低队友实际伤害的f2%
|
||||
BattleUtil.ApplyTreat(caster, arr[1], floor(finalDmg*f2))
|
||||
--之前是finaldag 改成 damage
|
||||
BattleUtil.ApplyTreat(caster, arr[1], floor(damage*f2))
|
||||
end
|
||||
target.Event:AddEvent(BattleEventName.RoleBeHit, OnBeHit)
|
||||
BattleUtil.CalDamage(skill, caster, target, dt, f1)
|
||||
|
@ -2074,6 +2075,10 @@ local effectList = {
|
|||
if ft < f2 then
|
||||
isSecKill = BattleUtil.RandomAction(f3, function()
|
||||
-- 秒杀
|
||||
local isBoss=BattleUtil.CheckIsBoss(target)
|
||||
if isBoss then
|
||||
return
|
||||
end
|
||||
BattleUtil.Seckill(skill, caster, target)
|
||||
end)
|
||||
end
|
||||
|
@ -2117,7 +2122,7 @@ local effectList = {
|
|||
caster.Event:DispatchEvent(BattleEventName.RoleViewBullet, skill, target)
|
||||
BattleLogic.WaitForTrigger(interval, function ()
|
||||
local OnBeHit = function(atkRole, damage, bCrit, finalDmg, damageType)
|
||||
if target:IsDead() then
|
||||
if target:IsDead() and not BattleUtil.CheckIsNoDead(target) then
|
||||
caster:AddBuff(Buff.Create(caster, BuffName.PropertyChange, 0, BattlePropList[pro1], f2, ct))
|
||||
end
|
||||
end
|
||||
|
@ -2229,6 +2234,17 @@ local effectList = {
|
|||
BattleUtil.ApplyTreat(caster, target, v)
|
||||
end)
|
||||
end,
|
||||
--组合技能:主动让自己释放一次有动作的自身普攻技能(配置目标选择只能配置成1个目标,否者会释放多次)by:王振兴
|
||||
[116] = function(caster, target, args, interval, skill)
|
||||
local i1 = args[1]
|
||||
--如果身上有不灭效果就不会加普攻,兼容金翅大鹏10星天赋 by:王振兴
|
||||
if not BattleLogic.BuffMgr:HasBuff(caster,BuffName.NoDead) then
|
||||
BattleLogic.WaitForTrigger(0.5, function ()
|
||||
caster:InsertSkill(BattleSkillType.Normal, false, false, nil)
|
||||
end)
|
||||
end
|
||||
end,
|
||||
|
||||
}
|
||||
|
||||
return effectList
|
|
@ -1479,9 +1479,12 @@ local passivityList = {
|
|||
[78] = function(role, args)
|
||||
local pro = args[1]
|
||||
local f1 = args[2]
|
||||
|
||||
local val = floor(BattleUtil.FP_Mul(f1, role:GetRoleData(BattlePropList[pro])))
|
||||
BattleUtil.CalTreat(role, role, val)
|
||||
LogBattle("开始治疗")
|
||||
--这里加一个延时,防止执行时显示层还没有初始化,从而没有表现
|
||||
BattleLogic.WaitForTrigger(0.05, function()
|
||||
local val = floor(BattleUtil.FP_Mul(f1, role:GetRoleData(BattlePropList[pro])))
|
||||
BattleUtil.CalTreat(role, role, val)
|
||||
end)
|
||||
end,
|
||||
--战斗结束时,为自身回复[a]*[b]的血量。
|
||||
--a[属性],b[float]
|
||||
|
@ -1563,7 +1566,7 @@ local passivityList = {
|
|||
-- buff.cover = true -- 可以叠加
|
||||
-- buff.clear = false -- 不可驱散
|
||||
-- role:AddBuff(buff)
|
||||
if skill and not skill.isAdd and defRole:IsDead() and BattleUtil.CheckIsNoDead(defRole) then
|
||||
if skill and not skill.isAdd and defRole:IsDead() and not BattleUtil.CheckIsNoDead(defRole) then
|
||||
role:AddRage(i1, CountTypeName.Add)
|
||||
end
|
||||
end
|
||||
|
@ -1687,7 +1690,8 @@ local passivityList = {
|
|||
local allDamage = 0
|
||||
local OnHit = function(atkRole, damage, bCrit, finalDmg, damageType, skill)
|
||||
if skill and skill.type == BattleSkillType.Special then
|
||||
allDamage = allDamage + finalDmg
|
||||
--吸血修改,finaldag 改成 damage by:王振兴 2020/08/17
|
||||
allDamage = allDamage + damage
|
||||
end
|
||||
end
|
||||
local function onSkillCast(skill)
|
||||
|
@ -1781,7 +1785,7 @@ local passivityList = {
|
|||
local ct = args[3]
|
||||
-- 释放技能后
|
||||
local onRoleHit = function(defRole)
|
||||
if defRole:IsDead() and BattleUtil.CheckIsNoDead(defRole) then
|
||||
if defRole:IsDead() and not BattleUtil.CheckIsNoDead(defRole) then
|
||||
local buff = Buff.Create(role, BuffName.PropertyChange, 0, BattlePropList[pro], f1, ct)
|
||||
-- buff.cover = true
|
||||
role:AddBuff(buff)
|
||||
|
@ -1875,6 +1879,10 @@ local passivityList = {
|
|||
[108] = function(role, args)
|
||||
local f1 = args[1]
|
||||
local onBeHit = function(caster, damage, bCrit, finalDmg, damageType, skill)
|
||||
--如果角色死亡就不会反弹伤害
|
||||
if role:IsDead() then
|
||||
return
|
||||
end
|
||||
if skill then --技能造成的直接伤害
|
||||
local rDamage = f1 * damage
|
||||
|
||||
|
@ -1985,8 +1993,7 @@ local passivityList = {
|
|||
local i1 = args[1]
|
||||
-- 释放技能后
|
||||
local onRoleHit = function(target)
|
||||
-- LogError("target "..target.roleId .. " ".. target.star)
|
||||
if target:IsDead() and BattleUtil.CheckIsNoDead(target) then
|
||||
if target:IsDead() and not BattleUtil.CheckIsNoDead(target) then
|
||||
for i = 1, i1 do
|
||||
role:AddSkill(BattleSkillType.Normal, false, true, nil)
|
||||
end
|
||||
|
@ -2032,7 +2039,7 @@ local passivityList = {
|
|||
local f1 = args[1]
|
||||
-- 释放技能后
|
||||
local onRoleHit = function(target)
|
||||
if target:IsDead() and BattleUtil.CheckIsNoDead(target) then
|
||||
if target:IsDead() and not BattleUtil.CheckIsNoDead(target) then
|
||||
local treat = floor(BattleUtil.FP_Mul(role:GetRoleData(RoleDataName.MaxHp), f1))
|
||||
BattleUtil.CalTreat(role, role, treat)
|
||||
end
|
||||
|
@ -2206,7 +2213,7 @@ local passivityList = {
|
|||
-- 释放技能后
|
||||
local onSkillEnd = function(skill)
|
||||
if skill.type == BattleSkillType.Special then
|
||||
local list = RoleManager.Query(function(v) return v.position > 3 end)
|
||||
local list = RoleManager.Query(function(v) return v.position > 3 and v.camp==role.camp end)
|
||||
for _, r in ipairs(list) do
|
||||
r:AddRage(i1, CountTypeName.Add)
|
||||
end
|
||||
|
@ -2221,7 +2228,7 @@ local passivityList = {
|
|||
local f1 = args[1]
|
||||
-- 释放技能后
|
||||
local onRoleHit = function(target)
|
||||
if target:IsDead() and BattleUtil.CheckIsNoDead(target) then
|
||||
if target:IsDead() and not BattleUtil.CheckIsNoDead(target) then
|
||||
local buff = Buff.Create(role, BuffName.PropertyChange, 1, RoleDataName.Crit, f1, CountTypeName.Add)
|
||||
role:AddBuff(buff)
|
||||
end
|
||||
|
@ -2376,7 +2383,7 @@ local passivityList = {
|
|||
|
||||
-- 击杀数量累加
|
||||
local OnRoleHit = function(defRole, damage, bCrit, finalDmg, damageType, skill)
|
||||
if skill and defRole:IsDead() and BattleUtil.CheckIsNoDead(defRole) then
|
||||
if skill and defRole:IsDead() and not BattleUtil.CheckIsNoDead(defRole) then
|
||||
killNum = killNum + 1
|
||||
end
|
||||
end
|
||||
|
@ -2514,7 +2521,8 @@ local passivityList = {
|
|||
if skill.type == BattleSkillType.Special then
|
||||
local list = skill:GetDirectTargetsNoMiss()
|
||||
if list then
|
||||
local tv = floor(BattleUtil.ErrorCorrection(role:GetRoleData(pro) * f1))
|
||||
local tv = floor(BattleUtil.ErrorCorrection(role:GetRoleData(BattlePropList[pro]) * f1))
|
||||
LogBattle(role:GetRoleData(pro).." ".. f1.." " .. tv)
|
||||
for _, r in ipairs(list) do
|
||||
local auraBuff = Buff.Create(role, BuffName.HOT, i1, 1, tv)
|
||||
auraBuff.interval = 1
|
||||
|
@ -2537,7 +2545,8 @@ local passivityList = {
|
|||
if skill.type == BattleSkillType.Normal then
|
||||
local list = skill:GetDirectTargetsNoMiss()
|
||||
if list then
|
||||
local tv = floor(BattleUtil.ErrorCorrection(role:GetRoleData(pro) * f1))
|
||||
local tv = floor(BattleUtil.ErrorCorrection(role:GetRoleData(BattlePropList[pro]) * f1))
|
||||
LogBattle(role:GetRoleData(pro).." ".. f1.." " .. tv)
|
||||
for _, r in ipairs(list) do
|
||||
local auraBuff = Buff.Create(role, BuffName.HOT, i1, 1, tv)
|
||||
auraBuff.interval = 1
|
||||
|
@ -2615,7 +2624,8 @@ local passivityList = {
|
|||
local f1 = args[2]
|
||||
local onHit = function(target, damage, bCrit, finalDmg)
|
||||
if BattleLogic.BuffMgr:HasBuff(target, BuffName.DOT, function(buff) return buff.damageType == dot end) then
|
||||
BattleUtil.ApplyTreat(role, role, floor(BattleUtil.ErrorCorrection(finalDmg * f1)))
|
||||
--吸血修改 finaldamage 改为 damage by:往王振兴 2020/08/17
|
||||
BattleUtil.ApplyTreat(role, role, floor(BattleUtil.ErrorCorrection(damage * f1)))
|
||||
end
|
||||
end
|
||||
local onSkillCast = function(skill)
|
||||
|
@ -2672,7 +2682,7 @@ local passivityList = {
|
|||
local function onRoleDead()
|
||||
for i = 1, i1 do
|
||||
-- 插入一个技能,该技能优先级较高
|
||||
role:InsertSkill(BattleSkillType.Special, false, true, nil)
|
||||
role:InsertSkill(BattleSkillType.DeadSkill, false, true, nil)
|
||||
end
|
||||
end
|
||||
role.Event:AddEvent(BattleEventName.RoleDead, onRoleDead)
|
||||
|
@ -2755,7 +2765,7 @@ local passivityList = {
|
|||
local dot = args[1]
|
||||
local f1 = args[2]
|
||||
local function onHit(target)
|
||||
if target:IsDead() and BattleUtil.CheckIsNoDead(target) then
|
||||
if target:IsDead() and not BattleUtil.CheckIsNoDead(target) then
|
||||
local maxHp = role:GetRoleData(RoleDataName.MaxHp)
|
||||
local value = floor(BattleUtil.ErrorCorrection(maxHp* f1))
|
||||
BattleUtil.ApplyTreat(role, role, value)
|
||||
|
@ -2844,16 +2854,19 @@ local passivityList = {
|
|||
local f1 = args[2]
|
||||
local f2 = args[3]
|
||||
--
|
||||
local onRoleHit = function(defRole, damage, bCrit, finalDmg, damageType, skill)
|
||||
local onRoleHit = function(defRole, damage, bCrit, finalDmg, damageType, skill)
|
||||
if skill and skill.type == BattleSkillType.Normal and not defRole:IsDead() then
|
||||
if BattleLogic.BuffMgr:HasBuff(defRole, BuffName.DOT, function (buff) return dot == 0 or buff.damageType == dot end) then
|
||||
if BattleLogic.BuffMgr:HasBuff(defRole, BuffName.DOT, function (buff) return dot == 0 or buff.damageType == dot end) then
|
||||
local isBoss=BattleUtil.CheckIsBoss(defRole)
|
||||
if isBoss then
|
||||
return
|
||||
end
|
||||
-- 检测被动技能对秒杀参数得影响
|
||||
local bf, kf = BattleUtil.CheckSeckill(f1, f2, role, defRole)
|
||||
--
|
||||
local ft = defRole:GetRoleData(RoleDataName.Hp)/defRole:GetRoleData(RoleDataName.MaxHp)
|
||||
if ft < bf then
|
||||
BattleUtil.RandomAction(kf, function()
|
||||
-- 秒杀
|
||||
BattleUtil.Seckill(skill, role, defRole)
|
||||
end)
|
||||
end
|
||||
|
@ -2890,7 +2903,7 @@ local passivityList = {
|
|||
local i1 = args[1]
|
||||
|
||||
local onHit = function(target, damage, bCrit, finalDmg)
|
||||
if target:IsDead() and BattleUtil.CheckIsNoDead(target) then
|
||||
if target:IsDead() and not BattleUtil.CheckIsNoDead(target) then
|
||||
role:AddRage(i1, CountTypeName.Add)
|
||||
end
|
||||
end
|
||||
|
@ -3028,12 +3041,34 @@ local passivityList = {
|
|||
-- a[float]
|
||||
[161] = function(role, args)
|
||||
local f1 = args[1]
|
||||
|
||||
--之前为根据异常效果的数量改为根据异常效果的类型 by:王振兴
|
||||
local function onPassiveDamaging(damagingFunc, target, damage)
|
||||
local list = BattleLogic.BuffMgr:GetBuff(target, function(buff)
|
||||
return buff.type == BuffName.DOT or buff.type == BuffName.Control
|
||||
end)
|
||||
if list and damagingFunc then
|
||||
local num = #list
|
||||
--local list = BattleLogic.BuffMgr:GetBuff(target, function(buff)
|
||||
--return buff.type == BuffName.DOT or buff.type == BuffName.Control
|
||||
--end)
|
||||
local dotList={}
|
||||
local controlList={}
|
||||
local list=BattleLogic.BuffMgr:GetBuff(target)
|
||||
for i = 1, #list do
|
||||
local buff=list[i]
|
||||
if buff.type== BuffName.DOT and buff.damageType and dotList and not BattleUtil.ChecklistIsContainValue(dotList,buff.damageType) then
|
||||
table.insert(dotList,buff.damageType)
|
||||
end
|
||||
|
||||
if buff.type== BuffName.Control and buff.ctrlType and controlList and not BattleUtil.ChecklistIsContainValue(controlList,buff.ctrlType) then
|
||||
table.insert(controlList,buff.ctrlType)
|
||||
end
|
||||
end
|
||||
local num = 0
|
||||
|
||||
if dotList then
|
||||
num = num + #dotList
|
||||
end
|
||||
if controlList then
|
||||
num=num+ #controlList
|
||||
end
|
||||
if num>0 and damagingFunc then
|
||||
local dd = BattleUtil.CountValue(damage, f1 * num, CountTypeName.AddPencent) - damage
|
||||
damagingFunc(-floor(BattleUtil.ErrorCorrection(dd)))
|
||||
end
|
||||
|
@ -3133,7 +3168,8 @@ local passivityList = {
|
|||
local f1 = args[2]
|
||||
local onHit = function(target, damage, bCrit, finalDmg)
|
||||
if BattleLogic.BuffMgr:HasBuff(target, BuffName.DOT, function(buff) return buff.damageType == dot end) then
|
||||
BattleUtil.ApplyTreat(role, role, floor(BattleUtil.ErrorCorrection(finalDmg * f1)))
|
||||
--吸血修改 finaldamage 改为 damage by:往王振兴 2020/08/17
|
||||
BattleUtil.ApplyTreat(role, role, floor(BattleUtil.ErrorCorrection(damage * f1)))
|
||||
end
|
||||
end
|
||||
local onSkillCast = function(skill)
|
||||
|
@ -3211,7 +3247,7 @@ local passivityList = {
|
|||
local dt = args[2]
|
||||
-- 直接伤害后
|
||||
local onRoleHit = function(target, damage, bCrit, finalDmg, damageType, skill)
|
||||
if skill and not skill.isAdd and target:IsDead() and BattleUtil.CheckIsNoDead(target) then
|
||||
if skill and not skill.isAdd and target:IsDead() and not BattleUtil.CheckIsNoDead(target) then
|
||||
local list = RoleManager.Query(function(v) return v.camp ~= role.camp end)
|
||||
BattleUtil.SortByHpFactor(list, 1)
|
||||
local index = 0
|
||||
|
@ -3235,9 +3271,9 @@ local passivityList = {
|
|||
|
||||
local af = 0
|
||||
local onSkillCast = function(skill)
|
||||
local targets = skill:GetDirectTargets()
|
||||
if targets and #targets > 0 then
|
||||
af = BattleUtil.ErrorCorrection(f1/#targets)
|
||||
local maxNum = skill:GetMaxTargetNum()
|
||||
if maxNum and maxNum > 0 then
|
||||
af = BattleUtil.ErrorCorrection(f1/maxNum)
|
||||
end
|
||||
end
|
||||
role.Event:AddEvent(BattleEventName.SkillCast, onSkillCast)
|
||||
|
@ -3309,9 +3345,9 @@ local passivityList = {
|
|||
|
||||
local af = 0
|
||||
local onSkillCast = function(skill)
|
||||
local targets = skill.effectTargets[2]
|
||||
if targets and #targets > 0 then
|
||||
af = BattleUtil.ErrorCorrection(f1/#targets)
|
||||
local maxNum = skill:GetMaxTargetNum()
|
||||
if maxNum and maxNum > 0 then
|
||||
af = BattleUtil.ErrorCorrection(f1/maxNum)
|
||||
end
|
||||
end
|
||||
role.Event:AddEvent(BattleEventName.SkillCast, onSkillCast)
|
||||
|
@ -3365,9 +3401,9 @@ local passivityList = {
|
|||
|
||||
local af = 0
|
||||
local onSkillCast = function(skill)
|
||||
local targets = skill:GetDirectTargets()
|
||||
if targets and #targets > 0 then
|
||||
af = BattleUtil.ErrorCorrection(f1/#targets)
|
||||
local maxNum = skill:GetMaxTargetNum()
|
||||
if maxNum and maxNum > 0 then
|
||||
af = BattleUtil.ErrorCorrection(f1/maxNum)
|
||||
end
|
||||
end
|
||||
role.Event:AddEvent(BattleEventName.SkillCast, onSkillCast)
|
||||
|
@ -3436,9 +3472,9 @@ local passivityList = {
|
|||
|
||||
local af = 0
|
||||
local onSkillCast = function(skill)
|
||||
local targets = skill:GetDirectTargets()
|
||||
if targets and #targets > 0 then
|
||||
af = BattleUtil.ErrorCorrection(f1/#targets)
|
||||
local maxNum = skill:GetMaxTargetNum()
|
||||
if maxNum and maxNum > 0 then
|
||||
af = BattleUtil.ErrorCorrection(f1/maxNum)
|
||||
end
|
||||
end
|
||||
role.Event:AddEvent(BattleEventName.SkillCast, onSkillCast)
|
||||
|
@ -3477,15 +3513,13 @@ local passivityList = {
|
|||
end
|
||||
role.Event:AddEvent(BattleEventName.BuffCaster, onBuffCaster)
|
||||
end,
|
||||
|
||||
|
||||
-- 直接伤害击杀目标对仇恨目标造成[a]%物理伤害
|
||||
-- a[float]
|
||||
[185] = function(role, args)
|
||||
local f1 = args[1]
|
||||
|
||||
local onRoleHit = function(target)
|
||||
if target:IsDead() and BattleUtil.CheckIsNoDead(target) then
|
||||
if target:IsDead() and not BattleUtil.CheckIsNoDead(target) then
|
||||
local target = RoleManager.GetAliveAggro(role)
|
||||
BattleUtil.CalDamage(nil, role, target, 1, f1)
|
||||
end
|
||||
|
@ -3714,15 +3748,24 @@ local passivityList = {
|
|||
local f1 = args[1]
|
||||
|
||||
local OnRoleDamageBefore = function(defRole, factorFunc, damageType, skill)
|
||||
local targets = skill:GetDirectTargets()
|
||||
if not targets or #targets == 0 then return end
|
||||
local cf = f1/#targets
|
||||
for _, target in ipairs(targets) do
|
||||
BattleUtil.RandomAction(cf, function()
|
||||
BattleLogic.BuffMgr:ClearBuff(target, function(buff)
|
||||
return buff.type == BuffName.Shield and buff.shieldType == ShieldTypeName.AllReduce
|
||||
if skill then
|
||||
-- 计算概率
|
||||
local cf = f1
|
||||
local maxNum = skill:GetMaxTargetNum()
|
||||
if maxNum and maxNum > 0 then
|
||||
cf = cf/maxNum
|
||||
end
|
||||
|
||||
local targets = skill:GetDirectTargets()
|
||||
if not targets or #targets == 0 then return end
|
||||
|
||||
for _, target in ipairs(targets) do
|
||||
BattleUtil.RandomAction(cf, function()
|
||||
BattleLogic.BuffMgr:ClearBuff(target, function(buff)
|
||||
return buff.type == BuffName.Shield and buff.shieldType == ShieldTypeName.AllReduce
|
||||
end)
|
||||
end)
|
||||
end)
|
||||
end
|
||||
end
|
||||
end
|
||||
role.Event:AddEvent(BattleEventName.RoleDamageBefore, OnRoleDamageBefore)
|
||||
|
@ -3769,7 +3812,7 @@ local passivityList = {
|
|||
[197] = function(role, args)
|
||||
local f1 = args[1]
|
||||
local onRoleHit = function(target, damage, bCrit, finalDmg, damageType, skill)
|
||||
if skill and skill.type == BattleSkillType.Special and target:IsDead() and BattleUtil.CheckIsNoDead(target) then
|
||||
if skill and skill.type == BattleSkillType.Special and target:IsDead() and not BattleUtil.CheckIsNoDead(target) then
|
||||
BattleUtil.RandomAction(f1, function()
|
||||
role:AddRage(target.Rage, CountTypeName.Add)
|
||||
end)
|
||||
|
@ -3854,6 +3897,10 @@ local passivityList = {
|
|||
role:AddRage(i1, CountTypeName.Add)
|
||||
|
||||
local function onPassiveSeckill(func)
|
||||
local isBoss=BattleUtil.CheckIsBoss(defRole)
|
||||
if isBoss then
|
||||
return
|
||||
end
|
||||
if func then func(f1, CountTypeName.Cover) end
|
||||
end
|
||||
role.Event:AddEvent(BattleEventName.PassiveSeckill, onPassiveSeckill)
|
||||
|
@ -3885,9 +3932,6 @@ local passivityList = {
|
|||
end
|
||||
end
|
||||
role.Event:AddEvent(BattleEventName.RoleHit, onRoleHit)
|
||||
|
||||
|
||||
|
||||
-- 秒杀概率无法复活
|
||||
local function onSecKill(target)
|
||||
BattleUtil.RandomAction(f3, function()
|
||||
|
@ -3895,7 +3939,6 @@ local passivityList = {
|
|||
end)
|
||||
end
|
||||
role.Event:AddEvent(BattleEventName.Seckill, onSecKill)
|
||||
|
||||
end,
|
||||
|
||||
|
||||
|
@ -4229,7 +4272,11 @@ local passivityList = {
|
|||
if das > hp then -- 护盾后伤害值依然致死
|
||||
dd = dd - das + hp - 1
|
||||
end
|
||||
BattleUtil.ApplyDamage(nil, role, r, dd)
|
||||
--boss 免疫生命百分比伤害
|
||||
local isBoss=BattleUtil.CheckIsBoss(r)
|
||||
if not isBoss then
|
||||
BattleUtil.ApplyDamage(nil, role, r, dd)
|
||||
end
|
||||
--概率控制
|
||||
BattleUtil.RandomControl(f2, ctrl, role, r, i2)
|
||||
end
|
||||
|
@ -4420,6 +4467,10 @@ local passivityList = {
|
|||
local f1 = args[1]
|
||||
--
|
||||
local onRoleHit = function(defRole, damage, bCrit, finalDmg, damageType, skill)
|
||||
local isBoss=BattleUtil.CheckIsBoss(defRole)
|
||||
if isBoss then
|
||||
return
|
||||
end
|
||||
if skill and not defRole:IsDead() then
|
||||
-- 检测被动技能对秒杀参数得影响
|
||||
local bf, kf = BattleUtil.CheckSeckill(f1, 0, role, defRole)
|
||||
|
@ -4691,5 +4742,42 @@ local passivityList = {
|
|||
end
|
||||
BattleLogic.Event:AddEvent(BattleEventName.RoleRealDead, _OnRoleRealDead)
|
||||
end,
|
||||
-- 释放技能有[a]%概率释放[b]技能。
|
||||
-- a[float]b[int]
|
||||
[242] = function(role, args)
|
||||
local f1 = args[1]
|
||||
local f2 = args[2]
|
||||
local f3=args[3]
|
||||
-- 释放技能后
|
||||
local onSkillEnd = function(skill)
|
||||
if skill and skill.type == BattleSkillType.Special then
|
||||
BattleUtil.RandomAction(f1, function()
|
||||
role:InsertExtraSkill(f2,f3)
|
||||
end)
|
||||
end
|
||||
end
|
||||
role.Event:AddEvent(BattleEventName.SkillCastEnd, onSkillEnd)
|
||||
end,
|
||||
-- 直接伤害击杀目标释放[a]技能。
|
||||
-- a[float]
|
||||
[243] = function(role, args)
|
||||
local f1 = args[1]
|
||||
local f2=args[2]
|
||||
local onRoleHit = function(target)
|
||||
if target:IsDead() and not BattleUtil.CheckIsNoDead(target) and not role:IsDead() then
|
||||
-- local target = RoleManager.GetAliveAggro(role)
|
||||
--BattleUtil.CalDamage(nil, role, target, 1, f1)
|
||||
--加一个延时操作,防止有的英雄有死亡后再释放一次技能的被动 by:王振兴
|
||||
role:InsertExtraSkill(f1,f2)
|
||||
end
|
||||
end
|
||||
role.Event:AddEvent(BattleEventName.RoleHit, onRoleHit)
|
||||
end,
|
||||
--怪物的身份表份标识 挂上这个效果就会变成参数对应的类型
|
||||
[244] = function(role, args)
|
||||
local f1 = args[1]
|
||||
role.data.enemyType=f1
|
||||
BattleUtil.CheckIsBoss(role)
|
||||
end,
|
||||
}
|
||||
return passivityList
|
||||
|
|
|
@ -208,7 +208,7 @@ function Skill:Cast(func)
|
|||
--技能的施法时间计算,根据当前目标id关联的持续时间,取其中时间最长的一个
|
||||
local duration = self.hitTime + self.continueTime
|
||||
-- 结算时间向后延长0.2秒,避免在效果结算完成前就结束了技能释放
|
||||
BattleLogic.WaitForTrigger(duration + 0.2, function()
|
||||
BattleLogic.WaitForTrigger(duration + 0.4, function()
|
||||
self.owner.Event:DispatchEvent(BattleEventName.SkillCastEnd, self)
|
||||
BattleLogic.Event:DispatchEvent(BattleEventName.SkillCastEnd, self)
|
||||
|
||||
|
|
|
@ -1,6 +1,20 @@
|
|||
BattleLogManager = {}
|
||||
local this = BattleLogManager
|
||||
local isLog = true
|
||||
local isEditor = AppConst and AppConst.Platform == "EDITOR"
|
||||
local isMobile = AppConst and (AppConst.Platform == "ANDROID" or AppConst.Platform == "IOS")
|
||||
|
||||
local isDebug = false
|
||||
function LogBattle(str)
|
||||
if isDebug then
|
||||
if isEditor then
|
||||
LogGreen(str)
|
||||
else
|
||||
print(str)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
local isLog = (true and not isMobile) or isEditor
|
||||
|
||||
local function pairsByKeys(t)
|
||||
local a = {}
|
||||
|
@ -80,6 +94,7 @@ function this.Init(fightdata, userdata)
|
|||
end
|
||||
|
||||
this.logList = {}
|
||||
this.WriteFightDataToFile()
|
||||
end
|
||||
|
||||
function this.Log(...)
|
||||
|
@ -93,10 +108,14 @@ function this.Log(...)
|
|||
log = log .. string.format("%s = %s, ", key, value)
|
||||
end
|
||||
table.insert(this.logList, log)
|
||||
-- 如果log大于100条写一便日志到文件
|
||||
if #this.logList > 100 then
|
||||
this.WriteLogToFile()
|
||||
end
|
||||
end
|
||||
|
||||
function this.WriteFile()
|
||||
if not isLog then return end
|
||||
|
||||
function this.GetFile(wType)
|
||||
local time = string.format("%d-%d-%d-%d-%d-%d",
|
||||
os.date("%Y"),
|
||||
os.date("%m"),
|
||||
|
@ -108,29 +127,44 @@ function this.WriteFile()
|
|||
local platform
|
||||
-- linux
|
||||
if not file then
|
||||
file = io.open("../luafight/BattleRecord/log-"..(this.userId or time)..".txt", "a")
|
||||
file = io.open("../luafight/BattleRecord/log-"..(this.userId or time)..".txt", wType)
|
||||
platform = "Linux"
|
||||
end
|
||||
-- local window server
|
||||
if not file then
|
||||
file = io.open("luafight/BattleRecord/log-"..(this.userId or time)..".txt", "a")
|
||||
file = io.open("luafight/BattleRecord/log-"..(this.userId or time)..".txt", wType)
|
||||
platform = "Local Windows Server"
|
||||
end
|
||||
-- local
|
||||
if not file then
|
||||
file = io.open("BattleRecord/log-"..(this.userId or time)..".txt", "a")
|
||||
file = io.open("BattleRecord/log-"..(this.userId or time)..".txt", wType)
|
||||
platform = "Local"
|
||||
end
|
||||
|
||||
return file, platform
|
||||
end
|
||||
|
||||
|
||||
-- 将战斗数据写入log
|
||||
function this.WriteFightDataToFile()
|
||||
if not isLog then return end
|
||||
local file, platform = this.GetFile("w")
|
||||
file:write(platform..":\n\n\n")
|
||||
for i = 1, #this.logList do
|
||||
file:write(this.logList[i].."\n")
|
||||
end
|
||||
file:write("\n\n\n\n\n")
|
||||
file:write("fightData:\n")
|
||||
file:write(this.PrintBattleTable(this.fightdata))
|
||||
file:write("\n\n")
|
||||
file:write("timeStamp: " .. this.timestamp)
|
||||
file:write("\n\n\n\n\n")
|
||||
io.close(file)
|
||||
end
|
||||
|
||||
-- 将日志写入log
|
||||
function this.WriteLogToFile()
|
||||
if not isLog then return end
|
||||
local file, platform = this.GetFile("a")
|
||||
for i = 1, #this.logList do
|
||||
file:write(this.logList[i].."\n")
|
||||
end
|
||||
this.logList = {}
|
||||
io.close(file)
|
||||
end
|
||||
|
||||
|
|
|
@ -1,30 +1,27 @@
|
|||
BattleLogic = {}
|
||||
|
||||
local floor = math.floor
|
||||
local min = math.min
|
||||
-- local objList = BattleDictionary.New()
|
||||
local removeObjList = BattleList.New()
|
||||
|
||||
local MaxRound = 20
|
||||
local CurRound = 0
|
||||
local CurCamp = 0
|
||||
local CurSkillPos = {}
|
||||
local PosList = {}
|
||||
|
||||
local curFrame
|
||||
|
||||
BattleLogic.Type = 0 --1 故事副本 2 地图探索 3 竞技场 4 秘境boss 5 解锁秘境 6 公会战 7 血战 8 兽潮 9巅峰战
|
||||
BattleLogic.Type = -1 -- 0 切磋 1 故事副本 2 地图探索 3 竞技场 4 秘境boss 5 解锁秘境 6 公会战 7 血战 8 兽潮 9巅峰战
|
||||
BattleLogic.IsEnd = false
|
||||
BattleLogic.Result = -1
|
||||
BattleLogic.Event = BattleEvent.New()
|
||||
BattleLogic.BuffMgr = BuffManager.New()
|
||||
|
||||
local _IsDebug
|
||||
|
||||
local fightData
|
||||
local record
|
||||
local userData
|
||||
|
||||
--所有英雄伤害和治疗
|
||||
local allHeroDamage=0
|
||||
--所有怪的伤害和治疗
|
||||
local allEnemyDamage=0
|
||||
--是否开启战斗日志
|
||||
BattleLogic.IsOpenBattleRecord = false
|
||||
--逻辑帧频
|
||||
|
@ -34,8 +31,6 @@ BattleLogic.GameDeltaTime = 1 / BattleLogic.GameFrameRate
|
|||
BattleLogic.TotalOrder = 0
|
||||
--当前波次
|
||||
BattleLogic.CurOrder = 0
|
||||
|
||||
|
||||
local actionPool = BattleObjectPool.New(function ()
|
||||
return { 0, 0 }
|
||||
end)
|
||||
|
@ -65,7 +60,8 @@ function BattleLogic.Init(data, _userData, maxRound)
|
|||
|
||||
CurRound = 0
|
||||
MaxRound = maxRound or 20
|
||||
|
||||
allHeroDamage= 0
|
||||
allEnemyDamage= 0
|
||||
_IsDebug = false
|
||||
|
||||
BattleLogic.Event:ClearEvent()
|
||||
|
@ -78,8 +74,31 @@ function BattleLogic.Init(data, _userData, maxRound)
|
|||
OutDataManager.Init(fightData)
|
||||
PassiveManager.Init()
|
||||
BattleLogManager.Init(fightData, userData)
|
||||
end
|
||||
|
||||
--监听英雄受到治疗
|
||||
BattleLogic.Event:AddEvent(BattleEventName.RoleBeTreated,function (castRole, realTreat, treat)
|
||||
if castRole.camp==0 then
|
||||
LogBattle("我方 英雄治疗"..treat)
|
||||
allHeroDamage=allHeroDamage+treat
|
||||
else
|
||||
LogBattle("敌方 英雄治疗"..treat)
|
||||
allEnemyDamage=allEnemyDamage+treat
|
||||
end
|
||||
end)
|
||||
--监听英雄受到攻击
|
||||
BattleLogic.Event:AddEvent(BattleEventName.RoleBeDamaged,function (defRole, atkRole, damage, bCrit, finalDmg, damageType, dotType)
|
||||
--我方阵营总攻击
|
||||
if atkRole.camp==0 then
|
||||
allHeroDamage=allHeroDamage+damage
|
||||
LogBattle("我方 英雄攻击"..damage)
|
||||
--敌方阵营
|
||||
else
|
||||
allEnemyDamage=allEnemyDamage+damage
|
||||
LogBattle("敌方 英雄攻击"..damage)
|
||||
end
|
||||
end)
|
||||
|
||||
end
|
||||
-- 检测先手阵营
|
||||
function BattleLogic.CheckFirstCamp()
|
||||
-- 默认我方先手
|
||||
|
@ -161,6 +180,7 @@ end
|
|||
-- debugTurn 用于判断是否是debug轮转的参数
|
||||
function BattleLogic.TurnRound(debugTurn)
|
||||
if BattleLogic.GetIsDebug() and not debugTurn then
|
||||
LogBattle("-------------")
|
||||
BattleLogic.Event:DispatchEvent(BattleEventName.DebugStop)
|
||||
return
|
||||
end
|
||||
|
@ -182,6 +202,11 @@ function BattleLogic.TurnRound(debugTurn)
|
|||
CurCamp = (CurCamp + 1) % 2
|
||||
end
|
||||
|
||||
-- 这里再检测一次战斗结束
|
||||
if CurRound > MaxRound then
|
||||
return
|
||||
end
|
||||
|
||||
--
|
||||
BattleLogManager.Log(
|
||||
"Camp Change",
|
||||
|
@ -279,7 +304,18 @@ function BattleLogic.Update()
|
|||
return
|
||||
end
|
||||
if CurRound > MaxRound then
|
||||
BattleLogic.BattleEnd(0)
|
||||
if BattleLogic.Type==9 or BattleLogic.Type== 0 then
|
||||
LogBattle("我方总输出"..allHeroDamage.."敌方总输出:"..allEnemyDamage)
|
||||
if allHeroDamage>allEnemyDamage then
|
||||
LogBattle("争霸赛我方胜")
|
||||
BattleLogic.BattleEnd(1)
|
||||
else
|
||||
LogBattle("争霸赛敌方胜")
|
||||
BattleLogic.BattleEnd(0)
|
||||
end
|
||||
else
|
||||
BattleLogic.BattleEnd(0)
|
||||
end
|
||||
return
|
||||
end
|
||||
if roleResult == 1 then
|
||||
|
@ -306,9 +342,6 @@ function BattleLogic.Update()
|
|||
-- 检测buff
|
||||
BattleLogic.BuffMgr:Update()
|
||||
---
|
||||
-- 检测角色状态
|
||||
RoleManager.Update()
|
||||
|
||||
-- 检测死亡
|
||||
if RoleManager.CheckDead() then -- 单独用一帧执行死亡
|
||||
return
|
||||
|
@ -323,7 +356,9 @@ function BattleLogic.Update()
|
|||
BattleLogic.CheckTurnRound()
|
||||
-- 技能
|
||||
SkillManager.Update()
|
||||
|
||||
--如果有英雄有可以复活的技能,先执行技能逻辑,最后判断死亡人数 by:王振兴
|
||||
-- 检测角色状态
|
||||
RoleManager.Update()
|
||||
end
|
||||
|
||||
-- 战斗结束
|
||||
|
@ -336,7 +371,7 @@ function BattleLogic.BattleEnd(result)
|
|||
BattleLogic.Event:DispatchEvent(BattleEventName.BattleEnd, result)
|
||||
-- 战斗日志写入
|
||||
if not BattleLogic.GetIsDebug() then
|
||||
BattleLogManager.WriteFile()
|
||||
BattleLogManager.WriteLogToFile()
|
||||
end
|
||||
end
|
||||
--
|
||||
|
|
|
@ -120,6 +120,8 @@ BattleEventName = {
|
|||
SkillTargetCheck = indexAdd(),
|
||||
|
||||
DebugStop = indexAdd(),
|
||||
--显示提示文字
|
||||
ShowHintText = indexAdd(),
|
||||
}
|
||||
|
||||
index = 0
|
||||
|
@ -186,8 +188,23 @@ BattleSkillType = {
|
|||
Monster = 0,
|
||||
Normal = 1,
|
||||
Special = 2,
|
||||
--额外技能
|
||||
Extra = 3,
|
||||
--死亡后释放的技能
|
||||
DeadSkill = 4,
|
||||
}
|
||||
|
||||
--敌人类型
|
||||
EnemyType={
|
||||
--普通敌人
|
||||
normal = 0,
|
||||
--boss
|
||||
Boss = 1,
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
CountTypeName = {
|
||||
Add = 1,
|
||||
AddPencent = 2,
|
||||
|
@ -202,6 +219,15 @@ ShieldTypeName = {
|
|||
AllReduce = 3, -- 无敌护盾
|
||||
}
|
||||
|
||||
--额外释放技能
|
||||
ExtraReleaseSkill={
|
||||
skill1={1012051,1,0,1,{200000,{1,0.41,2}}},
|
||||
skill2={1132051,0.8,0,1,{200212,{1,0.89,2}}},
|
||||
skill3={1151111,0.05,0,1,{220000,{1,0.86,2}}},
|
||||
skill4={10000351,0.3,0.5,4,{400000,{1,1.75,1}}},
|
||||
}
|
||||
|
||||
|
||||
|
||||
-- 战斗表属性id对应战斗中属性数据
|
||||
BattlePropList = {
|
||||
|
|
|
@ -173,9 +173,11 @@ function BattleUtil.ChooseTarget(role, chooseId)
|
|||
end
|
||||
arr = tempArr
|
||||
elseif chooseLimit == 3 then-- 对列
|
||||
local myCol = role.position % 3
|
||||
local tempArr = BattleUtil.ChooseCol(arr, myCol)
|
||||
if #tempArr == 0 then -- 对列没有人,按顺序找到有人得列
|
||||
local target=RoleManager.GetAggro(role)
|
||||
if target then
|
||||
local myCol = target.position % 3
|
||||
local tempArr = BattleUtil.ChooseCol(arr, myCol)
|
||||
if #tempArr == 0 then -- 对列没有人,按顺序找到有人得列
|
||||
for i = 1, 3 do
|
||||
local col = i % 3 -- 0 表示第三列嗷
|
||||
tempArr = BattleUtil.ChooseCol(arr, col)
|
||||
|
@ -183,8 +185,10 @@ function BattleUtil.ChooseTarget(role, chooseId)
|
|||
break
|
||||
end
|
||||
end
|
||||
end
|
||||
arr = tempArr
|
||||
end
|
||||
arr = tempArr
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
-- 选择条件
|
||||
|
@ -205,7 +209,11 @@ function BattleUtil.ChooseTarget(role, chooseId)
|
|||
elseif chooseWeight == 7 then -- 对位及其相邻目标
|
||||
arr = RoleManager.GetNeighbor(role, chooseType)
|
||||
elseif chooseWeight == 8 then -- 对位
|
||||
arr = RoleManager.GetArrAggroList(role, arr)
|
||||
if num==1 then
|
||||
arr=RoleManager.GetAggroHero(role,arr)
|
||||
else
|
||||
arr = RoleManager.GetArrAggroList(role, arr)
|
||||
end
|
||||
-- elseif chooseWeight == 9 then -- 展位距离
|
||||
-- BattleUtil.Sort(arr, function(a, b)
|
||||
-- local r1 = math.abs(role.position - a.position) * 10 + a.position
|
||||
|
@ -213,7 +221,6 @@ function BattleUtil.ChooseTarget(role, chooseId)
|
|||
-- if sort == 1 then return r1 > r2 else return r1 < r2 end
|
||||
-- end)
|
||||
end
|
||||
|
||||
local finalArr = {}
|
||||
if num == 0 then
|
||||
finalArr = arr
|
||||
|
@ -275,7 +282,19 @@ function BattleUtil.PreCountShield(defRole, damage)
|
|||
end
|
||||
return damage
|
||||
end
|
||||
|
||||
--检测是否为boss
|
||||
function BattleUtil.CheckIsBoss(role)
|
||||
if not role then
|
||||
return
|
||||
end
|
||||
if role.data.enemyType==EnemyType.Boss then
|
||||
--弹免疫
|
||||
role.Event:DispatchEvent(BattleEventName.ShowHintText,2, 12391)
|
||||
return true
|
||||
else
|
||||
return false
|
||||
end
|
||||
end
|
||||
|
||||
-- 秒杀
|
||||
function BattleUtil.Seckill(skill, atkRole, defRole)
|
||||
|
@ -345,12 +364,37 @@ end
|
|||
--检测是否有是金翅大鹏有不灭效果
|
||||
function BattleUtil.CheckIsNoDead(target)
|
||||
if target then
|
||||
return target:IsAssignHeroAndHeroStar(10086,10)==false and BattleLogic.BuffMgr:HasBuff(target,BuffName.NoDead)==false
|
||||
return target:IsAssignHeroAndHeroStar(10086,10) or BattleLogic.BuffMgr:HasBuff(target,BuffName.NoDead)
|
||||
end
|
||||
return false
|
||||
return false
|
||||
end
|
||||
|
||||
--检测列表是否包含值
|
||||
function BattleUtil.ChecklistIsContainValue(_list,_value)
|
||||
if _list and _value then
|
||||
for key, value in pairs(_list) do
|
||||
if value==_value then
|
||||
return true
|
||||
else
|
||||
return false
|
||||
end
|
||||
end
|
||||
end
|
||||
return false
|
||||
end
|
||||
|
||||
-- 根据id获取额外技能
|
||||
function BattleUtil.GetExtraSkillbyId(id)
|
||||
if id==1 then
|
||||
return ExtraReleaseSkill.skill1
|
||||
elseif id==2 then
|
||||
return ExtraReleaseSkill.skill2
|
||||
elseif id==3 then
|
||||
return ExtraReleaseSkill.skill3
|
||||
elseif id==4 then
|
||||
return ExtraReleaseSkill.skill4
|
||||
end
|
||||
end
|
||||
|
||||
function BattleUtil.FinalDamage(skill, atkRole, defRole, damage, bCrit, damageType, dotType)
|
||||
if damage < 0 then damage = 0 end
|
||||
|
@ -530,8 +574,8 @@ function BattleUtil.ApplyTreat(castRole, targetRole, value, baseFactor)
|
|||
end
|
||||
castRole.Event:DispatchEvent(BattleEventName.RoleTreat, targetRole, treat, baseTreat)
|
||||
targetRole.Event:DispatchEvent(BattleEventName.RoleBeTreated, castRole, treat, baseTreat)
|
||||
|
||||
--
|
||||
--添加发送到battleLogic的治疗消息,用于计算总的战斗伤害值
|
||||
BattleLogic.Event:DispatchEvent(BattleEventName.RoleBeTreated, castRole, treat, baseTreat)
|
||||
BattleLogManager.Log(
|
||||
"Final Damage",
|
||||
"acamp", castRole.camp,
|
||||
|
|
|
@ -24,6 +24,7 @@ function RoleLogic.New()
|
|||
end
|
||||
|
||||
function RoleLogic:Init(uid, data, position)
|
||||
data.star = data.star or 1
|
||||
self.uid = uid
|
||||
self.position = position
|
||||
self.roleData = data
|
||||
|
@ -47,7 +48,6 @@ function RoleLogic:Init(uid, data, position)
|
|||
|
||||
self.skill = data.skill
|
||||
self.superSkill = data.superSkill
|
||||
|
||||
--首次读条时间=速度/(20*(等级+10)
|
||||
self.sp = 0
|
||||
local time = self:GetRoleData(RoleDataName.Speed)/(20*(self:GetRoleData(RoleDataName.Level)+10))
|
||||
|
@ -74,8 +74,6 @@ function RoleLogic:Init(uid, data, position)
|
|||
BattleUtil.Passivity[id](self, args)
|
||||
-- 加入被动列表
|
||||
table.insert(self.passiveList, {id, args})
|
||||
else
|
||||
--print("被动技能"..id.."不存在")
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -89,7 +87,7 @@ function RoleLogic:Init(uid, data, position)
|
|||
self.aiTempCount = 0
|
||||
|
||||
self.IsDebug = false
|
||||
|
||||
self.enemyType = EnemyType.normal
|
||||
self.lockTarget = nil --嘲讽
|
||||
self.ctrl_dizzy = false --眩晕 不能释放所有技能
|
||||
self.ctrl_slient = false --沉默 只能1技能
|
||||
|
@ -161,6 +159,12 @@ end
|
|||
|
||||
-- 改变怒气值
|
||||
function RoleLogic:AddRage(value, type)
|
||||
-- 角色身上有无敌盾,不扣除怒气 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
|
||||
LogBattle("角色身上有无敌盾,不扣除怒气")
|
||||
return
|
||||
end
|
||||
|
||||
local delta = 0
|
||||
if type == 1 then --加算
|
||||
delta = value
|
||||
|
@ -316,7 +320,7 @@ function RoleLogic:SkillCast(skill, func)
|
|||
skill:Cast(_CheckRage)
|
||||
|
||||
-- 没有沉默,释放大技能
|
||||
elseif skill.type == BattleSkillType.Special and not self.ctrl_slient then
|
||||
elseif (skill.type == BattleSkillType.Special or skill.type==BattleSkillType.Extra or skill.type==BattleSkillType.DeadSkill) and not self.ctrl_slient then
|
||||
-- 先消耗怒气
|
||||
if skill.isRage then
|
||||
if self.Rage < self.SuperSkillRage then
|
||||
|
@ -372,6 +376,31 @@ function RoleLogic:AddSkill(type, isRage, isAdd, targets)
|
|||
"targets", targets and #targets or "0"
|
||||
)
|
||||
end
|
||||
|
||||
--加入额外技能,用于额外释放技能 by:王振兴
|
||||
function RoleLogic:InsertExtraSkill(id,type)
|
||||
local effectData=BattleUtil.GetExtraSkillbyId(id)
|
||||
if effectData then
|
||||
local skillType=BattleSkillType.Extra
|
||||
--如果type为1则按绝技处理,不为1的话按额外技能处理(额外技能因为被动判断会判断是否是绝技类型,所以不会触发)
|
||||
if type==1 then
|
||||
skillType=BattleSkillType.Special
|
||||
end
|
||||
--和老史,佳琦确认果 附加技能算绝技 被沉默无法释放 可以套娃 递归触发 by:王振兴
|
||||
SkillManager.InsertSkill(self, effectData, skillType, nil, true, false)
|
||||
BattleLogManager.Log(
|
||||
"Add Skill",
|
||||
"camp", self.camp,
|
||||
"pos", self.position,
|
||||
"type", skillType,
|
||||
"isRage", tostring(false),
|
||||
"isAdd", tostring(true),
|
||||
"targets", targets and #targets or "0"
|
||||
)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
-- 插入一个技能
|
||||
function RoleLogic:InsertSkill(type, isRage, isAdd, targets)
|
||||
if not self.IsCanAddSkill and isAdd then return end
|
||||
|
@ -409,7 +438,6 @@ function RoleLogic:CastSkill(func)
|
|||
self:AddSkill(BattleSkillType.Normal, true, false, nil)
|
||||
return
|
||||
end
|
||||
--
|
||||
end
|
||||
|
||||
-- 强制释放技能,测试技能时使用
|
||||
|
@ -453,7 +481,7 @@ end
|
|||
-- 真的去死
|
||||
function RoleLogic:GoDead()
|
||||
if self:IsCanDead() then
|
||||
self.isRealDead = true
|
||||
self.isRealDead = true
|
||||
self.Rage = 0
|
||||
BattleLogic.BuffMgr:ClearBuff(self)
|
||||
self.Event:DispatchEvent(BattleEventName.RoleRealDead, self)
|
||||
|
@ -468,16 +496,16 @@ function RoleLogic:SetDeadFilter(filter)
|
|||
self.deadFilter = filter
|
||||
end
|
||||
-- 要死了
|
||||
function RoleLogic:SetDead()
|
||||
function RoleLogic:SetDead()
|
||||
self.isDead = true
|
||||
RoleManager.AddDeadRole(self)
|
||||
RoleManager.AddDeadRole(self)
|
||||
end
|
||||
-- 判断是否死亡
|
||||
function RoleLogic:IsDead()
|
||||
return self.isDead
|
||||
end
|
||||
function RoleLogic:IsRealDead()
|
||||
return self.isRealDead
|
||||
return self.isRealDead
|
||||
end
|
||||
|
||||
|
||||
|
|
|
@ -253,6 +253,27 @@ function this.GetArrAggroList(role, arr)
|
|||
end)
|
||||
return targetList
|
||||
end
|
||||
|
||||
--对位规则: 1敌方相同对位 2若死亡或不存在,选取相邻阵位最近且阵位索引最小的
|
||||
function this.GetAggroHero(role,arr)
|
||||
-- 计算开始位置
|
||||
if not arr then
|
||||
return
|
||||
end
|
||||
local startPos = role.position
|
||||
local targetList={}
|
||||
startPos = startPos > 3 and startPos - 3 or startPos
|
||||
for _, v in ipairs(arr) do
|
||||
local pos= v.position>3 and v.position -3 or v.position
|
||||
if pos==startPos then
|
||||
table.insert(targetList,v)
|
||||
end
|
||||
end
|
||||
if #targetList==0 then
|
||||
table.insert(targetList,arr[1])
|
||||
end
|
||||
return targetList
|
||||
end
|
||||
--获取对位相邻站位的人 chooseType 1 我方 2 敌方(对位的敌人受到嘲讽的影响,若对位的敌人死亡,则选取相邻最近的作为目标)
|
||||
function this.GetNeighbor(role, chooseType)
|
||||
local posList = {}
|
||||
|
|
|
@ -6,6 +6,7 @@ local skillPool = BattleObjectPool.New(function ()
|
|||
end)
|
||||
|
||||
--
|
||||
this.DeadSkillList = {} -- 人物死亡后技能队列,死亡技能优先级最高
|
||||
this.SkillList = {}
|
||||
this.IsSkilling = false
|
||||
-- 初始化
|
||||
|
@ -17,18 +18,31 @@ end
|
|||
function this.AddSkill(caster, effectData, type, targets, isAdd, isRage)
|
||||
local skill = skillPool:Get()
|
||||
skill:Init(caster, effectData, type, targets, isAdd, isRage)
|
||||
table.insert(this.SkillList, skill)
|
||||
if type == BattleSkillType.DeadSkill then -- 死亡技能加入单独的对列
|
||||
table.insert(this.DeadSkillList, skill)
|
||||
else
|
||||
table.insert(this.SkillList, skill)
|
||||
end
|
||||
return skill
|
||||
end
|
||||
-- 插入技能到技能列表首位
|
||||
function this.InsertSkill(caster, effectData, type, targets, isAdd, isRage)
|
||||
local skill = skillPool:Get()
|
||||
skill:Init(caster, effectData, type, targets, isAdd, isRage)
|
||||
table.insert(this.SkillList, 1, skill)
|
||||
if type == BattleSkillType.DeadSkill then -- 死亡技能加入单独的对列
|
||||
table.insert(this.DeadSkillList, 1, skill)
|
||||
else
|
||||
table.insert(this.SkillList, 1, skill)
|
||||
end
|
||||
return skill
|
||||
end
|
||||
-- 获取是否拥有我的技能未释放
|
||||
function this.HaveMySkill(role)
|
||||
for _, skill in ipairs(this.DeadSkillList) do
|
||||
if skill.owner == role then
|
||||
return true
|
||||
end
|
||||
end
|
||||
for _, skill in ipairs(this.SkillList) do
|
||||
if skill.owner == role then
|
||||
return true
|
||||
|
@ -43,9 +57,13 @@ function this.SetTurnRoundFunc(func)
|
|||
this.TurnRoundFunc = func
|
||||
end
|
||||
function this.CheckTurnRound()
|
||||
-- 如果正在释放技能
|
||||
if this.IsSkilling then
|
||||
return
|
||||
end
|
||||
if this.DeadSkillList and #this.DeadSkillList > 0 then
|
||||
return
|
||||
end
|
||||
if this.SkillList and #this.SkillList > 0 then
|
||||
return
|
||||
end
|
||||
|
@ -60,25 +78,61 @@ end
|
|||
|
||||
--
|
||||
function this.Update()
|
||||
-- 如果正在引导战斗
|
||||
if BattleManager and BattleManager.IsGuidePause() then
|
||||
return
|
||||
end
|
||||
--
|
||||
if this.IsSkilling then
|
||||
return
|
||||
end
|
||||
if not this.SkillList or #this.SkillList == 0 then
|
||||
|
||||
-- 判断是否有死亡技能
|
||||
-- 跟佳琦对的是角色死后只有死亡后释放的技能才能释放(DeadSkill) by:王振兴 2020/09/02 18:53
|
||||
if this.DeadSkillList and #this.DeadSkillList > 0 then
|
||||
|
||||
local skill = this.DeadSkillList[1]
|
||||
table.remove(this.DeadSkillList, 1)
|
||||
this.IsSkilling = true
|
||||
if skill.owner:IsDead() then
|
||||
skill.owner:SkillCast(skill, function()
|
||||
skill:Dispose()
|
||||
skillPool:Put(skill)
|
||||
this.IsSkilling = false
|
||||
-- 检测一下轮转
|
||||
this.CheckTurnRound()
|
||||
end)
|
||||
else
|
||||
this.IsSkilling = false
|
||||
this.CheckTurnRound()
|
||||
end
|
||||
return
|
||||
end
|
||||
|
||||
|
||||
-- 判断
|
||||
if this.SkillList and #this.SkillList > 0 then
|
||||
|
||||
local skill = this.SkillList[1]
|
||||
table.remove(this.SkillList, 1)
|
||||
this.IsSkilling = true
|
||||
-- 检测技能释放 只有角色不是死亡状态或角色身上有不灭
|
||||
if (not skill.owner:IsDead() or BattleUtil.CheckIsNoDead(skill.owner)) then
|
||||
skill.owner:SkillCast(skill, function()
|
||||
skill:Dispose()
|
||||
skillPool:Put(skill)
|
||||
this.IsSkilling = false
|
||||
-- 检测一下轮转
|
||||
this.CheckTurnRound()
|
||||
end)
|
||||
else
|
||||
this.IsSkilling = false
|
||||
this.CheckTurnRound()
|
||||
end
|
||||
|
||||
return
|
||||
end
|
||||
|
||||
local skill = this.SkillList[1]
|
||||
table.remove(this.SkillList, 1)
|
||||
this.IsSkilling = true
|
||||
-- 检测技能释放
|
||||
skill.owner:SkillCast(skill, function()
|
||||
skill:Dispose()
|
||||
skillPool:Put(skill)
|
||||
this.IsSkilling = false
|
||||
-- 检测一下轮转
|
||||
this.CheckTurnRound()
|
||||
end)
|
||||
end
|
||||
|
||||
-- 清除
|
||||
|
|
Loading…
Reference in New Issue