local BossChallenge_Controller = {} local private = {} function BossChallenge_Controller.GetBossChallengeSummaryStateText(seasonId, difficult, score) local scoreData = DataSheetManager.BossChallengeScore:GetDataByID(difficult) local passScore = scoreData.PassScore local nextDifficult = difficult == MDL.BossChallenge.Difficult.Nightmare and difficult or difficult + 1 local difficultIds = UIUtils.GetLocalizedTxt(Const_IDS[MDL.BossChallenge.DifficultIDS[nextDifficult]]) if difficult == MDL.BossChallenge.Difficult.Nightmare then if score >= passScore then return true, UIUtils.GetLocalizedTxt(Const_IDS["IDS_BossChallenge_Settlement_Pass2"]) else return false, string.FormatByIdsId(Const_IDS["IDS_BossChallenge_Settlement_Fail2"], passScore) end else if score >= passScore then if BossChallenge_Controller.IsBossDifficultUnlock(difficult + 1, seasonId) then return true, UIUtils.GetLocalizedTxt(Const_IDS["IDS_BossChallenge_Settlement_Pass2"]) --非首通 PassCurrent else return true, string.FormatByIdsId(Const_IDS["IDS_BossChallenge_Settlement_Pass1"], difficultIds) --首通 PassAndUnlock end else if BossChallenge_Controller.IsBossDifficultUnlock(difficult + 1, seasonId) then return false, string.FormatByIdsId(Const_IDS["IDS_BossChallenge_Settlement_Fail2"], passScore) --未通,下个难度已开 ScoreToPassCurrent else return false, string.FormatByIdsId(Const_IDS["IDS_BossChallenge_Settlement_Fail1"], passScore, difficultIds) --未通,下个难度未开 ScoreToUnlock end end end end function BossChallenge_Controller.IsBossDifficultUnlock(difficult, seasonId) local score = MDL.BossChallenge.GetBossDifficultScoreByDifficultAndSeason(difficult, seasonId) if score > 0 then return true else if difficult == MDL.BossChallenge.Difficult.Normal then return true else local easyDifficult = difficult - 1 local passScore = DataSheetManager.BossChallengeScore:GetDataByID(easyDifficult).PassScore local easyDifficultScore = MDL.BossChallenge.GetBossDifficultScoreByDifficultAndSeason(easyDifficult, seasonId) return easyDifficultScore >= passScore end end end function BossChallenge_Controller.GetFirstUnPassBossDifficult(seasonId) for i = MDL.BossChallenge.Difficult.Normal, MDL.BossChallenge.Difficult.Nightmare do if not BossChallenge_Controller.IsBossDifficultUnlock(i, seasonId) then return i - 1 end end return MDL.BossChallenge.Difficult.Nightmare end function BossChallenge_Controller.ShowBattleSummary(msgInfo) CTL.HomeMain.CloseOpenView() UIManager.OpenView(Const_UI_Lua.UIEnum.UIBossChallengeSummaryPanel, {msgInfo}) if msgInfo.curPoint > msgInfo.lastPoint then MDL.BossChallenge.UpdateBossDifficultScore(msgInfo.bossLevelId, msgInfo.curPoint) end end function BossChallenge_Controller.IsSeasonOpen(seasonId) return MDL.BossChallenge.GetBossChallengeSeasonInfoById(seasonId).seasonState == MDL.FairPlay.SeasonState.SeasonOpening end function BossChallenge_Controller.GetSeasonBossById(seasonId) return MDL.BossChallenge.GetBossChallengeSeasonInfoById(seasonId).bossId end function BossChallenge_Controller.GetSeasonBossLevelList(seasonId) return MDL.BossChallenge.GetBossChallengeSeasonInfoById(seasonId).openBossList end function BossChallenge_Controller.GetLastSeasonId() local seasonData = MDL.BossChallenge.GetBossChallengeSeasonInfo().lastSeason if seasonData then local seasonId = seasonData.seasonId if seasonId > 0 then return seasonId end end return 0 end function BossChallenge_Controller.GetSeasonId() local seasonData = MDL.BossChallenge.GetBossChallengeSeasonInfo().curSeason return seasonData.seasonId end function BossChallenge_Controller.GetLeftSeasonTime(seasonId) local seasonData = MDL.BossChallenge.GetBossChallengeSeasonInfoById(BossChallenge_Controller.GetSeasonId()) local endTime = seasonData.seasonEndTime return os.difftime(endTime, UTL.Time.GetServerTimestamp()) end function BossChallenge_Controller.IfBossLevelIdUnlock(bossLevelId, seasonId) if BossChallenge_Controller.IsSeasonOpen(seasonId) then local unlockLevelIdTable = CTL.BossChallenge.GetSeasonBossLevelList(seasonId) for i, v in ipairs(unlockLevelIdTable) do if v == bossLevelId then return true end end end return false end function BossChallenge_Controller.GetBossLevelIdIndex(seasonId, bossLevelId) local nowSeasonBossLevelIdTable = CTL.BossChallenge.GetSeasonBossLevelList(seasonId) for i, v in ipairs(nowSeasonBossLevelIdTable) do if v == bossLevelId then return i - 1 end end return 0 end function BossChallenge_Controller.IsHeroBenefitBuffByBuffId(buffId, heroId) return BuffManager.IsMeetHeroTypeFilterOfBuff(DataSheetManager.BuffData:GetDataByBuffID(buffId),heroId) end function BossChallenge_Controller.GetBossLevelBuffInfluenceNumbers(bossLevelId, heroId) local influenceNum = 0 local buffTable = DataSheetManager.BossChallengeLevel:GetDataByID(bossLevelId).BuffID for i, v in ipairs(buffTable) do if BossChallenge_Controller.IsHeroBenefitBuffByBuffId(v, heroId) then influenceNum = influenceNum + 1 end end return influenceNum end function BossChallenge_Controller.GetBossLevelBuffInfluenceList(bossLevelId, heroId) local influenceList = {} local buffTable = DataSheetManager.BossChallengeLevel:GetDataByID(bossLevelId).BuffID for i, v in ipairs(buffTable) do influenceList[i] = BossChallenge_Controller.IsHeroBenefitBuffByBuffId(v, heroId) end return influenceList end function BossChallenge_Controller.GetCommandHeroList(bossLevelId) local commandHeroList = {} local GetInfluenceNumFunc = BossChallenge_Controller.GetBossLevelBuffInfluenceNumbers for i, v in DataSheetManager.HeroNum:GetEnumerator() do local influenceNum = GetInfluenceNumFunc(bossLevelId, v.ID) if influenceNum >= 2 then table.insert(commandHeroList, v.ID) end end return commandHeroList end function BossChallenge_Controller.GetFirstNoneSelectIndex(heroFormationList) for i, v in ipairs(heroFormationList) do if not v or v <= 0 then return i end end return nil end function BossChallenge_Controller.GetFirstSelectedHeroId(heroFormationList) for i, v in ipairs(heroFormationList) do if v and v > 0 then return v end end return nil end function BossChallenge_Controller.GetIndexByHeroId(list, id) for i, v in ipairs(list) do if v == id then return i end end return nil end function BossChallenge_Controller.IsWarZoneStyle() local seasonInfo = MDL.BossChallenge.GetBossChallengeSeasonInfo() if seasonInfo and seasonInfo.curSeason then return seasonInfo.curSeason.state == MDL.FairPlay.FairPlayState.WarZone end return false end return BossChallenge_Controller