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)
Example #2
0
def doOnUnitMove(pUnit, pPlot, pOldPlot):
    # Seevoelkereinheit wird entladen, leere Seevoelkerschiffe werden gekillt
    if pUnit.getUnitType() == gc.getInfoTypeForString("UNIT_SEEVOLK"):
        if not pUnit.hasCargo():
            # COMMAND_DELETE can cause CtD if used in onUnitMove()
            # pUnit.doCommand(CommandTypes.COMMAND_DELETE, 1, 1)
            pUnit.kill(True, -1)
            return True
        else:
            if pOldPlot.getOwner() == -1 and pPlot.getOwner() != -1:
                if gc.getPlayer(pPlot.getOwner()).isHuman():
                    CyInterface().addMessage(
                        pPlot.getOwner(), True, 15,
                        CyTranslator().getText("TXT_KEY_MESSAGE_SEEVOLK_ALERT",
                                               ()), None, 2, pUnit.getButton(),
                        ColorTypes(7), pPlot.getX(), pPlot.getY(), True, True)
                if pPlot.getOwner() == gc.getGame().getActivePlayer():
                    CyAudioGame().Play2DSound("AS2D_THEIRDECLAREWAR")

    # Barbarische Tiere sollen keine Stadt betreten / Barbarian animals will be disbanded when moving into a city
    elif pUnit.getUnitAIType() == UnitAITypes.UNITAI_ANIMAL:
        if pPlot.isCity():
            pUnit.kill(True, -1)
            return True
    # Barbarische Emigranten stehen nur rum und benoetigen unnoetig Rechenzeit
    elif pUnit.getUnitType() == gc.getInfoTypeForString("UNIT_EMIGRANT"):
        pUnit.kill(True, -1)
        return True
    # Barbarische befreite Sklaven stehen nur rum und benoetigen unnoetig Rechenzeit
    elif pUnit.getUnitType() == gc.getInfoTypeForString("UNIT_FREED_SLAVE"):
        pUnit.kill(True, -1)
        return True

    return False
def convertCity(pCity):
	iReligion = gc.getInfoTypeForString("RELIGION_CHRISTIANITY")
	iPlayer = pCity.getOwner()
	pPlayer = gc.getPlayer(iPlayer)

	# nicht bei Judentum, Hindu, Buddh und Jain
	if (not pCity.isHasReligion(gc.getInfoTypeForString("RELIGION_JUDAISM"))
			and not pCity.isHasReligion(gc.getInfoTypeForString("RELIGION_HINDUISM"))
			and not pCity.isHasReligion(gc.getInfoTypeForString("RELIGION_BUDDHISM"))
			and not pCity.isHasReligion(gc.getInfoTypeForString("RELIGION_JAINISMUS"))):

		if pCity.isCapital():
			iChance = 40 # 2.5%
		elif pCity.isHasBuilding(gc.getInfoTypeForString("BUILDING_STADT")):
			if pCity.isHasBuilding(gc.getInfoTypeForString("BUILDING_SKLAVENMARKT")):
				iChance = 30 # 3%
			else:
				iChance = 50 # 2%
		elif pCity.isHasBuilding(gc.getInfoTypeForString("BUILDING_SKLAVENMARKT")):
			iChance = 40 # 2.5%
		else:
			iChance = 75 # 1.5%

		# bei folgenden Civics Chance verringern
		if pPlayer.isCivic(gc.getInfoTypeForString("CIVIC_THEOCRACY")):
			iChance += 25
		if pPlayer.isCivic(gc.getInfoTypeForString("CIVIC_AMPHIKTIONIE")):
			iChance += 25

		if CvUtil.myRandom(iChance, "convertCity") == 1:
			pCity.setHasReligion(iReligion, 1, 1, 0)
			if pPlayer.isHuman():
				iRand = 1 + CvUtil.myRandom(3, "TXT_KEY_MESSAGE_HERESY_2CHRIST_")
				CyInterface().addMessage(iPlayer, True, 10, CyTranslator().getText("TXT_KEY_MESSAGE_HERESY_2CHRIST_"+str(iRand),(pCity.getName(),0)), None, 2,"Art/Interface/Buttons/Actions/button_kreuz.dds", ColorTypes(11), pCity.getX(), pCity.getY(), True, True)
def doHistory():
	"""++++++++++++++++++ Historische Texte ++++++++++++++++++++++++++++++++++++++++++++++"""
	iGameYear = gc.getGame().getGameTurnYear()
	# txts = 0
	if iGameYear in lNumHistoryTexts:
		txts = lNumHistoryTexts[iGameYear]
	# if txts > 0:
		iRand = CvUtil.myRandom(txts, "doHistory")

		# iRand 0 bedeutet keinen Text anzeigen. Bei mehr als 2 Texte immer einen einblenden
		if txts > 2:
			iRand += 1

		if iRand > 0:
			text = "TXT_KEY_HISTORY_"
			if iGameYear < 0:
				text = text + str(iGameYear * (-1)) + "BC_" + str(iRand)
			else:
				text = text + str(iGameYear) + "AD_" + str(iRand)

			text = CyTranslator().getText("TXT_KEY_HISTORY", ("",)) + " " + CyTranslator().getText(text, ("",))
			CyInterface().addMessage(gc.getGame().getActivePlayer(), True, 15, text, None, 2, None, ColorTypes(14), 0, 0, False, False)
class AbstractAlert(object):
    """Provides a base class and several convenience functions for 
	implementing an alert.

	"""

    gc = CyGlobalContext()

    localText = CyTranslator()

    #config = CvConfigParser.CvConfigParser("Civ IV Gameplay Enhancements Config.ini")

    def __init__(self, eventManager, *args, **kwargs):
        super(AbstractAlert, self).__init__(*args, **kwargs)
