aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/at
diff options
context:
space:
mode:
authorLorenz <ESs95s3P5z8Pheb>2022-07-14 10:04:55 +0200
committerLorenz <ESs95s3P5z8Pheb>2022-07-14 10:04:55 +0200
commit00fc1b55b6ebbcd19fa4d17df2fbeb50669d501b (patch)
treede4115d3996b73ce713f303e98dc82659382c5e9 /src/main/java/at
parent544840c5d8ebbec4bfdd5d213edf1ae2099b2d14 (diff)
downloadskyhanni-00fc1b55b6ebbcd19fa4d17df2fbeb50669d501b.tar.gz
skyhanni-00fc1b55b6ebbcd19fa4d17df2fbeb50669d501b.tar.bz2
skyhanni-00fc1b55b6ebbcd19fa4d17df2fbeb50669d501b.zip
added f4 damage indicator and clean end support
Diffstat (limited to 'src/main/java/at')
-rw-r--r--src/main/java/at/lorenz/mod/dungeon/DungeonCleanEnd.kt3
-rw-r--r--src/main/java/at/lorenz/mod/dungeon/damageindicator/DungeonBossDamageIndicator.kt44
-rw-r--r--src/main/java/at/lorenz/mod/dungeon/damageindicator/DungeonBossFinder.kt12
3 files changed, 43 insertions, 16 deletions
diff --git a/src/main/java/at/lorenz/mod/dungeon/DungeonCleanEnd.kt b/src/main/java/at/lorenz/mod/dungeon/DungeonCleanEnd.kt
index 62191a370..9d9f1b4d7 100644
--- a/src/main/java/at/lorenz/mod/dungeon/DungeonCleanEnd.kt
+++ b/src/main/java/at/lorenz/mod/dungeon/DungeonCleanEnd.kt
@@ -39,9 +39,6 @@ class DungeonCleanEnd {
if (!bossDone) return false
- //TODO remove
- if (Minecraft.getMinecraft().thePlayer.isSneaking) return false
-
return true
}
diff --git a/src/main/java/at/lorenz/mod/dungeon/damageindicator/DungeonBossDamageIndicator.kt b/src/main/java/at/lorenz/mod/dungeon/damageindicator/DungeonBossDamageIndicator.kt
index 5901dd29e..f1cf83b9c 100644
--- a/src/main/java/at/lorenz/mod/dungeon/damageindicator/DungeonBossDamageIndicator.kt
+++ b/src/main/java/at/lorenz/mod/dungeon/damageindicator/DungeonBossDamageIndicator.kt
@@ -1,6 +1,7 @@
package at.lorenz.mod.dungeon.damageindicator
import at.lorenz.mod.LorenzMod
+import at.lorenz.mod.dungeon.DungeonData
import at.lorenz.mod.events.DamageIndicatorFinalBossEvent
import at.lorenz.mod.events.DungeonEnterEvent
import at.lorenz.mod.events.LorenzChatEvent
@@ -26,7 +27,7 @@ class DungeonBossDamageIndicator {
var data = mutableMapOf<EntityLivingBase, EntityData>()
private var bossFinder: DungeonBossFinder? = null
private val decimalFormat = DecimalFormat("0.0")
- private val maxHealth = mutableMapOf<UUID, Double>()
+ private val maxHealth = mutableMapOf<UUID, Int>()
@SubscribeEvent
fun onDungeonStart(event: DungeonEnterEvent) {
@@ -107,19 +108,36 @@ class DungeonBossDamageIndicator {
val ignoreBlocks = result.ignoreBlocks
val delayedStart = result.delayedStart
- val currentMaxHealth = event.entity.baseMaxHealth
- val debugMaxHealth = getMaxHealthFor(event.entity)
- val biggestHealth: Double
- val health = event.entity.health + 0.0
- if (debugMaxHealth == 0.0) {
- biggestHealth = max(currentMaxHealth, health)
- setMaxHealth(event.entity, biggestHealth)
+ var health = event.entity.health.toInt()
+ val maxHealth: Int
+ if (DungeonData.isOneOf("F4")) {
+ val hitPoints = when (health) {
+ 300_000 -> 4
+ 222_000 -> 3
+ 144_000 -> 2
+ 66_000 -> 1
+ else -> {
+ LorenzUtils.error("Unexpected health of thorn in F4! ($health)")
+ return
+ }
+ }
+
+ health = hitPoints
+ maxHealth = 4
} else {
- biggestHealth = debugMaxHealth
+ val biggestHealth = getMaxHealthFor(event.entity)
+
+ if (biggestHealth == 0) {
+ val currentMaxHealth = event.entity.baseMaxHealth.toInt()
+ maxHealth = max(currentMaxHealth, health)
+ setMaxHealth(event.entity, maxHealth)
+ } else {
+ maxHealth = biggestHealth
+ }
}
- val percentage = health / biggestHealth
+ val percentage = health.toDouble() / maxHealth.toDouble()
val color = when {
percentage > 0.9 -> LorenzColor.DARK_GREEN
percentage > 0.75 -> LorenzColor.GREEN
@@ -148,12 +166,12 @@ class DungeonBossDamageIndicator {
}
}
- private fun setMaxHealth(entity: EntityLivingBase, currentMaxHealth: Double) {
+ private fun setMaxHealth(entity: EntityLivingBase, currentMaxHealth: Int) {
maxHealth[entity.uniqueID!!] = currentMaxHealth
}
- private fun getMaxHealthFor(entity: EntityLivingBase): Double {
- return maxHealth.getOrDefault(entity.uniqueID!!, 0.0)
+ private fun getMaxHealthFor(entity: EntityLivingBase): Int {
+ return maxHealth.getOrDefault(entity.uniqueID!!, 0)
}
@SubscribeEvent
diff --git a/src/main/java/at/lorenz/mod/dungeon/damageindicator/DungeonBossFinder.kt b/src/main/java/at/lorenz/mod/dungeon/damageindicator/DungeonBossFinder.kt
index 33f09967c..2b7e1b373 100644
--- a/src/main/java/at/lorenz/mod/dungeon/damageindicator/DungeonBossFinder.kt
+++ b/src/main/java/at/lorenz/mod/dungeon/damageindicator/DungeonBossFinder.kt
@@ -1,6 +1,7 @@
package at.lorenz.mod.dungeon.damageindicator
import at.lorenz.mod.dungeon.DungeonData
+import at.lorenz.mod.test.LorenzTest
import at.lorenz.mod.utils.LorenzUtils
import at.lorenz.mod.utils.LorenzUtils.baseMaxHealth
import at.lorenz.mod.utils.LorenzUtils.matchRegex
@@ -10,6 +11,7 @@ import net.minecraft.client.Minecraft
import net.minecraft.client.entity.EntityOtherPlayerMP
import net.minecraft.entity.Entity
import net.minecraft.entity.EntityLivingBase
+import net.minecraft.entity.monster.EntityGhast
import net.minecraft.entity.monster.EntityGiantZombie
import net.minecraft.entity.monster.EntityGuardian
import java.util.*
@@ -147,6 +149,16 @@ class DungeonBossFinder {
}
}
+ if (DungeonData.isOneOf("F4", "M4")) {
+ if (entity is EntityGhast) {
+ val health = LorenzUtils.formatDouble(entity.health.toDouble())
+ LorenzTest.enabled = true
+ LorenzTest.text = "thorn has $health hp!"
+ return EntityResult(ignoreBlocks = true, finalBoss = true)
+ }
+
+ }
+
if (DungeonData.isOneOf("F5", "M5")) {
if (entity is EntityOtherPlayerMP) {
if (entity == floor5lividEntity) {