战斗同步

back_recharge
duhui 2020-12-28 10:34:53 +08:00
parent ef6347f38d
commit 70dec4bc49
8 changed files with 87 additions and 89 deletions

View File

@ -2319,56 +2319,15 @@ local effectList = {
end)
end,
--直接斩杀[a] [b]%生命上限的伤害
--a[int 1:斩杀所有剩余血量 2:斩杀指定百分比血量] b[float]
--直接斩杀[a]%生命
[121] = function(caster, target, args, interval, skill)
local type = args[1]
local pro = args[2]
--boss不会被斩杀
local isBoss=BattleUtil.CheckIsBoss(target)
if isBoss then
return
end
if type==1 then
BattleUtil.SeckillHP(skill,caster,target,pro)
elseif type == 2 then
BattleUtil.Seckill(skill,caster,target)
end
end,
--给目标上麒麟印记(行动前[a]%几率受到[b]属性[c]%的伤害,生效后[d]%几率消失)
--a[float] b[属性] c[float] d[float]
[122] = function(caster, target, args, interval, skill)
local pro = args[1]
local pro1 = args[2]
local v1 = args[3]
local pro2 = args[4]
--boss不会被上麒麟印记
local isBoss=BattleUtil.CheckIsBoss(target)
if isBoss then
return
end
target:AddBuff(Buff.Create(caster, BuffName.KylinMark,0,pro,pro1,v1,pro2))
BattleUtil.SeckillHP(skill,caster,target,pro)
end,
--[a]%概率给目标上放逐效果
--a[float]
[123] = function(caster, target, args, interval, skill)
--boss不会被放逐
local pro=args[1]
local isBoss=BattleUtil.CheckIsBoss(target)
if isBoss then
return
end
BattleUtil.RandomAction(pro, function ()
target:AddBuff(Buff.Create(caster, BuffName.Exile,1))
end)
end,
}

View File

