From bd7c0eb2cdf4825ce4fa40482de9693d24e27a70 Mon Sep 17 00:00:00 2001 From: hannibal2 <24389977+hannibal00212@users.noreply.github.com> Date: Wed, 23 Aug 2023 00:31:57 +0200 Subject: Hopefully fixed derpy problems with trevor trapper, arachne, arachne keeper and zealots --- src/main/java/at/hannibal2/skyhanni/utils/EntityUtils.kt | 9 ++++++--- src/main/java/at/hannibal2/skyhanni/utils/LorenzUtils.kt | 11 ++++++++++- 2 files changed, 16 insertions(+), 4 deletions(-) (limited to 'src/main/java/at/hannibal2/skyhanni/utils') diff --git a/src/main/java/at/hannibal2/skyhanni/utils/EntityUtils.kt b/src/main/java/at/hannibal2/skyhanni/utils/EntityUtils.kt index 6763dabeb..12c47355f 100644 --- a/src/main/java/at/hannibal2/skyhanni/utils/EntityUtils.kt +++ b/src/main/java/at/hannibal2/skyhanni/utils/EntityUtils.kt @@ -102,8 +102,9 @@ object EntityUtils { fun EntityLivingBase.hasMaxHealth(health: Int, boss: Boolean = false, maxHealth: Int = baseMaxHealth): Boolean { if (maxHealth == health) return true - //Derpy - if (maxHealth == health * 2) return true + if (LorenzUtils.isDerpy) { + if (maxHealth == health * 2) return true + } // TODO runic support @@ -112,7 +113,9 @@ object EntityUtils { if (maxHealth == health * 3) return true //Derpy + Corrupted - if (maxHealth == health * 2 * 3) return true + if (LorenzUtils.isDerpy) { + if (maxHealth == health * 2 * 3) return true + } } return false diff --git a/src/main/java/at/hannibal2/skyhanni/utils/LorenzUtils.kt b/src/main/java/at/hannibal2/skyhanni/utils/LorenzUtils.kt index 2186a6d19..04de2d696 100644 --- a/src/main/java/at/hannibal2/skyhanni/utils/LorenzUtils.kt +++ b/src/main/java/at/hannibal2/skyhanni/utils/LorenzUtils.kt @@ -3,6 +3,7 @@ package at.hannibal2.skyhanni.utils import at.hannibal2.skyhanni.SkyHanniMod import at.hannibal2.skyhanni.data.HypixelData import at.hannibal2.skyhanni.data.IslandType +import at.hannibal2.skyhanni.data.MayorElection import at.hannibal2.skyhanni.features.dungeon.DungeonData import at.hannibal2.skyhanni.test.TestBingo import at.hannibal2.skyhanni.utils.NEUItems.getItemStackOrNull @@ -32,6 +33,7 @@ import kotlin.properties.ReadWriteProperty import kotlin.reflect.KMutableProperty1 import kotlin.reflect.KProperty import kotlin.reflect.KProperty0 +import kotlin.time.Duration.Companion.seconds object LorenzUtils { @@ -128,7 +130,7 @@ object LorenzUtils { // TODO replace all calls with regex fun String.between(start: String, end: String): String = this.split(start, end)[1] - //TODO change to Int + // TODO use derpy() on every use case val EntityLivingBase.baseMaxHealth: Int get() = this.getEntityAttribute(SharedMonsterAttributes.maxHealth).baseValue.toInt() @@ -476,4 +478,11 @@ object LorenzUtils { } fun List.indexOfFirst(vararg args: T) = args.map { indexOf(it) }.firstOrNull { it != -1 } + + private val recalculateDerpy = + RecalculatingValue(1.seconds) { MayorElection.isPerkActive("Derpy", "DOUBLE MOBS HP!!!") } + + val isDerpy get() = recalculateDerpy.getValue() + + fun Int.derpy() = if (isDerpy) this / 2 else this } \ No newline at end of file -- cgit