def onCombatResult(self, argsList):
'Combat Result'
pWinner,pLoser = argsList
playerX = PyPlayer(pWinner.getOwner())
unitX = PyInfo.UnitInfo(pWinner.getUnitType())
playerY = PyPlayer(pLoser.getOwner())
unitY = PyInfo.UnitInfo(pLoser.getUnitType())
# ---- UNIT: BANDEIRANTES Start --------------
if pWinner.getUnitType() == gc.getInfoTypeForString("UNIT_BANDEIRANTES"):
if CyGame().getSorenRandNum(2, "Random number for Unit Bandeirantes to get Worker or Settler") == 0:
iUnit = gc.getInfoTypeForString("UNIT_WORKER")
iUnitAIType = UnitAITypes.UNITAI_WORKER
else:
iUnit = gc.getInfoTypeForString("UNIT_SETTLER")
iUnitAIType = UnitAITypes.UNITAI_SETTLE
# Create the unit
NewUnit = playerX.initUnit(iUnit, pWinner.getX(), pWinner.getY(), iUnitAIType, DirectionTypes.DIRECTION_SOUTH)
NewUnit.finishMoves()
# optional, only english, if you want it in more languages use CyTranslator() and add a tag in a TextInfo.xml
if playerX.isHuman():
CyInterface().addMessage(pWinner.getOwner(), True, 10, "Your Bandeirantes has captured a "+PyInfo.UnitInfo(iUnit).getDescription()+"!", None, 2, PyInfo.UnitInfo(iUnit).getButton(), ColorTypes(14), unitX.getX(), unitX.getY(), True, True)
# ---- UNIT: BANDEIRANTES End ----------------
if (not self.__LOG_COMBAT):
return
if playerX and playerX and unitX and playerY:
CvUtil.pyPrint('Player %d Civilization %s Unit %s has defeated Player %d Civilization %s Unit %s'
%(playerX.getID(), playerX.getCivilizationName(), unitX.getDescription(),
playerY.getID(), playerY.getCivilizationName(), unitY.getDescription()))