mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-20 12:48:00 +00:00
Fix NPE if PW gets removed
This commit is contained in:
@@ -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) {
|
||||
|
||||
@@ -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()) {
|
||||
|
||||
Reference in New Issue
Block a user