def doStrandgut():
	iBarbPlayer = gc.getBARBARIAN_PLAYER()
	pBarbPlayer = gc.getPlayer(iBarbPlayer)
	iTreibgut = gc.getInfoTypeForString("UNIT_TREIBGUT")
	iStrandgut = gc.getInfoTypeForString("UNIT_STRANDGUT")
	iGoldkarren = gc.getInfoTypeForString("UNIT_GOLDKARREN")
	iDarkIce = gc.getInfoTypeForString("FEATURE_DARK_ICE")
	eCoast = gc.getInfoTypeForString("TERRAIN_COAST")

	lUnits = PyPlayer(iBarbPlayer).getUnitsOfType(iTreibgut)
	# CyInterface().addMessage(gc.getGame().getActivePlayer(), True, 15, CyTranslator().getText("TXT_KEY_MESSAGE_TEST", ("Test",len(lUnits))), None, 2, None, ColorTypes(11), 0, 0, False, False)
	for loopUnit in lUnits:
		pPlot = loopUnit.plot()
		if pPlot.getTerrainType() == eCoast:
			lPlots = []
			iX = pPlot.getX()
			iY = pPlot.getY()
			# iRange = 1
			for iI in xrange(DirectionTypes.NUM_DIRECTION_TYPES):
				loopPlot = plotDirection(iX, iY, DirectionTypes(iI))
				if loopPlot and not loopPlot.isNone():
					if not loopPlot.isWater():
						if not loopPlot.isPeak() and not loopPlot.isUnit() and loopPlot.getFeatureType() != iDarkIce:
							lPlots.append(loopPlot)
			if lPlots:
				pPlot = lPlots[CvUtil.myRandom(len(lPlots), "strandgut")]
				# Create Strandgut
				CvUtil.spawnUnit(iStrandgut, pPlot, pBarbPlayer)
				iPlotOwner = pPlot.getOwner()
				if iPlotOwner != -1 and gc.getPlayer(iPlotOwner).isHuman():
					CyInterface().addMessage(iPlotOwner, True, 15, CyTranslator().getText("TXT_KEY_TREIB2STRANDGUT", ()), None, 2, "Art/Interface/Buttons/Units/button_unit_strandgut.dds", ColorTypes(11), pPlot.getX(), pPlot.getY(), True, True)
				# Disband Treibgut
				# loopUnit.doCommand(CommandTypes.COMMAND_DELETE, -1, -1)
				loopUnit.kill(True, -1)  # RAMK_CTD
		elif pPlot.isCity():
			# Create Goldkarren
			CvUtil.spawnUnit(iGoldkarren, pPlot, pBarbPlayer)
			# Disband Treibgut
			# CyInterface().addMessage(gc.getGame().getActivePlayer(), True, 15, CyTranslator().getText("disbandTreibgutCity", ()), None, 2, None, ColorTypes(11), pPlot.getX(), pPlot.getY(), False, False)
			# loopUnit.doCommand(CommandTypes.COMMAND_DELETE, -1, -1)
			loopUnit.kill(True, -1)  # RAMK_CTD
Example #7
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")
Example #8
0
class AbstractAlert(object):
    """Provides a base class and several convenience functions for 
    implementing an alert.

    """

    gc = CyGlobalContext()

    localText = CyTranslator()

    def __init__(self, eventManager, *args, **kwargs):
        super(AbstractAlert, self).__init__(*args, **kwargs)

    def _addMessageNoIcon(self, player, message):
        """Displays an on-screen message with no popup icon."""
        self._addMessage(player, message, None, 0, 0)

    def _addMessageAtCity(self, player, message, icon, city):
        """Displays an on-screen message with a popup icon that zooms
        to the given city.

        """
        self._addMessage(player, message, icon, city.getX(), city.getY())

    def _addMessageAtPlot(self, player, message, icon, plot):
        """Displays an on-screen message with a popup icon that zooms
        to the given plot.
        
        """
        self._addMessage(player, message, icon, plot.getX(), plot.getY())

    def _addMessage(self, ePlayer, szString, szIcon, iFlashX, iFlashY):
        """Displays an on-screen message."""
        eventMessageTimeLong = self.gc.getDefineINT("EVENT_MESSAGE_TIME_LONG")
        CyInterface().addMessage(ePlayer, True, eventMessageTimeLong, szString,
                                 None, 0, szIcon, ColorTypes(-1), iFlashX,
                                 iFlashY, True, True)
