fix: include knocked out characters in TurnEvent for standard compatibility

This commit is contained in:
punchready 2021-06-03 02:37:03 +02:00
parent cc4c5ba8cb
commit c990356da0
1 changed files with 11 additions and 1 deletions

View File

@ -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());
}
}