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.isWorked(it)
|| it.owningCity == city && (it.getUnpillagedTileImprovement()
?.hasUnique(UniqueType.TileProvidesYieldWithoutPopulation) == true
|| it.terrainHasUnique(UniqueType.TileProvidesYieldWithoutPopulation))
?.hasUnique(UniqueType.TileProvidesYieldWithoutPopulation, it.stateThisTile) == true
|| it.terrainHasUnique(UniqueType.TileProvidesYieldWithoutPopulation, it.stateThisTile))
}
for (tile in workedTiles) {
if (tile.isBlockaded() && city.isWorked(tile)) {

View File

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

View File

@ -370,7 +370,7 @@ class Tile : IsPartOfGameInfoSerialization, Json.Serializable {
fun isRoughTerrain() = allTerrains.any { it.isRough() }
@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 */
fun terrainHasUnique(uniqueType: UniqueType, state: StateForConditionals = stateThisTile) =
terrainUniqueMap.getMatchingUniques(uniqueType, state).any()
@ -430,7 +430,7 @@ class Tile : IsPartOfGameInfoSerialization, Json.Serializable {
if (getCity() == null) return false
return isCityCenter()
|| isWorked()
|| getUnpillagedTileImprovement()?.hasUnique(UniqueType.TileProvidesYieldWithoutPopulation) == true
|| getUnpillagedTileImprovement()?.hasUnique(UniqueType.TileProvidesYieldWithoutPopulation, stateThisTile) == true
|| terrainHasUnique(UniqueType.TileProvidesYieldWithoutPopulation)
}