Example #9
0
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)
Example #10
0
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")
Example #11
0
def createCampUnit(iPlayer, iGameTurn):
    pPlayer = gc.getPlayer(iPlayer)
    if not pPlayer.isAlive(): return

    iTeam = pPlayer.getTeam()
    pTeam = gc.getTeam(iTeam)
    #eCiv = gc.getCivilizationInfo(pPlayer.getCivilizationType())

    if pPlayer.getUnitClassCount(
            gc.getInfoTypeForString("UNITCLASS_SPECIAL1")) > 0:
        # Terrain
        #eTundra = gc.getInfoTypeForString("TERRAIN_TUNDRA")
        #eGras = gc.getInfoTypeForString("TERRAIN_GRASS")
        #eEbene = gc.getInfoTypeForString("TERRAIN_PLAINS")
        eDesert = gc.getInfoTypeForString("TERRAIN_DESERT")
        # Feature
        #eDichterWald = gc.getInfoTypeForString("FEATURE_DICHTERWALD")

        eCamp = gc.getInfoTypeForString("UNIT_CAMP")

        lCamps = PyPlayer(pPlayer.getID()).getUnitsOfType(eCamp)
        for pUnit in lCamps:
            if pUnit is not None and not pUnit.isNone():
                #pUnit.NotifyEntity(MissionTypes.MISSION_FOUND)
                if pUnit.getFortifyTurns() == 0: return

                bCreateUnit = False
                iFortified = CvUtil.getScriptData(pUnit, ["f"], -1)

                if iFortified == -1:
                    CvUtil.addScriptData(pUnit, "f", iGameTurn)
                elif (iGameTurn - iFortified) % 5 == 0:
                    bCreateUnit = True

                if bCreateUnit:
                    pPlot = pUnit.plot()
                    lUnits = []

                    # Not on hills (for HI)
                    if pPlayer.isHuman() and pPlot.isHills():
                        CyInterface().addMessage(
                            iPlayer, True, 10,
                            CyTranslator().getText("TXT_KEY_HELP_NOCAMPUNIT",
                                                   ("", )), None, 2,
                            "Art/Interface/Buttons/General/button_alert_new.dds",
                            ColorTypes(11), pPlot.getX(), pPlot.getY(), True,
                            True)
                        return

                    # Desert
                    if pPlot.getTerrainType() == eDesert:
                        if pPlayer.canTrain(
                                gc.getInfoTypeForString(
                                    "UNIT_ARABIA_CAMELARCHER"), 0, 0):
                            lUnits.append(
                                gc.getInfoTypeForString(
                                    "UNIT_ARABIA_CAMELARCHER"))
                        if pPlayer.canTrain(
                                gc.getInfoTypeForString(
                                    "UNIT_CAMEL_CATAPHRACT"), 0, 0):
                            lUnits.append(
                                gc.getInfoTypeForString(
                                    "UNIT_CAMEL_CATAPHRACT"))

                    # Open terrain (primary Mounted only)
                    if not lUnits and pPlot.getFeatureType() == -1:
                        if pPlayer.canTrain(
                                gc.getInfoTypeForString("UNIT_MONGOL_KESHIK"),
                                0, 0):
                            lUnits.append(
                                gc.getInfoTypeForString("UNIT_MONGOL_KESHIK"))
                        if pPlayer.canTrain(
                                gc.getInfoTypeForString("UNIT_CATAPHRACT"), 0,
                                0):
                            lUnits.append(
                                gc.getInfoTypeForString("UNIT_CATAPHRACT"))
                        if pPlayer.canTrain(
                                gc.getInfoTypeForString("UNIT_HORSE_ARCHER"),
                                0, 0):
                            lUnits.append(
                                gc.getInfoTypeForString("UNIT_HORSE_ARCHER"))

                        if not lUnits and pPlayer.canTrain(
                                gc.getInfoTypeForString("UNIT_HORSEMAN"), 0,
                                0):
                            lUnits.append(
                                gc.getInfoTypeForString("UNIT_HORSEMAN"))

                    # On forests or if no mounted units available/constructable
                    if not lUnits:

                        if pPlayer.canTrain(
                                gc.getInfoTypeForString("UNIT_REFLEX_ARCHER"),
                                0, 0):
                            lUnits.append(
                                gc.getInfoTypeForString("UNIT_REFLEX_ARCHER"))
                        else:
                            lUnits.append(
                                gc.getInfoTypeForString(
                                    "UNIT_COMPOSITE_ARCHER"))

                        if pPlayer.canTrain(
                                gc.getInfoTypeForString("UNIT_SKIRMISHER"), 0,
                                0):
                            lUnits.append(
                                gc.getInfoTypeForString("UNIT_SKIRMISHER"))

                        if pPlayer.canTrain(
                                gc.getInfoTypeForString("UNIT_AXEMAN2"), 0, 0):
                            lUnits.append(
                                gc.getInfoTypeForString("UNIT_AXEMAN2"))

                        if pPlayer.canTrain(
                                gc.getInfoTypeForString("UNIT_SWORDSMAN"), 0,
                                0):
                            lUnits.append(
                                gc.getInfoTypeForString("UNIT_SWORDSMAN"))
                        elif pPlayer.canTrain(
                                gc.getInfoTypeForString("UNIT_SCHILDTRAEGER"),
                                0, 0):
                            lUnits.append(
                                gc.getInfoTypeForString("UNIT_SCHILDTRAEGER"))
                        else:
                            lUnits.append(
                                gc.getInfoTypeForString("UNIT_KURZSCHWERT"))

                        # standard unit
                        lUnits.append(gc.getInfoTypeForString("UNIT_SPEARMAN"))

                        iUnit = -1
                        if lUnits:
                            iUnit = lUnits[CvUtil.myRandom(
                                len(lUnits), "createCampUnit")]

                        # AI: Einheit autom, verkaufen (Soeldnerposten), falls Geldprobleme
                        if not pPlayer.isHuman() and (
                                pPlayer.AI_isFinancialTrouble()
                                or pTeam.getAtWarCount(True) == 0):
                            pPlayer.changeGold(25)
                        elif iUnit != -1:
                            # Einheit erstellen
                            CvUtil.spawnUnit(iUnit, pPlot, pPlayer)
