mirror of
https://github.com/yairm210/Unciv.git
synced 2025-07-11 00:08:58 +07:00
Fix Ensure Minimum Stats (#9408)
This commit is contained in:
@ -84,8 +84,11 @@ class TileStatFunctions(val tile: Tile) {
|
||||
|
||||
/** Ensures each stat is >= [other].stat - modifies in place */
|
||||
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
|
||||
}
|
||||
}
|
||||
|
||||
/** Gets basic stats to start off [getTileStats] or [getTileStartYield], independently mutable result */
|
||||
|
Reference in New Issue
Block a user