Fix NPE if PW gets removed

This commit is contained in:
tool4EvEr
2022-03-18 18:30:41 +01:00
parent 469ada0e4c
commit 0d009ad982
3 changed files with 3 additions and 5 deletions

View File

@@ -2521,10 +2521,8 @@ public class ComputerUtilCombat {
if (combat != null) {
// 1. If the card that spawned the attacker was sent at a planeswalker, attack the same. Consider improving.
GameEntity def = combat.getDefenderByAttacker(sa.getHostCard());
if (def != null && def instanceof Card) {
if (((Card)def).isPlaneswalker()) {
return def;
}
if (def != null && def instanceof Card && ((Card)def).isPlaneswalker() && defenders.contains(def)) {
return def;
}
// 2. Otherwise, go through the list of options one by one, choose the first one that can't be blocked profitably.
for (GameEntity p : defenders) {

View File

@@ -46,6 +46,7 @@ public class AddTurnAi extends SpellAbilityAi {
if (sa.usesTargeting()) {
sa.resetTargets();
if (sa.canTarget(ai)) {
// TODO check for Ugin's Nexus
sa.getTargets().add(ai);
} else if (mandatory) {
for (final Player ally : ai.getAllies()) {