feat: implement method to start a game

This commit is contained in:
2021-05-19 20:04:10 +02:00
parent f3b5fc277e
commit 596ace355a
3 changed files with 18 additions and 3 deletions

View File

@ -490,7 +490,7 @@ class GameLogic {
* @param state The game state to work on
* @return The list of resulting {@link Event}s
*/
private static ArrayList<Event> handleTurnEnd(GameState state) {
public static ArrayList<Event> handleTurnEnd(GameState state) {
ArrayList<Event> result = new ArrayList<>();
ArrayList<EntityID> order = state.turnOrder;
@ -521,8 +521,8 @@ class GameLogic {
}else {
int activeIndex = alive.indexOf(state.activeCharacter);
if(activeIndex == alive.size() - 1) {
int activeIndex = state.activeCharacter != null ? alive.indexOf(state.activeCharacter) : -1;
if(activeIndex == -1 || activeIndex == alive.size() - 1) {
state.activeCharacter = alive.get(0);
//reached end of turn order, new round
state.roundNumber++;