def _riverErrorMsg(msg, argTuple=()):
	CyInterface().addMessage(gc.getGame().getActivePlayer(), True, 5,
							 CyTranslator().getText(msg, argTuple),
							 None, 2, None, ColorTypes(14), 0, 0,
							 False, False)
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 doPlotFeatures():

	iGameTurn = gc.getGame().getElapsedGameTurns()
	if iGameTurn < 5: return

	# Inits
	iBarbPlayer = gc.getBARBARIAN_PLAYER()
	pBarbPlayer = gc.getPlayer(iBarbPlayer)

	# Flotsam
	terrOzean = gc.getInfoTypeForString("TERRAIN_OCEAN")
	bFlot = gc.getTeam(pBarbPlayer.getTeam()).isHasTech(gc.getInfoTypeForString("TECH_RUDERER2"))

	# Barbaren improvements
	impBarbFort = gc.getInfoTypeForString("IMPROVEMENT_BARBARENFORT")
	impCave = gc.getInfoTypeForString("IMPROVEMENT_CAVE")
	impGoody = gc.getInfoTypeForString("IMPROVEMENT_GOODY_HUT")
	iBarbForts = 0
	iCaves = 0
	iGoodyHuts = 0

	# Animals
	bonus_lion = gc.getInfoTypeForString("BONUS_LION")
	bonus_horse = gc.getInfoTypeForString("BONUS_HORSE")
	bonus_camel = gc.getInfoTypeForString("BONUS_CAMEL")
	bonus_ivory = gc.getInfoTypeForString("BONUS_IVORY")
	bonus_dogs = gc.getInfoTypeForString("BONUS_HUNDE")
	bonus_deer = gc.getInfoTypeForString("BONUS_DEER")
	bonus_pig = gc.getInfoTypeForString("BONUS_PIG")
	# features
	iDarkIce = gc.getInfoTypeForString("FEATURE_DARK_ICE")
	iFeatBurned = gc.getInfoTypeForString("FEATURE_FOREST_BURNT")
	iFeatSeuche = gc.getInfoTypeForString("FEATURE_SEUCHE")
	iTerrDesert = gc.getInfoTypeForString("TERRAIN_DESERT")
	iTerrPlains = gc.getInfoTypeForString("TERRAIN_PLAINS")
	iTerrTundra = gc.getInfoTypeForString("TERRAIN_TUNDRA")
	iFeatForest = gc.getInfoTypeForString("FEATURE_FOREST")
	iFeatDenseForest = gc.getInfoTypeForString("FEATURE_DICHTERWALD")
	iFeatJungle = gc.getInfoTypeForString("FEATURE_JUNGLE")

	# Heuschrecken/Grasshopper
	iFeatGrasshopper = gc.getInfoTypeForString("FEATURE_GRASSHOPPER")
	# Desert Storm
	iFeatDesertstorm = gc.getInfoTypeForString("FEATURE_FALLOUT")
	lDesertStorm = []

	# Plots
	Ocean = []
	Desert = []
	Forest = []
	DenseForest = []
	Tundra = []
	Plains = []
	Jungle = []
	Hills = []
	#GoodyPlots = []

	# map
	iMapW = gc.getMap().getGridWidth()
	iMapH = gc.getMap().getGridHeight()

	for x in xrange(iMapW):
		for y in xrange(iMapH):
			loopPlot = gc.getMap().plot(x, y)
			if loopPlot and not loopPlot.isNone():

				iPlotFeature = loopPlot.getFeatureType()
				iPlotTerrain = loopPlot.getTerrainType()
				iPlotImprovement = loopPlot.getImprovementType()

				if iPlotFeature == iDarkIce:
					continue

				if iPlotFeature == iFeatGrasshopper:
					doMoveGrasshoppers(loopPlot)
					continue
				if iPlotFeature == iFeatDesertstorm:
					lDesertStorm.append(loopPlot)
					continue

				if loopPlot.getFeatureType() == iFeatBurned:
					if CvUtil.myRandom(50, "burntForest2Forest") == 1:
						loopPlot.setFeatureType(iFeatForest, 0)
					continue

				# isWater
				if loopPlot.isWater():

					# Treibgut nur alle 10 Runden erstellen (wenn aktiv)
					if bFlotsam and gc.getGame().getGameTurn() % 10 == 0:
						if bFlot and bGoodyHuts:
							if loopPlot.getOwner() == -1:
								if iPlotTerrain == terrOzean:
									if loopPlot.getNumUnits() > 0:
										Ocean.append(loopPlot)

				# isLand
				elif not loopPlot.isPeak():
					iPlotOwner = loopPlot.getOwner()
					# nur ausserhalb von Cities
					if not loopPlot.isCity():

						# Forts oder Handelsposten
						if iPlotImprovement in L.LImprFortShort:
							# Init
							iOwner = -1
							iOwner = int(CvUtil.getScriptData(loopPlot, ["p", "t"], loopPlot.getOwner()))
							# Handelsposten entfernen, wenn der Plot in einem fremden Kulturkreis liegt
							if iPlotImprovement == gc.getInfoTypeForString("IMPROVEMENT_HANDELSPOSTEN"):
								if iOwner != iPlotOwner and iPlotOwner != -1:
									loopPlot.setImprovementType(-1)
									if gc.getPlayer(iOwner).isHuman():
										szText = CyTranslator().getText("TXT_KEY_INFO_CLOSED_TRADEPOST", ("",))
										CyInterface().addMessage(iOwner, True, 15, szText, "AS2D_UNIT_BUILD_UNIT", 2, "Art/Interface/Buttons/General/button_alert_new.dds", ColorTypes(7), loopPlot.getX(), loopPlot.getY(), True, True)

								# Kultur setzen
								if iPlotOwner == -1:
									loopPlot.setCulture(iOwner, 1, True)
									loopPlot.setOwner(iOwner)
							# Kultur bei Forts
							#else:
							#  doCheckFortCulture(loopPlot)

							continue

						# Check nur alle x Runden (Tier-Spawn)
						if iGameTurn % 2 == 0:

							# Lion - 3% Appearance
							if loopPlot.getBonusType(-1) == bonus_lion and iPlotImprovement == -1:
								if loopPlot.getNumUnits() == 0:
									if CvUtil.myRandom(33, "lion") == 1:
										iUnitType = gc.getInfoTypeForString("UNIT_LION")
										pBarbPlayer.initUnit(iUnitType, x, y, UnitAITypes.UNITAI_ATTACK, DirectionTypes.DIRECTION_SOUTH)
										# ***TEST***
										#CyInterface().addMessage(gc.getGame().getActivePlayer(), True, 10, "Barb. Atlasloewe erschaffen", None, 2, None, ColorTypes(10), 0, 0, False, False)
										continue
							# Wolf - 3% Appearance
							elif loopPlot.getBonusType(iPlotOwner) == bonus_dogs and iPlotImprovement == -1:
								if loopPlot.getNumUnits() == 0:
									if CvUtil.myRandom(33, "wolf") == 1:
										iUnitType = gc.getInfoTypeForString("UNIT_WOLF")
										pBarbPlayer.initUnit(iUnitType, x, y, UnitAITypes.UNITAI_ATTACK, DirectionTypes.DIRECTION_SOUTH)
										continue
							# Deer - 3% Appearance
							elif loopPlot.getBonusType(-1) == bonus_deer and iPlotImprovement == -1:
								if loopPlot.getNumUnits() == 0:
									iRand = CvUtil.myRandom(33, "deer or bear")
									if iRand == 1:
										iUnitType = gc.getInfoTypeForString("UNIT_DEER")
										pBarbPlayer.initUnit(iUnitType, x, y, UnitAITypes.UNITAI_ATTACK, DirectionTypes.DIRECTION_SOUTH)
										continue
									elif iRand == 2:
										iUnitType = gc.getInfoTypeForString("UNIT_BEAR")
										pBarbPlayer.initUnit(iUnitType, x, y, UnitAITypes.UNITAI_ATTACK, DirectionTypes.DIRECTION_SOUTH)
										continue
							# Boar/Schwarzwild - 3% Appearance
							elif loopPlot.getBonusType(iPlotOwner) == bonus_pig and iPlotImprovement == -1:
								if loopPlot.getNumUnits() == 0:
									if CvUtil.myRandom(33, "boar") == 1:
										iUnitType = gc.getInfoTypeForString("UNIT_BOAR")
										pBarbPlayer.initUnit(iUnitType, x, y, UnitAITypes.UNITAI_ATTACK, DirectionTypes.DIRECTION_SOUTH)
										continue
							# Horse - 2% Appearance
							elif loopPlot.getBonusType(iPlotOwner) == bonus_horse:
								iUnitType = gc.getInfoTypeForString("UNIT_HORSE")
								#iUnitTypeDom = gc.getInfoTypeForString("UNIT_HORSE")
								iTechDom = gc.getInfoTypeForString("TECH_PFERDEZUCHT")
								sTextDom = "TXT_KEY_INFO_DOM_HORSE"
								if loopPlot.getNumUnits() == 0:
									if CvUtil.myRandom(50, "horse") == 1:
										# Check Owner
										iNewUnitOwner = iBarbPlayer
										if iPlotOwner != -1 and iPlotOwner != iBarbPlayer:
											if gc.getTeam(gc.getPlayer(iPlotOwner).getTeam()).isHasTech(iTechDom):
												iNewUnitOwner = iPlotOwner
												#iUnitType = iUnitTypeDom
											elif gc.getPlayer(iPlotOwner).isHuman():
												CyInterface().addMessage(iPlotOwner, True, 10, CyTranslator().getText(sTextDom, ("",)), None, 2, gc.getBonusInfo(bonus_horse).getButton(), ColorTypes(13), x, y, True, True)
										# Add Unit
										gc.getPlayer(iNewUnitOwner).initUnit(iUnitType, x, y, UnitAITypes.UNITAI_EXPLORE, DirectionTypes.DIRECTION_SOUTH)
										continue
							# Camel - 2% Appearance
							elif loopPlot.getBonusType(iPlotOwner) == bonus_camel:
								iUnitType = gc.getInfoTypeForString("UNIT_CAMEL")
								#iUnitTypeDom = gc.getInfoTypeForString("UNIT_CAMEL")
								iTechDom = gc.getInfoTypeForString("TECH_KAMELZUCHT")
								sTextDom = "TXT_KEY_INFO_DOM_CAMEL"
								if loopPlot.getNumUnits() == 0:
									if CvUtil.myRandom(50, "camel") == 1:
										# Check Owner
										iNewUnitOwner = iBarbPlayer
										if iPlotOwner != -1:
											if gc.getTeam(gc.getPlayer(iPlotOwner).getTeam()).isHasTech(iTechDom):
												iNewUnitOwner = iPlotOwner
												#iUnitType = iUnitTypeDom
											elif gc.getPlayer(iPlotOwner).isHuman():
												CyInterface().addMessage(iPlotOwner, True, 10, CyTranslator().getText(sTextDom, ("",)), None, 2, gc.getBonusInfo(bonus_camel).getButton(), ColorTypes(13), x, y, True, True)
										# Add Unit
										gc.getPlayer(iNewUnitOwner).initUnit(iUnitType, x, y, UnitAITypes.UNITAI_EXPLORE, DirectionTypes.DIRECTION_SOUTH)
										continue
							# Elefant - 2% Appearance (ab Eisenzeit)
							elif loopPlot.getBonusType(iPlotOwner) == bonus_ivory and pBarbPlayer.getCurrentEra() >= 2:
								iUnitType = gc.getInfoTypeForString("UNIT_ELEFANT")
								if loopPlot.getNumUnits() == 0:
									if CvUtil.myRandom(50, "ele") == 1:
										# Check Owner
										iNewUnitOwner = iBarbPlayer
										if iPlotOwner != -1:
											if gc.getTeam(gc.getPlayer(iPlotOwner).getTeam()).isHasTech(gc.getInfoTypeForString("TECH_ELEFANTENZUCHT")):
												iNewUnitOwner = iPlotOwner
											elif gc.getPlayer(iPlotOwner).isHuman():
												CyInterface().addMessage(iPlotOwner, True, 10, CyTranslator().getText("TXT_KEY_INFO_DOM_ELEFANT", ("",)), None, 2, gc.getBonusInfo(bonus_ivory).getButton(), ColorTypes(13), x, y, True, True)
										# Add Unit
										gc.getPlayer(iNewUnitOwner).initUnit(iUnitType, x, y, UnitAITypes.UNITAI_EXPLORE, DirectionTypes.DIRECTION_SOUTH)
										continue

						# Barbarenforts/festungen (erzeugt barbarische Einheiten alle x Runden)
						if iPlotImprovement == impBarbFort:
							iBarbForts += 1
							#if iPlotOwner == -1 or iPlotOwner == iBarbPlayer:
							if loopPlot.getNumUnits() == 0:
								# Verteidiger setzen
								PAE_Barbaren.setFortDefence(loopPlot)
							elif loopPlot.getNumUnits() > 4:
								iNum = loopPlot.getNumUnits() - 4
								for k in xrange(iNum):
									loopPlot.getUnit(k).kill(True, -1)
							elif pBarbPlayer.getCurrentEra() > 0:
								if bRageBarbs:
									iTurns = 5
								else:
									iTurns = 10
								if gc.getGame().getGameTurn() % iTurns == 0:
									iAnzUnits = PAE_Barbaren.countNearbyUnits(loopPlot, 2, iBarbPlayer)
									if iAnzUnits < 6:
										# Einheiten) setzen
										PAE_Barbaren.createBarbUnit(loopPlot)
							continue
						# Baerenhoehle
						elif iPlotImprovement == impCave:
							iCaves += 1
							#if loopPlot.getNumUnits() <= 1:
							if CvUtil.myRandom(15, "cave bear") == 1:
								if not PAE_Barbaren.checkNearbyUnits(loopPlot,3): # (Plot, Radius)
									setUnitIntoCave(loopPlot)
								continue
						# Goody huts
						elif iPlotImprovement == impGoody:
							iGoodyHuts += 1

						# Keine Seuche in Deserts
						if iPlotTerrain == iTerrDesert and iPlotFeature == iFeatSeuche:
							loopPlot.setFeatureType(-1,0)

						# leere Plots zwischenspeichern
						if iGameTurn > 150 and iGameTurn % 10 == 0:
							if iPlotOwner == -1:
								if loopPlot.getNumUnits() == 0 and not loopPlot.isActiveVisible(0):

									# Empty Plots for Animals and Barbs
									if iPlotTerrain == iTerrDesert:
										Desert.append(loopPlot)
									elif iPlotTerrain == iTerrTundra:
										Tundra.append(loopPlot)
									elif iPlotFeature == iFeatDenseForest:
										DenseForest.append(loopPlot)
									elif iPlotFeature == iFeatJungle:
										Jungle.append(loopPlot)
									elif iPlotFeature == iFeatForest:
										Forest.append(loopPlot)
									elif iPlotTerrain == iTerrPlains:
										Plains.append(loopPlot)
									if loopPlot.isHills():
										Hills.append(loopPlot)
				# end if - not isCity

	# Plots verarbeiten --------------------------------

	# Flotsam (if activated)
	if bFlotsam and bFlot and bGoodyHuts:
		if Ocean:
			if CvUtil.myRandom(33, "setFlotsam") == 1:
				iUnit = gc.getInfoTypeForString("UNIT_TREIBGUT")
				iNum = gc.getMap().getWorldSize() + 1
				for i in xrange(iNum):
					CvUtil.spawnUnit(iUnit, Ocean[CvUtil.myRandom(len(Ocean), "spawnFlotsam")], pBarbPlayer)

	# Tiere setzen --------------------
	if Desert:
		if CvUtil.myRandom(33, "setAnimals4Desert") == 1:
			setAnimals(gc.getInfoTypeForString("UNIT_CAMEL"),Desert)
			setAnimals(gc.getInfoTypeForString("UNIT_LION"),Desert)
			setAnimals(gc.getInfoTypeForString("UNIT_HYENA"),Desert)
	elif DenseForest:
		if CvUtil.myRandom(33, "setAnimals4DenseForest") == 1:
			setAnimals(gc.getInfoTypeForString("UNIT_WOLF"),DenseForest)
			setAnimals(gc.getInfoTypeForString("UNIT_UR"),DenseForest)
			setAnimals(gc.getInfoTypeForString("UNIT_BEAR"),DenseForest)
	elif Tundra:
		if CvUtil.myRandom(33, "setAnimals4Tundra") == 1:
			setAnimals(gc.getInfoTypeForString("UNIT_WOLF"),Tundra)
			setAnimals(gc.getInfoTypeForString("UNIT_BEAR"),Tundra)
	elif Jungle:
		if CvUtil.myRandom(33, "setAnimals4Jungle") == 1:
			setAnimals(gc.getInfoTypeForString("UNIT_PANTHER"),Jungle)
			setAnimals(gc.getInfoTypeForString("UNIT_TIGER"),Jungle)
			setAnimals(gc.getInfoTypeForString("UNIT_LEOPARD"),Jungle)
			setAnimals(gc.getInfoTypeForString("UNIT_ELEFANT"),Jungle)
	elif Forest:
		if CvUtil.myRandom(33, "setAnimals4Forest") == 1:
			setAnimals(gc.getInfoTypeForString("UNIT_WOLF"),Forest)
			setAnimals(gc.getInfoTypeForString("UNIT_BEAR"),Forest)
			setAnimals(gc.getInfoTypeForString("UNIT_BOAR"),Forest)
			setAnimals(gc.getInfoTypeForString("UNIT_DEER"),Forest)
	elif Plains:
		if CvUtil.myRandom(33, "setAnimals4Plains") == 1:
			setAnimals(gc.getInfoTypeForString("UNIT_HYENA"),Plains)
			setAnimals(gc.getInfoTypeForString("UNIT_LEOPARD"),Plains)
			#setAnimals(gc.getInfoTypeForString("UNIT_HORSE"),Plains)

	# Goody huts setzen
	if bGoodyHuts:
		nPlots = Jungle + Forest + Plains
		if nPlots:
			if CvUtil.myRandom(33, "setGoodyHuts") == 1:
				setGoodies(impGoody,iGoodyHuts,nPlots)

	# Barbaren Forts setzen
	if bBarbForts:
		nPlots = Hills
		if nPlots:
			if CvUtil.myRandom(33, "setBarbForts") == 1:
				setGoodies(impBarbFort,iBarbForts,nPlots)

	# Caves setzen
	nPlots = Jungle + Forest + DenseForest + Desert + Tundra
	if nPlots:
		if CvUtil.myRandom(33, "setCaves") == 1:
			setGoodies(impCave,iCaves,nPlots)

	# move Desertstorm / Sandsturm bewegen
	if lDesertStorm:
		doMoveDesertStorm(lDesertStorm)

	# Olympiade / Olympic Games / Panhellenic Games
	doOlympicGames()
