local Base = require("Battle/Logic/Level/LevelFunction/LevelFunction") local ClimbTowerLevelFunction = class("ClimbTowerLevelFunction",Base) local DEFAULT_DIFFICULTY = 1 --默认难度搞成1 function ClimbTowerLevelFunction:InitLevel() local climbTowerId = LevelManager.GetClimbTowerId() self:SetClimbTowerData() if self.data then self.formulaAdaptiveVar = self.data.AdaptiveDifficultyNumber else logging.error(LTAG.ERROR,"[关卡策划]:爬塔没有发现关卡数据 。climbTowerId = ",climbTowerId ," 难度默认为9999") self.formulaAdaptiveVar = 9999 end self:CloseMusouShow() --爬塔玩法因为要走校验,所以是否开启无双演出不能走玩家设置。所以统一在这里关闭无双演出,让玩家体验更爽快一点 Base.InitLevel(self) end function ClimbTowerLevelFunction:SetClimbTowerData() local climbTowerId = LevelManager.GetClimbTowerId() self.data = DataSheetManager.ClimbTowerLevel:GetDataByID(climbTowerId) LevelManager.SetServerGs(self.data.Battle) end function ClimbTowerLevelFunction:InitLevelDifficulty() self.Difficulty = DEFAULT_DIFFICULTY self.LevelGs = self.data.Battle self.SubjugateDataPVEID = self.data.SubjugateDataPVE end --获取公式自适应变量,基础规则是以主玩家的等级为变量来自适应。仅可用于单机副本,联机副本需要重写 function ClimbTowerLevelFunction:GetFormulaAdaptiveVariable() return self.formulaAdaptiveVar end function ClimbTowerLevelFunction:GetFormulaAdaptVarRangeConstPrefix() return "MonsterAdaptedTowerRange_" end function ClimbTowerLevelFunction:IsMusouShowOpen(entity) return false --爬塔强制关闭无双演出(因为爬塔有时需要校验有时又不需要,不校验可以播无双演出,校验又不能播。为了体验上保持统一,统一指定为不播放无双演出) end --是否三军武将同时上场 function ClimbTowerLevelFunction:IsAllHeroJoinBattle() return true end --显示胜利pose的标识 function ClimbTowerLevelFunction:SetShowVictoryPoseFlag(flag) self.ShowVictoryPoseFlag = flag end function ClimbTowerLevelFunction:OnCreatePlayer() Base.OnCreatePlayer(self) local mainEntity = BattleDataGetter.GetHeroInHeroEntityTableByIndex(LuaConst.STANDALONE_PLAYER_PlayID,1) self:StartAutoFight(mainEntity) end --重载战斗结算,为了处理不同的Pose逻辑 function ClimbTowerLevelFunction:OnLevelSucceed(withShow) if not withShow then self.ShowVictoryPoseFlag = false end Base.OnLevelSucceed(self, self.ShowVictoryPoseFlag) end function ClimbTowerLevelFunction:OnLevelFail() if LevelManager.IsClimbTower() and self.ShowVictoryPoseFlag then local mainEntity = BattleDataGetter.GetHeroInHeroEntityTableByIndex(LuaConst.STANDALONE_PLAYER_PlayID,1) if mainEntity and mainEntity:IsAlive() then self:ShowVictoryPose() end end Base.OnLevelFail(self) end function ClimbTowerLevelFunction:OnUpdate() if self.handleEndLevelFrame == LogicUpdateManager._clientHandleFrame then LevelItemManager.Global:HandleEndLevel(false, true) end end function ClimbTowerLevelFunction:AfterSwitchHero(fromEntity, toEntity, dontBackground) Base.AfterSwitchHero(self, fromEntity, toEntity, dontBackground) local robotAI = self:GetRobotAI(toEntity) if robotAI then toEntity.components.aiBase:SetSingleCurrentAiByID(robotAI) end end function ClimbTowerLevelFunction:QuitRoom(entity) self.ShowVictoryPoseFlag = true self.handleEndLevelFrame = LogicUpdateManager._clientHandleFrame + 2 --这里直接HandleEndLevel会导致ShowVictoryPose播不出动画,所以异步到OnUpdate里面去 end function ClimbTowerLevelFunction:GetRobotAI(entity) if entity:IsMainEntityOfPlayer() then return LuaConst.ClimbPveRobotAIID else --返回副单位AI(副单位:三将同时上场时,没有被玩家操控的那些英雄单位) return entity:GetSideHeroForceAiID() or LuaConst.ClimbSideHeroAI end end return ClimbTowerLevelFunction