同步战斗逻辑

back_recharge
lvxinran 2019-07-15 19:25:22 +08:00
parent 89affcf6c1
commit 91d33e56ed
4 changed files with 15 additions and 5 deletions

View File

@ -19,7 +19,7 @@ local propertyList = {
RoleDataName.CritDamageFactor, RoleDataName.CritDamageFactor,
RoleDataName.TreatFacter, RoleDataName.TreatFacter,
RoleDataName.MaxHp, RoleDataName.MaxHp,
RoleDataName.Hp, RoleDataName.MaxHp,
RoleDataName.CureFacter, RoleDataName.CureFacter,
RoleDataName.Tenacity, RoleDataName.Tenacity,
} }

View File

@ -207,7 +207,7 @@ local passivityList = {
end) end)
end end
end end
role.Event:AddEvent(BattleEventName.OnRoleBeDamagedBefore, OnRoleBeDamagedBefore) role.Event:AddEvent(BattleEventName.RoleBeDamagedBefore, OnRoleBeDamagedBefore)
end, end,
--受击时,有[a]的概率抵消[b]*[c]的攻击。 --受击时,有[a]的概率抵消[b]*[c]的攻击。

View File

@ -32,6 +32,7 @@ function Skill:Init(role, effectData)
self.sp = 0 self.sp = 0
self.spPass = 0 self.spPass = 0
self.isTeamSkill = false self.isTeamSkill = false
self.isManual = false
for i=2, #effectData do for i=2, #effectData do
local v = effectData[i] local v = effectData[i]
@ -167,6 +168,7 @@ function Skill:Cast()
end end
BattleLogic.SetSkillUsable(self.owner.camp, false) BattleLogic.SetSkillUsable(self.owner.camp, false)
self.isManual = false
BattleLogic.WaitForTrigger(duration, function() BattleLogic.WaitForTrigger(duration, function()
BattleLogic.SetSkillUsable(self.owner.camp, true) BattleLogic.SetSkillUsable(self.owner.camp, true)
if not self.isTeamSkill then if not self.isTeamSkill then
@ -178,7 +180,8 @@ function Skill:Cast()
end end
--表现层调用 --表现层调用
function Skill:CanManualCast() function Skill:CanManualCast()
return self.owner:CanCastSkill() and self.owner.camp == 0 and not self.owner.Auto and self.sp >= self.spPass return not self.isManual and self.owner.enable and not self.owner.ctrl_slient and
self.owner.camp == 0 and not self.owner.Auto and self.sp >= self.spPass
end end
--表现层调用 --表现层调用
function Skill:ManualCast() function Skill:ManualCast()
@ -192,6 +195,7 @@ function Skill:ManualCast()
else else
BattleLogic.AddOption(3, self.owner.uid) BattleLogic.AddOption(3, self.owner.uid)
end end
self.isManual = true
end end
end end

View File

@ -25,6 +25,7 @@ BattleLogic.Result = -1
BattleLogic.Event = BattleEvent.New() BattleLogic.Event = BattleEvent.New()
BattleLogic.BuffMgr = BuffManager.New() BattleLogic.BuffMgr = BuffManager.New()
local skillManualQueue = BattleQueue.New()
local playerTeamDummyRole = {camp = 0, Event = BattleLogic.Event, isTeam = true, curSkill = nil} local playerTeamDummyRole = {camp = 0, Event = BattleLogic.Event, isTeam = true, curSkill = nil}
local enemyTeamDummyRole = {camp = 1, Event = BattleLogic.Event, isTeam = true, curSkill = nil} local enemyTeamDummyRole = {camp = 1, Event = BattleLogic.Event, isTeam = true, curSkill = nil}
local playerTeamSkillList = {} local playerTeamSkillList = {}
@ -76,6 +77,7 @@ function BattleLogic.Init(maxTime, data, optionData)
BattleLogic.TotalOrder = #data.enemyData BattleLogic.TotalOrder = #data.enemyData
BattleLogic.Clear() BattleLogic.Clear()
skillManualQueue:Clear()
curUid = 0 curUid = 0
curBuffId = 0 curBuffId = 0
@ -289,12 +291,12 @@ function BattleLogic.ExecuteOption(option)
elseif opType == 2 then --释放skill elseif opType == 2 then --释放skill
local role = objList.kvList[opArg] local role = objList.kvList[opArg]
if role and role.skill then if role and role.skill then
role.skill:Cast() skillManualQueue:Enqueue(role.skill)
end end
elseif opType == 3 then --释放superSkill elseif opType == 3 then --释放superSkill
local role = objList.kvList[opArg] local role = objList.kvList[opArg]
if role and role.superSkill then if role and role.superSkill then
role.superSkill:Cast() skillManualQueue:Enqueue(role.superSkill)
end end
elseif opType == 4 then --释放teamSkill elseif opType == 4 then --释放teamSkill
local teamSkill = playerTeamSkillList[playerTeamSkillIndex] local teamSkill = playerTeamSkillList[playerTeamSkillIndex]
@ -399,6 +401,10 @@ function BattleLogic.Update()
end end
end end
if playerSkillUsable and skillManualQueue.size > 0 then --手动操作的技能进入队列,等待释放
skillManualQueue:Dequeue():Cast()
end
local index = 1 local index = 1
while index <= tbActionList.size do while index <= tbActionList.size do
local action = tbActionList.buffer[index] local action = tbActionList.buffer[index]