fix: remove major flaw in state manipulation
This commit is contained in:
@ -99,7 +99,8 @@ class GameStateManager {
|
||||
* @return The optionally resulting {@link Event Events}
|
||||
*/
|
||||
public ArrayList<Event> checkPostPhase() {
|
||||
ArrayList<Event> result = GameLogic.checkTurnEnd(state);
|
||||
GameState snapshot = state.snapshot();
|
||||
ArrayList<Event> result = GameLogic.checkTurnEnd(snapshot);
|
||||
applyEvents(result);
|
||||
return result;
|
||||
}
|
||||
@ -111,10 +112,14 @@ class GameStateManager {
|
||||
* @return The resulting {@link Event Events}
|
||||
*/
|
||||
public ArrayList<Event> startGame(ArrayList<Integer> selectedCharacters1, ArrayList<Integer> selectedCharacters2) {
|
||||
ArrayList<Event> result = GameLogic.startGame(state, selectedCharacters1, selectedCharacters2);
|
||||
GameState snapshot = state.snapshot();
|
||||
|
||||
ArrayList<Event> result = GameLogic.startGame(snapshot, selectedCharacters1, selectedCharacters2);
|
||||
applyEvents(result);
|
||||
|
||||
ArrayList<Event> result2 = GameLogic.startRound(state);
|
||||
snapshot = state.snapshot();
|
||||
|
||||
ArrayList<Event> result2 = GameLogic.startRound(snapshot);
|
||||
applyEvents(result2);
|
||||
|
||||
result.addAll(result2);
|
||||
@ -127,7 +132,8 @@ class GameStateManager {
|
||||
* @return The resulting {@link Event Events}
|
||||
*/
|
||||
public ArrayList<Event> endTurn() {
|
||||
ArrayList<Event> result = GameLogic.endTurn(state);
|
||||
GameState snapshot = state.snapshot();
|
||||
ArrayList<Event> result = GameLogic.endTurn(snapshot);
|
||||
applyEvents(result);
|
||||
return result;
|
||||
}
|
||||
|
Reference in New Issue
Block a user