Skip to content

Commit

Permalink
fix a critical bug that crashed the game...
Browse files Browse the repository at this point in the history
  • Loading branch information
adamtomi committed Dec 12, 2022
1 parent 9acd8ec commit 2330449
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/main/java/com/vamk/tbg/game/Game.java
Original file line number Diff line number Diff line change
Expand Up @@ -254,6 +254,14 @@ private void play(Entity entity, boolean first) {
.filter(x -> move.isAttack() == entity.isEnemyOf(x))
.toList();

//TODO this is not the best way to go about this problem.
// It'd be nice to have a better "AI" in place however,
// in which case this will get replaced anyway.
if (targets.isEmpty()) {
LOGGER.info("No suitable target found...");
return;
}

target = RandomUtil.pickRandom(targets);
}

Expand Down

0 comments on commit 2330449

Please sign in to comment.