diff options
author | syeyoung <42869671+cyoung06@users.noreply.github.com> | 2020-12-14 18:14:18 +0900 |
---|---|---|
committer | syeyoung <42869671+cyoung06@users.noreply.github.com> | 2020-12-14 18:14:18 +0900 |
commit | 963dada297f02a24ea1a8b0c1dbc2cbfb27e7bd1 (patch) | |
tree | 590e6e2f47ed670baba1dc2ca00e1de6362ca566 /src/main/java/kr/syeyoung/dungeonsguide/dungeon | |
parent | 219f145634b856fdeb35faafa91dbaeeb4b328e2 (diff) | |
download | Skyblock-Dungeons-Guide-963dada297f02a24ea1a8b0c1dbc2cbfb27e7bd1.tar.gz Skyblock-Dungeons-Guide-963dada297f02a24ea1a8b0c1dbc2cbfb27e7bd1.tar.bz2 Skyblock-Dungeons-Guide-963dada297f02a24ea1a8b0c1dbc2cbfb27e7bd1.zip |
moar value edits
Diffstat (limited to 'src/main/java/kr/syeyoung/dungeonsguide/dungeon')
5 files changed, 93 insertions, 6 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 6afb976f..0096ba80 100644 --- a/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonBreakableWall.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonBreakableWall.java @@ -26,7 +26,7 @@ public class DungeonBreakableWall implements DungeonMechanic, RouteBlocker { @Override public Set<Action> getAction(String state, DungeonRoom dungeonRoom) { - if (!"broken".equalsIgnoreCase(state)) throw new IllegalArgumentException(state+" is not valid state for breakable wall"); + if (!"open".equalsIgnoreCase(state)) throw new IllegalArgumentException(state+" is not valid state for breakable wall"); if (!isBlocking(dungeonRoom)) { return Collections.emptySet(); } @@ -86,6 +86,6 @@ public class DungeonBreakableWall implements DungeonMechanic, RouteBlocker { if (!secretPoint.getOffsetPointList().isEmpty()) b = secretPoint.getOffsetPointList().get(0).getBlock(dungeonRoom); - return b == Blocks.air ?"broken" :"blocking"; + return b == Blocks.air ?"open" :"closed"; } } diff --git a/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonDoor.java b/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonDoor.java new file mode 100644 index 00000000..0182f938 --- /dev/null +++ b/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonDoor.java @@ -0,0 +1,87 @@ +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.block.Block; +import net.minecraft.init.Blocks; +import net.minecraft.util.BlockPos; + +import java.awt.*; +import java.util.List; +import java.util.*; + +@Data +public class DungeonDoor 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) || "closed".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 DungeonDoor clone() throws CloneNotSupportedException { + DungeonDoor dungeonSecret = new DungeonDoor(); + dungeonSecret.secretPoint = (OffsetPointSet) secretPoint.clone(); + dungeonSecret.preRequisite = new ArrayList<String>(preRequisite); + return dungeonSecret; + } + + @Override + public String getCurrentState(DungeonRoom dungeonRoom) { + return isBlocking(dungeonRoom) ?"closed":"open"; + } +} 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 a7662831..a29ae770 100644 --- a/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonLever.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonLever.java @@ -69,7 +69,7 @@ public class DungeonLever implements DungeonMechanic { return "undeterminable"; } else { String state = mechanic.getCurrentState(dungeonRoom); - if ("broken".equalsIgnoreCase(state)) { + if ("open".equalsIgnoreCase(state)) { return "triggered"; } else { return "untriggered"; 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 0b68f855..56826abd 100644 --- a/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonPressurePlate.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonPressurePlate.java @@ -69,7 +69,7 @@ public class DungeonPressurePlate implements DungeonMechanic { return "undeterminable"; } else { String state = mechanic.getCurrentState(dungeonRoom); - if ("broken".equalsIgnoreCase(state)) { + if ("open".equalsIgnoreCase(state)) { return "triggered"; } else { return "untriggered"; 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 6ae34a71..02b90455 100644 --- a/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonTomb.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonTomb.java @@ -30,7 +30,7 @@ public class DungeonTomb implements DungeonMechanic, RouteBlocker { @Override public Set<Action> getAction(String state, DungeonRoom dungeonRoom) { - if (!"broken".equalsIgnoreCase(state)) throw new IllegalArgumentException(state+" is not valid state for tomb"); + if (!"open".equalsIgnoreCase(state)) throw new IllegalArgumentException(state+" is not valid state for tomb"); if (!isBlocking(dungeonRoom)) { return Collections.emptySet(); } @@ -89,6 +89,6 @@ public class DungeonTomb implements DungeonMechanic, RouteBlocker { Block b = Blocks.air; if (!secretPoint.getOffsetPointList().isEmpty()) b = secretPoint.getOffsetPointList().get(0).getBlock(dungeonRoom); - return b == Blocks.air ?"broken" :"blocking"; + return b == Blocks.air ?"open" :"closed"; } } |