diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/BawkBawkBattles.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/BawkBawkBattles.java index 252b7754d..1f4730b64 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/BawkBawkBattles.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/BawkBawkBattles.java @@ -352,33 +352,25 @@ public class BawkBawkBattles extends TeamGame implements IThrown { int limit = _list.size(); int attemps = 0; - boolean available = true; - Challenge instance = _list.select(); + Challenge instance = _list.random(); while (!isSuitable(instance)) { if (attemps < limit) { - instance = _list.select(); + instance = _list.random(); attemps++; } else { - available = false; - break; + _list.resetPlayed(); + attemps = 0; } } - if (available) - { - System.out.println("Found matching challenge: " + instance.getName()); - return instance; - } - else - { - return null; - } + System.out.println("Found matching challenge: " + instance.getName()); + return instance; } private boolean isSuitable(Challenge instance) @@ -889,6 +881,8 @@ public class BawkBawkBattles extends TeamGame implements IThrown _settings.markMessagesAsSending(false); _settings.markMessagesAsSent(false); + _list.addPlayed(_challenge); + Damage = false; _challenge = null; EndCheck(); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenge/ChallengeList.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenge/ChallengeList.java index 3e631f7de..855f6be03 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenge/ChallengeList.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenge/ChallengeList.java @@ -11,13 +11,12 @@ public class ChallengeList private List _played = new ArrayList<>(); private Challenge _restricted; - public Challenge select() + public Challenge random() { if (_restricted == null) { if (_played.size() == _challenges.size()) { - System.out.println("All challenges played, resetting and selecting new one."); _played.clear(); return UtilMath.randomElement(_challenges); } @@ -25,21 +24,16 @@ public class ChallengeList { Challenge challenge = UtilMath.randomElement(_challenges); - System.out.println("Attempt: " + challenge.getName()); - while (_played.contains(challenge)) { - System.out.println("Attempt (Loop): " + challenge.getName()); challenge = UtilMath.randomElement(_challenges); } - System.out.println("Selected: " + challenge.getName()); return challenge; } } else { - System.out.println("Restricted: " + _restricted.getName()); return _restricted; } } @@ -52,10 +46,20 @@ public class ChallengeList } } + public void addPlayed(Challenge challenge) + { + _played.add(challenge); + } + public void restrict(Challenge challenge) { _restricted = challenge; } + + public void resetPlayed() + { + _played.clear(); + } public void unrestrict() { @@ -66,4 +70,9 @@ public class ChallengeList { return _challenges.size(); } + + public int played() + { + return _played.size(); + } }