def doMoveDesertStorm(lDesertStorm):
	iFeatDesertstorm = gc.getInfoTypeForString("FEATURE_FALLOUT")
	iTerrainDesert = gc.getInfoTypeForString("TERRAIN_DESERT")
	#iDarkIce = gc.getInfoTypeForString("FEATURE_DARK_ICE")

	lImprovements = [
		gc.getInfoTypeForString("IMPROVEMENT_FORT"),
		gc.getInfoTypeForString("IMPROVEMENT_FORT2"),
		gc.getInfoTypeForString("IMPROVEMENT_TURM2"),
		gc.getInfoTypeForString("IMPROVEMENT_MINE")
	]

	# Wegen Wind von West nach Ost, die Reihenfolge der Plot-Liste umkehren
	lDesertStorm.reverse()

	for p in lDesertStorm:
		loopPlot = plotXY(p.getX(), p.getY(), 2, 0) # 2-Plot-Schritte nach Osten
		if loopPlot and not loopPlot.isNone():
			if loopPlot.getTerrainType() == iTerrainDesert:
				if loopPlot.getFeatureType() == -1:
					if not loopPlot.isPeak():
						bMeldung = False
						# Entferne Modernisierung 1:3
						if loopPlot.getImprovementType() not in lImprovements:
							if CvUtil.myRandom(3, "doDestroyImprovementDueToDesertStorm") == 1:
								loopPlot.setImprovementType(-1)
								bMeldung = True
						# Entferne Strasse 1:3
						if loopPlot.getRouteType() == 0 and not loopPlot.isCity():
							if CvUtil.myRandom(3, "doDestroyRouteDueToDesertStorm") == 1:
								loopPlot.setRouteType(-1)
								bMeldung = True
						# Sandsturm setzen
						loopPlot.setFeatureType(iFeatDesertstorm, 0)
						# Meldung an den Spieler
						if bMeldung and loopPlot.getOwner() != -1:
							if gc.getPlayer(loopPlot.getOwner()).isHuman():
								CyInterface().addMessage(gc.getPlayer(loopPlot.getOwner()).getID(), True, 12, CyTranslator().getText("TXT_KEY_DISASTER_DESERTSTORM", ("", )), None, 2, gc.getFeatureInfo(iFeatDesertstorm).getButton(), ColorTypes(7), loopPlot.getX(), loopPlot.getY(), True, True)
		# Sandsturm entfernen (vorheriger Plot)
		p.setFeatureType(-1, 0)
