From 48cc9357c13a0a4de9542acd1804488bf24b354f Mon Sep 17 00:00:00 2001 From: wangzhenxing Date: Fri, 24 Sep 2021 14:46:02 +0800 Subject: [PATCH] =?UTF-8?q?[=E6=88=98=E6=96=97]=3D=3D=3D=3D=3D=3D=3D=3D=3D?= =?UTF-8?q?=3D=E8=A2=AB=E5=8A=A8194=E4=BF=AE=E6=94=B9=20=20=20=E6=96=B0?= =?UTF-8?q?=E5=A2=9E=E8=A2=AB=E5=8A=A8251=20=20=20=E9=A2=9D=E5=A4=96?= =?UTF-8?q?=E8=A1=8C=E5=8A=A8=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Modules/Battle/Logic/Base/Passivity.lua | 47 ++++++++++---- .../~Lua/Modules/Battle/Logic/BattleLogic.lua | 65 ++++++++++++++++++- .../~Lua/Modules/Battle/Logic/Buff/Blood.lua | 5 ++ 3 files changed, 103 insertions(+), 14 deletions(-) diff --git a/Assets/ManagedResources/~Lua/Modules/Battle/Logic/Base/Passivity.lua b/Assets/ManagedResources/~Lua/Modules/Battle/Logic/Base/Passivity.lua index 73b5927bc9..793c94c356 100644 --- a/Assets/ManagedResources/~Lua/Modules/Battle/Logic/Base/Passivity.lua +++ b/Assets/ManagedResources/~Lua/Modules/Battle/Logic/Base/Passivity.lua @@ -4114,17 +4114,21 @@ local passivityList = { 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) + BattleUtil.RandomAction(cf, function() + BattleLogic.BuffMgr:ClearBuff(defRole, function(buff) + return buff.type == BuffName.Shield and buff.shieldType == ShieldTypeName.AllReduce end) - end + end) + --local targets = skill:GetDirectTargets() + --if not targets or #targets == 0 then return end + -- for _, target in ipairs(targets) do + -- LogError("11111111111") + -- 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 role.Event:AddEvent(BattleEventName.RoleDamageBefore, OnRoleDamageBefore,nil,nil,role) @@ -7933,7 +7937,12 @@ local passivityList = { return end local rDamage =floor(f1 * damage) - role:AddBuff(Buff.Create(role, BuffName.Blood,0, rDamage)) + + if role.bloodShield then + role.bloodShield:AddValue(rDamage) + else + role:AddBuff(Buff.Create(role, BuffName.Blood,0, rDamage)) + end end role.Event:AddEvent(BattleEventName.RoleBeHit, onBeHit,nil,nil,role) @@ -8273,6 +8282,22 @@ local passivityList = { BattleLogic.Event:AddEvent(BattleEventName.BattleRoundChange, onRoundChange) end, + --每回合开始,为自己添加[a][b]%的御甲 + --a[int],b[float] + [351] = function(role, args,id,judge) + local pro = args[1] + local v1 = args[2] + local onRoundChange=function(curRound) + local val = floor(BattleUtil.FP_Mul(v1, role:GetRoleData(BattlePropList[pro]))) + --如果身上有御甲就添加御甲的值 + if role.bloodShield then + role.bloodShield:AddValue(val) + else--没有就上御甲buff + role:AddBuff(Buff.Create(role, BuffName.Blood,0, val)) + end + end + BattleLogic.Event:AddEvent(BattleEventName.BattleRoundStart, onRoundChange,nil,nil,role) + end } return passivityList \ No newline at end of file diff --git a/Assets/ManagedResources/~Lua/Modules/Battle/Logic/BattleLogic.lua b/Assets/ManagedResources/~Lua/Modules/Battle/Logic/BattleLogic.lua index bb45ba8e7f..0cbed82875 100644 --- a/Assets/ManagedResources/~Lua/Modules/Battle/Logic/BattleLogic.lua +++ b/Assets/ManagedResources/~Lua/Modules/Battle/Logic/BattleLogic.lua @@ -1,4 +1,4 @@ -require("Modules.Battle.Logic.HardStageCondition") +require("Modules.Battle.Logic.HardStageCondition") require("Modules.Battle.Logic.HardStageEventManager") BattleLogic = {} local floor = math.floor @@ -234,8 +234,12 @@ function BattleLogic.TurnRound(debugTurn) -- 第一次进入 或者 本轮结束 初始化流程状态 if CurRound == 0 or (CurSkillPos[0] == 6 and CurSkillPos[1] == 6) then if CurRound ~= 0 then - -- 上一轮结束 - BattleLogic.Event:DispatchEvent(BattleEventName.BattleRoundEnd, CurRound) + if BattleLogic.CheckHaveInsertRole() then + return + else + -- 上一轮结束 + BattleLogic.Event:DispatchEvent(BattleEventName.BattleRoundEnd, CurRound) + end end -- 检测一次灵兽技能 SkillManager.CheckMonsterSkill(function() @@ -378,6 +382,61 @@ function BattleLogic.CheckBattleLogic() SkillRole:CastSkill() end +--检测是否有插入得英雄 +function BattleLogic.CheckHaveInsertRole() + if insertSkillRole then + local SkillRole=insertSkillRole + insertSkillRole=nil + -- 如果找不到下一个人,直接交换阵营 + if not SkillRole then + BattleLogManager.Log( "No Skill Position" ) + BattleLogic.TurnRoundNextFrame() + return + end + -- + BattleLogManager.Log( + "Position Change", + "position", CurSkillPos[CurCamp] + ) + + -- 行动 + SkillRole.Event:DispatchEvent(BattleEventName.RoleTurnStart, SkillRole) -- 开始行动 + BattleLogic.Event:DispatchEvent(BattleEventName.RoleTurnStart, SkillRole) -- 开始行动 + -- buff计算 + BattleLogic.BuffMgr:TurnUpdate(1) -- 计算恢复血量 + BattleLogic.BuffMgr:TurnUpdate(2) -- 计算持续伤害(除去流血) + -- 设置行动完成回调 + SkillManager.SetTurnRoundFunc(function() + 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() + end) + + -- 如果角色无法释放技能 + if not SkillRole:IsAvailable() -- 角色不能释放技能 + or (SkillRole:IsDead() -- 将死状态 + and not BattleLogic.BuffMgr:HasBuff(SkillRole,BuffName.NoDead) --将死但没有不死buff + and not SkillManager.HaveMySkill(SkillRole)) -- 也没有要释放的技能 + then + SkillManager.CheckTurnRound() + return + end + + -- 释放技能后,递归交换阵营 + SkillRole:CastSkill() + return true + else + return false + end + +end + + + function BattleLogic.WaitForTrigger(delayTime, action) delayTime = BattleUtil.ErrorCorrection(delayTime) local delayFrame = floor(delayTime * BattleLogic.GameFrameRate + 0.5) diff --git a/Assets/ManagedResources/~Lua/Modules/Battle/Logic/Buff/Blood.lua b/Assets/ManagedResources/~Lua/Modules/Battle/Logic/Buff/Blood.lua index d88bbadc76..050447c982 100644 --- a/Assets/ManagedResources/~Lua/Modules/Battle/Logic/Buff/Blood.lua +++ b/Assets/ManagedResources/~Lua/Modules/Battle/Logic/Buff/Blood.lua @@ -9,6 +9,11 @@ function Blood:SetData(...) end +function Blood:AddValue(value) + self.bloodValue=self.bloodValue+value +end + + --初始化后调用一次 function Blood:OnStart()