コード例 #1
0
    def onCityAcquired(self, argsList):
        iOwner, iPlayer, city, bConquest, bTrade = argsList
        tCity = (city.getX(), city.getY())

        cnm.onCityAcquired(city, iPlayer)

        if bConquest:
            sta.onCityAcquired(city, iOwner, iPlayer)

        if iPlayer == iArabia:
            self.up.arabianUP(city)

        if iPlayer == iMongolia and bConquest and utils.getHumanID(
        ) != iPlayer:
            self.up.mongolUP(city)

        # relocate capitals
        if utils.getHumanID() != iPlayer:
            if iPlayer == iOttomans and tCity == (68, 45):
                utils.moveCapital(iOttomans, tCity)  # Kostantiniyye
            elif iPlayer == iMongolia and tCity == (102, 47):
                utils.moveCapital(iMongolia, tCity)  # Khanbaliq
            elif iPlayer == iTurks and utils.isAreaControlled(
                    iTurks, Areas.tCoreArea[iPersia][0],
                    Areas.tCoreArea[iPersia][1]):
                capital = pTurks.getCapitalCity()
                if not utils.isPlotInArea((capital.getX(), capital.getY()),
                                          Areas.tCoreArea[iPersia][0],
                                          Areas.tCoreArea[iPersia][1]):
                    newCapital = utils.getRandomEntry(
                        utils.getAreaCitiesCiv(
                            iTurks,
                            utils.getPlotList(Areas.tCoreArea[iPersia][0],
                                              Areas.tCoreArea[iPersia][1])))
                    if newCapital:
                        utils.moveCapital(
                            iTurks, (newCapital.getX(), newCapital.getY()))

        # remove slaves if unable to practice slavery
        if not gc.getPlayer(iPlayer).canUseSlaves():
            utils.removeSlaves(city)
        else:
            utils.freeSlaves(city, iPlayer)

        if city.isCapital():
            if city.isHasRealBuilding(iAdministrativeCenter):
                city.setHasRealBuilding(iAdministrativeCenter, False)

        # Leoreth: relocate capital for AI if reacquired:
        if utils.getHumanID() != iPlayer and iPlayer < iNumPlayers:
            if data.players[iPlayer].iResurrections == 0:
                if Areas.getCapital(iPlayer) == tCity:
                    utils.relocateCapital(iPlayer, city)
            else:
                if Areas.getRespawnCapital(iPlayer) == tCity:
                    utils.relocateCapital(iPlayer, city)

        # Leoreth: conquering Constantinople adds it to the Turkish core + Rumelia
        if iPlayer == iOttomans and tCity == (68, 45):
            utils.setReborn(iOttomans, True)

        if iPlayer == iTurks:
            if utils.isAreaControlled(iPlayer, Areas.tCoreArea[iPersia][0],
                                      Areas.tCoreArea[iPersia][1]):
                utils.setReborn(iTurks, True)
            else:
                utils.setReborn(iTurks, False)

        # Leoreth: help Byzantium/Constantinople
        if iPlayer == iByzantium and tCity == Areas.getCapital(
                iByzantium
        ) and gc.getGame().getGameTurn() <= getTurnForYear(330) + 3:
            if city.getPopulation() < 5:
                city.setPopulation(5)

            city.setHasRealBuilding(iBarracks, True)
            city.setHasRealBuilding(iWalls, True)
            city.setHasRealBuilding(iLibrary, True)
            city.setHasRealBuilding(iMarket, True)
            city.setHasRealBuilding(iGranary, True)
            city.setHasRealBuilding(iHarbor, True)
            city.setHasRealBuilding(iForge, True)

            city.setName("Konstantinoupolis", False)

            city.setHasRealBuilding(
                iTemple + 4 * gc.getPlayer(iPlayer).getStateReligion(), True)

        if bConquest:

            # Colombian UP: no resistance in conquered cities in Latin America
            if iPlayer == iMaya and utils.isReborn(iMaya):
                if utils.isPlotInArea(tCity, tSouthCentralAmericaTL,
                                      tSouthCentralAmericaBR):
                    city.setOccupationTimer(0)

            # Statue of Zeus effect: no city resistance on conquest
            if gc.getPlayer(iPlayer).isHasBuildingEffect(iStatueOfZeus):
                city.setOccupationTimer(0)

            # Byzantium reduced to four cities: core shrinks to Constantinople
            if iOwner == iByzantium and gc.getPlayer(
                    iByzantium).getNumCities <= 4:
                utils.setReborn(iByzantium, True)

        if bTrade:
            for i in range(iNumBuildings):
                iNationalWonder = i
                if isNationalWonderClass(
                        gc.getBuildingInfo(iNationalWonder).
                        getBuildingClassType()) and city.hasBuilding(
                            iNationalWonder):
                    city.setHasRealBuilding(iNationalWonder, False)

        # Leoreth: Escorial effect
        if gc.getPlayer(iPlayer).isHasBuildingEffect(iEscorial):
            if city.isColony():
                capital = gc.getPlayer(iPlayer).getCapitalCity()
                iGold = utils.getTurns(10 + utils.calculateDistance(
                    capital.getX(), capital.getY(), city.getX(), city.getY()))
                CyInterface().addMessage(
                    iPlayer, False, iDuration,
                    CyTranslator().getText("TXT_KEY_BUILDING_ESCORIAL_EFFECT",
                                           (iGold, city.getName())), "", 0, "",
                    ColorTypes(iWhite), -1, -1, True, True)
                gc.getPlayer(iPlayer).changeGold(iGold)

        self.pla.onCityAcquired(iOwner, iPlayer, city)  # Plague
        self.com.onCityAcquired(city)  # Communications
        self.corp.onCityAcquired(argsList)  # Companies
        dc.onCityAcquired(iOwner, iPlayer)  # DynamicCivs

        vic.onCityAcquired(iPlayer, iOwner, city, bConquest)

        lTradingCompanyList = [
            iSpain, iFrance, iEngland, iPortugal, iNetherlands
        ]

        if bTrade and iPlayer in lTradingCompanyList and (
                city.getX(), city.getY()
        ) in tTradingCompanyPlotLists[lTradingCompanyList.index(iPlayer)]:
            self.up.tradingCompanyCulture(city, iPlayer, iOwner)

        return 0
