use of mage.target.TargetCard in project mage by magefree.
the class EccentricFarmerEffect method apply.
@Override
public boolean apply(Game game, Ability source) {
Player player = game.getPlayer(source.getControllerId());
if (player == null) {
return false;
}
player.millCards(3, source, game);
if (player.getGraveyard().count(StaticFilters.FILTER_CARD_LAND, game) < 1) {
return true;
}
TargetCard target = new TargetCardInYourGraveyard(0, 1, StaticFilters.FILTER_CARD_LAND, true);
player.choose(outcome, target, source.getSourceId(), game);
player.moveCards(game.getCard(target.getFirstTarget()), Zone.HAND, source, game);
return true;
}
use of mage.target.TargetCard in project mage by magefree.
the class ExperimentalOverloadEffect method apply.
@Override
public boolean apply(Game game, Ability source) {
Player player = game.getPlayer(source.getControllerId());
if (player == null) {
return false;
}
int spellCount = player.getGraveyard().count(StaticFilters.FILTER_CARD_INSTANT_OR_SORCERY, game);
new WeirdToken2(spellCount).putOntoBattlefield(1, game, source, source.getControllerId());
if (spellCount < 1) {
return true;
}
TargetCard target = new TargetCardInYourGraveyard(0, 1, StaticFilters.FILTER_CARD_INSTANT_OR_SORCERY, true);
player.choose(outcome, player.getGraveyard(), target, game);
return player.moveCards(game.getCard(target.getFirstTarget()), Zone.HAND, source, game);
}
use of mage.target.TargetCard in project mage by magefree.
the class ExtortionEffect method apply.
@Override
public boolean apply(Game game, Ability source) {
Player targetPlayer = game.getPlayer(source.getFirstTarget());
Player you = game.getPlayer(source.getControllerId());
if (targetPlayer == null || you == null) {
return false;
}
you.lookAtCards("Discard", targetPlayer.getHand(), game);
TargetCard target = new TargetCardInHand(0, 2, StaticFilters.FILTER_CARD_CARDS);
target.setNotTarget(true);
you.choose(Outcome.Discard, targetPlayer.getHand(), target, game);
targetPlayer.discard(new CardsImpl(target.getTargets()), false, source, game);
return true;
}
use of mage.target.TargetCard in project mage by magefree.
the class GontiLordOfLuxuryLookEffect method apply.
@Override
public boolean apply(Game game, Ability source) {
Player controller = game.getPlayer(source.getControllerId());
Player opponent = game.getPlayer(getTargetPointer().getFirst(game, source));
MageObject sourceObject = source.getSourceObject(game);
if (controller == null || opponent == null || sourceObject == null) {
return false;
}
Cards topCards = new CardsImpl();
topCards.addAll(opponent.getLibrary().getTopCards(game, 4));
TargetCard target = new TargetCard(Zone.LIBRARY, new FilterCard("card to exile"));
controller.choose(outcome, topCards, target, game);
Card card = game.getCard(target.getFirstTarget());
if (card == null) {
controller.putCardsOnBottomOfLibrary(topCards, game, source, false);
return true;
}
topCards.remove(card);
// move card to exile
UUID exileZoneId = CardUtil.getExileZoneId(game, source.getSourceId(), source.getSourceObjectZoneChangeCounter());
card.setFaceDown(true, game);
if (controller.moveCardsToExile(card, source, game, false, exileZoneId, sourceObject.getIdName())) {
card.setFaceDown(true, game);
Set<UUID> exileZones = (Set<UUID>) game.getState().getValue(VALUE_PREFIX + source.getSourceId().toString());
if (exileZones == null) {
exileZones = new HashSet<>();
game.getState().setValue(VALUE_PREFIX + source.getSourceId().toString(), exileZones);
}
exileZones.add(exileZoneId);
// allow to cast the card
ContinuousEffect effect = new GontiLordOfLuxuryCastFromExileEffect();
effect.setTargetPointer(new FixedTarget(card.getId(), game));
game.addEffect(effect, source);
// and you may spend mana as though it were mana of any color to cast it
effect = new GontiLordOfLuxurySpendAnyManaEffect();
effect.setTargetPointer(new FixedTarget(card.getId(), game));
game.addEffect(effect, source);
// For as long as that card remains exiled, you may look at it
effect = new GontiLordOfLuxuryLookEffect(controller.getId());
effect.setTargetPointer(new FixedTarget(card.getId(), game));
game.addEffect(effect, source);
}
// then put the rest on the bottom of that library in a random order
controller.putCardsOnBottomOfLibrary(topCards, game, source, false);
return true;
}
use of mage.target.TargetCard in project mage by magefree.
the class HaraldUnitesTheElvesTriggeredAbility method apply.
@Override
public boolean apply(Game game, Ability source) {
Player player = game.getPlayer(source.getControllerId());
if (player == null) {
return false;
}
player.millCards(3, source, game);
TargetCard targetCard = new TargetCardInYourGraveyard(0, 1, filter, true);
player.choose(outcome, targetCard, source.getSourceId(), game);
Card card = player.getGraveyard().get(targetCard.getFirstTarget(), game);
if (card != null) {
player.moveCards(card, Zone.BATTLEFIELD, source, game);
}
return true;
}
Aggregations