-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
57 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
45 changes: 45 additions & 0 deletions
45
src/main/java/net/oxyopia/vice/features/bosses/Elderpork.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
package net.oxyopia.vice.features.bosses | ||
|
||
import net.minecraft.entity.boss.BossBar | ||
import net.oxyopia.vice.data.Colors | ||
import net.oxyopia.vice.data.World | ||
import net.oxyopia.vice.events.BossBarEvents | ||
import net.oxyopia.vice.events.ChatEvent | ||
import net.oxyopia.vice.events.core.SubscribeEvent | ||
import net.oxyopia.vice.utils.HudUtils.toText | ||
import net.oxyopia.vice.utils.TimeUtils.formatTimer | ||
import net.oxyopia.vice.utils.TimeUtils.timeDelta | ||
import net.oxyopia.vice.utils.TimeUtils.timeDeltaWithin | ||
import kotlin.time.Duration.Companion.seconds | ||
|
||
object Elderpork : Boss( | ||
World.Elderpork, | ||
Regex("Elderpork the Great - (?:(\\d+)/\\d+|YOU/SHOULD/KILL/YOURSELF) ❤ \\[PHASE (\\d+)]"), | ||
phaseTimesSec = listOf(60 * 2, 60 * 10, 60 * 5, 60 * 2) | ||
){ | ||
private val MONITOR_MAX_TIME = 30.seconds | ||
|
||
private var monitorLastStart = -0L | ||
|
||
@SubscribeEvent | ||
fun onChatMessage(event: ChatEvent) { | ||
if (event.string.endsWith("is preparing to fight Elderpork the Great!") && event.hasNoSender) { | ||
monitorLastStart = System.currentTimeMillis() | ||
} | ||
} | ||
|
||
@SubscribeEvent | ||
fun onBossbarAfter(event: BossBarEvents.Insert) { | ||
if (monitorLastStart.timeDeltaWithin(MONITOR_MAX_TIME)) { | ||
val elapsedTime = monitorLastStart.timeDelta() | ||
val percentageComplete = elapsedTime / MONITOR_MAX_TIME | ||
|
||
event.add( | ||
"Delivery Start ${elapsedTime.formatTimer(MONITOR_MAX_TIME)}".toText(Colors.Elderpork), | ||
1f - percentageComplete.toFloat(), | ||
BossBar.Color.PINK, | ||
BossBar.Style.NOTCHED_10 | ||
) | ||
} | ||
} | ||
} |