コード例 #2
0
    def onTechAcquired(self, argsList):
        iTech, iTeam, iPlayer, bAnnounce = argsList

        iHuman = utils.getHumanID()

        iEra = gc.getTechInfo(iTech).getEra()
        iGameTurn = gc.getGame().getGameTurn()

        if iGameTurn == utils.getScenarioStartTurn():
            return

        sta.onTechAcquired(iPlayer, iTech)
        AIParameters.onTechAcquired(iPlayer, iTech)

        if iGameTurn > getTurnForYear(tBirth[iPlayer]):
            vic.onTechAcquired(iPlayer, iTech)
            cnm.onTechAcquired(iPlayer)
            dc.onTechAcquired(iPlayer, iTech)

        if gc.getPlayer(iPlayer).isAlive() and iGameTurn > getTurnForYear(
                tBirth[iPlayer]) and iPlayer < iNumPlayers:
            self.rel.onTechAcquired(iTech, iPlayer)
            if iGameTurn > getTurnForYear(1700):
                self.aiw.forgetMemory(iTech, iPlayer)

        if iTech == iExploration:
            if iPlayer in [
                    iSpain, iFrance, iEngland, iGermany, iVikings,
                    iNetherlands, iPortugal
            ]:
                data.players[iPlayer].iExplorationTurn = iGameTurn

        elif iTech == iCompass:
            if iPlayer == iVikings:
                gc.getMap().plot(49, 62).setTerrainType(iCoast, True, True)

        elif iTech == iMicrobiology:
            self.pla.onTechAcquired(iTech, iPlayer)

        elif iTech == iRailroad:
            self.rnf.onRailroadDiscovered(iPlayer)

        if iTech in [iExploration, iFirearms]:
            teamPlayer = gc.getTeam(iPlayer)
            if teamPlayer.isHasTech(iExploration) and teamPlayer.isHasTech(
                    iFirearms):
                self.rnf.earlyTradingCompany(iPlayer)

        if iTech in [iEconomics, iReplaceableParts]:
            teamPlayer = gc.getTeam(iPlayer)
            if teamPlayer.isHasTech(iEconomics) and teamPlayer.isHasTech(
                    iReplaceableParts):
                self.rnf.lateTradingCompany(iPlayer)

        if utils.getHumanID() != iPlayer:
            if iPlayer == iJapan and iEra == iIndustrial:
                utils.moveCapital(iPlayer, (116, 47))  # Toukyou
            elif iPlayer == iItaly and iEra == iIndustrial:
                utils.moveCapital(iPlayer, (60, 44))  # Roma
            elif iPlayer == iVikings and iEra == iRenaissance:
                utils.moveCapital(iPlayer, (63, 59))  # Stockholm
            elif iPlayer == iHolyRome and iEra == iRenaissance:
                utils.moveCapital(iPlayer, (62, 49))  # Wien

        # Maya UP: +20 food when a tech is discovered before the medieval era
        if iPlayer == iMaya and not pMaya.isReborn() and iEra < iMedieval:
            if pMaya.getNumCities() > 0:
                iFood = 20 / pMaya.getNumCities()
                for city in utils.getCityList(iMaya):
                    city.changeFood(iFood)
                CyInterface().addMessage(
                    iPlayer, False, iDuration,
                    CyTranslator().getText(
                        "TXT_KEY_MAYA_UP_EFFECT",
                        (gc.getTechInfo(iTech).getText(), iFood)), "", 0, "",
                    ColorTypes(iWhite), -1, -1, True, True)

        # Spain's core extends when reaching the Renaissance and there are no Moors in Iberia
        # at the same time, the Moorish core relocates to Africa
        if iPlayer == iSpain and iEra == iRenaissance and not utils.isReborn(
                iSpain):
            bNoMoors = True
            if gc.getPlayer(iMoors).isAlive():
                for city in utils.getCityList(iMoors):
                    if city.plot().getRegionID() == rIberia:
                        bNoMoors = False
            if bNoMoors:
                utils.setReborn(iSpain, True)
                utils.setReborn(iMoors, True)

        # Italy's core extends when reaching the Industrial era
        if iPlayer == iItaly and iEra == iIndustrial:
            utils.setReborn(iItaly, True)

        # Japan's core extends when reaching the Industrial era
        if iPlayer == iJapan and iEra == iIndustrial:
            utils.setReborn(iJapan, True)

        # Germany's core shrinks when reaching the Digital era
        if iPlayer == iGermany and iEra == iDigital:
            utils.setReborn(iGermany, True)