Example #16
0
    def placeSpecial(self):

        screen = self.top.getScreen()

        panelName = self.top.getNextWidgetName()
        screen.addPanel(panelName, "", "", True, False, self.X_SPECIAL_PANE,
                        self.Y_SPECIAL_PANE, self.W_SPECIAL_PANE,
                        self.H_SPECIAL_PANE, PanelStyles.PANEL_STYLE_BLUE50)

        listName = self.top.getNextWidgetName()

        szSpecialText = CyGameTextMgr().getTechHelp(self.iTech, True, False,
                                                    False, False, -1)[1:]

        # Obsolete Unit
        if self.iTech == gc.getInfoTypeForString("TECH_GRENZHEER"):
            if szSpecialText != "": szSpecialText += "\n"
            szSpecialText += CyTranslator().getText(
                "TXT_KEY_TECH_OBSOLETES",
                (gc.getUnitInfo(gc.getInfoTypeForString(
                    "UNIT_PRAETORIAN")).getDescription(), ))

        # Spionagemissionen (werden erst im Spiel angezeigt, da Spionage auch ausgeschaltet sein kann -> getNumEspionageMissionInfos() = 0)
        for eLoopEspionage in xrange(gc.getNumEspionageMissionInfos()):
            if gc.getEspionageMissionInfo(
                    eLoopEspionage).getTechPrereq() == self.iTech:
                if szSpecialText != "": szSpecialText += "\n"
                szSpecialText += CyTranslator().getText(
                    "TXT_KEY_MESSAGE_TECH_ESPIONAGE_MISSIONS",
                    (gc.getEspionageMissionInfo(
                        eLoopEspionage).getDescription(), ))

        # Freie Einheit bei Kult
        if self.iTech == gc.getInfoTypeForString(
                "TECH_FRUCHTBARKEIT") or self.iTech == gc.getInfoTypeForString(
                    "TECH_GLADIATOR"):
            if szSpecialText != "": szSpecialText += "\n"
            szSpecialText += CyTranslator().getText(
                "TXT_KEY_MESSAGE_TECH_UNIT_1", ())

        # Freie Einheit bei Religion
        if self.iTech == gc.getInfoTypeForString("TECH_RELIGION_CELTIC") or self.iTech == gc.getInfoTypeForString("TECH_RELIGION_NORDIC") \
        or self.iTech == gc.getInfoTypeForString("TECH_RELIGION_SUMER") or self.iTech == gc.getInfoTypeForString("TECH_RELIGION_GREEK") \
        or self.iTech == gc.getInfoTypeForString("TECH_RELIGION_HINDU") or self.iTech == gc.getInfoTypeForString("TECH_DUALISMUS"):
            if szSpecialText != "": szSpecialText += "\n"
            szSpecialText += CyTranslator().getText(
                "TXT_KEY_MESSAGE_TECH_UNIT_2", ())

        # PAE - Tradeable/conquerable
        if szSpecialText != "": szSpecialText += "\n"
        if gc.getTechInfo(self.iTech).isTrade():
            szSpecialText += CyTranslator().getText(
                "TXT_KEY_MESSAGE_TECH_TRADEABLE", ())
        else:
            szSpecialText += CyTranslator().getText(
                "TXT_KEY_MESSAGE_TECH_NOT_TRADEABLE", ())

        # BTS: Auflistung
        screen.addMultilineText(
            listName, szSpecialText, self.X_SPECIAL_PANE + 5,
            self.Y_SPECIAL_PANE + 20, self.W_SPECIAL_PANE - 30,
            self.H_SPECIAL_PANE - 10, WidgetTypes.WIDGET_GENERAL, -1, -1,
            CvUtil.FONT_LEFT_JUSTIFY)
