From 4a1adfa7bda8d734e33d37c2e3c5410426c7851d Mon Sep 17 00:00:00 2001 From: wangzhenxing Date: Wed, 21 Jun 2023 20:22:23 +0800 Subject: [PATCH] =?UTF-8?q?=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D?= =?UTF-8?q?=3D=3D=3D=3D=3D=3D=E6=88=98=E6=96=97=E4=BF=AE=E6=94=B9=E5=8F=8A?= =?UTF-8?q?=E6=B7=BB=E5=8A=A0log?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Modules/Battle/Logic/Base/BattleEvent.lua | 9 +++++ .../~Lua/Modules/Battle/Logic/Base/Buff.lua | 8 ++++ .../Modules/Battle/Logic/Misc/BattleUtil.lua | 39 +++++++++++++------ .../Modules/Battle/Logic/Role/RoleData.lua | 3 +- .../Modules/Battle/Logic/Role/RoleManager.lua | 1 + 5 files changed, 48 insertions(+), 12 deletions(-) diff --git a/Assets/ManagedResources/~Lua/Modules/Battle/Logic/Base/BattleEvent.lua b/Assets/ManagedResources/~Lua/Modules/Battle/Logic/Base/BattleEvent.lua index 96b9e372ff..464636a8c6 100644 --- a/Assets/ManagedResources/~Lua/Modules/Battle/Logic/Base/BattleEvent.lua +++ b/Assets/ManagedResources/~Lua/Modules/Battle/Logic/Base/BattleEvent.lua @@ -66,6 +66,15 @@ function BattleEvent:DispatchEvent(sEventName, ...) if v.once then self:RemoveEvent(sEventName, v) end + if v.role~=nil then + BattleLogManager.Log( + "send event", + "event id==", tostring(sEventName), + "camp", tostring(v.role.camp), + "pos", tostring(v.role.position) + ) + end + end end diff --git a/Assets/ManagedResources/~Lua/Modules/Battle/Logic/Base/Buff.lua b/Assets/ManagedResources/~Lua/Modules/Battle/Logic/Base/Buff.lua index c079ff66b8..47112c3197 100644 --- a/Assets/ManagedResources/~Lua/Modules/Battle/Logic/Base/Buff.lua +++ b/Assets/ManagedResources/~Lua/Modules/Battle/Logic/Base/Buff.lua @@ -183,6 +183,14 @@ function BuffManager:AddBuff(target, buff) buff.caster.Event:DispatchEvent(BattleEventName.BuffCaster, buff) buff.caster.Event:DispatchEvent(BattleEventName.BuffCaster2, buff) buff.target.Event:DispatchEvent(BattleEventName.BuffBeAdd, buff) + BattleLogManager.Log( + "Role add Buff", + "buff.type", tostring(buff.type), + "target.camp==", tostring(target.camp), + "target.position", tostring(target.position), + "caster.camp==", tostring(buff.caster.camp), + "caster.position", tostring(buff.caster.position) + ) -- 用于记录统计 BattleLogic.Event:DispatchEvent(BattleEventName.RecordBuff, buff.caster, buff.target, buff) end diff --git a/Assets/ManagedResources/~Lua/Modules/Battle/Logic/Misc/BattleUtil.lua b/Assets/ManagedResources/~Lua/Modules/Battle/Logic/Misc/BattleUtil.lua index 0341f266ce..ce2d0a289a 100644 --- a/Assets/ManagedResources/~Lua/Modules/Battle/Logic/Misc/BattleUtil.lua +++ b/Assets/ManagedResources/~Lua/Modules/Battle/Logic/Misc/BattleUtil.lua @@ -229,6 +229,21 @@ function BattleUtil.RemoveNoDeadRole(arr) end end end + +--按怒气排序 +function BattleUtil.SortByPos(arr, sort) + BattleUtil.Sort(arr, function(a, b) + local r1 = a.Rage + local r2 = b.Rage + if sort == 1 then + return a.position>b.position + else + return a.position0 then + BattleUtil.SortByPos(RealDeadList,1) for i = 1, #RealDeadList do if RealDeadList[i].camp==type then return RealDeadList[i]