コード例 #3
0
    def onTechAcquired(self, argsList):
        iTech, iTeam, iPlayer, bAnnounce = argsList

        iHuman = utils.getHumanID()

        iEra = gc.getTechInfo(iTech).getEra()

        if gc.getGame().getGameTurn() == utils.getScenarioStartTurn():
            return

        sta.onTechAcquired(iPlayer, iTech)
        AIParameters.onTechAcquired(iPlayer, iTech)

        if gc.getGame().getGameTurn() > getTurnForYear(tBirth[iPlayer]):
            vic.onTechAcquired(iPlayer, iTech)
            cnm.onTechAcquired(iPlayer)
            dc.onTechAcquired(iPlayer, iTech)

        if gc.getPlayer(iPlayer).isAlive() and gc.getGame().getGameTurn(
        ) > getTurnForYear(tBirth[iPlayer]) and iPlayer < iNumPlayers:
            self.rel.onTechAcquired(iTech, iPlayer)
            if (gc.getGame().getGameTurn() > getTurnForYear(1700)):
                self.aiw.forgetMemory(iTech, iPlayer)

        if iTech == iExploration:
            if iPlayer in [
                    iSpain, iFrance, iEngland, iGermany, iVikings,
                    iNetherlands, iPortugal
            ]:
                data.players[iPlayer].iExplorationTurn = gc.getGame(
                ).getGameTurn()

        elif iTech == iCompass:
            if iPlayer == iVikings:
                gc.getMap().plot(49, 62).setTerrainType(iCoast, True, True)

        elif iTech == iMicrobiology:
            self.pla.onTechAcquired(iTech, iPlayer)

        elif iTech == iRailroad:
            self.rnf.onRailroadDiscovered(iPlayer)

        if iTech in [iExploration, iFirearms]:
            teamPlayer = gc.getTeam(iPlayer)
            if teamPlayer.isHasTech(iExploration) and teamPlayer.isHasTech(
                    iFirearms):
                self.rnf.earlyTradingCompany(iPlayer)

        if iTech in [iEconomics, iReplaceableParts]:
            teamPlayer = gc.getTeam(iPlayer)
            if teamPlayer.isHasTech(iEconomics) and teamPlayer.isHasTech(
                    iReplaceableParts):
                self.rnf.lateTradingCompany(iPlayer)

        if utils.getHumanID() != iPlayer:
            if iPlayer == iJapan and iEra == iIndustrial:
                utils.moveCapital(iPlayer, (116, 47))  # Toukyou
            elif iPlayer == iItaly and iEra == iIndustrial:
                utils.moveCapital(iPlayer, (60, 44))  # Roma
            elif iPlayer == iVikings and iEra == iRenaissance:
                utils.moveCapital(iPlayer, (63, 59))  # Stockholm
            elif iPlayer == iHolyRome and iEra == iRenaissance:
                utils.moveCapital(iPlayer, (62, 49))  # Wien

        # Spain's core extends when reaching the Renaissance and there are no Moors in Iberia
        # at the same time, the Moorish core relocates to Africa
        if iPlayer == iSpain and iEra == iRenaissance and not utils.isReborn(
                iSpain):
            bNoMoors = True
            if gc.getPlayer(iMoors).isAlive():
                for city in utils.getCityList(iMoors):
                    if city.plot().getRegionID() == rIberia:
                        bNoMoors = False
            if bNoMoors:
                utils.setReborn(iSpain, True)
                utils.setReborn(iMoors, True)

        # Italy's core extends when reaching the Industrial era
        if iPlayer == iItaly and iEra == iIndustrial:
            utils.setReborn(iItaly, True)

        # Arabia's core moves to Iraq when Education is discovered
        if iPlayer == iArabia and iTech == iEducation:
            utils.setReborn(iArabia, True)

        # Japan's core extends when reaching the Industrial era
        if iPlayer == iJapan and iEra == iIndustrial:
            utils.setReborn(iJapan, True)

        # Germany's core shrinks when reaching the Digital era
        if iPlayer == iGermany and iEra == iDigital:
            utils.setReborn(iGermany, True)
