diff --git a/Assets/ManagedResources/~Lua/Modules/Battle/Logic/Base/Effect.lua b/Assets/ManagedResources/~Lua/Modules/Battle/Logic/Base/Effect.lua index 634d4aced6..5a076e0eb2 100644 --- a/Assets/ManagedResources/~Lua/Modules/Battle/Logic/Base/Effect.lua +++ b/Assets/ManagedResources/~Lua/Modules/Battle/Logic/Base/Effect.lua @@ -2122,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() and BattleUtil.CheckIsNoDead(target) then + if target:IsDead() and not BattleUtil.CheckIsNoDead(target) then caster:AddBuff(Buff.Create(caster, BuffName.PropertyChange, 0, BattlePropList[pro1], f2, ct)) end end diff --git a/Assets/ManagedResources/~Lua/Modules/Battle/Logic/Base/Passivity.lua b/Assets/ManagedResources/~Lua/Modules/Battle/Logic/Base/Passivity.lua index 0633d019b9..ee6cafb15c 100644 --- a/Assets/ManagedResources/~Lua/Modules/Battle/Logic/Base/Passivity.lua +++ b/Assets/ManagedResources/~Lua/Modules/Battle/Logic/Base/Passivity.lua @@ -1479,11 +1479,11 @@ local passivityList = { [78] = function(role, args) local pro = args[1] local f1 = args[2] - LogError("开始治疗") + LogBattle("开始治疗") --这里加一个延时,防止执行时显示层还没有初始化,从而没有表现 BattleLogic.WaitForTrigger(0.05, function() - local val = floor(BattleUtil.FP_Mul(f1, role:GetRoleData(BattlePropList[pro]))) - BattleUtil.CalTreat(role, role, val) + local val = floor(BattleUtil.FP_Mul(f1, role:GetRoleData(BattlePropList[pro]))) + BattleUtil.CalTreat(role, role, val) end) end, --战斗结束时,为自身回复[a]*[b]的血量。 @@ -1566,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 @@ -1785,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) @@ -1993,7 +1993,7 @@ local passivityList = { local i1 = args[1] -- 释放技能后 local onRoleHit = function(target) - 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 @@ -2039,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 @@ -2228,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 @@ -2383,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 @@ -2522,7 +2522,7 @@ local passivityList = { local list = skill:GetDirectTargetsNoMiss() if list then local tv = floor(BattleUtil.ErrorCorrection(role:GetRoleData(BattlePropList[pro]) * f1)) - LogError(role:GetRoleData(pro).." ".. f1.." " .. tv) + 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 @@ -2546,7 +2546,7 @@ local passivityList = { local list = skill:GetDirectTargetsNoMiss() if list then local tv = floor(BattleUtil.ErrorCorrection(role:GetRoleData(BattlePropList[pro]) * f1)) - LogError(role:GetRoleData(pro).." ".. f1.." " .. tv) + 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 @@ -2765,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) @@ -2903,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 @@ -3247,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 @@ -3519,7 +3519,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 target = RoleManager.GetAliveAggro(role) BattleUtil.CalDamage(nil, role, target, 1, f1) end @@ -3812,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) @@ -3898,9 +3898,9 @@ local passivityList = { local function onPassiveSeckill(func) local isBoss=BattleUtil.CheckIsBoss(defRole) - if isBoss then - return - end + if isBoss then + return + end if func then func(f1, CountTypeName.Cover) end end role.Event:AddEvent(BattleEventName.PassiveSeckill, onPassiveSeckill) @@ -4752,9 +4752,7 @@ local passivityList = { local onSkillEnd = function(skill) if skill and skill.type == BattleSkillType.Special then BattleUtil.RandomAction(f1, function() - BattleLogic.WaitForTrigger(0.1, function() - role:InsertExtraSkill(f2,f3) - end) + role:InsertExtraSkill(f2,f3) end) end end @@ -4766,14 +4764,11 @@ local passivityList = { local f1 = args[1] local f2=args[2] local onRoleHit = function(target) - if target:IsDead() and BattleUtil.CheckIsNoDead(target) and not role:IsDead() then - -- local target = RoleManager.GetAliveAggro(role) - --BattleUtil.CalDamage(nil, role, target, 1, f1) - --加一个延时操作,防止有的英雄有死亡后再释放一次技能的被动 by:王振兴 - BattleLogic.WaitForTrigger(1, function() + 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 end role.Event:AddEvent(BattleEventName.RoleHit, onRoleHit) @@ -4783,7 +4778,6 @@ local passivityList = { local f1 = args[1] role.data.enemyType=f1 BattleUtil.CheckIsBoss(role) - LogError("111111") end, } return passivityList \ No newline at end of file diff --git a/Assets/ManagedResources/~Lua/Modules/Battle/Logic/BattleLogManager.lua b/Assets/ManagedResources/~Lua/Modules/Battle/Logic/BattleLogManager.lua index 342a23b7b5..8f2f6afd60 100644 --- a/Assets/ManagedResources/~Lua/Modules/Battle/Logic/BattleLogManager.lua +++ b/Assets/ManagedResources/~Lua/Modules/Battle/Logic/BattleLogManager.lua @@ -1,6 +1,19 @@ BattleLogManager = {} local this = BattleLogManager -local isLog = false and AppConst.platform == "EDITOR" +local isEditor = AppConst and AppConst.Platform == "EDITOR" + +local isDebug = false +function LogBattle(str) + if isDebug then + if isEditor then + LogGreen(str) + else + print(str) + end + end +end + +local isLog = true or isEditor local function pairsByKeys(t) local a = {} @@ -93,6 +106,8 @@ function this.Log(...) log = log .. string.format("%s = %s, ", key, value) end table.insert(this.logList, log) + -- 打印一下 + LogBattle(log) end function this.WriteFile() @@ -108,17 +123,17 @@ 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", "w") 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", "w") 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", "w") platform = "Local" end diff --git a/Assets/ManagedResources/~Lua/Modules/Battle/Logic/BattleLogic.lua b/Assets/ManagedResources/~Lua/Modules/Battle/Logic/BattleLogic.lua index 4f6e250d75..c40216cf6f 100644 --- a/Assets/ManagedResources/~Lua/Modules/Battle/Logic/BattleLogic.lua +++ b/Assets/ManagedResources/~Lua/Modules/Battle/Logic/BattleLogic.lua @@ -78,10 +78,10 @@ function BattleLogic.Init(data, _userData, maxRound) --监听英雄受到治疗 BattleLogic.Event:AddEvent(BattleEventName.RoleBeTreated,function (castRole, realTreat, treat) if castRole.camp==0 then - LogError("我方 英雄治疗"..treat) + LogBattle("我方 英雄治疗"..treat) allHeroDamage=allHeroDamage+treat else - LogError("敌方 英雄治疗"..treat) + LogBattle("敌方 英雄治疗"..treat) allEnemyDamage=allEnemyDamage+treat end end) @@ -89,12 +89,12 @@ end) BattleLogic.Event:AddEvent(BattleEventName.RoleBeDamaged,function (defRole, atkRole, damage, bCrit, finalDmg, damageType, dotType) --我方阵营总攻击 if atkRole.camp==0 then - allHeroDamage=allHeroDamage+damage - LogError("我方 英雄攻击"..damage) + allHeroDamage=allHeroDamage+damage + LogBattle("我方 英雄攻击"..damage) --敌方阵营 else - allEnemyDamage=allEnemyDamage+damage - LogError("敌方 英雄攻击"..damage) + allEnemyDamage=allEnemyDamage+damage + LogBattle("敌方 英雄攻击"..damage) end end) @@ -180,8 +180,7 @@ end -- debugTurn 用于判断是否是debug轮转的参数 function BattleLogic.TurnRound(debugTurn) if BattleLogic.GetIsDebug() and not debugTurn then - LogGreen(Language[10227]) - LogBlue("-------------") + LogBattle("-------------") BattleLogic.Event:DispatchEvent(BattleEventName.DebugStop) return end @@ -191,7 +190,6 @@ function BattleLogic.TurnRound(debugTurn) CurCamp = BattleLogic.FirstCamp -- 判断先手阵营 CurSkillPos[0] = 0 CurSkillPos[1] = 0 - LogGreen(Language[10228]..CurRound) -- BattleLogManager.Log( "Round Change", @@ -209,8 +207,6 @@ function BattleLogic.TurnRound(debugTurn) return end - - LogGreen(Language[10229]..CurCamp) -- BattleLogManager.Log( "Camp Change", @@ -239,13 +235,11 @@ function BattleLogic.TurnRound(debugTurn) end -- 如果找不到下一个人,直接交换阵营 if not SkillRole then - LogGreen(Language[10230]) BattleLogManager.Log( "No Skill Position" ) BattleLogic.TurnRoundNextFrame() return end - LogGreen(Language[10231]..CurSkillPos[CurCamp]) -- BattleLogManager.Log( "Position Change", @@ -311,12 +305,12 @@ function BattleLogic.Update() end if CurRound > MaxRound then if BattleLogic.Type==9 or BattleLogic.Type== 0 then - LogError("我方总输出"..allHeroDamage.."敌方总输出:"..allEnemyDamage) + LogBattle("我方总输出"..allHeroDamage.."敌方总输出:"..allEnemyDamage) if allHeroDamage>allEnemyDamage then - LogError("争霸赛我方胜") + LogBattle("争霸赛我方胜") BattleLogic.BattleEnd(1) else - LogError("争霸赛敌方胜") + LogBattle("争霸赛敌方胜") BattleLogic.BattleEnd(0) end else diff --git a/Assets/ManagedResources/~Lua/Modules/Battle/Logic/Misc/BattleUtil.lua b/Assets/ManagedResources/~Lua/Modules/Battle/Logic/Misc/BattleUtil.lua index 4c7887f1f3..ab23fad49f 100644 --- a/Assets/ManagedResources/~Lua/Modules/Battle/Logic/Misc/BattleUtil.lua +++ b/Assets/ManagedResources/~Lua/Modules/Battle/Logic/Misc/BattleUtil.lua @@ -284,16 +284,16 @@ function BattleUtil.PreCountShield(defRole, 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,Language[12391]) - return true -else - return false -end + 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 -- 秒杀 @@ -364,9 +364,9 @@ 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 --检测列表是否包含值 @@ -385,15 +385,15 @@ 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 + 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) diff --git a/Assets/ManagedResources/~Lua/Modules/Battle/Logic/RoleLogic.lua b/Assets/ManagedResources/~Lua/Modules/Battle/Logic/RoleLogic.lua index 85dd8f7f83..6753f6b1f6 100644 --- a/Assets/ManagedResources/~Lua/Modules/Battle/Logic/RoleLogic.lua +++ b/Assets/ManagedResources/~Lua/Modules/Battle/Logic/RoleLogic.lua @@ -73,8 +73,6 @@ function RoleLogic:Init(uid, data, position) BattleUtil.Passivity[id](self, args) -- 加入被动列表 table.insert(self.passiveList, {id, args}) - else - LogRed(Language[10232]..id..Language[10233]) end end end @@ -162,7 +160,7 @@ 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 - LogError("角色身上有无敌盾,不扣除怒气") + LogBattle("角色身上有无敌盾,不扣除怒气") return end @@ -431,18 +429,14 @@ function RoleLogic:CastSkill(func) -- 没有沉默 if not self.ctrl_slient and self.Rage >= self.SuperSkillRage then -- 释放大技能 - LogBlue(Language[10234]) self:AddSkill(BattleSkillType.Special, true, false, nil) return end -- 没有麻痹 释放普通技能 if not self.ctrl_palsy then - LogBlue(Language[10235]) self:AddSkill(BattleSkillType.Normal, true, false, nil) return end - -- - LogBlue(Language[10236]) end -- 强制释放技能,测试技能时使用 @@ -460,10 +454,8 @@ function RoleLogic:ForceCastSkill(type, targets, func) SkillManager.SetTurnRoundFunc(func) -- 释放技能 if type == 1 and self.skill then - LogBlue(Language[10237]) self:AddSkill(BattleSkillType.Normal, true, false, nil) elseif type == 2 and self.superSkill then - LogBlue(Language[10238]) if self.Rage < self.SuperSkillRage then self.Rage = self.SuperSkillRage end diff --git a/Assets/ManagedResources/~Lua/Modules/Battle/Logic/SkillManager.lua b/Assets/ManagedResources/~Lua/Modules/Battle/Logic/SkillManager.lua index f4674b73dd..fe7baff755 100644 --- a/Assets/ManagedResources/~Lua/Modules/Battle/Logic/SkillManager.lua +++ b/Assets/ManagedResources/~Lua/Modules/Battle/Logic/SkillManager.lua @@ -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 @@ -47,6 +61,9 @@ 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 @@ -69,26 +86,51 @@ function this.Update() if this.IsSkilling then return end - if not this.SkillList or #this.SkillList == 0 then - return - end - - local skill = this.SkillList[1] - table.remove(this.SkillList, 1) - this.IsSkilling = true - -- 检测技能释放 只有角色不是死亡状态或角色身上有不灭 或这释放的技能为死亡后才释放的技能 - --跟佳琦对的是角色死后只有死亡后释放的技能才能释放(DeadSkill) by:王振兴 2020/09/02 18:53 - if (not skill.owner:IsDead() or not BattleUtil.CheckIsNoDead(skill.owner)) or skill.type == BattleSkillType.DeadSkill then - skill.owner:SkillCast(skill, function() - skill:Dispose() - skillPool:Put(skill) + + -- 判断是否有死亡技能 + -- 跟佳琦对的是角色死后只有死亡后释放的技能才能释放(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) - 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 end diff --git a/Assets/ManagedResources/~Lua/Modules/Battle/View/RoleView.lua b/Assets/ManagedResources/~Lua/Modules/Battle/View/RoleView.lua index 6ab908ede8..4e85ce9b6a 100644 --- a/Assets/ManagedResources/~Lua/Modules/Battle/View/RoleView.lua +++ b/Assets/ManagedResources/~Lua/Modules/Battle/View/RoleView.lua @@ -354,8 +354,8 @@ local TextFloatingColor = { Green = 4, } --单纯显示提示文字 -function RoleView:OnShowHintText(type,text) - self:TextBuffFloating(type,text) +function RoleView:OnShowHintText(type,LanguageIndex) + self:TextBuffFloating(type,Language[LanguageIndex]) end