From 588633fe4627e274dd9b4b1f69b2fe5da17d976f Mon Sep 17 00:00:00 2001 From: punchready Date: Tue, 18 May 2021 18:44:01 +0200 Subject: [PATCH] fix: add more necessary getters to GameStateView --- .../marvelous/gamelibrary/gamelogic/GameStateView.java | 9 +++++++++ .../marvelous/gamelibrary/gamelogic/GameStateTest.java | 4 ++++ 2 files changed, 13 insertions(+) diff --git a/src/main/java/uulm/teamname/marvelous/gamelibrary/gamelogic/GameStateView.java b/src/main/java/uulm/teamname/marvelous/gamelibrary/gamelogic/GameStateView.java index 5ecd370..52b24a5 100644 --- a/src/main/java/uulm/teamname/marvelous/gamelibrary/gamelogic/GameStateView.java +++ b/src/main/java/uulm/teamname/marvelous/gamelibrary/gamelogic/GameStateView.java @@ -5,6 +5,7 @@ import uulm.teamname.marvelous.gamelibrary.entities.Entity; import uulm.teamname.marvelous.gamelibrary.entities.EntityID; import uulm.teamname.marvelous.gamelibrary.entities.StoneType; +import java.util.ArrayList; import java.util.Iterator; /** Represents a game state view containing getters for all the properties of a {@link GameState}. */ @@ -40,6 +41,10 @@ public class GameStateView { return state.activeCharacter; } + public ArrayList getTurnOrder() { + return state.turnOrder; + } + public boolean isWon() { return state.won; } @@ -47,4 +52,8 @@ public class GameStateView { public int getStoneCooldown(StoneType stone) { return state.stoneCooldown.getCooldown(stone); } + + public ParticipantType getWinnerAccordingToWinConditions() { + return GameLogic.checkWinConditions(state); + } } diff --git a/src/test/java/uulm/teamname/marvelous/gamelibrary/gamelogic/GameStateTest.java b/src/test/java/uulm/teamname/marvelous/gamelibrary/gamelogic/GameStateTest.java index 3d192fa..456cff9 100644 --- a/src/test/java/uulm/teamname/marvelous/gamelibrary/gamelogic/GameStateTest.java +++ b/src/test/java/uulm/teamname/marvelous/gamelibrary/gamelogic/GameStateTest.java @@ -5,6 +5,10 @@ import uulm.teamname.marvelous.gamelibrary.IntVector2; import uulm.teamname.marvelous.gamelibrary.entities.EntityID; import uulm.teamname.marvelous.gamelibrary.entities.EntityType; import uulm.teamname.marvelous.gamelibrary.entities.Rock; +import uulm.teamname.marvelous.gamelibrary.events.Event; +import uulm.teamname.marvelous.gamelibrary.requests.CharacterRequest; + +import java.util.ArrayList; import static org.junit.jupiter.api.Assertions.*;