コード例 #4
0
    def onCityAcquired(self, argsList):
        iOwner, iPlayer, city, bConquest, bTrade = argsList
        tCity = (city.getX(), city.getY())

        cnm.onCityAcquired(city, iPlayer)

        if bConquest:
            sta.onCityAcquired(city, iOwner, iPlayer)

        if iPlayer == iArabia:
            self.up.arabianUP(city)
        # elif iPlayer == iMughals and utils.getHumanID() != iMughals:
        # self.up.mughalUP(city)
        # elif iPlayer == iSeljuks:
        # self.up.seljukUP(city)

        if iPlayer == iMongolia and bConquest and utils.getHumanID(
        ) != iPlayer:
            self.up.mongolUP(city)

        if iPlayer < iNumMajorPlayers:
            utils.spreadMajorCulture(iPlayer, tCity)

        # relocate capitals
        if utils.getHumanID() != iPlayer:
            if iPlayer == iTurkey and tCity == (68, 45):
                utils.moveCapital(iTurkey, tCity)  # Kostantiniyye
            elif iPlayer == iMongolia and tCity == (102, 47):
                utils.moveCapital(iMongolia, tCity)  # Khanbaliq

        # remove slaves if unable to practice slavery
        if not gc.getPlayer(iPlayer).isColonialSlavery():
            utils.removeSlaves(city)
        else:
            utils.freeSlaves(city, iPlayer)

        if city.isCapital():
            if city.isHasRealBuilding(iAdministrativeCenter):
                city.setHasRealBuilding(iAdministrativeCenter, False)

        # kill Seljuks
        #if iOwner == iSeljuks and gc.getPlayer(iSeljuks).isAlive() and gc.getGame().getGameTurnYear() >= 1250:
        #	if city.isCapital() or gc.getPlayer(iSeljuks).getNumCities() <= 2:
        #		sta.completeCollapse(iSeljuks)
        #utils.killAndFragmentCiv(iSeljuks, iIndependent, iIndependent2, -1, False)

        # Leoreth: relocate capital for AI if reacquired:
        if utils.getHumanID() != iPlayer and iPlayer < iNumPlayers:
            if data.players[iPlayer].iResurrections == 0:
                if Areas.getCapital(iPlayer) == tCity:
                    utils.relocateCapital(iPlayer, city)
            else:
                if Areas.getRespawnCapital(iPlayer) == tCity:
                    utils.relocateCapital(iPlayer, city)

        # Leoreth: conquering Constantinople adds it to the Turkish core + Rumelia
        if iPlayer == iTurkey and tCity == (68, 45):
            utils.setReborn(iTurkey, True)

        # Leoreth: help Byzantium/Constantinople
        if iPlayer == iByzantium and tCity == Areas.getCapital(
                iByzantium
        ) and gc.getGame().getGameTurn() <= getTurnForYear(330) + 3:
            if city.getPopulation() < 5:
                city.setPopulation(5)

            city.setHasRealBuilding(iBarracks, True)
            city.setHasRealBuilding(iWalls, True)
            city.setHasRealBuilding(iLibrary, True)
            city.setHasRealBuilding(iMarket, True)
            city.setHasRealBuilding(iGranary, True)
            city.setHasRealBuilding(iHarbor, True)
            city.setHasRealBuilding(iForge, True)

            city.setName("Konstantinoupolis", False)

            city.setHasRealBuilding(
                iTemple + 4 * gc.getPlayer(iPlayer).getStateReligion(), True)

        if bConquest:

            # Colombian UP: no resistance in conquered cities in Latin America
            if iPlayer == iMaya and utils.isReborn(iMaya):
                if utils.isPlotInArea(tCity, tSouthCentralAmericaTL,
                                      tSouthCentralAmericaBR):
                    city.setOccupationTimer(0)

            # Statue of Zeus effect: no city resistance on conquest
            if gc.getPlayer(iPlayer).isHasBuildingEffect(iStatueOfZeus):
                city.setOccupationTimer(0)

            # Byzantium reduced to four cities: core shrinks to Constantinople
            if iOwner == iByzantium and gc.getPlayer(
                    iByzantium).getNumCities <= 4:
                utils.setReborn(iByzantium, True)

        if bTrade:
            for i in range(iNumBuildings):
                iNationalWonder = i
                if isNationalWonderClass(
                        gc.getBuildingInfo(iNationalWonder).
                        getBuildingClassType()) and city.hasBuilding(
                            iNationalWonder):
                    city.setHasRealBuilding(iNationalWonder, False)

        self.pla.onCityAcquired(iOwner, iPlayer, city)  # Plague
        self.com.onCityAcquired(city)  # Communications
        self.corp.onCityAcquired(argsList)  # Companies
        dc.onCityAcquired(iOwner, iPlayer)  # DynamicCivs

        vic.onCityAcquired(iPlayer, iOwner, city, bConquest)

        return 0
