aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/io
diff options
context:
space:
mode:
authorTaoshi <nicolaikh@live.dk>2022-11-16 14:46:18 +0100
committerGitHub <noreply@github.com>2022-11-16 14:46:18 +0100
commit1b14d93c566d2e16462e7879f1d1b4722e8bbae4 (patch)
tree15d16c22e712db5e2658b041a407e7479934d018 /src/main/java/io
parent9d0d62d66698f1d3833e7335ba81d059233709c1 (diff)
downloadNotEnoughUpdates-1b14d93c566d2e16462e7879f1d1b4722e8bbae4.tar.gz
NotEnoughUpdates-1b14d93c566d2e16462e7879f1d1b4722e8bbae4.tar.bz2
NotEnoughUpdates-1b14d93c566d2e16462e7879f1d1b4722e8bbae4.zip
Aatrox buff calculation in Slayer Overlay (#439)
* If aatrox has his +25% buff active, update calculation * Formatted code and updated 2.1.1.md Should be more like the rest of the code now. * More readable * surely this time * CTRL+ALT+L * Fix 0 bosses to kill if below xpPerBoss
Diffstat (limited to 'src/main/java/io')
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/overlays/SlayerOverlay.java25
1 files changed, 24 insertions, 1 deletions
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/overlays/SlayerOverlay.java b/src/main/java/io/github/moulberry/notenoughupdates/overlays/SlayerOverlay.java
index 72879bf9..95447398 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/overlays/SlayerOverlay.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/overlays/SlayerOverlay.java
@@ -47,11 +47,13 @@ public class SlayerOverlay extends TextOverlay {
private static String slayerEXP = "0";
private static int slayerIntXP;
+ private static int differenceFromLastXP = 0;
private static int untilNextSlayerLevel;
private static int xpToLevelUp;
private static boolean useSmallXpNext = true;
private static long agvSlayerTime = 0;
private static boolean isSlayerNine = false;
+ private static boolean slayerXPBuffActive = false;
private static int xpPerBoss = 0;
private static int bossesUntilNextLevel = 0;
private final HashSet<String> revenantLocations = new HashSet<>(Arrays.asList("Graveyard", "Coal Mine"));
@@ -121,6 +123,22 @@ public class SlayerOverlay extends TextOverlay {
isSlayerNine = true;
} else if (!slayerXp.equals("0")) {
slayerEXP = slayerXp.replace(",", "");
+
+ differenceFromLastXP = slayerIntXP - Integer.parseInt(slayerEXP);
+ if (differenceFromLastXP != 0) {
+ switch (differenceFromLastXP) {
+ case 1875:
+ case 625:
+ case 125:
+ case 31:
+ case 6:
+ slayerXPBuffActive = true;
+ break;
+ default:
+ slayerXPBuffActive = false;
+ }
+ }
+
slayerIntXP = Integer.parseInt(slayerEXP);
isSlayerNine = false;
} else {
@@ -197,9 +215,14 @@ public class SlayerOverlay extends TextOverlay {
} else {
xpPerBoss = 0;
}
+
+ if (slayerXPBuffActive) {
+ xpPerBoss *= 1.25;
+ }
+
untilNextSlayerLevel = xpToLevelUp - slayerIntXP;
if (xpPerBoss != 0 && untilNextSlayerLevel != 0 && xpToLevelUp != 0) {
- bossesUntilNextLevel = (xpToLevelUp - untilNextSlayerLevel) / xpPerBoss;
+ bossesUntilNextLevel = (int) Math.ceil((xpToLevelUp - untilNextSlayerLevel) / xpPerBoss);
} else {
bossesUntilNextLevel = 0;
}