From f54198d97e91f36ec2af5cfd9b8574ece293a92b Mon Sep 17 00:00:00 2001 From: Agetian Date: Fri, 27 Jan 2017 14:29:27 +0000 Subject: [PATCH] - Fixed the AI crashing the game when trying to play Profaner of the Dead (which can happen, for instance, when exiling one from opponent's library and playing it without paying mana cost). --- .../src/main/java/forge/ai/ability/ChangeZoneAllAi.java | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/forge-ai/src/main/java/forge/ai/ability/ChangeZoneAllAi.java b/forge-ai/src/main/java/forge/ai/ability/ChangeZoneAllAi.java index 275bf5c8b0c..cc122c45d45 100644 --- a/forge-ai/src/main/java/forge/ai/ability/ChangeZoneAllAi.java +++ b/forge-ai/src/main/java/forge/ai/ability/ChangeZoneAllAi.java @@ -279,6 +279,13 @@ public class ChangeZoneAllAi extends SpellAbilityAi { final ZoneType destination = ZoneType.smartValueOf(sa.getParam("Destination")); final ZoneType origin = ZoneType.listValueOf(sa.getParam("Origin")).get(0); + if (sa.getHostCard().getName().equals("Profaner of the Dead")) { + // TODO: this is a stub to prevent the AI from crashing the game when, for instance, playing the opponent's + // Profaner from exile without paying its mana cost. Otherwise the card is marked RemAIDeck and there is no + // specific AI to support playing it in a smarter way. Feel free to expand. + return !CardLists.filter(ai.getOpponents().getCardsIn(origin), CardPredicates.Presets.CREATURES).isEmpty(); + } + CardCollectionView humanType = CardLists.filterControlledBy(ai.getGame().getCardsIn(origin), ai.getOpponents()); humanType = AbilityUtils.filterListByType(humanType, sa.getParam("ChangeType"), sa);