use of mage.target.common.TargetCardInHand in project mage by magefree.
the class CinderSeerEffect 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 ConchHornEffect method putOnLibrary.
private boolean putOnLibrary(Player player, Ability source, Game game) {
TargetCardInHand target = new TargetCardInHand();
if (target.canChoose(source.getSourceId(), player.getId(), game)) {
player.chooseTarget(Outcome.ReturnToHand, target, source, game);
Card card = player.getHand().get(target.getFirstTarget(), game);
if (card != null) {
return player.moveCardToLibraryWithInfo(card, source, game, Zone.HAND, true, false);
}
}
return false;
}
use of mage.target.common.TargetCardInHand in project mage by magefree.
the class DreamCacheEffect method apply.
@Override
public boolean apply(Game game, Ability source) {
Player controller = game.getPlayer(source.getControllerId());
if (controller != null) {
controller.drawCards(3, source, game);
boolean putOnTop = controller.chooseUse(Outcome.Neutral, "Put cards on top?", 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()) {
if (putOnTop) {
controller.putCardsOnTopOfLibrary(cardsToLibrary, game, source, false);
} else {
controller.putCardsOnBottomOfLibrary(cardsToLibrary, game, source, false);
}
}
return true;
}
return false;
}
use of mage.target.common.TargetCardInHand in project mage by magefree.
the class FoldIntoAetherEffect method apply.
@Override
public boolean apply(Game game, Ability source) {
UUID targetId = getTargetPointer().getFirst(game, source);
StackObject stackObject = game.getStack().getStackObject(targetId);
Player spellController = null;
if (stackObject != null) {
spellController = game.getPlayer(stackObject.getControllerId());
}
if (game.getStack().counter(targetId, source, game)) {
TargetCardInHand target = new TargetCardInHand(StaticFilters.FILTER_CARD_CREATURE);
if (spellController != null && target.canChoose(source.getSourceId(), spellController.getId(), game) && spellController.chooseUse(Outcome.Neutral, "Put a creature card from your hand in play?", source, game) && spellController.choose(Outcome.PutCreatureInPlay, target, source.getSourceId(), game)) {
Card card = game.getCard(target.getFirstTarget());
if (card != null) {
spellController.moveCards(card, Zone.BATTLEFIELD, source, game);
}
}
return true;
}
return false;
}
use of mage.target.common.TargetCardInHand in project mage by magefree.
the class IlhargTheRazeBoarEffect method apply.
@Override
public boolean apply(Game game, Ability source) {
Player player = game.getPlayer(source.getControllerId());
if (player == null) {
return false;
}
TargetCard target = new TargetCardInHand(0, 1, StaticFilters.FILTER_CARD_CREATURE);
if (!player.choose(outcome, player.getHand(), target, game)) {
return false;
}
Card card = game.getCard(target.getFirstTarget());
if (card == null) {
return false;
}
player.moveCards(card, Zone.BATTLEFIELD, source, game, true, false, true, null);
Permanent permanent = game.getPermanent(card.getId());
if (permanent == null) {
return false;
}
game.getCombat().addAttackingCreature(permanent.getId(), game);
Effect effect = new ReturnToHandTargetEffect();
effect.setText("return " + permanent.getName() + " to its owner's hand");
effect.setTargetPointer(new FixedTarget(permanent, game));
game.addDelayedTriggeredAbility(new AtTheBeginOfNextEndStepDelayedTriggeredAbility(effect), source);
return true;
}
Aggregations