=====================战斗修改及添加log

dev_fengTi_And
wangzhenxing 2023-06-21 20:22:23 +08:00 committed by PC-202302260912\Administrator
parent 122addf38f
commit 543bdb6579
5 changed files with 48 additions and 12 deletions

View File

@ -66,6 +66,15 @@ function BattleEvent:DispatchEvent(sEventName, ...)
if v.once then if v.once then
self:RemoveEvent(sEventName, v) self:RemoveEvent(sEventName, v)
end 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
end end

View File

@ -183,6 +183,14 @@ function BuffManager:AddBuff(target, buff)
buff.caster.Event:DispatchEvent(BattleEventName.BuffCaster, buff) buff.caster.Event:DispatchEvent(BattleEventName.BuffCaster, buff)
buff.caster.Event:DispatchEvent(BattleEventName.BuffCaster2, buff) buff.caster.Event:DispatchEvent(BattleEventName.BuffCaster2, buff)
buff.target.Event:DispatchEvent(BattleEventName.BuffBeAdd, 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) BattleLogic.Event:DispatchEvent(BattleEventName.RecordBuff, buff.caster, buff.target, buff)
end end

View File

@ -229,6 +229,21 @@ function BattleUtil.RemoveNoDeadRole(arr)
end end
end 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.position<b.position
end
end)
return arr
end
--按怒气排序 --按怒气排序
function BattleUtil.SortByRage(arr, sort) function BattleUtil.SortByRage(arr, sort)
BattleUtil.Sort(arr, function(a, b) BattleUtil.Sort(arr, function(a, b)
@ -448,17 +463,19 @@ function BattleUtil.ChooseTarget(role, chooseId,queryType)
arr=RoleManager.GetNeighbor(list[1], chooseType) arr=RoleManager.GetNeighbor(list[1], chooseType)
end end
elseif chooseWeight ==15 then --我方阵亡 elseif chooseWeight ==15 then --我方阵亡
--BattleUtil.WaitForTrigger(BattleLogic.GameDeltaTime,function()
local aaa=RoleManager.GetDeadRole(role.camp) local aaa=RoleManager.GetDeadRole(role.camp)
if aaa~=nil then if aaa~=nil then
--LogError(aaa.position) --LogError(aaa.position)
end end
if aaa then if aaa then
aaa.isRealDead=false aaa.isRealDead=false
arr={} arr={}
table.insert(arr,aaa) table.insert(arr,aaa)
end BattleUtil.SortByPos(arr, sort)
-- return aaa return {arr[1]}
end
--end)
elseif chooseWeight ==16 then --(血量百分比 含不灭) elseif chooseWeight ==16 then --(血量百分比 含不灭)
BattleUtil.SortByHpFactor(arr, sort) BattleUtil.SortByHpFactor(arr, sort)
elseif chooseWeight ==17 then --怒气 elseif chooseWeight ==17 then --怒气

View File

@ -42,7 +42,8 @@ function RoleData:SetValue(name, value)
"camp", self.role.camp, "camp", self.role.camp,
"position", self.role.position, "position", self.role.position,
"propId", name, "propId", name,
"value", value) "value", value,
"change value", delta)
end end
end end
end end

View File

@ -93,6 +93,7 @@ function this.AddDeadRole(role)
end end
function this.GetDeadRole(type) function this.GetDeadRole(type)
if RealDeadList and #RealDeadList>0 then if RealDeadList and #RealDeadList>0 then
BattleUtil.SortByPos(RealDeadList,1)
for i = 1, #RealDeadList do for i = 1, #RealDeadList do
if RealDeadList[i].camp==type then if RealDeadList[i].camp==type then
return RealDeadList[i] return RealDeadList[i]