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)
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()
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() if iOwner < con.iNumActivePlayers: cnm.onCityBuilt(city) # starting workers if gc.getPlayer(iOwner).getNumCities() == 1: self.rnf.createStartingWorkers(iOwner, (city.getX(), city.getY())) #Rhye - delete culture of barbs and minor civs to prevent weird unhappiness pCurrent = gc.getMap().plot( city.getX(), city.getY() ) for i in range(con.iNumTotalPlayers - con.iNumActivePlayers): iMinorCiv = i + con.iNumActivePlayers pCurrent.setCulture(iMinorCiv, 0, True) pCurrent.setCulture(con.iBarbarian, 0, True) if iOwner < iNumMajorPlayers: utils.spreadMajorCulture(iOwner, city.getX(), city.getY()) 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 == con.iTurkey: self.up.turkishUP(city, iOwner, -1) if iOwner == con.iCarthage: if city.getX() == 58 and city.getY() == 39: if not gc.getPlayer(con.iCarthage).isHuman(): x = gc.getPlayer(con.iCarthage).getCapitalCity().getX() y = gc.getPlayer(con.iCarthage).getCapitalCity().getY() carthage = gc.getMap().plot(58,39).getPlotCity() carthage.setHasRealBuilding(con.iPalace, True) gc.getMap().plot(x,y).getPlotCity().setHasRealBuilding(con.iPalace, False) carthage.setPopulation(3) utils.makeUnitAI(con.iWorkboat, con.iCarthage, (58, 39), UnitAITypes.UNITAI_WORKER_SEA, 1) utils.makeUnitAI(con.iGalley, con.iCarthage, (57, 40), UnitAITypes.UNITAI_SETTLER_SEA, 1) utils.makeUnitAI(con.iSettler, con.iCarthage, (57, 40), UnitAITypes.UNITAI_SETTLE, 1) if not utils.isReborn(iOwner): gc.getPlayer(con.iCarthage).setReborn(True) self.dc.setCivAdjective(iOwner, "TXT_KEY_CIV_CARTHAGE_ADJECTIVE") self.dc.setCivShortDesc(iOwner, "TXT_KEY_CIV_CARTHAGE_SHORT_DESC") if iOwner == con.iByzantium and (city.getX(), city.getY()) == con.tCapitals[0][con.iByzantium] and gc.getGame().getGameTurn() <= getTurnForYear(330)+3: if city.getPopulation() < 5: city.setPopulation(5) city.setHasRealBuilding(con.iBarracks, True) city.setHasRealBuilding(con.iWalls, True) city.setHasRealBuilding(con.iLibrary, True) city.setHasRealBuilding(con.iMarket, True) city.setHasRealBuilding(con.iGranary, True) city.setHasRealBuilding(con.iHarbor, True) city.setHasRealBuilding(con.iForge, True) city.setHasRealBuilding(con.iJewishTemple + 4*gc.getPlayer(iOwner).getStateReligion(), True) if iOwner == con.iNetherlands and (city.getX(), city.getY()) == con.tCapitals[0][con.iNetherlands] and gc.getGame().getGameTurn() <= getTurnForYear(1580)+3: city.setPopulation(9) for iBuilding in [con.iLibrary, con.iBarracks, con.iGrocer, con.iBank, con.iColosseum, con.iTheatre, con.iJewishTemple+4*gc.getPlayer(con.iNetherlands).getStateReligion()]: city.setHasRealBuilding(iBuilding, True) gc.getPlayer(con.iNetherlands).AI_updateFoundValues(False) if iOwner == con.iItaly and (city.getX(), city.getY()) == con.tCapitals[0][con.iItaly] and gc.getGame().getGameTurn() <= getTurnForYear(con.tBirth[con.iItaly])+3: city.setPopulation(7) for iBuilding in [con.iLibrary, con.iGrocer, con.iTemple+4*gc.getPlayer(con.iItaly).getStateReligion(), con.iMarket, con.iItalianArtStudio, con.iAqueduct, con.iCourthouse, con.iWalls]: city.setHasRealBuilding(iBuilding, True) gc.getPlayer(con.iItaly).AI_updateFoundValues(False) vic.onCityBuilt(iOwner, city) if iOwner < con.iNumPlayers: self.dc.onCityBuilt(iOwner) if iOwner == con.iArabia: if not gc.getGame().isReligionFounded(con.iIslam): if (city.getX(), city.getY()) == (75, 33): self.rel.foundReligion((75, 33), con.iIslam) # Leoreth: free defender and worker for AI colonies if iOwner in con.lCivGroups[0]: if city.getRegionID() not in con.mercRegions[con.iArea_Europe]: if utils.getHumanID() != iOwner: x = city.getX() y = city.getY() utils.createGarrisons((x,y), iOwner, 1) utils.makeUnit(con.iWorker, iOwner, (x,y), 1) # Holy Rome founds its capital if iOwner == con.iHolyRome: if gc.getPlayer(con.iHolyRome).getNumCities() == 1: self.rnf.holyRomanSpawn()