mirror of
https://github.com/yairm210/Unciv.git
synced 2024-12-22 16:54:24 +07:00
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:
parent
4bac39c910
commit
73424466d4
@ -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)) {
|
||||
|
@ -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
|
||||
|
@ -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)
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user