From 12f3e8ebf4fac3c48d12fc770ae28a678f989ba5 Mon Sep 17 00:00:00 2001 From: chenxi Date: Wed, 19 Apr 2023 22:30:26 +0800 Subject: [PATCH] =?UTF-8?q?=E8=A1=A8=E7=8E=B0=E5=A4=84=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../battle/component/battle_unit_comp.lua | 24 +++++++++---------- lua/app/module/battle/team/battle_team.lua | 11 +++++++++ 2 files changed, 23 insertions(+), 12 deletions(-) diff --git a/lua/app/module/battle/component/battle_unit_comp.lua b/lua/app/module/battle/component/battle_unit_comp.lua index 097dab83..d07bcd34 100644 --- a/lua/app/module/battle/component/battle_unit_comp.lua +++ b/lua/app/module/battle/component/battle_unit_comp.lua @@ -237,11 +237,11 @@ function BattleUnitComp:getAnimationKeyFrameTime(animationName) end function BattleUnitComp:getIsCentralizedAttack() - return self.centralizedAttack + return self.team:getCentralizedAttack() end function BattleUnitComp:beforeAttack() - self.centralizedAttack = true + self.team:setCentralizedAttack(true) self.battleController:setIsPauseHpProgress(true) self:checkPassiveEvent(PASSIVE_EVENT.ON_UNI_ATTACK_START, self) end @@ -290,21 +290,21 @@ function BattleUnitComp:useSkill(index, count, callback) self.actionOverCallback = nil self.activeSkillIndex = nil self.battleController:setIsPauseHpProgress(false) - self.centralizedAttack = false + self.team:setCentralizedAttack(false) callback() return end if not self:changeState(UNIT_STATE.NORMAL_ATTACK) then self.actionOverCallback = nil self.battleController:setIsPauseHpProgress(false) - self.centralizedAttack = false + self.team:setCentralizedAttack(false) callback() end else if not self:changeState(UNIT_STATE.SKILL_ATTACK) then self.actionOverCallback = nil self.battleController:setIsPauseHpProgress(false) - self.centralizedAttack = false + self.team:setCentralizedAttack(false) callback() end end @@ -327,21 +327,21 @@ function BattleUnitComp:useAllSkills(callback) if self.normalSkillCount <= 0 then self.actionOverCallback = nil self.battleController:setIsPauseHpProgress(false) - self.centralizedAttack = false + self.team:setCentralizedAttack(false) callback() return end if not self:changeState(UNIT_STATE.NORMAL_ATTACK) then self.actionOverCallback = nil self.battleController:setIsPauseHpProgress(false) - self.centralizedAttack = false + self.team:setCentralizedAttack(false) callback() end else if not self:changeState(UNIT_STATE.SKILL_ATTACK) then self.actionOverCallback = nil self.battleController:setIsPauseHpProgress(false) - self.centralizedAttack = false + self.team:setCentralizedAttack(false) callback() end end @@ -353,7 +353,7 @@ function BattleUnitComp:useNormalSkill(count, callback) if not self:changeState(UNIT_STATE.NORMAL_ATTACK) then self.actionOverCallback = nil self.battleController:setIsPauseHpProgress(false) - self.centralizedAttack = false + self.team:setCentralizedAttack(false) callback() end end @@ -723,7 +723,7 @@ function BattleUnitComp:updateSkillAttack(dt) self.currAttackKeyTime = 0 if self.normalSkillCount > 0 then if self.normalSkillCount == 1 and self.currActiveSkill == nil then -- 最后一次攻击 - self.centralizedAttack = false + self.team:setCentralizedAttack(false) end local skill = self.unitEntity:getNormalSkill() self:onSkillTakeEffect(skill) @@ -733,7 +733,7 @@ function BattleUnitComp:updateSkillAttack(dt) else local isHaveNextAttack = self:getIsHaveNextAvailableActiveSkill() if not isHaveNextAttack then - self.centralizedAttack = false + self.team:setCentralizedAttack(false) end self:onSkillTakeEffect(self.currActiveSkill) if not isHaveNextAttack then @@ -897,7 +897,7 @@ function BattleUnitComp:updateNormalAttack(dt) if self.currAttackKeyTime > 0 and self.attackTime >= self.currAttackKeyTime then -- 到达关键后使用 self.currAttackKeyTime = 0 if self.normalSkillCount == 1 then -- 如果是最后一次攻击,那么敌人受到这次攻击可以开始嗝屁了 - self.centralizedAttack = false + self.team:setCentralizedAttack(false) end local skill = self.unitEntity:getNormalSkill() self:onSkillTakeEffect(skill) diff --git a/lua/app/module/battle/team/battle_team.lua b/lua/app/module/battle/team/battle_team.lua index 3194ea9b..a3a6c7b6 100644 --- a/lua/app/module/battle/team/battle_team.lua +++ b/lua/app/module/battle/team/battle_team.lua @@ -93,9 +93,11 @@ function BattleTeam:useAssistingSkill(assistingList, callback) if count <= 0 then return callback() end + self:setCentralizedAttack(true) local function finish() count = count - 1 if count == 0 then + self:setCentralizedAttack(false) callback() end end @@ -261,6 +263,15 @@ function BattleTeam:stopRunAction() end end +function BattleTeam:getCentralizedAttack() + return self.centralizedAttack +end + + +function BattleTeam:setCentralizedAttack(centralizedAttack) + self.centralizedAttack = centralizedAttack +end + function BattleTeam:tick(dt) for k, v in ipairs(self.unitList) do v:tick(dt)