def update(self, fDelta): ##Rhye - begin iActivePlayer = CyGame().getActivePlayer() if tBirth[iActivePlayer] <= utils.getScenarioStartYear(): screen = CyGInterfaceScreen("CvLoadingScreen", self.iScreenID) screen.setBarPercentage("ProgressBar", InfoBarTypes.INFOBAR_STORED, 1) screen.setLabel( "Text", "", CyTranslator().getText("TXT_KEY_AUTOPLAY_TURNS_REMAINING", (0, )), CvUtil.FONT_CENTER_JUSTIFY, 530, 445, 0, FontTypes.GAME_FONT, WidgetTypes.WIDGET_GENERAL, -1, -1) screen.show("Exit") #Rhye else: iGameTurn = CyGame().getGameTurn() iNumAutoPlayTurns = getTurnForYear( tBirth[CyGame().getActiveTeam()]) iNumTurnsRemaining = iNumAutoPlayTurns - iGameTurn #if (iNumTurnsRemaining != self.iTurnsRemaining): # self.iTurnsRemaining = iNumTurnsRemaining screen = CyGInterfaceScreen("CvLoadingScreen", self.iScreenID) exponent = 1 + iNumAutoPlayTurns / utils.getTurns(190) screen.setBarPercentage( "ProgressBar", InfoBarTypes.INFOBAR_STORED, float( math.pow(iGameTurn - utils.getScenarioStartTurn(), exponent)) / float( math.pow(iNumAutoPlayTurns - utils.getScenarioStartTurn(), exponent))) screen.setLabel( "Text", "", CyTranslator().getText("TXT_KEY_AUTOPLAY_TURNS_REMAINING", (max(0, iNumTurnsRemaining), )), CvUtil.FONT_CENTER_JUSTIFY, 530, 445, 0, FontTypes.GAME_FONT, WidgetTypes.WIDGET_GENERAL, -1, -1) if (iNumTurnsRemaining <= 0): #Rhye screen.show("Exit") #Rhye ##Rhye - end return
def onReligionFounded(self, iReligion, iFounder): if gc.getGame().getGameTurn() == utils.getScenarioStartTurn(): return if iReligion == iCatholicism: utils.setStateReligionBeforeBirth(lCatholicStart, iCatholicism) utils.setStateReligionBeforeBirth(lProtestantStart, iCatholicism) elif iReligion == iProtestantism: utils.setStateReligionBeforeBirth(lProtestantStart, iProtestantism)
def onReligionFounded(self, argsList): 'Religion Founded' iReligion, iFounder = argsList if gc.getGame().getGameTurn() == utils.getScenarioStartTurn(): return vic.onReligionFounded(iFounder, iReligion) self.rel.onReligionFounded(iReligion, iFounder)
def onReligionFounded(self, argsList): 'Religion Founded' iReligion, iFounder = argsList if gc.getGame().getGameTurn() == utils.getScenarioStartTurn(): return vic.onReligionFounded(iFounder, iReligion) self.rel.onReligionFounded(iReligion, iFounder) dc.onReligionFounded(iFounder)
def onEndTurnReady(self, argsList): "Loops over active player's cities, telling each to perform its check." if gc.getGame().getGameTurn() > utils.getScenarioStartTurn(): self.checkAllActivePlayerCities()
def interfaceScreen(self): 'Use a popup to display the opening text' if ( CyGame().isPitbossHost() ): return self.player = gc.getPlayer(gc.getGame().getActivePlayer()) self.EXIT_TEXT = localText.getText("TXT_KEY_SCREEN_CONTINUE", ()) # Create screen screen = CyGInterfaceScreen( "CvDawnOfMan", self.iScreenID ) screen.showScreen(PopupStates.POPUPSTATE_QUEUED, False) screen.showWindowBackground( False ) screen.setDimensions(screen.centerX(self.X_SCREEN), screen.centerY(self.Y_SCREEN), self.W_SCREEN, self.H_SCREEN) screen.enableWorldSounds( false ) # Create panels # Main szMainPanel = "DawnOfManMainPanel" screen.addPanel( szMainPanel, "", "", true, true, self.X_MAIN_PANEL, self.Y_MAIN_PANEL, self.W_MAIN_PANEL, self.H_MAIN_PANEL, PanelStyles.PANEL_STYLE_MAIN ) ##Rhye - begin ## # Top ## szHeaderPanel = "DawnOfManHeaderPanel" ## screen.addPanel( szHeaderPanel, "", "", true, false, ## self.X_HEADER_PANEL, self.Y_HEADER_PANEL, self.W_HEADER_PANEL, self.H_HEADER_PANEL, PanelStyles.PANEL_STYLE_DAWNTOP ) ##Rhye - end # Bottom szTextPanel = "DawnOfManTextPanel" screen.addPanel( szTextPanel, "", "", true, true, self.X_TEXT_PANEL, self.Y_TEXT_PANEL, self.W_TEXT_PANEL, self.H_TEXT_PANEL, PanelStyles.PANEL_STYLE_DAWNBOTTOM ) # Add contents ##Rhye - begin ## # Leaderhead graphic ## szLeaderPanel = "DawnOfManLeaderPanel" ## screen.addPanel( szLeaderPanel, "", "", true, false, ## self.X_LEADER_ICON - 3, self.Y_LEADER_ICON - 5, self.W_LEADER_ICON + 6, self.H_LEADER_ICON + 8, PanelStyles.PANEL_STYLE_DAWNTOP ) ## screen.addLeaderheadGFC("LeaderHead", self.player.getLeaderType(), AttitudeTypes.ATTITUDE_PLEASED, ## self.X_LEADER_ICON + 5, self.Y_LEADER_ICON + 5, self.W_LEADER_ICON - 10, self.H_LEADER_ICON - 10, WidgetTypes.WIDGET_GENERAL, -1, -1) ## # Info/"Stats" text ## ## szNameText = "<color=255,255,0,255>" + u"<font=3b>" + gc.getLeaderHeadInfo(self.player.getLeaderType()).getDescription().upper() + u"</font>" + "\n- " + self.player.getCivilizationDescription(0) + " -" ## screen.addMultilineText( "NameText", szNameText, self.X_LEADER_TITLE_TEXT, self.Y_LEADER_TITLE_TEXT, self.W_LEADER_TITLE_TEXT, self.H_LEADER_TITLE_TEXT, WidgetTypes.WIDGET_GENERAL, -1, -1, CvUtil.FONT_CENTER_JUSTIFY) ## ## self.Text_BoxText = CyGameTextMgr().parseLeaderTraits(self.player.getLeaderType(), self.player.getCivilizationType(), True, False) ## self.Text_BoxText += "\n" + CyGameTextMgr().parseCivInfos(self.player.getCivilizationType(), True) ## ## screen.addMultilineText( "HeaderText", self.Text_BoxText, self.X_STATS_TEXT, self.Y_STATS_TEXT, self.W_STATS_TEXT, self.H_STATS_TEXT, WidgetTypes.WIDGET_GENERAL, -1, -1, CvUtil.FONT_LEFT_JUSTIFY) ## # Fancy icon things ## screen.addDDSGFC( "IconLeft", gc.getMissionInfo(MissionTypes.MISSION_FORTIFY).getButton(), self.X_FANCY_ICON1 , self.Y_FANCY_ICON , self.WH_FANCY_ICON, self.WH_FANCY_ICON, WidgetTypes.WIDGET_GENERAL, -1, -1 ) ## screen.addDDSGFC( "IconRight", gc.getMissionInfo(MissionTypes.MISSION_FORTIFY).getButton(), self.X_FANCY_ICON2 , self.Y_FANCY_ICON , self.WH_FANCY_ICON, self.WH_FANCY_ICON, WidgetTypes.WIDGET_GENERAL, -1, -1 ) ##Rhye - end # Main Body text szDawnTitle = u"<font=3>" + localText.getText("TXT_KEY_DAWN_OF_MAN_SCREEN_TITLE", ()).upper() + u"</font>" screen.setLabel("DawnTitle", "Background", szDawnTitle, CvUtil.FONT_CENTER_JUSTIFY, self.X_TEXT_PANEL + (self.W_TEXT_PANEL / 2), self.Y_TEXT_PANEL + 15, -2.0, FontTypes.GAME_FONT, WidgetTypes.WIDGET_GENERAL, -1, -1 ) ##Rhye - begin pActivePlayer = gc.getPlayer(CyGame().getActivePlayer()) iActivePlayer = CyGame().getActivePlayer() if getTurnForYear(tBirth[iActivePlayer]) <= utils.getScenarioStartTurn(): iYear = utils.getScenarioStartYear() else: iYear = tBirth[iActivePlayer] year = str(abs(iYear)) + ' ' if iYear >= 0: year += CyTranslator().getText("TXT_KEY_AD", ()) else: year += CyTranslator().getText("TXT_KEY_BC", ()) #Leoreth: imported individual texts from Sword of Islam (edead) pActivePlayer = gc.getPlayer(CyGame().getActivePlayer()) bodyString = utils.getDawnOfManText(iActivePlayer) screen.addStackedBarGFC("ProgressBar", 300, 400, 435, 40, InfoBarTypes.NUM_INFOBAR_TYPES, WidgetTypes.WIDGET_GENERAL, -1, -1) screen.setStackedBarColors("ProgressBar", InfoBarTypes.INFOBAR_STORED, gc.getInfoTypeForString("COLOR_PLAYER_GREEN")) screen.setStackedBarColors("ProgressBar", InfoBarTypes.INFOBAR_RATE, gc.getInfoTypeForString("COLOR_RESEARCH_RATE")) screen.setStackedBarColors("ProgressBar", InfoBarTypes.INFOBAR_RATE_EXTRA, gc.getInfoTypeForString("COLOR_EMPTY")) screen.setStackedBarColors("ProgressBar", InfoBarTypes.INFOBAR_EMPTY, gc.getInfoTypeForString("COLOR_EMPTY")) self.iTurnsRemaining = -1 ##Rhye - end screen.addMultilineText( "BodyText", bodyString, self.X_TEXT_PANEL + self.iMarginSpace, self.Y_TEXT_PANEL + self.iMarginSpace + self.iTEXT_PANEL_MARGIN, self.W_TEXT_PANEL - (self.iMarginSpace * 2), self.H_TEXT_PANEL - (self.iMarginSpace * 2) - 75, WidgetTypes.WIDGET_GENERAL, -1, -1, CvUtil.FONT_LEFT_JUSTIFY) screen.setButtonGFC("Exit", self.EXIT_TEXT, "", self.X_EXIT, self.Y_EXIT, self.W_EXIT, self.H_EXIT, WidgetTypes.WIDGET_CLOSE_SCREEN, -1, -1, ButtonStyles.BUTTON_STYLE_STANDARD ) screen.hide( "Exit" ) #Rhye pActivePlayer = gc.getPlayer(CyGame().getActivePlayer()) pLeaderHeadInfo = gc.getLeaderHeadInfo(pActivePlayer.getLeaderType()) screen.setSoundId(CyAudioGame().Play2DSoundWithId(pLeaderHeadInfo.getDiploPeaceMusicScriptIds(0)))
def onTechAcquired(self, argsList): iTech, iTeam, iPlayer, bAnnounce = argsList iHuman = utils.getHumanID() iEra = gc.getTechInfo(iTech).getEra() iGameTurn = gc.getGame().getGameTurn() if iGameTurn == utils.getScenarioStartTurn(): return sta.onTechAcquired(iPlayer, iTech) AIParameters.onTechAcquired(iPlayer, iTech) if iGameTurn > getTurnForYear(tBirth[iPlayer]): vic.onTechAcquired(iPlayer, iTech) cnm.onTechAcquired(iPlayer) dc.onTechAcquired(iPlayer, iTech) if gc.getPlayer(iPlayer).isAlive() and iGameTurn > getTurnForYear( tBirth[iPlayer]) and iPlayer < iNumPlayers: self.rel.onTechAcquired(iTech, iPlayer) if iGameTurn > getTurnForYear(1700): self.aiw.forgetMemory(iTech, iPlayer) if iTech == iExploration: if iPlayer in [ iSpain, iFrance, iEngland, iGermany, iVikings, iNetherlands, iPortugal ]: data.players[iPlayer].iExplorationTurn = iGameTurn elif iTech == iCompass: if iPlayer == iVikings: gc.getMap().plot(49, 62).setTerrainType(iCoast, True, True) elif iTech == iMicrobiology: self.pla.onTechAcquired(iTech, iPlayer) elif iTech == iRailroad: self.rnf.onRailroadDiscovered(iPlayer) if iTech in [iExploration, iFirearms]: teamPlayer = gc.getTeam(iPlayer) if teamPlayer.isHasTech(iExploration) and teamPlayer.isHasTech( iFirearms): self.rnf.earlyTradingCompany(iPlayer) if iTech in [iEconomics, iReplaceableParts]: teamPlayer = gc.getTeam(iPlayer) if teamPlayer.isHasTech(iEconomics) and teamPlayer.isHasTech( iReplaceableParts): self.rnf.lateTradingCompany(iPlayer) if utils.getHumanID() != iPlayer: if iPlayer == iJapan and iEra == iIndustrial: utils.moveCapital(iPlayer, (116, 47)) # Toukyou elif iPlayer == iItaly and iEra == iIndustrial: utils.moveCapital(iPlayer, (60, 44)) # Roma elif iPlayer == iVikings and iEra == iRenaissance: utils.moveCapital(iPlayer, (63, 59)) # Stockholm elif iPlayer == iHolyRome and iEra == iRenaissance: utils.moveCapital(iPlayer, (62, 49)) # Wien # Maya UP: +20 food when a tech is discovered before the medieval era if iPlayer == iMaya and not pMaya.isReborn() and iEra < iMedieval: if pMaya.getNumCities() > 0: iFood = 20 / pMaya.getNumCities() for city in utils.getCityList(iMaya): city.changeFood(iFood) CyInterface().addMessage( iPlayer, False, iDuration, CyTranslator().getText( "TXT_KEY_MAYA_UP_EFFECT", (gc.getTechInfo(iTech).getText(), iFood)), "", 0, "", ColorTypes(iWhite), -1, -1, True, True) # Spain's core extends when reaching the Renaissance and there are no Moors in Iberia # at the same time, the Moorish core relocates to Africa if iPlayer == iSpain and iEra == iRenaissance and not utils.isReborn( iSpain): bNoMoors = True if gc.getPlayer(iMoors).isAlive(): for city in utils.getCityList(iMoors): if city.plot().getRegionID() == rIberia: bNoMoors = False if bNoMoors: utils.setReborn(iSpain, True) utils.setReborn(iMoors, True) # Italy's core extends when reaching the Industrial era if iPlayer == iItaly and iEra == iIndustrial: utils.setReborn(iItaly, True) # Japan's core extends when reaching the Industrial era if iPlayer == iJapan and iEra == iIndustrial: utils.setReborn(iJapan, True) # Germany's core shrinks when reaching the Digital era if iPlayer == iGermany and iEra == iDigital: utils.setReborn(iGermany, True)
def onTechAcquired(self, argsList): iTech, iTeam, iPlayer, bAnnounce = argsList iHuman = utils.getHumanID() iEra = gc.getTechInfo(iTech).getEra() if gc.getGame().getGameTurn() == utils.getScenarioStartTurn(): return sta.onTechAcquired(iPlayer, iTech) AIParameters.onTechAcquired(iPlayer, iTech) if gc.getGame().getGameTurn() > getTurnForYear(tBirth[iPlayer]): vic.onTechAcquired(iPlayer, iTech) cnm.onTechAcquired(iPlayer) dc.onTechAcquired(iPlayer, iTech) if gc.getPlayer(iPlayer).isAlive() and gc.getGame().getGameTurn( ) > getTurnForYear(tBirth[iPlayer]) and iPlayer < iNumPlayers: self.rel.onTechAcquired(iTech, iPlayer) if (gc.getGame().getGameTurn() > getTurnForYear(1700)): self.aiw.forgetMemory(iTech, iPlayer) if iTech == iExploration: if iPlayer in [ iSpain, iFrance, iEngland, iGermany, iVikings, iNetherlands, iPortugal ]: data.players[iPlayer].iExplorationTurn = gc.getGame( ).getGameTurn() elif iTech == iCompass: if iPlayer == iVikings: gc.getMap().plot(49, 62).setTerrainType(iCoast, True, True) elif iTech == iMicrobiology: self.pla.onTechAcquired(iTech, iPlayer) elif iTech == iRailroad: self.rnf.onRailroadDiscovered(iPlayer) if iTech in [iExploration, iFirearms]: teamPlayer = gc.getTeam(iPlayer) if teamPlayer.isHasTech(iExploration) and teamPlayer.isHasTech( iFirearms): self.rnf.earlyTradingCompany(iPlayer) if iTech in [iEconomics, iReplaceableParts]: teamPlayer = gc.getTeam(iPlayer) if teamPlayer.isHasTech(iEconomics) and teamPlayer.isHasTech( iReplaceableParts): self.rnf.lateTradingCompany(iPlayer) if utils.getHumanID() != iPlayer: if iPlayer == iJapan and iEra == iIndustrial: utils.moveCapital(iPlayer, (116, 47)) # Toukyou elif iPlayer == iItaly and iEra == iIndustrial: utils.moveCapital(iPlayer, (60, 44)) # Roma elif iPlayer == iVikings and iEra == iRenaissance: utils.moveCapital(iPlayer, (63, 59)) # Stockholm elif iPlayer == iHolyRome and iEra == iRenaissance: utils.moveCapital(iPlayer, (62, 49)) # Wien # Spain's core extends when reaching the Renaissance and there are no Moors in Iberia # at the same time, the Moorish core relocates to Africa if iPlayer == iSpain and iEra == iRenaissance and not utils.isReborn( iSpain): bNoMoors = True if gc.getPlayer(iMoors).isAlive(): for city in utils.getCityList(iMoors): if city.plot().getRegionID() == rIberia: bNoMoors = False if bNoMoors: utils.setReborn(iSpain, True) utils.setReborn(iMoors, True) # Italy's core extends when reaching the Industrial era if iPlayer == iItaly and iEra == iIndustrial: utils.setReborn(iItaly, True) # Arabia's core moves to Iraq when Education is discovered if iPlayer == iArabia and iTech == iEducation: utils.setReborn(iArabia, True) # Japan's core extends when reaching the Industrial era if iPlayer == iJapan and iEra == iIndustrial: utils.setReborn(iJapan, True) # Germany's core shrinks when reaching the Digital era if iPlayer == iGermany and iEra == iDigital: utils.setReborn(iGermany, True)
def getScreenHelp(): import Debug Debug.main() aHelp = [] #游戏基本信息 if (gc.getDefineINT("PYTHON_SCREEN_VICTORY_TIPS_00") == 1): aHelp.append( localText.getText("TXT_KEY_VICTORY_TIPS_IN_SCREEN_BASIC", ())) iHandicap = gc.getGame().getHandicapType() aHelp.append(' Handicap Level (1-5): ' + str(iHandicap + 1)) iScenario = utils.getScenario() txtScenario = ['BC3000', 'AD600', 'AD1700'] iGameSpeed = gc.getGame().getGameSpeedType() speedtext = u"正常速度" if iGameSpeed == 0: speedtext = "马拉松速度" elif iGameSpeed == 1: speedtext = "史诗速度" aHelp.append(' Scenario : ' + str(txtScenario[iScenario]) + " Speed: " + str(speedtext)) # 勒索国家金币的信息 if (gc.getDefineINT("PYTHON_SCREEN_VICTORY_TIPS_SHOW_AITRADE_ON_MONEY") > 0): aHelp.append(' ') aHelp.append('可勒索金币数量排名') for iCiv in range(iNumPlayers): if (gc.getPlayer(iCiv).isAlive() and iCiv is not utils.getHumanID()): iPlayer = iCiv human = utils.getHumanID() cantrade = gc.getPlayer(iPlayer).canTradeNetworkWith(human) a = gc.AI_considerOfferThreshold(human, iPlayer) # 3是中国 b = gc.getPlayer(iPlayer).AI_maxGoldTrade(human) c = min(a, b) if cantrade and c > 0: civname = gc.getPlayer( iCiv).getCivilizationShortDescription(0) aHelp.append(civname + ':' + str(c)) pass # 科技交易信息 if (gc.getDefineINT("PYTHON_SCREEN_VICTORY_TIPS_SHOW_AITRADE_ON_TECH") > 0): aHelp.append(' ') aHelp.append('AI可卖科技列表:') for iCiv in range(iNumPlayers): iPlayer = iCiv human = utils.getHumanID() if (gc.getPlayer(iCiv).isAlive() and iCiv is not human): for iTech in range(iNumTechs): cantrade = gc.getPlayer(iPlayer).canTradeNetworkWith(human) buyplayer = human sellplayer = iPlayer AIhastech = gc.getTeam( gc.getPlayer(iPlayer).getTeam()).isHasTech(iTech) Humanhastech = gc.getTeam( gc.getPlayer(human).getTeam()).isHasTech(iTech) if (AIhastech and not Humanhastech): techvalue = getTechValue(buyplayer, iTech, sellplayer) if techvalue > 0: civname = gc.getPlayer( iCiv).getCivilizationShortDescription(0) techname = utils.getTechNameCn(iTech) cantradetext = '' bcantradetech = canTradeTech( buyplayer, iTech, sellplayer) if (not cantrade or not bcantradetech): cantradetext = '[目前无法交易]' aHelp.append(civname + ': ' + techname + '(' + str(techvalue) + ')' + cantradetext) aHelp.append(' ') aHelp.append('人类可卖科技列表:') for iCiv in range(iNumPlayers): iPlayer = iCiv human = utils.getHumanID() if (gc.getPlayer(iCiv).isAlive() and iCiv is not human): for iTech in range(iNumTechs): cantrade = gc.getPlayer(iPlayer).canTradeNetworkWith(human) buyplayer = iPlayer sellplayer = human AIhastech = gc.getTeam( gc.getPlayer(iPlayer).getTeam()).isHasTech(iTech) Humanhastech = gc.getTeam( gc.getPlayer(human).getTeam()).isHasTech(iTech) if (not AIhastech and Humanhastech): techvalue = getTechValue(buyplayer, iTech, sellplayer) if techvalue > 0: civname = gc.getPlayer( iCiv).getCivilizationShortDescription(0) techname = utils.getTechNameCn(iTech) cantradetext = '' bcantradetech = canTradeTech( buyplayer, iTech, sellplayer) bTradeWorth = False iAImaxMoney = gc.getPlayer( buyplayer).AI_maxGoldTrade(utils.getHumanID()) PYTHON_TECHTRADE_VALUE_MIN_PERCENT = 80 iMinPercent = PYTHON_TECHTRADE_VALUE_MIN_PERCENT iThreshold = techvalue * iMinPercent / 100 if (iAImaxMoney >= iThreshold): bTradeWorth = True if (not cantrade or not bcantradetech or not bTradeWorth): cantradetext = '[目前无法交易]' # aHelp.append(civname + ': ' + techname + '(' + str(techvalue) + ')' + cantradetext) else: txt = '%s: %s : %d (%d' % ( civname, techname, techvalue, iAImaxMoney * 100 / techvalue) + '%)' aHelp.append(txt) # aHelp.append(civname + ': ' + techname+'('+str(techvalue)+')' + cantradetext) pass #部落村庄信息: if (gc.getDefineINT("PYTHON_SCREEN_VICTORY_TIPS_11") > 0): aHelp.append(' ') aHelp.append( localText.getText("TXT_KEY_VICTORY_TIPS_IN_SCREEN_CITY_RANK_GOODY", ())) goody_list = [] for x in range(gc.getMap().getGridWidth()): for y in range(gc.getMap().getGridHeight()): plot = gc.getMap().plot(x, y) isgoody = plot.isGoody() regionid = plot.getRegionID() if (isgoody): goody_list.append([regionid, x, y]) goody_list.sort(key=lambda x: x[0]) for i in range(len(goody_list)): regionid = goody_list[i][0] x = goody_list[i][1] y = goody_list[i][2] if regionid >= 0: regionname = utils.getRegionNameCn(regionid) aHelp.append('Goody [' + str(i) + '] in X:' + str(x) + ' Y: ' + str(y) + ' RegionName: ' + regionname) else: aHelp.append('Goody in X:' + str(x) + ' Y: ' + str(y)) # 稳定度信息: if (gc.getDefineINT("PYTHON_SCREEN_VICTORY_TIPS_12") > 0): aHelp.append(' ') for iCiv in range(iNumPlayers): if (gc.getPlayer(iCiv).isAlive()): #稳定度免疫信息 Stability_Immune = 0 War_Immune = 0 if Stability.isImmune(iCiv): Stability_Immune = 1 if Stability.isImmune_War(iCiv): War_Immune = 1 if (Stability_Immune or War_Immune): iPlayer = iCiv civname = gc.getPlayer( iCiv).getCivilizationShortDescription(0) Stability_Immune_Turn1 = Stability.calculate_stability_immune_after_Scenario_Start( ) + utils.getScenarioStartTurn() - gc.getGame( ).getGameTurn() Stability_Immune_Turn2 = Stability.calculate_stability_immune_after_birth( ) + getTurnForYear( tBirth[iPlayer]) - gc.getGame().getGameTurn() Stability_Immune_Turn3 = Stability.calculate_stability_immune_after_resurrection( ) + gc.getPlayer(iPlayer).getLatestRebellionTurn( ) - gc.getGame().getGameTurn() Stability_Immune_Turn = max(Stability_Immune_Turn1, Stability_Immune_Turn2, Stability_Immune_Turn3, 0) War_Immune_Turn1 = Stability.calculate_war_immune( ) + utils.getScenarioStartTurn() - gc.getGame( ).getGameTurn() War_Immune_Turn2 = Stability.calculate_war_immune( ) + getTurnForYear( tBirth[iPlayer]) - gc.getGame().getGameTurn() War_Immune_Turn3 = Stability.calculate_war_immune( ) + gc.getPlayer(iPlayer).getLatestRebellionTurn( ) - gc.getGame().getGameTurn() War_Immune_Turn = max(War_Immune_Turn1, War_Immune_Turn2, War_Immune_Turn3, 0) tiptext = civname + ": Stability Immune Turn Left: " + str( Stability_Immune_Turn ) + " War Immune Turn Left: " + str(War_Immune_Turn) aHelp.append(tiptext) # 1.国际会议回合 if (gc.getDefineINT("PYTHON_SCREEN_VICTORY_TIPS_01") == 1): aHelp.append(' ') aHelp.append( localText.getText("TXT_KEY_VICTORY_TIPS_IN_SCREEN_CONGRESS", ()) + str(data.iCongressTurns)) iGameTurn = gc.getGame().getGameTurn() ti = 0 for i in range(len(tBirth)): if (getTurnForYear(tBirth[i]) >= iGameTurn): ti = i break aHelp.append("Next Country " + gc.getPlayer(ti).getCivilizationShortDescription(0) + " Birth in " + str(tBirth[ti]) + " with turns left: " + str(getTurnForYear(tBirth[i]) - iGameTurn)) # 2.殖民地进度 if (gc.getDefineINT("PYTHON_SCREEN_VICTORY_TIPS_02") == 1): aHelp.append(' ') aHelp.append( localText.getText("TXT_KEY_VICTORY_TIPS_IN_SCREEN_COLONIST", ())) for iCiv in [ iSpain, iEngland, iFrance, iPortugal, iNetherlands, iVikings, iGermany ]: showtext1 = str( gc.getPlayer(iCiv).getCivilizationShortDescription(0) + ': ') showtext2 = str( data.players[iCiv].iColonistsAlreadyGiven) + ' / ' + str( dMaxColonists[iCiv]) showtext3 = '' if (data.players[iCiv].iColonistsAlreadyGiven < dMaxColonists[iCiv]): iGameTurn = (data.players[iCiv].iExplorationTurn + 1 + data.players[iCiv].iColonistsAlreadyGiven * 8) - gc.getGame().getGameTurn() if (iGameTurn < 0): iGameTurn = 0 showtext3 = str(' next exploration turn: ' + str(iGameTurn)) aHelp.append(showtext1 + showtext2 + showtext3) #3.瘟疫进度 if (gc.getDefineINT("PYTHON_SCREEN_VICTORY_TIPS_03") == 1): aHelp.append(' ') aHelp.append( localText.getText("TXT_KEY_VICTORY_TIPS_IN_SCREEN_PLAGUE", ())) for i in range(4): plague_turn = data.lGenericPlagueDates[i] iGameTurn = max(plague_turn - gc.getGame().getGameTurn(), 0) aHelp.append('Plague ' + str(i + 1) + ' start in: ' + str(plague_turn) + ' turn, Game turn left: ' + str(iGameTurn)) #4.科技进度 if (gc.getDefineINT("PYTHON_SCREEN_VICTORY_TIPS_04") > 0): aHelp.append(' ') techlist = [] valuelist = [] for iCiv in range(iNumPlayers): if (gc.getPlayer(iCiv).isAlive()): iTechValue = gc.getPlayer(iCiv).getTechHistory( gc.getGame().getGameTurn() - 1) valuelist.append(iTechValue) techlist.append([iCiv, iTechValue]) pass AveragePoint = 1 if (len(valuelist) > 0 and sum(valuelist) > 0): AveragePoint = sum(valuelist) / len(valuelist) aHelp.append( localText.getText("TXT_KEY_VICTORY_TIPS_IN_SCREEN_TECHRANK", ())) techlist.sort(key=lambda x: -x[1]) for i in range(len(techlist)): if (i < gc.getDefineINT("PYTHON_SCREEN_VICTORY_TIPS_04")): iCiv = techlist[i][0] iTechValue = techlist[i][1] civname = gc.getPlayer(iCiv).getCivilizationShortDescription(0) if (isDecline(iCiv)): civname = civname + '[F]' rank_percent = iTechValue * 100 / AveragePoint aHelp.append(' RANK (' + str(i + 1) + ') : ' + civname + ' with ' + str(iTechValue) + ' (' + str(rank_percent) + '%)') # 5.军事实力 if (gc.getDefineINT("PYTHON_SCREEN_VICTORY_TIPS_05") > 0): aHelp.append(' ') techlist = [] valuelist = [] for iCiv in range(iNumPlayers): if (gc.getPlayer(iCiv).isAlive()): iTechValue = gc.getPlayer(iCiv).getPowerHistory( gc.getGame().getGameTurn() - 1) valuelist.append(iTechValue) techlist.append([iCiv, iTechValue]) pass AveragePoint = 1 if (len(valuelist) > 0 and sum(valuelist) > 0): AveragePoint = sum(valuelist) / len(valuelist) aHelp.append( localText.getText("TXT_KEY_VICTORY_TIPS_IN_SCREEN_ARMYRANK", ())) techlist.sort(key=lambda x: -x[1]) for i in range(len(techlist)): if (i < gc.getDefineINT("PYTHON_SCREEN_VICTORY_TIPS_05")): iCiv = techlist[i][0] iTechValue = techlist[i][1] civname = gc.getPlayer(iCiv).getCivilizationShortDescription(0) if (isDecline(iCiv)): civname = civname + '[F]' rank_percent = iTechValue * 100 / AveragePoint aHelp.append(' RANK (' + str(i + 1) + ') : ' + civname + ' with ' + str(iTechValue) + ' (' + str(rank_percent) + '%)') # 5.文化实力 if (gc.getDefineINT("PYTHON_SCREEN_VICTORY_TIPS_05") > 0): aHelp.append(' ') techlist = [] valuelist = [] for iCiv in range(iNumPlayers): if (gc.getPlayer(iCiv).isAlive()): iTechValue = gc.getPlayer(iCiv).getCultureHistory( gc.getGame().getGameTurn() - 1) valuelist.append(iTechValue) techlist.append([iCiv, iTechValue]) pass AveragePoint = 1 if (len(valuelist) > 0 and sum(valuelist) > 0): AveragePoint = sum(valuelist) / len(valuelist) aHelp.append( localText.getText("TXT_KEY_VICTORY_TIPS_IN_SCREEN_CULTURERANK", ())) techlist.sort(key=lambda x: -x[1]) for i in range(len(techlist)): if (i < gc.getDefineINT("PYTHON_SCREEN_VICTORY_TIPS_05")): iCiv = techlist[i][0] iTechValue = techlist[i][1] civname = gc.getPlayer(iCiv).getCivilizationShortDescription(0) if (isDecline(iCiv)): civname = civname + '[F]' rank_percent = iTechValue * 100 / AveragePoint aHelp.append(' RANK (' + str(i + 1) + ') : ' + civname + ' with ' + str(iTechValue) + ' (' + str(rank_percent) + '%)') # 5.AI性格 if (gc.getDefineINT("PYTHON_SCREEN_VICTORY_TIPS_05") > 0 and 1 == 2): aHelp.append(' ') techlist = [] valuelist = [] for iCiv in range(iNumPlayers): if (gc.getPlayer(iCiv).isAlive()): #iTechValue = gc.getPlayer(iCiv).getCultureHistory(gc.getGame().getGameTurn()-1) iStrategyNum = gc.showAIstrategy(iCiv) #iStrategyNum=1 iTechValue = iStrategyNum valuelist.append(iTechValue) techlist.append([iCiv, iTechValue]) pass for i in range(len(techlist)): iCiv = techlist[i][0] iTechValue = techlist[i][1] civname = gc.getPlayer(iCiv).getCivilizationShortDescription(0) if (isDecline(iCiv)): civname = civname + '[F]' txt1 = civname + ' 的策略是 ' + str(iTechValue) aHelp.append(txt1) #6.世界最大城市排名 if (gc.getDefineINT("PYTHON_SCREEN_VICTORY_TIPS_06") > 0): aHelp.append(' ') aHelp.append( localText.getText("TXT_KEY_VICTORY_TIPS_IN_SCREEN_CITY_RANK_POP", ())) lCities = calculateTopCities_population() i_num_city = 0 for iCity in lCities: if (i_num_city < gc.getDefineINT("PYTHON_SCREEN_VICTORY_TIPS_06")): i_num_city += 1 civname = iCity[0].getName() + ' [' + str( gc.getPlayer(iCity[0].getOwner()). getCivilizationShortDescription(0)) + ']' iValue = iCity[1] rank_percent = 100 aHelp.append(' RANK (' + str(i_num_city) + ') : ' + civname + ' with ' + str(iValue) + ' ') pass #7.世界文化最高城市排名 if (gc.getDefineINT("PYTHON_SCREEN_VICTORY_TIPS_07") > 0): aHelp.append(' ') aHelp.append( localText.getText("TXT_KEY_VICTORY_TIPS_IN_SCREEN_CITY_RANK_CUL", ())) lCities = calculateTopCities_culture() i_num_city = 0 for iCity in lCities: if (i_num_city < gc.getDefineINT("PYTHON_SCREEN_VICTORY_TIPS_07")): i_num_city += 1 civname = iCity[0].getName() + ' [' + str( gc.getPlayer(iCity[0].getOwner()). getCivilizationShortDescription(0)) + ']' iValue = iCity[1] rank_percent = 100 aHelp.append(' RANK (' + str(i_num_city) + ') : ' + civname + ' with ' + str(iValue) + ' ') pass #8.世界工业产量最高城市排名 if (gc.getDefineINT("PYTHON_SCREEN_VICTORY_TIPS_08") > 0): aHelp.append(' ') aHelp.append( localText.getText("TXT_KEY_VICTORY_TIPS_IN_SCREEN_CITY_RANK_PRO", ())) lCities = calculateTopCities_production() i_num_city = 0 for iCity in lCities: if (i_num_city < gc.getDefineINT("PYTHON_SCREEN_VICTORY_TIPS_08")): i_num_city += 1 civname = iCity[0].getName() + ' [' + str( gc.getPlayer(iCity[0].getOwner()). getCivilizationShortDescription(0)) + ']' iValue = iCity[1] rank_percent = 100 aHelp.append(' RANK (' + str(i_num_city) + ') : ' + civname + ' with ' + str(iValue) + ' ') pass #9.世界商业产出最高城市排名 if (gc.getDefineINT("PYTHON_SCREEN_VICTORY_TIPS_09") > 0): aHelp.append(' ') aHelp.append( localText.getText("TXT_KEY_VICTORY_TIPS_IN_SCREEN_CITY_RANK_COM", ())) lCities = calculateTopCities_COMMERCE() i_num_city = 0 for iCity in lCities: if (i_num_city < gc.getDefineINT("PYTHON_SCREEN_VICTORY_TIPS_09")): i_num_city += 1 civname = iCity[0].getName() + ' [' + str( gc.getPlayer(iCity[0].getOwner()). getCivilizationShortDescription(0)) + ']' iValue = iCity[1] rank_percent = 100 aHelp.append(' RANK (' + str(i_num_city) + ') : ' + civname + ' with ' + str(iValue) + ' ') pass #10.世界食物产出最高城市排名 if (gc.getDefineINT("PYTHON_SCREEN_VICTORY_TIPS_10") > 0): aHelp.append(' ') aHelp.append( localText.getText("TXT_KEY_VICTORY_TIPS_IN_SCREEN_CITY_RANK_FOOD", ())) lCities = calculateTopCities_FOOD() i_num_city = 0 for iCity in lCities: if (i_num_city < gc.getDefineINT("PYTHON_SCREEN_VICTORY_TIPS_10")): i_num_city += 1 civname = iCity[0].getName() + ' [' + str( gc.getPlayer(iCity[0].getOwner()). getCivilizationShortDescription(0)) + ']' iValue = iCity[1] rank_percent = 100 aHelp.append(' RANK (' + str(i_num_city) + ') : ' + civname + ' with ' + str(iValue) + ' ') pass ''' iDebug=1 #下面代码仅为DEBUG使用 if (iDebug): for ePlayer in range(iNumActivePlayers): researchCost = str(gc.getTeam(gc.getPlayer(ePlayer).getTeam()).getResearchCost(100)*100/3000) civname=gc.getPlayer(ePlayer).getCivilizationShortDescription(0) utils.debug_manual(civname+','+researchCost,'ResearchCost') ''' return aHelp pass