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())
pPlayer = gc.getPlayer(pWinner.getOwner())
bUncaptured = True
pLPlayer = gc.getPlayer(pLoser.getOwner())
iRoot = gc.getInfoTypeForString('PROMOTION_ROOT')
iFlanking1 = gc.getInfoTypeForString('PROMOTION_FLANKING1')
iFlanking2 = gc.getInfoTypeForString('PROMOTION_FLANKING2')
iFlanking3 = gc.getInfoTypeForString('PROMOTION_FLANKING3')
iRnd = CyGame().getSorenRandNum(100, "Maniac")
if pLoser.isHasPromotion(iRoot):
iRnd = iRnd - 150
if pLoser.isHasPromotion(iFlanking1):
iRnd = iRnd + 20
if pLoser.isHasPromotion(iFlanking2):
iRnd = iRnd + 20
if pLoser.isHasPromotion(iFlanking3):
iRnd = iRnd + 10
if pWinner.isHasPromotion(iFlanking1):
iRnd = iRnd - 20
if pWinner.isHasPromotion(iFlanking2):
iRnd = iRnd - 20
if pWinner.isHasPromotion(iFlanking3):
iRnd = iRnd - 10
if iRnd >= 101:
pPlot = cf.FFHFindClearPlot(pLoser, -1)
if pPlot != -1:
newUnit = pLPlayer.initUnit(pLoser.getUnitType(), pPlot.getX(), pPlot.getY(), UnitAITypes.NO_UNITAI)
CyInterface().addMessage(pWinner.getOwner(),True,25,'Our enemies flee like cowards!','AS2D_DISCOVERBONUS',1,'Art/Interface/Buttons/Highscores/Warp.dds',ColorTypes(8),pPlot.getX(),pPlot.getY(),True,True)
CyInterface().addMessage(pLoser.getOwner(),True,25,'Tactical retreat succesful.','AS2D_DISCOVERBONUS',1,'Art/Interface/Buttons/Highscores/Warp.dds',ColorTypes(8),pPlot.getX(),pPlot.getY(),True,True)
newUnit.setDamage(95, True)
newUnit.setExperience(pLoser.getExperience(), -1)
newUnit.setLevel(pLoser.getLevel())
for iCount in range(gc.getNumPromotionInfos()):
if (pLoser.isHasPromotion(iCount)):
newUnit.setHasPromotion(iCount, True)