use of mage.target.common.TargetCardInYourGraveyard 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.common.TargetCardInYourGraveyard 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.common.TargetCardInYourGraveyard 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;
}
use of mage.target.common.TargetCardInYourGraveyard in project mage by magefree.
the class KingNarfisBetrayalSecondEffect method apply.
@Override
public boolean apply(Game game, Ability source) {
UUID controllerId = source.getControllerId();
Player controller = game.getPlayer(controllerId);
if (controller == null) {
return false;
}
millEffect.apply(game, source);
// Controller graveyard
if (controller.getGraveyard().count(filter, game) != 0) {
if (controller.chooseUse(outcome, "Exile a creature or planeswalker card from your graveyard?", source, game)) {
TargetCard target = new TargetCardInYourGraveyard(filter);
target.setNotTarget(true);
if (controller.chooseTarget(outcome, controller.getGraveyard(), target, source, game)) {
controller.moveCardsToExile(game.getCard(target.getFirstTarget()), source, game, true, CardUtil.getCardExileZoneId(game, source), CardUtil.createObjectRealtedWindowTitle(source, game, null));
}
}
}
// Each opponent's graveyard
for (UUID opponentId : game.getOpponents(controllerId)) {
Player opponent = game.getPlayer(opponentId);
if (opponent == null) {
continue;
}
if (opponent.getGraveyard().count(filter, game) != 0) {
if (controller.chooseUse(outcome, "Exile a creature or planeswalker card from " + opponent.getName() + "'s graveyard?", source, game)) {
TargetCard target = new TargetCardInOpponentsGraveyard(1, 1, filter, true);
target.setNotTarget(true);
if (controller.chooseTarget(outcome, opponent.getGraveyard(), target, source, game)) {
controller.moveCardsToExile(game.getCard(target.getFirstTarget()), source, game, true, CardUtil.getCardExileZoneId(game, source), CardUtil.createObjectRealtedWindowTitle(source, game, null));
}
}
}
}
return true;
}
use of mage.target.common.TargetCardInYourGraveyard in project mage by magefree.
the class SequesteredStashEffect method apply.
@Override
public boolean apply(Game game, Ability source) {
Player controller = game.getPlayer(source.getControllerId());
if (controller == null) {
return false;
}
TargetCardInYourGraveyard target = new TargetCardInYourGraveyard(new FilterArtifactCard("artifact card from your graveyard"));
target.setNotTarget(true);
if (target.canChoose(source.getSourceId(), source.getControllerId(), game) && controller.chooseUse(outcome, "Put an artifact card from your graveyard to library?", source, game) && controller.choose(outcome, target, source.getSourceId(), game)) {
Card card = game.getCard(target.getFirstTarget());
if (card != null) {
controller.moveCards(card, Zone.LIBRARY, source, game);
}
}
return true;
}
Aggregations