def useMongolUP(self): # Unused iOldOwner = data.lLatestRazeData[1] pCity = gc.getMap().plot(data.lLatestRazeData[3], data.lLatestRazeData[4]) city = pCity.getPlotCity() print ("Mongol UP", iOldOwner) for (x, y) in surroundingPlots((data.lLatestRazeData[3], data.lLatestRazeData[4]), iMongolianRadius): tPlot = (x, y) pPlot = gc.getMap().plot(x, y) if pPlot.isCity(): cityNear = pPlot.getPlotCity() iOwnerNear = cityNear.getOwner() if cityNear.getName() != city.getName(): print ("iOwnerNear", iOwnerNear, "citynear", cityNear.getName()) if iOwnerNear in [iOldOwner, iIndependent, iIndependent2]: print ("citynear", cityNear.getName(), "passed1") if cityNear.getPopulation() <= data.lLatestRazeData[2] and not cityNear.isCapital(): print ("citynear", cityNear.getName(), "passed2") bUnitsApproaching = False for (i, j) in utils.surroundingPlots((cityNear.getX(), cityNear.getY())): pNear = gc.getMap().plot(i, j) if pNear.isUnit(): for k in range(pNear.getNumUnits()): if pNear.getUnit(k).getOwner() == iMongolia: bUnitsApproaching = True break break if bUnitsApproaching: print ("citynear", cityNear.getName(), "passed3") utils.flipUnitsInCityBefore(tPlot, iMongolia, iOwnerNear) data.tTempFlippingCity = tPlot utils.flipCity(tPlot, 0, 0, iMongolia, [iOwnerNear]) utils.flipUnitsInCityAfter(data.tTempFlippingCity, iMongolia) utils.cultureManager(data.tTempFlippingCity, 50, iOwnerNear, iMongolia, False, False, False) CyInterface().addMessage(iOwnerNear, False, iDuration, CyTranslator().getText("TXT_KEY_UP_TERROR1", ()) + " " + cityNear.getName() + " " + CyTranslator().getText("TXT_KEY_UP_TERROR2", ()), "", 0, "", ColorTypes(iWhite), -1, -1, True, True) CyInterface().addMessage(iMongolia, False, iDuration, CyTranslator().getText("TXT_KEY_UP_TERROR1", ()) + " " + cityNear.getName() + " " + CyTranslator().getText("TXT_KEY_UP_TERROR2", ()), "", 0, "", ColorTypes(iWhite), -1, -1, True, True)
def infectCity(self, city): if city.getOwner( ) == iCongo and gc.getGame().getGameTurnYear() <= 1650: return # Leoreth: don't let plague mess up the UHV elif city.getOwner( ) == iMali and gc.getGame().getGameTurnYear() <= 1500: return # same for Mali #print ("infected", city.getName()) city.setHasRealBuilding(iPlague, True) if gc.getPlayer(city.getOwner()).isHuman(): CyInterface().addMessage( city.getOwner(), True, iDuration / 2, CyTranslator().getText("TXT_KEY_PLAGUE_SPREAD_CITY", ()) + " " + city.getName() + "!", "AS2D_PLAGUE", 0, "", ColorTypes(iLime), -1, -1, True, True) for (x, y) in utils.surroundingPlots((city.getX(), city.getY()), 2): pPlot = gc.getMap().plot(x, y) if pPlot.getUpgradeProgress() > 0: pPlot.setUpgradeProgress(0) iImprovement = pPlot.getImprovementType() if iImprovement == iTown: pPlot.setImprovementType(iVillage) #elif iImprovement == iVillage: # pPlot.setImprovementType(iHamlet) #elif iImprovement == iHamlet: # pPlot.setImprovementType(iCottage) #elif iImprovement == iCottage: # pPlot.setImprovementType(-1) if pPlot.isCity(): if (city.getX(), city.getY()) == (x, y): self.killUnitsByPlague(city, pPlot, 0, 100, 0)
def killNeighbours(self, tCoords): # Unused 'Kills all units in the neigbbouring tiles of plot (as well as plot itself) so late starters have some space.' for (x, y) in utils.surroundingPlots(tCoords): killPlot = CyMap().getPlot(x, y) for i in range(killPlot.getNumUnits()): unit = killPlot.getUnit(0) # 0 instead of i because killing units changes the indices unit.kill(False, iBarbarian)
def useMongolUP(self): # Unused iOldOwner = data.lLatestRazeData[1] pCity = gc.getMap().plot(data.lLatestRazeData[3], data.lLatestRazeData[4]) city = pCity.getPlotCity() print("Mongol UP", iOldOwner) for (x, y) in surroundingPlots( (data.lLatestRazeData[3], data.lLatestRazeData[4]), iMongolianRadius): tPlot = (x, y) pPlot = gc.getMap().plot(x, y) if pPlot.isCity(): cityNear = pPlot.getPlotCity() iOwnerNear = cityNear.getOwner() if cityNear.getName() != city.getName(): print("iOwnerNear", iOwnerNear, "citynear", cityNear.getName()) if iOwnerNear in [iOldOwner, iIndependent, iIndependent2]: print("citynear", cityNear.getName(), "passed1") if cityNear.getPopulation() <= data.lLatestRazeData[ 2] and not cityNear.isCapital(): print("citynear", cityNear.getName(), "passed2") bUnitsApproaching = False for (i, j) in utils.surroundingPlots( (cityNear.getX(), cityNear.getY())): pNear = gc.getMap().plot(i, j) if pNear.isUnit(): for k in range(pNear.getNumUnits()): if pNear.getUnit( k).getOwner() == iMongolia: bUnitsApproaching = True break break if bUnitsApproaching: print("citynear", cityNear.getName(), "passed3") utils.flipUnitsInCityBefore( tPlot, iMongolia, iOwnerNear) utils.flipCity(tPlot, 0, 0, iMongolia, [iOwnerNear]) utils.flipUnitsInCityAfter(tPlot, iMongolia) utils.cultureManager(tPlot, 50, iOwnerNear, iMongolia, False, False, False) CyInterface().addMessage( iOwnerNear, False, iDuration, CyTranslator().getText( "TXT_KEY_UP_TERROR1", ()) + " " + cityNear.getName() + " " + CyTranslator().getText( "TXT_KEY_UP_TERROR2", ()), "", 0, "", ColorTypes(iWhite), -1, -1, True, True) CyInterface().addMessage( iMongolia, False, iDuration, CyTranslator().getText( "TXT_KEY_UP_TERROR1", ()) + " " + cityNear.getName() + " " + CyTranslator().getText( "TXT_KEY_UP_TERROR2", ()), "", 0, "", ColorTypes(iWhite), -1, -1, True, True)
def checkRegion(self, tCity): # Unusued cityPlot = gc.getMap().plot(tCity[0], tCity[1]) iNumUnitsInAPlot = cityPlot.getNumUnits() ## print iNumUnitsInAPlot #checks if the plot already belongs to someone if cityPlot.isOwned(): if cityPlot.getOwner() != iBarbarian: return (False, -1) ## #checks if there's a unit on the plot if iNumUnitsInAPlot > 0: for i in range(iNumUnitsInAPlot): unit = cityPlot.getUnit(i) iOwner = unit.getOwner() if iOwner == iBarbarian: return (False, tCity[3] + 1) #checks the surroundings and allows only AI units for (x, y) in utils.surroundingPlots(tCity[0], tCity[1]): currentPlot = gc.getMap().plot(x, y) if currentPlot.isCity(): return (False, -1) iNumUnitsInAPlot = currentPlot.getNumUnits() if iNumUnitsInAPlot > 0: for i in range(iNumUnitsInAPlot): unit = currentPlot.getUnit(i) iOwner = unit.getOwner() pOwner = gc.getPlayer(iOwner) if pOwner.isHuman(): return (False, tCity[3] + 1) return (True, tCity[3])
def isFreePlot(self, tPlot, bIgnoreCulture = False): x, y = tPlot plot = gc.getMap().plot(x, y) # no cultural control over the tile if plot.isOwned() and plot.getOwner() < iNumPlayers and not bIgnoreCulture: return False # no city in adjacent tiles for (i, j) in utils.surroundingPlots(tPlot): currentPlot = gc.getMap().plot(i, j) if currentPlot.isCity(): return False return True
def tradingCompanyCulture(self, city, iCiv, iPreviousOwner): tCity = (city.getX(), city.getY()) x, y = tCity for (i, j) in utils.surroundingPlots(tCity): pPlot = gc.getMap().plot(i, j) if (i, j) == tCity: utils.convertPlotCulture(pPlot, iCiv, 51, False) elif pPlot.isCity(): pass elif utils.calculateDistance(i, j, x, y) == 1: utils.convertPlotCulture(pPlot, iCiv, 65, True) else: if pPlot.getOwner() == iPreviousOwner: utils.convertPlotCulture(pPlot, iCiv, 15, False)
def tradingCompanyCulture(self, city, iCiv, iPreviousOwner): tCity = (city.getX(), city.getY()) x, y = tCity for (i, j) in utils.surroundingPlots(tCity): pPlot = gc.getMap().plot(i, j) if (i, j) == tCity: utils.convertPlotCulture(pPlot, iCiv, 51, False) elif pPlot.isCity(): pass elif utils.calculateDistance(i, j, x ,y) == 1: utils.convertPlotCulture(pPlot, iCiv, 65, True) else: if pPlot.getOwner() == iPreviousOwner: utils.convertPlotCulture(pPlot, iCiv, 15, False)
def ottomanUP(self, city, iCiv, iPreviousOwner): tPlot = (city.getX(), city.getY()) x, y = tPlot for (i, j) in utils.surroundingPlots(tPlot, 2): pPlot = gc.getMap().plot(i, j) if (i, j) == tPlot: utils.convertPlotCulture(pPlot, iCiv, 51, False) elif pPlot.isCity(): pass elif utils.calculateDistance(i, j, x, y) == 1: utils.convertPlotCulture(pPlot, iCiv, 80, True) else: if pPlot.getOwner() == iPreviousOwner: utils.convertPlotCulture(pPlot, iCiv, 20, False)
def turkishUP(self, city, iCiv, iPreviousOwner): tPlot = (city.getX(), city.getY()) x, y = tPlot for (i, j) in utils.surroundingPlots(tPlot, 2): pPlot = gc.getMap().plot(i, j) if (i, j) == tPlot: utils.convertPlotCulture(pPlot, iCiv, 51, False) elif pPlot.isCity(): pass elif utils.calculateDistance(i, j, x ,y) == 1: utils.convertPlotCulture(pPlot, iCiv, 80, True) else: if pPlot.getOwner() == iPreviousOwner: utils.convertPlotCulture(pPlot, iCiv, 20, False)
def damageNearbyUnits(self, city): for (x, y) in utils.surroundingPlots((city.getX(), city.getY()), 3): plot = gc.getMap().plot(x, y) iDistance = utils.calculateDistance(city.getX(), city.getY(), x, y) if iDistance == 0: self.killUnitsByPlague(city, plot, 0, 42, 2) elif not plot.isCity(): if iDistance < 3: if plot.isRoute(): self.killUnitsByPlague(city, plot, 10, 35, 0) else: self.killUnitsByPlague(city, plot, 30, 35, 0) else: if plot.isRoute() or plot.isWater(): self.killUnitsByPlague(city, plot, 30, 35, 0)
def damageNearbyUnits(self, city): for (x, y) in utils.surroundingPlots((city.getX(), city.getY()), 3): plot = gc.getMap().plot(x, y) iDistance = utils.calculateDistance(city.getX(), city.getY(), x, y) if iDistance == 0: self.killUnitsByPlague(city, plot, 0, 42, 2) elif not plot.isCity(): if iDistance < 3: if plot.isRoute(): self.killUnitsByPlague(city, plot, 10, 35, 0) else: self.killUnitsByPlague(city, plot, 30, 35, 0) else: if plot.isRoute() or plot.isWater(): self.killUnitsByPlague(city, plot, 30, 35, 0)
def possibleTile(self, tPlot, bWater, bTerritory, bBorder, bImpassable, bNearCity): x, y = tPlot plot = gc.getMap().plot(x, y) lSurrounding = utils.surroundingPlots(tPlot) # never on peaks if plot.isPeak(): return False # only land or water if bWater != plot.isWater(): return False # only inside territory if specified if not bTerritory and plot.getOwner() >= 0: return False # never directly next to cities if [(i, j) for (i, j) in lSurrounding if gc.getMap().plot(i, j).isCity()]: return False # never on tiles with units if plot.isUnit(): return False # never in marsh (impassable) if plot.getFeatureType() == iMarsh: return False # allow other impassable terrain (ocean, jungle) if not bImpassable: if plot.getTerrainType() == iOcean: return False if plot.getFeatureType() == iJungle: return False # restrict to borders if specified if bBorder and not [ (i, j) for (i, j) in lSurrounding if gc.getMap().plot(i, j).getOwner() != plot.getOwner() ]: return False # near a city if specified (next to cities excluded above) if bNearCity and not [(i, j) for (i, j) in utils.surroundingPlots( tPlot, 2, lambda (a, b): not gc.getMap().plot(a, b).isCity())]: return False
def clearUnits(self, iPlayer, tPlot): # Unused lHumanUnits = [] lOtherUnits = [] for (x, y) in utils.surroundingPlots(tPlot): plot = gc.getMap().plot(x, y) for iUnit in range(plot.getNumUnits()): unit = plot.getUnit(iUnit) if unit.getOwner() == utils.getHumanID(): lHumanUnits.append(unit) else: lOtherUnits.append(unit) capital = gc.getPlayer(utils.getHumanID()).getCapitalCity() for unit in lHumanUnits: unit.setXY(capital.getX(), capital.getY()) for unit in lOtherUnits: utils.makeUnit(unit.getUnitType(), iPlayer, tPlot, 1) unit.kill(False, iBarbarian)
def infectCity(self, city): if city.getOwner() == iCongo and gc.getGame().getGameTurnYear() <= 1650: return # Leoreth: don't let plague mess up the UHV elif city.getOwner() == iMali and gc.getGame().getGameTurnYear() <= 1500: return # same for Mali #print ("infected", city.getName()) city.setHasRealBuilding(iPlague, True) if gc.getPlayer(city.getOwner()).isHuman(): CyInterface().addMessage(city.getOwner(), True, iDuration/2, CyTranslator().getText("TXT_KEY_PLAGUE_SPREAD_CITY", ()) + " " + city.getName() + "!", "AS2D_PLAGUE", 0, "", ColorTypes(iLime), -1, -1, True, True) for (x, y) in utils.surroundingPlots((city.getX(), city.getY()), 2): pPlot = gc.getMap().plot( x, y ) if pPlot.getUpgradeProgress() > 0: pPlot.setUpgradeProgress(0) iImprovement = pPlot.getImprovementType() if iImprovement == iTown: pPlot.setImprovementType(iVillage) elif iImprovement == iVillage: pPlot.setImprovementType(iHamlet) elif iImprovement == iHamlet: pPlot.setImprovementType(iCottage) elif iImprovement == iCottage: pPlot.setImprovementType(-1) if pPlot.isCity(): if (city.getX(), city.getY()) == (x, y): self.killUnitsByPlague(city, pPlot, 0, 100, 0)
def spreadToSurroundings(self, city): iPlayer = city.getOwner() # do not spread if plague is almost over if data.players[iPlayer].iPlagueCountdown <= 2: return for (x, y) in utils.surroundingPlots((city.getX(), city.getY()), 2): plot = gc.getMap().plot(x, y) if not plot.isOwned(): continue if (city.getX(), city.getY()) == (x, y): continue if plot.getOwner() == iPlayer: if plot.isCity(): plotCity = plot.getPlotCity() if not plotCity.isHasRealBuilding(iPlague): self.infectCity(plotCity) else: if data.players[iPlayer].bFirstContactPlague: continue if self.isVulnerable(plot.getOwner()): self.spreadPlague(plot.getOwner()) self.infectCitiesNear(plot.getOwner(), x, y)
def spreadToSurroundings(self, city): iPlayer = city.getOwner() # do not spread if plague is almost over if data.players[iPlayer].iPlagueCountdown <= 2: return for (x, y) in utils.surroundingPlots((city.getX(), city.getY()), 2): plot = gc.getMap().plot(x, y) if not plot.isOwned(): continue if (city.getX(), city.getY()) == (x, y): continue if plot.getOwner() == iPlayer: if plot.isCity(): plotCity = plot.getPlotCity() if not plotCity.isHasRealBuilding(iPlague): self.infectCity(plotCity) else: if data.players[iPlayer].bFirstContactPlague: continue if self.isVulnerable(plot.getOwner()): self.spreadPlague(plot.getOwner()) self.infectCitiesNear(plot.getOwner(), x, y)
def getUHVTileInfo(argsList): x = argsList[0] y = argsList[1] iPlayer = argsList[2] plot = gc.getMap().plot(x, y) if iPlayer == iGreece: if (x, y) in Areas.getNormalArea(iEgypt, False): return 0 if (x, y) in Areas.getNormalArea(iCarthage, False): return 1 if (x, y) in Areas.getNormalArea(iBabylonia, False): return 2 if (x, y) in Areas.getNormalArea(iPersia, False): return 3 elif iPlayer == iPersia and CyGlobalContext().getPlayer( iPersia).isReborn(): if utils.isPlotInArea((x, y), vic.tSafavidMesopotamiaTL, vic.tSafavidMesopotamiaBR): return 4 if utils.isPlotInArea((x, y), vic.tTransoxaniaTL, vic.tTransoxaniaBR): return 5 if utils.isPlotInArea((x, y), vic.tNWIndiaTL, vic.tNWIndiaBR, vic.tNWIndiaExceptions): return 6 elif iPlayer == iCarthage: if utils.isPlotInArea((x, y), Areas.tNormalArea[iItaly][0], Areas.tNormalArea[iItaly][1], [(62, 47), (63, 47), (63, 46)]): return 37 if (x, y) in Areas.getNormalArea(iSpain, False): return 8 elif iPlayer == iItaly: if utils.isPlotInArea( (x, y), vic.tMediterraneanTL, vic.tMediterraneanBR, vic. tMediterraneanExceptions) and CyGlobalContext().getMap().plot( x, y).isCoastalLand(): return 7 elif iPlayer == iRome: if (x, y) in Areas.getNormalArea(iSpain, False): return 8 if utils.isPlotInArea((x, y), vic.tFranceTL, Areas.tNormalArea[iFrance][1]): return 9 if (x, y) in Areas.getCoreArea(iEngland, False): return 10 if utils.isPlotInArea((x, y), vic.tCarthageTL, vic.tCarthageBR): return 11 if (x, y) in Areas.getCoreArea(iByzantium, False): return 12 if (x, y) in Areas.getCoreArea(iEgypt, False): return 13 elif iPlayer == iJapan: if utils.isPlotInArea((x, y), vic.tKoreaTL, vic.tKoreaBR): return 14 if utils.isPlotInArea((x, y), vic.tManchuriaTL, vic.tManchuriaBR): return 15 if utils.isPlotInArea((x, y), vic.tChinaTL, vic.tChinaBR): return 16 if utils.isPlotInArea((x, y), vic.tIndochinaTL, vic.tIndochinaBR, vic.tIndochinaExceptions): return 17 if utils.isPlotInArea((x, y), vic.tIndonesiaTL, vic.tIndonesiaBR): return 18 if utils.isPlotInArea((x, y), vic.tPhilippinesTL, vic.tPhilippinesBR): return 19 elif iPlayer == iEthiopia: if gc.getMap().plot(x, y).getRegionID() in lAfrica: return 33 elif iPlayer == iByzantium: if utils.isPlotInArea((x, y), vic.tBalkansTL, vic.tBalkansBR): return 21 if utils.isPlotInArea((x, y), vic.tNorthAfricaTL, vic.tNorthAfricaBR): return 22 if utils.isPlotInArea((x, y), vic.tNearEastTL, vic.tNearEastBR): return 23 elif iPlayer == iArabia: if (x, y) in Areas.getCoreArea(iEgypt, False): return 24 if utils.isPlotInArea((x, y), vic.tCarthageTL, vic.tCarthageBR): return 25 if (x, y) in Areas.getCoreArea(iBabylonia, False): return 26 if (x, y) in Areas.getCoreArea(iPersia, False): return 27 if (x, y) in Areas.getNormalArea(iSpain, False): return 28 elif iPlayer == iSpain: if utils.isPlotInArea((x, y), vic.tEuropeTL, vic.tEuropeBR): return 29 elif utils.isPlotInArea((x, y), vic.tEasternEuropeTL, vic.tEasternEuropeBR): return 29 elif iPlayer == iFrance: if utils.isPlotInArea((x, y), vic.tEuropeTL, vic.tEuropeBR): return 29 elif utils.isPlotInArea((x, y), vic.tEasternEuropeTL, vic.tEasternEuropeBR): return 29 if utils.isPlotInArea((x, y), vic.tNorthAmericaTL, vic.tNorthAmericaBR): return 30 elif iPlayer == iEngland: if plot.getRegionID() in lNorthAmerica: return 31 if plot.getRegionID() in lSouthAmerica: return 32 if plot.getRegionID() in lAfrica: return 33 if plot.getRegionID() in lAsia: return 34 if plot.getRegionID() in lOceania: return 35 elif iPlayer == iGermany: if (x, y) in Areas.getNormalArea(iFrance, False): return 36 if (x, y) in Areas.getNormalArea(iItaly, False): return 37 if (x, y) in Areas.getNormalArea(iRussia, False): return 38 if (x, y) in Areas.getNormalArea(iEngland, False): return 39 if (x, y) in Areas.getNormalArea(iVikings, False): return 40 elif iPlayer == iBurma: if utils.isPlotInArea((x, y), vic.tIndochinaTL, vic.tIndochinaBR, vic.tIndochinaExceptions): return 17 elif iPlayer == iKhazars: if (x, y) in vic.lDanube: return 87 if (x, y) in vic.lZaysan: return 88 elif iPlayer == iChad: if utils.isPlotInArea((x, y), vic.tCameroonTL, vic.tCameroonBR): return 102 if utils.isPlotInArea((x, y), vic.tNigeriaTL, vic.tNigeriaBR): return 103 if utils.isPlotInArea((x, y), vic.tLibyaTL, vic.tLibyaBR): return 104 elif iPlayer == iRussia: if utils.isPlotInArea((x, y), vic.tSiberiaTL, vic.tSiberiaBR): return 41 elif iPlayer == iInca: if (x, y) in vic.lAndeanCoast: return 42 if utils.isPlotInArea((x, y), vic.tSAmericaTL, vic.tSAmericaBR, vic.tSouthAmericaExceptions): return 43 elif iPlayer == iOttomans: if (x, y) in vic.lEasternMediterranean: return 47 if (x, y) in vic.lBlackSea: return 48 if (x, y) in utils.surroundingPlots(vic.tCairo): return 49 if (x, y) in utils.surroundingPlots(vic.tMecca): return 50 if (x, y) in utils.surroundingPlots(vic.tBaghdad): return 51 if (x, y) in utils.surroundingPlots(vic.tVienna): return 52 elif iPlayer in [iThailand, iVietnam]: if utils.isPlotInArea((x, y), vic.tSouthAsiaTL, vic.tSouthAsiaBR): return 53 elif iPlayer == iAmerica: if utils.isPlotInArea((x, y), vic.tNCAmericaTL, vic.tNCAmericaBR): return 54 elif iPlayer == iTamils: if utils.isPlotInArea((x, y), vic.tDeccanTL, vic.tDeccanBR): return 55 if utils.isPlotInArea((x, y), vic.tSrivijayaTL, vic.tSrivijayaBR): return 56 elif iPlayer == iMoors: if utils.isPlotInArea((x, y), vic.tIberiaTL, vic.tIberiaBR): return 57 if utils.isPlotInArea((x, y), vic.tMaghrebTL, vic.tMaghrebBR): return 58 if utils.isPlotInArea((x, y), vic.tWestAfricaTL, vic.tWestAfricaBR): return 59 elif iPlayer == iPortugal: if plot.getRegionID() in lAfrica: return 33 if plot.getRegionID() in lAsia: return 34 if utils.isPlotInArea((x, y), vic.tBrazilTL, vic.tBrazilBR): return 60 elif iPlayer == iMaya: if utils.isReborn(iPlayer): if utils.isPlotInArea((x, y), vic.tPeruTL, vic.tPeruBR): return 43 if utils.isPlotInArea((x, y), vic.tGranColombiaTL, vic.tGranColombiaBR): return 44 if utils.isPlotInArea((x, y), vic.tGuayanasTL, vic.tGuayanasBR): return 45 if utils.isPlotInArea((x, y), vic.tCaribbeanTL, vic.tCaribbeanBR): return 46 if utils.isPlotInArea((x, y), vic.tSAmericaTL, vic.tSAmericaBR, vic.tSouthAmericaExceptions): return 61 elif iPlayer == iCanada: if (x, y) in vic.lAtlanticCoast: return 63 if (x, y) in vic.lPacificCoast: return 64 if utils.isPlotInArea((x, y), vic.tCanadaWestTL, vic.tCanadaWestBR, vic.tCanadaWestExceptions) or utils.isPlotInArea( (x, y), vic.tCanadaEastTL, vic.tCanadaEastBR, vic.tCanadaEastExceptions): return 62 elif iPlayer == iPolynesia: if utils.isPlotInArea((x, y), vic.tHawaiiTL, vic.tHawaiiBR): return 65 if utils.isPlotInArea((x, y), vic.tNewZealandTL, vic.tNewZealandBR): return 66 if utils.isPlotInArea((x, y), vic.tMarquesasTL, vic.tMarquesasBR): return 67 if utils.isPlotInArea((x, y), vic.tEasterIslandTL, vic.tEasterIslandBR): return 68 elif iPlayer == iMongolia: if (x, y) in Areas.getNormalArea(iChina, False): return 69 elif iPlayer == iTurks: if (x, y) in vic.lMediterraneanPorts: return 70 if utils.isPlotInArea((x, y), vic.tChinaTL, vic.tChinaBR): return 71 elif iPlayer == iTeotihuacan: if utils.isPlotInArea((x, y), vic.tMesoamericaTL, vic.tMesoamericaBR): return 86 elif iPlayer == iSweden: if (x, y) in vic.lSkagerrak or (x, y) in vic.lSkagerrak: return 72 if (x, y) in vic.lBalticSea or (x, y) in vic.lBalticSea: return 73 elif iPlayer == iAustralia: if utils.isPlotInArea((x, y), vic.tAustraliaTL, vic.tAustraliaBR): return 74 if utils.isPlotInArea((x, y), vic.tNewZealandTL, vic.tNewZealandBR): return 66 if utils.isPlotInArea((x, y), vic.tNewGuineaTL, vic.tNewGuineaBR): return 75 if utils.isPlotInArea( (x, y), vic.tPacific1TL, vic.tPacific1BR) or utils.isPlotInArea( (x, y), vic.tPacific2TL, vic.tPacific2BR) or utils.isPlotInArea( (x, y), vic.tPacific3TL, vic.tPacific3BR) or utils.isPlotInArea( (x, y), vic.tHawaiiTL, vic.tHawaiiBR): return 76 elif iPlayer == iMamluks: if utils.isPlotInArea( (x, y), vic.tLowerNileTL, vic.tLowerNileBR) and gc.getMap().plot( x, y).isRiver(): if utils.isPlotInArea((x, y), vic.tNorthAfricaTL, vic.tNorthAfricaBR): return 80 return 79 if utils.isPlotInArea((x, y), vic.tNorthAfricaTL, vic.tNorthAfricaBR): return 22 if utils.isPlotInArea((x, y), vic.tHejazTL, vic.tHejazBR, vic.tHejazExceptions): return 77 if utils.isPlotInArea((x, y), vic.tLevantTL, vic.tLevantBR): return 78 if (x, y) in Areas.getCoreArea(iBabylonia, False): return 4 elif iPlayer == iManchuria: if gc.getMap().plot(x, y).getSettlerValue(iManchuria) >= 90: return 81 elif iPlayer == iBoers: if utils.isPlotInArea((x, y), vic.tBoerAfricaTL, vic.tBoerAfricaBR): return 82 elif iPlayer == iZimbabwe: if utils.isPlotInArea((x, y), vic.tSubeqAfricaTL, vic.tSubeqAfricaBR): return 83 if utils.isPlotInArea((x, y), vic.tSubSaharaTL, vic.tSubSaharaBR, vic.tSubSaharaExceptions): return 84 elif iPlayer == iSwahili: if gc.getMap().plot(x, y).getRegionID() == rAustralia: return 74 elif iPlayer == iKievanRus: if (x, y) in vic.lMediterraneanCoast: return 7 if (x, y) in vic.lBarents: return 85 elif iPlayer == iHungary: if gc.getMap().plot( x, y).getRegionID() in [rIberia, rEurope, rItaly, rBalkans]: return 29 elif iPlayer == iCeltia: if utils.isPlotInArea( (x, y), vic.tFranceTL, Areas.tNormalArea[iFrance][1]) or (x, y) == (56, 46): return 89 if utils.isPlotInArea((x, y), vic.tGermaniaTL, vic.tGermaniaBR): return 90 if gc.getMap().plot(x, y).getRegionID() == rItaly: return 91 if gc.getMap().plot(x, y).getRegionID() == rBritain: return 92 if gc.getMap().plot(x, y).getRegionID() == rIberia: return 8 elif iPlayer == iNorteChico: if utils.isReborn(iPlayer): if (x, y) in Areas.getCoreArea(iInca, False): return 95 if (x, y) in utils.isPlotInArea((x, y), vic.tChimuTL, vic.tChimuBR): return 96 elif iPlayer == iMississippi: if (x, y) in vic.lMississippiRiver: if (x, y) in vic.lOhioRiver: return 99 elif (x, y) in vic.lGreatLakes: return 101 return 98 elif (x, y) in vic.lGreatLakes: return 100 elif (x, y) in vic.lOhioRiver: return 97 elif iPlayer == iInuit: if (x, y) in vic.lKivalliq: return 105 if utils.isPlotInArea((x, y), vic.tNunavikTL, vic.tNunavikBR, vic.tNunavikExceptions): return 106 if utils.isPlotInArea((x, y), vic.tQikiqtaalukTL, vic.tQikiqtaalukBR, vic.tQikiqtaalukExceptions): return 107 if utils.isPlotInArea((x, y), vic.tKalaallitNunaatTL, vic.tKalaallitNunaatBR, vic.tKalaallitNunaatExceptions): return 108 elif iPlayer == iYuezhi: if (x, y) in Areas.getCoreArea(iYuezhi, True) and y <= 43: return 109 elif iPlayer == iXiongnu: if (x, y) in utils.getRegionPlots(lEurope): return 29 if (x, y) in utils.getRegionPlots(lIndia): return 110 # continue with 111 return -1
def doImmigration(self): # get available migration and immigration cities lSourceCities = [] lTargetCities = [] for iPlayer in range(iNumPlayers): if iPlayer in lCivBioNewWorld and not utils.isReborn(iPlayer): continue # no immigration to natives pPlayer = gc.getPlayer(iPlayer) lCities = [] bNewWorld = pPlayer.getCapitalCity().getRegionID() in lNewWorld for city in utils.getCityList(iPlayer): iFoodDifference = city.foodDifference(False) iHappinessDifference = city.happyLevel() - city.unhappyLevel(0) if city.getRegionID() in lNewWorld and bNewWorld: if iFoodDifference <= 0 or iHappinessDifference <= 0: continue iNorthAmericaBonus = 0 if city.getRegionID() in [rCanada, rUnitedStates]: iNorthAmericaBonus = 5 lCities.append((city, iHappinessDifference + iFoodDifference / 2 + city.getPopulation() / 2 + iNorthAmericaBonus)) elif city.getRegionID() not in lNewWorld and not bNewWorld: iValue = 0 if iFoodDifference < 0: iValue -= iFoodDifference / 2 if iHappinessDifference < 0: iValue -= iHappinessDifference if iValue > 0: lCities.append((city, iValue)) if lCities: lCities.sort(key=itemgetter(1), reverse=True) if bNewWorld: lTargetCities.append(lCities[0]) else: lSourceCities.append(lCities[0]) # sort highest to lowest for happiness/unhappiness lSourceCities.sort(key=itemgetter(1), reverse=True) lTargetCities.sort(key=itemgetter(1), reverse=True) #utils.debugTextPopup(str([(x.getName(), y) for (x,y) in lTargetCities])) #utils.debugTextPopup("Target city: "+targetCity.getName()) #utils.debugTextPopup("Source city: "+sourceCity.getName()) iNumMigrations = min(len(lSourceCities) / 4, len(lTargetCities)) for iMigration in range(iNumMigrations): sourceCity = lSourceCities[iMigration][0] targetCity = lTargetCities[iMigration][0] sourceCity.changePopulation(-1) targetCity.changePopulation(1) if sourceCity.getPopulation() >= 9: sourceCity.changePopulation(-1) targetCity.changePopulation(1) # extra cottage growth for target city's vicinity x = targetCity.getX() y = targetCity.getY() for (i, j) in utils.surroundingPlots((x, y), 2): pCurrent = gc.getMap().plot(i, j) if pCurrent.getWorkingCity() == targetCity: pCurrent.changeUpgradeProgress(utils.getTurns(10)) # migration brings culture targetPlot = gc.getMap().plot(x, y) iTargetPlayer = targetCity.getOwner() iSourcePlayer = sourceCity.getOwner() iCultureChange = targetPlot.getCulture(iTargetPlayer) / targetCity.getPopulation() targetPlot.setCulture(iSourcePlayer, iCultureChange, False) # chance to spread state religion if in source city if gc.getPlayer(iSourcePlayer).isStateReligion(): iReligion = gc.getPlayer(iSourcePlayer).getStateReligion() if sourceCity.isHasReligion(iReligion) and not targetCity.isHasReligion(iReligion): iRandom = gc.getGame().getSorenRandNum(3, 'random religion spread') if iRandom == 0: targetCity.setHasReligion(iReligion, True, True, True) # notify affected players if utils.getHumanID() == iSourcePlayer: CyInterface().addMessage(iSourcePlayer, False, iDuration, CyTranslator().getText("TXT_KEY_UP_EMIGRATION", (sourceCity.getName(),)), "", InterfaceMessageTypes.MESSAGE_TYPE_MINOR_EVENT, gc.getUnitInfo(iSettler).getButton(), ColorTypes(iYellow), sourceCity.getX(), sourceCity.getY(), True, True) elif utils.getHumanID() == iTargetPlayer: CyInterface().addMessage(iTargetPlayer, False, iDuration, CyTranslator().getText("TXT_KEY_UP_IMMIGRATION", (targetCity.getName(),)), "", InterfaceMessageTypes.MESSAGE_TYPE_MINOR_EVENT, gc.getUnitInfo(iSettler).getButton(), ColorTypes(iYellow), x, y, True, True) if iTargetPlayer == iCanada: self.canadianUP(targetCity)
def doAliyah(self): # get available emigration cities lSourceCities = [] # get target city: always the israeli capital pIsrael = gc.getPlayer(iIsrael) targetCity = pIsrael.getCapitalCity() for iPlayer in range(iNumPlayers): pPlayer = gc.getPlayer(iPlayer) # get Jewish cities of civs at war with Israel if gc.getTeam(pPlayer.getTeam()).isAtWar(iIsrael): for city in utils.getCityList(iPlayer): if city.isHasReligion(iJudaism): lSourceCities.append(city) #utils.debugTextPopup(str([(x.getName(), y) for (x,y) in lTargetCities])) #utils.debugTextPopup("Target city: "+targetCity.getName()) #utils.debugTextPopup("Source city: "+sourceCity.getName()) iNumMigrations = 0 if len(lSourceCities) > 0: iNumMigrations = (len(lSourceCities) / 4) + 1 for iMigration in range(iNumMigrations): sourceCity = utils.getRandomEntry(lSourceCities) lSourceCities.remove(sourceCity) sourceCity.changePopulation(-1) targetCity.changePopulation(1) # if sourceCity.getPopulation() >= 9: # sourceCity.changePopulation(-1) # targetCity.changePopulation(1) # extra cottage growth for target city's vicinity x = targetCity.getX() y = targetCity.getY() for (i, j) in utils.surroundingPlots((x, y), 2): pCurrent = gc.getMap().plot(i, j) if pCurrent.getWorkingCity() == targetCity: pCurrent.changeUpgradeProgress(utils.getTurns(10)) # migration brings culture targetPlot = gc.getMap().plot(x, y) iTargetPlayer = targetCity.getOwner() iSourcePlayer = sourceCity.getOwner() iCultureChange = targetPlot.getCulture( iTargetPlayer) / targetCity.getPopulation() targetPlot.setCulture(iSourcePlayer, iCultureChange, False) # remove Judaism from source city if sourceCity.isHasReligion( iJudaism) and not sourceCity.isHolyCityByType(iJudaism): sourceCity.setHasReligion(iJudaism, False, True, True) # in the rare event that the Israeli capital is not Jewish, make it so if not targetCity.isHasReligion(iJudaism): targetCity.setHasReligion(iJudaism, True, True, True) # notify affected players if utils.getHumanID() == iSourcePlayer: CyInterface().addMessage( iSourcePlayer, False, iDuration, CyTranslator().getText("TXT_KEY_UP_EMIGRATION_ALIYAH", (sourceCity.getName(), )), "", InterfaceMessageTypes.MESSAGE_TYPE_MINOR_EVENT, gc.getUnitInfo(iSettler).getButton(), ColorTypes(iYellow), sourceCity.getX(), sourceCity.getY(), True, True) elif utils.getHumanID() == iTargetPlayer: CyInterface().addMessage( iTargetPlayer, False, iDuration, CyTranslator().getText( "TXT_KEY_UP_IMMIGRATION_ALIYAH", (sourceCity.getName(), gc.getPlayer(iSourcePlayer). getCivilizationShortDescriptionKey(), targetCity.getName())), "", InterfaceMessageTypes.MESSAGE_TYPE_MINOR_EVENT, gc.getUnitInfo(iSettler).getButton(), ColorTypes(iYellow), x, y, True, True)
def doJewishKingdom(self): # get available migration and immigration cities lSourceCities = [] lTargetCities = [] for iPlayer in range(iNumPlayers): pPlayer = gc.getPlayer(iPlayer) lCities = [] for city in utils.getCityList(iPlayer): iFoodDifference = city.foodDifference(False) iHappinessDifference = city.happyLevel() - city.unhappyLevel(0) if iPlayer == iKhazars: if iFoodDifference <= 0 or iHappinessDifference <= 0: continue lCities.append( (city, iHappinessDifference + iFoodDifference / 2 + city.getPopulation() / 2)) else: iValue = 0 if iFoodDifference < 0: iValue -= iFoodDifference / 2 if iHappinessDifference < 0: iValue -= iHappinessDifference if iValue > 0: lCities.append((city, iValue)) if lCities: lCities.sort(key=itemgetter(1), reverse=True) if iPlayer == iKhazars: lTargetCities.append(lCities[0]) else: lSourceCities.append(lCities[0]) # sort highest to lowest for happiness/unhappiness lSourceCities.sort(key=itemgetter(1), reverse=True) lTargetCities.sort(key=itemgetter(1), reverse=True) #utils.debugTextPopup(str([(x.getName(), y) for (x,y) in lTargetCities])) #utils.debugTextPopup("Target city: "+targetCity.getName()) #utils.debugTextPopup("Source city: "+sourceCity.getName()) iNumMigrations = min(len(lSourceCities) / 4, len(lTargetCities)) for iMigration in range(iNumMigrations): sourceCity = lSourceCities[iMigration][0] targetCity = lTargetCities[iMigration][0] sourceCity.changePopulation(-1) targetCity.changePopulation(1) if sourceCity.getPopulation() >= 9: sourceCity.changePopulation(-1) targetCity.changePopulation(1) # extra cottage growth for target city's vicinity x = targetCity.getX() y = targetCity.getY() for (i, j) in utils.surroundingPlots((x, y), 2): pCurrent = gc.getMap().plot(i, j) if pCurrent.getWorkingCity() == targetCity: pCurrent.changeUpgradeProgress(utils.getTurns(10)) # migration brings culture targetPlot = gc.getMap().plot(x, y) iTargetPlayer = targetCity.getOwner() iSourcePlayer = sourceCity.getOwner() iCultureChange = targetPlot.getCulture( iTargetPlayer) / targetCity.getPopulation() targetPlot.changeCulture(iSourcePlayer, iCultureChange, False) # remove Judaism from source city if sourceCity.isHasReligion( iJudaism) and not sourceCity.isHolyCityByType(iJudaism): sourceCity.setHasReligion(iJudaism, False, True, True) # in the rare event that the Israeli capital is not Jewish, make it so if not targetCity.isHasReligion(iJudaism): targetCity.setHasReligion(iJudaism, True, True, True) # notify affected players if utils.getHumanID() == iSourcePlayer: CyInterface().addMessage( iSourcePlayer, False, iDuration, CyTranslator().getText( "TXT_KEY_UP_EMIGRATION_JEWISH_KINGDOM", (sourceCity.getName(), )), "", InterfaceMessageTypes.MESSAGE_TYPE_MINOR_EVENT, gc.getUnitInfo(iSettler).getButton(), ColorTypes(iYellow), sourceCity.getX(), sourceCity.getY(), True, True) elif utils.getHumanID() == iTargetPlayer: CyInterface().addMessage( iTargetPlayer, False, iDuration, CyTranslator().getText( "TXT_KEY_UP_IMMIGRATION_JEWISH_KINGDOM", (targetCity.getName(), )), "", InterfaceMessageTypes.MESSAGE_TYPE_MINOR_EVENT, gc.getUnitInfo(iSettler).getButton(), ColorTypes(iYellow), x, y, True, True)
def doImmigration(self): # get available migration and immigration cities lSourceCities = [] lTargetCities = [] for iPlayer in range(iNumPlayers): if iPlayer in lCivBioNewWorld and not utils.isReborn(iPlayer): continue # no immigration to natives pPlayer = gc.getPlayer(iPlayer) lCities = [] bNewWorld = pPlayer.getCapitalCity().getRegionID() in lNewWorld for city in utils.getCityList(iPlayer): iFoodDifference = city.foodDifference(False) iHappinessDifference = city.happyLevel() - city.unhappyLevel(0) if city.getRegionID() in lNewWorld and bNewWorld: if iFoodDifference <= 0 or iHappinessDifference <= 0: continue iNorthAmericaBonus = 0 if city.getRegionID() in [rCanada, rUnitedStates]: iNorthAmericaBonus = 5 lCities.append( (city, iHappinessDifference + iFoodDifference / 2 + city.getPopulation() / 2 + iNorthAmericaBonus)) elif city.getRegionID() not in lNewWorld and not bNewWorld: iValue = 0 if iFoodDifference < 0: iValue -= iFoodDifference / 2 if iHappinessDifference < 0: iValue -= iHappinessDifference if iValue > 0: lCities.append((city, iValue)) if lCities: lCities.sort(key=itemgetter(1), reverse=True) if bNewWorld: lTargetCities.append(lCities[0]) else: lSourceCities.append(lCities[0]) # sort highest to lowest for happiness/unhappiness lSourceCities.sort(key=itemgetter(1), reverse=True) lTargetCities.sort(key=itemgetter(1), reverse=True) #utils.debugTextPopup(str([(x.getName(), y) for (x,y) in lTargetCities])) #utils.debugTextPopup("Target city: "+targetCity.getName()) #utils.debugTextPopup("Source city: "+sourceCity.getName()) iNumMigrations = min(len(lSourceCities) / 4, len(lTargetCities)) for iMigration in range(iNumMigrations): sourceCity = lSourceCities[iMigration][0] targetCity = lTargetCities[iMigration][0] sourceCity.changePopulation(-1) targetCity.changePopulation(1) if sourceCity.getPopulation() >= 9: sourceCity.changePopulation(-1) targetCity.changePopulation(1) # extra cottage growth for target city's vicinity x = targetCity.getX() y = targetCity.getY() for (i, j) in utils.surroundingPlots((x, y), 2): pCurrent = gc.getMap().plot(i, j) if pCurrent.getWorkingCity() == targetCity: pCurrent.changeUpgradeProgress(utils.getTurns(10)) # migration brings culture targetPlot = gc.getMap().plot(x, y) iTargetPlayer = targetCity.getOwner() iSourcePlayer = sourceCity.getOwner() iCultureChange = targetPlot.getCulture( iTargetPlayer) / targetCity.getPopulation() targetPlot.changeCulture(iSourcePlayer, iCultureChange, False) # chance to spread state religion if in source city if gc.getPlayer(iSourcePlayer).isStateReligion(): iReligion = gc.getPlayer(iSourcePlayer).getStateReligion() if sourceCity.isHasReligion( iReligion) and not targetCity.isHasReligion(iReligion): iRandom = gc.getGame().getSorenRandNum( 3, 'random religion spread') if iRandom == 0: targetCity.setHasReligion(iReligion, True, True, True) # notify affected players if utils.getHumanID() == iSourcePlayer: CyInterface().addMessage( iSourcePlayer, False, iDuration, CyTranslator().getText("TXT_KEY_UP_EMIGRATION", (sourceCity.getName(), )), "", InterfaceMessageTypes.MESSAGE_TYPE_MINOR_EVENT, gc.getUnitInfo(iSettler).getButton(), ColorTypes(iYellow), sourceCity.getX(), sourceCity.getY(), True, True) elif utils.getHumanID() == iTargetPlayer: CyInterface().addMessage( iTargetPlayer, False, iDuration, CyTranslator().getText("TXT_KEY_UP_IMMIGRATION", (targetCity.getName(), )), "", InterfaceMessageTypes.MESSAGE_TYPE_MINOR_EVENT, gc.getUnitInfo(iSettler).getButton(), ColorTypes(iYellow), x, y, True, True) if iTargetPlayer == iCanada: self.canadianUP(targetCity)
def getUHVTileInfo(argsList): x = argsList[0] y = argsList[1] iPlayer = argsList[2] if iPlayer == iGreece: if (x, y) in Areas.getNormalArea(iEgypt, False): return 0 if (x, y) in Areas.getNormalArea(iCarthage, False): return 1 if (x, y) in Areas.getNormalArea(iBabylonia, False): return 2 if (x, y) in Areas.getNormalArea(iPersia, False): return 3 elif iPlayer == iPersia and CyGlobalContext().getPlayer( iPersia).isReborn(): if utils.isPlotInArea((x, y), vic.tSafavidMesopotamiaTL, vic.tSafavidMesopotamiaBR): return 4 if utils.isPlotInArea((x, y), vic.tTransoxaniaTL, vic.tTransoxaniaBR): return 5 if utils.isPlotInArea((x, y), vic.tNWIndiaTL, vic.tNWIndiaBR, vic.tNWIndiaExceptions): return 6 elif iPlayer == iCarthage: if utils.isPlotInArea((x, y), Areas.tNormalArea[iItaly][0], Areas.tNormalArea[iItaly][1], [(62, 47), (63, 47), (63, 46)]): return 37 if (x, y) in Areas.getNormalArea(iSpain, False): return 8 elif iPlayer == iItaly: if utils.isPlotInArea( (x, y), vic.tMediterraneanTL, vic.tMediterraneanBR, vic. tMediterraneanExceptions) and CyGlobalContext().getMap().plot( x, y).isCoastalLand(): return 7 elif iPlayer == iRome: if (x, y) in Areas.getNormalArea(iSpain, False): return 8 if utils.isPlotInArea((x, y), vic.tFranceTL, Areas.tNormalArea[iFrance][1]): return 9 if (x, y) in Areas.getCoreArea(iEngland, False): return 10 if utils.isPlotInArea((x, y), vic.tCarthageTL, vic.tCarthageBR): return 11 if (x, y) in Areas.getCoreArea(iByzantium, False): return 12 if (x, y) in Areas.getCoreArea(iEgypt, False): return 13 elif iPlayer == iJapan: if utils.isPlotInArea((x, y), vic.tKoreaTL, vic.tKoreaBR): return 14 if utils.isPlotInArea((x, y), vic.tManchuriaTL, vic.tManchuriaBR): return 15 if utils.isPlotInArea((x, y), vic.tChinaTL, vic.tChinaBR): return 16 if utils.isPlotInArea((x, y), vic.tIndochinaTL, vic.tIndochinaBR, vic.tIndochinaExceptions): return 17 if utils.isPlotInArea((x, y), vic.tIndonesiaTL, vic.tIndonesiaBR): return 18 if utils.isPlotInArea((x, y), vic.tPhilippinesTL, vic.tPhilippinesBR): return 19 elif iPlayer == iEthiopia: if gc.getMap().plot(x, y).getRegionID() in lAfrica: return 33 elif iPlayer == iByzantium: if utils.isPlotInArea((x, y), vic.tBalkansTL, vic.tBalkansBR): return 21 if utils.isPlotInArea((x, y), vic.tNorthAfricaTL, vic.tNorthAfricaBR): return 22 if utils.isPlotInArea((x, y), vic.tNearEastTL, vic.tNearEastBR): return 23 elif iPlayer == iArabia: if (x, y) in Areas.getCoreArea(iEgypt, False): return 24 if utils.isPlotInArea((x, y), vic.tCarthageTL, vic.tCarthageBR): return 25 if (x, y) in Areas.getCoreArea(iBabylonia, False): return 26 if (x, y) in Areas.getCoreArea(iPersia, False): return 27 if (x, y) in Areas.getNormalArea(iSpain, False): return 28 elif iPlayer == iSpain: if utils.isPlotInArea((x, y), vic.tEuropeTL, vic.tEuropeBR): return 29 elif utils.isPlotInArea((x, y), vic.tEasternEuropeTL, vic.tEasternEuropeBR): return 29 elif iPlayer == iFrance: if utils.isPlotInArea((x, y), vic.tEuropeTL, vic.tEuropeBR): return 29 elif utils.isPlotInArea((x, y), vic.tEasternEuropeTL, vic.tEasternEuropeBR): return 29 if utils.isPlotInArea((x, y), vic.tNorthAmericaTL, vic.tNorthAmericaBR): return 30 elif iPlayer == iEngland: if utils.isPlotInArea((x, y), vic.tNorthAmericaTL, vic.tNorthAmericaBR): return 31 if utils.isPlotInArea((x, y), vic.tSouthCentralAmericaTL, vic.tSouthCentralAmericaBR): return 32 if utils.isPlotInArea((x, y), vic.tAfricaTL, vic.tAfricaBR): return 33 if utils.isPlotInArea((x, y), vic.tAsiaTL, vic.tAsiaBR): return 34 if utils.isPlotInArea((x, y), vic.tOceaniaTL, vic.tOceaniaBR): return 35 elif iPlayer == iGermany: if (x, y) in Areas.getNormalArea(iFrance, False): return 36 if (x, y) in Areas.getNormalArea(iItaly, False): return 37 if (x, y) in Areas.getNormalArea(iRussia, False): return 38 if (x, y) in Areas.getNormalArea(iEngland, False): return 39 if (x, y) in Areas.getNormalArea(iVikings, False): return 40 elif iPlayer == iRussia: if utils.isPlotInArea((x, y), vic.tSiberiaTL, vic.tSiberiaBR): return 41 elif iPlayer == iInca: if (x, y) in vic.lAndeanCoast: return 42 if utils.isPlotInArea((x, y), vic.tSAmericaTL, vic.tSAmericaBR, vic.tSouthAmericaExceptions): return 43 elif iPlayer == iOttomans: if (x, y) in vic.lEasternMediterranean: return 47 if (x, y) in vic.lBlackSea: return 48 if (x, y) in utils.surroundingPlots(vic.tCairo): return 49 if (x, y) in utils.surroundingPlots(vic.tMecca): return 50 if (x, y) in utils.surroundingPlots(vic.tBaghdad): return 51 if (x, y) in utils.surroundingPlots(vic.tVienna): return 52 elif iPlayer == iThailand: if utils.isPlotInArea((x, y), vic.tSouthAsiaTL, vic.tSouthAsiaBR): return 53 elif iPlayer == iAmerica: if utils.isPlotInArea((x, y), vic.tNCAmericaTL, vic.tNCAmericaBR): return 54 elif iPlayer == iTamils: if utils.isPlotInArea((x, y), vic.tDeccanTL, vic.tDeccanBR): return 55 if utils.isPlotInArea((x, y), vic.tSrivijayaTL, vic.tSrivijayaBR): return 56 elif iPlayer == iMoors: if utils.isPlotInArea((x, y), vic.tIberiaTL, vic.tIberiaBR): return 57 if utils.isPlotInArea((x, y), vic.tMaghrebTL, vic.tMaghrebBR): return 58 if utils.isPlotInArea((x, y), vic.tWestAfricaTL, vic.tWestAfricaBR): return 59 elif iPlayer == iPortugal: if utils.isPlotInArea((x, y), vic.tAfricaTL, vic.tAfricaBR): return 33 if utils.isPlotInArea((x, y), vic.tAsiaTL, vic.tAsiaBR): return 34 if utils.isPlotInArea((x, y), vic.tBrazilTL, vic.tBrazilBR): return 60 elif iPlayer == iMaya: if utils.isReborn(iPlayer): if utils.isPlotInArea((x, y), vic.tPeruTL, vic.tPeruBR): return 43 if utils.isPlotInArea((x, y), vic.tGranColombiaTL, vic.tGranColombiaBR): return 44 if utils.isPlotInArea((x, y), vic.tGuayanasTL, vic.tGuayanasBR): return 45 if utils.isPlotInArea((x, y), vic.tCaribbeanTL, vic.tCaribbeanBR): return 46 if utils.isPlotInArea((x, y), vic.tSAmericaTL, vic.tSAmericaBR, vic.tSouthAmericaExceptions): return 61 elif iPlayer == iCanada: if (x, y) in vic.lAtlanticCoast: return 63 if (x, y) in vic.lPacificCoast: return 64 if utils.isPlotInArea((x, y), vic.tCanadaWestTL, vic.tCanadaWestBR, vic.tCanadaWestExceptions) or utils.isPlotInArea( (x, y), vic.tCanadaEastTL, vic.tCanadaEastBR, vic.tCanadaEastExceptions): return 62 elif iPlayer == iPolynesia: if utils.isPlotInArea((x, y), vic.tHawaiiTL, vic.tHawaiiBR): return 65 if utils.isPlotInArea((x, y), vic.tNewZealandTL, vic.tNewZealandBR): return 66 if utils.isPlotInArea((x, y), vic.tMarquesasTL, vic.tMarquesasBR): return 67 if utils.isPlotInArea((x, y), vic.tEasterIslandTL, vic.tEasterIslandBR): return 68 elif iPlayer == iMongolia: if (x, y) in Areas.getNormalArea(iChina, False): return 69 elif iPlayer == iTurks: if (x, y) in vic.lMediterraneanPorts: return 70 if utils.isPlotInArea((x, y), vic.tChinaTL, vic.tChinaBR): return 71 # free IDs: 20 # continue with ID 72 return -1