Search in sources :

Example 1 with CompositeCost

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);
}
Also used : Player(mage.players.Player) CompositeCost(mage.abilities.costs.CompositeCost) SacrificeSourceCost(mage.abilities.costs.common.SacrificeSourceCost) DoIfCostPaid(mage.abilities.effects.common.DoIfCostPaid) LookLibraryAndPickControllerEffect(mage.abilities.effects.common.LookLibraryAndPickControllerEffect) SacrificeSourceCost(mage.abilities.costs.common.SacrificeSourceCost) Cost(mage.abilities.costs.Cost) CompositeCost(mage.abilities.costs.CompositeCost) Cards(mage.cards.Cards) CardsImpl(mage.cards.CardsImpl)

Aggregations

CompositeCost (mage.abilities.costs.CompositeCost)1 Cost (mage.abilities.costs.Cost)1 SacrificeSourceCost (mage.abilities.costs.common.SacrificeSourceCost)1 DoIfCostPaid (mage.abilities.effects.common.DoIfCostPaid)1 LookLibraryAndPickControllerEffect (mage.abilities.effects.common.LookLibraryAndPickControllerEffect)1 Cards (mage.cards.Cards)1 CardsImpl (mage.cards.CardsImpl)1 Player (mage.players.Player)1