争霸赛胜负规则修改

wangzhenxing 2020-09-10 11:50:12 +09:00
parent 442daa6312
commit 49f0c19cea
2 changed files with 44 additions and 14 deletions

View File

@ -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.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
LogError("我方 英雄治疗"..treat)
allHeroDamage=allHeroDamage+treat
else
LogError("敌方 英雄治疗"..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
LogError("我方 英雄攻击"..damage)
--敌方阵营
else
allEnemyDamage=allEnemyDamage+damage
LogError("敌方 英雄攻击"..damage)
end
end)
end
-- 检测先手阵营
function BattleLogic.CheckFirstCamp()
-- 默认我方先手
@ -291,7 +310,18 @@ function BattleLogic.Update()
return
end
if CurRound > MaxRound then
if BattleLogic.Type==9 then
LogError("我方总输出"..allHeroDamage.."敌方总输出:"..allEnemyDamage)
if allHeroDamage>allEnemyDamage then
LogError("争霸赛我方胜")
BattleLogic.BattleEnd(1)
else
LogError("争霸赛敌方胜")
BattleLogic.BattleEnd(0)
end
else
BattleLogic.BattleEnd(0)
end
return
end
if roleResult == 1 then

View File

@ -562,8 +562,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,