use of mage.abilities.costs.CompositeCost in project mage by magefree.
the class PreferredSelectionEffect method apply.
@Override
public boolean apply(Game game, Ability source) {
Player player = game.getPlayer(source.getControllerId());
if (player == null) {
return false;
}
Cards cards = new CardsImpl(player.getLibrary().getTopCards(game, 2));
player.lookAtCards(source, "Top two cards", cards, game);
Cost cost = new CompositeCost(new SacrificeSourceCost(), new ManaCostsImpl<>("{2}{G}{G}"), "sacrifice this permanent and pay {2}{G}{G}");
return new DoIfCostPaid(new LookLibraryAndPickControllerEffect(StaticValue.get(2), false, StaticValue.get(1), StaticFilters.FILTER_CARD, Zone.HAND, true, false), new LookLibraryAndPickControllerEffect(StaticValue.get(2), false, StaticValue.get(1), StaticFilters.FILTER_CARD, Zone.HAND, true, false, false, Zone.LIBRARY, false, true, false), cost).apply(game, source);
}
Aggregations