def voteOnCityClaimAI(self, iVoter, iClaimant, tPlot, iClaimValue):
		iFavorClaimant = 0
		iFavorOwner = 0
		
		iClaimValidity = 0
		
		x, y = tPlot
		plot = gc.getMap().plot(x, y)
		pVoter = gc.getPlayer(iVoter)
		tVoter = gc.getTeam(iVoter)
		
		iOwner = plot.getOwner()
		iNumPlayersAlive = gc.getGame().countCivPlayersAlive()
		
		bCity = plot.isCity()
		bOwner = (iOwner >= 0)
		bOwnClaim = (iClaimant == iVoter)
		
		if bCity: city = plot.getPlotCity()
		if bOwner: 
			bMinor = (iOwner >= iNumPlayers)
			bOwnCity = (iOwner == iVoter)
			bWarClaim = (iClaimant in self.lWinners and iOwner in self.lLosers)
			
		sDebugText = '\nVote City AI Debug\nVoter: ' + gc.getPlayer(iVoter).getCivilizationShortDescription(0) + '\nClaimant: ' + gc.getPlayer(iClaimant).getCivilizationShortDescription(0)
		if bCity: sDebugText += '\nCity claim: ' + city.getName()
		if bOwner: sDebugText += '\nOwner: ' + gc.getPlayer(iOwner).getCivilizationShortDescription(0)
		
		print sDebugText
		
		# everyone agrees on AI American claims in the west
		if iClaimant == iAmerica and iVoter != iOwner:
			if utils.isPlotInArea((x, y), tAmericanClaimsTL, tAmericanClaimsBR):
				self.vote(iVoter, iClaimant, 1)
				return
			
		# player factors
		if bOwner and not bMinor and not bOwnCity and not bOwnClaim:
			# player rank
			iFavorClaimant += iNumPlayersAlive / 2 - gc.getGame().getPlayerRank(iClaimant)
			iFavorOwner += iNumPlayersAlive / 2 - gc.getGame().getPlayerRank(iOwner)
			
			# player relations
			iFavorClaimant += 5 * (pVoter.AI_getAttitude(iClaimant) - 2)
			iFavorOwner += 5 * (pVoter.AI_getAttitude(iOwner) - 2)
			
			# defensive pacts
			if tVoter.isDefensivePact(iClaimant): iFavorClaimant += 5
			if tVoter.isDefensivePact(iOwner): iFavorOwner += 5
			
			# at war
			if tVoter.isAtWar(iClaimant): iFavorClaimant -= 10
			if tVoter.isAtWar(iOwner): iFavorOwner -= 10
			
			# neighbors
			if not gc.getGame().isNeighbors(iVoter, iClaimant): iFavorClaimant += 5
			if not gc.getGame().isNeighbors(iVoter, iOwner): iFavorOwner += 10
			
			# vassalage
			if tVoter.isVassal(iClaimant): iFavorClaimant += 20
			if tVoter.isVassal(iOwner): iFavorOwner += 20
			
			if gc.getTeam(iClaimant).isVassal(iVoter): iFavorClaimant += 10
			if gc.getTeam(iOwner).isVassal(iVoter): iFavorOwner += 10
			
			# French UP
			if iClaimant == iFrance: iFavorClaimant += 10
			if iOwner == iFrance: iFavorOwner += 10
			
			# AI memory of human voting behavior
			if utils.getHumanID() == iClaimant and iVoter in self.dVotingMemory: iFavorClaimant += 5 * self.dVotingMemory[iVoter]
			if utils.getHumanID() == iOwner and iVoter in self.dVotingMemory: iFavorOwner += 5 * self.dVotingMemory[iVoter]
			
		# if we don't dislike them, agree with the value of their claim
		if pVoter.AI_getAttitude(iClaimant) >= AttitudeTypes.ATTITUDE_CAUTIOUS: iClaimValidity += iClaimValue
			
		# French UP
		if iClaimant == iFrance: iClaimValidity += 5
			
		# plot factors
		# plot culture
		if bOwner:
			iClaimValidity += (100 * plot.getCulture(iClaimant) / plot.countTotalCulture()) / 20
			
			# after wars: claiming from a non-participant has less legitimacy unless its your own claim
			if self.bPostWar and not bOwnClaim and iOwner not in self.lLosers:
				iClaimValidity -= 10
			
		# generic settler map bonus
		iClaimantValue = plot.getSettlerValue(iClaimant)
		if iClaimantValue >= 90:
			iClaimValidity += max(1, iClaimantValue / 100)

		# Europeans support colonialism unless they want the plot for themselves
		if iVoter in lCivGroups[0]:
			if iClaimant in lCivGroups[0]:
				if not bOwner or iOwner not in lCivGroups[0]:
					if plot.getSettlerValue(iVoter) < 90:
						iClaimValidity += 10
						
		# vote to support settler maps for civs from your own group
		if bOwner:
			bDifferentGroupClaimant = True
			bDifferentGroupOwner = True
			for lGroup in lCivGroups:
				if iVoter in lGroup and iClaimant in lGroup: bDifferentGroupClaimant = False
				if iVoter in lGroup and iOwner in lGroup: bDifferentGroupOwner = False
		
			iClaimantValue = plot.getSettlerValue(iClaimant)
			iOwnerValue = plot.getSettlerValue(iOwner)
			
			if not bDifferentGroupClaimant and bDifferentGroupOwner and iClaimantValue >= 90: iClaimantValue *= 2
			if not bDifferentGroupOwner and bDifferentGroupClaimant and iOwnerValue >= 90: iOwnerValue *= 2
			
			iClaimValidity += max(1, iClaimantValue / 100)
			iClaimValidity -= max(1, iOwnerValue / 100)
			
		# own expansion targets
		if not bOwnClaim:
			iOwnSettlerValue = plot.getSettlerValue(iVoter)
			iOwnWarTargetValue = plot.getWarValue(iVoter)
			
			# if vote between two civs, favor the weaker one if we want to expand there later on
			if bOwner:
				iClaimantPower = gc.getTeam(iClaimant).getPower(True)
				iOwnerPower = gc.getTeam(iOwner).getPower(True)
			
				if iClaimantPower > iOwnerPower:
					if iOwnSettlerValue >= 200: iFavorClaimant -= max(1, iOwnSettlerValue / 100)
					if iOwnWarTargetValue > 0: iFavorClaimant -= max(1, iOwnWarTargetValue / 2)
				elif iOwnerPower > iClaimantPower:
					if iOwnSettlerValue >= 200: iFavorOwner -= max(1, iOwnSettlerValue / 100)
					if iOwnWarTargetValue > 0: iFavorOwner -= max(1, iOwnWarTargetValue / 2)
			# if vote for free territory, reduce the validity of the claim
			else:
				if iOwnSettlerValue >= 200: iClaimValidity -= max(1, iOwnSettlerValue / 100)
				if iOwnWarTargetValue > 0: iClaimValidity -= max(1, iOwnWarTargetValue / 2)
		
		# city factors
		if bCity:
			# previous ownership
			if city.isEverOwned(iClaimant): iClaimValidity += 5
			if city.getOriginalOwner() == iClaimant: iClaimValidity += 5
			
			# city culture, see plot culture
			if city.getCulture(iClaimant) == 0: iClaimValidity -= 10
			
			# close borders
			for i in range(21):
				if city.getCityIndexPlot(i).getOwner() == iClaimant:
					iClaimValidity += 1
					
			# capital
			if city.isCapital(): iClaimValidity -= 10
			
			# core area
			if plot.isCore(iClaimant): iClaimValidity += 10
			if plot.isCore(iOwner): iClaimValidity -= 15
			
		sDebugText = 'FavorClaimant: ' + str(iFavorClaimant)
		sDebugText += '\nFavorOwner: ' + str(iFavorOwner)
		sDebugText += '\nClaim Validity: ' + str(iClaimValidity)
		
		print sDebugText + '\n'
				
		bThreatenedClaimant = (2 * tVoter.getPower(True) < gc.getTeam(iClaimant).getPower(True))
		if bOwner: bThreatenedOwner = (2 * tVoter.getPower(True) < gc.getTeam(iOwner).getPower(True))
		
		# always vote for claims on empty territory unless claim is invalid
		if not bOwner:
			if iClaimValidity >= 0:
				print 'Voted YES: empty territory'
				self.vote(iVoter, iClaimant, 1)
				return
		
		# always vote for own claims unless threatened by owner
		if bOwnClaim:
			if not bOwner or not bThreatenedOwner:
				print 'Voted YES: own claim'
				self.vote(iVoter, iClaimant, 1)
				return
				
		# always vote against claims on own cities unless threatened by owner
		if bOwner and bOwnCity:
			if not bThreatenedClaimant:
				print 'Voted NO: claim on own city'
				self.vote(iVoter, iClaimant, -1)
				return
				
		# vote yes to asking minor cities if there is a valid claim
		if bOwner and bMinor:
			if iClaimValidity > 0:
				print 'Voted YES: valid claim on minors'
				self.vote(iVoter, iClaimant, 1)
			else:
				print 'Voted NO: invalid claim on minors'
				self.vote(iVoter, iClaimant, -1)
			return
			
		# always vote no against claims against a common enemy
		if bOwner and not bOwnClaim:
			if tVoter.isAtWar(iClaimant) and gc.getTeam(iOwner).isAtWar(iClaimant) and not tVoter.isAtWar(iOwner):
				print 'Voted NO: claimant is common enemy'
				self.vote(iVoter, iClaimant, -1)
			
		# maybe include threatened here?
		# winners of wars don't need valid claims
		if iClaimValidity > 0 or (bOwner and bWarClaim):
			# claim insufficient to overcome dislike
			if iFavorClaimant + iClaimValidity < iFavorOwner:
				print 'Voted NO: claimant favor and validity lower than owner favor'
				self.vote(iVoter, iClaimant, -1)
			# valid claim and claimant is more liked
			elif iFavorClaimant > iFavorOwner:
				print 'Voted YES: claimant favor higher than owner favor'
				self.vote(iVoter, iClaimant, 1)
			# less liked, but justified by claim
			elif iFavorClaimant + iClaimValidity >= iFavorOwner:
				# human can bribe on a close call if own claim or own city
				if (iClaimant == utils.getHumanID() or (bOwner and iOwner == utils.getHumanID())) and iClaimValidity < 50 and iFavorOwner - iFavorClaimant > 0:
					# return the relevant data to be added to the list of possible bribes in the calling method
					print 'NO VOTE: open for bribes'
					return (iVoter, iClaimant, tPlot, iFavorOwner - iFavorClaimant, iClaimValidity)
				else:
					iRand = gc.getGame().getSorenRandNum(50, 'Random vote outcome')
					if iRand < iClaimValidity:
						print 'Voted YES: random'
						self.vote(iVoter, iClaimant, 1)
					else:
						print 'Voted NO: random'
						self.vote(iVoter, iClaimant, -1)
				
		else:
			# like them enough to overcome bad claim
			if iFavorClaimant + iClaimValidity > iFavorOwner:
				print 'Voted YES: likes claimant enough despite bad claim'
				self.vote(iVoter, iClaimant, 1)
			else:
				print 'Voted NO: bad claim'
				self.vote(iVoter, iClaimant, -1)
				
		print 'End vote city AI'
				
		# return none to signify that no bribe is possible
		return None
	def selectClaims(self, iPlayer):
		pPlayer = gc.getPlayer(iPlayer)
		iGameTurn = gc.getGame().getGameTurn()
		iNumPlayersAlive = gc.getGame().countCivPlayersAlive()
		lPlots = []
		
		for iLoopPlayer in range(iNumTotalPlayers+1):
			if iLoopPlayer == iPlayer: continue
			if not gc.getPlayer(iLoopPlayer).isAlive(): continue
			
			# after a war: winners can only claim from losers and vice versa
			if self.bPostWar:
				if iPlayer in self.lWinners and iLoopPlayer not in self.lLosers: continue
				if iPlayer in self.lLosers and iLoopPlayer not in self.lWinners: continue
				
			# AI civs: cannot claim cities from friends
			if utils.getHumanID() != iPlayer and pPlayer.AI_getAttitude(iLoopPlayer) >= AttitudeTypes.ATTITUDE_FRIENDLY: continue
			
			# recently born
			if iGameTurn < getTurnForYear(tBirth[iLoopPlayer]) + utils.getTurns(20): continue
			
			# recently resurrected
			if iGameTurn < pPlayer.getLatestRebellionTurn() + utils.getTurns(20): continue
			
			# recently reborn
			if utils.isReborn(iLoopPlayer) and tRebirth != -1 and iGameTurn < getTurnForYear(tRebirth[iLoopPlayer]) + utils.getTurns(20): continue
			
			# exclude master/vassal relationships
			if gc.getTeam(iPlayer).isVassal(iLoopPlayer): continue
			if gc.getTeam(iLoopPlayer).isVassal(iPlayer): continue
			
			# cannot demand cities while at war
			if gc.getTeam(iPlayer).isAtWar(iLoopPlayer): continue
			
			for city in utils.getCityList(iLoopPlayer):
				x, y = city.getX(), city.getY()
				plot = gc.getMap().plot(x, y)
				iSettlerMapValue = plot.getSettlerValue(iPlayer)
				iValue = 0
				
				if not plot.isRevealed(iPlayer, False): continue
				if city.isCapital(): continue
				
				# after a war: losers can only claim previously owned cities
				if self.bPostWar and iPlayer in self.lLosers:
					if city.getGameTurnPlayerLost(iPlayer) < gc.getGame().getGameTurn() - utils.getTurns(25): continue
				
				# city culture
				iTotalCulture = city.countTotalCultureTimes100()
				if iTotalCulture > 0:
					iCultureRatio = city.getCultureTimes100(iPlayer) * 100 / iTotalCulture
					if iCultureRatio > 20:
						if iLoopPlayer != iAmerica:
							iValue += iCultureRatio / 20
							
				# ever owned
				if city.isEverOwned(iPlayer):
					iValue += 3
						
				# own core
				if plot.isCore(iPlayer):
					iValue += 5
							
				# colonies
				if iPlayer in lCivGroups[0]:
					if iLoopPlayer >= iNumPlayers or (iLoopPlayer not in lCivGroups[0] and utils.getStabilityLevel(iLoopPlayer) < iStabilityShaky) or (iLoopPlayer in lCivGroups[0] and utils.getHumanID() != iLoopPlayer and pPlayer.AI_getAttitude(iLoopPlayer) < AttitudeTypes.ATTITUDE_PLEASED):
						if plot.getRegionID() not in lEurope and plot.getRegionID() not in lMiddleEast:
							if iSettlerMapValue > 90:
								iValue += max(1, iSettlerMapValue / 100)
									
				# weaker and collapsing empires
				if iLoopPlayer < iNumPlayers:
					if gc.getGame().getPlayerRank(iLoopPlayer) > iNumPlayersAlive / 2 and gc.getGame().getPlayerRank(iLoopPlayer) < iNumPlayersAlive / 2:
						if data.players[iLoopPlayer].iStabilityLevel == iStabilityCollapsing:
							if iSettlerMapValue >= 90:
								iValue += max(1, iSettlerMapValue / 100)
									
				# close to own empire
				closestCity = gc.getMap().findCity(x, y, iPlayer, TeamTypes.NO_TEAM, False, False, TeamTypes.NO_TEAM, DirectionTypes.NO_DIRECTION, city)
				iDistance = stepDistance(x, y, closestCity.getX(), closestCity.getY())
				if iDistance < 5:
					iValue += 5-iDistance
					
				# after war: war targets
				if self.bPostWar:
					iValue += plot.getWarValue(iPlayer) / 2
					
				# AI America receives extra value for claims in the west
				if iPlayer == iAmerica and utils.getHumanID() != iPlayer:
					if utils.isPlotInArea((x, y), tAmericanClaimsTL, tAmericanClaimsBR):
						iValue += 5
						
				# help AI Australia gain Australia
				if iPlayer == iAustralia and utils.getHumanID() != iPlayer:
					if utils.isPlotInArea((x, y), tAustraliaTL, tAustraliaBR):
						iValue += 5
						
				# help Canada gain Labrador and Newfoundland
				if iPlayer == iCanada:
					if utils.isPlotInArea((x, y), tNewfoundlandTL, tNewfoundlandBR):
						iValue += 5
					
				if iValue > 0:
					lPlots.append((x, y, iValue))
		
		# extra spots for colonial civs -> will be settled
		# not available after wars because these congresses are supposed to reassign cities
		if iPlayer in lCivGroups[0] and not self.bPostWar:
			for (x, y) in utils.getWorldPlotsList():
				if utils.getHumanID() == iPlayer and not plot.isRevealed(iPlayer, False): continue
				plot = gc.getMap().plot(x, y)
				if not plot.isCity() and not plot.isPeak() and not plot.isWater() and pPlayer.canFound(x, y):
					if plot.getRegionID() in [rWestAfrica, rSouthAfrica, rEthiopia] or (plot.getRegionID() == [rAustralia, rOceania] and gc.getGame().getGameTurn() < tBirth[iAustralia]) or (plot.getRegionID() == rSouthAfrica and gc.getGame().getGameTurn() < tBirth[iBoers]):
						iSettlerMapValue = plot.getSettlerValue(iPlayer)
						if iSettlerMapValue >= 90 and cnm.getFoundName(iPlayer, (x, y)):
							closestCity = gc.getMap().findCity(x, y, PlayerTypes.NO_PLAYER, TeamTypes.NO_TEAM, False, False, TeamTypes.NO_TEAM, DirectionTypes.NO_DIRECTION, CyCity())
							if stepDistance(x, y, closestCity.getX(), closestCity.getY()) > 2:
								lPlots.append((x, y, max(1, iSettlerMapValue / 100 - 1)))
						
		lPlots = utils.getSortedList(lPlots, lambda x: x[2] + gc.getGame().getSorenRandNum(3, 'Randomize city value'), True)
		return lPlots[:10]