コード例 #5
0
	def onTechAcquired(self, argsList):
		iTech, iTeam, iPlayer, bAnnounce = argsList

		iHuman = utils.getHumanID()
		
		iEra = gc.getTechInfo(iTech).getEra()
		
		if utils.getScenario() == i600AD and gc.getGame().getGameTurn() == getTurnForYear(600): #late start condition
			return
			
		if utils.getScenario() == i1700AD and gc.getGame().getGameTurn() == getTurnForYear(1700):
			return
			
		sta.onTechAcquired(iPlayer, iTech)
		AIParameters.onTechAcquired(iPlayer, iTech)
		
		if gc.getGame().getGameTurn() > getTurnForYear(tBirth[iPlayer]):
			vic.onTechAcquired(iPlayer, iTech)
			cnm.onTechAcquired(argsList[2])

		if gc.getPlayer(iPlayer).isAlive() and gc.getGame().getGameTurn() > getTurnForYear(tBirth[iPlayer]) and iPlayer < iNumPlayers:
			self.rel.onTechAcquired(argsList[0], argsList[2])
			if (gc.getGame().getGameTurn() > getTurnForYear(1700)):
				self.aiw.forgetMemory(argsList[0], argsList[2])

		if iTech == iAstronomy:
			if iPlayer in [iSpain, iFrance, iEngland, iGermany, iVikings, iNetherlands, iPortugal]:
				data.players[iPlayer].iAstronomyTurn = gc.getGame().getGameTurn()
				
		elif iTech == iCompass:
			if iPlayer == iVikings:
				gc.getMap().plot(49, 62).setTerrainType(iCoast, True, True)
				
		elif iTech == iMedicine:
			self.pla.onTechAcquired(argsList[0], argsList[2])

		elif iTech == iRailroad:
			self.rnf.onRailroadDiscovered(argsList[2])
			
		if iTech in [iAstronomy, iGunpowder]:
			teamPlayer = gc.getTeam(iPlayer)
			if teamPlayer.isHasTech(iAstronomy) and teamPlayer.isHasTech(iGunpowder):
				self.rnf.earlyTradingCompany(iPlayer)
			
		if iTech in [iEconomics, iRifling]:
			teamPlayer = gc.getTeam(iPlayer)
			if teamPlayer.isHasTech(iEconomics) and teamPlayer.isHasTech(iRifling):
				self.rnf.lateTradingCompany(iPlayer)
	
		if utils.getHumanID() != iPlayer:
			if iPlayer == iJapan and iEra == iIndustrial:
				utils.moveCapital(iPlayer, (116, 47)) # Toukyou
			elif iPlayer == iItaly and iEra == iIndustrial:
				utils.moveCapital(iPlayer, (60, 44)) # Roma
			elif iPlayer == iVikings and iEra == iRenaissance:
				utils.moveCapital(iPlayer, (63, 59)) # Stockholm
			elif iPlayer == iHolyRome and iEra == iRenaissance:
				utils.moveCapital(iPlayer, (62, 49)) # Wien
				
		# Spain's core extends when reaching the Renaissance and there are no Moors in Iberia
		# at the same time, the Moorish core relocates to Africa
		if iPlayer == iSpain and iEra == iRenaissance and not utils.isReborn(iSpain):
			bNoMoors = True
			if gc.getPlayer(iMoors).isAlive():
				for city in utils.getCityList(iMoors):
					if city.plot().getRegionID() == rIberia:
						bNoMoors = False
			if bNoMoors:
				utils.setReborn(iSpain, True)
				utils.setReborn(iMoors, True)
				
		# Italy's core extends when reaching the Industrial era
		if iPlayer == iItaly and iEra == iIndustrial:
			utils.setReborn(iItaly, True)
			
		# Arabia's core moves to Iraq when Philosophy is discovered
		if iPlayer == iArabia and iTech == iPhilosophy:
			utils.setReborn(iArabia, True)
			
		# Japan's core extends when reaching the Industrial era
		if iPlayer == iJapan and iEra == iIndustrial:
			utils.setReborn(iJapan, True)
			
		# Germany's core shrinks when reaching the Modern era
		if iPlayer == iGermany and iEra == iModern:
			utils.setReborn(iGermany, True)
