mirror of
https://github.com/yairm210/Unciv.git
synced 2025-01-13 08:14:29 +07:00
Fixed sqrt of negative number (#5193)
This commit is contained in:
parent
70c3b4bd65
commit
03a7288656
@ -29,6 +29,7 @@ import com.unciv.ui.victoryscreen.RankingType
|
||||
import java.util.*
|
||||
import kotlin.collections.ArrayList
|
||||
import kotlin.collections.HashMap
|
||||
import kotlin.math.max
|
||||
import kotlin.math.min
|
||||
import kotlin.math.roundToInt
|
||||
import kotlin.math.sqrt
|
||||
@ -524,9 +525,8 @@ class CivilizationInfo {
|
||||
else
|
||||
unit.getForceEvaluation()
|
||||
}
|
||||
val goldBonus = sqrt(gold.toFloat()).toPercent() // 2f if gold == 10000
|
||||
val goldBonus = sqrt(max(0f, gold.toFloat())).toPercent() // 2f if gold == 10000
|
||||
sum = (sum * min(goldBonus, 2f)).toInt() // 2f is max bonus
|
||||
|
||||
return sum
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user