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())
# Animal bonus start
player = pWinner.getOwner()
winnerOwner = gc.getPlayer(player)
team = winnerOwner.getTeam()
winnerTeam = gc.getTeam(team)
pLoserType = pLoser.getUnitType()
if (pLoserType == gc.getInfoTypeForString('UNIT_ELEPHANT')):
if winnerTeam.isHasTech(gc.getInfoTypeForString('TECH_ANIMAL_HUSBANDRY')):
pLoser.plot().setBonusType(gc.getInfoTypeForString('BONUS_IVORY'))
if (pLoserType == gc.getInfoTypeForString('UNIT_HORSE')):
if winnerTeam.isHasTech(gc.getInfoTypeForString('TECH_ANIMAL_HUSBANDRY')):
pLoser.plot().setBonusType(gc.getInfoTypeForString('BONUS_HORSE'))
if (pLoserType == gc.getInfoTypeForString('UNIT_DEER')):
if winnerTeam.isHasTech(gc.getInfoTypeForString('TECH_ANIMAL_HUSBANDRY')):
pLoser.plot().setBonusType(gc.getInfoTypeForString('BONUS_DEER'))
# Animal bonus end
#slave mod#
if (pWinner.isMadeAttack()):
iAttacker = pWinner.getOwner()
attacker = PyPlayer(iAttacker)
if gc.getPlayer(iAttacker).isCivic(CvUtil.findInfoTypeNum(gc.getCivicInfo,gc.getNumCivicInfos(),'CIVIC_SLAVERY')):
if ((pLoser.plot()).isCity() == 0):
if (pLoser.isAnimal() == 0):
if (pLoser.getCaptureUnitType((gc.getPlayer(pLoser.getOwner())).getCivilizationType()) == -1):
# you can change the chance of getting slaves with this between 0-99, 0 means 0% and 99 100%
iChance = 30
iRandNum = CyGame().getSorenRandNum(99, "Slave")
if iChance < iRandNum:
attacker.initUnit(gc.getCivilizationInfo(gc.getPlayer(iAttacker).getCivilizationType()).getCivilizationUnits(CvUtil.findInfoTypeNum(gc.getUnitClassInfo, gc.getNumUnitClassInfos(), 'UNITCLASS_SLAVE')), pWinner.getX(), pWinner.getY(), UnitAITypes.NO_UNITAI)
#slave mod#