コード例 #6
0
	def onCityAcquired(self, argsList):
		iOwner, iPlayer, city, bConquest, bTrade = argsList
		tCity = (city.getX(), city.getY())
		
		cnm.onCityAcquired(city, iPlayer)
		
		if bConquest:
			sta.onCityAcquired(city, iOwner, iPlayer)
			
		if iPlayer == iArabia:
			self.up.arabianUP(city)
		# elif iPlayer == iMughals and utils.getHumanID() != iMughals:
			# self.up.mughalUP(city)
		# elif iPlayer == iSeljuks:
			# self.up.seljukUP(city)
			
		if iPlayer == iMongolia and bConquest and utils.getHumanID() != iPlayer:
			self.up.mongolUP(city)
			
		if iPlayer < iNumMajorPlayers:
			utils.spreadMajorCulture(iPlayer, tCity)
		
		# relocate capitals
		if utils.getHumanID() != iPlayer:
			if iPlayer == iTurkey and tCity == (68, 45):
				utils.moveCapital(iTurkey, tCity) # Kostantiniyye
			elif iPlayer == iMongolia and tCity == (102, 47):
				utils.moveCapital(iMongolia, tCity) # Khanbaliq
				
		# remove slaves if unable to practice slavery
		if gc.getPlayer(iPlayer).getCivics(1) == iCivicEgalitarianism:
			utils.removeSlaves(city)
		else:
			utils.freeSlaves(city, iPlayer)
					
							
		# kill Seljuks
		#if iOwner == iSeljuks and gc.getPlayer(iSeljuks).isAlive() and gc.getGame().getGameTurnYear() >= 1250:
		#	if city.isCapital() or gc.getPlayer(iSeljuks).getNumCities() <= 2:
		#		sta.completeCollapse(iSeljuks)
				#utils.killAndFragmentCiv(iSeljuks, iIndependent, iIndependent2, -1, False)
				
		# Leoreth: relocate capital for AI if reacquired:
		if utils.getHumanID() != iPlayer and iPlayer < iNumPlayers:
			if data.players[iPlayer].iResurrections == 0:
				if Areas.getCapital(iPlayer) == tCity:
					utils.relocateCapital(iPlayer, city)
			else:
				if Areas.getRespawnCapital(iPlayer) == tCity:
					utils.relocateCapital(iPlayer, city)
					
		# Leoreth: conquering Constantinople adds it to the Turkish core + Rumelia
		if iPlayer == iTurkey and tCity == (68, 45):
			utils.setReborn(iTurkey, True)
					
		# Leoreth: help Byzantium/Constantinople
		if iPlayer == iByzantium and tCity == Areas.getCapital(iByzantium) and gc.getGame().getGameTurn() <= getTurnForYear(330)+3:
			if city.getPopulation() < 5:
				city.setPopulation(5)
				
			city.setHasRealBuilding(iBarracks, True)
			city.setHasRealBuilding(iWalls, True)
			city.setHasRealBuilding(iLibrary, True)
			city.setHasRealBuilding(iMarket, True)
			city.setHasRealBuilding(iGranary, True)
			city.setHasRealBuilding(iHarbor, True)
			city.setHasRealBuilding(iForge, True)
			
			city.setName("Konstantinoupolis", False)
			
			city.setHasRealBuilding(iTemple + 4*gc.getPlayer(iPlayer).getStateReligion(), True)
			
		if bConquest:

			# Colombian UP: no resistance in conquered cities in Latin America
			if iPlayer == iMaya and utils.isReborn(iMaya):
				if utils.isPlotInArea(tCity, tSouthCentralAmericaTL, tSouthCentralAmericaBR):
					city.setOccupationTimer(0)
					
			# Statue of Zeus effect: no city resistance on conquest
			if gc.getPlayer(iPlayer).countNumBuildings(iStatueOfZeus) > 0 and not gc.getTeam(iPlayer).isHasTech(iTheology):
				city.setOccupationTimer(0)
				
			# Byzantium reduced to four cities: core shrinks to Constantinople
			if iOwner == iByzantium and gc.getPlayer(iByzantium).getNumCities <= 4:
				utils.setReborn(iByzantium, True)
					
		if bTrade:
			for i in range(iNumBuildings):
				iNationalWonder = i
				if isNationalWonderClass(gc.getBuildingInfo(iNationalWonder).getBuildingClassType()) and city.hasBuilding(iNationalWonder):
					city.setHasRealBuilding(iNationalWonder, False)
					
		self.pla.onCityAcquired(iOwner, iPlayer, city) # Plague
		self.com.onCityAcquired(city) # Communications
		self.corp.onCityAcquired(argsList) # Companies
		dc.onCityAcquired(iOwner, iPlayer) # DynamicCivs
		
		vic.onCityAcquired(iPlayer, iOwner, city, bConquest)
		
		return 0
