FFHSpells.py, the function reqPirateCove.
def reqPirateCove(caster):
if caster.getUnitClassType() != gc.getInfoTypeForString('UNITCLASS_WORKER'):
return False
if not canCast(caster):
return False
pPlayer = gc.getPlayer(caster.getOwner())
if pPlayer.getCivilizationType() != gc.getInfoTypeForString('CIVILIZATION_LANUN'):
return False
if pPlayer.isHuman() == False:
return False
iX = caster.getX()
iY = caster.getY()
pPlot = caster.plot()
if pPlot.isWater():
return False
if pPlot.area().getNumTiles() == 1:
return False
if pPlot.getNumUnits() > 1:
return False
if pPlot.isCity():
return False
if (pPlot.isOwned() and pPlot.getOwner() != caster.getOwner()):
return False
if pPlot.getImprovementType() != -1:
return False
bValid = False
for iiX in range(iX-1, iX+2, 1):
for iiY in range(iY-1, iY+2, 1):
pPlot = CyMap().plot(iiX,iiY)
if pPlot.isWater():
bValid = True
if bValid == False:
return False
for iiX in range(iX-2, iX+3, 1):
for iiY in range(iY-2, iY+3, 1):
pPlot = CyMap().plot(iiX,iiY)
if pPlot.getImprovementType() == gc.getInfoTypeForString('IMPROVEMENT_PIRATE_COVE'):
return False
return True
def spellPirateCove(caster):
doCast(caster)
pPlayer = gc.getPlayer(caster.getOwner())
pPlot = caster.plot()
caster.setXY(pPlayer.getCapitalCity().getX(), pPlayer.getCapitalCity().getY())
pPlot.setBonusType(-1)
pPlot.setFeatureType(-1, -1)
pPlot.setPlotType(PlotTypes.PLOT_OCEAN, True, True)
pPlot.setTerrainType(gc.getInfoTypeForString('TERRAIN_COAST'),True,True)
pPlot.setImprovementType(gc.getInfoTypeForString('IMPROVEMENT_PIRATE_COVE'))
caster.setHasPromotion(gc.getInfoTypeForString('PROMOTION_GOLEM'), True)
caster.kill(True, 0)
CyMap().recalculateAreas()
for iiX in range(iX-2, iX+3, 1):
for iiY in range(iY-2, iY+3, 1):
pPlot = CyMap().plot(iiX,iiY)
if pPlot.getImprovementType() == gc.getInfoTypeForString('IMPROVEMENT_PIRATE_COVE'):
return False
def reqPirateCove(caster):
if caster.getUnitClassType() != gc.getInfoTypeForString('UNITCLASS_WORKER'):
return False
if not canCast(caster):
return False
pPlayer = gc.getPlayer(caster.getOwner())
if pPlayer.getCivilizationType() != gc.getInfoTypeForString('CIVILIZATION_LANUN'):
return False
if pPlayer.isHuman() == False:
return False
iX = caster.getX()
iY = caster.getY()
pPlot = caster.plot()
if pPlot.isWater():
return False
if pPlot.area().getNumTiles() == 1:
return False
if pPlot.getNumUnits() > 1:
return False
if pPlot.isCity():
return False
if (pPlot.isOwned() and pPlot.getOwner() != caster.getOwner()):
return False
if pPlot.getImprovementType() != -1:
return False
bValid = False
## for iiX in range(iX-1, iX+2, 1):
## for iiY in range(iY-1, iY+2, 1):
## pPlot = CyMap().plot(iiX,iiY)
## if pPlot.isWater():
## bValid = True
## if bValid == False:
## return False
## for iiX in range(iX-2, iX+3, 1):
## for iiY in range(iY-2, iY+3, 1):
## pPlot = CyMap().plot(iiX,iiY)
## if pPlot.getImprovementType() == gc.getInfoTypeForString('IMPROVEMENT_PIRATE_COVE'):
## return False
return True
for iiY in range(iY-2, iY+3, 1):
for iiY in range(iY-4, iY+5, 1):
it seems to me that you need to set bValid to true...
You should not comment out the first loop, that checks if there's water nearby. Commenting out the second loop will work. I just did so and then built three piratecoves next to eachother.
No you do not need to start a new game. You can even make the python changes while playing. That's what I did. (But if you do make the changes while in the game you'll need to move the worker for the option to show up)
You can do that? Great! Never thought of trying to change something while running the game. Does it work with XML changes as well? Probably not, because it's all read in when starting the game, but it can't hurt to ask.