AI: improved stability and bug fixes (related to #13290):

- bug's reason: wrong usage of canTarget, add/addTarget, getOpponents, etc;
- fixed that it can target dead players in some use cases (close #13507);
- fixed that it wrongly choose targets in bad/good effects in some use cases;
- fixed that it can't find valid targets in some use cases;
- fixed game freezes and errors with some cards;
This commit is contained in:
Oleg Agafonov 2025-04-19 07:04:55 +04:00
parent b915c6590b
commit 3dc606501d
10 changed files with 219 additions and 204 deletions

View file

@ -36,7 +36,7 @@ public class AttackIfAbleTargetRandomOpponentSourceEffect extends OneShotEffect
if (controller == null) {
return false;
}
List<UUID> opponents = new ArrayList<>(game.getOpponents(controller.getId()));
List<UUID> opponents = new ArrayList<>(game.getOpponents(controller.getId(), true));
Player opponent = game.getPlayer(opponents.get(RandomUtil.nextInt(opponents.size())));
if (opponent != null) {
game.informPlayers(opponent.getLogName() + " was chosen at random.");