use of mage.target.common.TargetCardInHand in project mage by magefree.
the class NoxiousVaporsEffect method chooseCardForColor.
private void chooseCardForColor(ObjectColor color, Set<Card> chosenCards, Player player, Game game, Ability source) {
FilterCard filter = new FilterCard();
filter.add(new ColorPredicate(color));
TargetCardInHand target = new TargetCardInHand(filter);
if (player.choose(Outcome.Benefit, target, source.getSourceId(), game)) {
Card card = game.getCard(target.getFirstTarget());
if (card != null) {
chosenCards.add(card);
}
}
}
use of mage.target.common.TargetCardInHand in project mage by magefree.
the class PatronOfTheMoonEffect method apply.
@Override
public boolean apply(Game game, Ability source) {
Player controller = game.getPlayer(source.getControllerId());
if (controller != null) {
TargetCard target = new TargetCardInHand(0, 2, new FilterLandCard("up to two land cards to put onto the battlefield tapped"));
controller.chooseTarget(outcome, controller.getHand(), target, source, game);
return controller.moveCards(new CardsImpl(target.getTargets()).getCards(game), Zone.BATTLEFIELD, source, game, true, false, false, null);
}
return false;
}
use of mage.target.common.TargetCardInHand in project mage by magefree.
the class SawtoothLoonEffect method apply.
@Override
public boolean apply(Game game, Ability source) {
Player controller = game.getPlayer(source.getControllerId());
if (controller != null) {
controller.drawCards(2, source, game);
TargetCardInHand target = new TargetCardInHand(2, 2, new FilterCard());
controller.chooseTarget(Outcome.Detriment, target, source, game);
Cards cardsToLibrary = new CardsImpl(target.getTargets());
if (!cardsToLibrary.isEmpty()) {
controller.putCardsOnBottomOfLibrary(cardsToLibrary, game, source, false);
}
return true;
}
return false;
}
use of mage.target.common.TargetCardInHand in project mage by magefree.
the class ScentOfCinderEffect method apply.
@Override
public boolean apply(Game game, Ability source) {
RevealTargetFromHandCost cost = new RevealTargetFromHandCost(new TargetCardInHand(0, Integer.MAX_VALUE, filter));
if (!cost.pay(source, game, source, source.getControllerId(), true)) {
return false;
}
int xValue = cost.getNumberRevealedCards();
return new DamageTargetEffect(xValue).apply(game, source);
}
use of mage.target.common.TargetCardInHand in project mage by magefree.
the class ScentOfJasmineEffect method apply.
@Override
public boolean apply(Game game, Ability source) {
RevealTargetFromHandCost cost = new RevealTargetFromHandCost(new TargetCardInHand(0, Integer.MAX_VALUE, filter));
if (!cost.pay(source, game, source, source.getControllerId(), true)) {
return false;
}
int xValue = cost.getNumberRevealedCards();
return new GainLifeEffect(2 * xValue).apply(game, source);
}
Aggregations