@Override public PaymentDecision visit(CostGainControl cost) { if (cost.payCostFromSource()) return PaymentDecision.card(source); Integer c = cost.convertAmount(); if (c == null) { c = AbilityUtils.calculateAmount(source, cost.getAmount(), ability); } final List<Card> typeList = CardLists.getValidCards( player.getGame().getCardsIn(ZoneType.Battlefield), cost.getType().split(";"), player, source); if (typeList.size() < c) { return null; } CardLists.sortByPowerAsc(typeList); final List<Card> res = new ArrayList<Card>(); for (int i = 0; i < c; i++) { res.add(typeList.get(i)); } return res.isEmpty() ? null : PaymentDecision.card(res); }
@Override public PaymentDecision visit(CostExiledMoveToGrave cost) { Integer c = cost.convertAmount(); List<Card> chosen = new ArrayList<Card>(); if (c == null) { c = AbilityUtils.calculateAmount(source, cost.getAmount(), ability); } List<Card> typeList = player.getGame().getCardsIn(ZoneType.Exile); typeList = CardLists.getValidCards(typeList, cost.getType().split(";"), player, source); if (typeList.size() < c) { return null; } CardLists.sortByPowerAsc(typeList); Collections.reverse(typeList); for (int i = 0; i < c; i++) { chosen.add(typeList.get(i)); } return chosen.isEmpty() ? null : PaymentDecision.card(chosen); }