mirror of
https://github.com/yairm210/Unciv.git
synced 2025-09-27 13:55:54 -04:00
🐛 fix golden age points computation to consider negative happiness (#10224)
This commit is contained in:
parent
b16cbc1b0c
commit
348910dcf7
@ -9,6 +9,7 @@ import com.unciv.logic.civilization.PopupAlert
|
|||||||
import com.unciv.models.ruleset.unique.UniqueTriggerActivation
|
import com.unciv.models.ruleset.unique.UniqueTriggerActivation
|
||||||
import com.unciv.models.ruleset.unique.UniqueType
|
import com.unciv.models.ruleset.unique.UniqueType
|
||||||
import com.unciv.ui.components.extensions.toPercent
|
import com.unciv.ui.components.extensions.toPercent
|
||||||
|
import kotlin.math.max
|
||||||
|
|
||||||
class GoldenAgeManager : IsPartOfGameInfoSerialization {
|
class GoldenAgeManager : IsPartOfGameInfoSerialization {
|
||||||
@Transient
|
@Transient
|
||||||
@ -58,7 +59,8 @@ class GoldenAgeManager : IsPartOfGameInfoSerialization {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fun endTurn(happiness: Int) {
|
fun endTurn(happiness: Int) {
|
||||||
if (happiness > 0 && !isGoldenAge()) storedHappiness += happiness
|
if (!isGoldenAge())
|
||||||
|
storedHappiness = (storedHappiness + happiness).coerceAtLeast(0)
|
||||||
|
|
||||||
if (isGoldenAge())
|
if (isGoldenAge())
|
||||||
turnsLeftForCurrentGoldenAge--
|
turnsLeftForCurrentGoldenAge--
|
||||||
|
Loading…
x
Reference in New Issue
Block a user