def foundCity(self, iPlayer, tPlot, sName, iPopulation, iUnitType=-1, iNumUnits=-1, lReligions=[]): pPlayer = gc.getPlayer(iPlayer) x, y = tPlot plot = gc.getMap().plot(x, y) plot.setOwner(iPlayer) pPlayer.found(x, y) if plot.isCity(): city = gc.getMap().plot(x, y).getPlotCity() city.setName(sName, False) city.setPopulation(iPopulation) plot.changeCulture(iPlayer, 10 * (gc.getGame().getCurrentEra() + 1), True) city.changeCulture(iPlayer, 10 * (gc.getGame().getCurrentEra() + 1), True) if iNumUnits > 0 and iUnitType > 0: utils.makeUnit(iUnitType, iPlayer, tPlot, iNumUnits) for iReligion in lReligions: if gc.getGame().isReligionFounded(iReligion): city.setHasReligion(iReligion, True, False, False) return True return False
def onCombatResult(self, argsList): self.up.aztecUP(argsList) self.rnf.immuneMode(argsList) self.up.vikingUP(argsList) # includes Moorish Corsairs pWinningUnit, pLosingUnit = argsList vic.onCombatResult(pWinningUnit, pLosingUnit) iUnitPower = 0 pLosingUnitInfo = gc.getUnitInfo(pLosingUnit.getUnitType()) if pLosingUnitInfo.getUnitCombatType() != gc.getInfoTypeForString("UNITCOMBAT_SIEGE"): iUnitPower = pLosingUnitInfo.getPowerValue() sta.onCombatResult(pWinningUnit.getOwner(), pLosingUnit.getOwner(), iUnitPower) # catch slaves by defeating native and barbarian Pombos or Impis if pLosingUnit.getOwner() in [iBarbarian, iNative] and pLosingUnit.getUnitType() in [iZuluImpi, iCongolesePombos]: if gc.getMap().plot(pLosingUnit.getX(), pLosingUnit.getY()).getOwner() == pWinningUnit.getOwner(): if gc.getPlayer(pWinningUnit.getOwner()).getCivics(2) == iCivicSlavery: iRand = gc.getGame().getSorenRandNum(5, "Caught slaves?") if iRand == 1: iNewUnit = utils.getUniqueUnitType(pWinningUnit.getOwner(), gc.getUnitInfo(iSlave).getUnitClassType()) utils.makeUnit(iNewUnit, pWinningUnit.getOwner(), (pWinningUnit.getX(), pWinningUnit.getY()), 1) CyInterface().addMessage(pWinningUnit.getOwner(),True,15,CyTranslator().getText("TXT_KEY_UP_ENSLAVE_WIN", ()),'SND_REVOLTEND',1,'Art/Units/slave/button_slave.dds',ColorTypes(8),pWinningUnit.getX(),pWinningUnit.getY(),True,True) # Maya Holkans give food to closest city on victory if pWinningUnit.getUnitType() == iMayanHolkan: iOwner = pWinningUnit.getOwner() city = gc.getMap().findCity(pWinningUnit.getX(), pWinningUnit.getY(), iOwner, TeamTypes.NO_TEAM, False, False, TeamTypes.NO_TEAM, DirectionTypes.NO_DIRECTION, CyCity()) if city: city.changeFood(5) sAdjective = gc.getPlayer(pLosingUnit.getOwner()).getCivilizationAdjectiveKey() CyInterface().addMessage(iOwner, False, iDuration, CyTranslator().getText("TXT_KEY_MAYA_HOLKAN_EFFECT", (sAdjective, pLosingUnit.getNameKey(), 5, city.getName())), "", 0, "", ColorTypes(iWhite), -1, -1, True, True)
def onGreatPersonBorn(self, unit, iPlayer, city): # Khazar Khagan Ability: Khagan born when a Bek is born iUnitType = utils.getBaseUnit(unit.getUnitType()) pUnitInfo = gc.getUnitInfo(iUnitType) if pUnitInfo.getGreatPeoples( iSpecialistGreatGeneral) and iPlayer == iKhazars: utils.makeUnit(iKhagan, iKhazars, (city.getX(), city.getY()), 1)
def spreadReligion(self, tCoords, iNum, iMissionary): # Unused x, y = tCoords if not tCoords or not gc.getMap().plot(x, y).isCity(): return city = gc.getMap().plot(x, y).getPlotCity() #print city #print city.getOwner() utils.makeUnit(iMissionary, city.getOwner(), tCoords, iNum)
def onBuildingBuilt(self, argsList): city, iBuildingType = argsList iOwner = city.getOwner() tCity = (city.getX(), city.getY()) vic.onBuildingBuilt(iOwner, iBuildingType) self.rel.onBuildingBuilt(city, iOwner, iBuildingType) if iOwner < iNumPlayers: self.com.onBuildingBuilt(iOwner, iBuildingType, city) if isWorldWonderClass(gc.getBuildingInfo(iBuildingType).getBuildingClassType()): sta.onWonderBuilt(iOwner, iBuildingType) if iBuildingType == iPalace: sta.onPalaceMoved(iOwner) dc.onPalaceMoved(iOwner) if city.isHasRealBuilding(iAdministrativeCenter): city.setHasRealBuilding(iAdministrativeCenter, False) # Leoreth: in case human Phoenicia moves palace to Carthage if iOwner == iCarthage and tCity == (58, 39): utils.setReborn(iCarthage, True) # Leoreth: update trade routes when Porcelain Tower is built to start its effect if iBuildingType == iPorcelainTower: gc.getPlayer(iOwner).updateTradeRoutes() # Leoreth/Voyhkah: Empire State Building if iBuildingType == iEmpireStateBuilding: iPop = city.getPopulation() city.setBuildingCommerceChange(gc.getInfoTypeForString("BUILDINGCLASS_EMPIRE_STATE_BUILDING"), 0, iPop) # Leoreth: Machu Picchu if iBuildingType == iMachuPicchu: iNumPeaks = 0 for i in range(21): if city.getCityIndexPlot(i).isPeak(): iNumPeaks += 1 city.setBuildingCommerceChange(gc.getInfoTypeForString("BUILDINGCLASS_MACHU_PICCHU"), 0, iNumPeaks * 2) # Leoreth: Great Wall if iBuildingType == iGreatWall: for iPlot in range(gc.getMap().numPlots()): plot = gc.getMap().plotByIndex(iPlot) if plot.getOwner() == iOwner and not plot.isWater(): plot.setWithinGreatWall(True) # Leoreth: La Mezquita if iBuildingType == iMezquita: lGPList = [0, 0, 0, 0, 0, 0, 0] for city in utils.getCityList(iOwner): for i in range(7): iSpecialistUnit = utils.getUniqueUnit(iOwner, iGreatProphet + i) lGPList[i] += city.getGreatPeopleUnitProgress(iSpecialistUnit) iGPType = utils.getUniqueUnit(iOwner, iGreatProphet + utils.getHighestIndex(lGPList)) utils.makeUnit(iGPType, iOwner, tCity, 1) CyInterface().addMessage(iOwner, False, iDuration, CyTranslator().getText("TXT_KEY_MEZQUITA_FREE_GP", (gc.getUnitInfo(iGPType).getText(), city.getName())), "", InterfaceMessageTypes.MESSAGE_TYPE_MINOR_EVENT, gc.getUnitInfo(iGPType).getButton(), ColorTypes(iWhite), city.getX(), city.getY(), True, True)
def endObserverMode(): if data.iBeforeObserverSlot != -1: if gc.getPlayer(data.iBeforeObserverSlot).isAlive(): gc.getGame().setActivePlayer(data.iBeforeObserverSlot, False) data.iBeforeObserverSlot = -1 else: utils.makeUnit(iCatapult, data.iBeforeObserverSlot, (0, 0), 1) gc.getGame().setActivePlayer(data.iBeforeObserverSlot, False) data.iBeforeObserverSlot = -1
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 StartObServerMode(iTurns): data.ObserverTurn = iTurns data.iBeforeObserverSlot = utils.getHumanID() if gc.getPlayer(iHarappa).isAlive(): iObserverSlot = iCanada else: iObserverSlot = iHarappa gc.getTeam(gc.getPlayer(iHarappa).getTeam()).setHasTech( iCalendar, True, iHarappa, False, False) utils.makeUnit(iCatapult, iObserverSlot, (0, 0), 1) gc.getGame().setActivePlayer(iObserverSlot, False) gc.getGame().setAIAutoPlay(iTurns)
def onKbdEvent(self, argsList): 'keypress handler - return 1 if the event was consumed' eventType, key, mx, my, px, py = argsList theKey = int(key) if (eventType == self.EventKeyDown and theKey == int(InputTypes.KB_Q) and self.eventManager.bAlt and self.eventManager.bShift): print("SHIFT-ALT-Q") #enables squatting self.rnf.setCheatMode(True) CyInterface().addMessage(utils.getHumanID(), True, iDuration, "EXPLOITER!!! ;)", "", 0, "", ColorTypes(iRed), -1, -1, True, True) #Stability Cheat if data.bCheatMode and theKey == int( InputTypes.KB_S ) and self.eventManager.bAlt and self.eventManager.bShift: print("SHIFT-ALT-S") #increases stability by one level utils.setStabilityLevel( utils.getHumanID(), min(5, utils.getStabilityLevel(utils.getHumanID()) + 1)) if eventType == self.EventKeyDown and theKey == int( InputTypes.KB_V ) and self.eventManager.bCtrl and self.eventManager.bShift: for iPlayer in range(iNumTotalPlayersB): pPlayer = gc.getPlayer(iPlayer) #pPlayer.initCity(71, 34) #city = gc.getMap().plot(71, 34).getPlotCity() lEras = [iAncient, iMedieval, iIndustrial] for iEra in lEras: pPlayer.setCurrentEra(iEra) for iUnit in range(iNumUnits): print( str( gc.getCivilizationInfo( pPlayer.getCivilizationType()). getShortDescription(0))) print(str(gc.getEraInfo(iEra).getDescription())) print(str(gc.getUnitInfo(iUnit).getDescription())) utils.makeUnit(iUnit, iPlayer, (68, 33), 1) gc.getMap().plot(68, 33).getUnit(0).kill( False, iBarbarian)
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 spawnUnits(self, iCiv, tTopLeft, tBottomRight, iUnitType, iNumUnits, iTurn, iPeriod, iRest, function, eUnitAIType = UnitAITypes.UNITAI_ATTACK, prefix = 0, art = "", promotionList = [], argsList = []): print "spawnUnits called" if iNumUnits <= 0: # edead return None pUnit = None # edead if (iTurn % utils.getTurns(iPeriod) == iRest): dummy, plotList = utils.squareSearch( tTopLeft, tBottomRight, function, argsList ) if (len(plotList)): rndNum = gc.getGame().getSorenRandNum(len(plotList), 'Spawn units') result = plotList[rndNum] if (result): pUnit = utils.makeUnit(iUnitType, iCiv, result, iNumUnits, eUnitAIType, promotionList, prefix, art) # edead: pass the object return pUnit # edead: pass the object
def onBuildingBuilt(self, argsList): city, iBuildingType = argsList iOwner = city.getOwner() tCity = (city.getX(), city.getY()) vic.onBuildingBuilt(iOwner, iBuildingType) rel.onBuildingBuilt(city, iOwner, iBuildingType) self.up.onBuildingBuilt(city, iOwner, iBuildingType) if iOwner < iNumPlayers: self.com.onBuildingBuilt(iOwner, iBuildingType, city) if isWorldWonderClass( gc.getBuildingInfo(iBuildingType).getBuildingClassType()): sta.onWonderBuilt(iOwner, iBuildingType) if iBuildingType == iPalace: sta.onPalaceMoved(iOwner) dc.onPalaceMoved(iOwner) if city.isHasRealBuilding(iAdministrativeCenter): city.setHasRealBuilding(iAdministrativeCenter, False) utils.makeUnit(iGreatStatesman, iOwner, tCity, 1) # Leoreth: in case human Phoenicia moves palace to Carthage if iOwner == iCarthage and tCity == (58, 39): utils.setReborn(iCarthage, True) # Leoreth: update trade routes when Porcelain Tower is built to start its effect if iBuildingType == iPorcelainTower: gc.getPlayer(iOwner).updateTradeRoutes() # Leoreth/Voyhkah: Empire State Building if iBuildingType == iEmpireStateBuilding: iPop = city.getPopulation() city.setBuildingCommerceChange( gc.getBuildingInfo( iEmpireStateBuilding).getBuildingClassType(), 0, iPop) # Leoreth: Oriental Pearl Tower if iBuildingType == iOrientalPearlTower: iPop = city.getPopulation() city.setBuildingCommerceChange( gc.getBuildingInfo(iOrientalPearlTower).getBuildingClassType(), 1, 2 * iPop) # Leoreth: Machu Picchu if iBuildingType == iMachuPicchu: iNumPeaks = 0 for i in range(21): if city.getCityIndexPlot(i).isPeak(): iNumPeaks += 1 city.setBuildingCommerceChange( gc.getBuildingInfo(iMachuPicchu).getBuildingClassType(), 0, iNumPeaks * 2) # Leoreth: Great Wall if iBuildingType == iGreatWall: for iPlot in range(gc.getMap().numPlots()): plot = gc.getMap().plotByIndex(iPlot) if plot.getOwner() == iOwner and not plot.isWater(): plot.setWithinGreatWall(True)
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) utils.makeUnit(iGreatStatesman, iPlayer, tCity, 1) # 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 iTurks in [iPlayer, iOwner]: if utils.isAreaControlled(iTurks, 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) # 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 iNationalWonder in range(iNumBuildings): if iNationalWonder != iPalace and 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
def onGoldenAge(self, argsList): iPlayer = argsList[0] if not data.players[iPlayer].bFirstGoldenAge: data.players[iPlayer].bFirstGoldenAge = True capital = gc.getPlayer(iPlayer).getCapitalCity() if iPlayer in [iPolynesia, iVikings, iIndonesia, iNetherlands]: utils.makeUnit(iSettler, iPlayer, (capital.getX(), capital.getY()), 2) utils.makeUnit(utils.getBestWorker(iPlayer), iPlayer, (capital.getX(), capital.getY()), 1) utils.makeUnit(iWorkboat, iPlayer, (capital.getX(), capital.getY()), 1) utils.makeUnit(utils.getBestInfantry(iPlayer), iPlayer, (capital.getX(), capital.getY()), 1) utils.makeUnit(utils.getBestCounter(iPlayer), iPlayer, (capital.getX(), capital.getY()), 1) utils.makeUnit(utils.getBestDefender(iPlayer), iPlayer, (capital.getX(), capital.getY()), 1) utils.makeUnit(utils.getBestShip(iPlayer), iPlayer, (capital.getX(), capital.getY()), 4) elif iPlayer in [iMaya, iInca, iAztecs, iCongo]: utils.makeUnit(iSettler, iPlayer, (capital.getX(), capital.getY()), 2) utils.makeUnit(utils.getBestWorker(iPlayer), iPlayer, (capital.getX(), capital.getY()), 1) utils.makeUnit(utils.getBestInfantry(iPlayer), iPlayer, (capital.getX(), capital.getY()), 3) utils.makeUnit(utils.getBestCounter(iPlayer), iPlayer, (capital.getX(), capital.getY()), 3) utils.makeUnit(utils.getBestDefender(iPlayer), iPlayer, (capital.getX(), capital.getY()), 3) else: utils.makeUnit(utils.getBestWorker(iPlayer), iPlayer, (capital.getX(), capital.getY()), 1) utils.makeUnit(utils.getBestInfantry(iPlayer), iPlayer, (capital.getX(), capital.getY()), 2) utils.makeUnit(utils.getBestCounter(iPlayer), iPlayer, (capital.getX(), capital.getY()), 2) utils.makeUnit(utils.getBestDefender(iPlayer), iPlayer, (capital.getX(), capital.getY()), 2) utils.makeUnit(utils.getBestSiege(iPlayer), iPlayer, (capital.getX(), capital.getY()), 1) utils.makeUnit(utils.getBestCavalry(iPlayer), iPlayer, (capital.getX(), capital.getY()), 1) if iPlayer == iHarappa: utils.makeUnit(iCityBuilder, iPlayer, (capital.getX(), capital.getY()), 2) elif iPlayer == iAmerica: utils.makeUnit(iPioneer, iPlayer, (capital.getX(), capital.getY()), 2) else: utils.makeUnit(iSettler, iPlayer, (capital.getX(), capital.getY()), 2) sta.onGoldenAge(iPlayer)
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 onKbdEvent(self, argsList): 'keypress handler - return 1 if the event was consumed' #Rhye - start debug eventType, key, mx, my, px, py = argsList theKey = int(key) iHuman = utils.getHumanID() if (eventType == self.EventKeyDown and theKey == int(InputTypes.KB_B) and self.eventManager.bAlt): iGameTurn = gc.getGame().getGameTurn() if (eventType == self.EventKeyDown and theKey == int(InputTypes.KB_N) and self.eventManager.bAlt): #print("ALT-N") # self.printEmbassyDebug() # self.printPlotsDebug() self.printStabilityDebug() if (eventType == self.EventKeyDown and theKey == int(InputTypes.KB_C) and self.eventManager.bAlt and self.eventManager.bShift): #print("SHIFT-ALT-C") #picks a dead civ so that autoplay can be started with game.AIplay xx iDebugDeadCiv = iMauryans #gc.getTeam(gc.getPlayer(iDebugDeadCiv).getTeam()).setHasTech(con.iCalendar, True, iDebugDeadCiv, False, False) utils.makeUnit(con.iSpearman, iDebugDeadCiv, (0, 0), 1) gc.getGame().setActivePlayer(iDebugDeadCiv, False) gc.getPlayer(iDebugDeadCiv).setPlayable(True) if (eventType == self.EventKeyDown and theKey == int(InputTypes.KB_Q) and self.eventManager.bAlt and self.eventManager.bShift): #print("SHIFT-ALT-Q") #enables squatting self.rnf.setCheatMode(True) CyInterface().addMessage(iHuman, True, con.iDuration, "EXPLOITER!!! ;)", "", 0, "", ColorTypes(con.iRed), -1, -1, True, True) # keyboard event test #if eventType == self.EventKeyDown and px >= 0 and py >= 0 and theKey == 45 and self.eventManager.bCtrl and self.eventManager.bAlt: #pPlot = gc.getMap().plot(px,py) #iActivePlayer = gc.getGame().getActivePlayer() #iActiveTeam = gc.getPlayer(iActivePlayer).getTeam() #if pPlot.isCity(): #CyInterface().addMessage(iHuman, True, con.iDuration, "contact", "", 0, "", ColorTypes(con.iGreen), -1, -1, True, True) # province highlight if eventType == self.EventKeyDown and px >= 0 and py >= 0 and theKey == 45 and self.eventManager.bCtrl and not self.eventManager.bAlt: pPlot = gc.getMap().plot(px, py) iActivePlayer = gc.getGame().getActivePlayer() iActiveTeam = gc.getPlayer(iActivePlayer).getTeam() iRegionID = pPlot.getRegionID() # do not show provinces of unrevealed tiles if not pPlot.isRevealed(iActiveTeam, False) and not gc.getGame().isDebugMode(): return # do not redraw if already drawn if self.lastRegionID == iRegionID: return engine = CyEngine() # clear the highlight engine.clearAreaBorderPlots( AreaBorderLayers.AREA_BORDER_LAYER_HIGHLIGHT_PLOT) #engine.clearColoredPlots(PlotLandscapeLayers.PLOT_LANDSCAPE_LAYER_RECOMMENDED_PLOTS) # cache the plot's coords self.lastRegionID = pPlot.getRegionID() # select an appriopriate color if pPlot.isWater(): #color = gc.getColorInfo(gc.getInfoTypeForString("COLOR_HIGHLIGHT_WATER")).getColor() return else: iLevel = utils.getRegionStabilityLevel(iHuman, iRegionID) if iLevel == 4: color = gc.getColorInfo( gc.getInfoTypeForString( "COLOR_HIGHLIGHT_CORE")).getColor() elif iLevel == 3: color = gc.getColorInfo( gc.getInfoTypeForString( "COLOR_HIGHLIGHT_BORDER")).getColor() elif iLevel == 2: color = gc.getColorInfo( gc.getInfoTypeForString( "COLOR_HIGHLIGHT_CONTESTED")).getColor() elif iLevel == 1: color = gc.getColorInfo( gc.getInfoTypeForString( "COLOR_HIGHLIGHT_OUTSIDE")).getColor() else: color = gc.getColorInfo( gc.getInfoTypeForString( "COLOR_HIGHLIGHT_FOREIGN")).getColor() # apply the highlight for x in range(con.iMapWidth): for y in range(con.iMapHeight): pCurrent = gc.getMap().plot(x, y) if pCurrent.getRegionID() == iRegionID and ( gc.getGame().isDebugMode() or pCurrent.isRevealed(iActiveTeam, False)): engine.fillAreaBorderPlot( x, y, color, AreaBorderLayers.AREA_BORDER_LAYER_HIGHLIGHT_PLOT) return # clear all hightlights if (eventType == self.EventKeyUp and self.eventManager.bCtrl) or (eventType == self.EventKeyDown): CyEngine().clearAreaBorderPlots( AreaBorderLayers.AREA_BORDER_LAYER_HIGHLIGHT_PLOT) #CyEngine().clearColoredPlots(PlotLandscapeLayers.PLOT_LANDSCAPE_LAYER_RECOMMENDED_PLOTS) self.lastRegionID = -1
def onKbdEvent(self, argsList): 'keypress handler - return 1 if the event was consumed' eventType, key, mx, my, px, py = argsList # Rhye: RFC debug iHuman = utils.getHumanID() if eventType == self.EventKeyDown and key == InputTypes.KB_N and self.eventManager.bAlt: print("ALT-N") self.printStabilityDebug() if eventType == self.EventKeyDown and key == InputTypes.KB_C and self.eventManager.bAlt and self.eventManager.bShift: print( "SHIFT-ALT-C" ) #picks a dead civ so that autoplay can be started with game.AIplay xx iDebugDeadCiv = iMauryans #gc.getTeam(gc.getPlayer(iDebugDeadCiv).getTeam()).setHasTech(con.iCalendar, True, iDebugDeadCiv, False, False) utils.makeUnit(con.iSpearman, iDebugDeadCiv, (0, 0), 1) gc.getGame().setActivePlayer(iDebugDeadCiv, False) gc.getPlayer(iDebugDeadCiv).setPlayable(True) if eventType == self.EventKeyDown and key == InputTypes.KB_Q and self.eventManager.bAlt and self.eventManager.bShift: print("SHIFT-ALT-Q") #enables squatting self.rnf.setCheatMode(True) CyInterface().addMessage(iHuman, True, con.iDuration, "EXPLOITER!!! ;)", "", 0, "", ColorTypes(con.iRed), -1, -1, True, True) # Baldyr: Stability Cheat if self.rnf.getCheatMode( ) and key == InputTypes.KB_S and self.eventManager.bAlt and self.eventManager.bShift: print("SHIFT-ALT-S") #boosts stability by +10 for the human player sd.setStability(iHuman, sd.getStability(iHuman) + 10) # edead: SoI Debug if eventType == self.EventKeyDown and key == InputTypes.KB_N and self.eventManager.bCtrl and gc.getGame( ).isDebugMode(): print("CTRL-N") utils.launchDebugScreen() # edead: province highlight if eventType == self.EventKeyDown and px >= 0 and py >= 0 and int( key ) == 45 and self.eventManager.bCtrl and not self.eventManager.bAlt: plot = gc.getMap().plot(px, py) iActivePlayer = gc.getGame().getActivePlayer() iActiveTeam = gc.getPlayer(iActivePlayer).getTeam() iRegionID = plot.getRegionID() # do not show provinces of unrevealed tiles if not plot.isRevealed(iActiveTeam, False) and not gc.getGame().isDebugMode(): return # do not redraw if already drawn if self.lastRegionID == iRegionID: return map = CyMap() engine = CyEngine() # clear the highlight engine.clearAreaBorderPlots( AreaBorderLayers.AREA_BORDER_LAYER_HIGHLIGHT_PLOT) #engine.clearColoredPlots(PlotLandscapeLayers.PLOT_LANDSCAPE_LAYER_RECOMMENDED_PLOTS) # cache the plot's coords self.lastRegionID = plot.getRegionID() # select an appriopriate color if plot.isWater(): return else: iLevel = utils.getRegionStabilityLevel(iHuman, iRegionID) if iLevel == 4: color = gc.getColorInfo( gc.getInfoTypeForString( "COLOR_HIGHLIGHT_CORE")).getColor() elif iLevel == 3: color = gc.getColorInfo( gc.getInfoTypeForString( "COLOR_HIGHLIGHT_BORDER")).getColor() elif iLevel == 2: color = gc.getColorInfo( gc.getInfoTypeForString( "COLOR_HIGHLIGHT_CONTESTED")).getColor() elif iLevel == 1: color = gc.getColorInfo( gc.getInfoTypeForString( "COLOR_HIGHLIGHT_OUTSIDE")).getColor() else: color = gc.getColorInfo( gc.getInfoTypeForString( "COLOR_HIGHLIGHT_FOREIGN")).getColor() # apply the highlight for i in range(map.numPlots()): plot = map.plotByIndex(i) if plot.getRegionID() == iRegionID and ( gc.getGame().isDebugMode() or plot.isRevealed(iActiveTeam, False)): engine.fillAreaBorderPlot( plot.getX(), plot.getY(), color, AreaBorderLayers.AREA_BORDER_LAYER_HIGHLIGHT_PLOT) return # clear all hightlights if (eventType == self.EventKeyUp and self.eventManager.bCtrl) or (eventType == self.EventKeyDown): CyEngine().clearAreaBorderPlots( AreaBorderLayers.AREA_BORDER_LAYER_HIGHLIGHT_PLOT) self.lastRegionID = -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.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) # chance to spawn a worker if (gc.getGame().getGameTurn() <= getTurnForYear(1950)): iRandom = gc.getGame().getSorenRandNum(2, 'random Worker spawn') if iRandom == 0: utils.makeUnit(iWorker, iTargetPlayer, (x, y), 1) # 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 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 foundCity(self, iPlayer, tPlot, sName, iPopulation, iUnitType=-1, iNumUnits=-1, lReligions=[]): pPlayer = gc.getPlayer(iPlayer) x, y = tPlot plot = gc.getMap().plot(x, y) plot.setOwner(iPlayer) pPlayer.found(x, y) if plot.isCity(): city = gc.getMap().plot(x, y).getPlotCity() city.setName(sName, False) city.setPopulation(iPopulation) if sName in ['Tucume']: city.setHasRealBuilding(iGranary, True) plot.changeCulture(iPlayer, 20 * (gc.getGame().getCurrentEra() + 1), True) city.changeCulture(iPlayer, 20 * (gc.getGame().getCurrentEra() + 1), True) utils.makeUnit(iChimuSuchucChiquiAucac, iPlayer, tPlot, 2) elif sName == 'Vatapi': city.setHasRealBuilding(iGranary, True) city.setHasRealBuilding(iLighthouse, True) city.setHasRealBuilding(iBarracks, True) plot.changeCulture(iPlayer, 20 * (gc.getGame().getCurrentEra() + 1), True) city.changeCulture(iPlayer, 20 * (gc.getGame().getCurrentEra() + 1), True) elif sName == 'Dvin': city.setHasRealBuilding(iGranary, True) city.setHasRealBuilding(iLibrary, True) city.setHasRealBuilding(iBarracks, True) plot.changeCulture(iPlayer, 20 * (gc.getGame().getCurrentEra() + 1), True) city.changeCulture(iPlayer, 20 * (gc.getGame().getCurrentEra() + 1), True) elif sName == 'Chan Chan': city.setHasRealBuilding(iGranary, True) city.setHasRealBuilding(iLighthouse, True) city.setHasRealBuilding(iBarracks, True) plot.changeCulture(iPlayer, 20 * (gc.getGame().getCurrentEra() + 1), True) city.changeCulture(iPlayer, 20 * (gc.getGame().getCurrentEra() + 1), True) elif sName == 'Bahrein': city.setHasRealBuilding(iIslamicTemple, True) city.setHasRealBuilding(iLighthouse, True) city.setHasRealBuilding(iBarracks, True) plot.changeCulture(iPlayer, 20 * (gc.getGame().getCurrentEra() + 1), True) city.changeCulture(iPlayer, 20 * (gc.getGame().getCurrentEra() + 1), True) else: plot.changeCulture(iPlayer, 10 * (gc.getGame().getCurrentEra() + 1), True) city.changeCulture(iPlayer, 10 * (gc.getGame().getCurrentEra() + 1), True) if iNumUnits > 0 and iUnitType > 0: utils.makeUnit(iUnitType, iPlayer, tPlot, iNumUnits) for iReligion in lReligions: if gc.getGame().isReligionFounded(iReligion): city.setHasReligion(iReligion, True, False, False) return True return False
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 onCombatResult(self, argsList): iHuman = utils.getHumanID() pWinningUnit, pLosingUnit, pAttackingUnit = argsList if pWinningUnit.getOwner() == iHuman: self.vic.onCombatResult(argsList) # Mamluks self.sta.onCombatResult(argsList) self.rnf.immuneMode(argsList) # srpt Slavery iWinningPlayer = pWinningUnit.getOwner() iLosingPlayer = pLosingUnit.getOwner() iAttackingPlayer = pAttackingUnit.getOwner() pWinningPlayer = gc.getPlayer(pWinningUnit.getOwner()) pLosingPlayer = gc.getPlayer(pLosingUnit.getOwner()) pAttackingPlayer = gc.getPlayer(pAttackingUnit.getOwner()) #land only if not (gc.getMap().plot(pWinningUnit.getX(), pWinningUnit.getY()).isWater()): if (pWinningPlayer.getCivics(2) != con.iSlavery): return cLosingUnit = PyHelpers.PyInfo.UnitInfo(pLosingUnit.getUnitType()) if (con.iRam < pLosingUnit.getUnitType() < con.iLevySpearman): return # Only enslave land units!! if (cLosingUnit.getDomainType() == gc.getInfoTypeForString( "DOMAIN_LAND")): iThreshold = 20 iRandom = gc.getGame().getSorenRandNum(100, 'capture chance') if pLosingUnit.getOwner() == con.iBarbarian: iThreshold += 10 if iWinningPlayer == iAttackingPlayer: iThreshold += 10 #print ("pWinningPlayer.getCapitalCity().productionLeft()", pWinningPlayer.getCapitalCity().productionLeft()) if (iRandom < iThreshold): #if iWinningPlayer != iHuman and pWinningPlayer.getCapitalCity().isProductionBuilding() and pWinningPlayer.getCapitalCity().productionLeft() > 45: #self.aiSlaveFunction(iWinningPlayer, (pLosingUnit.getX(), pLosingUnit.getY())) #else: if gc.getMap().plot( pLosingUnit.getX(), pLosingUnit.getY( )).getNumDefenders(iLosingPlayer) <= 1: pPlot = gc.getMap().plot(pLosingUnit.getX(), pLosingUnit.getY()) if pPlot.getTerrainType( ) != con.iWasteland and pPlot.getFeatureType( ) != con.iJungle: #pNewUnit = pWinningPlayer.initUnit(con.iSlave, pLosingUnit.getX(), pLosingUnit.getY(), UnitAITypes.UNITAI_SLAVE, DirectionTypes.DIRECTION_SOUTH) pNewUnit = utils.makeUnit( con.iSlave, iWinningPlayer, (pLosingUnit.getX(), pLosingUnit.getY()), 1) CyInterface().addMessage( pWinningPlayer.getID(), True, 15, CyTranslator().getText( "You have enslaved an enemy unit", ()), 'SND_REVOLTEND', 1, 'Art/Units/Slave/button_slave.dds', ColorTypes(8), pLosingUnit.getX(), pLosingUnit.getY(), True, True) CyInterface().addMessage( pLosingPlayer.getID(), True, 15, CyTranslator().getText( "Your unit has been enslaved", ()), 'SND_REVOLTEND', 1, 'Art/Units/Slave/button_slave.dds', ColorTypes(7), pLosingUnit.getX(), pLosingUnit.getY(), True, True) pNewUnit.finishMoves() else: pPlot = gc.getMap().plot(pWinningUnit.getX(), pWinningUnit.getY()) if pPlot.getTerrainType( ) != con.iWasteland and pPlot.getFeatureType( ) != con.iJungle: #pNewUnit = pWinningPlayer.initUnit(con.iSlave, pWinningUnit.getX(), pWinningUnit.getY(), UnitAITypes.UNITAI_SLAVE, DirectionTypes.DIRECTION_SOUTH) pNewUnit = utils.makeUnit( con.iSlave, iWinningPlayer, (pWinningUnit.getX(), pWinningUnit.getY()), 1) CyInterface().addMessage( pWinningPlayer.getID(), True, 15, CyTranslator().getText( "You have enslaved an enemy unit", ()), 'SND_REVOLTEND', 1, 'Art/Units/Slave/button_slave.dds', ColorTypes(8), pWinningUnit.getX(), pWinningUnit.getY(), True, True) CyInterface().addMessage( pLosingPlayer.getID(), True, 15, CyTranslator().getText( "Your unit has been enslaved", ()), 'SND_REVOLTEND', 1, 'Art/Units/Slave/button_slave.dds', ColorTypes(7), pWinningUnit.getX(), pWinningUnit.getY(), True, True) pNewUnit.finishMoves() elif iAttackingPlayer == iLosingPlayer: if (iRandom < iThreshold): #if iWinningPlayer != iHuman and pWinningPlayer.getCapitalCity().isProductionBuilding(): #self.aiSlaveFunction(iWinningPlayer, (pWinningUnit.getX(), pWinningUnit.getY())) #else: pPlot = gc.getMap().plot(pWinningUnit.getX(), pWinningUnit.getY()) if pPlot.getTerrainType( ) != con.iWasteland and pPlot.getFeatureType( ) != con.iJungle: #pNewUnit = pWinningPlayer.initUnit(con.iSlave, pWinningUnit.getX(), pWinningUnit.getY(), UnitAITypes.UNITAI_SLAVE, DirectionTypes.DIRECTION_SOUTH) pNewUnit = utils.makeUnit( con.iSlave, iWinningPlayer, (pWinningUnit.getX(), pWinningUnit.getY()), 1) pNewUnit.finishMoves() CyInterface().addMessage( pWinningPlayer.getID(), True, 15, CyTranslator().getText( "TXT_KEY_UP_ENSLAVE_WIN", ()), 'SND_REVOLTEND', 1, 'Art/Units/Slave/button_slave.dds', ColorTypes(8), pWinningUnit.getX(), pWinningUnit.getY(), True, True) CyInterface().addMessage( pLosingPlayer.getID(), True, 15, CyTranslator().getText( "TXT_KEY_UP_ENSLAVE_LOSE", ()), 'SND_REVOLTEND', 1, 'Art/Units/Slave/button_slave.dds', ColorTypes(7), pWinningUnit.getX(), pWinningUnit.getY(), True, True) pNewUnit.finishMoves()
def checkTurn(self, iGameTurn): #handicap level modifier iHandicap = gc.getHandicapInfo( gc.getGame().getHandicapType()).getBarbarianSpawnModifier() # Leoreth: buff certain cities if independent / barbarian (imported from SoI) if iGameTurn % 20 == 10: for tMinorState in tMinorStates: iStartYear, iEndYear, tPlot, lUnitList = tMinorState if utils.isYearIn(iStartYear, iEndYear): x, y = tPlot plot = gc.getMap().plot(x, y) iOwner = plot.getOwner() if plot.isCity( ) and plot.getNumUnits() < 4 and iOwner >= iNumPlayers: iUnit = utils.getRandomEntry(lUnitList) utils.makeUnit(iUnit, iOwner, tPlot, 1) if utils.isYearIn(-3000, -850): if iHandicap >= 0: self.checkSpawn(iBarbarian, iWarrior, 1, (76, 46), (99, 53), self.spawnMinors, iGameTurn, 5, 0) self.checkSpawn(iBarbarian, iWolf, 1, (75, 54), (104, 64), self.spawnNatives, iGameTurn, 5, 2) self.checkSpawn(iBarbarian, iBear, 1, (75, 54), (104, 64), self.spawnNatives, iGameTurn, 5, 4) self.checkLimitedSpawn(iBarbarian, iLion, 1, 5, (55, 10), (72, 29), self.spawnNatives, iGameTurn, 5, 1) self.checkLimitedSpawn(iBarbarian, iPanther, 1, 5, (55, 10), (72, 29), self.spawnNatives, iGameTurn, 5, 3) #celts if utils.isYearIn(-650, -110): self.checkSpawn(iCeltia, iGallicWarrior, 1, (49, 46), (65, 52), self.spawnMinors, iGameTurn, 6, 0) if iHandicap >= 0: self.checkSpawn(iCeltia, iAxeman, 1, (49, 46), (65, 52), self.spawnMinors, iGameTurn, 8, 5, ["TXT_KEY_ADJECTIVE_GAUL"]) #norse if utils.isYearIn(-650, 550): self.checkSpawn(iBarbarian, iGalley, 1, (50, 49), (61, 55), self.spawnPirates, iGameTurn, 20, 0, ["TXT_KEY_ADJECTIVE_NORSE"]) #mongolia if utils.isYearIn(-210, 300): self.checkSpawn(iBarbarian, iHorseman, 3 + iHandicap, (94, 48), (107, 54), self.spawnNomads, iGameTurn, 8 - iHandicap, 0, ["TXT_KEY_ADJECTIVE_XIONGNU"]) elif utils.isYearIn(300, 900): iNumUnits = 2 + iHandicap self.checkSpawn( iBarbarian, iHorseArcher, iNumUnits, (91, 50), (107, 54), self.spawnNomads, iGameTurn, 7 - iHandicap, 0, ["TXT_KEY_ADJECTIVE_GOKTURK", "TXT_KEY_ADJECTIVE_UIGHUR"]) elif utils.isYearIn(900, 1100): iNumUnits = 1 + iHandicap self.checkSpawn( iBarbarian, iKeshik, iNumUnits, (94, 48), (107, 54), self.spawnInvaders, iGameTurn, 6, 0, ["TXT_KEY_ADJECTIVE_JURCHEN", "TXT_KEY_ADJECTIVE_KHITAN"]) #tibet if utils.isYearIn(-350, 200): self.checkSpawn(iBarbarian, iLightSwordsman, 1 + iHandicap, (92, 41), (99, 45), self.spawnMinors, iGameTurn, 10 - iHandicap, 3, ["TXT_KEY_ADJECTIVE_TIBETAN"]) elif utils.isYearIn(200, 1100): self.checkSpawn(iBarbarian, iSwordsman, 1 + iHandicap, (92, 41), (99, 45), self.spawnMinors, iGameTurn, 10 - iHandicap, 3, ["TXT_KEY_ADJECTIVE_TIBETAN"]) # Deccan barbarians if utils.isYearIn(-1000, 1200): iUnit = iArcher iStrength = iHandicap if iGameTurn >= getTurnForYear(-500): iUnit = iAxeman if iGameTurn >= getTurnForYear(0): iStrength += 1 if iGameTurn >= getTurnForYear(200): iUnit = iSwordsman self.checkSpawn(iBarbarian, iUnit, iStrength, (87, 23), (96, 37), self.spawnInvaders, iGameTurn, 8 - iHandicap, 0, ["Hindi"]) # elephants in india pre-khmer if utils.isYearIn(-210, 700): self.checkSpawn(iBarbarian, iWarElephant, 1, (86, 31), (100, 41), self.spawnInvaders, iGameTurn, 8 - iHandicap, 4) #Indo-Scythians if utils.isYearIn(-200, 400): self.checkSpawn(iBarbarian, iHorseman, 2, (84, 40), (89, 43), self.spawnNomads, iGameTurn, 8 - iHandicap, 4, ["TXT_KEY_ADJECTIVE_INDO_SCYTHIAN"]) #Kushana if utils.isYearIn(30, 220): self.checkSpawn(iBarbarian, iAsvaka, 3 + iHandicap, (84, 40), (89, 43), self.spawnInvaders, iGameTurn, 8, 3, ["TXT_KEY_ADJECTIVE_KUSHANA"]) #Hephtalites if utils.isYearIn(400, 550): self.checkSpawn(iBarbarian, iHorseArcher, 2 + iHandicap, (84, 40), (89, 43), self.spawnInvaders, iGameTurn, 5 - iHandicap, 2, ["TXT_KEY_ADJECTIVE_HEPHTHALITE"]) # Holkans in classical Mesoamerica if utils.isYearIn(100, 600): self.checkSpawn(iBarbarian, iHolkan, 1, (17, 31), (25, 37), self.spawnUprising, iGameTurn, 6, 4) elif utils.isYearIn(600, 1000): self.checkSpawn(iBarbarian, iHolkan, 1, (17, 31), (25, 37), self.spawnUprising, iGameTurn, 4, 2) #pirates in Mediterranean if utils.isYearIn(-210, 50): self.checkSpawn(iBarbarian, iWarGalley, 1, (49, 37), (72, 44), self.spawnPirates, iGameTurn, 8, 0) #pirates in Barbary coast if not gc.getPlayer(iMoors).isAlive(): if utils.isYearIn(-50, 700): self.checkSpawn(iBarbarian, iWarGalley, 1, (46, 30), (62, 39), self.spawnPirates, iGameTurn, 18, 0) elif utils.isYearIn(700, 1400): self.checkSpawn(iBarbarian, iWarGalley, 1, (46, 30), (62, 39), self.spawnPirates, iGameTurn, 8, 0) #pirates in Indian ocean if utils.isYearIn(-650, 700): self.checkSpawn(iBarbarian, iWarGalley, 1, (72, 20), (91, 36), self.spawnPirates, iGameTurn, 18, 0) elif utils.isYearIn(700, 1700): self.checkSpawn(iBarbarian, iHeavyGalley, 1, (72, 20), (91, 36), self.spawnPirates, iGameTurn, 10, 0) # Leoreth: Barbarians in Anatolia (Hittites), replace Hattusas spawn if utils.isYearIn(-2000, -800): self.checkSpawn(iBarbarian, iHuluganni, 1 + iHandicap, (68, 42), (74, 45), self.spawnInvaders, iGameTurn, 16, 0, ["TXT_KEY_ADJECTIVE_HITTITE"]) #barbarians in europe if utils.isYearIn(-210, 470): self.checkSpawn(iBarbarian, iAxeman, 3 + iHandicap, (50, 45), (63, 52), self.spawnInvaders, iGameTurn, 10, 0, ["TXT_KEY_ADJECTIVE_GERMANIC"]) self.checkSpawn(iBarbarian, iAxeman, 2 + iHandicap, (64, 49), (69, 55), self.spawnInvaders, iGameTurn, 12, 2, ["TXT_KEY_ADJECTIVE_GERMANIC"]) # Leoreth: begins 100 AD instead of 50 AD if utils.isYearIn(100, 470): self.checkSpawn(iBarbarian, iSwordsman, 3, (58, 45), (70, 55), self.spawnInvaders, iGameTurn, 8, 5, ["TXT_KEY_ADJECTIVE_GERMANIC"]) if utils.isYearIn(300, 550): self.checkSpawn(iBarbarian, iAxeman, 4 + iHandicap, (49, 41), (56, 52), self.spawnInvaders, iGameTurn, 5, 4, ["TXT_KEY_ADJECTIVE_VISIGOTHIC"]) self.checkSpawn(iBarbarian, iSwordsman, 4 + iHandicap, (49, 41), (57, 52), self.spawnInvaders, iGameTurn, 5, 2, ["TXT_KEY_ADJECTIVE_VISIGOTHIC"]) self.checkSpawn(iBarbarian, iHorseArcher, 3, (55, 49), (65, 53), self.spawnInvaders, iGameTurn, 5, 0, ["TXT_KEY_ADJECTIVE_HUNNIC"]) if utils.isYearIn(300, 700): self.checkSpawn(iBarbarian, iHorseArcher, 3 + iHandicap, (58, 50), (88, 53), self.spawnInvaders, iGameTurn, 3, 2, ["TXT_KEY_ADJECTIVE_HUNNIC"]) #Leoreth: barbarians in Balkans / Black Sea until the High Middle Ages (Bulgarians, Cumans, Pechenegs) if utils.isYearIn(680, 1000): self.checkSpawn( iBarbarian, iHorseArcher, 3 + iHandicap, (64, 45), (69, 49), self.spawnInvaders, iGameTurn, 6, 2, ["TXT_KEY_ADJECTIVE_AVAR", "TXT_KEY_ADJECTIVE_BULGAR"]) if utils.isYearIn(900, 1200): self.checkSpawn(iBarbarian, iHorseArcher, 3 + iHandicap, (68, 48), (78, 50), self.spawnInvaders, iGameTurn, 8, 5, ["TXT_KEY_ADJECTIVE_CUMAN"]) #barbarians in central asia if utils.isYearIn(-1600, -850): self.checkLimitedSpawn(iBarbarian, iVulture, 1, 3, (74, 34), (78, 44), self.spawnNomads, iGameTurn, 8 - iHandicap, 2, ["TXT_KEY_ADJECTIVE_ASSYRIAN"]) elif utils.isYearIn(-850, 300): self.checkLimitedSpawn(iBarbarian, iVulture, 1, 4, (73, 38), (78, 44), self.spawnNomads, iGameTurn, 10 - iHandicap, 2, ["TXT_KEY_ADJECTIVE_ASSYRIAN"]) self.checkSpawn(iBarbarian, iHorseman, 2 + iHandicap, (79, 41), (84, 49), self.spawnInvaders, iGameTurn, 7 - iHandicap, 2, ["TXT_KEY_ADJECTIVE_PARTHIAN"]) elif utils.isYearIn(300, 700): #if utils.getScenario() == i3000BC: #late start condition self.checkSpawn(iBarbarian, iHorseArcher, 2 + iHandicap, (78, 42), (88, 50), self.spawnNomads, iGameTurn, 8 - iHandicap, 2, ["TXT_KEY_ADJECTIVE_TURKIC"]) elif utils.isYearIn(700, 1040): #if utils.getScenario() == i3000BC: #late start condition self.checkSpawn(iBarbarian, iHorseArcher, 2 + iHandicap, (78, 42), (90, 52), self.spawnNomads, iGameTurn, 6 - iHandicap, 2, ["TXT_KEY_ADJECTIVE_TURKIC"]) # late Central Asian barbarians iSteppeUnit = iKeshik iExtra = iHandicap if utils.isYearIn(1200, 1600): if not utils.getAreaCitiesCiv( iMongolia, utils.getPlotList((70, 48), (80, 59))): self.checkSpawn( iBarbarian, iSteppeUnit, 1 + iExtra, (74, 47), (81, 47), self.spawnNomads, iGameTurn, 10 - iHandicap, 5, ["TXT_KEY_ADJECTIVE_TATAR", "TXT_KEY_ADJECTIVE_NOGAI"]) if utils.isYearIn(1400, 1700): if utils.getAreaCities(utils.getPlotList((80, 47), (88, 53))): self.checkSpawn( iBarbarian, iSteppeUnit, 1 + iExtra, (80, 47), (88, 53), self.spawnNomads, iGameTurn, 10 - 2 * iHandicap, 2, ["TXT_KEY_ADJECTIVE_UZBEK", "TXT_KEY_ADJECTIVE_KAZAKH"]) #barbarians in Elam if utils.isYearIn(-1600, -1000): self.checkSpawn(iBarbarian, iChariot, 1, (81, 37), (87, 45), self.spawnMinors, iGameTurn, 9 - iHandicap, 0, ["TXT_KEY_ADJECTIVE_ELAMITE"]) #barbarians in north africa if utils.isYearIn(-210, 50): self.checkSpawn(iBarbarian, iNumidianCavalry, 1, (54, 31), (67, 35), self.spawnNomads, iGameTurn, 9 - iHandicap, 3, ["TXT_KEY_ADJECTIVE_BERBER"]) elif utils.isYearIn(50, 900): if utils.getScenario() == i3000BC: #late start condition self.checkSpawn(iBarbarian, iNumidianCavalry, 1 + iHandicap, (54, 31), (67, 35), self.spawnNomads, iGameTurn, 10 - iHandicap, 5, ["TXT_KEY_ADJECTIVE_BERBER"]) elif utils.isYearIn(900, 1800): self.checkSpawn(iBarbarian, iCamelArcher, 1, (54, 27), (67, 35), self.spawnNomads, iGameTurn, 10 - iHandicap, 4, ["TXT_KEY_ADJECTIVE_BERBER"]) #camels in arabia if utils.isYearIn(190, 550): self.checkSpawn(iBarbarian, iCamelArcher, 1, (73, 30), (82, 36), self.spawnNomads, iGameTurn, 9 - iHandicap, 7, ["TXT_KEY_ADJECTIVE_BEDOUIN"]) if utils.isYearIn(-800, 1300): iNumUnits = iHandicap if utils.getScenario() == i3000BC: iNumUnits += 1 self.checkSpawn(iBarbarian, iMedjay, iNumUnits, (66, 28), (71, 34), self.spawnUprising, iGameTurn, 12, 4, ["TXT_KEY_ADJECTIVE_NUBIAN"]) if utils.isYearIn(450, 1600): if utils.getScenario() == i3000BC: self.checkSpawn(iNative, iImpi, 2 + iHandicap, (60, 10), (72, 27), self.spawnNatives, iGameTurn, 10, 4) else: self.checkSpawn(iNative, iImpi, 2 + iHandicap, (60, 10), (72, 27), self.spawnNatives, iGameTurn, 15, 4) elif utils.isYearIn(1600, 1800): self.checkSpawn(iNative, iPombos, 2 + iHandicap, (60, 10), (72, 27), self.spawnNatives, iGameTurn, 10, 4) #west africa if utils.isYearIn(450, 1700): if iGameTurn < getTurnForYear(1300): sAdj = ["TXT_KEY_ADJECTIVE_GHANAIAN"] else: sAdj = ["TXT_KEY_ADJECTIVE_SONGHAI"] self.checkSpawn(iNative, iImpi, 2, (48, 22), (63, 29), self.spawnMinors, iGameTurn, 16, 10, sAdj) if utils.isYearIn(1200, 1700): self.checkSpawn(iBarbarian, iFarari, 1, (48, 26), (65, 37), self.spawnMinors, iGameTurn, 16, 4, sAdj) #American natives if utils.isYearIn(600, 1100): self.checkSpawn(iNative, iDogSoldier, 1 + iHandicap, (15, 38), (24, 47), self.spawnNatives, iGameTurn, 20, 0) if utils.getScenario() == i3000BC: #late start condition self.checkSpawn(iNative, iJaguar, 3, (15, 38), (24, 47), self.spawnNatives, iGameTurn, 16 - 2 * iHandicap, 10) else: #late start condition self.checkSpawn(iNative, iJaguar, 2, (15, 38), (24, 47), self.spawnNatives, iGameTurn, 16 - 2 * iHandicap, 10) if utils.isYearIn(1300, 1600): self.checkSpawn(iNative, iDogSoldier, 2 + iHandicap, (15, 38), (24, 47), self.spawnNatives, iGameTurn, 8, 0) if utils.isYearIn(1400, 1800): self.checkSpawn(iNative, iDogSoldier, 1 + iHandicap, (11, 44), (33, 51), self.spawnUprising, iGameTurn, 12, 0) self.checkSpawn(iNative, iDogSoldier, 1 + iHandicap, (11, 44), (33, 51), self.spawnUprising, iGameTurn, 12, 6) if utils.isYearIn(1300, 1600): if iGameTurn % 18 == 0: if not gc.getMap().plot(27, 29).isUnit(): utils.makeUnitAI(iDogSoldier, iNative, (27, 29), UnitAITypes.UNITAI_ATTACK, 2 + iHandicap) elif iGameTurn % 18 == 9: if not gc.getMap().plot(30, 13).isUnit(): utils.makeUnitAI(iDogSoldier, iNative, (30, 13), UnitAITypes.UNITAI_ATTACK, 2 + iHandicap) if utils.isYearIn(1700, 1900): self.checkSpawn(iNative, iMountedBrave, 1 + iHandicap, (15, 44), (24, 52), self.spawnUprising, iGameTurn, 12 - iHandicap, 2) if utils.isYearIn(1500, 1850): self.checkSpawn(iNative, iMohawk, 1, (24, 46), (30, 51), self.spawnUprising, iGameTurn, 8, 4) #pirates in the Caribbean if utils.isYearIn(1600, 1800): self.checkSpawn(iNative, iPrivateer, 1, (24, 32), (35, 46), self.spawnPirates, iGameTurn, 5, 0) #pirates in Asia if utils.isYearIn(1500, 1900): self.checkSpawn(iNative, iPrivateer, 1, (72, 24), (110, 36), self.spawnPirates, iGameTurn, 8, 0) if iGameTurn < getTurnForYear( tMinorCities[len(tMinorCities) - 1][0]) + 10: self.foundMinorCities(iGameTurn) if iGameTurn == getTurnForYear(tBirth[iInca]): if utils.getHumanID() == iInca: utils.makeUnit(iAucac, iNative, (24, 26), 1) utils.makeUnit(iAucac, iNative, (25, 23), 1)
def checkTurn(self, iGameTurn): #handicap level modifier iHandicap = gc.getHandicapInfo( gc.getGame().getHandicapType()).getBarbarianSpawnModifier() # Leoreth: buff certain cities if independent / barbarian (imported from SoI) if iGameTurn % 20 == 10: for tMinorState in tMinorStates: iStartYear, iEndYear, tPlot, lUnitList = tMinorState if utils.isYearIn(iStartYear, iEndYear): x, y = tPlot plot = gc.getMap().plot(x, y) iOwner = plot.getOwner() if plot.isCity( ) and plot.getNumUnits() < 4 and iOwner >= iNumPlayers: iUnit = utils.getRandomEntry(lUnitList) utils.makeUnit(iUnit, iOwner, tPlot, 1) if utils.isYearIn(-100, 1600): # Brown Bear in Chukchi self.checkLimitedSpawn(iBarbarian, iPolarBear, 1, 5, (140, 65), (148, 76), self.spawnBears, iGameTurn, 10, 1) # Brown Bear and American Black Bear in Alaska and Western Canada self.checkLimitedSpawn(iBarbarian, iPolarBear, 1, 5, (0, 67), (24, 77), self.spawnBears, iGameTurn, 5, 3) # Polar Bear in Greenland and Eastern Canada self.checkLimitedSpawn(iBarbarian, iPolarBear, 1, 5, (25, 63), (44, 77), self.spawnBears, iGameTurn, 5, 5) if utils.isYearIn(-3000, -850): if iHandicap >= 0: self.checkSpawn(iBarbarian, iWarrior, 1, (92, 53), (116, 62), self.spawnMinors, iGameTurn, 5, 0) # Wolves and Brown Bears in Russia and Siberia self.checkSpawn(iBarbarian, iWolf, 1, (89, 66), (125, 75), self.spawnNatives, iGameTurn, 5, 2) self.checkSpawn(iBarbarian, iBear, 1, (89, 66), (125, 75), self.spawnNatives, iGameTurn, 5, 4) # Panthers, Hyenas, and Lions in South Africa self.checkSpawn(iBarbarian, iLion, 1, (67, 12), (84, 34), self.spawnNatives, iGameTurn, 4, 1) self.checkSpawn(iBarbarian, iPanther, 1, (67, 12), (84, 34), self.spawnNatives, iGameTurn, 4, 3) self.checkLimitedSpawn(iBarbarian, iHyena, 1, 5, (67, 12), (84, 34), self.spawnNatives, iGameTurn, 5, 3) # Panthers and Tigers in India, South China, Indochina, and Indonesia self.checkLimitedSpawn(iBarbarian, iPanther, 1, 5, (101, 32), (130, 49), self.spawnNatives, iGameTurn, 5, 1) self.checkLimitedSpawn(iBarbarian, iTiger, 1, 5, (101, 32), (130, 49), self.spawnNatives, iGameTurn, 5, 1) #Asian Black Bears in China, Japan, Manchuria, Vietnam, and Korea self.checkLimitedSpawn(iBarbarian, iBear, 1, 5, (120, 35), (141, 66), self.spawnNatives, iGameTurn, 5, 3) # Jaguars in Brazil, Colombia, and Mesoamerica self.checkLimitedSpawn(iBarbarian, iJaguarAnimal, 1, 5, (34, 24), (49, 36), self.spawnNatives, iGameTurn, 5, 1) self.checkLimitedSpawn(iBarbarian, iJaguarAnimal, 1, 5, (26, 29), (40, 38), self.spawnNatives, iGameTurn, 5, 3) self.checkLimitedSpawn(iBarbarian, iJaguarAnimal, 1, 5, (19, 36), (30, 45), self.spawnNatives, iGameTurn, 5, 3) #celts if utils.isYearIn(-650, -110): self.checkSpawn(iBarbarian, iSwordsman, 1, (57, 56), (76, 61), self.spawnMinors, iGameTurn, 6, 0) if iHandicap >= 0: self.checkSpawn(iBarbarian, iAxeman, 1, (57, 56), (76, 61), self.spawnMinors, iGameTurn, 8, 5, ["TXT_KEY_ADJECTIVE_GAUL"]) #norse if utils.isYearIn(-650, 550): self.checkSpawn(iBarbarian, iGalley, 1, (55, 59), (66, 68), self.spawnPirates, iGameTurn, 20, 0, ["TXT_KEY_ADJECTIVE_NORSE"]) #mongolia if utils.isYearIn(-210, 400): self.checkSpawn(iBarbarian, iHorseArcher, 3 + iHandicap, (118, 55), (129, 58), self.spawnNomads, iGameTurn, 7 - iHandicap, 0, ["TXT_KEY_ADJECTIVE_XIONGNU"]) elif utils.isYearIn(-210, 400): self.checkSpawn(iBarbarian, iHorseArcher, 1 + iHandicap, (106, 54), (114, 59), self.spawnNomads, iGameTurn, 7 - iHandicap, 0, ["TXT_KEY_ADJECTIVE_XIONGNU"]) elif utils.isYearIn(-210, 400): self.checkSpawn(iBarbarian, iHorseArcher, 1 + iHandicap, (114, 60), (125, 65), self.spawnNomads, iGameTurn, 7 - iHandicap, 0, ["TXT_KEY_ADJECTIVE_XIONGNU"]) elif utils.isYearIn(400, 900): iNumUnits = 3 + iHandicap self.checkSpawn( iBarbarian, iHorseArcher, iNumUnits, (110, 58), (129, 65), self.spawnNomads, iGameTurn, 6 - iHandicap, 0, ["TXT_KEY_ADJECTIVE_GOKTURK", "TXT_KEY_ADJECTIVE_UIGHUR"]) elif utils.isYearIn(900, 1100): iNumUnits = 3 + iHandicap self.checkSpawn( iBarbarian, iKeshik, iNumUnits, (110, 58), (129, 65), self.spawnInvaders, iGameTurn, 6, 0, ["TXT_KEY_ADJECTIVE_JURCHEN", "TXT_KEY_ADJECTIVE_KHITAN"]) #tibet if utils.isYearIn(-350, 200): self.checkSpawn(iBarbarian, iLightSwordsman, 1 + iHandicap, (107, 48), (116, 52), self.spawnMinors, iGameTurn, 10 - iHandicap, 3, ["TXT_KEY_ADJECTIVE_TIBETAN"]) elif utils.isYearIn(200, 1100): self.checkSpawn(iBarbarian, iSwordsman, 1 + iHandicap, (107, 48), (116, 52), self.spawnMinors, iGameTurn, 10 - iHandicap, 3, ["TXT_KEY_ADJECTIVE_TIBETAN"]) # Deccan barbarians if utils.isYearIn(-1000, 1200): iUnit = iArcher iStrength = iHandicap if iGameTurn >= getTurnForYear(-500): iUnit = iAxeman if iGameTurn >= getTurnForYear(0): iStrength += 1 if iGameTurn >= getTurnForYear(200): iUnit = iSwordsman self.checkSpawn(iBarbarian, iUnit, iStrength, (101, 31), (111, 42), self.spawnInvaders, iGameTurn, 8 - iHandicap, 0, ["Hindi"]) # elephants in india pre-khmer if utils.isYearIn(-210, 700): self.checkSpawn(iBarbarian, iWarElephant, 1, (103, 35), (117, 45), self.spawnInvaders, iGameTurn, 8 - iHandicap, 4) # elephants in africa if utils.isYearIn(1110, 1450): self.checkSpawn(iBarbarian, iWarElephant, 2, (75, 18), (83, 25), self.spawnInvaders, iGameTurn, 8 - iHandicap, 4) # Longbowman in africa if utils.isYearIn(1450, 1600): self.checkSpawn(iBarbarian, iLongbowman, 2, (75, 18), (83, 25), self.spawnInvaders, iGameTurn, 8 - iHandicap, 4) # OromoWarrior in africa if utils.isYearIn(1610, 1850): self.checkSpawn(iBarbarian, iOromoWarrior, 2, (75, 18), (83, 25), self.spawnInvaders, iGameTurn, 8 - iHandicap, 4) #Indo-Scythians if utils.isYearIn(-200, 400): self.checkSpawn(iBarbarian, iHorseman, 2, (97, 47), (104, 51), self.spawnNomads, iGameTurn, 8 - iHandicap, 4, ["TXT_KEY_ADJECTIVE_INDO_SCYTHIAN"]) #Kushana if utils.isYearIn(30, 220): self.checkSpawn(iBarbarian, iHorseman, 3 + iHandicap, (97, 47), (104, 51), self.spawnInvaders, iGameTurn, 8, 3, ["TXT_KEY_ADJECTIVE_KUSHANA"]) #Hephtalites if utils.isYearIn(400, 550): self.checkSpawn(iBarbarian, iHorseArcher, 2 + iHandicap, (97, 47), (104, 51), self.spawnInvaders, iGameTurn, 5 - iHandicap, 2, ["TXT_KEY_ADJECTIVE_HEPHTHALITE"]) # Holkans in classical Mesoamerica if utils.isYearIn(-200, 100): self.checkSpawn(iBarbarian, iHolkan, 1, (15, 36), (27, 44), self.spawnUprising, iGameTurn, 7, 5) if utils.isYearIn(100, 600): self.checkSpawn(iBarbarian, iHolkan, 1, (15, 36), (27, 44), self.spawnUprising, iGameTurn, 6, 4) elif utils.isYearIn(600, 1000): self.checkSpawn(iBarbarian, iHolkan, 1, (15, 36), (27, 44), self.spawnUprising, iGameTurn, 4, 2) # Picta Aucacs in pre-Incan Andes if utils.isYearIn(800, 1100): self.checkSpawn(iBarbarian, iPictaAucac, 1, (29, 17), (33, 24), self.spawnUprising, iGameTurn, 4, 2) # Jaguars in classical Mesoamerica if utils.isYearIn(150, 500): self.checkSpawn(iBarbarian, iJaguar, 1, (15, 36), (27, 44), self.spawnUprising, iGameTurn, 6, 4) elif utils.isYearIn(500, 1150): self.checkSpawn(iBarbarian, iJaguar, 1, (15, 36), (27, 44), self.spawnUprising, iGameTurn, 4, 2) #pirates in Mediterranean if utils.isYearIn(-210, 50): self.checkSpawn(iBarbarian, iWarGalley, 1, (55, 44), (84, 54), self.spawnPirates, iGameTurn, 8, 0) #pirates in Barbary coast if not gc.getPlayer(iMoors).isAlive(): if utils.isYearIn(-50, 700): self.checkSpawn(iBarbarian, iWarGalley, 1, (52, 41), (72, 49), self.spawnPirates, iGameTurn, 18, 0) elif utils.isYearIn(700, 1400): self.checkSpawn(iBarbarian, iWarGalley, 1, (52, 41), (72, 49), self.spawnPirates, iGameTurn, 8, 0) #pirates in Indian ocean if utils.isYearIn(-650, 700): self.checkSpawn(iBarbarian, iWarGalley, 1, (84, 24), (106, 42), self.spawnPirates, iGameTurn, 18, 0) elif utils.isYearIn(700, 1700): self.checkSpawn(iBarbarian, iHeavyGalley, 1, (84, 24), (106, 42), self.spawnPirates, iGameTurn, 10, 0) # Leoreth: Barbarians in Anatolia (Hittites), replace Hattusas spawn #if utils.isYearIn(-2000, -800): #self.checkSpawn(iBarbarian, iHuluganni, 1 + iHandicap, (81, 51), (86, 55), self.spawnInvaders, iGameTurn, 16, 0, ["TXT_KEY_ADJECTIVE_HITTITE"]) if utils.isYearIn(-2000, -800): self.checkSpawn(iBarbarian, iChariot, 1 + iHandicap, (81, 51), (86, 55), self.spawnInvaders, iGameTurn, 16, 0) #barbarians in europe if utils.isYearIn(-210, 470): self.checkSpawn(iBarbarian, iAxeman, 3 + iHandicap, (57, 55), (74, 61), self.spawnInvaders, iGameTurn, 10, 0, ["TXT_KEY_ADJECTIVE_GERMANIC"]) self.checkSpawn(iBarbarian, iAxeman, 2 + iHandicap, (74, 58), (81, 66), self.spawnInvaders, iGameTurn, 12, 2, ["TXT_KEY_ADJECTIVE_GERMANIC"]) # Leoreth: begins 100 AD instead of 50 AD if utils.isYearIn(100, 470): self.checkSpawn(iBarbarian, iSwordsman, 4, (66, 55), (82, 66), self.spawnInvaders, iGameTurn, 8, 5, ["TXT_KEY_ADJECTIVE_GERMANIC"]) if utils.isYearIn(300, 550): self.checkSpawn(iBarbarian, iAxeman, 4 + iHandicap, (55, 49), (63, 61), self.spawnInvaders, iGameTurn, 5, 4, ["TXT_KEY_ADJECTIVE_VISIGOTHIC"]) self.checkSpawn(iBarbarian, iSwordsman, 4 + iHandicap, (55, 49), (63, 61), self.spawnInvaders, iGameTurn, 5, 2, ["TXT_KEY_ADJECTIVE_VISIGOTHIC"]) self.checkSpawn(iBarbarian, iHorseArcher, 4, (62, 58), (76, 64), self.spawnInvaders, iGameTurn, 5, 0, ["TXT_KEY_ADJECTIVE_HUNNIC"]) if utils.isYearIn(300, 700): self.checkSpawn(iBarbarian, iHorseArcher, 3 + iHandicap, (65, 60), (106, 63), self.spawnInvaders, iGameTurn, 3, 2, ["TXT_KEY_ADJECTIVE_HUNNIC"]) #Leoreth: barbarians in Balkans / Black Sea until the High Middle Ages (Bulgarians, Cumans, Pechenegs) if utils.isYearIn(680, 1000): self.checkSpawn( iBarbarian, iHorseArcher, 3 + iHandicap, (73, 55), (81, 60), self.spawnInvaders, iGameTurn, 6, 2, ["TXT_KEY_ADJECTIVE_AVAR", "TXT_KEY_ADJECTIVE_BULGAR"]) if utils.isYearIn(900, 1200): self.checkSpawn(iBarbarian, iHorseArcher, 3 + iHandicap, (79, 58), (92, 61), self.spawnInvaders, iGameTurn, 8, 5, ["TXT_KEY_ADJECTIVE_CUMAN"]) #1SDAN: Qarmatians (Abu Tahir al-Jannabi) if utils.isYearIn(900, 1000): self.checkSpawn(iBarbarian, iHorseArcher, 1 + iHandicap, (91, 39), (95, 41), self.spawnInvaders, iGameTurn, 3, 2, ["TXT_KEY_ADJECTIVE_QARMATIAN"]) #barbarians in central asia if utils.isYearIn(-1600, -850): self.checkLimitedSpawn(iBarbarian, iVulture, 1, 3, (84, 42), (90, 44), self.spawnNomads, iGameTurn, 8 - iHandicap, 2, ["TXT_KEY_ADJECTIVE_ASSYRIAN"]) elif utils.isYearIn(-850, -200): self.checkSpawn(iBarbarian, iHorseman, 1 + iHandicap, (80, 56), (90, 60), self.spawnInvaders, iGameTurn, 10 - 2 * iHandicap, 3, ["TXT_KEY_ADJECTIVE_SCYTHIAN"]) elif utils.isYearIn(-200, 600): self.checkSpawn(iBarbarian, iHorseman, 2 + iHandicap, (92, 49), (98, 59), self.spawnInvaders, iGameTurn, 7 - iHandicap, 2, ["TXT_KEY_ADJECTIVE_PARTHIAN"]) elif utils.isYearIn(600, 900): #if utils.getScenario() == i3000BC: #late start condition self.checkSpawn(iBarbarian, iOghuz, 2 + iHandicap, (91, 50), (103, 58), self.spawnNomads, iGameTurn, 8 - iHandicap, 2) elif utils.isYearIn(900, 1040): #if utils.getScenario() == i3000BC: #late start condition self.checkSpawn(iBarbarian, iOghuz, 2 + iHandicap, (91, 50), (106, 62), self.spawnNomads, iGameTurn, 6 - iHandicap, 2) # late Central Asian barbarians if utils.isYearIn(1200, 1600): if not utils.getAreaCitiesCiv( iMongolia, utils.getPlotList((82, 58), (95, 70))): self.checkSpawn( iBarbarian, iKeshik, 1 + iHandicap, (88, 57), (94, 61), self.spawnNomads, iGameTurn, 10 - iHandicap, 5, ["TXT_KEY_ADJECTIVE_TATAR", "TXT_KEY_ADJECTIVE_NOGAI"]) if utils.isYearIn(1400, 1700): if utils.getAreaCities(utils.getPlotList((91, 58), (106, 62))): self.checkSpawn( iBarbarian, iKeshik, 1 + iHandicap, (91, 58), (106, 62), self.spawnNomads, iGameTurn, 10 - 2 * iHandicap, 2, ["TXT_KEY_ADJECTIVE_UZBEK", "TXT_KEY_ADJECTIVE_KAZAKH"]) #barbarians in Elam if utils.isYearIn(-1600, -1000): self.checkSpawn(iBarbarian, iChariot, 1, (92, 43), (99, 50), self.spawnMinors, iGameTurn, 9 - iHandicap, 0, ["TXT_KEY_ADJECTIVE_ELAMITE"]) #barbarians in north africa if utils.isYearIn(-210, 50): self.checkSpawn(iBarbarian, iCamelRider, 1, (60, 38), (78, 42), self.spawnNomads, iGameTurn, 9 - iHandicap, 3, ["TXT_KEY_ADJECTIVE_BERBER"]) elif utils.isYearIn(50, 900): if utils.getScenario() == i3000BC: #late start condition self.checkSpawn(iBarbarian, iCamelRider, 1 + iHandicap, (60, 38), (78, 42), self.spawnNomads, iGameTurn, 10 - iHandicap, 5, ["TXT_KEY_ADJECTIVE_BERBER"]) elif utils.isYearIn(900, 1800): self.checkSpawn(iBarbarian, iCamelArcher, 1, (60, 33), (78, 42), self.spawnNomads, iGameTurn, 10 - iHandicap, 4, ["TXT_KEY_ADJECTIVE_BERBER"]) #camels in arabia if utils.isYearIn(190, 550): self.checkSpawn(iBarbarian, iCamelArcher, 1, (85, 36), (96, 42), self.spawnNomads, iGameTurn, 9 - iHandicap, 7, ["TXT_KEY_ADJECTIVE_BEDOUIN"]) if utils.isYearIn(-800, 1300) and self.includesActiveHuman( [iEgypt, iMamluks, iArabia]): iNumUnits = iHandicap if utils.getScenario() == i3000BC: iNumUnits += 1 self.checkSpawn(iBarbarian, iMedjay, iNumUnits, (78, 33), (82, 41), self.spawnUprising, iGameTurn, 12, 4, ["TXT_KEY_ADJECTIVE_NUBIAN"]) if utils.isYearIn(450, 1600): if utils.getScenario() == i3000BC: self.checkSpawn(iNative, iImpi, 2 + iHandicap, (68, 12), (85, 31), self.spawnNatives, iGameTurn, 10, 4) else: self.checkSpawn(iNative, iImpi, 2 + iHandicap, (68, 12), (85, 31), self.spawnNatives, iGameTurn, 15, 4) elif utils.isYearIn(1600, 1800): self.checkSpawn(iNative, iPombos, 2 + iHandicap, (68, 12), (85, 31), self.spawnNatives, iGameTurn, 10, 4) #west africa if utils.isYearIn(450, 1700): if iGameTurn < getTurnForYear(1300): sAdj = ["TXT_KEY_ADJECTIVE_GHANAIAN"] else: sAdj = ["TXT_KEY_ADJECTIVE_SONGHAI"] self.checkSpawn(iNative, iImpi, 2, (55, 28), (70, 34), self.spawnMinors, iGameTurn, 16, 10, sAdj) if utils.isYearIn(1200, 1700): self.checkSpawn(iBarbarian, iFarari, 2, (54, 31), (76, 43), self.spawnMinors, iGameTurn, 16, 4, sAdj) #bulala in Chad if utils.isYearIn(1210, 1571): self.checkSpawn(iNative, iLongbowman, 1, (70, 33), (75, 37), self.spawnNatives, iGameTurn, 5, 2, ["TXT_KEY_ADJECTIVE_BULALA"]) #American natives if utils.isYearIn(-100, 400): self.checkSpawn(iNative, iDogSoldier, 2 + iHandicap, (13, 46), (24, 56), self.spawnNatives, iGameTurn, 20, 0) if utils.isYearIn(400, 1100): self.checkSpawn(iNative, iDogSoldier, 1 + iHandicap, (13, 46), (24, 56), self.spawnNatives, iGameTurn, 20, 0) if utils.getScenario() == i3000BC: #late start condition self.checkSpawn(iNative, iJaguar, 3, (12, 45), (24, 55), self.spawnNatives, iGameTurn, 16 - 2 * iHandicap, 10) else: #late start condition self.checkSpawn(iNative, iJaguar, 2, (12, 45), (24, 55), self.spawnNatives, iGameTurn, 16 - 2 * iHandicap, 10) if utils.isYearIn(1300, 1600): self.checkSpawn(iNative, iDogSoldier, 2 + iHandicap, (12, 45), (24, 55), self.spawnNatives, iGameTurn, 8, 0) if utils.isYearIn(1400, 1800): self.checkSpawn(iNative, iDogSoldier, 1 + iHandicap, (8, 50), (34, 60), self.spawnUprising, iGameTurn, 12, 0) self.checkSpawn(iNative, iDogSoldier, 1 + iHandicap, (8, 50), (34, 60), self.spawnUprising, iGameTurn, 12, 6) if utils.isYearIn(1300, 1600): if iGameTurn % 18 == 0: if not gc.getMap().plot(28, 31).isUnit(): utils.makeUnitAI(iChimuSuchucChiquiAucac, iNative, (28, 31), UnitAITypes.UNITAI_ATTACK, 2 + iHandicap) elif iGameTurn % 18 == 9: if not gc.getMap().plot(34, 20).isUnit(): utils.makeUnitAI(iChimuSuchucChiquiAucac, iNative, (34, 20), UnitAITypes.UNITAI_ATTACK, 2 + iHandicap) if self.includesActiveHuman( [iAmerica, iEngland, iFrance, iMississippi]): if utils.isYearIn(1700, 1900): self.checkSpawn(iNative, iMountedBrave, 1 + iHandicap, (14, 52), (23, 62), self.spawnNomads, iGameTurn, 12 - iHandicap, 2) if utils.isYearIn(1500, 1850): self.checkSpawn(iNative, iMohawk, 1, (24, 54), (31, 61), self.spawnUprising, iGameTurn, 8, 4) # if iGameTurn == getTurnForYear(-500): # gc.getMap().plot(19, 41).setImprovementType(iHut) # utils.makeUnitAI(iHolkan, iNative, (19, 41), UnitAITypes.UNITAI_ATTACK, 2) # Oromos in the Horn of Africa if utils.isYearIn(1500, 1700): iNumUnits = 1 if pEthiopia.isAlive(): iNumUnits += 1 if utils.isYearIn(1650, 1800): iNumUnits += 1 self.checkSpawn(iBarbarian, iOromoWarrior, iNumUnits, (80, 29), (85, 32), self.spawnInvaders, iGameTurn, 8, 3) #pirates in the Caribbean if utils.isYearIn(1600, 1800): self.checkSpawn(iNative, iPrivateer, 1, (25, 37), (38, 53), self.spawnPirates, iGameTurn, 5, 0) #pirates in Asia if utils.isYearIn(1500, 1900): self.checkSpawn(iNative, iPrivateer, 1, (83, 24), (133, 42), self.spawnPirates, iGameTurn, 8, 0) if iGameTurn < getTurnForYear( tMinorCities[len(tMinorCities) - 1][0]) + 10: self.foundMinorCities(iGameTurn) if iGameTurn == getTurnForYear(-1200): pJerusalem = gc.getGame().getHolyCity(iJudaism) if pJerusalem and pJerusalem.getOwner() >= iNumMajorPlayers: pJerusalem.setHasRealBuilding(iJewishShrine, True)