Example #17
0
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)
Example #18
0
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())
Example #19
0
## Copyright Firaxis Games 2005
##
## Alex Mantzaris / Jesse Smith 09-2005
from CvPythonExtensions import (CyGlobalContext, CyArtFileMgr, CyTranslator,
                                FontTypes, CivilopediaPageTypes, NotifyCode,
                                WidgetTypes, PanelStyles, AttitudeTypes,
                                CyGameTextMgr, InputTypes, LeaderheadAction)
import CvUtil
# import ScreenInput
import CvScreenEnums
# import random

# globals
gc = CyGlobalContext()
ArtFileMgr = CyArtFileMgr()
localText = CyTranslator()


class CvPediaLeader:
    "Civilopedia Screen for Leaders"

    def __init__(self, main):
        self.iLeader = -1
        self.top = main

        self.X_LEADERHEAD_PANE = 10
        self.Y_LEADERHEAD_PANE = 50
        self.W_LEADERHEAD_PANE = 270
        self.H_LEADERHEAD_PANE = 300

        self.X_LEADERHEAD = self.X_LEADERHEAD_PANE + 5
def removePagans(pCity):
	iReligion = gc.getInfoTypeForString("RELIGION_CHRISTIANITY")
	iPlayer = pCity.getOwner()
	pPlayer = gc.getPlayer(iPlayer)

	# Kult
	lCorp = []
	iRange = gc.getNumCorporationInfos()
	for i in xrange(iRange):
		if pCity.isHasCorporation(i):
			lCorp.append(i)

	# Religion
	lReli = []
	iRange = gc.getNumReligionInfos()
	for i in xrange(iRange):
		if pCity.isHasReligion(i) and i != iReligion:
			lReli.append(i)

	# Kult oder Religion entfernen
	text = ""
	bUndoCorp = False
	if lCorp and lReli:
		if CvUtil.myRandom(2, "undoCorp") == 1:
			bUndoCorp = True

	# Kult
	if lCorp or bUndoCorp:
		iRand = CvUtil.myRandom(len(lCorp), "removePaganCult")
		iRange = gc.getNumBuildingInfos()
		for iBuildingLoop in xrange(iRange):
			if pCity.getNumBuilding(iBuildingLoop) > 0:
				pBuilding = gc.getBuildingInfo(iBuildingLoop)
				if pBuilding.getPrereqCorporation() == lCorp[iRand]:
					# Akademien (Corp7)
					if pBuilding.getType() not in [
						gc.getInfoTypeForString("BUILDING_ACADEMY_2"),
						gc.getInfoTypeForString("BUILDING_ACADEMY_3"),
						gc.getInfoTypeForString("BUILDING_ACADEMY_4")
					]:
						# Wunder sollen nicht betroffen werden
						iBuildingClass = pBuilding.getBuildingClassType()
						if not isWorldWonderClass(iBuildingClass) and not isTeamWonderClass(iBuildingClass) and not isNationalWonderClass(iBuildingClass):
							pCity.setNumRealBuilding(iBuildingLoop,0)
		pCity.setHasCorporation(lCorp[iRand], 0, 0, 0)
		text = gc.getCorporationInfo( lCorp[iRand] ).getText()

	# Religion
	elif lReli:
		iRand = CvUtil.myRandom(len(lReli), "removePaganReli")
		iRange = gc.getNumBuildingInfos()
		for iBuildingLoop in xrange(iRange):
			if pCity.isHasBuilding(iBuildingLoop):
				pBuilding = gc.getBuildingInfo(iBuildingLoop)
				if pBuilding.getPrereqReligion() == lReli[iRand]:
					# Holy City
					if pBuilding.getHolyCity() == -1:
						# Wunder sollen nicht betroffen werden
						iBuildingClass = pBuilding.getBuildingClassType()
						if not isWorldWonderClass(iBuildingClass) and not isTeamWonderClass(iBuildingClass) and not isNationalWonderClass(iBuildingClass):
							pCity.setNumRealBuilding(iBuildingLoop,0)

		pCity.setHasReligion(lReli[iRand], 0, 0, 0)
		text = gc.getReligionInfo( lReli[iRand] ).getText()

	# Meldung
	if pPlayer.isHuman() and text != "":
		iRand = 1 + CvUtil.myRandom(3, "TXT_KEY_MESSAGE_HERESY_CULTS_")
		CyInterface().addMessage(iPlayer, True, 10, CyTranslator().getText("TXT_KEY_MESSAGE_HERESY_CULTS_"+str(iRand),(text,pCity.getName())), None, 2,"Art/Interface/Buttons/Actions/button_kreuz.dds", ColorTypes(11), pCity.getX(), pCity.getY(), True, True)