refactor: use isAlive instead of hp.getValue

This commit is contained in:
punchready 2021-06-03 03:15:05 +02:00
parent 00eb5e21f3
commit 614b33adff

View File

@ -498,7 +498,7 @@ public class GameLogic {
EntityType opposing = target.id.type == EntityType.P1 ? EntityType.P2 : EntityType.P1;
state.winConditions.increaseValue(opposing, WinCondition.TotalDamage, ((CharacterEvent)event).amount);
if(target.hp.getValue() == 0) {
if(!target.isAlive()) {
state.winConditions.increaseValue(opposing, WinCondition.TotalKnockouts, 1);
}
}
@ -815,7 +815,7 @@ public class GameLogic {
Collections.shuffle(state.turnOrder);
for (EntityID id: state.turnOrder) {
if(id.type == EntityType.NPC || revived.contains(id) || ((Character)state.entities.findEntity(id)).hp.getValue() > 0){
if(id.type == EntityType.NPC || revived.contains(id) || ((Character)state.entities.findEntity(id)).isAlive()){
state.activeCharacter = id;
break;
}else { // again send empty turns for knocked out characters
@ -927,7 +927,7 @@ public class GameLogic {
for(Character character: characters) {
if(checkLineOfSight(state, spawnPosition, character.getPosition())) {
if(character.hp.getValue() == 0) {
if(!character.isAlive()) {
revived.add(character.id);
}
if(character.hp.getValue() != character.hp.getMax()) {