def onBuildingBuilt(self, argsList):
'Building Completed'
pCity, iBuildingType = argsList
game = gc.getGame()
if ( iBuildingType == gc.getInfoTypeForString("BUILDING_MACHU_PICCHU") ):
pPlayer = gc.getPlayer(pCity.plot().getOwner())
iPID = pPlayer.getID()
iTID = pPlayer.getTeam()
iX = pCity.getX()
iY = pCity.getY()
### check inner city radius for Peaks (MachuPicchu Wonder prefers to be in the inner city radius of the home city of this wonder) ###
lPeakPlotX = []
lPeakPlotY = []
for iXLoop in range(iX - 1, iX + 2, 1):
for iYLoop in range(iY - 1, iY + 2, 1):
pPlot = CyMap().plot(iXLoop, iYLoop)
if ( pPlot.isPlayerCityRadius(iPID)==true ):
if ( pPlot.getTeam()==iTID ):
if ( pPlot.isPeak()==true ):
lPeakPlotX.append(iXLoop)
lPeakPlotY.append(iYLoop)
if ( len(lPeakPlotX) < 1 ):
### check all city radius plots for Peaks if no inner peak available ###
lPeakPlotX = []
lPeakPlotY = []
for iXLoop in range(iX - 2, iX + 3, 1):
for iYLoop in range(iY - 2, iY + 3, 1):
pPlot = CyMap().plot(iXLoop, iYLoop)
if ( pPlot.isPlayerCityRadius(iPID)==true ):
if ( pPlot.getTeam()==iTID ):
if ( pPlot.isPeak()==true ):
lPeakPlotX.append(iXLoop)
lPeakPlotY.append(iYLoop)
if ( len(lPeakPlotX) > 0 ):
it_machu_picchu = gc.getInfoTypeForString( "IMPROVEMENT_MACHU_PICCHU" )
### set bonus for peaks in all city radius plots ###
for iCity in range(pPlayer.getNumCities()):
ppCity = pPlayer.getCity(iCity)
iiX = ppCity.getX()
iiY = ppCity.getY()
### check all city radius plots for peak ###
for iXLoop in range(iiX - 2, iiX + 3, 1):
for iYLoop in range(iiY - 2, iiY + 3, 1):
lPlot = CyMap().plot(iXLoop, iYLoop)
if ( lPlot.isPlayerCityRadius(iPID)==true ):
if ( lPlot.getTeam()==iTID ):
if(lPlot.getTerrainType() != -1):
if ( lPlot.isPeak()==true ):
lPlot.setImprovementType(it_machu_picchu)
### now set bonus only with matchu picchu and remove matchu picchu (overlapping city radius) ###
for iCity in range(pPlayer.getNumCities()):
ppCity = pPlayer.getCity(iCity)
iiX = ppCity.getX()
iiY = ppCity.getY()
### check all city radius plots for peak ###
for iXLoop in range(iiX - 2, iiX + 3, 1):
for iYLoop in range(iiY - 2, iiY + 3, 1):
lPlot = CyMap().plot(iXLoop, iYLoop)
if ( lPlot.isPlayerCityRadius(iPID)==true ):
if ( lPlot.getTeam()==iTID ):
if(lPlot.getTerrainType() != -1):
if ( lPlot.isPeak()==true ):
if ( lPlot.getImprovementType() == it_machu_picchu ):
CyGame().setPlotExtraYield(iXLoop, iYLoop, YieldTypes.YIELD_FOOD, 1)
CyGame().setPlotExtraYield(iXLoop, iYLoop, YieldTypes.YIELD_PRODUCTION, 2)
CyGame().setPlotExtraYield(iXLoop, iYLoop, YieldTypes.YIELD_COMMERCE, 1)
lPlot.setImprovementType(-1)
### ausgabe ###
CyInterface().addMessage(iPID,True,0,' ','',1,'Art/Interface/Buttons/MachuPicchu_Python/MachuPicchu_Python_211.dds',ColorTypes(5), iXLoop, iYLoop,True,True)
### set machu picchu on hill ###
### get random Peak from list ###
iRand = CyGame().getSorenRandNum( len(lPeakPlotX), "Random Peak")
iXPeak = lPeakPlotX[iRand]
iYPeak = lPeakPlotY[iRand]
pPeakPlot = CyMap().plot(iXPeak, iYPeak)
#pPeakPlot.setFeatureType(gc.getInfoTypeForString( "FEATURE_FOREST" ), 1)
pPeakPlot.setImprovementType(gc.getInfoTypeForString( "IMPROVEMENT_MACHU_PICCHU" ))
CyGame().setPlotExtraYield(iXPeak, iYPeak, YieldTypes.YIELD_FOOD, 1)
CyGame().setPlotExtraYield(iXPeak, iYPeak, YieldTypes.YIELD_COMMERCE, 6)
plot_culture_1_10 = int(pPeakPlot.getCulture(iPID) * 0.10)
pPeakPlot.changeCulture(iPID, plot_culture_1_10, true)
### ausgabe ###
CyInterface().addMessage(iPID,false,10,CyTranslator().getText("TXT_KEY_MACHU_PICCHU_GAMETXT1",(iXPeak,iXPeak)),'',0,gc.getBuildingInfo(gc.getInfoTypeForString("BUILDING_MACHU_PICCHU")).getButton(),ColorTypes(5), iXPeak, iYPeak,True,True)
### message: The Machu Picchu provides some benefits from Peaks! ###
### set additional bonus for peaks in the wonder city radius ###
for iXLoop in range(iX - 2, iX + 3, 1):
for iYLoop in range(iY - 2, iY + 3, 1):
pPlot = CyMap().plot(iXLoop, iYLoop)
if ( pPlot.isPlayerCityRadius(iPID)==true ):
if ( pPlot.getTeam()==iTID ):
if(pPlot.getTerrainType() != -1):
if ( pPlot.isPeak()==true ):
CyGame().setPlotExtraYield(iXLoop, iYLoop, YieldTypes.YIELD_COMMERCE, 1)
### ausgabe ###
if ( iXLoop != iXPeak or iYLoop != iYPeak ):
CyInterface().addMessage(iPID,True,0," ",'0',1,'Art/Interface/Buttons/MachuPicchu_Python/MachuPicchu_Python_212.dds',ColorTypes(5), iXLoop, iYLoop,True,True)
else:
CyInterface().addMessage(iPID,True,0," ",'0',1,'Art/Interface/Buttons/MachuPicchu_Python/MachuPicchu_Python_218.dds',ColorTypes(5), iXLoop, iYLoop,True,True)