From dd3201dfd212544baef08a530301d8af389c4300 Mon Sep 17 00:00:00 2001 From: punchready Date: Thu, 3 Jun 2021 02:21:12 +0200 Subject: [PATCH] feat: add method to end the current turn --- .../marvelous/gamelibrary/gamelogic/GameInstance.java | 8 ++++++++ .../gamelibrary/gamelogic/GameStateManager.java | 10 ++++++++++ 2 files changed, 18 insertions(+) diff --git a/src/main/java/uulm/teamname/marvelous/gamelibrary/gamelogic/GameInstance.java b/src/main/java/uulm/teamname/marvelous/gamelibrary/gamelogic/GameInstance.java index 7f92375..61d4bf8 100644 --- a/src/main/java/uulm/teamname/marvelous/gamelibrary/gamelogic/GameInstance.java +++ b/src/main/java/uulm/teamname/marvelous/gamelibrary/gamelogic/GameInstance.java @@ -75,6 +75,14 @@ public class GameInstance { return manager.startGame(selectedCharacters1, selectedCharacters2); } + /** + * Forcefully ends the current turn. + * @return The list of resulting {@link Event}s + */ + public ArrayList endTurn() { + return manager.endTurn(); + } + /** * Produces a {@link EventType#GamestateEvent} for the current {@link GameState}. * @return The resulting event diff --git a/src/main/java/uulm/teamname/marvelous/gamelibrary/gamelogic/GameStateManager.java b/src/main/java/uulm/teamname/marvelous/gamelibrary/gamelogic/GameStateManager.java index aa70c3f..167060b 100644 --- a/src/main/java/uulm/teamname/marvelous/gamelibrary/gamelogic/GameStateManager.java +++ b/src/main/java/uulm/teamname/marvelous/gamelibrary/gamelogic/GameStateManager.java @@ -112,6 +112,16 @@ class GameStateManager { return result; } + /** + * Forcefully ends the current turn. + * @return The resulting {@link Event}s + */ + public ArrayList endTurn() { + ArrayList result = GameLogic.endTurn(state); + applyEvents(result); + return result; + } + /** * Produces a {@link EventType#GamestateEvent} for the current {@link GameState}. * @return The resulting event