import CvUtil
import CvGameUtils
import CvGameInterfaceFile
import CvEventInterface
from CvPythonExtensions import *
class CvFuryRoadGameUtils(CvGameUtils.CvGameUtils):
### PUBLIC OVERRIDE FUNCTIONS
def __init__(self):
self.parent = CvGameUtils.CvGameUtils
self.parent.__init__(self)
self.gc = CyGlobalContext()
self.lastPlayer = -1 ; self.lastTurn = -1
self.dOrder = {}
self.iTruck = -1 ; self.iCapitol = -1
self.iFall = -1 ; self. iImmune = -1
[COLOR="red"]#Added in "Founding Cities Only On Specific Tiles"
def cannotFoundCity(self,argsList):
iPlayer, iPlotX, iPlotY = argsList
pPlot = CyMap().plot(iPlotX, iPlotY)
for i in range(pPlot.getNumUnits()):
pUnit = pPlot.getUnit(i)
if pUnit.getUnitType() == gc.getInfoTypeForString('UNIT_SETTLER'):
return False
elif pUnit.getUnitType() == gc.getInfoTypeForString('UNIT_EXCAVATOR'):
if pPlot.getFeatureType() == gc.getInfoTypeForString('FEATURE_RUIN'):
return False
return True
#End of Additions[/COLOR]
# Prevent unit from moving into fallout without radimmune
# Be sure to check XML/PythonCallbackDefines.xml for UNIT_CANNOT_MOVE_INTO
def unitCannotMoveInto(self,argsList):
iPlayer, iUnitId, iPlotX, iPlotY = argsList
pUnit = self.gc.getPlayer(iPlayer).getUnit(iUnitId)
if self.iFall == -1:
self.iFall = self.gc.getInfoTypeForString("FEATURE_FALLOUT")
self.iImmune = self.gc.getInfoTypeForString("PROMOTION_RADIMMUNE")
if CyMap().plot(iPlotX, iPlotY).getFeatureType() == self.iFall:
if pUnit.isHasPromotion(self.iImmune): return false
return true
return self.parent.unitCannotMoveInto(self,argsList)