mirror of
https://github.com/yairm210/Unciv.git
synced 2025-07-15 10:18:26 +07:00
Fix Ensure Minimum Stats (#9408)
This commit is contained in:
@ -84,9 +84,12 @@ class TileStatFunctions(val tile: Tile) {
|
|||||||
|
|
||||||
/** Ensures each stat is >= [other].stat - modifies in place */
|
/** Ensures each stat is >= [other].stat - modifies in place */
|
||||||
private fun Stats.coerceAtLeast(other: Stats) {
|
private fun Stats.coerceAtLeast(other: Stats) {
|
||||||
for ((stat, value) in other)
|
// Note: Not `for ((stat, value) in other)` - that would skip zero values
|
||||||
|
for (stat in Stat.values()) {
|
||||||
|
val value = other[stat]
|
||||||
if (this[stat] < value) this[stat] = value
|
if (this[stat] < value) this[stat] = value
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/** Gets basic stats to start off [getTileStats] or [getTileStartYield], independently mutable result */
|
/** Gets basic stats to start off [getTileStats] or [getTileStartYield], independently mutable result */
|
||||||
private fun getTerrainStats(): Stats {
|
private fun getTerrainStats(): Stats {
|
||||||
|
Reference in New Issue
Block a user