コード例 #7
0
    def onCityBuilt(self, argsList):
        city = argsList[0]
        iOwner = city.getOwner()
        tCity = (city.getX(), city.getY())
        x, y = tCity

        if iOwner < iNumActivePlayers:
            cnm.onCityBuilt(city)

        # starting workers
        if city.isCapital():
            self.rnf.createStartingWorkers(iOwner, tCity)

        #Rhye - delete culture of barbs and minor civs to prevent weird unhappiness
        pPlot = gc.getMap().plot(x, y)
        for i in range(iNumTotalPlayers - iNumActivePlayers):
            iMinorCiv = i + iNumActivePlayers
            pPlot.setCulture(iMinorCiv, 0, True)
        pPlot.setCulture(iBarbarian, 0, True)

        if iOwner < iNumMajorPlayers:
            utils.spreadMajorCulture(iOwner, tCity)
            if gc.getPlayer(iOwner).getNumCities() < 2:
                gc.getPlayer(iOwner).AI_updateFoundValues(False)
                # fix for settler maps not updating after 1st city is founded

        if iOwner == iOttomans:
            self.up.ottomanUP(city, iOwner, -1)

        elif iOwner == iBoers:
            self.up.boersUP(city)

        if iOwner == iYuezhi and utils.getOwnedCoreCities(iYuezhi) > 0:
            if tCity in Areas.getCoreArea(iYuezhi, True):
                if not pYuezhi.isReborn():
                    utils.setReborn(iYuezhi, True)
                if city.getX() <= 102 and not pYuezhi.isHuman():
                    if (pYuezhi.getCapitalCity().getX(),
                            pYuezhi.getCapitalCity().getY()
                        ) in Areas.getCoreArea(iYuezhi, False):
                        utils.moveCapital(iYuezhi, tCity)

        if iOwner == iCarthage:
            if tCity == (67, 48):
                if not gc.getPlayer(iCarthage).isHuman():
                    x = gc.getPlayer(iCarthage).getCapitalCity().getX()
                    y = gc.getPlayer(iCarthage).getCapitalCity().getY()
                    carthage = gc.getMap().plot(67, 48).getPlotCity()
                    carthage.setHasRealBuilding(iPalace, True)
                    gc.getMap().plot(x, y).getPlotCity().setHasRealBuilding(
                        iPalace, False)
                    dc.onPalaceMoved(iCarthage)

                    carthage.setPopulation(3)

                    utils.makeUnitAI(iWorkboat, iCarthage, (67, 48),
                                     UnitAITypes.UNITAI_WORKER_SEA, 1)
                    utils.makeUnitAI(iGalley, iCarthage, (67, 48),
                                     UnitAITypes.UNITAI_SETTLER_SEA, 1)
                    utils.makeUnitAI(iSettler, iCarthage, (67, 48),
                                     UnitAITypes.UNITAI_SETTLE, 1)

                    # additional defenders and walls to make human life not too easy
                    if utils.getHumanID() == iRome:
                        carthage.setHasRealBuilding(iWalls, True)
                        utils.makeUnitAI(iArcher, iCarthage, (67, 48),
                                         UnitAITypes.UNITAI_CITY_DEFENSE, 2)
                        utils.makeUnit(iNumidianCavalry, iCarthage, (67, 48),
                                       3)
                        utils.makeUnitAI(iWarElephant, iCarthage, (67, 48),
                                         UnitAITypes.UNITAI_CITY_COUNTER, 2)

                if utils.getOwnedCoreCities(iCarthage) > 0:
                    utils.setReborn(iCarthage, True)

        if iOwner == iByzantium and tCity == Areas.getCapital(
                iByzantium
        ) and gc.getGame().getGameTurn() <= getTurnForYear(330) + 3:
            if city.getPopulation() < 5:
                city.setPopulation(5)

            city.setHasRealBuilding(iBarracks, True)
            city.setHasRealBuilding(iWalls, True)
            city.setHasRealBuilding(iLibrary, True)
            city.setHasRealBuilding(iMarket, True)
            city.setHasRealBuilding(iGranary, True)
            city.setHasRealBuilding(iHarbor, True)
            city.setHasRealBuilding(iForge, True)

            city.setHasRealBuilding(
                iTemple + 4 * gc.getPlayer(iOwner).getStateReligion(), True)

        if iOwner == iPortugal and tCity == Areas.getCapital(
                iPortugal) and gc.getGame().getGameTurn() <= getTurnForYear(
                    tBirth[iPortugal]) + 3:
            city.setPopulation(5)

            for iBuilding in [
                    iLibrary, iMarket, iHarbor, iLighthouse, iForge, iWalls,
                    iTemple + 4 * gc.getPlayer(iPortugal).getStateReligion()
            ]:
                city.setHasRealBuilding(iBuilding, True)

        if iOwner == iNetherlands and tCity == Areas.getCapital(
                iNetherlands
        ) and gc.getGame().getGameTurn() <= getTurnForYear(1580) + 3:
            city.setPopulation(9)

            for iBuilding in [
                    iLibrary, iMarket, iWharf, iLighthouse, iBarracks,
                    iPharmacy, iBank, iArena, iTheatre, iTemple +
                    4 * gc.getPlayer(iNetherlands).getStateReligion()
            ]:
                city.setHasRealBuilding(iBuilding, True)

            gc.getPlayer(iNetherlands).AI_updateFoundValues(False)

        if iOwner == iItaly and tCity == Areas.getCapital(
                iItaly) and gc.getGame().getGameTurn() <= getTurnForYear(
                    tBirth[iItaly]) + 3:
            city.setPopulation(7)

            for iBuilding in [
                    iLibrary, iPharmacy,
                    iTemple + 4 * gc.getPlayer(iItaly).getStateReligion(),
                    iMarket, iArtStudio, iAqueduct, iCourthouse, iWalls
            ]:
                city.setHasRealBuilding(iBuilding, True)

            gc.getPlayer(iItaly).AI_updateFoundValues(False)

        vic.onCityBuilt(iOwner, city)

        self.up.onCityBuilt(iOwner, city)

        if iOwner < iNumPlayers:
            dc.onCityBuilt(iOwner)

        if iOwner == iArabia:
            if not gc.getGame().isReligionFounded(iIslam):
                if tCity == (75, 33):
                    rel.foundReligion(tCity, iIslam)

        # Leoreth: free defender and worker for AI colonies
        if iOwner in lCivGroups[0]:
            if city.getRegionID() not in mercRegions[iArea_Europe]:
                if utils.getHumanID() != iOwner:
                    utils.createGarrisons(tCity, iOwner, 1)
                    utils.makeUnit(iWorker, iOwner, tCity, 1)

        # Holy Rome founds its capital
        if iOwner == iHolyRome:
            if gc.getPlayer(iHolyRome).getNumCities() == 1:
                self.rnf.holyRomanSpawn()

        # Leoreth: Escorial effect
        if gc.getPlayer(iOwner).isHasBuildingEffect(iEscorial):
            if city.isColony():
                capital = gc.getPlayer(iOwner).getCapitalCity()
                iGold = utils.getTurns(10 + utils.calculateDistance(
                    capital.getX(), capital.getY(), city.getX(), city.getY()))
                CyInterface().addMessage(
                    iOwner, False, iDuration,
                    CyTranslator().getText("TXT_KEY_BUILDING_ESCORIAL_EFFECT",
                                           (iGold, city.getName())), "", 0, "",
                    ColorTypes(iWhite), -1, -1, True, True)
                gc.getPlayer(iOwner).changeGold(iGold)

        # Leoreth: free defender and worker for cities founded by American Pioneer in North America
        if iOwner == iAmerica:
            if city.getRegionID() in [rUnitedStates, rCanada, rAlaska]:
                utils.createGarrisons(tCity, iOwner, 1)
                utils.makeUnit(utils.getBestWorker(iOwner), iOwner, tCity, 1)

        # 1SDAN: Free Armoury for cities founded by Khazarian Khagans
        if iOwner == iKhazars:
            city.setHasRealBuilding(iArmoury, True)