aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonLever.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonLever.java')
-rw-r--r--src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonLever.java21
1 files changed, 16 insertions, 5 deletions
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();
+ }
}