aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics
diff options
context:
space:
mode:
authorsyeyoung <42869671+cyoung06@users.noreply.github.com>2020-12-14 18:31:24 +0900
committersyeyoung <42869671+cyoung06@users.noreply.github.com>2020-12-14 18:31:24 +0900
commit299a569e6e37870bf7828500244916acefc3e1a0 (patch)
tree238597b930190b441382e73c4df0926fc757a799 /src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics
parent54b2804d7ff5c1d560893376070979d993ef0580 (diff)
downloadSkyblock-Dungeons-Guide-299a569e6e37870bf7828500244916acefc3e1a0.tar.gz
Skyblock-Dungeons-Guide-299a569e6e37870bf7828500244916acefc3e1a0.tar.bz2
Skyblock-Dungeons-Guide-299a569e6e37870bf7828500244916acefc3e1a0.zip
oneway and two way
Diffstat (limited to 'src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics')
-rw-r--r--src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonBreakableWall.java5
-rw-r--r--src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonDoor.java13
-rw-r--r--src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonLever.java21
-rw-r--r--src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonMechanic.java2
-rw-r--r--src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonOnewayDoor.java95
-rw-r--r--src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonOnewayLever.java85
-rw-r--r--src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonPressurePlate.java16
-rw-r--r--src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonSecret.java13
-rw-r--r--src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonTomb.java5
9 files changed, 242 insertions, 13 deletions
diff --git a/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonBreakableWall.java b/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonBreakableWall.java
index 0096ba80..9daf6bf3 100644
--- a/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonBreakableWall.java
+++ b/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonBreakableWall.java
@@ -88,4 +88,9 @@ public class DungeonBreakableWall implements DungeonMechanic, RouteBlocker {
return b == Blocks.air ?"open" :"closed";
}
+
+ @Override
+ public Set<String> getPossibleStates(DungeonRoom dungeonRoom) {
+ return isBlocking(dungeonRoom) ? Collections.singleton("open") : Collections.<String>emptySet();
+ }
}
diff --git a/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonDoor.java b/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonDoor.java
index 0182f938..93370c6c 100644
--- a/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonDoor.java
+++ b/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonDoor.java
@@ -32,7 +32,7 @@ public class DungeonDoor implements DungeonMechanic, RouteBlocker {
}
Set<Action> base;
Set<Action> preRequisites = base = new HashSet<Action>();
- {
+ if (!state.equalsIgnoreCase(getCurrentState(dungeonRoom))) {
ActionClickSet actionClick;
preRequisites.add(actionClick = new ActionClickSet(secretPoint));
actionClick.setPredicate(PredicateSuperBoom.INSTANCE);
@@ -84,4 +84,15 @@ public class DungeonDoor implements DungeonMechanic, RouteBlocker {
public String getCurrentState(DungeonRoom dungeonRoom) {
return isBlocking(dungeonRoom) ?"closed":"open";
}
+
+
+ @Override
+ public Set<String> getPossibleStates(DungeonRoom dungeonRoom) {
+ String currentStatus = getCurrentState(dungeonRoom);
+ if (currentStatus.equalsIgnoreCase("closed"))
+ return Collections.singleton("open");
+ else if (currentStatus.equalsIgnoreCase("open"))
+ return Collections.singleton("closed");
+ return Collections.emptySet();
+ }
}
diff --git a/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonLever.java b/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonLever.java
index a29ae770..79752eab 100644
--- a/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonLever.java
+++ b/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonLever.java
@@ -1,17 +1,18 @@
package kr.syeyoung.dungeonsguide.dungeon.mechanics;
import kr.syeyoung.dungeonsguide.dungeon.data.OffsetPoint;
-import kr.syeyoung.dungeonsguide.dungeon.mechanics.action.*;
+import kr.syeyoung.dungeonsguide.dungeon.mechanics.action.Action;
+import kr.syeyoung.dungeonsguide.dungeon.mechanics.action.ActionChangeState;
+import kr.syeyoung.dungeonsguide.dungeon.mechanics.action.ActionClick;
+import kr.syeyoung.dungeonsguide.dungeon.mechanics.action.ActionMove;
import kr.syeyoung.dungeonsguide.dungeon.roomfinder.DungeonRoom;
import kr.syeyoung.dungeonsguide.utils.RenderUtils;
import lombok.Data;
import net.minecraft.util.BlockPos;
import java.awt.*;
-import java.util.ArrayList;
-import java.util.HashSet;
import java.util.List;
-import java.util.Set;
+import java.util.*;
@Data
public class DungeonLever implements DungeonMechanic {
@@ -24,7 +25,7 @@ public class DungeonLever implements DungeonMechanic {
if (!("triggered".equalsIgnoreCase(state) || "untriggered".equalsIgnoreCase(state))) throw new IllegalArgumentException(state+" is not valid state for secret");
Set<Action> base;
Set<Action> preRequisites = base = new HashSet<Action>();
- {
+ if (!state.equalsIgnoreCase(getCurrentState(dungeonRoom))){
ActionClick actionClick;
preRequisites.add(actionClick = new ActionClick(leverPoint));
preRequisites = actionClick.getPreRequisite();
@@ -76,4 +77,14 @@ public class DungeonLever implements DungeonMechanic {
}
}
}
+
+ @Override
+ public Set<String> getPossibleStates(DungeonRoom dungeonRoom) {
+ String currentStatus = getCurrentState(dungeonRoom);
+ if (currentStatus.equalsIgnoreCase("untriggered"))
+ return Collections.singleton("triggered");
+ else if (currentStatus.equalsIgnoreCase("triggered"))
+ return Collections.singleton("untriggered");
+ return Collections.emptySet();
+ }
}
diff --git a/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonMechanic.java b/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonMechanic.java
index 232af04b..7bd4d71b 100644
--- a/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonMechanic.java
+++ b/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonMechanic.java
@@ -12,4 +12,6 @@ public interface DungeonMechanic {
void highlight(Color color, String name, DungeonRoom dungeonRoom, float partialTicks);
String getCurrentState(DungeonRoom dungeonRoom);
+
+ Set<String> getPossibleStates(DungeonRoom dungeonRoom);
}
diff --git a/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonOnewayDoor.java b/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonOnewayDoor.java
new file mode 100644
index 00000000..5b32e29a
--- /dev/null
+++ b/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonOnewayDoor.java
@@ -0,0 +1,95 @@
+package kr.syeyoung.dungeonsguide.dungeon.mechanics;
+
+import kr.syeyoung.dungeonsguide.dungeon.data.OffsetPoint;
+import kr.syeyoung.dungeonsguide.dungeon.data.OffsetPointSet;
+import kr.syeyoung.dungeonsguide.dungeon.mechanics.action.Action;
+import kr.syeyoung.dungeonsguide.dungeon.mechanics.action.ActionChangeState;
+import kr.syeyoung.dungeonsguide.dungeon.mechanics.action.ActionClickSet;
+import kr.syeyoung.dungeonsguide.dungeon.mechanics.action.ActionMoveNearestAir;
+import kr.syeyoung.dungeonsguide.dungeon.mechanics.predicates.PredicateSuperBoom;
+import kr.syeyoung.dungeonsguide.dungeon.roomfinder.DungeonRoom;
+import kr.syeyoung.dungeonsguide.utils.RenderUtils;
+import lombok.Data;
+import net.minecraft.init.Blocks;
+import net.minecraft.util.BlockPos;
+
+import java.awt.*;
+import java.util.List;
+import java.util.*;
+
+@Data
+public class DungeonOnewayDoor implements DungeonMechanic, RouteBlocker {
+ private OffsetPointSet secretPoint = new OffsetPointSet();
+ private List<String> preRequisite = new ArrayList<String>();
+
+
+ @Override
+ public Set<Action> getAction(String state, DungeonRoom dungeonRoom) {
+ if (!("open".equalsIgnoreCase(state))) throw new IllegalArgumentException(state+" is not valid state for door");
+ if (!isBlocking(dungeonRoom)) {
+ return Collections.emptySet();
+ }
+ Set<Action> base;
+ Set<Action> preRequisites = base = new HashSet<Action>();
+ {
+ ActionClickSet actionClick;
+ preRequisites.add(actionClick = new ActionClickSet(secretPoint));
+ actionClick.setPredicate(PredicateSuperBoom.INSTANCE);
+ preRequisites = actionClick.getPreRequisite();
+ }
+ {
+ ActionMoveNearestAir actionMove = new ActionMoveNearestAir(secretPoint.getOffsetPointList().get(0));
+ preRequisites.add(actionMove);
+ preRequisites = actionMove.getPreRequisite();
+ }
+ {
+ for (String str : preRequisite) {
+ ActionChangeState actionChangeState = new ActionChangeState(str.split(":")[0], str.split(":")[1]);
+ preRequisites.add(actionChangeState);
+ }
+ }
+ return base;
+ }
+
+ @Override
+ public void highlight(Color color, String name, DungeonRoom dungeonRoom, float partialTicks) {
+ if (secretPoint.getOffsetPointList().isEmpty()) return;
+ OffsetPoint firstpt = secretPoint.getOffsetPointList().get(0);
+ BlockPos pos = firstpt.getBlockPos(dungeonRoom);
+ RenderUtils.drawTextAtWorld(name, pos.getX() +0.5f, pos.getY()+0.25f, pos.getZ()+0.5f, 0xFFFFFFFF, 0.03f, false, true, partialTicks);
+ RenderUtils.drawTextAtWorld(getCurrentState(dungeonRoom), pos.getX() +0.5f, pos.getY()+0.75f, pos.getZ()+0.5f, 0xFFFFFFFF, 0.03f, false, true, partialTicks);
+
+ for (OffsetPoint offsetPoint : secretPoint.getOffsetPointList()) {
+ RenderUtils.highlightBlock(offsetPoint.getBlockPos(dungeonRoom), color,partialTicks);
+ }
+ }
+
+ @Override
+ public boolean isBlocking(DungeonRoom dungeonRoom) {
+ for (OffsetPoint offsetPoint : secretPoint.getOffsetPointList()) {
+ if (offsetPoint.getBlock(dungeonRoom) != Blocks.air) return true;
+ }
+ return false;
+ }
+
+ public DungeonOnewayDoor clone() throws CloneNotSupportedException {
+ DungeonOnewayDoor dungeonSecret = new DungeonOnewayDoor();
+ dungeonSecret.secretPoint = (OffsetPointSet) secretPoint.clone();
+ dungeonSecret.preRequisite = new ArrayList<String>(preRequisite);
+ return dungeonSecret;
+ }
+
+ @Override
+ public String getCurrentState(DungeonRoom dungeonRoom) {
+ return isBlocking(dungeonRoom) ?"closed":"open";
+ }
+
+
+ @Override
+ public Set<String> getPossibleStates(DungeonRoom dungeonRoom) {
+ String currentStatus = getCurrentState(dungeonRoom);
+ if (currentStatus.equalsIgnoreCase("closed"))
+ return Collections.singleton("open");
+ return Collections.emptySet();
+ }
+}
diff --git a/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonOnewayLever.java b/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonOnewayLever.java
new file mode 100644
index 00000000..10a6ecab
--- /dev/null
+++ b/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonOnewayLever.java
@@ -0,0 +1,85 @@
+package kr.syeyoung.dungeonsguide.dungeon.mechanics;
+
+import kr.syeyoung.dungeonsguide.dungeon.data.OffsetPoint;
+import kr.syeyoung.dungeonsguide.dungeon.mechanics.action.*;
+import kr.syeyoung.dungeonsguide.dungeon.roomfinder.DungeonRoom;
+import kr.syeyoung.dungeonsguide.utils.RenderUtils;
+import lombok.Data;
+import net.minecraft.util.BlockPos;
+
+import java.awt.*;
+import java.util.*;
+import java.util.List;
+
+@Data
+public class DungeonOnewayLever implements DungeonMechanic {
+ private OffsetPoint leverPoint = new OffsetPoint(0,0,0);
+ private List<String> preRequisite = new ArrayList<String>();
+ private String triggering;
+
+ @Override
+ public Set<Action> getAction(String state, DungeonRoom dungeonRoom) {
+ if (!("triggered".equalsIgnoreCase(state) || "untriggered".equalsIgnoreCase(state))) throw new IllegalArgumentException(state+" is not valid state for secret");
+ Set<Action> base;
+ Set<Action> preRequisites = base = new HashSet<Action>();
+ {
+ ActionClick actionClick;
+ preRequisites.add(actionClick = new ActionClick(leverPoint));
+ preRequisites = actionClick.getPreRequisite();
+ }
+ {
+ ActionMove actionMove = new ActionMove(leverPoint);
+ preRequisites.add(actionMove);
+ preRequisites = actionMove.getPreRequisite();
+ }
+ {
+ for (String str : preRequisite) {
+ ActionChangeState actionChangeState = new ActionChangeState(str.split(":")[0], str.split(":")[1]);
+ preRequisites.add(actionChangeState);
+ }
+ }
+ return base;
+ }
+
+ @Override
+ public void highlight(Color color, String name, DungeonRoom dungeonRoom, float partialTicks) {
+ BlockPos pos = getLeverPoint().getBlockPos(dungeonRoom);
+ RenderUtils.highlightBlock(pos, color,partialTicks);
+ RenderUtils.drawTextAtWorld(name, pos.getX() +0.5f, pos.getY()+0.75f, pos.getZ()+0.5f, 0xFFFFFFFF, 0.03f, false, true, partialTicks);
+ RenderUtils.drawTextAtWorld(getCurrentState(dungeonRoom), pos.getX() +0.5f, pos.getY()+0.25f, pos.getZ()+0.5f, 0xFFFFFFFF, 0.03f, false, true, partialTicks);
+ }
+
+ public DungeonOnewayLever clone() throws CloneNotSupportedException {
+ DungeonOnewayLever dungeonSecret = new DungeonOnewayLever();
+ dungeonSecret.leverPoint = (OffsetPoint) leverPoint.clone();
+ dungeonSecret.triggering = triggering;
+ dungeonSecret.preRequisite = new ArrayList<String>(preRequisite);
+ return dungeonSecret;
+ }
+
+
+ @Override
+ public String getCurrentState(DungeonRoom dungeonRoom) {
+
+ DungeonMechanic mechanic = dungeonRoom.getDungeonRoomInfo().getMechanics().get(triggering);
+ if (mechanic == null)
+ {
+ return "undeterminable";
+ } else {
+ String state = mechanic.getCurrentState(dungeonRoom);
+ if ("open".equalsIgnoreCase(state)) {
+ return "triggered";
+ } else {
+ return "untriggered";
+ }
+ }
+ }
+
+ @Override
+ public Set<String> getPossibleStates(DungeonRoom dungeonRoom) {
+ String currentStatus = getCurrentState(dungeonRoom);
+ if (currentStatus.equalsIgnoreCase("untriggered"))
+ return Collections.singleton("triggered");
+ return Collections.emptySet();
+ }
+}
diff --git a/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonPressurePlate.java b/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonPressurePlate.java
index 56826abd..a59b44b5 100644
--- a/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonPressurePlate.java
+++ b/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonPressurePlate.java
@@ -8,10 +8,8 @@ import lombok.Data;
import net.minecraft.util.BlockPos;
import java.awt.*;
-import java.util.ArrayList;
-import java.util.HashSet;
+import java.util.*;
import java.util.List;
-import java.util.Set;
@Data
public class DungeonPressurePlate implements DungeonMechanic {
@@ -22,6 +20,8 @@ public class DungeonPressurePlate implements DungeonMechanic {
@Override
public Set<Action> getAction(String state, DungeonRoom dungeonRoom) {
if (!("triggered".equalsIgnoreCase(state) || "untriggered".equalsIgnoreCase(state))) throw new IllegalArgumentException(state+" is not valid state for secret");
+ if (state.equalsIgnoreCase(getCurrentState(dungeonRoom))) return Collections.emptySet();
+
Set<Action> base;
Set<Action> preRequisites = base = new HashSet<Action>();
if ("triggered".equalsIgnoreCase(state)) {
@@ -76,4 +76,14 @@ public class DungeonPressurePlate implements DungeonMechanic {
}
}
}
+
+ @Override
+ public Set<String> getPossibleStates(DungeonRoom dungeonRoom) {
+ String currentStatus = getCurrentState(dungeonRoom);
+ if (currentStatus.equalsIgnoreCase("triggered"))
+ return Collections.singleton("untriggered");
+ else if (currentStatus.equalsIgnoreCase("untriggered"))
+ return Collections.singleton("triggered");
+ return Collections.emptySet();
+ }
}
diff --git a/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonSecret.java b/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonSecret.java
index 90adb774..fe5ad8c7 100644
--- a/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonSecret.java
+++ b/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonSecret.java
@@ -18,10 +18,8 @@ import net.minecraft.util.BlockPos;
import org.jetbrains.annotations.Nullable;
import java.awt.*;
-import java.util.ArrayList;
-import java.util.HashSet;
+import java.util.*;
import java.util.List;
-import java.util.Set;
@Data
public class DungeonSecret implements DungeonMechanic {
@@ -52,7 +50,7 @@ public class DungeonSecret implements DungeonMechanic {
@Override
public Set<Action> getAction(String state, DungeonRoom dungeonRoom) {
- if (!"claimed".equalsIgnoreCase(state)) throw new IllegalArgumentException(state+" is not valid state for secret");
+ if (!"found".equalsIgnoreCase(state)) throw new IllegalArgumentException(state+" is not valid state for secret");
Set<Action> base;
Set<Action> preRequisites = base = new HashSet<Action>();
if (secretType == SecretType.CHEST) {
@@ -109,4 +107,11 @@ public class DungeonSecret implements DungeonMechanic {
public String getCurrentState(DungeonRoom dungeonRoom) {
return getSecretStatus(dungeonRoom).name();
}
+
+ @Override
+ public Set<String> getPossibleStates(DungeonRoom dungeonRoom) {
+ SecretStatus status = getSecretStatus(dungeonRoom);
+ if (status == SecretStatus.FOUND) return Collections.emptySet();
+ else return Collections.singleton("found");
+ }
}
diff --git a/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonTomb.java b/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonTomb.java
index 02b90455..f65b0c0d 100644
--- a/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonTomb.java
+++ b/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonTomb.java
@@ -91,4 +91,9 @@ public class DungeonTomb implements DungeonMechanic, RouteBlocker {
b = secretPoint.getOffsetPointList().get(0).getBlock(dungeonRoom);
return b == Blocks.air ?"open" :"closed";
}
+
+ @Override
+ public Set<String> getPossibleStates(DungeonRoom dungeonRoom) {
+ return isBlocking(dungeonRoom) ? Collections.singleton("open") : Collections.<String>emptySet();
+ }
}