Esempio n. 3
0
    def onCityAcquired(self, argsList):
        iOwner, iPlayer, city, bConquest, bTrade = argsList
        tCity = (city.getX(), city.getY())

        cnm.onCityAcquired(city, iPlayer)

        if bConquest:
            sta.onCityAcquired(city, iOwner, iPlayer)

        if iPlayer == iArabia:
            self.up.arabianUP(city)
        # elif iPlayer == iMughals and utils.getHumanID() != iMughals:
        # self.up.mughalUP(city)
        # elif iPlayer == iSeljuks:
        # self.up.seljukUP(city)

        if iPlayer == iMongolia and bConquest and utils.getHumanID(
        ) != iPlayer:
            self.up.mongolUP(city)

        if iPlayer < iNumMajorPlayers:
            utils.spreadMajorCulture(iPlayer, tCity)

        # relocate capitals
        if utils.getHumanID() != iPlayer:
            if iPlayer == iTurkey and tCity == (68, 45):
                utils.moveCapital(iTurkey, tCity)  # Kostantiniyye
            elif iPlayer == iMongolia and tCity == (102, 47):
                utils.moveCapital(iMongolia, tCity)  # Khanbaliq

        # remove slaves if unable to practice slavery
        if not gc.getPlayer(iPlayer).isColonialSlavery():
            utils.removeSlaves(city)
        else:
            utils.freeSlaves(city, iPlayer)

        if city.isCapital():
            if city.isHasRealBuilding(iAdministrativeCenter):
                city.setHasRealBuilding(iAdministrativeCenter, False)

        # kill Seljuks
        #if iOwner == iSeljuks and gc.getPlayer(iSeljuks).isAlive() and gc.getGame().getGameTurnYear() >= 1250:
        #	if city.isCapital() or gc.getPlayer(iSeljuks).getNumCities() <= 2:
        #		sta.completeCollapse(iSeljuks)
        #utils.killAndFragmentCiv(iSeljuks, iIndependent, iIndependent2, -1, False)

        # Leoreth: relocate capital for AI if reacquired:
        if utils.getHumanID() != iPlayer and iPlayer < iNumPlayers:
            if data.players[iPlayer].iResurrections == 0:
                if Areas.getCapital(iPlayer) == tCity:
                    utils.relocateCapital(iPlayer, city)
            else:
                if Areas.getRespawnCapital(iPlayer) == tCity:
                    utils.relocateCapital(iPlayer, city)

        # Leoreth: conquering Constantinople adds it to the Turkish core + Rumelia
        if iPlayer == iTurkey and tCity == (68, 45):
            utils.setReborn(iTurkey, True)

        # Leoreth: help Byzantium/Constantinople
        if iPlayer == iByzantium and tCity == Areas.getCapital(
                iByzantium
        ) and gc.getGame().getGameTurn() <= getTurnForYear(330) + 3:
            if city.getPopulation() < 5:
                city.setPopulation(5)

            city.setHasRealBuilding(iBarracks, True)
            city.setHasRealBuilding(iWalls, True)
            city.setHasRealBuilding(iLibrary, True)
            city.setHasRealBuilding(iMarket, True)
            city.setHasRealBuilding(iGranary, True)
            city.setHasRealBuilding(iHarbor, True)
            city.setHasRealBuilding(iForge, True)

            city.setName("Konstantinoupolis", False)

            city.setHasRealBuilding(
                iTemple + 4 * gc.getPlayer(iPlayer).getStateReligion(), True)

        if bConquest:

            # Colombian UP: no resistance in conquered cities in Latin America
            if iPlayer == iMaya and utils.isReborn(iMaya):
                if utils.isPlotInArea(tCity, tSouthCentralAmericaTL,
                                      tSouthCentralAmericaBR):
                    city.setOccupationTimer(0)

            # Statue of Zeus effect: no city resistance on conquest
            if gc.getPlayer(iPlayer).isHasBuildingEffect(iStatueOfZeus):
                city.setOccupationTimer(0)

            # Byzantium reduced to four cities: core shrinks to Constantinople
            if iOwner == iByzantium and gc.getPlayer(
                    iByzantium).getNumCities <= 4:
                utils.setReborn(iByzantium, True)

        if bTrade:
            for i in range(iNumBuildings):
                iNationalWonder = i
                if isNationalWonderClass(
                        gc.getBuildingInfo(iNationalWonder).
                        getBuildingClassType()) and city.hasBuilding(
                            iNationalWonder):
                    city.setHasRealBuilding(iNationalWonder, False)

        self.pla.onCityAcquired(iOwner, iPlayer, city)  # Plague
        self.com.onCityAcquired(city)  # Communications
        self.corp.onCityAcquired(argsList)  # Companies
        dc.onCityAcquired(iOwner, iPlayer)  # DynamicCivs

        vic.onCityAcquired(iPlayer, iOwner, city, bConquest)

        return 0
