Bring back old behavior where exhaustion is immediately nullified by energy buffer on Androids
This commit is contained in:
parent
5d8f2d5a4a
commit
ca37b4959f
@ -69,13 +69,13 @@ 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) {
|
|
||||||
energyToDrain += PlayerConfig.ANDROID_ENERGY_PER_HUNGER_POINT * points
|
|
||||||
} else {
|
|
||||||
if (saturationLevel > 0f) {
|
if (saturationLevel > 0f) {
|
||||||
val satisfied = min(saturationLevel.roundToInt(), points)
|
val satisfied = min(saturationLevel.roundToInt(), points)
|
||||||
points -= satisfied
|
points -= satisfied
|
||||||
@ -85,7 +85,6 @@ class MatteryFoodData(private var player: Player) : FoodData() {
|
|||||||
foodLevel = max(0, foodLevel - points)
|
foodLevel = max(0, foodLevel - points)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
private fun tickRegeneration(values: IFoodRegenerationValues): Boolean {
|
private fun tickRegeneration(values: IFoodRegenerationValues): Boolean {
|
||||||
if (!player.isHurt || foodLevel < values.foodLimit || values.requiresSaturation && saturationLevel <= 0f)
|
if (!player.isHurt || foodLevel < values.foodLimit || values.requiresSaturation && saturationLevel <= 0f)
|
||||||
|
Loading…
Reference in New Issue
Block a user