PlayAi: Fix NPE with Invoke Calamity

This commit is contained in:
tool4EvEr
2022-04-13 10:21:48 +02:00
parent 80c51f4ef5
commit 4e63a9431d
12 changed files with 17 additions and 33 deletions

View File

@@ -195,8 +195,7 @@ public class PlayAi extends SpellAbilityAi {
final Card source = sa.getHostCard();
if (tgt != null) {
ZoneType zone = tgt.getZone().get(0);
cards = CardLists.getValidCards(ai.getGame().getCardsIn(zone), tgt.getValidTgts(), ai, source, sa);
cards = CardLists.getValidCards(ai.getGame().getCardsIn(tgt.getZone()), tgt.getValidTgts(), ai, source, sa);
} else if (!sa.hasParam("Valid")) {
cards = AbilityUtils.getDefinedCards(source, sa.getParam("Defined"), sa);
}
@@ -214,9 +213,11 @@ public class PlayAi extends SpellAbilityAi {
// Ensure that if a ValidZone is specified, there's at least something to choose from in that zone.
if (sa.hasParam("ValidZone")) {
cards = new CardCollection(AbilityUtils.filterListByType(ai.getGame().getCardsIn(ZoneType.valueOf(sa.getParam("ValidZone"))),
cards = new CardCollection(AbilityUtils.filterListByType(ai.getGame().getCardsIn(ZoneType.listValueOf(sa.getParam("ValidZone"))),
sa.getParam("Valid"), sa));
}
// exclude own card
cards.remove(source);
return cards;
}