use of mage.abilities.effects.common.asthought.PlayFromNotOwnHandZoneTargetEffect in project mage by magefree.
the class DauthiVoidwalkerPlayEffect method apply.
@Override
public boolean apply(Game game, Ability source) {
Player player = game.getPlayer(source.getControllerId());
if (player == null) {
return false;
}
TargetCardInExile target = new TargetCardInExile(0, 1, filter, null, true);
player.choose(outcome, target, source.getSourceId(), game);
Card card = game.getCard(target.getFirstTarget());
if (card == null) {
return false;
}
game.addEffect(new PlayFromNotOwnHandZoneTargetEffect(Zone.EXILED, TargetController.YOU, Duration.EndOfTurn, true, false).setTargetPointer(new FixedTarget(card, game)), source);
return true;
}
use of mage.abilities.effects.common.asthought.PlayFromNotOwnHandZoneTargetEffect in project mage by magefree.
the class ChandraDressedToKillPlayEffect method apply.
@Override
public boolean apply(Game game, Ability source) {
Player controller = game.getPlayer(source.getControllerId());
if (controller == null) {
return false;
}
Card card = controller.getLibrary().getFromTop(game);
if (card == null) {
return false;
}
UUID exileId = CardUtil.getExileZoneId(game, source.getSourceId(), source.getSourceObjectZoneChangeCounter());
MageObject sourceObject = source.getSourceObject(game);
String exileName = sourceObject == null ? null : sourceObject.getIdName();
controller.moveCardsToExile(card, source, game, true, exileId, exileName);
if (game.getState().getZone(card.getId()) == Zone.EXILED && card.getColor(game).isRed()) {
game.addEffect(new PlayFromNotOwnHandZoneTargetEffect(Zone.EXILED, TargetController.YOU, Duration.EndOfTurn, false, true).setTargetPointer(new FixedTarget(card, game)), source);
}
return true;
}
use of mage.abilities.effects.common.asthought.PlayFromNotOwnHandZoneTargetEffect in project mage by magefree.
the class ChandraFireArtisanEffect 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) {
return false;
}
Cards cards = new CardsImpl(controller.getLibrary().getTopCards(game, (exileSeven ? 7 : 1)));
controller.moveCards(cards, Zone.EXILED, source, game);
for (Card card : cards.getCards(game)) {
if (card == null) {
continue;
}
ContinuousEffect effect = new PlayFromNotOwnHandZoneTargetEffect(Zone.EXILED, Duration.EndOfTurn);
effect.setTargetPointer(new FixedTarget(card, game));
game.addEffect(effect, source);
}
return true;
}
use of mage.abilities.effects.common.asthought.PlayFromNotOwnHandZoneTargetEffect in project mage by magefree.
the class CunningAbductionSpendAnyManaEffect method apply.
@Override
public boolean apply(Game game, Ability source) {
Player opponent = game.getPlayer(targetPointer.getFirst(game, source));
MageObject sourceObject = game.getObject(source.getSourceId());
if (opponent != null && sourceObject != null) {
opponent.revealCards(sourceObject.getName(), opponent.getHand(), game);
Player controller = game.getPlayer(source.getControllerId());
if (controller != null) {
int cardsHand = opponent.getHand().count(filter, game);
Card card = null;
if (cardsHand > 0) {
TargetCard target = new TargetCard(Zone.HAND, filter);
if (controller.choose(Outcome.Benefit, opponent.getHand(), target, game)) {
card = opponent.getHand().get(target.getFirstTarget(), game);
}
}
if (card != null) {
// move card to exile
UUID exileId = CardUtil.getCardExileZoneId(game, source);
controller.moveCardsToExile(card, source, game, true, exileId, sourceObject.getIdName());
// allow to cast the card
ContinuousEffect effect = new PlayFromNotOwnHandZoneTargetEffect(Zone.EXILED, Duration.Custom);
effect.setTargetPointer(new FixedTarget(card, game));
game.addEffect(effect, source);
// and you may spend mana as though it were mana of any color to cast it
effect = new CunningAbductionSpendAnyManaEffect();
effect.setTargetPointer(new FixedTarget(card.getId(), game));
game.addEffect(effect, source);
}
return true;
}
}
return false;
}
use of mage.abilities.effects.common.asthought.PlayFromNotOwnHandZoneTargetEffect in project mage by magefree.
the class DeadMansChestSpendManaEffect method apply.
@Override
public boolean apply(Game game, Ability source) {
Player controller = game.getPlayer(source.getControllerId());
MageObject sourceObject = source.getSourceObject(game);
Permanent attachedTo = (Permanent) getValue("attachedTo");
if (controller != null && sourceObject != null && attachedTo != null) {
Player owner = game.getPlayer(attachedTo.getOwnerId());
int amount = attachedTo.getPower().getValue();
if (owner != null && amount > 0) {
Set<Card> cards = owner.getLibrary().getTopCards(game, amount);
if (!cards.isEmpty()) {
controller.moveCardsToExile(cards, source, game, true, source.getSourceId(), sourceObject.getName());
for (Card card : cards) {
if (!card.isLand(game)) {
ContinuousEffect effect = new PlayFromNotOwnHandZoneTargetEffect(Zone.EXILED, Duration.Custom);
effect.setTargetPointer(new FixedTarget(card, game));
game.addEffect(effect, source);
effect = new DeadMansChestSpendManaEffect();
effect.setTargetPointer(new FixedTarget(card, game));
game.addEffect(effect, source);
}
}
}
}
return true;
}
return false;
}
Aggregations