PlayEffect: don't cast to CardCollection

This commit is contained in:
Hanmac
2018-04-20 13:01:29 +02:00
parent a11d5a0fa5
commit c47da9acdd

View File

@@ -78,7 +78,9 @@ public class PlayEffect extends SpellAbilityEffect {
if (sa.hasParam("ValidZone")) { if (sa.hasParam("ValidZone")) {
zone = ZoneType.smartValueOf(sa.getParam("ValidZone")); zone = ZoneType.smartValueOf(sa.getParam("ValidZone"));
} }
tgtCards = (CardCollection)AbilityUtils.filterListByType(game.getCardsIn(zone), sa.getParam("Valid"), sa); tgtCards = new CardCollection(
AbilityUtils.filterListByType(game.getCardsIn(zone), sa.getParam("Valid"), sa)
);
} }
else if (sa.hasParam("AnySupportedCard")) { else if (sa.hasParam("AnySupportedCard")) {
List<PaperCard> cards = Lists.newArrayList(StaticData.instance().getCommonCards().getUniqueCards()); List<PaperCard> cards = Lists.newArrayList(StaticData.instance().getCommonCards().getUniqueCards());
@@ -110,7 +112,11 @@ public class PlayEffect extends SpellAbilityEffect {
} }
if (sa.hasParam("ChoiceNum")) { if (sa.hasParam("ChoiceNum")) {
final int choicenum = AbilityUtils.calculateAmount(source, sa.getParam("ChoiceNum"), sa); final int choicenum = AbilityUtils.calculateAmount(source, sa.getParam("ChoiceNum"), sa);
tgtCards = (CardCollection)activator.getController().chooseCardsForEffect(choice, sa, source + " - Choose up to " + Lang.nounWithNumeral(choicenum, "card"), 0, choicenum, true); tgtCards = new CardCollection(
activator.getController().chooseCardsForEffect(choice, sa,
source + " - Choose up to " + Lang.nounWithNumeral(choicenum, "card"), 0, choicenum, true
)
);
} }
else { else {
tgtCards = choice; tgtCards = choice;