Bring back old behavior where exhaustion is immediately nullified by energy buffer on Androids
This commit is contained in:
parent
5d8f2d5a4a
commit
ca37b4959f
@ -69,21 +69,20 @@ class MatteryFoodData(private var player: Player) : FoodData() {
|
|||||||
private var energyToDrain = Decimal.ZERO
|
private var energyToDrain = Decimal.ZERO
|
||||||
|
|
||||||
private fun tickExhaustion() {
|
private fun tickExhaustion() {
|
||||||
if (exhaustionLevel >= EXHAUSTION_PER_HUNGER_POINT) {
|
if (player.matteryPlayer.isAndroid && exhaustionLevel > 0f) {
|
||||||
|
energyToDrain += PlayerConfig.ANDROID_ENERGY_PER_HUNGER_POINT * (exhaustionLevel / EXHAUSTION_PER_HUNGER_POINT)
|
||||||
|
exhaustionLevel = 0f
|
||||||
|
} else if (exhaustionLevel >= EXHAUSTION_PER_HUNGER_POINT) {
|
||||||
var points = (exhaustionLevel / EXHAUSTION_PER_HUNGER_POINT).toInt()
|
var points = (exhaustionLevel / EXHAUSTION_PER_HUNGER_POINT).toInt()
|
||||||
exhaustionLevel %= EXHAUSTION_PER_HUNGER_POINT
|
exhaustionLevel %= EXHAUSTION_PER_HUNGER_POINT
|
||||||
|
|
||||||
if (player.matteryPlayer.isAndroid) {
|
if (saturationLevel > 0f) {
|
||||||
energyToDrain += PlayerConfig.ANDROID_ENERGY_PER_HUNGER_POINT * points
|
val satisfied = min(saturationLevel.roundToInt(), points)
|
||||||
} else {
|
points -= satisfied
|
||||||
if (saturationLevel > 0f) {
|
saturationLevel -= satisfied
|
||||||
val satisfied = min(saturationLevel.roundToInt(), points)
|
|
||||||
points -= satisfied
|
|
||||||
saturationLevel -= satisfied
|
|
||||||
}
|
|
||||||
|
|
||||||
foodLevel = max(0, foodLevel - points)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
foodLevel = max(0, foodLevel - points)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user