diff options
author | syeyoung <cyong06@naver.com> | 2021-02-20 01:23:37 +0900 |
---|---|---|
committer | syeyoung <cyong06@naver.com> | 2021-02-20 01:23:37 +0900 |
commit | 7c15d593f5f583fc819835f7c0265137beb9c270 (patch) | |
tree | 6361f6ae8292a64b79cb4c42bdcde7d781382178 /src/main/java/kr | |
parent | 4ad16fc1d8b6c8ccb342e88c77a396131490657c (diff) | |
download | Skyblock-Dungeons-Guide-7c15d593f5f583fc819835f7c0265137beb9c270.tar.gz Skyblock-Dungeons-Guide-7c15d593f5f583fc819835f7c0265137beb9c270.tar.bz2 Skyblock-Dungeons-Guide-7c15d593f5f583fc819835f7c0265137beb9c270.zip |
button solver, some tweaks
Diffstat (limited to 'src/main/java/kr')
8 files changed, 163 insertions, 10 deletions
diff --git a/src/main/java/kr/syeyoung/dungeonsguide/dungeon/DungeonContext.java b/src/main/java/kr/syeyoung/dungeonsguide/dungeon/DungeonContext.java index ee4ce4cc..6f162a5c 100755 --- a/src/main/java/kr/syeyoung/dungeonsguide/dungeon/DungeonContext.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/dungeon/DungeonContext.java @@ -58,6 +58,14 @@ public class DungeonContext { @Getter @Setter + private boolean trapRoomGen = false; + + @Getter + @Setter + private boolean gotMimic = false; + + @Getter + @Setter private BossfightProcessor bossfightProcessor; @Getter @@ -66,7 +74,8 @@ public class DungeonContext { public DungeonContext(World world) { this.world = world; mapProcessor = new MapProcessor(this); - + DungeonSpecificDataProvider doorFinder = DungeonSpecificDataProviderRegistry.getDoorFinder(((SkyblockStatus) e.getDungeonsGuide().getSkyblockStatus()).getDungeonName()); + trapRoomGen = doorFinder.isTrapSpawn(e.getDungeonsGuide().getSkyblockStatus().getDungeonName()); } @@ -115,6 +124,8 @@ public class DungeonContext { if (dr != null) { dr.setTotalSecrets(secrets2); } + } else if (component.getFormattedText().contains("$DG-Mimic")) { + gotMimic = true; } } } 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 d39418bd..0c874458 100755 --- a/src/main/java/kr/syeyoung/dungeonsguide/dungeon/doorfinder/CatacombDataProvider.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/dungeon/doorfinder/CatacombDataProvider.java @@ -92,4 +92,21 @@ public class CatacombDataProvider implements DungeonSpecificDataProvider { } return null; } + + @Override + public boolean isTrapSpawn(String dungeonName) { + String floor = dungeonName.substring(14).trim(); + if (floor.equals("F3")) { + return true; + } else if (floor.equals("F4")) { + return true; + } else if (floor.equals("F5")) { + return true; + } else if (floor.equals("F6")) { + return true; + } else if (floor.equals("F7")) { + return true; + } + return false; + } } diff --git a/src/main/java/kr/syeyoung/dungeonsguide/dungeon/doorfinder/DungeonSpecificDataProvider.java b/src/main/java/kr/syeyoung/dungeonsguide/dungeon/doorfinder/DungeonSpecificDataProvider.java index 3103adf0..4cc0e677 100755 --- a/src/main/java/kr/syeyoung/dungeonsguide/dungeon/doorfinder/DungeonSpecificDataProvider.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/dungeon/doorfinder/DungeonSpecificDataProvider.java @@ -12,4 +12,6 @@ public interface DungeonSpecificDataProvider { Vector2d findDoorOffset(World w, String dungeonName); BossfightProcessor createBossfightProcessor(World w, String dungeonName); + + boolean isTrapSpawn(String dungeonName); }
\ No newline at end of file diff --git a/src/main/java/kr/syeyoung/dungeonsguide/features/impl/dungeon/FeatureDungeonScore.java b/src/main/java/kr/syeyoung/dungeonsguide/features/impl/dungeon/FeatureDungeonScore.java index f3fd44d3..4c774d20 100644 --- a/src/main/java/kr/syeyoung/dungeonsguide/features/impl/dungeon/FeatureDungeonScore.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/features/impl/dungeon/FeatureDungeonScore.java @@ -190,17 +190,23 @@ public class FeatureDungeonScore extends TextHUDFeature { skill -= FeatureRegistry.DUNGEON_DEATHS.getTotalDeaths() * 2; int totalCompRooms= 0; boolean bossroomFound = false; + boolean traproomFound = false; for (DungeonRoom dungeonRoom : context.getDungeonRoomList()) { if (dungeonRoom.getColor() == 74) bossroomFound = true; + if (dungeonRoom.getColor() == 62) traproomFound = true; if (dungeonRoom.getCurrentState() != DungeonRoom.RoomState.DISCOVERED) totalCompRooms += dungeonRoom.getUnitPoints().size(); if (dungeonRoom.getColor() == 66 && dungeonRoom.getCurrentState() == DungeonRoom.RoomState.DISCOVERED) skill -= 10; if (dungeonRoom.getColor() == 74 && dungeonRoom.getCurrentState() == DungeonRoom.RoomState.DISCOVERED) skill += 1; + if (dungeonRoom.getColor() == 62 && dungeonRoom.getCurrentState() == DungeonRoom.RoomState.DISCOVERED) + skill += 1; + skill += dungeonRoom.getCurrentState().getScoreModifier(); } if (!bossroomFound) skill += 1; + if (!traproomFound && context.isTrapRoomGen()) skill += 1; skill -= getUndiscoveredPuzzles() * 10; skill -= (getTotalRooms() - totalCompRooms) * 4; skill = MathHelper.clamp_int(skill, 0, 100); @@ -225,17 +231,24 @@ public class FeatureDungeonScore extends TextHUDFeature { int time = 0; { double timeModifier; + int timeModifierModifier = + e.getDungeonsGuide().getSkyblockStatus().getDungeonName().substring(14).trim().equals("F2") ? -120 : 0; if (context.getBossRoomEnterSeconds() != -1) { - timeModifier = Math.max(0, context.getBossRoomEnterSeconds() - 1200); + timeModifier = Math.max(0, context.getBossRoomEnterSeconds() - timeModifierModifier); } else { - timeModifier = Math.max(0, FeatureRegistry.DUNGEON_SBTIME.getTimeElapsed() / 1000 - 1200); + timeModifier = Math.max(0, FeatureRegistry.DUNGEON_SBTIME.getTimeElapsed() / 1000 - timeModifierModifier); } - time = MathHelper.clamp_int((int) Math.floor(100 - 2.2 * timeModifier), 0, 100); + + if (timeModifier <= 1320) time = 100; + else if (timeModifier <= 1420) time = (int) Math.ceil(232 - 0.1 * timeModifier); + else if (timeModifier <= 1820) time = (int) Math.ceil(161 - 0.05 * timeModifier); + else if (timeModifier < 3920) time = (int) Math.ceil(392/3.0 - (1/30.0) * timeModifier); } int bonus = 0; int tombs; { bonus += tombs = MathHelper.clamp_int(FeatureRegistry.DUNGEON_TOMBS.getTombsFound(), 0, 5); + if (context.isGotMimic()) bonus += 2; } // amazing thing @@ -272,7 +285,7 @@ public class FeatureDungeonScore extends TextHUDFeature { String currentLetter = getLetter(current); String nextLetter= getNextLetter(currentLetter); if (nextLetter == null) { - actualBit.add(new StyledText(nextLetter+" Expected","nextScore")); + actualBit.add(new StyledText("S+ Expected","nextScore")); return actualBit; } int req = getScoreRequirement(nextLetter); diff --git a/src/main/java/kr/syeyoung/dungeonsguide/pathfinding/NodeProcessorDungeonRoom.java b/src/main/java/kr/syeyoung/dungeonsguide/pathfinding/NodeProcessorDungeonRoom.java index 256673ba..5ec6c84d 100644 --- a/src/main/java/kr/syeyoung/dungeonsguide/pathfinding/NodeProcessorDungeonRoom.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/pathfinding/NodeProcessorDungeonRoom.java @@ -89,6 +89,8 @@ public class NodeProcessorDungeonRoom extends NodeProcessor { || state.getBlock() == Blocks.trapdoor || state.getBlock() == Blocks.iron_trapdoor || state.getBlock() == Blocks.wooden_button || state.getBlock() == Blocks.stone_button || state.getBlock() == Blocks.fire || state.getBlock() == Blocks.torch + || state.getBlock() == Blocks.rail || state.getBlock() == Blocks.golden_rail + || state.getBlock() == Blocks.activator_rail || state.getBlock() == Blocks.activator_rail || (state == Blocks.stone.getStateFromMeta(2)); } } diff --git a/src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/ProcessorFactory.java b/src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/ProcessorFactory.java index 6574c170..6415eb6f 100755 --- a/src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/ProcessorFactory.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/ProcessorFactory.java @@ -26,6 +26,7 @@ public class ProcessorFactory { static { registerRoomProcessor("default", new GeneralRoomProcessor.Generator()); + registerRoomProcessor("button_5", new RoomProcessorButtonSolver.Generator()); registerRoomProcessor("puzzle_water_solver", new RoomProcessorWaterPuzzle.Generator()); registerRoomProcessor("puzzle_teleport_solver", new RoomProcessorTeleportMazeSolver.Generator()); registerRoomProcessor("puzzle_riddle_solver", new RoomProcessorRiddle.Generator()); diff --git a/src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/RoomProcessorButtonSolver.java b/src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/RoomProcessorButtonSolver.java new file mode 100644 index 00000000..92bd9edb --- /dev/null +++ b/src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/RoomProcessorButtonSolver.java @@ -0,0 +1,112 @@ +package kr.syeyoung.dungeonsguide.roomprocessor; + +import kr.syeyoung.dungeonsguide.dungeon.data.OffsetPointSet; +import kr.syeyoung.dungeonsguide.dungeon.roomfinder.DungeonRoom; +import kr.syeyoung.dungeonsguide.utils.RenderUtils; +import net.minecraft.client.Minecraft; +import net.minecraft.client.renderer.GlStateManager; +import net.minecraft.util.BlockPos; +import net.minecraft.util.IChatComponent; +import net.minecraftforge.event.entity.player.PlayerInteractEvent; + +import java.awt.*; +import java.util.Arrays; + +public class RoomProcessorButtonSolver extends GeneralRoomProcessor { + public RoomProcessorButtonSolver(DungeonRoom dungeonRoom) { + super(dungeonRoom); + + OffsetPointSet ops = (OffsetPointSet) dungeonRoom.getDungeonRoomInfo().getProperties().get("buttons"); + if (ops == null) { + bugged = true; + return; + } + + buttons = new BlockPos[12]; + woods = new BlockPos[12]; + for (int i = 0; i < ops.getOffsetPointList().size(); i++) { + buttons[i] = ops.getOffsetPointList().get(i).getBlockPos(dungeonRoom); + woods[i] = buttons[i].add(0,-1,0); + } + } + + private boolean bugged; + + private BlockPos[] buttons; + private BlockPos[] woods; + + private long clicked; + private int clickedButton = -1; + + private int[] result = new int[12]; + + @Override + public void onInteractBlock(PlayerInteractEvent event) { + super.onInteractBlock(event); + if (bugged) return; + + if (event.action != PlayerInteractEvent.Action.RIGHT_CLICK_BLOCK) return; + for (int i = 0; i < buttons.length; i++) { + if (event.pos.equals(buttons[i])) { + clicked = System.currentTimeMillis(); + clickedButton = i; + return; + } + } + } + + @Override + public void chatReceived(IChatComponent chat) { + super.chatReceived(chat); + if (bugged) return; + + if (clickedButton == -1) return; + if (clicked + 500 < System.currentTimeMillis()) return; + + String msg = chat.getFormattedText(); + if (msg.equals("§r§cThis button doesn't seem to do anything...§r")) { + result[clickedButton] = -1; + clickedButton = -1; + } else if (msg.equals("§r§aThis button seems connected to something§r")) { + Arrays.fill(result, -1); + if (clickedButton % 4 != 0) result[clickedButton - 1] = 1; + if (clickedButton % 4 != 3) result[clickedButton + 1] = 1; + clickedButton = -1; + } else if (msg.equals("§r§aClick! you Hear the sound of a door opening§r")) { + Arrays.fill(result, -1); + result[clickedButton] = 2; + clickedButton = -1; + } + } + + @Override + public void drawWorld(float partialTicks) { + super.drawWorld(partialTicks); + if (bugged) return; + if (Minecraft.getMinecraft().thePlayer.getPosition().distanceSq(woods[6]) > 100) return; + + + for (int i = 0; i < woods.length; i++) { + int data = result[i]; + BlockPos pos = woods[i]; + + if (data == 0) { + RenderUtils.highlightBlock(pos, new Color(0, 255, 255, 50), partialTicks, false); + } else if (data == -1) { + RenderUtils.highlightBlock(pos, new Color(255, 0, 0, 50), partialTicks, false); + } else if (data == 1) { + RenderUtils.highlightBlock(pos, new Color(0, 255, 0, 50), partialTicks, false); + } else if (data == 2) { + RenderUtils.highlightBlock(pos, new Color(0, 255, 0, 100), partialTicks, false); + } + } + } + + public static class Generator implements RoomProcessorGenerator<RoomProcessorButtonSolver> { + @Override + public RoomProcessorButtonSolver createNew(DungeonRoom dungeonRoom) { + RoomProcessorButtonSolver defaultRoomProcessor = new RoomProcessorButtonSolver(dungeonRoom); + return defaultRoomProcessor; + } + } +} diff --git a/src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/bossfight/BossfightProcessorBonzo.java b/src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/bossfight/BossfightProcessorBonzo.java index a7efef0c..05722565 100644 --- a/src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/bossfight/BossfightProcessorBonzo.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/bossfight/BossfightProcessorBonzo.java @@ -15,11 +15,6 @@ public class BossfightProcessorBonzo extends GeneralBossfightProcessor { .signatureMsg("§r§c[BOSS] Bonzo §r§f: Gratz for making it this far, but I’m basically unbeatable.§r") .nextPhase("fight-1").build() ); - /* - * §r§cThis button doesn't seem to do anything...§r - * §r§aThis button seems connected to something§r - * §r§aClick! you Hear the sound of a door opening§r - * */ addPhase(GeneralBossfightProcessor.PhaseData.builder() .phase("fight-1") |