Esempio n. 4
0
    def onCityAcquired(self, argsList):
        iOwner, iPlayer, city, bConquest, bTrade = argsList
        tCity = (city.getX(), city.getY())

        cnm.onCityAcquired(city, iPlayer)

        if bConquest:
            sta.onCityAcquired(city, iOwner, iPlayer)

        if iPlayer == iArabia:
            self.up.arabianUP(city)

        if iPlayer == iMongolia and bConquest and utils.getHumanID(
        ) != iPlayer:
            self.up.mongolUP(city)

        # relocate capitals
        if utils.getHumanID() != iPlayer:
            if iPlayer == iOttomans and tCity == (68, 45):
                utils.moveCapital(iOttomans, tCity)  # Kostantiniyye
            elif iPlayer == iMongolia and tCity == (102, 47):
                utils.moveCapital(iMongolia, tCity)  # Khanbaliq
            elif iPlayer == iTurks and utils.isAreaControlled(
                    iTurks, Areas.tCoreArea[iPersia][0],
                    Areas.tCoreArea[iPersia][1]):
                capital = pTurks.getCapitalCity()
                if not utils.isPlotInArea((capital.getX(), capital.getY()),
                                          Areas.tCoreArea[iPersia][0],
                                          Areas.tCoreArea[iPersia][1]):
                    newCapital = utils.getRandomEntry(
                        utils.getAreaCitiesCiv(
                            iTurks,
                            utils.getPlotList(Areas.tCoreArea[iPersia][0],
                                              Areas.tCoreArea[iPersia][1])))
                    if newCapital:
                        utils.moveCapital(
                            iTurks, (newCapital.getX(), newCapital.getY()))

        # remove slaves if unable to practice slavery
        if not gc.getPlayer(iPlayer).canUseSlaves():
            utils.removeSlaves(city)
        else:
            utils.freeSlaves(city, iPlayer)

        if city.isCapital():
            if city.isHasRealBuilding(iAdministrativeCenter):
                city.setHasRealBuilding(iAdministrativeCenter, False)

        # Leoreth: relocate capital for AI if reacquired:
        if utils.getHumanID() != iPlayer and iPlayer < iNumPlayers:
            if data.players[iPlayer].iResurrections == 0:
                if Areas.getCapital(iPlayer) == tCity:
                    utils.relocateCapital(iPlayer, city)
            else:
                if Areas.getRespawnCapital(iPlayer) == tCity:
                    utils.relocateCapital(iPlayer, city)

        # Leoreth: conquering Constantinople adds it to the Turkish core + Rumelia
        if iPlayer == iOttomans and tCity == (68, 45):
            utils.setReborn(iOttomans, True)

        if iPlayer == iTurks:
            if utils.isAreaControlled(iPlayer, Areas.tCoreArea[iPersia][0],
                                      Areas.tCoreArea[iPersia][1]):
                utils.setReborn(iTurks, True)
            else:
                utils.setReborn(iTurks, False)

        # Leoreth: help Byzantium/Constantinople
        if iPlayer == iByzantium and tCity == Areas.getCapital(
                iByzantium
        ) and gc.getGame().getGameTurn() <= getTurnForYear(330) + 3:
            if city.getPopulation() < 5:
                city.setPopulation(5)

            city.setHasRealBuilding(iBarracks, True)
            city.setHasRealBuilding(iWalls, True)
            city.setHasRealBuilding(iLibrary, True)
            city.setHasRealBuilding(iMarket, True)
            city.setHasRealBuilding(iGranary, True)
            city.setHasRealBuilding(iHarbor, True)
            city.setHasRealBuilding(iForge, True)

            city.setName("Konstantinoupolis", False)

            city.setHasRealBuilding(
                iTemple + 4 * gc.getPlayer(iPlayer).getStateReligion(), True)

        if bConquest:

            # Colombian UP: no resistance in conquered cities in Latin America
            if iPlayer == iMaya and utils.isReborn(iMaya):
                if utils.isPlotInArea(tCity, tSouthCentralAmericaTL,
                                      tSouthCentralAmericaBR):
                    city.setOccupationTimer(0)

            # Statue of Zeus effect: no city resistance on conquest
            if gc.getPlayer(iPlayer).isHasBuildingEffect(iStatueOfZeus):
                city.setOccupationTimer(0)

            # Byzantium reduced to four cities: core shrinks to Constantinople
            if iOwner == iByzantium and gc.getPlayer(
                    iByzantium).getNumCities <= 4:
                utils.setReborn(iByzantium, True)

        if bTrade:
            for i in range(iNumBuildings):
                iNationalWonder = i
                if isNationalWonderClass(
                        gc.getBuildingInfo(iNationalWonder).
                        getBuildingClassType()) and city.hasBuilding(
                            iNationalWonder):
                    city.setHasRealBuilding(iNationalWonder, False)

        # Leoreth: Escorial effect
        if gc.getPlayer(iPlayer).isHasBuildingEffect(iEscorial):
            if city.isColony():
                capital = gc.getPlayer(iPlayer).getCapitalCity()
                iGold = utils.getTurns(10 + utils.calculateDistance(
                    capital.getX(), capital.getY(), city.getX(), city.getY()))
                CyInterface().addMessage(
                    iPlayer, False, iDuration,
                    CyTranslator().getText("TXT_KEY_BUILDING_ESCORIAL_EFFECT",
                                           (iGold, city.getName())), "", 0, "",
                    ColorTypes(iWhite), -1, -1, True, True)
                gc.getPlayer(iPlayer).changeGold(iGold)

        self.pla.onCityAcquired(iOwner, iPlayer, city)  # Plague
        self.com.onCityAcquired(city)  # Communications
        self.corp.onCityAcquired(argsList)  # Companies
        dc.onCityAcquired(iOwner, iPlayer)  # DynamicCivs

        vic.onCityAcquired(iPlayer, iOwner, city, bConquest)

        lTradingCompanyList = [
            iSpain, iFrance, iEngland, iPortugal, iNetherlands
        ]

        if bTrade and iPlayer in lTradingCompanyList and (
                city.getX(), city.getY()
        ) in tTradingCompanyPlotLists[lTradingCompanyList.index(iPlayer)]:
            self.up.tradingCompanyCulture(city, iPlayer, iOwner)

        return 0
