aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/at/hannibal2/skyhanni/utils
diff options
context:
space:
mode:
authorhannibal2 <24389977+hannibal00212@users.noreply.github.com>2023-08-23 00:31:57 +0200
committerhannibal2 <24389977+hannibal00212@users.noreply.github.com>2023-08-23 00:31:57 +0200
commitbd7c0eb2cdf4825ce4fa40482de9693d24e27a70 (patch)
treed614cb3e80475c666e02cc61807348a4b9b4d7dc /src/main/java/at/hannibal2/skyhanni/utils
parent6ef62c0a5c2f23befeac58451ff7a41cb0ec4678 (diff)
downloadskyhanni-bd7c0eb2cdf4825ce4fa40482de9693d24e27a70.tar.gz
skyhanni-bd7c0eb2cdf4825ce4fa40482de9693d24e27a70.tar.bz2
skyhanni-bd7c0eb2cdf4825ce4fa40482de9693d24e27a70.zip
Hopefully fixed derpy problems with trevor trapper, arachne, arachne keeper and zealots
Diffstat (limited to 'src/main/java/at/hannibal2/skyhanni/utils')
-rw-r--r--src/main/java/at/hannibal2/skyhanni/utils/EntityUtils.kt9
-rw-r--r--src/main/java/at/hannibal2/skyhanni/utils/LorenzUtils.kt11
2 files changed, 16 insertions, 4 deletions
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 <T> List<T>.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