def handleInput(self, inputClass): ' Calls function mapped in DomesticAdvisorInputMap' # only get from the map if it has the key if (inputClass.getNotifyCode() == NotifyCode.NOTIFY_LISTBOX_ITEM_SELECTED): if (inputClass.getMouseX() == 0): screen = CyGInterfaceScreen("DomesticAdvisor", CvScreenEnums.DOMESTIC_ADVISOR) screen.hideScreen() CyInterface().selectCity( gc.getPlayer(inputClass.getData1()).getCity( inputClass.getData2()), True) popupInfo = CyPopupInfo() popupInfo.setButtonPopupType( ButtonPopupTypes.BUTTONPOPUP_PYTHON_SCREEN) popupInfo.setText(u"showDomesticAdvisor") popupInfo.addPopup(inputClass.getData1()) else: self.updateAppropriateCitySelection() self.updateSpecialists() elif (inputClass.getNotifyCode() == NotifyCode.NOTIFY_CLICKED): if (inputClass.getFunctionName() == "DomesticSplit"): screen = CyGInterfaceScreen("DomesticAdvisor", CvScreenEnums.DOMESTIC_ADVISOR) screen.hideScreen() return 0
def doVikings(): iBarbPlayer = gc.getBARBARIAN_PLAYER() pBarbPlayer = gc.getPlayer(iBarbPlayer) iUnitTypeShip = gc.getInfoTypeForString("UNIT_VIKING_1") iUnitTypeUnit = gc.getInfoTypeForString("UNIT_VIKING_2") iDarkIce = gc.getInfoTypeForString("FEATURE_DARK_ICE") iMapW = gc.getMap().getGridWidth() iMapH = gc.getMap().getGridHeight() bMeldung = False for _ in xrange(4): iRandX = CvUtil.myRandom(iMapW, "W") iRandY = iMapH - CvUtil.myRandom(5, "H") loopPlot = gc.getMap().plot(iRandX, iRandY) if loopPlot is not None and not loopPlot.isNone(): if loopPlot.getFeatureType() == iDarkIce: continue if not loopPlot.isUnit() and loopPlot.isWater( ) and not loopPlot.isLake() and not loopPlot.isOwned(): # Wikinger erstellen bMeldung = True CvUtil.spawnUnit(iUnitTypeShip, loopPlot, pBarbPlayer) for _ in xrange(4): CvUtil.spawnUnit(iUnitTypeUnit, loopPlot, pBarbPlayer) if bMeldung: if gc.getGame().getGameTurnYear() == 400: for iPlayer in xrange(gc.getMAX_PLAYERS()): pPlayer = gc.getPlayer(iPlayer) if pPlayer.isAlive() and pPlayer.isHuman(): popupInfo = CyPopupInfo() popupInfo.setButtonPopupType( ButtonPopupTypes.BUTTONPOPUP_TEXT) popupInfo.setText(CyTranslator().getText( "TXT_KEY_MESSAGE_VIKINGS", ("", ))) popupInfo.addPopup(pPlayer.getID()) CyAudioGame().Play2DSound("AS2D_THEIRDECLAREWAR")
def doHuns(): iHuns = 0 iGameTurn = gc.getGame().getGameTurnYear() if iGameTurn == 250: iHuns = 20 elif iGameTurn == 255: iHuns = 24 elif iGameTurn == 260: iHuns = 28 elif iGameTurn >= 270 and iGameTurn <= 400 and iGameTurn % 10 == 0: iHuns = 28 # Diesen Wert auch unten bei der Meldung angeben! if iHuns == 0: return CivHuns = gc.getInfoTypeForString("CIVILIZATION_HUNNEN") bHunsAlive = False iMaxPlayers = gc.getMAX_PLAYERS() for iPlayer in xrange(iMaxPlayers): pPlayer = gc.getPlayer(iPlayer) # Hunnen sollen nur auftauchen, wenn es nicht bereits Hunnen gibt if pPlayer.getCivilizationType() == CivHuns and pPlayer.isAlive(): bHunsAlive = True break if not bHunsAlive: for iPlayer in xrange(iMaxPlayers): pPlayer = gc.getPlayer(iPlayer) # Message PopUps if iHuns < 28 and pPlayer.isAlive() and pPlayer.isHuman(): popupInfo = CyPopupInfo() popupInfo.setButtonPopupType(ButtonPopupTypes.BUTTONPOPUP_TEXT) if iHuns == 20: popupInfo.setText(CyTranslator().getText( "TXT_KEY_MESSAGE_HUNNEN_1", ("", ))) elif iHuns == 24: CyAudioGame().Play2DSound("AS2D_THEIRDECLAREWAR") popupInfo.setText(CyTranslator().getText( "TXT_KEY_MESSAGE_HUNNEN_2", ("", ))) else: popupInfo.setText(CyTranslator().getText( "TXT_KEY_MESSAGE_HUNNEN_3", ("", ))) popupInfo.addPopup(pPlayer.getID()) iMapW = gc.getMap().getGridWidth() iMapH = gc.getMap().getGridHeight() iDarkIce = gc.getInfoTypeForString("FEATURE_DARK_ICE") # 15 Versuche einen Plot zu finden bPlot = False for _ in xrange(15): # Diese Koordinaten entsprechen Nord-Osten iRandX = iMapW - 15 + CvUtil.myRandom(15, "W2") iRandY = iMapH - 15 + CvUtil.myRandom(15, "H2") loopPlot = gc.getMap().plot(iRandX, iRandY) if loopPlot is not None and not loopPlot.isNone(): if loopPlot.getFeatureType( ) != iDarkIce and not loopPlot.isUnit( ) and not loopPlot.isWater() and not loopPlot.isOwned( ) and not loopPlot.isPeak(): bPlot = True break if not bPlot: return # Hunnen versuchen zu erstellen False: Ausgeschaltet! if iGameTurn >= 250 and gc.getGame().countCivPlayersAlive( ) < iMaxPlayers and False: # freie PlayerID herausfinden iHunsID = 0 for i in xrange(iMaxPlayers): j = iMaxPlayers - i - 1 pPlayer = gc.getPlayer(j) if not pPlayer.isAlive(): iHunsID = j break if iHunsID == 0: return # Hunnen erstellen LeaderHuns = gc.getInfoTypeForString("LEADER_ATTILA") gc.getGame().addPlayer(iHunsID, LeaderHuns, CivHuns) pPlayer = gc.getPlayer(iHunsID) iUnitSettler = gc.getInfoTypeForString("UNIT_SETTLER") iUnitSpearman = gc.getInfoTypeForString("UNIT_SPEARMAN") iUnitWorker = gc.getInfoTypeForString("UNIT_WORKER") iUnitKeshik = gc.getInfoTypeForString("UNIT_MONGOL_KESHIK") iUnitArcher = gc.getInfoTypeForString("UNIT_REFLEX_ARCHER") iUnitHorse = gc.getInfoTypeForString("UNIT_HORSE") for _ in xrange(3): CvUtil.spawnUnit(iUnitSettler, loopPlot, pPlayer) for _ in xrange(4): CvUtil.spawnUnit(iUnitSpearman, loopPlot, pPlayer) for _ in xrange(6): CvUtil.spawnUnit(iUnitWorker, loopPlot, pPlayer) for _ in xrange(8): CvUtil.spawnUnit(iUnitKeshik, loopPlot, pPlayer) for _ in xrange(9): CvUtil.spawnUnit(iUnitArcher, loopPlot, pPlayer) for _ in xrange(9): CvUtil.spawnUnit(iUnitHorse, loopPlot, pPlayer) pPlayer.setCurrentEra(3) pPlayer.setGold(300) # increasing Anger to all other CIVs # and looking for best tech player pTeam = gc.getTeam(pPlayer.getTeam()) iPlayerBestTechScore = -1 iTechScore = 0 for i in xrange(iMaxPlayers): pSecondPlayer = gc.getPlayer(i) # increases Anger for all AIs if pSecondPlayer.getID() != pPlayer.getID( ) and pSecondPlayer.isAlive(): # Haltung aendern pPlayer.AI_changeAttitudeExtra(i, -5) # Krieg erklaeren pTeam.declareWar(pSecondPlayer.getTeam(), 0, 6) # TechScore herausfinden if iTechScore < pSecondPlayer.getTechScore(): iTechScore = pSecondPlayer.getTechScore() iPlayerBestTechScore = i # Techs geben if iPlayerBestTechScore > -1: xTeam = gc.getTeam( gc.getPlayer(iPlayerBestTechScore).getTeam()) iTechNum = gc.getNumTechInfos() for iTech in xrange(iTechNum): if gc.getTechInfo(iTech) is not None and xTeam.isHasTech( iTech) and not pTeam.isHasTech( iTech) and gc.getTechInfo(iTech).isTrade(): pTeam.setHasTech(iTech, 1, iHunsID, 0, 0) else: iUnitType = gc.getInfoTypeForString('UNIT_MONGOL_KESHIK') pBarbPlayer = gc.getPlayer(gc.getBARBARIAN_PLAYER()) for _ in xrange(iHuns): CvUtil.spawnUnit(iUnitType, loopPlot, pBarbPlayer)
def doSeevoelker(): iBarbPlayer = gc.getBARBARIAN_PLAYER() pBarbPlayer = gc.getPlayer(iBarbPlayer) iUnitTypeShip = gc.getInfoTypeForString("UNIT_SEEVOLK") # Cargo: 3 iUnitTypeWarrior1 = gc.getInfoTypeForString("UNIT_SEEVOLK_1") iUnitTypeWarrior2 = gc.getInfoTypeForString("UNIT_SEEVOLK_2") iUnitTypeWarrior3 = gc.getInfoTypeForString("UNIT_SEEVOLK_3") # Handicap: 0 (Settler) - 8 (Deity) # Worldsize: 0 (Duell) - 5 (Huge) iRange = 1 + gc.getMap().getWorldSize() + gc.getGame().getHandicapType() #iRange = max(iRange,8) iPlots = gc.getMap().numPlots() iLandPlots = gc.getMap().getLandPlots() # Wenn es mehr Land als Wasser gibt if iLandPlots > iPlots / 2: iRange /= 2 for _ in xrange(iRange): # Wird geaendert zu einem Mittelmeerstreifen: x: 5 bis (X-5), y: 5 bis letztes Drittel von Y iMapX = gc.getMap().getGridWidth() - 5 iMapY = int(gc.getMap().getGridHeight() / 3 * 2) iRandX = 5 + CvUtil.myRandom(iMapX, "X") iRandY = 5 + CvUtil.myRandom(iMapY, "Y") loopPlot = gc.getMap().plot(iRandX, iRandY) # Plot soll ein Ozean sein terr_ocean = gc.getInfoTypeForString("TERRAIN_OCEAN") feat_ice = gc.getInfoTypeForString("FEATURE_ICE") iDarkIce = gc.getInfoTypeForString("FEATURE_DARK_ICE") if loopPlot is not None and not loopPlot.isNone(): if loopPlot.getFeatureType() == iDarkIce: continue if not loopPlot.isUnit() and not loopPlot.isOwned( ) and loopPlot.getFeatureType( ) != feat_ice and loopPlot.getTerrainType() == terr_ocean: # Schiffe erstellen iAnz = 1 if bRageBarbs and gc.getGame().getGameTurnYear() > -1000: iAnz = 2 #elif gc.getGame().getGameTurnYear() > -1200: # iAnz = 2 for _ in xrange(iAnz): CvUtil.spawnUnit(iUnitTypeShip, loopPlot, pBarbPlayer) CvUtil.spawnUnit(iUnitTypeWarrior1, loopPlot, pBarbPlayer) CvUtil.spawnUnit(iUnitTypeWarrior2, loopPlot, pBarbPlayer) CvUtil.spawnUnit(iUnitTypeWarrior3, loopPlot, pBarbPlayer) # Meldung PopUp if gc.getGame().getGameTurnYear() > -1400 and gc.getGame().getGameTurnYear( ) < -1380: for iPlayer in xrange(gc.getMAX_PLAYERS()): pPlayer = gc.getPlayer(iPlayer) if pPlayer.isAlive() and pPlayer.isHuman(): popupInfo = CyPopupInfo() popupInfo.setButtonPopupType(ButtonPopupTypes.BUTTONPOPUP_TEXT) popupInfo.setText(CyTranslator().getText( "TXT_KEY_MESSAGE_SEAPEOPLES", ("", ))) popupInfo.addPopup(pPlayer.getID()) CyAudioGame().Play2DSound("AS2D_THEIRDECLAREWAR")
def onCityAcquired(pCity, iNewOwner): iCivRome = 0 # Capital: Rome iCivCarthage = 1 # Capital: Carthage sData = CvUtil.getScriptData(pCity.plot(), ["t"]) if sData == "Rome" and iNewOwner == iCivCarthage or sData == "Carthage" and iNewOwner == iCivRome: # PAE Movie if gc.getPlayer(iNewOwner).isHuman(): if iNewOwner == iCivRome: iMovie = 1 else: iMovie = 2 popupInfo = CyPopupInfo() popupInfo.setButtonPopupType( ButtonPopupTypes.BUTTONPOPUP_PYTHON_SCREEN) popupInfo.setData1(iMovie) # dynamicID in CvWonderMovieScreen popupInfo.setData2(0) # fix pCity.getID() popupInfo.setData3(3) # fix PAE Movie ID for victory movies popupInfo.setText(u"showWonderMovie") popupInfo.addPopup(iNewOwner) gc.getGame().setWinner(gc.getPlayer(iNewOwner).getTeam(), 2)
def onEndGameTurn(iGameTurn): """Kriegserklärung FIRST TURN""" # Beginn Runde 1 (218 v.Chr.) Kriegserklärung Team 0 (Rom) an Team 1 (Karthago) if iGameTurn == 12: # ewiger Krieg #gc.getTeam(gc.getPlayer(0).getTeam()).setPermanentWarPeace(gc.getPlayer(1).getTeam(), False) gc.getTeam(gc.getPlayer(iRome).getTeam()).declareWar( gc.getPlayer(iCarthago).getTeam(), False, 5) gc.getPlayer(iRome).AI_setAttitudeExtra(iCarthago, -50) gc.getPlayer(iCarthago).AI_setAttitudeExtra(iRome, -50) # gc.getTeam(gc.getPlayer(0).getTeam()).setWarWeariness(gc.getPlayer(1).getTeam(),30) # gc.getTeam(gc.getPlayer(1).getTeam()).setWarWeariness(gc.getPlayer(0).getTeam(),30) # Meldung an die Spieler popupInfo = CyPopupInfo() popupInfo.setButtonPopupType(ButtonPopupTypes.BUTTONPOPUP_TEXT) popupInfo.setText(CyTranslator().getText( "TXT_KEY_MESSAGE_2NDPUNICWAR_1", ("", ))) popupInfo.addPopup(gc.getGame().getActivePlayer()) # Konsul Lucius Postumius Albinus fällt im Kampf gegen Boier if iGameTurn == 40: iBoier = 7 if not gc.getTeam(gc.getPlayer(iBoier)).isAtWar(gc.getPlayer(iRome)): gc.getTeam(gc.getPlayer(iBoier).getTeam()).declareWar( gc.getPlayer(iRome).getTeam(), False, 5) gc.getPlayer(iRome).AI_setAttitudeExtra(iBoier, -30) gc.getPlayer(iBoier).AI_setAttitudeExtra(iRome, -30) # Meldung an die Spieler popupInfo = CyPopupInfo() popupInfo.setButtonPopupType(ButtonPopupTypes.BUTTONPOPUP_TEXT) popupInfo.setText(CyTranslator().getText( "TXT_KEY_MESSAGE_2NDPUNICWAR_7", ("", ))) popupInfo.addPopup(gc.getGame().getActivePlayer()) # Massinissa verbündet sich mit Karthago # Civ Ost-Numider (Massinissa) wird Vasall von Karthago # Bedingung: Ost-Numider ist noch nicht Vasall if iGameTurn == 45: iMassinissa = 3 iTeamCarthago = gc.getPlayer(iCarthago).getTeam() iTeamNumidien = gc.getPlayer(iMassinissa).getTeam() pTeamNumidien = gc.getTeam(iTeamNumidien) if not pTeamNumidien.isVassal(iTeamCarthago): gc.getTeam(iTeamCarthago).assignVassal( iTeamNumidien, 0) # Vassal, but no surrender # Meldung an die Spieler popupInfo = CyPopupInfo() popupInfo.setButtonPopupType(ButtonPopupTypes.BUTTONPOPUP_TEXT) popupInfo.setText(CyTranslator().getText( "TXT_KEY_MESSAGE_2NDPUNICWAR_8", ("", ))) popupInfo.addPopup(gc.getGame().getActivePlayer()) # 214 v.Chr.: Syrakus erklärt Rom den Krieg if iGameTurn == 65: iSyracus = 21 if not gc.getTeam(gc.getPlayer(iSyracus)).isAtWar(gc.getPlayer(iRome)): gc.getTeam(gc.getPlayer(iSyracus).getTeam()).declareWar( gc.getPlayer(iRome).getTeam(), False, 5) # Meldung an die Spieler popupInfo = CyPopupInfo() popupInfo.setButtonPopupType(ButtonPopupTypes.BUTTONPOPUP_TEXT) popupInfo.setText(CyTranslator().getText( "TXT_KEY_MESSAGE_2NDPUNICWAR_11", ("", ))) popupInfo.addPopup(gc.getGame().getActivePlayer()) # Syphax verbündet sich mit Rom # Civ West-Numider (Syphax) wird Vasall von Rom # Bedingung: West-Numider ist noch nicht Vasall von Rom if iGameTurn == 145: iSyphax = 2 iTeamRome = gc.getPlayer(iRome).getTeam() iTeamNumidien = gc.getPlayer(iSyphax).getTeam() pTeamNumidien = gc.getTeam(iTeamNumidien) if not pTeamNumidien.isVassal(iTeamRome): gc.getTeam(iTeamRome).assignVassal(iTeamNumidien, 0) # Vassal, but no surrender # Meldung an die Spieler popupInfo = CyPopupInfo() popupInfo.setButtonPopupType(ButtonPopupTypes.BUTTONPOPUP_TEXT) popupInfo.setText(CyTranslator().getText( "TXT_KEY_MESSAGE_2NDPUNICWAR_16", ("", ))) popupInfo.addPopup(gc.getGame().getActivePlayer()) # Syphax läuft zu Karthago über # Civ West-Numider (Syphax) wird Vasall von Karthago # Bedingung: West-Numider ist noch nicht Vasall von Karthago if iGameTurn == 174: iSyphax = 2 iTeamCarthago = gc.getPlayer(iCarthago).getTeam() iTeamNumidien = gc.getPlayer(iSyphax).getTeam() pTeamNumidien = gc.getTeam(iTeamNumidien) if not pTeamNumidien.isVassal(iTeamCarthago): gc.getTeam(iTeamCarthago).assignVassal( iTeamNumidien, 0) # Vassal, but no surrender # Meldung an die Spieler popupInfo = CyPopupInfo() popupInfo.setButtonPopupType(ButtonPopupTypes.BUTTONPOPUP_TEXT) popupInfo.setText(CyTranslator().getText( "TXT_KEY_MESSAGE_2NDPUNICWAR_18", ("", ))) popupInfo.addPopup(gc.getGame().getActivePlayer()) # Massinissa läuft zu Rom über # Civ Ost-Numider (Massinissa) wird Vasall von Rom # Bedingung: Ost-Numider ist noch nicht Vasall von Rom if iGameTurn == 145: iMassinissa = 3 iTeamRome = gc.getPlayer(iRome).getTeam() iTeamNumidien = gc.getPlayer(iMassinissa).getTeam() pTeamNumidien = gc.getTeam(iTeamNumidien) if not pTeamNumidien.isVassal(iTeamRome): gc.getTeam(iTeamRome).assignVassal(iTeamNumidien, 0) # Vassal, but no surrender # Meldung an die Spieler popupInfo = CyPopupInfo() popupInfo.setButtonPopupType(ButtonPopupTypes.BUTTONPOPUP_TEXT) popupInfo.setText(CyTranslator().getText( "TXT_KEY_MESSAGE_2NDPUNICWAR_19", ("", ))) popupInfo.addPopup(gc.getGame().getActivePlayer())
def onEndPlayerTurn(iPlayer, iGameTurn): # Kelten erheben sich in der Po-Ebene if iGameTurn == 13: if iPlayer == iRome and gc.getPlayer(iPlayer).isHuman(): # 1. barb. Einheiten bei Placentia # Plot für die Landungseinheiten lPlots = [ CyMap().plot(47, 66), CyMap().plot(48, 66), CyMap().plot(49, 66) ] Landungsplot = getRandomPlot(lPlots) # Einheiten erstellen LNewUnits = [ gc.getInfoTypeForString("UNIT_CELTIC_GALLIC_WARRIOR"), gc.getInfoTypeForString("UNIT_SCHILDTRAEGER"), gc.getInfoTypeForString("UNIT_SKIRMISHER"), gc.getInfoTypeForString("UNIT_HORSEMAN_CELTIC") ] for i in LNewUnits: pUnit = gc.getPlayer(gc.getBARBARIAN_PLAYER()).initUnit( i, Landungsplot.getX(), Landungsplot.getY(), UnitAITypes.UNITAI_ATTACK, DirectionTypes.DIRECTION_SOUTH) pUnit.setExperience(2, -1) # Ping CyInterface().doPing(Landungsplot.getX(), Landungsplot.getY(), iPlayer) # 2. barb. Einheiten bei Ravenna # Plot für die Landungseinheiten lPlots = [ CyMap().plot(53, 67), CyMap().plot(53, 57), CyMap().plot(53, 65) ] Landungsplot = getRandomPlot(lPlots) # Einheiten erstellen LNewUnits = [ gc.getInfoTypeForString("UNIT_CELTIC_GALLIC_WARRIOR"), gc.getInfoTypeForString("UNIT_SCHILDTRAEGER"), gc.getInfoTypeForString("UNIT_SKIRMISHER"), gc.getInfoTypeForString("UNIT_HORSEMAN_CELTIC") ] for i in LNewUnits: pUnit = gc.getPlayer(gc.getBARBARIAN_PLAYER()).initUnit( i, Landungsplot.getX(), Landungsplot.getY(), UnitAITypes.UNITAI_ATTACK, DirectionTypes.DIRECTION_SOUTH) pUnit.setExperience(2, -1) # Ping CyInterface().doPing(Landungsplot.getX(), Landungsplot.getY(), iPlayer) # Meldung an den Spieler popupInfo = CyPopupInfo() popupInfo.setButtonPopupType(ButtonPopupTypes.BUTTONPOPUP_TEXT) popupInfo.setText(CyTranslator().getText( "TXT_KEY_MESSAGE_2NDPUNICWAR_2", ("", ))) popupInfo.addPopup(iPlayer) # 2. Schlacht von Lilybaeum, Angriff Karthago auf Sizilien if iGameTurn == 19: if iPlayer == iRome and gc.getPlayer(iPlayer).isHuman(): # Plot für die Schiffe lPlots = [ CyMap().plot(51, 45), CyMap().plot(51, 46), CyMap().plot(51, 47) ] Schiffsplot = getRandomPlot(lPlots) # Schiffe erstellen LNewUnits = [gc.getInfoTypeForString("UNIT_QUADRIREME")] for i in LNewUnits: for _ in range(4): pUnit = gc.getPlayer(iCarthago).initUnit( i, Schiffsplot.getX(), Schiffsplot.getY(), UnitAITypes.UNITAI_ASSAULT_SEA, DirectionTypes.DIRECTION_SOUTH) pUnit.setExperience(2, -1) pUnit.setHasPromotion( gc.getInfoTypeForString("PROMOTION_COMBAT1"), True) pUnit.setHasPromotion( gc.getInfoTypeForString("PROMOTION_COMBAT2"), True) # Meldung an den Spieler popupInfo = CyPopupInfo() popupInfo.setButtonPopupType(ButtonPopupTypes.BUTTONPOPUP_TEXT) popupInfo.setText(CyTranslator().getText( "TXT_KEY_MESSAGE_2NDPUNICWAR_3", ("", ))) popupInfo.addPopup(iPlayer) CyCamera().JustLookAtPlot(Schiffsplot) # Schlacht von Cissa, Römer landen in Iberien if iGameTurn == 23: if iPlayer == iCarthago and gc.getPlayer(iPlayer).isHuman(): # Plot für die Landungseinheiten lPlots = [ CyMap().plot(19, 52), CyMap().plot(19, 53), CyMap().plot(20, 53) ] Landungsplot = getRandomPlot(lPlots) # Plot für die Schiffe lPlots = [ CyMap().plot(20, 52), CyMap().plot(21, 52), CyMap().plot(21, 53) ] Schiffsplot = getRandomPlot(lPlots) # Schiffe erstellen LNewUnits = [ gc.getInfoTypeForString("UNIT_QUADRIREME"), gc.getInfoTypeForString("UNIT_TRIREME") ] for i in LNewUnits: for _ in range(2): pUnit = gc.getPlayer(iRome).initUnit( i, Schiffsplot.getX(), Schiffsplot.getY(), UnitAITypes.UNITAI_ASSAULT_SEA, DirectionTypes.DIRECTION_SOUTH) pUnit.setExperience(2, -1) pUnit.setHasPromotion( gc.getInfoTypeForString("PROMOTION_COMBAT1"), True) pUnit.setHasPromotion( gc.getInfoTypeForString("PROMOTION_CORVUS1"), True) # Einheiten erstellen LNewUnits = [ gc.getInfoTypeForString("UNIT_TRIARII"), gc.getInfoTypeForString("UNIT_PRINCIPES"), gc.getInfoTypeForString("UNIT_PRINCIPES"), gc.getInfoTypeForString("UNIT_HASTATI"), gc.getInfoTypeForString("UNIT_HASTATI"), gc.getInfoTypeForString("UNIT_SKIRMISHER_ROME"), gc.getInfoTypeForString("UNIT_SKIRMISHER_ROME") ] for i in LNewUnits: pUnit = gc.getPlayer(iRome).initUnit( i, Landungsplot.getX(), Landungsplot.getY(), UnitAITypes.UNITAI_ATTACK, DirectionTypes.DIRECTION_SOUTH) pUnit.setExperience(2, -1) # Meldung an den Spieler popupInfo = CyPopupInfo() popupInfo.setButtonPopupType(ButtonPopupTypes.BUTTONPOPUP_TEXT) popupInfo.setText(CyTranslator().getText( "TXT_KEY_MESSAGE_2NDPUNICWAR_4", ("", ))) popupInfo.addPopup(iPlayer) CyCamera().JustLookAtPlot(Landungsplot) # Rom erobert Sagunt (Plot: 20,50) if iGameTurn == 30: if iPlayer == iCarthago and gc.getPlayer(iPlayer).isHuman() and CyMap( ).plot(20, 50).getOwner() == iCarthago: # Plot für die Landungseinheiten lPlots = [CyMap().plot(19, 51), CyMap().plot(20, 49)] Landungsplot = getRandomPlot(lPlots) # Plot für die Schiffe lPlots = [ CyMap().plot(20, 49), CyMap().plot(20, 50), CyMap().plot(20, 51) ] Schiffsplot = getRandomPlot(lPlots) # Schiffe erstellen LNewUnits = [ gc.getInfoTypeForString("UNIT_QUADRIREME"), gc.getInfoTypeForString("UNIT_TRIREME") ] for i in LNewUnits: for _ in range(2): pUnit = gc.getPlayer(iRome).initUnit( i, Schiffsplot.getX(), Schiffsplot.getY(), UnitAITypes.UNITAI_ASSAULT_SEA, DirectionTypes.DIRECTION_SOUTH) pUnit.setExperience(2, -1) pUnit.setHasPromotion( gc.getInfoTypeForString("PROMOTION_COMBAT1"), True) pUnit.setHasPromotion( gc.getInfoTypeForString("PROMOTION_CORVUS1"), True) # Einheiten erstellen LNewUnits = [ gc.getInfoTypeForString("UNIT_TRIARII"), gc.getInfoTypeForString("UNIT_PRINCIPES"), gc.getInfoTypeForString("UNIT_PRINCIPES"), gc.getInfoTypeForString("UNIT_HASTATI"), gc.getInfoTypeForString("UNIT_HASTATI"), gc.getInfoTypeForString("UNIT_SKIRMISHER_ROME"), gc.getInfoTypeForString("UNIT_SKIRMISHER_ROME") ] for i in LNewUnits: pUnit = gc.getPlayer(iRome).initUnit( i, Landungsplot.getX(), Landungsplot.getY(), UnitAITypes.UNITAI_ATTACK, DirectionTypes.DIRECTION_SOUTH) pUnit.setExperience(2, -1) # Meldung an den Spieler popupInfo = CyPopupInfo() popupInfo.setButtonPopupType(ButtonPopupTypes.BUTTONPOPUP_TEXT) popupInfo.setText(CyTranslator().getText( "TXT_KEY_MESSAGE_2NDPUNICWAR_5", ("", ))) popupInfo.addPopup(iPlayer) CyCamera().JustLookAtPlot(Landungsplot) # iberische Städte rebellieren gegen Karthago # barb. Einheiten in Iberien if iGameTurn == 38: if iPlayer == iCarthago and gc.getPlayer(iPlayer).isHuman(): LNewUnits = [ gc.getInfoTypeForString("UNIT_SCHILDTRAEGER_IBERIA"), gc.getInfoTypeForString("UNIT_SPEARMAN"), gc.getInfoTypeForString("UNIT_SKIRMISHER_ROME"), gc.getInfoTypeForString("UNIT_CELTIBERIAN_CAVALRY") ] # Plot für die Landungseinheiten lPlots = [ CyMap().plot(14, 50), CyMap().plot(14, 51), CyMap().plot(14, 52) ] Landungsplot = getRandomPlot(lPlots) for i in LNewUnits: pUnit = gc.getPlayer(gc.getBARBARIAN_PLAYER()).initUnit( i, Landungsplot.getX(), Landungsplot.getY(), UnitAITypes.UNITAI_ATTACK, DirectionTypes.DIRECTION_SOUTH) pUnit.setExperience(2, -1) # Plot für die Landungseinheiten lPlots = [ CyMap().plot(8, 43), CyMap().plot(9, 42), CyMap().plot(9, 43) ] Landungsplot = getRandomPlot(lPlots) for i in LNewUnits: pUnit = gc.getPlayer(gc.getBARBARIAN_PLAYER()).initUnit( i, Landungsplot.getX(), Landungsplot.getY(), UnitAITypes.UNITAI_ATTACK, DirectionTypes.DIRECTION_SOUTH) pUnit.setExperience(2, -1) # Meldung an den Spieler popupInfo = CyPopupInfo() popupInfo.setButtonPopupType(ButtonPopupTypes.BUTTONPOPUP_TEXT) popupInfo.setText(CyTranslator().getText( "TXT_KEY_MESSAGE_2NDPUNICWAR_6", ("", ))) popupInfo.addPopup(iPlayer) CyCamera().JustLookAtPlot(Landungsplot) # Capua verbündet sich mit Hannibal # Capua wird barbarisch (Plot: 58, 58) # Bedinung: Capua = römisch + Rom u. Karthago im Krieg if iGameTurn == 50: if iPlayer == iRome and gc.getPlayer(iPlayer).isHuman(): pPlot = CyMap().plot(58, 58) if pPlot.getOwner() == iRome and gc.getTeam( gc.getPlayer(iCarthago)).isAtWar(gc.getPlayer(iRome)): # Stadt wird barbarisch + Einheiten PAE_City.doRenegadeCity(pPlot.getPlotCity(), gc.getBARBARIAN_PLAYER(), None) LNewUnits = [ gc.getInfoTypeForString("UNIT_REBELL"), gc.getInfoTypeForString("UNIT_REFLEX_ARCHER"), gc.getInfoTypeForString("UNIT_SAMNIT") ] for i in LNewUnits: pUnit = gc.getPlayer(gc.getBARBARIAN_PLAYER()).initUnit( i, pPlot.getX(), pPlot.getY(), UnitAITypes.UNITAI_CITY_DEFENSE, DirectionTypes.DIRECTION_SOUTH) pUnit.setExperience(2, -1) pUnit.setHasPromotion( gc.getInfoTypeForString("PROMOTION_CITY_GARRISON1"), True) # Meldung an den Spieler popupInfo = CyPopupInfo() popupInfo.setButtonPopupType(ButtonPopupTypes.BUTTONPOPUP_TEXT) popupInfo.setText(CyTranslator().getText( "TXT_KEY_MESSAGE_2NDPUNICWAR_9", ("", ))) popupInfo.addPopup(iPlayer) CyCamera().JustLookAtPlot(pPlot) # Schlacht von Cornus, Punier landen auf Sardinien if iGameTurn == 56: if iPlayer == iRome and gc.getPlayer(iPlayer).isHuman(): # Plot für die Landungseinheiten lPlots = [ CyMap().plot(44, 52), CyMap().plot(45, 51), CyMap().plot(45, 52) ] Landungsplot = getRandomPlot(lPlots) # Plot für die Schiffe lPlots = [ CyMap().plot(43, 51), CyMap().plot(43, 52), CyMap().plot(43, 53) ] Schiffsplot = getRandomPlot(lPlots) # Schiffe erstellen LNewUnits = [ gc.getInfoTypeForString("UNIT_QUADRIREME"), gc.getInfoTypeForString("UNIT_TRIREME") ] for i in LNewUnits: for _ in range(2): pUnit = gc.getPlayer(iRome).initUnit( i, Schiffsplot.getX(), Schiffsplot.getY(), UnitAITypes.UNITAI_ASSAULT_SEA, DirectionTypes.DIRECTION_SOUTH) pUnit.setExperience(2, -1) pUnit.setHasPromotion( gc.getInfoTypeForString("PROMOTION_COMBAT1"), True) pUnit.setHasPromotion( gc.getInfoTypeForString("PROMOTION_COMBAT2"), True) # Einheiten erstellen LNewUnits = [ gc.getInfoTypeForString("UNIT_CARTH_SACRED_BAND_OFFICER"), gc.getInfoTypeForString("UNIT_SPEARMAN_CARTHAGE"), gc.getInfoTypeForString("UNIT_SPEARMAN_CARTHAGE"), gc.getInfoTypeForString("UNIT_REBELL"), gc.getInfoTypeForString("UNIT_REBELL"), gc.getInfoTypeForString("UNIT_SKIRMISHER"), gc.getInfoTypeForString("UNIT_SKIRMISHER") ] for i in LNewUnits: pUnit = gc.getPlayer(iRome).initUnit( i, Landungsplot.getX(), Landungsplot.getY(), UnitAITypes.UNITAI_ATTACK, DirectionTypes.DIRECTION_SOUTH) pUnit.setExperience(2, -1) # Meldung an den Spieler popupInfo = CyPopupInfo() popupInfo.setButtonPopupType(ButtonPopupTypes.BUTTONPOPUP_TEXT) popupInfo.setText(CyTranslator().getText( "TXT_KEY_MESSAGE_2NDPUNICWAR_10", ("", ))) popupInfo.addPopup(iPlayer) CyCamera().JustLookAtPlot(Landungsplot) # Massinissa schickt Truppen nach Iberien # ost-num. Truppen in Karthago-Nova # Bedingung: Ost-Numider Vasall von Karthago + Rom und Karthago im Krieg if iGameTurn == 85: if iPlayer == iCarthago or iPlayer == iRome: iMessana = 3 iTeamCarthago = gc.getPlayer(iCarthago).getTeam() iTeamMessana = gc.getPlayer(iMessana).getTeam() pTeamMessana = gc.getTeam(iTeamMessana) if pTeamMessana.isVassal(iTeamCarthago) and gc.getTeam( gc.getPlayer(iCarthago)).isAtWar(gc.getPlayer(iRome)): # Plot für die Einheiten Landungsplot = CyMap().plot(19, 46) if iPlayer == iCarthago: # Einheiten erstellen LNewUnits = [ gc.getInfoTypeForString("UNIT_HORSEMAN_NUMIDIA") ] for i in LNewUnits: for _ in range(4): pUnit = gc.getPlayer(iMessana).initUnit( i, Landungsplot.getX(), Landungsplot.getY(), UnitAITypes.UNITAI_ATTACK, DirectionTypes.DIRECTION_SOUTH) pUnit.setExperience(2, -1) # Meldung an den Spieler popupInfo = CyPopupInfo() popupInfo.setButtonPopupType(ButtonPopupTypes.BUTTONPOPUP_TEXT) popupInfo.setText(CyTranslator().getText( "TXT_KEY_MESSAGE_2NDPUNICWAR_12", ("", ))) popupInfo.addPopup(iPlayer) CyCamera().JustLookAtPlot(Landungsplot) # Hannibal erobert Tarent # Tarent wird barbarisch # Bedinung: Tarent = römisch + Rom u. Karthago im Krieg if iGameTurn == 90: if iPlayer == iRome: pPlot = CyMap().plot(62, 53) if pPlot.getOwner() == iRome and gc.getTeam( gc.getPlayer(iRome)).isAtWar(gc.getPlayer(iCarthago)): # Stadt wird barbarisch + Einheiten PAE_City.doRenegadeCity(pPlot.getPlotCity(), gc.getBARBARIAN_PLAYER(), None) LNewUnits = [ gc.getInfoTypeForString("UNIT_REBELL"), gc.getInfoTypeForString("UNIT_REFLEX_ARCHER"), gc.getInfoTypeForString("UNIT_HOPLIT") ] for i in LNewUnits: pUnit = gc.getPlayer(gc.getBARBARIAN_PLAYER()).initUnit( i, pPlot.getX(), pPlot.getY(), UnitAITypes.UNITAI_CITY_DEFENSE, DirectionTypes.DIRECTION_SOUTH) pUnit.setExperience(2, -1) pUnit.setHasPromotion( gc.getInfoTypeForString("PROMOTION_CITY_GARRISON1"), True) # Meldung an den Spieler popupInfo = CyPopupInfo() popupInfo.setButtonPopupType(ButtonPopupTypes.BUTTONPOPUP_TEXT) popupInfo.setText(CyTranslator().getText( "TXT_KEY_MESSAGE_2NDPUNICWAR_13", ("", ))) popupInfo.addPopup(iPlayer) CyCamera().JustLookAtPlot(pPlot) # Unruhen in Rom if iGameTurn == 110: if iPlayer == iRome: pCity = gc.getPlayer(iPlayer).getCapitalCity() PAE_City.doCityRevolt(pCity, 4) # Meldung an den Spieler popupInfo = CyPopupInfo() popupInfo.setButtonPopupType(ButtonPopupTypes.BUTTONPOPUP_TEXT) popupInfo.setText(CyTranslator().getText( "TXT_KEY_MESSAGE_2NDPUNICWAR_14", ("", ))) popupInfo.addPopup(iPlayer) CyCamera().JustLookAtPlot(pCity.plot()) # Schlacht von Neu-Karthago, Römer greifen Stadt an # röm. Schiffe + Einheiten bei Neu-Karthago (Plot: 19,46) # Bedingung: Neu-Karthago = karth. + Rom und Karthago im Krieg if iGameTurn == 125: if iPlayer == iCarthago: pPlot = CyMap().plot(19, 46) # TXT_KEY_CITY_NAME_CARTHAGO_NOVO if pPlot.getOwner() == iCarthago and gc.getTeam( gc.getPlayer(iCarthago)).isAtWar(gc.getPlayer(iRome)): # Plot für die Landungseinheiten lPlots = [ CyMap().plot(18, 45), CyMap().plot(19, 45), CyMap().plot(19, 47) ] Landungsplot = getRandomPlot(lPlots) # Plot für die Schiffe lPlots = [ CyMap().plot(20, 45), CyMap().plot(20, 46), CyMap().plot(20, 47) ] Schiffsplot = getRandomPlot(lPlots) # Schiffe erstellen LNewUnits = [ gc.getInfoTypeForString("UNIT_QUADRIREME"), gc.getInfoTypeForString("UNIT_TRIREME") ] for i in LNewUnits: for _ in range(2): pUnit = gc.getPlayer(iRome).initUnit( i, Schiffsplot.getX(), Schiffsplot.getY(), UnitAITypes.UNITAI_ASSAULT_SEA, DirectionTypes.DIRECTION_SOUTH) pUnit.setExperience(2, -1) pUnit.setHasPromotion( gc.getInfoTypeForString("PROMOTION_COMBAT1"), True) pUnit.setHasPromotion( gc.getInfoTypeForString("PROMOTION_CORVUS1"), True) # Einheiten erstellen LNewUnits = [ gc.getInfoTypeForString("UNIT_TRIARII"), gc.getInfoTypeForString("UNIT_PRINCIPES"), gc.getInfoTypeForString("UNIT_PRINCIPES"), gc.getInfoTypeForString("UNIT_HASTATI"), gc.getInfoTypeForString("UNIT_HASTATI"), gc.getInfoTypeForString("UNIT_SKIRMISHER_ROME"), gc.getInfoTypeForString("UNIT_SKIRMISHER_ROME") ] for i in LNewUnits: pUnit = gc.getPlayer(iRome).initUnit( i, Landungsplot.getX(), Landungsplot.getY(), UnitAITypes.UNITAI_ATTACK, DirectionTypes.DIRECTION_SOUTH) pUnit.setExperience(2, -1) pUnit = gc.getPlayer(iRome).initUnit( gc.getInfoTypeForString("UNIT_LEGION_TRIBUN"), Landungsplot.getX(), Landungsplot.getY(), UnitAITypes.UNITAI_ATTACK, DirectionTypes.DIRECTION_SOUTH) pUnit.setExperience(2, -1) pUnit.setHasPromotion( gc.getInfoTypeForString("PROMOTION_COMBAT1"), True) pUnit.setName("Publius Cornelius Scipio") # Meldung an den Spieler popupInfo = CyPopupInfo() popupInfo.setButtonPopupType(ButtonPopupTypes.BUTTONPOPUP_TEXT) popupInfo.setText(CyTranslator().getText( "TXT_KEY_MESSAGE_2NDPUNICWAR_15", ("", ))) popupInfo.addPopup(iPlayer) CyCamera().JustLookAtPlot(Landungsplot) # Schlacht am Metaurus (Ost-Italien) Hasdrubal Barca # karthag. Einheiten in Italien # Stadt (Ariminum) = römisch + Rom und Karthago im Krieg if iGameTurn == 150: if iPlayer == iRome: pPlot = CyMap().plot(54, 62) # Florentia if pPlot.getOwner() == iRome and gc.getTeam( gc.getPlayer(iRome)).isAtWar(gc.getPlayer(iCarthago)): # Plot für die Landungseinheiten lPlots = [ CyMap().plot(55, 64), CyMap().plot(54, 64), CyMap().plot(55, 63) ] Landungsplot = getRandomPlot(lPlots) # Einheiten erstellen LNewUnits = [ gc.getInfoTypeForString("UNIT_CARTH_SACRED_BAND_OFFICER"), gc.getInfoTypeForString("UNIT_SPEARMAN_CARTHAGE"), gc.getInfoTypeForString("UNIT_SPEARMAN_CARTHAGE"), gc.getInfoTypeForString("UNIT_SCHILDTRAEGER_IBERIA"), gc.getInfoTypeForString("UNIT_SCHILDTRAEGER_IBERIA"), gc.getInfoTypeForString("UNIT_CELTIC_GALLIC_WARRIOR"), gc.getInfoTypeForString("UNIT_CELTIC_GALLIC_WARRIOR") ] for i in LNewUnits: pUnit = gc.getPlayer(iCarthago).initUnit( i, Landungsplot.getX(), Landungsplot.getY(), UnitAITypes.UNITAI_ATTACK, DirectionTypes.DIRECTION_SOUTH) pUnit.setExperience(2, -1) pUnit.setHasPromotion( gc.getInfoTypeForString("PROMOTION_COMBAT1"), True) pUnit.setHasPromotion( gc.getInfoTypeForString("PROMOTION_COMBAT2"), True) pUnit = gc.getPlayer(iCarthago).initUnit( gc.getInfoTypeForString( "UNIT_MOUNTED_SACRED_BAND_CARTHAGE"), Landungsplot.getX(), Landungsplot.getY(), UnitAITypes.UNITAI_ATTACK, DirectionTypes.DIRECTION_SOUTH) pUnit.setExperience(2, -1) pUnit.setHasPromotion( gc.getInfoTypeForString("PROMOTION_COMBAT1"), True) pUnit.setHasPromotion( gc.getInfoTypeForString("PROMOTION_COMBAT2"), True) pUnit.setHasPromotion( gc.getInfoTypeForString("PROMOTION_LEADER"), True) pUnit.setHasPromotion( gc.getInfoTypeForString("PROMOTION_LEADERSHIP"), True) pUnit.setHasPromotion( gc.getInfoTypeForString("PROMOTION_FLANKING1"), True) pUnit.setHasPromotion( gc.getInfoTypeForString("PROMOTION_FORM_FLANKENSCHUTZ"), True) pUnit.setName("Hasdrubal Barca") # Meldung an den Spieler popupInfo = CyPopupInfo() popupInfo.setButtonPopupType(ButtonPopupTypes.BUTTONPOPUP_TEXT) popupInfo.setText(CyTranslator().getText( "TXT_KEY_MESSAGE_2NDPUNICWAR_17", ("", ))) popupInfo.addPopup(iPlayer) CyCamera().JustLookAtPlot(Landungsplot) # Rom landet in Afrika bei Utica if iGameTurn == 183: if iPlayer == iCarthago and not gc.getPlayer(iRome).isHuman(): if gc.getTeam(gc.getPlayer(iCarthago)).isAtWar( gc.getPlayer(iRome)): # Plot für die Landungseinheiten lPlots = [ CyMap().plot(40, 40), CyMap().plot(41, 40), CyMap().plot(41, 41) ] Landungsplot = getRandomPlot(lPlots) # Plot für die Schiffe lPlots = [ CyMap().plot(40, 42), CyMap().plot(41, 42), CyMap().plot(42, 42) ] Schiffsplot = getRandomPlot(lPlots) # Schiffe erstellen LNewUnits = [ gc.getInfoTypeForString("UNIT_QUADRIREME"), gc.getInfoTypeForString("UNIT_TRIREME") ] for i in LNewUnits: for _ in range(2): pUnit = gc.getPlayer(iRome).initUnit( i, Schiffsplot.getX(), Schiffsplot.getY(), UnitAITypes.UNITAI_ASSAULT_SEA, DirectionTypes.DIRECTION_SOUTH) pUnit.setExperience(2, -1) pUnit.setHasPromotion( gc.getInfoTypeForString("PROMOTION_COMBAT1"), True) pUnit.setHasPromotion( gc.getInfoTypeForString("PROMOTION_CORVUS1"), True) # Einheiten erstellen LNewUnits = [ gc.getInfoTypeForString("UNIT_TRIARII"), gc.getInfoTypeForString("UNIT_PRINCIPES"), gc.getInfoTypeForString("UNIT_PRINCIPES"), gc.getInfoTypeForString("UNIT_HASTATI"), gc.getInfoTypeForString("UNIT_HASTATI"), gc.getInfoTypeForString("UNIT_SKIRMISHER_ROME"), gc.getInfoTypeForString("UNIT_SKIRMISHER_ROME") ] for i in LNewUnits: pUnit = gc.getPlayer(iRome).initUnit( i, Landungsplot.getX(), Landungsplot.getY(), UnitAITypes.UNITAI_ATTACK, DirectionTypes.DIRECTION_SOUTH) pUnit.setExperience(2, -1) pUnit.setHasPromotion( gc.getInfoTypeForString("PROMOTION_COMBAT1"), True) # Meldung an den Spieler popupInfo = CyPopupInfo() popupInfo.setButtonPopupType(ButtonPopupTypes.BUTTONPOPUP_TEXT) popupInfo.setText(CyTranslator().getText( "TXT_KEY_MESSAGE_2NDPUNICWAR_20", ("", ))) popupInfo.addPopup(iPlayer) CyCamera().JustLookAtPlot(Landungsplot)
def doOlympicGames(): # wurde das Projekt erstellt? if gc.getGame().getProjectCreatedCount(gc.getInfoTypeForString("PROJECT_OLYMPIC_GAMES")) == 0: return # alle 4 Runden if gc.getGame().getCalendar() == gc.getInfoTypeForString("CALENDAR_MONTHS"): iTurns = 48 elif gc.getGame().getCalendar() == gc.getInfoTypeForString("CALENDAR_SEASONS"): iTurns = 16 else: iTurns = 4 if gc.getGame().getElapsedGameTurns() % iTurns == 1: # Inits lCities4Olympiade = [] lHumans = [] lPlayers = [] iTechSchaukampf = gc.getInfoTypeForString("TECH_GLADIATOR") iTechImperialismus = gc.getInfoTypeForString("TECH_NATIONALISM") iTechPapsttum = gc.getInfoTypeForString("TECH_PAPSTTUM") iReligionGreek = gc.getInfoTypeForString("RELIGION_GREEK") iReligionRome = gc.getInfoTypeForString("RELIGION_ROME") iBuildingStadion = gc.getInfoTypeForString("BUILDING_STADION") iBuildingClassStadion = gc.getInfoTypeForString("BUILDINGCLASS_STADION") iBuildingOlympionike = gc.getInfoTypeForString("BUILDING_OLYMPIONIKE") iBuildingClassGymnasion = gc.getInfoTypeForString("BUILDINGCLASS_SPECIAL3") # Los gehts iNumPlayers = gc.getMAX_PLAYERS() for iPlayer in xrange (iNumPlayers): pPlayer = gc.getPlayer(iPlayer) if pPlayer and not pPlayer.isNone() and pPlayer.isAlive(): # and not pPlayer.isBarbarian(): # Hat der Spieler noch nicht Schaukampf erforscht, isser nicht dabei if not gc.getTeam(pPlayer.getTeam()).isHasTech(iTechSchaukampf): continue # Hat der Spieler bereits das Papsttum erforscht, is der Spass vorbei if gc.getTeam(pPlayer.getTeam()).isHasTech(iTechPapsttum): continue # Hat der Spieler Imperialismus erforscht? bAllowRomanGods = False if gc.getTeam(pPlayer.getTeam()).isHasTech(iTechImperialismus): bAllowRomanGods = True # Init des Spezialgebäudes Gymnasion, Gymnasium iBuildingGymnasion = gc.getCivilizationInfo(pPlayer.getCivilizationType()).getCivilizationBuildings(iBuildingClassGymnasion) # Cities iNumCities = pPlayer.getNumCities() for iCity in xrange (iNumCities): pCity = pPlayer.getCity(iCity) if pCity and not pCity.isNone(): # Aktuellen Olympioniken rausschmeissen pCity.setNumRealBuilding(iBuildingOlympionike,0) # Hat die Stadt die richtige Religion? if pCity.isHasReligion(iReligionGreek) or bAllowRomanGods and pCity.isHasReligion(iReligionRome): # Liste für Spielermeldungen if pPlayer.isHuman() and iPlayer not in lHumans: lHumans.append(iPlayer) # Liste verschiedener CIVs if iPlayer not in lPlayers: lPlayers.append(iPlayer) # Stadt an den Spielen zulassen lCities4Olympiade.append(pCity) # Verbesserte Chancen: if pCity.isHasBuilding(iBuildingStadion): lCities4Olympiade.append(pCity) if pCity.isHasBuilding(iBuildingGymnasion): lCities4Olympiade.append(pCity) # Choose new Olympic Winner City # erst ab 2 CIVs if len(lPlayers) <= 1: return iRand = CvUtil.myRandom(len(lCities4Olympiade), "CityOfOlympiadWinner") pCity = lCities4Olympiade[iRand] # Olympionike in die Stadt stellen pCity.setNumRealBuilding(iBuildingOlympionike,1) # Stadion verbessern +1 Kultur if pCity.isHasBuilding(iBuildingStadion): iCulture = pCity.getBuildingCommerceChange(iBuildingClassStadion, CommerceTypes.COMMERCE_CULTURE) + 1 pCity.setBuildingCommerceChange(iBuildingClassStadion, CommerceTypes.COMMERCE_CULTURE, iCulture) # Goldkarren erzeugen CvUtil.spawnUnit(gc.getInfoTypeForString("UNIT_GOLDKARREN"), pCity.plot(), gc.getPlayer(pCity.getOwner())) CvUtil.spawnUnit(gc.getInfoTypeForString("UNIT_GOLDKARREN"), pCity.plot(), gc.getPlayer(pCity.getOwner())) # einen weiteren bei Seasons if iTurns >= 16: CvUtil.spawnUnit(gc.getInfoTypeForString("UNIT_GOLDKARREN"), pCity.plot(), gc.getPlayer(pCity.getOwner())) # zwei weitere bei Months (insg. 5) if iTurns > 16: CvUtil.spawnUnit(gc.getInfoTypeForString("UNIT_GOLDKARREN"), pCity.plot(), gc.getPlayer(pCity.getOwner())) CvUtil.spawnUnit(gc.getInfoTypeForString("UNIT_GOLDKARREN"), pCity.plot(), gc.getPlayer(pCity.getOwner())) # Chance eines beladenen Fuhrwerks if CvUtil.myRandom(4, "Olympia_ChanceOfBonus") == 1: pNewUnit = CvUtil.spawnUnit(gc.getInfoTypeForString("UNIT_SUPPLY_FOOD"), pCity.plot(), gc.getPlayer(pCity.getOwner())) lBonuses = [ gc.getInfoTypeForString("BONUS_OLIVES"), gc.getInfoTypeForString("BONUS_OLIVES"), gc.getInfoTypeForString("BONUS_OLIVES"), gc.getInfoTypeForString("BONUS_OLIVES"), gc.getInfoTypeForString("BONUS_OLIVES"), gc.getInfoTypeForString("BONUS_GRAPES"), gc.getInfoTypeForString("BONUS_GRAPES"), gc.getInfoTypeForString("BONUS_GRAPES"), gc.getInfoTypeForString("BONUS_ROGGEN"), gc.getInfoTypeForString("BONUS_HAFER"), gc.getInfoTypeForString("BONUS_GERSTE"), gc.getInfoTypeForString("BONUS_WHEAT"), gc.getInfoTypeForString("BONUS_HIRSE"), gc.getInfoTypeForString("BONUS_HORSE") ] eBonus = CvUtil.myRandom(len(lBonuses), "Olympia_BonusType") eBonus = lBonuses[eBonus] CvUtil.addScriptData(pNewUnit, "b", eBonus) # Meldung an alle beteiligten Spieler for iPlayer in lHumans: xSound = None iColor = 14 # graublau bShow = False # Extra PopUp wenn HI der Gewinner ist if iPlayer == pCity.getOwner(): xSound = "AS2D_WELOVEKING" iColor = 10 # cyan bShow = True popupInfo = CyPopupInfo() popupInfo.setButtonPopupType(ButtonPopupTypes.BUTTONPOPUP_TEXT) sText = CyTranslator().getText("TXT_KEY_INFO_OLYMPIC_GAMES_WINNER", (pCity.getName(),gc.getPlayer(pCity.getOwner()).getCivilizationShortDescription(0))) popupInfo.setText(sText) popupInfo.addPopup(iPlayer) # Ingame Text CyInterface().addMessage(iPlayer, True, 15, CyTranslator().getText("TXT_KEY_INFO_OLYMPIC_GAMES_WINNER", (pCity.getName(),gc.getPlayer(pCity.getOwner()).getCivilizationShortDescription(0))), xSound, 2, "Art/Interface/Buttons/Buildings/button_building_olympionike.dds", ColorTypes(iColor), pCity.plot().getX(), pCity.plot().getY(), bShow, bShow)
def doRevoltAnarchy(iPlayer): pPlayer = gc.getPlayer(iPlayer) iRand = CvUtil.myRandom(3, "getAnarchyTurns") if iRand == 1: iBuilding = gc.getInfoTypeForString("BUILDING_PLAGUE") iNumCities = pPlayer.getNumCities() if iNumCities == 0: return iCityPlague = 0 iCityRevolt = 0 (loopCity, pIter) = pPlayer.firstCity(False) while loopCity: if not loopCity.isNone() and loopCity.getOwner() == iPlayer: #only valid cities if loopCity.isHasBuilding(iBuilding): iCityPlague += 1 if loopCity.getOccupationTimer() > 1: # Flunky: changed 0->1, because the counter is not yet updated from the previous round. iCityRevolt += 1 (loopCity, pIter) = pPlayer.nextCity(pIter, False) if iCityRevolt > 1 and iNumCities <= iCityRevolt * 2: pPlayer.changeAnarchyTurns(3) if pPlayer.isHuman(): popupInfo = CyPopupInfo() popupInfo.setButtonPopupType(ButtonPopupTypes.BUTTONPOPUP_TEXT) popupInfo.setText(CyTranslator().getText("TXT_KEY_MESSAGE_PLAYER_ANARCHY_FROM_REVOLTS", ("", ))) popupInfo.addPopup(iPlayer) elif iNumCities <= iCityPlague * 2: pPlayer.changeAnarchyTurns(2) if pPlayer.isHuman(): popupInfo = CyPopupInfo() popupInfo.setButtonPopupType(ButtonPopupTypes.BUTTONPOPUP_TEXT) popupInfo.setText(CyTranslator().getText("TXT_KEY_MESSAGE_PLAYER_ANARCHY_FROM_PLAGUE", ("", ))) popupInfo.addPopup(iPlayer)