def getUHVTileInfo(argsList):
    x = argsList[0]
    y = argsList[1]
    iPlayer = argsList[2]

    if iPlayer == iGreece:
        if (x, y) in Areas.getNormalArea(iEgypt, False):
            return 0

        if (x, y) in Areas.getNormalArea(iCarthage, False):
            return 1

        if (x, y) in Areas.getNormalArea(iBabylonia, False):
            return 2

        if (x, y) in Areas.getNormalArea(iPersia, False):
            return 3

    elif iPlayer == iPersia and CyGlobalContext().getPlayer(
            iPersia).isReborn():
        if utils.isPlotInArea((x, y), vic.tSafavidMesopotamiaTL,
                              vic.tSafavidMesopotamiaBR):
            return 4

        if utils.isPlotInArea((x, y), vic.tTransoxaniaTL, vic.tTransoxaniaBR):
            return 5

        if utils.isPlotInArea((x, y), vic.tNWIndiaTL, vic.tNWIndiaBR,
                              vic.tNWIndiaExceptions):
            return 6

    elif iPlayer == iCarthage:
        if utils.isPlotInArea((x, y), Areas.tNormalArea[iItaly][0],
                              Areas.tNormalArea[iItaly][1],
                              [(62, 47), (63, 47), (63, 46)]):
            return 37

        if (x, y) in Areas.getNormalArea(iSpain, False):
            return 8

    elif iPlayer == iItaly:
        if utils.isPlotInArea(
            (x, y), vic.tMediterraneanTL, vic.tMediterraneanBR, vic.
                tMediterraneanExceptions) and CyGlobalContext().getMap().plot(
                    x, y).isCoastalLand():
            return 7

    elif iPlayer == iRome:
        if (x, y) in Areas.getNormalArea(iSpain, False):
            return 8

        if utils.isPlotInArea((x, y), vic.tFranceTL,
                              Areas.tNormalArea[iFrance][1]):
            return 9

        if (x, y) in Areas.getCoreArea(iEngland, False):
            return 10

        if utils.isPlotInArea((x, y), vic.tCarthageTL, vic.tCarthageBR):
            return 11

        if (x, y) in Areas.getCoreArea(iByzantium, False):
            return 12

        if (x, y) in Areas.getCoreArea(iEgypt, False):
            return 13

    elif iPlayer == iJapan:
        if utils.isPlotInArea((x, y), vic.tKoreaTL, vic.tKoreaBR):
            return 14

        if utils.isPlotInArea((x, y), vic.tManchuriaTL, vic.tManchuriaBR):
            return 15

        if utils.isPlotInArea((x, y), vic.tChinaTL, vic.tChinaBR):
            return 16

        if utils.isPlotInArea((x, y), vic.tIndochinaTL, vic.tIndochinaBR,
                              vic.tIndochinaExceptions):
            return 17

        if utils.isPlotInArea((x, y), vic.tIndonesiaTL, vic.tIndonesiaBR):
            return 18

        if utils.isPlotInArea((x, y), vic.tPhilippinesTL, vic.tPhilippinesBR):
            return 19

    elif iPlayer == iEthiopia:
        if gc.getMap().plot(x, y).getRegionID() in lAfrica:
            return 33

    elif iPlayer == iByzantium:
        if utils.isPlotInArea((x, y), vic.tBalkansTL, vic.tBalkansBR):
            return 21

        if utils.isPlotInArea((x, y), vic.tNorthAfricaTL, vic.tNorthAfricaBR):
            return 22

        if utils.isPlotInArea((x, y), vic.tNearEastTL, vic.tNearEastBR):
            return 23

    elif iPlayer == iArabia:
        if (x, y) in Areas.getCoreArea(iEgypt, False):
            return 24

        if utils.isPlotInArea((x, y), vic.tCarthageTL, vic.tCarthageBR):
            return 25

        if (x, y) in Areas.getCoreArea(iBabylonia, False):
            return 26

        if (x, y) in Areas.getCoreArea(iPersia, False):
            return 27

        if (x, y) in Areas.getNormalArea(iSpain, False):
            return 28

    elif iPlayer == iSpain:
        if utils.isPlotInArea((x, y), vic.tEuropeTL, vic.tEuropeBR): return 29
        elif utils.isPlotInArea((x, y), vic.tEasternEuropeTL,
                                vic.tEasternEuropeBR):
            return 29

    elif iPlayer == iFrance:
        if utils.isPlotInArea((x, y), vic.tEuropeTL, vic.tEuropeBR): return 29
        elif utils.isPlotInArea((x, y), vic.tEasternEuropeTL,
                                vic.tEasternEuropeBR):
            return 29

        if utils.isPlotInArea((x, y), vic.tNorthAmericaTL,
                              vic.tNorthAmericaBR):
            return 30

    elif iPlayer == iEngland:
        if utils.isPlotInArea((x, y), vic.tNorthAmericaTL,
                              vic.tNorthAmericaBR):
            return 31

        if utils.isPlotInArea((x, y), vic.tSouthCentralAmericaTL,
                              vic.tSouthCentralAmericaBR):
            return 32

        if utils.isPlotInArea((x, y), vic.tAfricaTL, vic.tAfricaBR):
            return 33

        if utils.isPlotInArea((x, y), vic.tAsiaTL, vic.tAsiaBR):
            return 34

        if utils.isPlotInArea((x, y), vic.tOceaniaTL, vic.tOceaniaBR):
            return 35

    elif iPlayer == iGermany:
        if (x, y) in Areas.getNormalArea(iFrance, False):
            return 36

        if (x, y) in Areas.getNormalArea(iItaly, False):
            return 37

        if (x, y) in Areas.getNormalArea(iRussia, False):
            return 38

        if (x, y) in Areas.getNormalArea(iEngland, False):
            return 39

        if (x, y) in Areas.getNormalArea(iVikings, False):
            return 40

    elif iPlayer == iRussia:
        if utils.isPlotInArea((x, y), vic.tSiberiaTL, vic.tSiberiaBR):
            return 41

    elif iPlayer == iInca:
        if (x, y) in vic.lAndeanCoast:
            return 42

        if utils.isPlotInArea((x, y), vic.tSAmericaTL, vic.tSAmericaBR,
                              vic.tSouthAmericaExceptions):
            return 43

    elif iPlayer == iOttomans:
        if (x, y) in vic.lEasternMediterranean:
            return 47

        if (x, y) in vic.lBlackSea:
            return 48

        if (x, y) in utils.surroundingPlots(vic.tCairo):
            return 49

        if (x, y) in utils.surroundingPlots(vic.tMecca):
            return 50

        if (x, y) in utils.surroundingPlots(vic.tBaghdad):
            return 51

        if (x, y) in utils.surroundingPlots(vic.tVienna):
            return 52

    elif iPlayer == iThailand:
        if utils.isPlotInArea((x, y), vic.tSouthAsiaTL, vic.tSouthAsiaBR):
            return 53

    elif iPlayer == iAmerica:
        if utils.isPlotInArea((x, y), vic.tNCAmericaTL, vic.tNCAmericaBR):
            return 54

    elif iPlayer == iTamils:
        if utils.isPlotInArea((x, y), vic.tDeccanTL, vic.tDeccanBR):
            return 55

        if utils.isPlotInArea((x, y), vic.tSrivijayaTL, vic.tSrivijayaBR):
            return 56

    elif iPlayer == iMoors:
        if utils.isPlotInArea((x, y), vic.tIberiaTL, vic.tIberiaBR):
            return 57

        if utils.isPlotInArea((x, y), vic.tMaghrebTL, vic.tMaghrebBR):
            return 58

        if utils.isPlotInArea((x, y), vic.tWestAfricaTL, vic.tWestAfricaBR):
            return 59

    elif iPlayer == iPortugal:
        if utils.isPlotInArea((x, y), vic.tAfricaTL, vic.tAfricaBR):
            return 33

        if utils.isPlotInArea((x, y), vic.tAsiaTL, vic.tAsiaBR):
            return 34

        if utils.isPlotInArea((x, y), vic.tBrazilTL, vic.tBrazilBR):
            return 60

    elif iPlayer == iMaya:
        if utils.isReborn(iPlayer):
            if utils.isPlotInArea((x, y), vic.tPeruTL, vic.tPeruBR):
                return 43

            if utils.isPlotInArea((x, y), vic.tGranColombiaTL,
                                  vic.tGranColombiaBR):
                return 44

            if utils.isPlotInArea((x, y), vic.tGuayanasTL, vic.tGuayanasBR):
                return 45

            if utils.isPlotInArea((x, y), vic.tCaribbeanTL, vic.tCaribbeanBR):
                return 46

            if utils.isPlotInArea((x, y), vic.tSAmericaTL, vic.tSAmericaBR,
                                  vic.tSouthAmericaExceptions):
                return 61

    elif iPlayer == iCanada:
        if (x, y) in vic.lAtlanticCoast:
            return 63

        if (x, y) in vic.lPacificCoast:
            return 64

        if utils.isPlotInArea((x, y), vic.tCanadaWestTL, vic.tCanadaWestBR,
                              vic.tCanadaWestExceptions) or utils.isPlotInArea(
                                  (x, y), vic.tCanadaEastTL, vic.tCanadaEastBR,
                                  vic.tCanadaEastExceptions):
            return 62

    elif iPlayer == iPolynesia:
        if utils.isPlotInArea((x, y), vic.tHawaiiTL, vic.tHawaiiBR):
            return 65

        if utils.isPlotInArea((x, y), vic.tNewZealandTL, vic.tNewZealandBR):
            return 66

        if utils.isPlotInArea((x, y), vic.tMarquesasTL, vic.tMarquesasBR):
            return 67

        if utils.isPlotInArea((x, y), vic.tEasterIslandTL,
                              vic.tEasterIslandBR):
            return 68

    elif iPlayer == iMongolia:
        if (x, y) in Areas.getNormalArea(iChina, False):
            return 69

    elif iPlayer == iTurks:
        if (x, y) in vic.lMediterraneanPorts:
            return 70

        if utils.isPlotInArea((x, y), vic.tChinaTL, vic.tChinaBR):
            return 71

        # free IDs: 20
        # continue with ID 72

    return -1
	def onCityAcquired(self, argsList):
		iOwner, iPlayer, city, bConquest, bTrade = argsList
		tCity = (city.getX(), city.getY())
		
		cnm.onCityAcquired(city, iPlayer)
		
		if bConquest:
			sta.onCityAcquired(city, iOwner, iPlayer)
			
		if iPlayer == iArabia:
			self.up.arabianUP(city)
		# elif iPlayer == iMughals and utils.getHumanID() != iMughals:
			# self.up.mughalUP(city)
		# elif iPlayer == iSeljuks:
			# self.up.seljukUP(city)
			
		if iPlayer == iMongolia and bConquest and utils.getHumanID() != iPlayer:
			self.up.mongolUP(city)
			
		if iPlayer < iNumMajorPlayers:
			utils.spreadMajorCulture(iPlayer, tCity)
		
		# relocate capitals
		if utils.getHumanID() != iPlayer:
			if iPlayer == iTurkey and tCity == (68, 45):
				utils.moveCapital(iTurkey, tCity) # Kostantiniyye
			elif iPlayer == iMongolia and tCity == (102, 47):
				utils.moveCapital(iMongolia, tCity) # Khanbaliq
				
		# remove slaves if unable to practice slavery
		if gc.getPlayer(iPlayer).getCivics(1) == iCivicEgalitarianism:
			utils.removeSlaves(city)
		else:
			utils.freeSlaves(city, iPlayer)
					
							
		# kill Seljuks
		#if iOwner == iSeljuks and gc.getPlayer(iSeljuks).isAlive() and gc.getGame().getGameTurnYear() >= 1250:
		#	if city.isCapital() or gc.getPlayer(iSeljuks).getNumCities() <= 2:
		#		sta.completeCollapse(iSeljuks)
				#utils.killAndFragmentCiv(iSeljuks, iIndependent, iIndependent2, -1, False)
				
		# Leoreth: relocate capital for AI if reacquired:
		if utils.getHumanID() != iPlayer and iPlayer < iNumPlayers:
			if data.players[iPlayer].iResurrections == 0:
				if Areas.getCapital(iPlayer) == tCity:
					utils.relocateCapital(iPlayer, city)
			else:
				if Areas.getRespawnCapital(iPlayer) == tCity:
					utils.relocateCapital(iPlayer, city)
					
		# Leoreth: conquering Constantinople adds it to the Turkish core + Rumelia
		if iPlayer == iTurkey and tCity == (68, 45):
			utils.setReborn(iTurkey, True)
					
		# Leoreth: help Byzantium/Constantinople
		if iPlayer == iByzantium and tCity == Areas.getCapital(iByzantium) and gc.getGame().getGameTurn() <= getTurnForYear(330)+3:
			if city.getPopulation() < 5:
				city.setPopulation(5)
				
			city.setHasRealBuilding(iBarracks, True)
			city.setHasRealBuilding(iWalls, True)
			city.setHasRealBuilding(iLibrary, True)
			city.setHasRealBuilding(iMarket, True)
			city.setHasRealBuilding(iGranary, True)
			city.setHasRealBuilding(iHarbor, True)
			city.setHasRealBuilding(iForge, True)
			
			city.setName("Konstantinoupolis", False)
			
			city.setHasRealBuilding(iTemple + 4*gc.getPlayer(iPlayer).getStateReligion(), True)
			
		if bConquest:

			# Colombian UP: no resistance in conquered cities in Latin America
			if iPlayer == iMaya and utils.isReborn(iMaya):
				if utils.isPlotInArea(tCity, tSouthCentralAmericaTL, tSouthCentralAmericaBR):
					city.setOccupationTimer(0)
					
			# Statue of Zeus effect: no city resistance on conquest
			if gc.getPlayer(iPlayer).countNumBuildings(iStatueOfZeus) > 0 and not gc.getTeam(iPlayer).isHasTech(iTheology):
				city.setOccupationTimer(0)
				
			# Byzantium reduced to four cities: core shrinks to Constantinople
			if iOwner == iByzantium and gc.getPlayer(iByzantium).getNumCities <= 4:
				utils.setReborn(iByzantium, True)
					
		if bTrade:
			for i in range(iNumBuildings):
				iNationalWonder = i
				if isNationalWonderClass(gc.getBuildingInfo(iNationalWonder).getBuildingClassType()) and city.hasBuilding(iNationalWonder):
					city.setHasRealBuilding(iNationalWonder, False)
					
		self.pla.onCityAcquired(iOwner, iPlayer, city) # Plague
		self.com.onCityAcquired(city) # Communications
		self.corp.onCityAcquired(argsList) # Companies
		dc.onCityAcquired(iOwner, iPlayer) # DynamicCivs
		
		vic.onCityAcquired(iPlayer, iOwner, city, bConquest)
		
		return 0
