use of mage.target.common.TargetCardInYourGraveyard in project mage by magefree.
the class DeadReckoningEffect method apply.
@Override
public boolean apply(Game game, Ability source) {
Player controller = game.getPlayer(source.getControllerId());
TargetCardInYourGraveyard target1 = new TargetCardInYourGraveyard(new FilterCreatureCard("creature card in your graveyard"));
TargetCreaturePermanent target2 = new TargetCreaturePermanent();
if (controller != null) {
if (target1.canChoose(source.getSourceId(), source.getControllerId(), game) && controller.choose(Outcome.Benefit, target1, source.getSourceId(), game) && target2.canChoose(source.getSourceId(), source.getControllerId(), game) && controller.choose(Outcome.Damage, target2, source.getSourceId(), game)) {
Card creatureInGraveyard = game.getCard(target1.getFirstTarget());
if (creatureInGraveyard != null) {
if (controller.putCardsOnTopOfLibrary(creatureInGraveyard, game, source, true)) {
int power = creatureInGraveyard.getPower().getValue();
Permanent creature = game.getPermanent(target2.getFirstTarget());
if (creature != null) {
creature.damage(power, source.getSourceId(), source, game, false, true);
return true;
}
}
}
}
}
return false;
}
use of mage.target.common.TargetCardInYourGraveyard in project mage by magefree.
the class GhoulraiserEffect method apply.
@Override
public boolean apply(Game game, Ability source) {
Player player = game.getPlayer(source.getControllerId());
if (player == null || player.getGraveyard().count(filter, game) < 1) {
return false;
}
TargetCard target = new TargetCardInYourGraveyard(filter);
target.setNotTarget(true);
target.setRandom(true);
target.chooseTarget(outcome, player.getId(), source, 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 LilianaTheLastHopeEffect 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(StaticFilters.FILTER_CARD_CREATURE_YOUR_GRAVEYARD);
target.setNotTarget(true);
if (target.canChoose(source.getSourceId(), source.getControllerId(), game) && controller.chooseUse(outcome, "Return a creature card from your graveyard to hand?", source, game) && controller.choose(Outcome.ReturnToHand, target, source.getSourceId(), game)) {
Card card = game.getCard(target.getFirstTarget());
if (card != null) {
controller.moveCards(card, Zone.HAND, source, game);
}
}
return true;
}
use of mage.target.common.TargetCardInYourGraveyard in project mage by magefree.
the class MythosOfBrokkosEffect method apply.
@Override
public boolean apply(Game game, Ability source) {
Player player = game.getPlayer(source.getControllerId());
if (player == null) {
return false;
}
if (condition.apply(game, source)) {
TargetCardInLibrary targetCardInLibrary = new TargetCardInLibrary();
if (player.searchLibrary(targetCardInLibrary, source, game)) {
Card card = game.getCard(targetCardInLibrary.getFirstTarget());
if (card != null) {
player.moveCards(card, Zone.GRAVEYARD, source, game);
}
player.shuffleLibrary(source, game);
}
}
TargetCard targetCard = new TargetCardInYourGraveyard(0, 2, filter, true);
player.choose(outcome, player.getGraveyard(), targetCard, game);
Cards cards = new CardsImpl(targetCard.getTargets());
return player.moveCards(cards, Zone.HAND, source, game);
}
use of mage.target.common.TargetCardInYourGraveyard in project mage by magefree.
the class VisionsOfDreadEffect 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 || opponent.getGraveyard().count(StaticFilters.FILTER_CARD_CREATURE, game) < 1) {
return false;
}
TargetCardInYourGraveyard target = new TargetCardInYourGraveyard(StaticFilters.FILTER_CARD_CREATURE_YOUR_GRAVEYARD);
target.setNotTarget(true);
opponent.choose(Outcome.Detriment, target, source.getSourceId(), game);
return controller.moveCards(game.getCard(target.getFirstTarget()), Zone.BATTLEFIELD, source, game);
}
Aggregations