def onCombatResult(self, argsList):
		self.up.aztecUP(argsList)
		self.rnf.immuneMode(argsList)
		self.up.vikingUP(argsList) # includes Moorish Corsairs
		
		pWinningUnit, pLosingUnit = argsList
		
		vic.onCombatResult(pWinningUnit, pLosingUnit)
		
		iUnitPower = 0
		pLosingUnitInfo = gc.getUnitInfo(pLosingUnit.getUnitType())
		
		if pLosingUnitInfo.getUnitCombatType() != gc.getInfoTypeForString("UNITCOMBAT_SIEGE"):
			iUnitPower = pLosingUnitInfo.getPowerValue()
		
		sta.onCombatResult(pWinningUnit.getOwner(), pLosingUnit.getOwner(), iUnitPower)
		
		# catch slaves by defeating native and barbarian Pombos or Impis
		if pLosingUnit.getOwner() in [iBarbarian, iNative] and pLosingUnit.getUnitType() in [iZuluImpi, iCongolesePombos]:
			if gc.getMap().plot(pLosingUnit.getX(), pLosingUnit.getY()).getOwner() == pWinningUnit.getOwner():
				if gc.getPlayer(pWinningUnit.getOwner()).getCivics(2) == iCivicSlavery:
					iRand = gc.getGame().getSorenRandNum(5, "Caught slaves?")
					if iRand == 1:
						iNewUnit = utils.getUniqueUnitType(pWinningUnit.getOwner(), gc.getUnitInfo(iSlave).getUnitClassType())
						utils.makeUnit(iNewUnit, pWinningUnit.getOwner(), (pWinningUnit.getX(), pWinningUnit.getY()), 1)
						CyInterface().addMessage(pWinningUnit.getOwner(),True,15,CyTranslator().getText("TXT_KEY_UP_ENSLAVE_WIN", ()),'SND_REVOLTEND',1,'Art/Units/slave/button_slave.dds',ColorTypes(8),pWinningUnit.getX(),pWinningUnit.getY(),True,True)

		# Maya Holkans give food to closest city on victory
		if pWinningUnit.getUnitType() == iMayanHolkan:
			iOwner = pWinningUnit.getOwner()
			city = gc.getMap().findCity(pWinningUnit.getX(), pWinningUnit.getY(), iOwner, TeamTypes.NO_TEAM, False, False, TeamTypes.NO_TEAM, DirectionTypes.NO_DIRECTION, CyCity())
			if city: 
				city.changeFood(5)
				sAdjective = gc.getPlayer(pLosingUnit.getOwner()).getCivilizationAdjectiveKey()
				CyInterface().addMessage(iOwner, False, iDuration, CyTranslator().getText("TXT_KEY_MAYA_HOLKAN_EFFECT", (sAdjective, pLosingUnit.getNameKey(), 5, city.getName())), "", 0, "", ColorTypes(iWhite), -1, -1, True, True)
