From c990356da0ce5fc7847456a656fdb94dc5f6918b Mon Sep 17 00:00:00 2001 From: punchready Date: Thu, 3 Jun 2021 02:37:03 +0200 Subject: [PATCH] fix: include knocked out characters in TurnEvent for standard compatibility --- .../marvelous/gamelibrary/gamelogic/GameLogic.java | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/main/java/uulm/teamname/marvelous/gamelibrary/gamelogic/GameLogic.java b/src/main/java/uulm/teamname/marvelous/gamelibrary/gamelogic/GameLogic.java index d55ae8d..623e788 100644 --- a/src/main/java/uulm/teamname/marvelous/gamelibrary/gamelogic/GameLogic.java +++ b/src/main/java/uulm/teamname/marvelous/gamelibrary/gamelogic/GameLogic.java @@ -709,8 +709,13 @@ public class GameLogic { Character character = ((Character)state.entities.findEntity(id)); - if(character.hp.getValue() > 0){ + if(character.isAlive()){ alive.add(id); + }else { // send empty turn for knocked out characters + result.add(new EventBuilder(EventType.TurnEvent) + .withTurnCount(state.turnOrder.size()) + .withNextCharacter(id) + .buildGameEvent()); } if(character.inventory.getFreeSlots() == 0) { // no slots => has all infinity stones @@ -779,6 +784,11 @@ public class GameLogic { if(id.type == EntityType.NPC || revived.contains(id) || ((Character)state.entities.findEntity(id)).hp.getValue() > 0){ state.activeCharacter = id; break; + }else { // again send empty turns for knocked out characters + result.add(new EventBuilder(EventType.TurnEvent) + .withTurnCount(state.turnOrder.size()) + .withNextCharacter(id) + .buildGameEvent()); } }