Search in sources :

Example 6 with DiscardCardYouChooseTargetEffect

use of mage.abilities.effects.common.discard.DiscardCardYouChooseTargetEffect in project mage by magefree.

the class AddleEffect method apply.

@Override
public boolean apply(Game game, Ability source) {
    Player controller = game.getPlayer(source.getControllerId());
    ChoiceColor choice = new ChoiceColor();
    if (controller != null && controller.choose(outcome, choice, game)) {
        ObjectColor color = choice.getColor();
        game.informPlayers(controller.getLogName() + " chooses " + color + '.');
        FilterCard filter = new FilterCard();
        filter.add(new ColorPredicate(color));
        Effect effect = new DiscardCardYouChooseTargetEffect(filter);
        return effect.apply(game, source);
    }
    return false;
}
Also used : FilterCard(mage.filter.FilterCard) ColorPredicate(mage.filter.predicate.mageobject.ColorPredicate) TargetPlayer(mage.target.TargetPlayer) Player(mage.players.Player) ObjectColor(mage.ObjectColor) DiscardCardYouChooseTargetEffect(mage.abilities.effects.common.discard.DiscardCardYouChooseTargetEffect) OneShotEffect(mage.abilities.effects.OneShotEffect) Effect(mage.abilities.effects.Effect) DiscardCardYouChooseTargetEffect(mage.abilities.effects.common.discard.DiscardCardYouChooseTargetEffect) ChoiceColor(mage.choices.ChoiceColor)

Aggregations

DiscardCardYouChooseTargetEffect (mage.abilities.effects.common.discard.DiscardCardYouChooseTargetEffect)6 Player (mage.players.Player)6 FilterCard (mage.filter.FilterCard)5 Effect (mage.abilities.effects.Effect)3 OneShotEffect (mage.abilities.effects.OneShotEffect)3 TargetPlayer (mage.target.TargetPlayer)3 Card (mage.cards.Card)2 UUID (java.util.UUID)1 ObjectColor (mage.ObjectColor)1 ChoiceColor (mage.choices.ChoiceColor)1 FilterNonlandCard (mage.filter.common.FilterNonlandCard)1 OwnerIdPredicate (mage.filter.predicate.card.OwnerIdPredicate)1 CardIdPredicate (mage.filter.predicate.mageobject.CardIdPredicate)1 ColorPredicate (mage.filter.predicate.mageobject.ColorPredicate)1 ManaValuePredicate (mage.filter.predicate.mageobject.ManaValuePredicate)1 TargetCard (mage.target.TargetCard)1 TargetCardInExile (mage.target.common.TargetCardInExile)1 FixedTarget (mage.target.targetpointer.FixedTarget)1