From 14adb676724cac2bdd900cb878dcc2a5a2d2d739 Mon Sep 17 00:00:00 2001 From: Thunderblade73 <85900443+Thunderblade73@users.noreply.github.com> Date: Tue, 30 Jul 2024 10:28:46 +0200 Subject: Fix: Hotm wrong max Powder if disabled (#2269) --- src/main/java/at/hannibal2/skyhanni/data/HotmData.kt | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'src/main/java/at/hannibal2/skyhanni/data') diff --git a/src/main/java/at/hannibal2/skyhanni/data/HotmData.kt b/src/main/java/at/hannibal2/skyhanni/data/HotmData.kt index 1775cdeeb..1d9ca3827 100644 --- a/src/main/java/at/hannibal2/skyhanni/data/HotmData.kt +++ b/src/main/java/at/hannibal2/skyhanni/data/HotmData.kt @@ -36,7 +36,6 @@ import net.minecraftforge.fml.common.eventhandler.SubscribeEvent import kotlin.math.ceil import kotlin.math.pow - private fun calculatePeakOfTheMountainLoot(level: Int): Map = buildMap { for (i in 1..level) { when (i) { @@ -52,7 +51,6 @@ private fun calculatePeakOfTheMountainLoot(level: Int): Map } } - enum class HotmData( val guiName: String, val maxLevel: Int, @@ -359,17 +357,22 @@ enum class HotmData( val printName = name.allLettersFirstUppercase() + /** Level which are actually paid with powder (does exclude [blueEgg]*/ val rawLevel: Int get() = storage?.perks?.get(this.name)?.level ?: 0 + /** Level for which the effect that is present (considers [enabled] and [blueEgg])*/ var activeLevel: Int - get() = if (enabled) storage?.perks?.get(this.name)?.level?.plus(blueEgg()) ?: 0 else 0 + get() = if (enabled) effectivLevel else 0 private set(value) { storage?.perks?.computeIfAbsent(this.name) { HotmTree.HotmPerk() }?.level = value.minus(blueEgg()) } + /** Level that considering [blueEgg]*/ + val effectivLevel: Int get() = storage?.perks?.get(this.name)?.level?.plus(blueEgg()) ?: 0 + val isMaxLevel: Boolean - get() = activeLevel >= maxLevel // >= to account for +1 from Blue Cheese + get() = effectivLevel >= maxLevel // >= to account for +1 from Blue Cheese private fun blueEgg() = if (this != PEAK_OF_THE_MOUNTAIN && maxLevel != 1 && HotmAPI.isBlueEggActive) 1 else 0 -- cgit