Resolved #12640 - "Tile provides yield without assigned population", "Adjacent enemy units ending their turn take [49] damage" accept tile/civ conditionals

This commit is contained in:
yairm210
2024-12-15 11:33:23 +02:00
parent 4bac39c910
commit 73424466d4
3 changed files with 5 additions and 5 deletions

View File

@ -351,8 +351,8 @@ class CityStats(val city: City) {
city.location == it.position city.location == it.position
|| city.isWorked(it) || city.isWorked(it)
|| it.owningCity == city && (it.getUnpillagedTileImprovement() || it.owningCity == city && (it.getUnpillagedTileImprovement()
?.hasUnique(UniqueType.TileProvidesYieldWithoutPopulation) == true ?.hasUnique(UniqueType.TileProvidesYieldWithoutPopulation, it.stateThisTile) == true
|| it.terrainHasUnique(UniqueType.TileProvidesYieldWithoutPopulation)) || it.terrainHasUnique(UniqueType.TileProvidesYieldWithoutPopulation, it.stateThisTile))
} }
for (tile in workedTiles) { for (tile in workedTiles) {
if (tile.isBlockaded() && city.isWorked(tile)) { if (tile.isBlockaded() && city.isWorked(tile)) {

View File

@ -88,7 +88,7 @@ class UnitTurnManager(val unit: MapUnit) {
&& it.getUnpillagedImprovement() != null && it.getUnpillagedImprovement() != null
&& unit.civ.isAtWarWith(it.getOwner()!!) && unit.civ.isAtWarWith(it.getOwner()!!)
}.map { tile -> }.map { tile ->
tile to tile.getTileImprovement()!!.getMatchingUniques(UniqueType.DamagesAdjacentEnemyUnits) tile to tile.getTileImprovement()!!.getMatchingUniques(UniqueType.DamagesAdjacentEnemyUnits, tile.stateThisTile)
.sumOf { it.params[0].toInt() } .sumOf { it.params[0].toInt() }
}.maxByOrNull { it.second } }.maxByOrNull { it.second }
?: return ?: return

View File

@ -370,7 +370,7 @@ class Tile : IsPartOfGameInfoSerialization, Json.Serializable {
fun isRoughTerrain() = allTerrains.any { it.isRough() } fun isRoughTerrain() = allTerrains.any { it.isRough() }
@Transient @Transient
private var stateThisTile: StateForConditionals = StateForConditionals.EmptyState internal var stateThisTile: StateForConditionals = StateForConditionals.EmptyState
/** Checks whether any of the TERRAINS of this tile has a certain unique */ /** Checks whether any of the TERRAINS of this tile has a certain unique */
fun terrainHasUnique(uniqueType: UniqueType, state: StateForConditionals = stateThisTile) = fun terrainHasUnique(uniqueType: UniqueType, state: StateForConditionals = stateThisTile) =
terrainUniqueMap.getMatchingUniques(uniqueType, state).any() terrainUniqueMap.getMatchingUniques(uniqueType, state).any()
@ -430,7 +430,7 @@ class Tile : IsPartOfGameInfoSerialization, Json.Serializable {
if (getCity() == null) return false if (getCity() == null) return false
return isCityCenter() return isCityCenter()
|| isWorked() || isWorked()
|| getUnpillagedTileImprovement()?.hasUnique(UniqueType.TileProvidesYieldWithoutPopulation) == true || getUnpillagedTileImprovement()?.hasUnique(UniqueType.TileProvidesYieldWithoutPopulation, stateThisTile) == true
|| terrainHasUnique(UniqueType.TileProvidesYieldWithoutPopulation) || terrainHasUnique(UniqueType.TileProvidesYieldWithoutPopulation)
} }