def spellTsunami(caster,target):
doCast(caster)
pPlot = target
if pPlot.isOwned():
startWar(caster.getOwner(), pPlot.getOwner())
for i in range(pPlot.getNumUnits()):
pUnit = pPlot.getUnit(i)
if isResisted(pUnit,caster,0) == False:
iDmg = pUnit.getDamage() + 10 + CyGame().getSorenRandNum(20, "Bob")
if iDmg > 100:
pUnit.kill(True,0)
else:
pUnit.setDamage(iDmg, True)
#if CyGame().getSorenRandNum(100, "Bob") <= gc.getDefineINT('TSUNAMI_FLOOD_CHANCE'):
if pPlot.isCity():
if pPlot.getPlotCity().getPopulation() > 2:
pPlot.getPlotCity().changePopulation(-2)
else:
pPlot.getPlotCity().kill()
else:
pPlot.setImprovementType(-1)
iniPlotType = pPlot.getPlotType()
pPlot.setFeatureType(-1, -1)
if iniPlotType == 0:
pPlot.setPlotType(PlotTypes.PLOT_HILLS, True, True)
if iniPlotType == 1:
pPlot.setPlotType(PlotTypes.PLOT_LAND, True, True)
if iniPlotType == 2:
pPlot.setBonusType(-1)
pPlot.setPlotType(PlotTypes.PLOT_OCEAN, True, True)
for i in range(pPlot.getNumUnits()):
pUnit = pPlot.getUnit(i)
pPlot2 = findClearPlot(pUnit)
if pPlot2 == -1:
pUnit.kill(True,0)
else:
pUnit.setXY(pPlot2.getX(),pPlot2.getY())