From 541b4fc271c556cb2efbfe5062ab4bedc61355b4 Mon Sep 17 00:00:00 2001 From: gaoxin Date: Fri, 25 Sep 2020 12:22:12 +0800 Subject: [PATCH] =?UTF-8?q?=E6=88=98=E6=96=97=E9=80=BB=E8=BE=91=E5=90=8C?= =?UTF-8?q?=E6=AD=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../~Lua/Modules/Battle/Logic/Base/Effect.lua | 2 +- .../Modules/Battle/Logic/Base/Passivity.lua | 85 +++++++++++-------- .../Modules/Battle/Logic/BattleLogManager.lua | 23 ++++- .../~Lua/Modules/Battle/Logic/BattleLogic.lua | 64 +++++++++----- .../Modules/Battle/Logic/Misc/BattleUtil.lua | 40 ++++++--- .../~Lua/Modules/Battle/Logic/RoleLogic.lua | 10 +-- .../Modules/Battle/Logic/SkillManager.lua | 82 +++++++++++++----- .../~Lua/Modules/Battle/View/RoleView.lua | 8 +- 8 files changed, 211 insertions(+), 103 deletions(-) diff --git a/Assets/ManagedResources/~Lua/Modules/Battle/Logic/Base/Effect.lua b/Assets/ManagedResources/~Lua/Modules/Battle/Logic/Base/Effect.lua index 61f90d9a81..c70e92fc4b 100644 --- a/Assets/ManagedResources/~Lua/Modules/Battle/Logic/Base/Effect.lua +++ b/Assets/ManagedResources/~Lua/Modules/Battle/Logic/Base/Effect.lua @@ -2118,7 +2118,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 aabe0ae621..ee6cafb15c 100644 --- a/Assets/ManagedResources/~Lua/Modules/Battle/Logic/Base/Passivity.lua +++ b/Assets/ManagedResources/~Lua/Modules/Battle/Logic/Base/Passivity.lua @@ -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 @@ -1782,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) @@ -1990,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 @@ -2036,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 @@ -2225,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 @@ -2380,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 @@ -2518,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 @@ -2541,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 @@ -2760,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) @@ -2849,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 @@ -2895,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 @@ -3239,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 @@ -3511,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 @@ -3804,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) @@ -3889,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) @@ -3920,9 +3932,6 @@ local passivityList = { end end role.Event:AddEvent(BattleEventName.RoleHit, onRoleHit) - - - -- 秒杀概率无法复活 local function onSecKill(target) BattleUtil.RandomAction(f3, function() @@ -3930,7 +3939,6 @@ local passivityList = { end) end role.Event:AddEvent(BattleEventName.Seckill, onSecKill) - end, @@ -4264,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 @@ -4455,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) @@ -4736,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 @@ -4750,17 +4764,20 @@ 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) end, + --怪物的身份表份标识 挂上这个效果就会变成参数对应的类型 + [244] = function(role, args) + local f1 = args[1] + role.data.enemyType=f1 + BattleUtil.CheckIsBoss(role) + 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 07f51ec900..c40216cf6f 100644 --- a/Assets/ManagedResources/~Lua/Modules/Battle/Logic/BattleLogic.lua +++ b/Assets/ManagedResources/~Lua/Modules/Battle/Logic/BattleLogic.lua @@ -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,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 @@ -172,7 +190,6 @@ function BattleLogic.TurnRound(debugTurn) CurCamp = BattleLogic.FirstCamp -- 判断先手阵营 CurSkillPos[0] = 0 CurSkillPos[1] = 0 - LogGreen(Language[10228]..CurRound) -- BattleLogManager.Log( "Round Change", @@ -190,8 +207,6 @@ function BattleLogic.TurnRound(debugTurn) return end - - LogGreen(Language[10229]..CurCamp) -- BattleLogManager.Log( "Camp Change", @@ -220,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", @@ -291,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 diff --git a/Assets/ManagedResources/~Lua/Modules/Battle/Logic/Misc/BattleUtil.lua b/Assets/ManagedResources/~Lua/Modules/Battle/Logic/Misc/BattleUtil.lua index df1dd051f6..ab23fad49f 100644 --- a/Assets/ManagedResources/~Lua/Modules/Battle/Logic/Misc/BattleUtil.lua +++ b/Assets/ManagedResources/~Lua/Modules/Battle/Logic/Misc/BattleUtil.lua @@ -282,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) @@ -352,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 --检测列表是否包含值 @@ -373,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) @@ -562,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, diff --git a/Assets/ManagedResources/~Lua/Modules/Battle/Logic/RoleLogic.lua b/Assets/ManagedResources/~Lua/Modules/Battle/Logic/RoleLogic.lua index c78160548c..da7f54d3d0 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 ec4f6fa5cd..e093e6bb37 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 @@ -46,6 +60,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 @@ -64,26 +81,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 53963859ac..4e85ce9b6a 100644 --- a/Assets/ManagedResources/~Lua/Modules/Battle/View/RoleView.lua +++ b/Assets/ManagedResources/~Lua/Modules/Battle/View/RoleView.lua @@ -71,7 +71,7 @@ function RoleView.New(go, role, position, root) role.Event:AddEvent(BattleEventName.BuffDurationChange, instance.OnBuffRoundChange, instance) role.Event:AddEvent(BattleEventName.ShildTrigger, instance.OnShieldTrigger, instance) - + role.Event:AddEvent(BattleEventName.ShowHintText,instance.OnShowHintText,instance) instance.hpCache = instance.role:GetRoleData(RoleDataName.Hp) / instance.role:GetRoleData(RoleDataName.MaxHp) instance.hpSlider = Util.GetGameObject(go, "hpProgress/hp"):GetComponent("Image") instance.hpPassSlider = Util.GetGameObject(go, "hpProgress/hpPass"):GetComponent("Image") @@ -353,6 +353,12 @@ local TextFloatingColor = { Purple = 3, Green = 4, } +--单纯显示提示文字 +function RoleView:OnShowHintText(type,LanguageIndex) + self:TextBuffFloating(type,Language[LanguageIndex]) +end + + function RoleView:TextBuffFloating(type, text) local color if type == 1 then --蓝色 增益 效果抵抗