use of mage.cards.Card in project mage by magefree.
the class PuppeteerCliqueEffect method apply.
@Override
public boolean apply(Game game, Ability source) {
Card card = game.getCard(getTargetPointer().getFirst(game, source));
if (card == null) {
return false;
}
Player controller = game.getPlayer(source.getControllerId());
if (controller == null || !controller.moveCards(card, Zone.BATTLEFIELD, source, game)) {
return false;
}
Permanent permanent = game.getPermanent(card.getId());
if (permanent == null) {
return false;
}
ContinuousEffect hasteEffect = new GainAbilityTargetEffect(HasteAbility.getInstance(), Duration.Custom);
hasteEffect.setTargetPointer(new FixedTarget(permanent, game));
game.addEffect(hasteEffect, source);
ExileTargetEffect exileEffect = new ExileTargetEffect("exile " + permanent.getLogName());
exileEffect.setTargetPointer(new FixedTarget(permanent, game));
DelayedTriggeredAbility delayedAbility = new AtTheBeginOfNextEndStepDelayedTriggeredAbility(exileEffect, TargetController.YOU);
game.addDelayedTriggeredAbility(delayedAbility, source);
return true;
}
use of mage.cards.Card in project mage by magefree.
the class PuresightMerrowEffect method apply.
@Override
public boolean apply(Game game, Ability source) {
Player controller = game.getPlayer(source.getControllerId());
MageObject sourceObject = source.getSourceObject(game);
if (controller != null && sourceObject != null) {
Card card = controller.getLibrary().getFromTop(game);
if (card != null) {
Cards cards = new CardsImpl(card);
controller.lookAtCards("Puresight Merrow", cards, game);
if (controller.chooseUse(Outcome.Removal, "Exile the card from the top of your library?", source, game)) {
controller.moveCardToExileWithInfo(card, source.getSourceId(), sourceObject.getIdName(), source, game, Zone.LIBRARY, true);
} else {
game.informPlayers(controller.getLogName() + " puts the card back on top of their library.");
}
return true;
}
}
return false;
}
use of mage.cards.Card in project mage by magefree.
the class PulseOfTheDrossReturnToHandEffect method apply.
@Override
public boolean apply(Game game, Ability source) {
Player controller = game.getPlayer(source.getControllerId());
if (controller != null) {
Player player = game.getPlayer(source.getFirstTarget());
if (player != null) {
if (player.getHand().size() > controller.getHand().size()) {
Card card = game.getCard(source.getSourceId());
controller.moveCards(card, Zone.HAND, source, game);
}
return true;
}
}
return false;
}
use of mage.cards.Card in project mage by magefree.
the class PsychoticEpisodeEffect method apply.
@Override
public boolean apply(Game game, Ability source) {
Player player = game.getPlayer(targetPointer.getFirst(game, source));
Player controller = game.getPlayer(source.getControllerId());
MageObject sourceObject = source.getSourceObject(game);
if (player != null && controller != null && sourceObject != null) {
TargetCard targetCard = new TargetCard(Zone.ALL, new FilterCard());
targetCard.setRequired(true);
Cards options = player.getHand().copy();
Card topdeck = player.getLibrary().getFromTop(game);
options.add(topdeck);
controller.lookAtCards("Top of Library (Psychotic Episode)", topdeck, game);
if (controller.choose(Outcome.Discard, options, targetCard, game)) {
Card card = game.getCard(targetCard.getFirstTarget());
if (card != null) {
CardsImpl cards = new CardsImpl();
cards.add(card);
player.revealCards(sourceObject.getIdName(), cards, game);
player.putCardsOnBottomOfLibrary(cards, game, source, true);
}
}
return true;
}
return false;
}
use of mage.cards.Card in project mage by magefree.
the class PryingQuestionsEffect method apply.
@Override
public boolean apply(Game game, Ability source) {
Player targetOpponent = game.getPlayer(this.getTargetPointer().getFirst(game, source));
if (targetOpponent != null) {
if (!targetOpponent.getHand().isEmpty()) {
TargetCardInHand target = new TargetCardInHand();
target.setNotTarget(true);
target.setTargetName("a card from your hand to put on top of your library");
targetOpponent.choose(Outcome.Detriment, target, source.getSourceId(), game);
Card card = targetOpponent.getHand().get(target.getFirstTarget(), game);
if (card != null) {
targetOpponent.moveCardToLibraryWithInfo(card, source, game, Zone.HAND, true, false);
}
}
return true;
}
return false;
}
Aggregations