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())
#############################
## Start Modifaction Block ##
#############################
xType = unitX.getUnitCombatType()
yType = unitY.getUnitCombatType()
if (yType != gc.getInfoTypeForString("UNITCOMBAT_SIEGE") and yType != gc.getInfoTypeForString("UNITCOMBAT_ARMOR") and yType != gc.getInfoTypeForString("UNITCOMBAT_HELICOPTER") and yType != gc.getInfoTypeForString("UNITCOMBAT_NAVAL") and yType != gc.getInfoTypeForString("NONE")):
if (xType != gc.getInfoTypeForString("UNITCOMBAT_HELICOPTER") and xType != gc.getInfoTypeForString("NONE")):
iRand = random.randint(1, 100)
if (iRand <= 5):
newUnit = playerX.player.initUnit(pLoser.getUnitType(), pWinner.getX(), pWinner.getY(), UnitAITypes.NO_UNITAI)
newUnit.finishMoves()
newUnit.setDamage(50, False)
newUnit.setExperience(pLoser.getExperience(), -1)
newUnit.setLevel(pLoser.getLevel())
for iCount in range(gc.getNumPromotionInfos()):
if (pLoser.isHasPromotion(iCount)):
newUnit.setHasPromotion(iCount, True)
#############################
## End Modifaction Block ##
#############################
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()))