# Natural Wonders - Start
# This is the code that spawns each natural wonder into the map to add new wonder see below!
dNaturalWonders = {\
#These are parameters for new wonders, you pick a type ie: "TERRAIN_DESERT" and then things about it
# in order of appearance: is it a hill?, (if coast) is it next to a land tile? is it a river? is it a mountain?
# (if water) is it a lake?, is the tile adjectent to lake or oasis?, is it next to the sea (possibly lake?)?, is it a water tile?
# True for yes
# False for no
# None for doesn't matter (same for terrain, however in this case bWater will handle plot type (bWater CANNOT be None))
#Wonder XML name:[TerrainType, bHills, bAdjecentLand, bRiver, bPeak, bLake, bFreshWater, bCostalLand, bWater (CANNOT BE NONE!)]
"FEATURE_DEVILS_TABLE":["TERRAIN_PLAINS", True, None, None, None, None, None, None, False],\
"FEATURE_ULURU":["TERRAIN_DESERT", False, None, None, None, None, None, None, False],\
"FEATURE_SUGARLOAF":["TERRAIN_COAST", None, True, None, None, None, None, None, True]\
}
Map = gc.getMap()
Game = CyGame()
for wonder in dNaturalWonders.iterkeys():
WonderType = gc.getInfoTypeForString(wonder)
TerrainType = gc.getInfoTypeForString(dNaturalWonders[wonder][0])
bHills = dNaturalWonders[wonder][1]
bAdjecentLand = dNaturalWonders[wonder][2]
bRiver = dNaturalWonders[wonder][3]
bPeak = dNaturalWonders[wonder][4]
bLake = dNaturalWonders[wonder][5]
bFreshWater = dNaturalWonders[wonder][6]
bCoastalLand = dNaturalWonders[wonder][7]
bWater = dNaturalWonders[wonder][8]
if bWater:
bHills = None
bRiver = None
bPeak = None
bFreshWater = None
bCostalLand = None
else:
bAdjecentLand = None
bLake = None
#start checking plots
lPlots = list()
for x in xrange(Map.getGridWidth()):
for y in xrange(Map.getGridHeight()):
pPlot = Map.plot(x, y)
bPlotPerfect = True
if not pPlot.isWater() and not pPlot.isAdjacentToLand(): continue #this must be one tile island...
for team in xrange(Game.countCivTeamsEverAlive()):
if pPlot.isRevealed(team, False) or not pPlot.getBonusType(team) == -1: bPlotPerfect = False
if not bPlotPerfect: continue
if not TerrainType == None:
if not pPlot.getTerrainType() == TerrainType: continue
else:
if not pPlot.isWater() == bWater: continue
if not bHills == None:
if not pPlot.isHills() == bHills: continue
if not bAdjecentLand == None:
if not pPlot.isAdjacentToLand() == bAdjecentLand: continue
if not bRiver == None:
if not pPlot.isRiver() == bRiver: continue
if not bPeak == None:
if not pPlot.isPeak() == bPeak: continue
if not bLake == None:
if not pPlot.isLake() == bLake: continue
if not bFreshWater == None:
if not pPlot.isFreshWater() == bFreshWater: continue
if not bCoastalLand == None:
if not pPlot.isCoastalLand() == bCoastalLand: continue
#if bPlotPerfect:
lPlots.append(pPlot)
pPlot = lPlots[Game.getSorenRandNum(len(lPlots), "Random Plot")]
pPlot.setBonusType(-1) #just in case previous code fails for some reason!
pPlot.setFeatureType(WonderType, 0)
# Natural Wonders - End