争霸赛胜负规则修改
parent
442daa6312
commit
49f0c19cea
|
|
@ -1,30 +1,27 @@
|
||||||
BattleLogic = {}
|
BattleLogic = {}
|
||||||
|
|
||||||
local floor = math.floor
|
local floor = math.floor
|
||||||
local min = math.min
|
local min = math.min
|
||||||
-- local objList = BattleDictionary.New()
|
-- local objList = BattleDictionary.New()
|
||||||
local removeObjList = BattleList.New()
|
local removeObjList = BattleList.New()
|
||||||
|
|
||||||
local MaxRound = 20
|
local MaxRound = 20
|
||||||
local CurRound = 0
|
local CurRound = 0
|
||||||
local CurCamp = 0
|
local CurCamp = 0
|
||||||
local CurSkillPos = {}
|
local CurSkillPos = {}
|
||||||
local PosList = {}
|
local PosList = {}
|
||||||
|
|
||||||
local curFrame
|
local curFrame
|
||||||
|
|
||||||
BattleLogic.Type = 0 --1 故事副本 2 地图探索 3 竞技场 4 秘境boss 5 解锁秘境 6 公会战 7 血战 8 兽潮 9巅峰战
|
BattleLogic.Type = 0 --1 故事副本 2 地图探索 3 竞技场 4 秘境boss 5 解锁秘境 6 公会战 7 血战 8 兽潮 9巅峰战
|
||||||
BattleLogic.IsEnd = false
|
BattleLogic.IsEnd = false
|
||||||
BattleLogic.Result = -1
|
BattleLogic.Result = -1
|
||||||
BattleLogic.Event = BattleEvent.New()
|
BattleLogic.Event = BattleEvent.New()
|
||||||
BattleLogic.BuffMgr = BuffManager.New()
|
BattleLogic.BuffMgr = BuffManager.New()
|
||||||
|
|
||||||
local _IsDebug
|
local _IsDebug
|
||||||
|
|
||||||
local fightData
|
local fightData
|
||||||
local record
|
local record
|
||||||
local userData
|
local userData
|
||||||
|
--所有英雄伤害和治疗
|
||||||
|
local allHeroDamage=0
|
||||||
|
--所有怪的伤害和治疗
|
||||||
|
local allEnemyDamage=0
|
||||||
--是否开启战斗日志
|
--是否开启战斗日志
|
||||||
BattleLogic.IsOpenBattleRecord = false
|
BattleLogic.IsOpenBattleRecord = false
|
||||||
--逻辑帧频
|
--逻辑帧频
|
||||||
|
|
@ -34,8 +31,6 @@ BattleLogic.GameDeltaTime = 1 / BattleLogic.GameFrameRate
|
||||||
BattleLogic.TotalOrder = 0
|
BattleLogic.TotalOrder = 0
|
||||||
--当前波次
|
--当前波次
|
||||||
BattleLogic.CurOrder = 0
|
BattleLogic.CurOrder = 0
|
||||||
|
|
||||||
|
|
||||||
local actionPool = BattleObjectPool.New(function ()
|
local actionPool = BattleObjectPool.New(function ()
|
||||||
return { 0, 0 }
|
return { 0, 0 }
|
||||||
end)
|
end)
|
||||||
|
|
@ -65,7 +60,8 @@ function BattleLogic.Init(data, _userData, maxRound)
|
||||||
|
|
||||||
CurRound = 0
|
CurRound = 0
|
||||||
MaxRound = maxRound or 20
|
MaxRound = maxRound or 20
|
||||||
|
allHeroDamage= 0
|
||||||
|
allEnemyDamage= 0
|
||||||
_IsDebug = false
|
_IsDebug = false
|
||||||
|
|
||||||
BattleLogic.Event:ClearEvent()
|
BattleLogic.Event:ClearEvent()
|
||||||
|
|
@ -78,8 +74,31 @@ function BattleLogic.Init(data, _userData, maxRound)
|
||||||
OutDataManager.Init(fightData)
|
OutDataManager.Init(fightData)
|
||||||
PassiveManager.Init()
|
PassiveManager.Init()
|
||||||
BattleLogManager.Init(fightData, userData)
|
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()
|
function BattleLogic.CheckFirstCamp()
|
||||||
-- 默认我方先手
|
-- 默认我方先手
|
||||||
|
|
@ -291,7 +310,18 @@ function BattleLogic.Update()
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
if CurRound > MaxRound then
|
if CurRound > MaxRound then
|
||||||
BattleLogic.BattleEnd(0)
|
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
|
return
|
||||||
end
|
end
|
||||||
if roleResult == 1 then
|
if roleResult == 1 then
|
||||||
|
|
|
||||||
|
|
@ -562,8 +562,8 @@ function BattleUtil.ApplyTreat(castRole, targetRole, value, baseFactor)
|
||||||
end
|
end
|
||||||
castRole.Event:DispatchEvent(BattleEventName.RoleTreat, targetRole, treat, baseTreat)
|
castRole.Event:DispatchEvent(BattleEventName.RoleTreat, targetRole, treat, baseTreat)
|
||||||
targetRole.Event:DispatchEvent(BattleEventName.RoleBeTreated, castRole, treat, baseTreat)
|
targetRole.Event:DispatchEvent(BattleEventName.RoleBeTreated, castRole, treat, baseTreat)
|
||||||
|
--添加发送到battleLogic的治疗消息,用于计算总的战斗伤害值
|
||||||
--
|
BattleLogic.Event:DispatchEvent(BattleEventName.RoleBeTreated, castRole, treat, baseTreat)
|
||||||
BattleLogManager.Log(
|
BattleLogManager.Log(
|
||||||
"Final Damage",
|
"Final Damage",
|
||||||
"acamp", castRole.camp,
|
"acamp", castRole.camp,
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue