mirror of
https://github.com/yairm210/Unciv.git
synced 2025-09-26 13:27:22 -04:00
Fix Ensure Minimum Stats (#9408)
This commit is contained in:
parent
728afab1db
commit
ec4586af6c
@ -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 */
|
||||
|
Loading…
x
Reference in New Issue
Block a user