Search in sources :

Example 1 with FilterBasicLandCard

use of mage.filter.common.FilterBasicLandCard in project mage by magefree.

the class OldGrowthDryadsEffect method apply.

@Override
public boolean apply(Game game, Ability source) {
    Set<Player> playersThatSearched = new HashSet<>(1);
    for (UUID opponentId : game.getOpponents(source.getControllerId())) {
        Player opponent = game.getPlayer(opponentId);
        if (opponent != null && opponent.chooseUse(Outcome.PutLandInPlay, "Search your library for a basic land card and put it onto the battlefield tapped?", source, game)) {
            TargetCardInLibrary target = new TargetCardInLibrary(new FilterBasicLandCard());
            if (opponent.searchLibrary(target, source, game)) {
                Card targetCard = opponent.getLibrary().getCard(target.getFirstTarget(), game);
                if (targetCard != null) {
                    opponent.moveCards(targetCard, Zone.BATTLEFIELD, source, game, true, false, false, null);
                    playersThatSearched.add(opponent);
                }
            }
        }
    }
    for (Player opponent : playersThatSearched) {
        opponent.shuffleLibrary(source, game);
    }
    return true;
}
Also used : Player(mage.players.Player) FilterBasicLandCard(mage.filter.common.FilterBasicLandCard) UUID(java.util.UUID) TargetCardInLibrary(mage.target.common.TargetCardInLibrary) HashSet(java.util.HashSet) FilterBasicLandCard(mage.filter.common.FilterBasicLandCard) Card(mage.cards.Card)

Aggregations

HashSet (java.util.HashSet)1 UUID (java.util.UUID)1 Card (mage.cards.Card)1 FilterBasicLandCard (mage.filter.common.FilterBasicLandCard)1 Player (mage.players.Player)1 TargetCardInLibrary (mage.target.common.TargetCardInLibrary)1