Esempio n. 7
0
def getUHVTileInfo(argsList):
    x = argsList[0]
    y = argsList[1]
    iPlayer = argsList[2]

    plot = gc.getMap().plot(x, y)

    if iPlayer == iGreece:
        if (x, y) in Areas.getNormalArea(iEgypt, False):
            return 0

        if (x, y) in Areas.getNormalArea(iCarthage, False):
            return 1

        if (x, y) in Areas.getNormalArea(iBabylonia, False):
            return 2

        if (x, y) in Areas.getNormalArea(iPersia, False):
            return 3

    elif iPlayer == iPersia and CyGlobalContext().getPlayer(
            iPersia).isReborn():
        if utils.isPlotInArea((x, y), vic.tSafavidMesopotamiaTL,
                              vic.tSafavidMesopotamiaBR):
            return 4

        if utils.isPlotInArea((x, y), vic.tTransoxaniaTL, vic.tTransoxaniaBR):
            return 5

        if utils.isPlotInArea((x, y), vic.tNWIndiaTL, vic.tNWIndiaBR,
                              vic.tNWIndiaExceptions):
            return 6

    elif iPlayer == iCarthage:
        if utils.isPlotInArea((x, y), Areas.tNormalArea[iItaly][0],
                              Areas.tNormalArea[iItaly][1],
                              [(62, 47), (63, 47), (63, 46)]):
            return 37

        if (x, y) in Areas.getNormalArea(iSpain, False):
            return 8

    elif iPlayer == iItaly:
        if utils.isPlotInArea(
            (x, y), vic.tMediterraneanTL, vic.tMediterraneanBR, vic.
                tMediterraneanExceptions) and CyGlobalContext().getMap().plot(
                    x, y).isCoastalLand():
            return 7

    elif iPlayer == iRome:
        if (x, y) in Areas.getNormalArea(iSpain, False):
            return 8

        if utils.isPlotInArea((x, y), vic.tFranceTL,
                              Areas.tNormalArea[iFrance][1]):
            return 9

        if (x, y) in Areas.getCoreArea(iEngland, False):
            return 10

        if utils.isPlotInArea((x, y), vic.tCarthageTL, vic.tCarthageBR):
            return 11

        if (x, y) in Areas.getCoreArea(iByzantium, False):
            return 12

        if (x, y) in Areas.getCoreArea(iEgypt, False):
            return 13

    elif iPlayer == iJapan:
        if utils.isPlotInArea((x, y), vic.tKoreaTL, vic.tKoreaBR):
            return 14

        if utils.isPlotInArea((x, y), vic.tManchuriaTL, vic.tManchuriaBR):
            return 15

        if utils.isPlotInArea((x, y), vic.tChinaTL, vic.tChinaBR):
            return 16

        if utils.isPlotInArea((x, y), vic.tIndochinaTL, vic.tIndochinaBR,
                              vic.tIndochinaExceptions):
            return 17

        if utils.isPlotInArea((x, y), vic.tIndonesiaTL, vic.tIndonesiaBR):
            return 18

        if utils.isPlotInArea((x, y), vic.tPhilippinesTL, vic.tPhilippinesBR):
            return 19

    elif iPlayer == iEthiopia:
        if gc.getMap().plot(x, y).getRegionID() in lAfrica:
            return 33

    elif iPlayer == iByzantium:
        if utils.isPlotInArea((x, y), vic.tBalkansTL, vic.tBalkansBR):
            return 21

        if utils.isPlotInArea((x, y), vic.tNorthAfricaTL, vic.tNorthAfricaBR):
            return 22

        if utils.isPlotInArea((x, y), vic.tNearEastTL, vic.tNearEastBR):
            return 23

    elif iPlayer == iArabia:
        if (x, y) in Areas.getCoreArea(iEgypt, False):
            return 24

        if utils.isPlotInArea((x, y), vic.tCarthageTL, vic.tCarthageBR):
            return 25

        if (x, y) in Areas.getCoreArea(iBabylonia, False):
            return 26

        if (x, y) in Areas.getCoreArea(iPersia, False):
            return 27

        if (x, y) in Areas.getNormalArea(iSpain, False):
            return 28

    elif iPlayer == iSpain:
        if utils.isPlotInArea((x, y), vic.tEuropeTL, vic.tEuropeBR): return 29
        elif utils.isPlotInArea((x, y), vic.tEasternEuropeTL,
                                vic.tEasternEuropeBR):
            return 29

    elif iPlayer == iFrance:
        if utils.isPlotInArea((x, y), vic.tEuropeTL, vic.tEuropeBR): return 29
        elif utils.isPlotInArea((x, y), vic.tEasternEuropeTL,
                                vic.tEasternEuropeBR):
            return 29

        if utils.isPlotInArea((x, y), vic.tNorthAmericaTL,
                              vic.tNorthAmericaBR):
            return 30

    elif iPlayer == iEngland:
        if plot.getRegionID() in lNorthAmerica:
            return 31

        if plot.getRegionID() in lSouthAmerica:
            return 32

        if plot.getRegionID() in lAfrica:
            return 33

        if plot.getRegionID() in lAsia:
            return 34

        if plot.getRegionID() in lOceania:
            return 35

    elif iPlayer == iGermany:
        if (x, y) in Areas.getNormalArea(iFrance, False):
            return 36

        if (x, y) in Areas.getNormalArea(iItaly, False):
            return 37

        if (x, y) in Areas.getNormalArea(iRussia, False):
            return 38

        if (x, y) in Areas.getNormalArea(iEngland, False):
            return 39

        if (x, y) in Areas.getNormalArea(iVikings, False):
            return 40

    elif iPlayer == iBurma:
        if utils.isPlotInArea((x, y), vic.tIndochinaTL, vic.tIndochinaBR,
                              vic.tIndochinaExceptions):
            return 17

    elif iPlayer == iKhazars:
        if (x, y) in vic.lDanube:
            return 87

        if (x, y) in vic.lZaysan:
            return 88

    elif iPlayer == iChad:
        if utils.isPlotInArea((x, y), vic.tCameroonTL, vic.tCameroonBR):
            return 102
        if utils.isPlotInArea((x, y), vic.tNigeriaTL, vic.tNigeriaBR):
            return 103
        if utils.isPlotInArea((x, y), vic.tLibyaTL, vic.tLibyaBR):
            return 104

    elif iPlayer == iRussia:
        if utils.isPlotInArea((x, y), vic.tSiberiaTL, vic.tSiberiaBR):
            return 41

    elif iPlayer == iInca:
        if (x, y) in vic.lAndeanCoast:
            return 42

        if utils.isPlotInArea((x, y), vic.tSAmericaTL, vic.tSAmericaBR,
                              vic.tSouthAmericaExceptions):
            return 43

    elif iPlayer == iOttomans:
        if (x, y) in vic.lEasternMediterranean:
            return 47

        if (x, y) in vic.lBlackSea:
            return 48

        if (x, y) in utils.surroundingPlots(vic.tCairo):
            return 49

        if (x, y) in utils.surroundingPlots(vic.tMecca):
            return 50

        if (x, y) in utils.surroundingPlots(vic.tBaghdad):
            return 51

        if (x, y) in utils.surroundingPlots(vic.tVienna):
            return 52

    elif iPlayer in [iThailand, iVietnam]:
        if utils.isPlotInArea((x, y), vic.tSouthAsiaTL, vic.tSouthAsiaBR):
            return 53

    elif iPlayer == iAmerica:
        if utils.isPlotInArea((x, y), vic.tNCAmericaTL, vic.tNCAmericaBR):
            return 54

    elif iPlayer == iTamils:
        if utils.isPlotInArea((x, y), vic.tDeccanTL, vic.tDeccanBR):
            return 55

        if utils.isPlotInArea((x, y), vic.tSrivijayaTL, vic.tSrivijayaBR):
            return 56

    elif iPlayer == iMoors:
        if utils.isPlotInArea((x, y), vic.tIberiaTL, vic.tIberiaBR):
            return 57

        if utils.isPlotInArea((x, y), vic.tMaghrebTL, vic.tMaghrebBR):
            return 58

        if utils.isPlotInArea((x, y), vic.tWestAfricaTL, vic.tWestAfricaBR):
            return 59

    elif iPlayer == iPortugal:
        if plot.getRegionID() in lAfrica:
            return 33

        if plot.getRegionID() in lAsia:
            return 34

        if utils.isPlotInArea((x, y), vic.tBrazilTL, vic.tBrazilBR):
            return 60

    elif iPlayer == iMaya:
        if utils.isReborn(iPlayer):
            if utils.isPlotInArea((x, y), vic.tPeruTL, vic.tPeruBR):
                return 43

            if utils.isPlotInArea((x, y), vic.tGranColombiaTL,
                                  vic.tGranColombiaBR):
                return 44

            if utils.isPlotInArea((x, y), vic.tGuayanasTL, vic.tGuayanasBR):
                return 45

            if utils.isPlotInArea((x, y), vic.tCaribbeanTL, vic.tCaribbeanBR):
                return 46

            if utils.isPlotInArea((x, y), vic.tSAmericaTL, vic.tSAmericaBR,
                                  vic.tSouthAmericaExceptions):
                return 61

    elif iPlayer == iCanada:
        if (x, y) in vic.lAtlanticCoast:
            return 63

        if (x, y) in vic.lPacificCoast:
            return 64

        if utils.isPlotInArea((x, y), vic.tCanadaWestTL, vic.tCanadaWestBR,
                              vic.tCanadaWestExceptions) or utils.isPlotInArea(
                                  (x, y), vic.tCanadaEastTL, vic.tCanadaEastBR,
                                  vic.tCanadaEastExceptions):
            return 62

    elif iPlayer == iPolynesia:
        if utils.isPlotInArea((x, y), vic.tHawaiiTL, vic.tHawaiiBR):
            return 65

        if utils.isPlotInArea((x, y), vic.tNewZealandTL, vic.tNewZealandBR):
            return 66

        if utils.isPlotInArea((x, y), vic.tMarquesasTL, vic.tMarquesasBR):
            return 67

        if utils.isPlotInArea((x, y), vic.tEasterIslandTL,
                              vic.tEasterIslandBR):
            return 68

    elif iPlayer == iMongolia:
        if (x, y) in Areas.getNormalArea(iChina, False):
            return 69

    elif iPlayer == iTurks:
        if (x, y) in vic.lMediterraneanPorts:
            return 70

        if utils.isPlotInArea((x, y), vic.tChinaTL, vic.tChinaBR):
            return 71

    elif iPlayer == iTeotihuacan:
        if utils.isPlotInArea((x, y), vic.tMesoamericaTL, vic.tMesoamericaBR):
            return 86

    elif iPlayer == iSweden:
        if (x, y) in vic.lSkagerrak or (x, y) in vic.lSkagerrak:
            return 72

        if (x, y) in vic.lBalticSea or (x, y) in vic.lBalticSea:
            return 73

    elif iPlayer == iAustralia:
        if utils.isPlotInArea((x, y), vic.tAustraliaTL, vic.tAustraliaBR):
            return 74

        if utils.isPlotInArea((x, y), vic.tNewZealandTL, vic.tNewZealandBR):
            return 66

        if utils.isPlotInArea((x, y), vic.tNewGuineaTL, vic.tNewGuineaBR):
            return 75

        if utils.isPlotInArea(
            (x, y), vic.tPacific1TL, vic.tPacific1BR) or utils.isPlotInArea(
                (x, y), vic.tPacific2TL,
                vic.tPacific2BR) or utils.isPlotInArea(
                    (x, y), vic.tPacific3TL,
                    vic.tPacific3BR) or utils.isPlotInArea(
                        (x, y), vic.tHawaiiTL, vic.tHawaiiBR):
            return 76

    elif iPlayer == iMamluks:
        if utils.isPlotInArea(
            (x, y), vic.tLowerNileTL, vic.tLowerNileBR) and gc.getMap().plot(
                x, y).isRiver():
            if utils.isPlotInArea((x, y), vic.tNorthAfricaTL,
                                  vic.tNorthAfricaBR):
                return 80
            return 79

        if utils.isPlotInArea((x, y), vic.tNorthAfricaTL, vic.tNorthAfricaBR):
            return 22

        if utils.isPlotInArea((x, y), vic.tHejazTL, vic.tHejazBR,
                              vic.tHejazExceptions):
            return 77

        if utils.isPlotInArea((x, y), vic.tLevantTL, vic.tLevantBR):
            return 78

        if (x, y) in Areas.getCoreArea(iBabylonia, False):
            return 4

    elif iPlayer == iManchuria:
        if gc.getMap().plot(x, y).getSettlerValue(iManchuria) >= 90:
            return 81

    elif iPlayer == iBoers:
        if utils.isPlotInArea((x, y), vic.tBoerAfricaTL, vic.tBoerAfricaBR):
            return 82

    elif iPlayer == iZimbabwe:
        if utils.isPlotInArea((x, y), vic.tSubeqAfricaTL, vic.tSubeqAfricaBR):
            return 83

        if utils.isPlotInArea((x, y), vic.tSubSaharaTL, vic.tSubSaharaBR,
                              vic.tSubSaharaExceptions):
            return 84

    elif iPlayer == iSwahili:
        if gc.getMap().plot(x, y).getRegionID() == rAustralia:
            return 74

    elif iPlayer == iKievanRus:
        if (x, y) in vic.lMediterraneanCoast:
            return 7

        if (x, y) in vic.lBarents:
            return 85

    elif iPlayer == iHungary:
        if gc.getMap().plot(
                x, y).getRegionID() in [rIberia, rEurope, rItaly, rBalkans]:
            return 29

    elif iPlayer == iCeltia:
        if utils.isPlotInArea(
            (x, y), vic.tFranceTL,
                Areas.tNormalArea[iFrance][1]) or (x, y) == (56, 46):
            return 89

        if utils.isPlotInArea((x, y), vic.tGermaniaTL, vic.tGermaniaBR):
            return 90

        if gc.getMap().plot(x, y).getRegionID() == rItaly:
            return 91

        if gc.getMap().plot(x, y).getRegionID() == rBritain:
            return 92

        if gc.getMap().plot(x, y).getRegionID() == rIberia:
            return 8

    elif iPlayer == iNorteChico:
        if utils.isReborn(iPlayer):
            if (x, y) in Areas.getCoreArea(iInca, False):
                return 95

            if (x, y) in utils.isPlotInArea((x, y), vic.tChimuTL,
                                            vic.tChimuBR):
                return 96

    elif iPlayer == iMississippi:
        if (x, y) in vic.lMississippiRiver:
            if (x, y) in vic.lOhioRiver:
                return 99
            elif (x, y) in vic.lGreatLakes:
                return 101
            return 98
        elif (x, y) in vic.lGreatLakes:
            return 100
        elif (x, y) in vic.lOhioRiver:
            return 97

    elif iPlayer == iInuit:
        if (x, y) in vic.lKivalliq:
            return 105

        if utils.isPlotInArea((x, y), vic.tNunavikTL, vic.tNunavikBR,
                              vic.tNunavikExceptions):
            return 106

        if utils.isPlotInArea((x, y), vic.tQikiqtaalukTL, vic.tQikiqtaalukBR,
                              vic.tQikiqtaalukExceptions):
            return 107

        if utils.isPlotInArea((x, y), vic.tKalaallitNunaatTL,
                              vic.tKalaallitNunaatBR,
                              vic.tKalaallitNunaatExceptions):
            return 108

    elif iPlayer == iYuezhi:
        if (x, y) in Areas.getCoreArea(iYuezhi, True) and y <= 43:
            return 109

    elif iPlayer == iXiongnu:
        if (x, y) in utils.getRegionPlots(lEurope):
            return 29
        if (x, y) in utils.getRegionPlots(lIndia):
            return 110

        # continue with 111
    return -1
	def selectClaims(self, iPlayer):
		pPlayer = gc.getPlayer(iPlayer)
		iGameTurn = gc.getGame().getGameTurn()
		iNumPlayersAlive = gc.getGame().countCivPlayersAlive()
		lPlots = []
		
		for iLoopPlayer in range(iNumTotalPlayers+1):
			if iLoopPlayer == iPlayer: continue
			if not gc.getPlayer(iLoopPlayer).isAlive(): continue
			
			# after a war: winners can only claim from losers and vice versa
			if self.bPostWar:
				if iPlayer in self.lWinners and iLoopPlayer not in self.lLosers: continue
				if iPlayer in self.lLosers and iLoopPlayer not in self.lWinners: continue
				
			# AI civs: cannot claim cities from friends
			if utils.getHumanID() != iPlayer and pPlayer.AI_getAttitude(iLoopPlayer) >= AttitudeTypes.ATTITUDE_FRIENDLY: continue
			
			# recently born
			if iGameTurn < getTurnForYear(tBirth[iLoopPlayer]) + utils.getTurns(20): continue
			
			# recently resurrected
			if iGameTurn < pPlayer.getLatestRebellionTurn() + utils.getTurns(20): continue
			
			# recently reborn
			if utils.isReborn(iLoopPlayer) and tRebirth != -1 and iGameTurn < getTurnForYear(tRebirth[iLoopPlayer]) + utils.getTurns(20): continue
			
			# exclude master/vassal relationships
			if gc.getTeam(iPlayer).isVassal(iLoopPlayer): continue
			if gc.getTeam(iLoopPlayer).isVassal(iPlayer): continue
			
			# cannot demand cities while at war
			if gc.getTeam(iPlayer).isAtWar(iLoopPlayer): continue
			
			for city in utils.getCityList(iLoopPlayer):
				x, y = city.getX(), city.getY()
				plot = gc.getMap().plot(x, y)
				iSettlerMapValue = plot.getSettlerValue(iPlayer)
				iValue = 0
				
				if not plot.isRevealed(iPlayer, False): continue
				if city.isCapital(): continue
				
				# after a war: losers can only claim previously owned cities
				if self.bPostWar and iPlayer in self.lLosers:
					if city.getGameTurnPlayerLost(iPlayer) < gc.getGame().getGameTurn() - utils.getTurns(25): continue
				
				# city culture
				iTotalCulture = city.countTotalCultureTimes100()
				if iTotalCulture > 0:
					iCultureRatio = city.getCultureTimes100(iPlayer) * 100 / iTotalCulture
					if iCultureRatio > 20:
						if iLoopPlayer != iAmerica:
							iValue += iCultureRatio / 20
							
				# ever owned
				if city.isEverOwned(iPlayer):
					iValue += 3
						
				# own core
				if plot.isCore(iPlayer):
					iValue += 5
							
				# colonies
				if iPlayer in lCivGroups[0]:
					if iLoopPlayer >= iNumPlayers or (iLoopPlayer not in lCivGroups[0] and utils.getStabilityLevel(iLoopPlayer) < iStabilityShaky) or (iLoopPlayer in lCivGroups[0] and utils.getHumanID() != iLoopPlayer and pPlayer.AI_getAttitude(iLoopPlayer) < AttitudeTypes.ATTITUDE_PLEASED):
						if plot.getRegionID() not in lEurope and plot.getRegionID() not in lMiddleEast:
							if iSettlerMapValue > 90:
								iValue += max(1, iSettlerMapValue / 100)
									
				# weaker and collapsing empires
				if iLoopPlayer < iNumPlayers:
					if gc.getGame().getPlayerRank(iLoopPlayer) > iNumPlayersAlive / 2 and gc.getGame().getPlayerRank(iLoopPlayer) < iNumPlayersAlive / 2:
						if data.players[iLoopPlayer].iStabilityLevel == iStabilityCollapsing:
							if iSettlerMapValue >= 90:
								iValue += max(1, iSettlerMapValue / 100)
									
				# close to own empire
				closestCity = gc.getMap().findCity(x, y, iPlayer, TeamTypes.NO_TEAM, False, False, TeamTypes.NO_TEAM, DirectionTypes.NO_DIRECTION, city)
				iDistance = stepDistance(x, y, closestCity.getX(), closestCity.getY())
				if iDistance < 5:
					iValue += 5-iDistance
					
				# after war: war targets
				if self.bPostWar:
					iValue += plot.getWarValue(iPlayer) / 2
					
				# AI America receives extra value for claims in the west
				if iPlayer == iAmerica and utils.getHumanID() != iPlayer:
					if utils.isPlotInArea((x, y), tAmericanClaimsTL, tAmericanClaimsBR):
						iValue += 5
						
				# help Canada gain Labrador and Newfoundland
				if iPlayer == iCanada:
					if utils.isPlotInArea((x, y), tNewfoundlandTL, tNewfoundlandBR):
						iValue += 5
					
				if iValue > 0:
					lPlots.append((x, y, iValue))
		
		# extra spots for colonial civs -> will be settled
		# not available after wars because these congresses are supposed to reassign cities
		if iPlayer in lCivGroups[0] and not self.bPostWar:
			for (x, y) in utils.getWorldPlotsList():
				if utils.getHumanID() == iPlayer and not plot.isRevealed(iPlayer, False): continue
				plot = gc.getMap().plot(x, y)
				if not plot.isCity() and not plot.isPeak() and not plot.isWater() and pPlayer.canFound(x, y):
					if plot.getRegionID() in [rWestAfrica, rSouthAfrica, rEthiopia, rAustralia, rOceania]:
						iSettlerMapValue = plot.getSettlerValue(iPlayer)
						if iSettlerMapValue >= 90 and cnm.getFoundName(iPlayer, (x, y)):
							closestCity = gc.getMap().findCity(x, y, PlayerTypes.NO_PLAYER, TeamTypes.NO_TEAM, False, False, TeamTypes.NO_TEAM, DirectionTypes.NO_DIRECTION, CyCity())
							if stepDistance(x, y, closestCity.getX(), closestCity.getY()) > 2:
								lPlots.append((x, y, max(1, iSettlerMapValue / 100 - 1)))
						
		lPlots = utils.getSortedList(lPlots, lambda x: x[2] + gc.getGame().getSorenRandNum(3, 'Randomize city value'), True)
		return lPlots[:10]
	def voteOnCityClaimAI(self, iVoter, iClaimant, tPlot, iClaimValue):
		iFavorClaimant = 0
		iFavorOwner = 0
		
		iClaimValidity = 0
		
		x, y = tPlot
		plot = gc.getMap().plot(x, y)
		pVoter = gc.getPlayer(iVoter)
		tVoter = gc.getTeam(iVoter)
		
		iOwner = plot.getOwner()
		iNumPlayersAlive = gc.getGame().countCivPlayersAlive()
		
		bCity = plot.isCity()
		bOwner = (iOwner >= 0)
		bOwnClaim = (iClaimant == iVoter)
		
		if bCity: city = plot.getPlotCity()
		if bOwner: 
			bMinor = (iOwner >= iNumPlayers)
			bOwnCity = (iOwner == iVoter)
			bWarClaim = (iClaimant in self.lWinners and iOwner in self.lLosers)
			
		sDebugText = '\nVote City AI Debug\nVoter: ' + gc.getPlayer(iVoter).getCivilizationShortDescription(0) + '\nClaimant: ' + gc.getPlayer(iClaimant).getCivilizationShortDescription(0)
		if bCity: sDebugText += '\nCity claim: ' + city.getName()
		if bOwner: sDebugText += '\nOwner: ' + gc.getPlayer(iOwner).getCivilizationShortDescription(0)
		
		print sDebugText
		
		# everyone agrees on AI American claims in the west
		if iClaimant == iAmerica and utils.getHumanID() != iAmerica and iVoter != iOwner:
			if utils.isPlotInArea((x, y), tAmericanClaimsTL, tAmericanClaimsBR):
				self.vote(iVoter, iClaimant, 1)
				return
			
		# player factors
		if bOwner and not bMinor and not bOwnCity and not bOwnClaim:
			# player rank
			iFavorClaimant += iNumPlayersAlive / 2 - gc.getGame().getPlayerRank(iClaimant)
			iFavorOwner += iNumPlayersAlive / 2 - gc.getGame().getPlayerRank(iOwner)
			
			# player relations
			iFavorClaimant += 5 * (pVoter.AI_getAttitude(iClaimant) - 2)
			iFavorOwner += 5 * (pVoter.AI_getAttitude(iOwner) - 2)
			
			# defensive pacts
			if tVoter.isDefensivePact(iClaimant): iFavorClaimant += 5
			if tVoter.isDefensivePact(iOwner): iFavorOwner += 5
			
			# at war
			if tVoter.isAtWar(iClaimant): iFavorClaimant -= 10
			if tVoter.isAtWar(iOwner): iFavorOwner -= 10
			
			# neighbors
			if not gc.getGame().isNeighbors(iVoter, iClaimant): iFavorClaimant += 5
			if not gc.getGame().isNeighbors(iVoter, iOwner): iFavorOwner += 10
			
			# vassalage
			if tVoter.isVassal(iClaimant): iFavorClaimant += 20
			if tVoter.isVassal(iOwner): iFavorOwner += 20
			
			if gc.getTeam(iClaimant).isVassal(iVoter): iFavorClaimant += 10
			if gc.getTeam(iOwner).isVassal(iVoter): iFavorOwner += 10
			
			# French UP
			if iClaimant == iFrance: iFavorClaimant += 10
			if iOwner == iFrance: iFavorOwner += 10
			
			# AI memory of human voting behavior
			if utils.getHumanID() == iClaimant and iVoter in self.dVotingMemory: iFavorClaimant += 5 * self.dVotingMemory[iVoter]
			if utils.getHumanID() == iOwner and iVoter in self.dVotingMemory: iFavorOwner += 5 * self.dVotingMemory[iVoter]
			
		# if we don't dislike them, agree with the value of their claim
		if pVoter.AI_getAttitude(iClaimant) >= AttitudeTypes.ATTITUDE_CAUTIOUS: iClaimValidity += iClaimValue
			
		# French UP
		if iClaimant == iFrance: iClaimValidity += 5
			
		# plot factors
		# plot culture
		if bOwner:
			iClaimValidity += (100 * plot.getCulture(iClaimant) / plot.countTotalCulture()) / 20
			
			# after wars: claiming from a non-participant has less legitimacy unless its your own claim
			if self.bPostWar and not bOwnClaim and iOwner not in self.lLosers:
				iClaimValidity -= 10
			
		# generic settler map bonus
		iClaimantValue = plot.getSettlerValue(iClaimant)
		if iClaimantValue >= 90:
			iClaimValidity += max(1, iClaimantValue / 100)

		# Europeans support colonialism unless they want the plot for themselves
		if iVoter in lCivGroups[0]:
			if iClaimant in lCivGroups[0]:
				if not bOwner or iOwner not in lCivGroups[0]:
					if plot.getSettlerValue(iVoter) < 90:
						iClaimValidity += 10
						
		# vote to support settler maps for civs from your own group
		if bOwner:
			bDifferentGroupClaimant = True
			bDifferentGroupOwner = True
			for lGroup in lCivGroups:
				if iVoter in lGroup and iClaimant in lGroup: bDifferentGroupClaimant = False
				if iVoter in lGroup and iOwner in lGroup: bDifferentGroupOwner = False
		
			iClaimantValue = plot.getSettlerValue(iClaimant)
			iOwnerValue = plot.getSettlerValue(iOwner)
			
			if not bDifferentGroupClaimant and bDifferentGroupOwner and iClaimantValue >= 90: iClaimantValue *= 2
			if not bDifferentGroupOwner and bDifferentGroupClaimant and iOwnerValue >= 90: iOwnerValue *= 2
			
			iClaimValidity += max(1, iClaimantValue / 100)
			iClaimValidity -= max(1, iOwnerValue / 100)
			
		# own expansion targets
		if not bOwnClaim:
			iOwnSettlerValue = plot.getSettlerValue(iVoter)
			iOwnWarTargetValue = plot.getWarValue(iVoter)
			
			# if vote between two civs, favor the weaker one if we want to expand there later on
			if bOwner:
				iClaimantPower = gc.getTeam(iClaimant).getPower(True)
				iOwnerPower = gc.getTeam(iOwner).getPower(True)
			
				if iClaimantPower > iOwnerPower:
					if iOwnSettlerValue >= 200: iFavorClaimant -= max(1, iOwnSettlerValue / 100)
					if iOwnWarTargetValue > 0: iFavorClaimant -= max(1, iOwnWarTargetValue / 2)
				elif iOwnerPower > iClaimantPower:
					if iOwnSettlerValue >= 200: iFavorOwner -= max(1, iOwnSettlerValue / 100)
					if iOwnWarTargetValue > 0: iFavorOwner -= max(1, iOwnWarTargetValue / 2)
			# if vote for free territory, reduce the validity of the claim
			else:
				if iOwnSettlerValue >= 200: iClaimValidity -= max(1, iOwnSettlerValue / 100)
				if iOwnWarTargetValue > 0: iClaimValidity -= max(1, iOwnWarTargetValue / 2)
		
		# city factors
		if bCity:
			# previous ownership
			if city.isEverOwned(iClaimant): iClaimValidity += 5
			if city.getOriginalOwner() == iClaimant: iClaimValidity += 5
			
			# city culture, see plot culture
			if city.getCulture(iClaimant) == 0: iClaimValidity -= 10
			
			# close borders
			for i in range(21):
				if city.getCityIndexPlot(i).getOwner() == iClaimant:
					iClaimValidity += 1
					
			# capital
			if city.isCapital(): iClaimValidity -= 10
			
			# core area
			if plot.isCore(iClaimant): iClaimValidity += 10
			if plot.isCore(iOwner): iClaimValidity -= 15
			
		sDebugText = 'FavorClaimant: ' + str(iFavorClaimant)
		sDebugText += '\nFavorOwner: ' + str(iFavorOwner)
		sDebugText += '\nClaim Validity: ' + str(iClaimValidity)
		
		print sDebugText + '\n'
				
		bThreatenedClaimant = (2 * tVoter.getPower(True) < gc.getTeam(iClaimant).getPower(True))
		if bOwner: bThreatenedOwner = (2 * tVoter.getPower(True) < gc.getTeam(iOwner).getPower(True))
		
		# always vote for claims on empty territory unless claim is invalid
		if not bOwner:
			if iClaimValidity >= 0:
				print 'Voted YES: empty territory'
				self.vote(iVoter, iClaimant, 1)
				return
		
		# always vote for own claims unless threatened by owner
		if bOwnClaim:
			if not bOwner or not bThreatenedOwner:
				print 'Voted YES: own claim'
				self.vote(iVoter, iClaimant, 1)
				return
				
		# always vote against claims on own cities unless threatened by owner
		if bOwner and bOwnCity:
			if not bThreatenedClaimant:
				print 'Voted NO: claim on own city'
				self.vote(iVoter, iClaimant, -1)
				return
				
		# vote yes to asking minor cities if there is a valid claim
		if bOwner and bMinor:
			if iClaimValidity > 0:
				print 'Voted YES: valid claim on minors'
				self.vote(iVoter, iClaimant, 1)
			else:
				print 'Voted NO: invalid claim on minors'
				self.vote(iVoter, iClaimant, -1)
			return
			
		# always vote no against claims against a common enemy
		if bOwner and not bOwnClaim:
			if tVoter.isAtWar(iClaimant) and gc.getTeam(iOwner).isAtWar(iClaimant) and not tVoter.isAtWar(iOwner):
				print 'Voted NO: claimant is common enemy'
				self.vote(iVoter, iClaimant, -1)
			
		# maybe include threatened here?
		# winners of wars don't need valid claims
		if iClaimValidity > 0 or (bOwner and bWarClaim):
			# claim insufficient to overcome dislike
			if iFavorClaimant + iClaimValidity < iFavorOwner:
				print 'Voted NO: claimant favor and validity lower than owner favor'
				self.vote(iVoter, iClaimant, -1)
			# valid claim and claimant is more liked
			elif iFavorClaimant > iFavorOwner:
				print 'Voted YES: claimant favor higher than owner favor'
				self.vote(iVoter, iClaimant, 1)
			# less liked, but justified by claim
			elif iFavorClaimant + iClaimValidity >= iFavorOwner:
				# human can bribe on a close call if own claim or own city
				if (iClaimant == utils.getHumanID() or (bOwner and iOwner == utils.getHumanID())) and iClaimValidity < 50 and iFavorOwner - iFavorClaimant > 0:
					# return the relevant data to be added to the list of possible bribes in the calling method
					print 'NO VOTE: open for bribes'
					return (iVoter, iClaimant, tPlot, iFavorOwner - iFavorClaimant, iClaimValidity)
				else:
					iRand = gc.getGame().getSorenRandNum(50, 'Random vote outcome')
					if iRand < iClaimValidity:
						print 'Voted YES: random'
						self.vote(iVoter, iClaimant, 1)
					else:
						print 'Voted NO: random'
						self.vote(iVoter, iClaimant, -1)
				
		else:
			# like them enough to overcome bad claim
			if iFavorClaimant + iClaimValidity > iFavorOwner:
				print 'Voted YES: likes claimant enough despite bad claim'
				self.vote(iVoter, iClaimant, 1)
			else:
				print 'Voted NO: bad claim'
				self.vote(iVoter, iClaimant, -1)
				
		print 'End vote city AI'
				
		# return none to signify that no bribe is possible
		return None