Beispiel #2
0
        def onCombatResult(self, argsList):
                self.up.aztecUP(argsList)
                self.rnf.immuneMode(argsList)
		self.up.vikingUP(argsList) # includes Moorish Corsairs
		
		pWinningUnit, pLosingUnit = argsList
		
		vic.onCombatResult(pWinningUnit, pLosingUnit)
		
		iUnitPower = 0
		pLosingUnitInfo = gc.getUnitInfo(pLosingUnit.getUnitType())
		
		if pLosingUnitInfo.getUnitCombatType() != gc.getInfoTypeForString("UNITCOMBAT_SIEGE"):
			iUnitPower = pLosingUnitInfo.getPowerValue()
		
		sta.onCombatResult(pWinningUnit.getOwner(), pLosingUnit.getOwner(), iUnitPower)
		
		# catch slaves by defeating native and barbarian Pombos or Impis
		if pLosingUnit.getOwner() in [con.iBarbarian, con.iNative] and pLosingUnit.getUnitType() in [con.iZuluImpi, con.iKongoPombos]:
			if gc.getMap().plot(pLosingUnit.getX(), pLosingUnit.getY()).getOwner() == pWinningUnit.getOwner():
				if gc.getPlayer(pWinningUnit.getOwner()).getCivics(2) == con.iCivicSlavery:
					iRand = gc.getGame().getSorenRandNum(5, "Caught slaves?")
					if iRand == 1:
						iNewUnit = utils.getUniqueUnitType(pWinningUnit.getOwner(), gc.getUnitInfo(con.iSlave).getUnitClassType())
						utils.makeUnit(iNewUnit, pWinningUnit.getOwner(), (pWinningUnit.getX(), pWinningUnit.getY()), 1)
						CyInterface().addMessage(pWinningUnit.getOwner(),True,15,CyTranslator().getText("TXT_KEY_UP_ENSLAVE_WIN", ()),'SND_REVOLTEND',1,'Art/Units/slave/button_slave.dds',ColorTypes(8),pWinningUnit.getX(),pWinningUnit.getY(),True,True)

		# Maya Holkans give food to closest city on victory
		if pWinningUnit.getUnitType() == con.iMayaHolkan:
			iOwner = pWinningUnit.getOwner()
			city = gc.getMap().findCity(pWinningUnit.getX(), pWinningUnit.getY(), iOwner, TeamTypes.NO_TEAM, False, False, TeamTypes.NO_TEAM, DirectionTypes.NO_DIRECTION, CyCity())
			if city: 
				city.changeFood(5)
				sAdjective = gc.getPlayer(pLosingUnit.getOwner()).getCivilizationAdjectiveKey()
				CyInterface().addMessage(iOwner, False, con.iDuration, CyTranslator().getText("TXT_KEY_MAYA_HOLKAN_EFFECT", (sAdjective, pLosingUnit.getNameKey(), 5, city.getName())), "", 0, "", ColorTypes(con.iWhite), -1, -1, True, True)
    def onCombatResult(self, argsList):
        self.rnf.immuneMode(argsList)
        self.up.vikingUP(argsList)  # includes Moorish Corsairs

        pWinningUnit, pLosingUnit = argsList
        iWinningPlayer = pWinningUnit.getOwner()
        iLosingPlayer = pLosingUnit.getOwner()

        vic.onCombatResult(pWinningUnit, pLosingUnit)

        iUnitPower = 0
        pLosingUnitInfo = gc.getUnitInfo(pLosingUnit.getUnitType())

        if pLosingUnitInfo.getUnitCombatType() != gc.getInfoTypeForString(
                "UNITCOMBAT_SIEGE"):
            iUnitPower = pLosingUnitInfo.getPowerValue()

        sta.onCombatResult(iWinningPlayer, iLosingPlayer, iUnitPower)

        # capture slaves
        if iWinningPlayer == iAztecs and not pAztecs.isReborn():
            utils.captureUnit(pLosingUnit, pWinningUnit, iAztecSlave, 35)

        elif iLosingPlayer == iNative:
            if iWinningPlayer not in lCivBioNewWorld or True in data.lFirstContactConquerors:
                if gc.getPlayer(iWinningPlayer).isSlavery() or gc.getPlayer(
                        iWinningPlayer).isColonialSlavery():
                    utils.captureUnit(pLosingUnit, pWinningUnit, iSlave, 35)

        # Maya Holkans give food to closest city on victory
        if pWinningUnit.getUnitType() == iHolkan:
            iOwner = pWinningUnit.getOwner()
            if gc.getPlayer(iOwner).getNumCities() > 0:
                city = gc.getMap().findCity(pWinningUnit.getX(),
                                            pWinningUnit.getY(), iOwner,
                                            TeamTypes.NO_TEAM, False, False,
                                            TeamTypes.NO_TEAM,
                                            DirectionTypes.NO_DIRECTION,
                                            CyCity())
                if city:
                    city.changeFood(5)
                    if utils.getHumanID() == pWinningUnit.getOwner():
                        data.iTeotlSacrifices += 1
                    sAdjective = gc.getPlayer(
                        pLosingUnit.getOwner()).getCivilizationAdjectiveKey()
                    CyInterface().addMessage(
                        iOwner, False, iDuration,
                        CyTranslator().getText(
                            "TXT_KEY_MAYA_HOLKAN_EFFECT",
                            (sAdjective, pLosingUnit.getNameKey(), 5,
                             city.getName())), "", 0, "", ColorTypes(iWhite),
                        -1, -1, True, True)

        # Brandenburg Gate effect
        if gc.getPlayer(iLosingPlayer).isHasBuildingEffect(iBrandenburgGate):
            for iPromotion in range(gc.getNumPromotionInfos()):
                if gc.getPromotionInfo(iPromotion).isLeader(
                ) and pLosingUnit.isHasPromotion(iPromotion):
                    gc.getPlayer(iLosingPlayer).restoreGeneralThreshold()