=====================战斗修改及添加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
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

View File

@ -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

View File

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

View File

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

View File

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