diff options
Diffstat (limited to 'src')
5 files changed, 24 insertions, 9 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/data/EntityData.kt b/src/main/java/at/hannibal2/skyhanni/data/EntityData.kt index dad4a1bf3..40cada194 100644 --- a/src/main/java/at/hannibal2/skyhanni/data/EntityData.kt +++ b/src/main/java/at/hannibal2/skyhanni/data/EntityData.kt @@ -3,6 +3,7 @@ package at.hannibal2.skyhanni.data import at.hannibal2.skyhanni.events.* import at.hannibal2.skyhanni.utils.EntityUtils import at.hannibal2.skyhanni.utils.LorenzUtils.baseMaxHealth +import at.hannibal2.skyhanni.utils.LorenzUtils.derpy import net.minecraft.client.Minecraft import net.minecraft.client.entity.EntityOtherPlayerMP import net.minecraft.client.entity.EntityPlayerSP @@ -26,7 +27,7 @@ class EntityData { val oldMaxHealth = maxHealthMap.getOrDefault(entity, -1) if (oldMaxHealth != maxHealth) { maxHealthMap[entity] = maxHealth - EntityMaxHealthUpdateEvent(entity, maxHealth).postAndCatch() + EntityMaxHealthUpdateEvent(entity, maxHealth.derpy()).postAndCatch() } } } @@ -70,7 +71,7 @@ class EntityData { } if (entity is EntityLivingBase) { - EntityHealthUpdateEvent(entity, health).postAndCatch() + EntityHealthUpdateEvent(entity, health.derpy()).postAndCatch() } } } diff --git a/src/main/java/at/hannibal2/skyhanni/features/damageindicator/MobFinder.kt b/src/main/java/at/hannibal2/skyhanni/features/damageindicator/MobFinder.kt index 31a3a3c44..0cb2c9b14 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/damageindicator/MobFinder.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/damageindicator/MobFinder.kt @@ -10,6 +10,7 @@ import at.hannibal2.skyhanni.utils.EntityUtils.hasNameTagWith import at.hannibal2.skyhanni.utils.LocationUtils.distanceToPlayer import at.hannibal2.skyhanni.utils.LorenzUtils import at.hannibal2.skyhanni.utils.LorenzUtils.baseMaxHealth +import at.hannibal2.skyhanni.utils.LorenzUtils.derpy import at.hannibal2.skyhanni.utils.LorenzVec import at.hannibal2.skyhanni.utils.StringUtils.matchRegex import at.hannibal2.skyhanni.utils.getLorenzVec @@ -376,14 +377,14 @@ class MobFinder { ) { val maxHealth = entity.baseMaxHealth // Ignore the minis - if (maxHealth == 12 || maxHealth == 4000) return null + if (maxHealth == 12 || maxHealth.derpy() == 4000) return null return EntityResult(bossType = BossType.ARACHNE_SMALL) } if (entity.hasNameTagWith(1, "[§7Lv500§8] §cArachne") || entity.hasNameTagWith(1, "[§7Lv500§8] §lArachne") ) { val maxHealth = entity.baseMaxHealth - if (maxHealth == 12 || maxHealth == 4000) return null + if (maxHealth == 12 || maxHealth.derpy() == 4000) return null return EntityResult(bossType = BossType.ARACHNE_BIG) } diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/trevor/TrevorSolver.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/trevor/TrevorSolver.kt index 0ef03688e..4275e4698 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/misc/trevor/TrevorSolver.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/misc/trevor/TrevorSolver.kt @@ -6,6 +6,7 @@ import at.hannibal2.skyhanni.utils.EntityUtils.hasMaxHealth import at.hannibal2.skyhanni.utils.LocationUtils import at.hannibal2.skyhanni.utils.LocationUtils.distanceToPlayer import at.hannibal2.skyhanni.utils.LorenzUtils.baseMaxHealth +import at.hannibal2.skyhanni.utils.LorenzUtils.derpy import at.hannibal2.skyhanni.utils.LorenzVec import at.hannibal2.skyhanni.utils.toLorenzVec import net.minecraft.client.Minecraft @@ -51,7 +52,7 @@ object TrevorSolver { for (entity in EntityUtils.getAllEntities()) { if (entity is EntityOtherPlayerMP) continue val name = entity.name - val entityHealth = if (entity is EntityLivingBase) entity.baseMaxHealth else 0 + val entityHealth = if (entity is EntityLivingBase) entity.baseMaxHealth.derpy() else 0 currentMob = TrevorMobs.entries.firstOrNull { it.mobName.contains(name) } if (currentMob == TrevorMobs.CHICKEN) { if (entity is EntityChicken) { 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 |