@ -42,7 +42,7 @@ function EffectCaster:DoEffect(caster, target, eff, duration, skill)
e.args[i] = eff.args[i]
end
-- 检测被动技能对技能参数的影响
-- 检测被动技能对技能参数的影响
local function _PassiveCheck(pe)
if pe then
e = pe
@ -60,7 +60,7 @@ end
function EffectCaster:takeEffect(caster, target, effects, effectIndex, duration, skill)
for k=1, #effects do
-- 如果不是第一个效果对列的第一个效果则判断是否命中
-- 如果不是第一个效果对列的第一个效果则判断是否命中
if k ~= 1 and effectIndex == 1 then
if self:CheckTargetIsHit(target) then
self:DoEffect(caster, target, effects[k], duration, skill)
@ -76,25 +76,25 @@ function EffectCaster:ChooseTarget()
--
self.effectTargets = {}
self.targetIsHit = {}
-- 先计算出技能的目标
-- 先计算出技能的目标
for i=1, #self.effectList do
-- 是否重新选择目标
-- 是否重新选择目标
local isReTarget = true
if self.targets and self.targets[i] then
self.effectTargets[i] = self.targets[i]
-- 判断是否有有效目标
-- 判断是否有有效目标
for _, role in ipairs(self.effectTargets[i]) do
if not role:IsRealDead() then
isReTarget = false
end
end
end
-- 重新选择目标
-- 重新选择目标
if isReTarget then
local effectGroup = self.effectList[i]
local chooseId = effectGroup.chooseId
self.effectTargets[i] = BattleUtil.ChooseTarget(self.skill.owner, chooseId)
-- 检测被动对攻击目标的影响
-- 检测被动对攻击目标的影响
if i == 1 then
local function _PassiveTarget(targets)
self.effectTargets[i] = targets
@ -105,19 +105,19 @@ function EffectCaster:ChooseTarget()
end
end
-- 释放技能
-- func 技能释放完成回调
-- 释放技能
-- func 技能释放完成回调
function EffectCaster:Cast()
-- 选择目标
-- 选择目标
self:ChooseTarget()
-- 对目标造成相应的效果
-- 对目标造成相应的效果
for i=1, #self.effectList do
local effectGroup = self.effectList[i]
local chooseId = effectGroup.chooseId
local arr = self.effectTargets[i]
if arr and #arr > 0 then
-- 效果延迟1帧生效
-- 效果延迟1帧生效
BattleLogic.WaitForTrigger(BattleLogic.GameDeltaTime, function()
local effects = effectGroup.effects
local weight = math.floor(chooseId % 10000 / 100)
@ -125,10 +125,10 @@ function EffectCaster:Cast()
if count == 0 then
count = #arr
end
-- 全部同时生效
-- 全部同时生效
for j=1, count do
if arr[j] and not arr[j]:IsRealDead() then
-- 检测是否命中
-- 检测是否命中
if i == 1 then
self.targetIsHit[arr[j]] = BattleUtil.CheckIsHit(self.skill.owner, arr[j])
end
@ -140,7 +140,7 @@ function EffectCaster:Cast()
end
end
-- 遍历技能命中目标
-- 遍历技能命中目标
function EffectCaster:ForeachTargets(func)
local targets = self:GetDirectTargets()
for _, role in ipairs(targets) do
@ -150,7 +150,7 @@ function EffectCaster:ForeachTargets(func)
end
end
-- 获取直接选择目标Id
-- 获取直接选择目标Id
function EffectCaster:GetDirectChooseId()
local effectGroup = self.effectList[1]
local chooseId = effectGroup.chooseId
@ -158,12 +158,12 @@ function EffectCaster:GetDirectChooseId()
end
-- 获取技能的直接目标,和策划规定第一个效果的目标为直接效果目标,(包含miss的目标)
-- 获取技能的直接目标,和策划规定第一个效果的目标为直接效果目标,(包含miss的目标)
function EffectCaster:GetDirectTargets()
return self.effectTargets[1]
end
-- 获取直接目标不包含miss的目标可能为空
-- 获取直接目标不包含miss的目标可能为空
function EffectCaster:GetDirectTargetsNoMiss()
local list = {}
for _, role in ipairs(self.effectTargets[1]) do
@ -174,7 +174,7 @@ function EffectCaster:GetDirectTargetsNoMiss()
return list
end
-- 获取技能目标最大人数
-- 获取技能目标最大人数
function EffectCaster:GetMaxTargetNum()
local mainEffect = self.effectList[1]
if not mainEffect then
@ -183,7 +183,7 @@ function EffectCaster:GetMaxTargetNum()
return BattleUtil.GetMaxTargetNum(mainEffect.chooseId)
end
-- 判断是否命中
-- 判断是否命中
function EffectCaster:CheckTargetIsHit(role)
return self.targetIsHit[role]
end

View File

@ -2307,7 +2307,7 @@ local passivityList = {
local ct = args[3]
role.isHaveNoDead = true
-- 角色死亡时
local onRoleDead = function()
local onRoleDead = function(atkRole)
-- -- 暂时不能死
-- role:SetDeadFilter(false)
@ -3638,7 +3638,12 @@ local passivityList = {
local finalDamage = BattleUtil.CountValue(damage, f1, ct)
local curHp = role:GetRoleData(RoleDataName.Hp)
--如果敌方忽略分摊就只减伤
if atkRole.ignoreShara then
local ignoreShara=atkRole.ignoreShara
--特殊处理 白骨精附加的普攻不会忽略分摊
if atkRole.roleId==10091 and skill and skill.type==BattleSkillType.Normal and skill.isAdd then
ignoreShara=false
end
if ignoreShara then
local dd = damage - finalDamage
damagingFunc(floor(BattleUtil.ErrorCorrection(dd)))
return
@ -3929,6 +3934,11 @@ local passivityList = {
local function onFinalBeDamage(damagingFunc, atkRole, damage, skill, dotType, bCrit, damageType)
-- 非直接伤害不免除
if not skill then
return
end
--
local maxDamage = role:GetRoleData(RoleDataName.MaxHp) * f1
curDamage = curDamage + damage
if curDamage > maxDamage then
@ -3951,8 +3961,13 @@ local passivityList = {
local f1 = args[1]
local onFinalDamage = function(damagingFunc, atkRole, defRole, damage, skill, dotType, bCrit, damageType)
local ignoreShara=atkRole.ignoreShara
--特殊处理 白骨精附加的普攻不会忽略分摊
if atkRole.roleId==10091 and skill and skill.type==BattleSkillType.Normal and skill.isAdd then
ignoreShara=false
end
--如果敌人免疫分摊
if atkRole and atkRole.ignoreShara then
if atkRole and ignoreShara then
return
end
if not role:IsDead() and skill and role.position ~= defRole.position and defRole.camp == role.camp and defRole.element == role.element then
@ -4907,6 +4922,7 @@ local passivityList = {
if skill and BattleUtil.ChecklistIsContainValue(skill.triggerPassivityId,id) then
return
end
--白骨精追加普攻不处罚特性
if skill and judge==1 and skill.type== BattleSkillType.Normal and skill.isAdd and skill.owner.roleId==10091 then
return
@ -5172,6 +5188,9 @@ local passivityList = {
if skill and skill.type== BattleSkillType.Extra and skill.owner.roleId==10015 and judge==1 then
return
end
if skill and skill.type== BattleSkillType.ChaosNormal and judge==1 then
return
end
if target:IsDead() and not BattleUtil.CheckIsNoDead(target) and not role:IsDead() then
-- local target = RoleManager.GetAliveAggro(role)
--BattleUtil.CalDamage(nil, role, target, 1, f1)
@ -5881,6 +5900,7 @@ local passivityList = {
if skill and skill.type== BattleSkillType.Extra and skill.owner.roleId==10015 and judge==1 then
return
end
if target:IsDead() and not BattleUtil.CheckIsNoDead(target) and not role:IsDead() then
--role:InsertExtraSkill(f1,f2)
local effectData={role.superSkill[1],role.superSkill[2],role.superSkill[3],role.superSkill[4],{targets,{1,f1,f2}}}
@ -5957,10 +5977,16 @@ local passivityList = {
--造成伤害暴击后,将伤害的[a]%转化为自身生命治疗自己
--a[float]
[289] = function(role, args)
[289] = function(role, args,id,judge)
local f1 = args[1]
local OnDamage = function(defRole, damage, bCrit, finalDmg)
BattleUtil.CalTreat(role, role, floor(f1 * finalDmg))
local OnDamage = function(defRole, damage, bCrit, finalDmg,damageType,skill)
--白骨精追加普攻不处罚特性
if skill and judge==1 and skill.type== BattleSkillType.Normal and skill.isAdd and skill.owner.roleId==10091 then
return
end
BattleUtil.CalTreat(role, role, floor(f1 * damage))
end
role.Event:AddEvent(BattleEventName.RoleCrit, OnDamage)
end,

View File

@ -76,11 +76,12 @@ function BattleLogic.Init(data, _userData, maxRound)
-- 监听英雄受到治疗
BattleLogic.Event:AddEvent(BattleEventName.RoleBeTreated,function (castRole, realTreat, treat)
if castRole.camp==0 then
allHeroDamage=allHeroDamage+treat
else
allEnemyDamage=allEnemyDamage+treat
end
--巅峰争霸赛和切磋超时改为只判断总伤害,不再判断总治疗
-- if castRole.camp==0 then
-- allHeroDamage=allHeroDamage+treat
-- else
-- allEnemyDamage=allEnemyDamage+treat
-- end
end)
--监听英雄受到攻击
BattleLogic.Event:AddEvent(BattleEventName.RoleBeDamaged,function (defRole, atkRole, damage, bCrit, finalDmg, damageType, dotType)
@ -272,7 +273,8 @@ function BattleLogic.CheckBattleLogic()
CurSkillPos[CurCamp] = p
-- 自己阵营中的位置 + 自己阵营的ID * 6 = 自己在PosList中的位置
local role = RoleManager.GetRole(CurCamp, p) --PosList[p + (CurCamp * 6)]
if role and not role:IsRealDead() then
--角色如果被放逐不能行动 by:wangzhenxing 2020/12/23 11:35
if role and not role:IsRealDead() then
SkillRole = role
break
end
@ -283,6 +285,7 @@ function BattleLogic.CheckBattleLogic()
BattleLogic.BuffMgr:TurnUpdate(3) -- 计算持续伤害(流血)
BattleLogic.BuffMgr:TurnUpdate(4) -- 计算其他buff
BattleLogic.BuffMgr:PassUpdate() -- 计算buff轮数
BattleLogic.BuffMgr:PassUpdateNoDead() -- 计算buff不灭
end
-- 如果找不到下一个人,直接交换阵营
if not SkillRole then
@ -308,6 +311,7 @@ function BattleLogic.CheckBattleLogic()
BattleLogic.BuffMgr:TurnUpdate(3) -- 计算持续伤害(流血)
BattleLogic.BuffMgr:TurnUpdate(4) -- 计算其他buff
BattleLogic.BuffMgr:PassUpdate() -- 计算buff轮数
BattleLogic.BuffMgr:PassUpdateNoDead() -- 计算buff不灭
SkillRole.Event:DispatchEvent(BattleEventName.RoleTurnEnd, SkillRole) -- 行动结束
BattleLogic.Event:DispatchEvent(BattleEventName.RoleTurnEnd, SkillRole) -- 开始行动
BattleLogic.TurnRoundNextFrame()
@ -359,7 +363,7 @@ function BattleLogic.Update()
return
end
if CurRound > MaxRound then
if BattleLogic.Type==9 or BattleLogic.Type== 0 then
if BattleLogic.Type==9 or BattleLogic.Type==17 then
if allHeroDamage>allEnemyDamage then
BattleLogic.BattleEnd(1)
else

View File

@ -23,12 +23,12 @@ function Control:OnStart()
self.target.ctrl_noheal = true
elseif self.ctrlType == 5 then --致盲
self.target.ctrl_blind = true
elseif self.ctrlType == 7 then --麻痹
self.target.ctrl_palsy = true
elseif self.ctrlType == 8 then --混乱
self.target.ctrl_chaos = true
end
end
--间隔N帧触发返回true时表示继续触发返回false立刻触发OnEnd
@ -50,8 +50,7 @@ function Control:OnEnd()
elseif self.ctrlType == 4 then --禁疗
self.target.ctrl_noheal = false
elseif self.ctrlType == 5 then --致盲
self.target.ctrl_blind = false
self.target.ctrl_blind = false
elseif self.ctrlType == 7 then --麻痹
self.target.ctrl_palsy = false
elseif self.ctrlType==8 then --混乱

View File

@ -40,6 +40,7 @@ end
-- 计算护盾
function Shield:CountShield(damage, atkRole,skill)
self.atk = atkRole
local isImmuneAllReduceShield=false
local finalDamage = 0
if self.shieldType == ShieldTypeName.NormalReduce then
@ -64,7 +65,12 @@ function Shield:CountShield(damage, atkRole,skill)
end
elseif self.shieldType == ShieldTypeName.AllReduce then
--攻击者免疫无敌盾
if atkRole.isImmuneAllReduceShield and skill then
isImmuneAllReduceShield=atkRole.isImmuneAllReduceShield
--特殊处理 白骨精附加的普攻不会必定暴击
if atkRole.roleId==10091 and skill and skill.type==BattleSkillType.Normal and skill.isAdd then
isImmuneAllReduceShield=false
end
if isImmuneAllReduceShield and skill then
finalDamage=damage
else
finalDamage = 0
@ -78,7 +84,7 @@ function Shield:CountShield(damage, atkRole,skill)
--
-- self.caster.Event:DispatchEvent(BattleEventName.ShildTrigger, self)
self.target.Event:DispatchEvent(BattleEventName.ShildTrigger, self,atkRole)
self.target.Event:DispatchEvent(BattleEventName.ShildTrigger, self,isImmuneAllReduceShield)
BattleLogic.Event:DispatchEvent(BattleEventName.ShildTrigger, self)
return finalDamage

View File

@ -272,7 +272,6 @@ function BattleUtil.ChooseTarget(role, chooseId)
else
arr = RoleManager.GetArrAggroList(role, arr)
end
-- body
-- elseif chooseWeight == 9 then -- 展位距离
-- BattleUtil.Sort(arr, function(a, b)
-- local r1 = math.abs(role.position - a.position) * 10 + a.position
@ -593,9 +592,14 @@ function BattleUtil.CalDamage(skill, atkRole, defRole, damageType, baseFactor, i
-- 是否暴击: 暴击率 = 自身暴击率 - 对方抗暴率
local bCrit = false
local critRandom = Random.Range01()
--特殊处理 白骨精附加的普攻不会必定暴击
local mustCrit=atkRole.mustCrit
if atkRole.roleId==10091 and skill and skill.type==BattleSkillType.Normal and skill.isAdd then
mustCrit=false
end
local critCondition = clamp(atkRole:GetRoleData(RoleDataName.Crit) - defRole:GetRoleData(RoleDataName.Tenacity), 0, 1)
bCrit = critRandom <= critCondition
bCrit =atkRole.mustCrit or bCrit or defRole.isFlagCrit == true -- 必定暴击
bCrit =mustCrit or bCrit or defRole.isFlagCrit == true -- 必定暴击
-- 计算暴伤害系数
local critDamageFactor = 1
@ -726,16 +730,18 @@ end
-- 检测命中
function BattleUtil.CheckIsHit(atkRole, defRole)
function BattleUtil.CheckIsHit(atkRole, defRole,skill)
-- 是否命中: 命中 = 自身命中率 - 对方闪避率
local isHit = false
if atkRole.mustHit then
return true
local mustHit = atkRole.mustHit
--特殊处理 白骨精附加的普攻不会必定暴击
if atkRole.roleId==10091 and skill and skill.type==BattleSkillType.Normal and skill.isAdd then
mustHit=false
end
local hitRandom = Random.Range01()
local hitCondition = clamp(atkRole:GetRoleData(RoleDataName.Hit) - defRole:GetRoleData(RoleDataName.Dodge), 0, 1)
isHit = hitRandom <= hitCondition
return isHit
return mustHit or isHit
end

View File

@ -55,8 +55,6 @@ function RoleLogic:Init(uid, data, position)
self.RageGrow = 2 -- 普通技能怒气成长
self.SuperSkillRage = 4 -- 技能需要释放的怒气值默认为4
self.NoRageRate = 0 -- 不消耗怒气值的概率
--
self.isImmuneReduceRage=false --是否免疫减怒
self.aiOrder = data.ai
self.aiIndex = 1