def foundColony(self, iPlayer, tPlot):
		x, y = tPlot
		plot = gc.getMap().plot(x, y)
		
		if plot.isOwned(): utils.convertPlotCulture(plot, iPlayer, 100, True)
		
		if utils.getHumanID() == iPlayer:
			utils.makeUnit(iSettler, iPlayer, tPlot, 1)
		else:
			gc.getPlayer(iPlayer).found(x, y)
			
		utils.createGarrisons(tPlot, iPlayer, 2)
	def foundColony(self, iPlayer, tPlot):
		x, y = tPlot
		plot = gc.getMap().plot(x, y)
		
		if plot.isOwned(): utils.convertPlotCulture(plot, iPlayer, 100, True)
		
		if utils.getHumanID() == iPlayer:
			utils.makeUnit(iSettler, iPlayer, tPlot, 1)
		else:
			gc.getPlayer(iPlayer).found(x, y)
			
		utils.createGarrisons(tPlot, iPlayer, 2)
示例#3
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)

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

                    carthage.setPopulation(3)

                    utils.makeUnitAI(iWorkboat, iCarthage, (58, 39),
                                     UnitAITypes.UNITAI_WORKER_SEA, 1)
                    utils.makeUnitAI(iGalley, iCarthage, (57, 40),
                                     UnitAITypes.UNITAI_SETTLER_SEA, 1)
                    utils.makeUnitAI(iSettler, iCarthage, (57, 40),
                                     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, (58, 39),
                                         UnitAITypes.UNITAI_CITY_DEFENSE, 2)
                        utils.makeUnit(iNumidianCavalry, iCarthage, (58, 39),
                                       3)
                        utils.makeUnitAI(iWarElephant, iCarthage, (58, 39),
                                         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)

        if iOwner < iNumPlayers:
            dc.onCityBuilt(iOwner)

        if iOwner == iArabia:
            if not gc.getGame().isReligionFounded(iIslam):
                if tCity == (75, 33):
                    self.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(iWorker, iOwner, tCity, 1)
示例#4
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 == iTurkey:
            self.up.turkishUP(city, iOwner, -1)
        elif iOwner == iBoers:
            self.up.boersUP(city)

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

                    carthage.setPopulation(3)

                    utils.makeUnitAI(iWorkboat, iCarthage, (58, 39),
                                     UnitAITypes.UNITAI_WORKER_SEA, 1)
                    utils.makeUnitAI(iGalley, iCarthage, (57, 40),
                                     UnitAITypes.UNITAI_SETTLER_SEA, 1)
                    utils.makeUnitAI(iSettler, iCarthage, (57, 40),
                                     UnitAITypes.UNITAI_SETTLE, 1)

                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, iAmphitheatre, 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)

        if iOwner < iNumPlayers:
            dc.onCityBuilt(iOwner)

        if iOwner == iArabia:
            if not gc.getGame().isReligionFounded(iIslam):
                if tCity == (75, 33):
                    self.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()
	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 == iTurkey:
			self.up.turkishUP(city, iOwner, -1)
			
		if iOwner == iCarthage:
			if tCity == (58, 39):
				if not gc.getPlayer(iCarthage).isHuman():
					x = gc.getPlayer(iCarthage).getCapitalCity().getX()
					y = gc.getPlayer(iCarthage).getCapitalCity().getY()
					carthage = gc.getMap().plot(58, 39).getPlotCity()
					carthage.setHasRealBuilding(iPalace, True)
					gc.getMap().plot(x, y).getPlotCity().setHasRealBuilding(iPalace, False)
					dc.onPalaceMoved(iCarthage)
					
					carthage.setPopulation(3)
					
					utils.makeUnitAI(iWorkboat, iCarthage, (58, 39), UnitAITypes.UNITAI_WORKER_SEA, 1)
					utils.makeUnitAI(iPhoenicianBireme, iCarthage, (57, 40), UnitAITypes.UNITAI_SETTLER_SEA, 1)
					utils.makeUnitAI(iSettler, iCarthage, (57, 40), UnitAITypes.UNITAI_SETTLE, 1)
					
				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 == iNetherlands and tCity == Areas.getCapital(iNetherlands) and gc.getGame().getGameTurn() <= getTurnForYear(1580)+3:
			city.setPopulation(9)
			
			for iBuilding in [iLibrary, iBarracks, iGrocer, iBank, iAmphitheatre, 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, iGrocer, iTemple+4*gc.getPlayer(iItaly).getStateReligion(), iMarket, iItalianArtStudio, iAqueduct, iCourthouse, iWalls]:
				city.setHasRealBuilding(iBuilding, True)
				
			gc.getPlayer(iItaly).AI_updateFoundValues(False)

		vic.onCityBuilt(iOwner, city)
			
		if iOwner < iNumPlayers:
			dc.onCityBuilt(iOwner)

		if iOwner == iArabia:
			if not gc.getGame().isReligionFounded(iIslam):
				if tCity == (75, 33):
					self.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()