mirror of
https://github.com/yairm210/Unciv.git
synced 2025-07-04 15:27:50 +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:
@ -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)) {
|
||||||
|
@ -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
|
||||||
|
@ -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)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user