aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/kr/syeyoung
diff options
context:
space:
mode:
authorsyeyoung <cyong06@naver.com>2021-02-24 02:29:02 +0900
committersyeyoung <cyong06@naver.com>2021-02-24 02:29:02 +0900
commitd9ebe7b909ab386f21ec15f2ab5e2c58a71391f9 (patch)
treef7ecbbbbf687519689f1bea33aa6a07c4b51571a /src/main/java/kr/syeyoung
parent32317d3372448fd9c719cb96ba60c0b9dde1303c (diff)
downloadSkyblock-Dungeons-Guide-d9ebe7b909ab386f21ec15f2ab5e2c58a71391f9.tar.gz
Skyblock-Dungeons-Guide-d9ebe7b909ab386f21ec15f2ab5e2c58a71391f9.tar.bz2
Skyblock-Dungeons-Guide-d9ebe7b909ab386f21ec15f2ab5e2c58a71391f9.zip
water solver 3.0
creeper solver 2.0 terminal solver 1.1
Diffstat (limited to 'src/main/java/kr/syeyoung')
-rw-r--r--src/main/java/kr/syeyoung/dungeonsguide/features/impl/boss/terminal/SelectInOrderSolutionProvider.java4
-rw-r--r--src/main/java/kr/syeyoung/dungeonsguide/features/impl/secret/FeatureMechanicBrowse.java1
-rwxr-xr-xsrc/main/java/kr/syeyoung/dungeonsguide/roomprocessor/RoomProcessorCreeperSolver.java2
-rwxr-xr-xsrc/main/java/kr/syeyoung/dungeonsguide/roomprocessor/waterpuzzle/Route.java2
-rwxr-xr-xsrc/main/java/kr/syeyoung/dungeonsguide/roomprocessor/waterpuzzle/WaterBoard.java53
5 files changed, 48 insertions, 14 deletions
diff --git a/src/main/java/kr/syeyoung/dungeonsguide/features/impl/boss/terminal/SelectInOrderSolutionProvider.java b/src/main/java/kr/syeyoung/dungeonsguide/features/impl/boss/terminal/SelectInOrderSolutionProvider.java
index d03f71fa..f6fc76e7 100644
--- a/src/main/java/kr/syeyoung/dungeonsguide/features/impl/boss/terminal/SelectInOrderSolutionProvider.java
+++ b/src/main/java/kr/syeyoung/dungeonsguide/features/impl/boss/terminal/SelectInOrderSolutionProvider.java
@@ -19,7 +19,7 @@ public class SelectInOrderSolutionProvider implements TerminalSolutionProvider {
for (Slot inventorySlot : chest.inventorySlots) {
if (inventorySlot.inventory != chest.getLowerChestInventory()) continue;
if (inventorySlot.getHasStack() && inventorySlot.getStack() != null && inventorySlot.getStack().getItem() == Item.getItemFromBlock(Blocks.stained_glass_pane)
- && inventorySlot.getStack().getItemDamage() == EnumDyeColor.LIME.getMetadata()) {
+ && inventorySlot.getStack().getItemDamage() == EnumDyeColor.RED.getMetadata()) {
if (inventorySlot.getStack().stackSize < lowest) {
lowest = inventorySlot.getStack().stackSize;
slotLowest = inventorySlot;
@@ -33,7 +33,7 @@ public class SelectInOrderSolutionProvider implements TerminalSolutionProvider {
for (Slot inventorySlot : chest.inventorySlots) {
if (inventorySlot.inventory != chest.getLowerChestInventory()) continue;
if (inventorySlot.getHasStack() && inventorySlot.getStack() != null && inventorySlot.getStack().getItem() == Item.getItemFromBlock(Blocks.stained_glass_pane)
- && inventorySlot.getStack().getItemDamage() == EnumDyeColor.LIME.getMetadata()) {
+ && inventorySlot.getStack().getItemDamage() == EnumDyeColor.RED.getMetadata()) {
if (inventorySlot.getStack().stackSize == lowest + 1) {
next = inventorySlot;
}
diff --git a/src/main/java/kr/syeyoung/dungeonsguide/features/impl/secret/FeatureMechanicBrowse.java b/src/main/java/kr/syeyoung/dungeonsguide/features/impl/secret/FeatureMechanicBrowse.java
index e7aa9421..c1793eec 100644
--- a/src/main/java/kr/syeyoung/dungeonsguide/features/impl/secret/FeatureMechanicBrowse.java
+++ b/src/main/java/kr/syeyoung/dungeonsguide/features/impl/secret/FeatureMechanicBrowse.java
@@ -396,6 +396,7 @@ public class FeatureMechanicBrowse extends GuiFeature implements GuiPreRenderLis
if (dungeonRoom == null) return;
if (!(dungeonRoom.getRoomProcessor() instanceof GeneralRoomProcessor)) return;
if (selected != -1) {
+ if (sortedMechanics.size() <= selected) return;;
((DungeonMechanic)sortedMechanics.get(selected)).highlight(new Color(0,255,255,50), sortedMechanicsName.get(selected) +" ("+(((DungeonMechanic)
sortedMechanics.get(selected)).getRepresentingPoint() != null ?
String.format("%.1f", MathHelper.sqrt_double(((DungeonMechanic) sortedMechanics.get(selected)).getRepresentingPoint().getBlockPos(dungeonRoom).distanceSq(Minecraft.getMinecraft().thePlayer.getPosition()))) : "")
diff --git a/src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/RoomProcessorCreeperSolver.java b/src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/RoomProcessorCreeperSolver.java
index 9d0e8557..a2f6c025 100755
--- a/src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/RoomProcessorCreeperSolver.java
+++ b/src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/RoomProcessorCreeperSolver.java
@@ -39,7 +39,7 @@ public class RoomProcessorCreeperSolver extends GeneralRoomProcessor {
final BlockPos low = getDungeonRoom().getMin().add(0,-2,0);
final BlockPos high = getDungeonRoom().getMax().add(0,20,0);
final AxisAlignedBB axis = AxisAlignedBB.fromBounds(
- low.getX() + 15, low.getY(), low.getZ() + 15,
+ low.getX() + 15, low.getY() + 5, low.getZ() + 15,
high.getX() - 15, low.getY() + 10.5, high.getZ() - 15
);
diff --git a/src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/waterpuzzle/Route.java b/src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/waterpuzzle/Route.java
index a873d654..9e15a26c 100755
--- a/src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/waterpuzzle/Route.java
+++ b/src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/waterpuzzle/Route.java
@@ -18,7 +18,7 @@ public class Route implements Cloneable, Comparable {
private int notMatches = 0;
public double calculateCost() {
- return (1.0/matches) * 50 + stateFlops * 10 + notMatches * 100;
+ return (1.0/matches) * 50 + stateFlops * 20 + notMatches * 10000;
}
@Override
diff --git a/src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/waterpuzzle/WaterBoard.java b/src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/waterpuzzle/WaterBoard.java
index 29a9a5dc..d0e4a6e0 100755
--- a/src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/waterpuzzle/WaterBoard.java
+++ b/src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/waterpuzzle/WaterBoard.java
@@ -95,6 +95,17 @@ public class WaterBoard {
ends.add(waterNodeEndMap.get(s));
}
currentRoute = getBestRoute(ends);
+
+// {
+//
+// Set<LeverState> currentState = new HashSet<LeverState>();
+// World w = waterPuzzle.getDungeonRoom().getContext().getWorld();
+// for (SwitchData switchDatum : this.switchData) {
+// currentState.add(new LeverState(switchDatum.getBlockId(), switchDatum.getCurrentState(w)));
+// }
+// currentRoute = simulate(currentState);
+// }
+
target = new ArrayList<BlockPos>();
target2 = new ArrayList<String>();
if (currentRoute != null) {
@@ -131,10 +142,10 @@ public class WaterBoard {
for (LeverState leverState : currentState) {
if (!states.contains(leverState))
- r.setStateFlops(r.getMatches() + 1);
+ r.setStateFlops(r.getStateFlops() + 1);
}
- for (WaterNodeEnd potentialEnd : potentialEnds) {
- if (r.getEndingNodes().contains(potentialEnd)) {
+ for (WaterNodeEnd potentialEnd : r.getEndingNodes()) {
+ if (potentialEnds.contains(potentialEnd)) {
r.setMatches(r.getMatches() + 1);
} else {
r.setNotMatches(r.getNotMatches() + 1);
@@ -151,7 +162,7 @@ public class WaterBoard {
public Route simulate(Set<LeverState> leverStates) {
leverStates.add(null);
Route r = new Route();
- Queue<WaterNode> toGoDownTo = new LinkedList<WaterNode>();
+ final Queue<WaterNode> toGoDownTo = new LinkedList<WaterNode>();
Set<WaterNode> searched = new HashSet<WaterNode>();
Set<LeverState> waterBlockingStates = new HashSet<LeverState>();
World w = waterPuzzle.getDungeonRoom().getContext().getWorld();
@@ -181,7 +192,7 @@ public class WaterBoard {
if (followWater && !nodehere.isWaterFilled(w)) break;
if (!nodehere.canWaterGoThrough()) break;
if (!leverStates.contains(nodehere.getCondition()) && !nodehere.isWaterFilled(w)) break;
- if (!leverStates.contains(nodehere.getCondition()) && nodehere.isWaterFilled(w)) waterBlockingStates.add(nodehere.getCondition());
+ if (nodehere.getCondition() != null && leverStates.contains(nodehere.getCondition().invert()) && nodehere.isWaterFilled(w)) waterBlockingStates.add(nodehere.getCondition().invert());
WaterNode down = getNodeAt(i, asd.getY() + 1);
if (i != asd.getX())
followWater = nodehere.isWaterFilled(w) && (down == null || (down.canWaterGoThrough() && leverStates.contains(down.getCondition())));
@@ -189,6 +200,9 @@ public class WaterBoard {
if (down != null && ((down.canWaterGoThrough() && leverStates.contains(down.getCondition())) || down.isWaterFilled(w))) {
toGoDownTo.add(down);
}
+ if (down != null && down.canWaterGoThrough() && down.getCondition() != null && leverStates.contains(down.getCondition().invert())) {
+ waterBlockingStates.add(down.getCondition().invert());
+ }
}
followWater = getNodeAt(asd.getX() +1, asd.getY()) != null && leverStates.contains(getNodeAt(asd.getX() + 1, asd.getY()).getCondition())
&& getNodeAt(asd.getX() +2, asd.getY()) != null && leverStates.contains(getNodeAt(asd.getX() + 2, asd.getY()).getCondition());
@@ -198,7 +212,7 @@ public class WaterBoard {
if (followWater && !nodehere.isWaterFilled(w)) break;
if (!nodehere.canWaterGoThrough()) break;
if (!leverStates.contains(nodehere.getCondition()) && !nodehere.isWaterFilled(w)) break;
- if (!leverStates.contains(nodehere.getCondition()) && nodehere.isWaterFilled(w)) waterBlockingStates.add(nodehere.getCondition());
+ if (nodehere.getCondition() != null && leverStates.contains(nodehere.getCondition().invert()) && nodehere.isWaterFilled(w)) waterBlockingStates.add(nodehere.getCondition().invert());
WaterNode down = getNodeAt(i, asd.getY() + 1);
if (i != asd.getX())
followWater = nodehere.isWaterFilled(w) && (down == null || (down.canWaterGoThrough() && leverStates.contains(down.getCondition())));
@@ -206,6 +220,9 @@ public class WaterBoard {
if (down != null && ((down.canWaterGoThrough() && leverStates.contains(down.getCondition())) || down.isWaterFilled(w))) {
toGoDownTo.add(down);
}
+ if (down != null && down.canWaterGoThrough() && down.getCondition() != null && leverStates.contains(down.getCondition().invert())) {
+ waterBlockingStates.add(down.getCondition().invert());
+ }
}
} else {
int minDistToDropRight = 9999;
@@ -242,29 +259,44 @@ public class WaterBoard {
if (minDistToDropRight == min) {
for (int i = asd.getX(); i <= asd.getX() + minDistToDropRight; i++) {
WaterNode nodehere = getNodeAt(i, asd.getY());
- if (leverStates.contains(nodehere.getCondition()) && nodehere.isWaterFilled(w)) waterBlockingStates.add(nodehere.getCondition());
+ if (nodehere.getCondition() != null && leverStates.contains(nodehere.getCondition().invert()) && nodehere.isWaterFilled(w)) waterBlockingStates.add(nodehere.getCondition().invert());
r.getNodes().add(nodehere);
WaterNode down = getNodeAt(i, asd.getY() + 1);
if (down != null && ((down.canWaterGoThrough() && leverStates.contains(down.getCondition())) || down.isWaterFilled(w))) {
toGoDownTo.add(down);
}
+ if (down != null && down.canWaterGoThrough() && down.getCondition() != null && leverStates.contains(down.getCondition().invert())) {
+ waterBlockingStates.add(down.getCondition().invert());
+ }
}
}
if (minDistToDropLeft == min) {
for (int i = asd.getX(); i >= asd.getX() - minDistToDropLeft; i--) {
WaterNode nodehere = getNodeAt(i, asd.getY());
- if (leverStates.contains(nodehere.getCondition()) && nodehere.isWaterFilled(w)) waterBlockingStates.add(nodehere.getCondition());
+ if (nodehere.getCondition() != null && leverStates.contains(nodehere.getCondition().invert()) && nodehere.isWaterFilled(w)) waterBlockingStates.add(nodehere.getCondition().invert());
r.getNodes().add(nodehere);
WaterNode down = getNodeAt(i, asd.getY() + 1);
if (down != null && ((down.canWaterGoThrough() && leverStates.contains(down.getCondition())) || down.isWaterFilled(w))) {
toGoDownTo.add(down);
}
+ if (down != null && down.canWaterGoThrough() && down.getCondition() != null && leverStates.contains(down.getCondition().invert())) {
+ waterBlockingStates.add(down.getCondition().invert());
+ }
}
}
}
}
- LinkedList<LeverState> states = new LinkedList<LeverState>();
- states.addAll(waterBlockingStates);
+ ArrayList<LeverState> state = new ArrayList<LeverState>(waterBlockingStates);
+ state.remove(null);
+ Collections.sort(state, new Comparator<LeverState>() {
+ @Override
+ public int compare(LeverState leverState, LeverState t1) {
+ int var0 = toggleableMap.get(leverState.getBlockId()).getY();
+ int var1 = toggleableMap.get(t1.getBlockId()).getY();
+ return var0 < var1 ? -1 : (var0 == var1 ? 0 : 1);
+ }
+ });
+ LinkedList<LeverState> states = new LinkedList<LeverState>(state);
for (LeverState ls : leverStates) {
if (!states.contains(ls)) {
states.add(ls);
@@ -272,6 +304,7 @@ public class WaterBoard {
}
states.remove(null);
+
r.setConditionList(states);
return r;
}