Search in sources :

Example 21 with FilterNonlandCard

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

the class AgonizingRemorseEffect method apply.

@Override
public boolean apply(Game game, Ability source) {
    Player controller = game.getPlayer(source.getControllerId());
    Player opponent = game.getPlayer(source.getFirstTarget());
    if (controller == null || opponent == null) {
        return false;
    }
    opponent.revealCards(source, opponent.getHand(), game);
    TargetCard target;
    Cards cards;
    if (controller.chooseUse(outcome, "Exile a card from hand or graveyard?", null, "Hand", "Graveyard", source, game)) {
        target = new TargetCard(Zone.HAND, new FilterNonlandCard("nonland card in " + opponent.getName() + "'s hand"));
        target.setNotTarget(true);
        cards = opponent.getHand();
    } else {
        target = new TargetCard(Zone.GRAVEYARD, new FilterCard("card in " + opponent.getName() + "'s graveyard"));
        target.setNotTarget(true);
        cards = opponent.getGraveyard();
    }
    if (controller.choose(outcome, cards, target, game)) {
        Card card = game.getCard(target.getFirstTarget());
        if (card != null) {
            controller.moveCards(card, Zone.EXILED, source, game);
        }
    }
    controller.loseLife(1, game, source, false);
    return true;
}
Also used : FilterCard(mage.filter.FilterCard) Player(mage.players.Player) FilterNonlandCard(mage.filter.common.FilterNonlandCard) TargetCard(mage.target.TargetCard) Cards(mage.cards.Cards) FilterCard(mage.filter.FilterCard) FilterNonlandCard(mage.filter.common.FilterNonlandCard) TargetCard(mage.target.TargetCard) Card(mage.cards.Card)

Aggregations

FilterNonlandCard (mage.filter.common.FilterNonlandCard)21 Player (mage.players.Player)21 TargetCard (mage.target.TargetCard)15 Card (mage.cards.Card)14 FilterCard (mage.filter.FilterCard)9 UUID (java.util.UUID)7 ApprovingObject (mage.ApprovingObject)7 MageObject (mage.MageObject)6 TargetCardInLibrary (mage.target.common.TargetCardInLibrary)6 Cards (mage.cards.Cards)5 ManaValuePredicate (mage.filter.predicate.mageobject.ManaValuePredicate)4 CardsImpl (mage.cards.CardsImpl)3 Permanent (mage.game.permanent.Permanent)3 NamePredicate (mage.filter.predicate.mageobject.NamePredicate)2 Spell (mage.game.stack.Spell)2 TargetPlayer (mage.target.TargetPlayer)2 TargetCardInHand (mage.target.common.TargetCardInHand)2 ArrayList (java.util.ArrayList)1 HashSet (java.util.HashSet)1 Cost (mage.abilities.costs.Cost)1