Search in sources :

Example 1 with LookLibraryAndPickControllerEffect

use of mage.abilities.effects.common.LookLibraryAndPickControllerEffect in project mage by magefree.

the class GarruksHarbingerEffect method apply.

@Override
public boolean apply(Game game, Ability source) {
    Integer damage = (Integer) getValue("damage");
    if (damage != null) {
        LookLibraryAndPickControllerEffect effect = new LookLibraryAndPickControllerEffect(StaticValue.get(damage), false, StaticValue.get(1), filter, false);
        effect.setBackInRandomOrder(true);
        return effect.apply(game, source);
    }
    return false;
}
Also used : LookLibraryAndPickControllerEffect(mage.abilities.effects.common.LookLibraryAndPickControllerEffect)

Example 2 with LookLibraryAndPickControllerEffect

use of mage.abilities.effects.common.LookLibraryAndPickControllerEffect 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

LookLibraryAndPickControllerEffect (mage.abilities.effects.common.LookLibraryAndPickControllerEffect)2 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 Cards (mage.cards.Cards)1 CardsImpl (mage.cards.CardsImpl)1 Player (mage.players.Player)1