This commit is contained in:
EmperorPinguin 2025-08-11 21:56:14 +02:00 committed by GitHub
parent 2fe9bd2f6d
commit a90cbadc35
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 13 additions and 14 deletions

View File

@ -112,8 +112,7 @@ object CityLocationTileRanker {
// Settling on luxuries generally speeds up our game, and settling on strategics as well, as the AI cheats and can see them.
var tiles = 0
val cityWorkRange = civ.gameInfo.ruleset.modOptions.constants.cityWorkRange
for (i in 0..cityWorkRange) {
for (i in 0..2) {
//Ideally, we shouldn't really count the center tile, as it's converted into 1 production 2 food anyways with special cases treated above, but doing so can lead to AI moving settler back and forth until forever
for (nearbyTile in newCityTile.getTilesAtDistance(i)) {
tiles++
@ -159,7 +158,7 @@ object CityLocationTileRanker {
if (rankTile.getCity() != null) return -1f
var locationSpecificTileValue = 0f
// Don't settle near but not on the coast
if (rankTile.isCoastalTile() && !onCoast) locationSpecificTileValue -= 2
if (rankTile.isWater && !onCoast) locationSpecificTileValue -= 1
// Check if there are any new unique luxury resources
if (rankTile.hasViewableResource(civ) && rankTile.tileResource.resourceType == ResourceType.Luxury
&& !(civ.hasResource(rankTile.resource!!) || newUniqueLuxuryResources.contains(rankTile.resource))) {
@ -175,14 +174,14 @@ object CityLocationTileRanker {
if (rankTile.hasViewableResource(civ)) {
rankTileValue += when (rankTile.tileResource.resourceType) {
ResourceType.Bonus -> 2f
ResourceType.Strategic -> 1.2f * rankTile.resourceAmount
ResourceType.Luxury -> 10f * rankTile.resourceAmount //very important for humans who might want to conquer the AI
ResourceType.Bonus -> 1f
ResourceType.Strategic -> 2f
ResourceType.Luxury -> 10f //very important for humans who might want to conquer the AI
}
}
if (rankTile.terrainHasUnique(UniqueType.FreshWater)) rankTileValue += 0.5f
//Taking into account freshwater farm food, maybe less important in baseruleset mods
if (rankTile.terrainFeatures.isNotEmpty() && rankTile.lastTerrain.hasUnique(UniqueType.ProductionBonusWhenRemoved)) rankTileValue += 0.5f
if (rankTile.terrainFeatures.isNotEmpty() && rankTile.lastTerrain.hasUnique(UniqueType.ProductionBonusWhenRemoved)) rankTileValue += 0.7f
//Taking into account yields from forest chopping
if (rankTile.isNaturalWonder()) rankTileValue += 10

View File

@ -114,7 +114,7 @@ object SpecificUnitAutomation {
// It's possible that we'll see a tile "over the sea" that's better than the tiles close by, but that's not a reason to abandon the close tiles!
// Also this lead to some routing problems, see https://github.com/yairm210/Unciv/issues/3653
val bestTilesInfo = CityLocationTileRanker.getBestTilesToFoundCity(unit, rangeToSearch, 30f)
val bestTilesInfo = CityLocationTileRanker.getBestTilesToFoundCity(unit, rangeToSearch, 20f)
var bestCityLocation: Tile? = null
if (unit.civ.gameInfo.turns == 0 && unit.civ.cities.isEmpty() && bestTilesInfo.tileRankMap.containsKey(unit.getTile())) { // Special case, we want AI to settle in place on turn 1.