feat: add proper game initialization

This commit is contained in:
2021-05-31 21:37:18 +02:00
parent 184c839c3a
commit 4b794e99e9
5 changed files with 96 additions and 7 deletions

View File

@ -53,19 +53,29 @@ class GameStateManager {
return (Event[])GameLogic.checkTurnEnd(state).toArray();
}
/**
* Initializes the game.
* @param selectedCharacters1 The characters selected by player 1
* @param selectedCharacters2 The characters selected by player 2
* @return The resulting {@link Event}s
*/
public Event[] initGame(ArrayList<Integer> selectedCharacters1, ArrayList<Integer> selectedCharacters2) {
return GameLogic.startGame(state, selectedCharacters1, selectedCharacters2).toArray(new Event[0]);
}
/**
* Starts the game.
* @return The resulting {@link Event}s
*/
public Event[] startGame() {
return (Event[])GameLogic.handleTurnEnd(state).toArray();
return GameLogic.handleRoundStart(state).toArray(new Event[0]);
}
/**
* Applies an array of {@link Event}s to the game state.
* @param events The events to apply
*/
public void applyEvents(Event[] events) {
public void applyEvents(Event... events) {
for(Event event: events) {
GameLogic.applyEvent(state, event);
}