diff options
author | syeyoung <cyong06@naver.com> | 2021-01-17 15:55:59 +0900 |
---|---|---|
committer | syeyoung <cyong06@naver.com> | 2021-01-17 15:55:59 +0900 |
commit | a976ac4cfb25514d4e56310e044e64adf2f285de (patch) | |
tree | e099c924901b62e2156c7832756b29ba9d92b18a /src/main/java | |
parent | 7c45bc056f404eb743bd97bf2c3c5900cde27083 (diff) | |
download | Skyblock-Dungeons-Guide-a976ac4cfb25514d4e56310e044e64adf2f285de.tar.gz Skyblock-Dungeons-Guide-a976ac4cfb25514d4e56310e044e64adf2f285de.tar.bz2 Skyblock-Dungeons-Guide-a976ac4cfb25514d4e56310e044e64adf2f285de.zip |
score calculation a bit better and bossfights
Diffstat (limited to 'src/main/java')
5 files changed, 102 insertions, 10 deletions
diff --git a/src/main/java/kr/syeyoung/dungeonsguide/SkyblockStatus.java b/src/main/java/kr/syeyoung/dungeonsguide/SkyblockStatus.java index bda98879..489925b2 100755 --- a/src/main/java/kr/syeyoung/dungeonsguide/SkyblockStatus.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/SkyblockStatus.java @@ -36,6 +36,10 @@ public class SkyblockStatus { private DungeonContext context; @Getter + @Setter + private int percentage; + + @Getter private String dungeonName; private final Pattern SERVER_BRAND_PATTERN = Pattern.compile("(.+) <- (?:.+)"); @@ -89,6 +93,7 @@ public class SkyblockStatus { String strippedLine = TextUtils.keepScoreboardCharacters(TextUtils.stripColor(ScorePlayerTeam.formatPlayerName(scorePlayerTeam, sc.getPlayerName()))).trim(); if (strippedLine.contains("Dungeon Cleared: ")) { foundDungeon = true; + percentage = Integer.parseInt(strippedLine.substring(17)); } if (ScorePlayerTeam.formatPlayerName(scorePlayerTeam, sc.getPlayerName()).startsWith(" §7⏣")) { dungeonName = strippedLine.trim(); diff --git a/src/main/java/kr/syeyoung/dungeonsguide/dungeon/doorfinder/CatacombDataProvider.java b/src/main/java/kr/syeyoung/dungeonsguide/dungeon/doorfinder/CatacombDataProvider.java index 463ee3db..b198841a 100755 --- a/src/main/java/kr/syeyoung/dungeonsguide/dungeon/doorfinder/CatacombDataProvider.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/dungeon/doorfinder/CatacombDataProvider.java @@ -2,10 +2,13 @@ package kr.syeyoung.dungeonsguide.dungeon.doorfinder; import com.google.common.base.Predicate; import com.google.common.collect.Sets; +import kr.syeyoung.dungeonsguide.e; import kr.syeyoung.dungeonsguide.roomprocessor.bossfight.BossfightProcessor; +import kr.syeyoung.dungeonsguide.roomprocessor.bossfight.GeneralBossfightProcessor; import net.minecraft.entity.item.EntityArmorStand; import net.minecraft.init.Blocks; import net.minecraft.util.BlockPos; +import net.minecraft.util.ChatComponentText; import net.minecraft.world.World; import javax.vecmath.Vector2d; @@ -65,9 +68,76 @@ public class CatacombDataProvider implements DungeonSpecificDataProvider { } return null; } + /* + * §r§c[BOSS] The Professor§r§f: I was burdened with terrible news recently...§r + * §r§c[BOSS] The Professor§r§f: I'll show you real power!§r + * §r§c[BOSS] The Professor§r§f: Oh? You found my Guardians one weakness?§r + * §r§c[BOSS] The Professor§r§f: This time I'll be your opponent!§r + * §r§c[BOSS] The Professor§r§f: I see. You have forced me to use my ultimate technique.§r + * §r§c[BOSS] The Professor§r§f: The process is irreversible, but I'll be stronger than a Wither now!§r + * §r§c[BOSS] The Professor§r§f: What?! My Guardian power is unbeatable!§r + * + * */ @Override public BossfightProcessor createBossfightProcessor(World w, String dungeonName) { + String floor = dungeonName.substring(14).trim(); + e.sendDebugChat(new ChatComponentText("Floor: "+floor+ " Building bossfight processor")); + if (floor.equals("F2")) { + GeneralBossfightProcessor bossfightProcessor = new GeneralBossfightProcessor(); + bossfightProcessor.addPhase(GeneralBossfightProcessor.PhaseData.builder() + .phase("start") + .signatureMsg("§r§c[BOSS] Scarf§r§f: This is where the journey ends for you, Adventurers.§r") + .nextPhase("fight-1").build() + ); + bossfightProcessor.addPhase(GeneralBossfightProcessor.PhaseData.builder() + .phase("fight-1") + .signatureMsg("§r§c[BOSS] Scarf§r§f: ARISE, MY CREATIONS!§r") + .nextPhase("first-defeat").build() + ); + bossfightProcessor.addPhase(GeneralBossfightProcessor.PhaseData.builder() + .phase("first-defeat") + .signatureMsg("§r§c[BOSS] Scarf§r§f: Those toys are not strong enough I see.§r") + .nextPhase("fight-2").build() + ); + bossfightProcessor.addPhase(GeneralBossfightProcessor.PhaseData.builder() + .phase("fight-2") + .signatureMsg("§r§c[BOSS] Scarf§r§f: Did you forget? I was taught by the best! Let's dance.§r") + .nextPhase("final-defeat").build() + ); + bossfightProcessor.addPhase(GeneralBossfightProcessor.PhaseData.builder() + .phase("final-defeat") + .signatureMsg("§r§c[BOSS] Scarf§r§f: Whatever...§r").build() + ); + return bossfightProcessor; + } else if (floor.equals("F1")) { + GeneralBossfightProcessor bossfightProcessor = new GeneralBossfightProcessor(); + bossfightProcessor.addPhase(GeneralBossfightProcessor.PhaseData.builder() + .phase("start") + .signatureMsg("§r§c[BOSS] Bonzo§r§f: Gratz for making it this far, but I’m basically unbeatable.§r") + .nextPhase("fight-1").build() + ); + bossfightProcessor.addPhase(GeneralBossfightProcessor.PhaseData.builder() + .phase("fight-1") + .signatureMsg("§r§c[BOSS] Bonzo§r§f: I can summon lots of undead! Check this out.§r") + .nextPhase("first-defeat").build() + ); + bossfightProcessor.addPhase(GeneralBossfightProcessor.PhaseData.builder() + .phase("first-defeat") + .signatureMsg("§r§c[BOSS] Bonzo§r§f: Oh I'm dead!§r").signatureMsg("§r§c[BOSS] Bonzo§r§f: Hoho, looks like you killed me!§r") + .nextPhase("fight-2").build() + ); + bossfightProcessor.addPhase(GeneralBossfightProcessor.PhaseData.builder() + .phase("fight-2") + .signatureMsg("§r§c[BOSS] Bonzo§r§f: Sike§r").signatureMsg("§r§c[BOSS] Bonzo§r§f: I can revive myself and become much stronger!§r") + .nextPhase("final-defeat").build() + ); + bossfightProcessor.addPhase(GeneralBossfightProcessor.PhaseData.builder() + .phase("final-defeat") + .signatureMsg("§r§c[BOSS] Bonzo§r§f: Alright, maybe I'm just weak after all..§r").build() + ); + return bossfightProcessor; + } return null; } } diff --git a/src/main/java/kr/syeyoung/dungeonsguide/dungeon/roomfinder/DungeonRoom.java b/src/main/java/kr/syeyoung/dungeonsguide/dungeon/roomfinder/DungeonRoom.java index 6b0322ee..75a204d8 100755 --- a/src/main/java/kr/syeyoung/dungeonsguide/dungeon/roomfinder/DungeonRoom.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/dungeon/roomfinder/DungeonRoom.java @@ -46,7 +46,7 @@ public class DungeonRoom { @AllArgsConstructor @Getter public static enum RoomState { - DISCOVERED(0), COMPLETE_WITHOUT_SECRETS(0), FINISHED(0), FAILED(-14); + DISCOVERED(0), COMPLETE_WITHOUT_SECRETS(0), FINISHED(0), FAILED(-10); private int scoreModifier; } diff --git a/src/main/java/kr/syeyoung/dungeonsguide/features/impl/FeatureDungeonScore.java b/src/main/java/kr/syeyoung/dungeonsguide/features/impl/FeatureDungeonScore.java index 788f3207..2dde882f 100644 --- a/src/main/java/kr/syeyoung/dungeonsguide/features/impl/FeatureDungeonScore.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/features/impl/FeatureDungeonScore.java @@ -7,10 +7,14 @@ import kr.syeyoung.dungeonsguide.e; import kr.syeyoung.dungeonsguide.features.FeatureParameter; import kr.syeyoung.dungeonsguide.features.FeatureRegistry; import kr.syeyoung.dungeonsguide.features.GuiFeature; +import kr.syeyoung.dungeonsguide.utils.TextUtils; import lombok.AllArgsConstructor; import lombok.Data; +import net.minecraft.client.Minecraft; import net.minecraft.client.gui.FontRenderer; +import net.minecraft.client.network.NetworkPlayerInfo; import net.minecraft.client.renderer.GlStateManager; +import net.minecraft.scoreboard.ScorePlayerTeam; import net.minecraft.util.MathHelper; import org.lwjgl.opengl.GL11; @@ -73,13 +77,27 @@ public class FeatureDungeonScore extends GuiFeature { private int deaths; } + public int getPercentage() { + return skyblockStatus.getPercentage(); + } + public int getCompleteRooms() { + for (NetworkPlayerInfo networkPlayerInfoIn : Minecraft.getMinecraft().thePlayer.sendQueue.getPlayerInfoMap()) { + String name = networkPlayerInfoIn.getDisplayName() != null ? networkPlayerInfoIn.getDisplayName().getFormattedText() : ScorePlayerTeam.formatPlayerName(networkPlayerInfoIn.getPlayerTeam(), networkPlayerInfoIn.getGameProfile().getName()); + if (name.startsWith("§r Completed Rooms: §r")) { + String milestone = TextUtils.stripColor(name).substring(21); + return Integer.parseInt(milestone); + } + } + return 0; + } + public ScoreCalculation calculateScore() { if (!skyblockStatus.isOnDungeon()) return null; DungeonContext context = skyblockStatus.getContext(); if (context == null) return null; if (!context.getMapProcessor().isInitialized()) return null; - int skill = 100; + int skill = getPercentage(); int deaths = 0; { deaths = FeatureRegistry.DUNGEON_DEATHS.getTotalDeaths(); @@ -94,17 +112,13 @@ public class FeatureDungeonScore extends GuiFeature { int totalSecrets = 0; int secrets = 0; { - int clearedRooms = 0; for (DungeonRoom dungeonRoom : context.getDungeonRoomList()) { - if (!(dungeonRoom.getCurrentState() == DungeonRoom.RoomState.DISCOVERED)) { - clearedRooms ++; - } if (dungeonRoom.getTotalSecrets() != -1) totalSecrets += dungeonRoom.getTotalSecrets(); else totalSecretsKnown = false; } - fullyCleared = clearedRooms == context.getDungeonRoomList().size() && context.getMapProcessor().getUndiscoveredRoom() == 0; - explorer += MathHelper.clamp_int((int) Math.floor(60 * (clearedRooms / ((double)context.getDungeonRoomList().size() + context.getMapProcessor().getUndiscoveredRoom()))), 0, 60); + fullyCleared = getPercentage() == context.getDungeonRoomList().size() && context.getMapProcessor().getUndiscoveredRoom() == 0; + explorer += MathHelper.clamp_int((int) Math.floor(6.0 / 10.0 * getPercentage()), 0, 60); explorer += MathHelper.clamp_int((int) Math.floor(40 * ((secrets = FeatureRegistry.DUNGEON_SECRETS.getSecretsFound()) / (double)totalSecrets)),0,40); } int time = 0; diff --git a/src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/bossfight/GeneralBossfightProcessor.java b/src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/bossfight/GeneralBossfightProcessor.java index 6c593548..45c38697 100644 --- a/src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/bossfight/GeneralBossfightProcessor.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/bossfight/GeneralBossfightProcessor.java @@ -2,6 +2,7 @@ package kr.syeyoung.dungeonsguide.roomprocessor.bossfight; import lombok.Builder; import lombok.Data; +import lombok.Singular; import net.minecraft.util.IChatComponent; import java.util.*; @@ -43,7 +44,7 @@ public class GeneralBossfightProcessor implements BossfightProcessor { for (String nextPhase : currentPhase.getNextPhases()) { PhaseData phaseData = phases.get(nextPhase); if (phaseData == null) continue; - if (phaseData.signatureMsg.contains(chat.getFormattedText())) { + if (phaseData.signatureMsgs.contains(chat.getFormattedText())) { currentPhase = phaseData; onPhaseChange(); return; @@ -72,7 +73,9 @@ public class GeneralBossfightProcessor implements BossfightProcessor { @Builder public static class PhaseData { private String phase; - private Set<String> signatureMsg; + @Singular + private Set<String> signatureMsgs; + @Singular private Set<String> nextPhases; } } |