Hello, I want to identify all cities (in the civ) with a specific improvement around them. In this case the improvement in question is the plantation as I want to create an event for the abolition of slavery.The ultimate goal is to add some unhappiness from those poor planters who would not be able to oppress other people ever again...
Here is what I hope to be a good beginning, but now I must retrieve the list of the included cities.
Here is what I hope to be a good beginning, but now I must retrieve the list of the included cities.
Code:
def canApplyPlantersRebellion(argsList):
iEvent = argsList[0]
kTriggeredData = argsList[1]
listPlantation = []
listPlantation.append(CvUtil.findInfoTypeNum(gc.getImprovementInfo,gc.getNumImprovementInfos(),'IMPROVEMENT_PLANTATION'))
listPlots = []
loopPlot.isCity()
for iDX in range(-1, 2):
for iDY in range(-1, 2):
loopPlot = plotXY(kTriggeredData.iPlotX, kTriggeredData.iPlotY, iDX, iDY)
if not loopPlot.isNone():
if (iDX != 0 or iDY != 0):
if loopPlot.getImprovementType() != -1:
listPlots.append(loopPlot)
return
for i in range(3):
if len(listPlots) > 0:
plot = listPlots[gc.getGame().getSorenRandNum(len(listPlots), "")]
iImprovement = plot.getImprovementType()
if iImprovement in listPlantation:
return true