From 66846b4d0bd5b835989b9e3deb5d14db082caf02 Mon Sep 17 00:00:00 2001 From: Sloth Date: Tue, 16 Apr 2013 07:13:12 +0000 Subject: [PATCH] - Fixed a possible NPE created by changeHiddenOriginResolveAI. --- src/main/java/forge/card/ability/ai/ChangeZoneAi.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/main/java/forge/card/ability/ai/ChangeZoneAi.java b/src/main/java/forge/card/ability/ai/ChangeZoneAi.java index ad4e05dfb87..a2642afc3dd 100644 --- a/src/main/java/forge/card/ability/ai/ChangeZoneAi.java +++ b/src/main/java/forge/card/ability/ai/ChangeZoneAi.java @@ -1168,7 +1168,7 @@ public class ChangeZoneAi extends SpellAbilityAi { }); } } - if (ZoneType.Exile.equals(destination) || origin.contains(ZoneType.Battlefield)) { + if (ZoneType.Exile.equals(destination) || origin.contains(ZoneType.Battlefield) || ZoneType.Library.equals(destination)) { // Exiling or bouncing stuff if (player.isOpponentOf(ai)) { c = ComputerUtilCard.getBestAI(fetchList); @@ -1198,7 +1198,9 @@ public class ChangeZoneAi extends SpellAbilityAi { if (CardLists.filter(hand, Presets.LANDS).isEmpty() && CardLists.filter(ai.getCardsIn(ZoneType.Battlefield), Presets.LANDS).size() < 4) { boolean canCastSomething = false; for (Card cardInHand : hand) { - canCastSomething |= ComputerUtilMana.payManaCost(cardInHand.getFirstSpellAbility(), ai, true, 0, false); + final SpellAbility spell = cardInHand.getFirstSpellAbility(); + spell.setActivatingPlayer(ai); + canCastSomething |= ComputerUtilMana.payManaCost(spell, ai, true, 0, false); } if (!canCastSomething) { System.out.println("Pulling a land as there are none in hand, less than 4 on the board, and nothing in hand is castable.");