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)
Exemplo n.º 2
0
    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)
        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)

            # 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: 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)
Exemplo n.º 3
0
        def onBuildingBuilt(self, argsList):
                city, iBuildingType = argsList
                iOwner = city.getOwner()
                vic.onBuildingBuilt(iOwner, iBuildingType)
                if iOwner < con.iNumPlayers:
                        self.com.onBuildingBuilt(iOwner, iBuildingType, city)
		
		if isWorldWonderClass(gc.getBuildingInfo(iBuildingType).getBuildingClassType()):
			sta.onWonderBuilt(iOwner, iBuildingType)
			
		if iBuildingType == con.iPalace:
			sta.onPalaceMoved(iOwner)
			
			if city.isHasRealBuilding(con.iSummerPalace): city.setHasRealBuilding(con.iSummerPalace, False)

		# Leoreth: Apostolic Palace moves holy city
		if iBuildingType == con.iApostolicPalace:
			self.rel.foundOrthodoxy(iOwner)
			
			# Leoreth: build shrine in 3000 BC scenario during HRE autoplay to provide a challenge
			if utils.getScenario() == con.i3000BC and utils.getHumanID() == con.iHolyRome and gc.getGame().getGameTurnYear() < 840:
				gc.getGame().getHolyCity().setHasRealBuilding(con.iChristianShrine, True)
			
			gc.getGame().setHolyCity(con.iChristianity, city, False)

		# Leoreth: update trade routes when Porcelain Tower is built to start its effect
		if iBuildingType == con.iPorcelainTower:
			gc.getPlayer(iOwner).updateTradeRoutes()

		# Leoreth/Voyhkah: Empire State Building
		if iBuildingType == con.iEmpireState:
			iPop = city.getPopulation()
			city.setBuildingCommerceChange(gc.getInfoTypeForString("BUILDINGCLASS_EMPIRE_STATE"), 0, iPop)
			
		# Leoreth: Machu Picchu
		if iBuildingType == con.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 == con.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 == con.iMezquita:
			lGPList = [0, 0, 0, 0, 0, 0, 0]
			for city in utils.getCityList(iOwner):
				for i in range(7):
					iSpecialistUnit = utils.getUniqueUnit(iOwner, con.iProphet + i)
					lGPList[i] += city.getGreatPeopleUnitProgress(iSpecialistUnit)
			iGPType = utils.getUniqueUnit(iOwner, con.iProphet + utils.getHighestIndex(lGPList))
			utils.makeUnit(iGPType, iOwner, (city.getX(), city.getY()), 1)
			CyInterface().addMessage(iOwner, False, con.iDuration, CyTranslator().getText("TXT_KEY_MEZQUITA_FREE_GP", (gc.getUnitInfo(iGPType).getText(), city.getName())), "", InterfaceMessageTypes.MESSAGE_TYPE_MINOR_EVENT, gc.getUnitInfo(iGPType).getButton(), ColorTypes(con.iWhite), city.getX(), city.getY(), True, True)

		# Leoreth: found Buddhism when a Hindu temple is built
		if iBuildingType == con.iHinduTemple:
			self.rel.foundBuddhism(city)
			
		# Leoreth: in case human Phoenicia moves palace to Carthage
		if iBuildingType == con.iPalace:
			if iOwner == con.iCarthage and city.getX() == 58 and city.getY() == 39:
				if not utils.isReborn(iOwner): gc.getPlayer(con.iCarthage).setReborn(True)