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 placeUpgrades(self): screen = self.top.getScreen() panel = self.top.getNextWidgetName() screen.addPanel(panel, " ", "", False, True, self.X_UPGRADES, self.Y_UPGRADES, self.W_UPGRADES, self.H_UPGRADES, PanelStyles.PANEL_STYLE_BLUE50) screen.attachLabel(panel, "", " ") for iUnitClass in xrange(gc.getNumUnitClassInfos()): if gc.getUnitInfo(self.iUnit).getUpgradeUnitClass(iUnitClass): if self.top.iActivePlayer >= 0 and self.iUnit == utils.getUniqueUnit(self.top.iActivePlayer, self.iUnit): iUnit = utils.getUniqueUnitType(self.top.iActivePlayer, iUnitClass) else: iUnit = gc.getUnitClassInfo(iUnitClass).getDefaultUnitIndex() screen.attachImageButton(panel, "", gc.getUnitInfo(iUnit).getButton(), GenericButtonSizes.BUTTON_SIZE_CUSTOM, WidgetTypes.WIDGET_PEDIA_JUMP_TO_UNIT, iUnit, 1, False)
def canadianUP(self, city): iPopulation = 5 * city.getPopulation() / 2 lProgress = [] bAllZero = True for iSpecialist in [iGreatProphet, iGreatArtist, iGreatScientist, iGreatMerchant, iGreatEngineer, iGreatStatesman]: iProgress = city.getGreatPeopleUnitProgress(utils.getUniqueUnit(city.getOwner(), iSpecialist)) if iProgress > 0: bAllZero = False lProgress.append(iProgress) if bAllZero: iGreatPerson = utils.getRandomEntry([iGreatProphet, iGreatArtist, iGreatScientist, iGreatMerchant, iGreatEngineer, iGreatStatesman]) else: iGreatPerson = utils.getHighestIndex(lProgress) + iGreatProphet iGreatPerson = utils.getUniqueUnit(city.getOwner(), iGreatPerson) city.changeGreatPeopleProgress(iPopulation) city.changeGreatPeopleUnitProgress(iGreatPerson, iPopulation) if utils.getHumanID() == city.getOwner(): CyInterface().addMessage(city.getOwner(), False, iDuration, CyTranslator().getText("TXT_KEY_UP_MULTICULTURALISM", (city.getName(), gc.getUnitInfo(iGreatPerson).getText(), iPopulation)), "", InterfaceMessageTypes.MESSAGE_TYPE_MINOR_EVENT, gc.getUnitInfo(iGreatPerson).getButton(), ColorTypes(iGreen), city.getX(), city.getY(), True, True)
def placeUpgrades(self): screen = self.top.getScreen() panel = self.top.getNextWidgetName() screen.addPanel(panel, " ", "", False, True, self.X_UPGRADES, self.Y_UPGRADES, self.W_UPGRADES, self.H_UPGRADES, PanelStyles.PANEL_STYLE_BLUE50) screen.attachLabel(panel, "", " ") for iUnitClass in xrange(gc.getNumUnitClassInfos()): if gc.getUnitInfo(self.iUnit).getUpgradeUnitClass(iUnitClass): if self.top.iActivePlayer >= 0 and self.iUnit == utils.getUniqueUnit( self.top.iActivePlayer, self.iUnit): iUnit = utils.getUniqueUnitType(self.top.iActivePlayer, iUnitClass) else: iUnit = gc.getUnitClassInfo( iUnitClass).getDefaultUnitIndex() screen.attachImageButton(panel, "", gc.getUnitInfo(iUnit).getButton(), GenericButtonSizes.BUTTON_SIZE_CUSTOM, WidgetTypes.WIDGET_PEDIA_JUMP_TO_UNIT, iUnit, 1, False)