back_recharge
wangyuan 2020-02-20 16:06:48 +08:00
parent 861c6a2ec5
commit bd54aea85e
2 changed files with 34 additions and 16 deletions

View File

@ -12,6 +12,9 @@ local curFrame
local playerSkillUsable
local enemySkillUsable
local bMyAllDead
local bEnemyAllDead
BattleLogic.Type = 0 --1 故事副本 2 地图探索 3 竞技场 4 秘境boss 5 解锁秘境 6 公会战 7 血战 8 兽潮 9巅峰战
BattleLogic.IsEnd = false
BattleLogic.Result = -1
@ -93,6 +96,9 @@ function BattleLogic.Init(maxTime, data, optionData)
playerSkillUsable = true
enemySkillUsable = true
bMyAllDead = false
bEnemyAllDead = false
BattleLogic.Event:ClearEvent()
BattleLogic.BuffMgr:Init()
BattleLogic.IsEnd = false
@ -132,7 +138,7 @@ function BattleLogic.StartOrder()
for k = 2, #v do
args[k-1] = v[k]
end
BattleUtil.Passivity[id](playerTeamDummyRole, args)
BattleLogic.TakeTeamPassivity(playerTeamDummyRole, id, args)
end
end
@ -155,7 +161,7 @@ function BattleLogic.StartOrder()
for k = 2, #v do
args[k-1] = v[k]
end
BattleUtil.Passivity[id](enemyTeamDummyRole, args)
BattleLogic.TakeTeamPassivity(enemyTeamDummyRole, id, args)
end
end
else
@ -181,12 +187,20 @@ function BattleLogic.StartOrder()
for k = 2, #v do
args[k-1] = v[k]
end
BattleUtil.Passivity[id](enemyTeamDummyRole, args)
BattleLogic.TakeTeamPassivity(enemyTeamDummyRole, id, args)
end
end
end
end
function BattleLogic.TakeTeamPassivity(teamCaster, id, args)
for i=1, objList.size do
if objList.vList[i].camp == teamCaster.camp then
BattleUtil.Passivity[id](objList.vList[i], args)
end
end
end
function BattleLogic.GetTeamSkill(camp, pos)
if camp == 0 then
return playerTeamSkillList[pos]
@ -360,6 +374,18 @@ function BattleLogic.Update()
BattleLogic.BattleEnd(0)
return
end
if bMyAllDead then
BattleLogic.BattleEnd(0)
return
end
if bEnemyAllDead then
if BattleLogic.CurOrder == BattleLogic.TotalOrder then
BattleLogic.BattleEnd(1)
else
BattleLogic.Event:DispatchEvent(BattleEventName.BattleOrderChange, BattleLogic.CurOrder + 1)
BattleLogic.StartOrder()
end
end
curStageFrame = curStageFrame + 1
@ -400,8 +426,8 @@ function BattleLogic.Update()
BattleLogic.BuffMgr:Update()
local bMyAllDead = true
local bEnemyAllDead = true
bMyAllDead = true
bEnemyAllDead = true
for i=1, objList.size do
local tmpObj = objList.vList[i]
if not tmpObj.isDead then
@ -413,17 +439,8 @@ function BattleLogic.Update()
end
end
end
if bMyAllDead then
BattleLogic.BattleEnd(0)
return
end
if bEnemyAllDead then
if BattleLogic.CurOrder == BattleLogic.TotalOrder then
BattleLogic.BattleEnd(1)
else
BattleLogic.Event:DispatchEvent(BattleEventName.BattleOrderChange, BattleLogic.CurOrder + 1)
BattleLogic.StartOrder()
end
if bEnemyAllDead and BattleLogic.CurOrder < BattleLogic.TotalOrder then
BattleLogic.Event:DispatchEvent(BattleEventName.BattleOrderEnd, BattleLogic.CurOrder)
end
end

View File

@ -6,6 +6,7 @@ end
BattleEventName = {
BattleOrderChange = indexAdd(),
BattleOrderEnd = indexAdd(),
BattleStageChange = indexAdd(),
BattleEnd = indexAdd(),
AddRole = indexAdd(),