@Override public PlayFromNotOwnHandZoneTargetEffect copy() { return new PlayFromNotOwnHandZoneTargetEffect(this); }
@Override public boolean applies(UUID objectId, Ability source, UUID affectedControllerId, Game game) { switch (allowedCaster) { case YOU: if (affectedControllerId != source.getControllerId()) { return false; } break; case OPPONENT: if (!game.getOpponents(source.getControllerId()).contains(affectedControllerId)) { return false; } break; case ANY: break; } List<UUID> targets = getTargetPointer().getTargets(game, source); if (targets.isEmpty()) { this.discard(); return false; } return targets.contains(objectId) && affectedControllerId.equals(source.getControllerId()) && game.getState().getZone(objectId).match(fromZone); } }
@Override public boolean apply(Game game, Ability source) { Player controller = game.getPlayer(source.getControllerId()); MageObject sourceObject = game.getObject(source.getSourceId()); if (controller != null && sourceObject != null) { Set<Card> cards = new HashSet<>(controller.getLibrary().getTopCards(game, 3)); if (!cards.isEmpty()) { controller.moveCardsToExile(cards, source, game, true, source.getSourceId(), sourceObject.getIdName()); // remove cards that could not be moved to exile for (Card card : cards) { if (!Zone.EXILED.equals(game.getState().getZone(card.getId()))) { cards.remove(card); } } if (!cards.isEmpty()) { ContinuousEffect effect = new PlayFromNotOwnHandZoneTargetEffect(Zone.EXILED, Duration.EndOfTurn); effect.setTargetPointer(new FixedTargets(cards, game)); game.addEffect(effect, source); } } return true; } return false; }
@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) { controller.moveCards(card, Zone.EXILED, source, game); ContinuousEffect effect = new PlayFromNotOwnHandZoneTargetEffect(Zone.EXILED, Duration.EndOfTurn); effect.setTargetPointer(new FixedTarget(card, game)); game.addEffect(effect, source); } return true; } return false; } }
@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; } Set<Card> cards = controller.getLibrary().getTopCards(game, 7); if (cards.isEmpty()) { return false; } controller.moveCards(cards, Zone.EXILED, source, game); for (Card card : cards) { if (card.isLand()) { continue; } ContinuousEffect effect = new PlayFromNotOwnHandZoneTargetEffect(Zone.EXILED, Duration.EndOfTurn); effect.setTargetPointer(new FixedTarget(card.getId(), card.getZoneChangeCounter(game))); game.addEffect(effect, source); } return true; } }
@Override public boolean apply(Game game, Ability source) { Player controller = game.getPlayer(source.getControllerId()); MageObject sourceObject = source.getSourceObject(game); if (controller != null && sourceObject != null) { int amount = (Integer) getValue("damage"); if (amount > 0) { Set<Card> cards = controller.getLibrary().getTopCards(game, amount); if (!cards.isEmpty()) { controller.moveCards(cards, Zone.EXILED, source, game); Cards canBeCast = new CardsImpl(); for (Card card : cards) { if (!card.isLand()) { canBeCast.add(card); } } ContinuousEffect effect = new PlayFromNotOwnHandZoneTargetEffect(Zone.EXILED, Duration.EndOfTurn); effect.setTargetPointer(new FixedTargets(canBeCast, game)); game.addEffect(effect, source); } return true; } return true; } return false; } }
@Override public boolean apply(Game game, Ability source) { Player controller = game.getPlayer(source.getControllerId()); Permanent sourcePermanent = game.getPermanentOrLKIBattlefield(source.getSourceId()); if (sourcePermanent != null && controller != null && controller.getLibrary().hasCards()) { Library library = controller.getLibrary(); Card card = library.getFromTop(game); if (card != null) { String exileName = sourcePermanent.getIdName() + " <this card may be played the turn it was exiled>"; controller.moveCardsToExile(card, source, game, true, source.getSourceId(), exileName); ContinuousEffect effect = new PlayFromNotOwnHandZoneTargetEffect(Zone.EXILED, Duration.EndOfTurn); effect.setTargetPointer(new FixedTarget(card, game)); game.addEffect(effect, source); } return true; } return false; } }
@Override public boolean apply(Game game, Ability source) { Player controller = game.getPlayer(source.getControllerId()); Permanent sourcePermanent = game.getPermanentOrLKIBattlefield(source.getSourceId()); if (sourcePermanent != null && controller != null && controller.getLibrary().hasCards()) { Library library = controller.getLibrary(); Card card = library.getFromTop(game); if (card != null) { String exileName = sourcePermanent.getIdName() + " <this card may be played the turn it was exiled>"; controller.moveCardsToExile(card, source, game, true, source.getSourceId(), exileName); ContinuousEffect effect = new PlayFromNotOwnHandZoneTargetEffect(Zone.EXILED, Duration.EndOfTurn); effect.setTargetPointer(new FixedTarget(card.getId(), card.getZoneChangeCounter(game))); game.addEffect(effect, source); } return true; } return false; } }
@Override public boolean apply(Game game, Ability source) { Player player = game.getPlayer(game.getActivePlayerId()); Permanent sourcePermanent = game.getPermanentOrLKIBattlefield(source.getSourceId()); if (player != null && sourcePermanent != null) { Card[] cards = player.getHand().getCards(new FilterCard(), game).toArray(new Card[0]); if (cards.length > 0) { Card card = cards[RandomUtil.nextInt(cards.length)]; if (card != null) { String exileName = sourcePermanent.getIdName() + " <this card may be played the turn it was exiled"; player.moveCardsToExile(card, source, game, true, source.getSourceId(), exileName); if (game.getState().getZone(card.getId()) == Zone.EXILED) { ContinuousEffect effect = new PlayFromNotOwnHandZoneTargetEffect(Zone.EXILED, Duration.EndOfTurn); effect.setTargetPointer(new FixedTarget(card, game)); game.addEffect(effect, source); DelayedTriggeredAbility delayed = new AtTheBeginOfNextEndStepDelayedTriggeredAbility(new ElkinLairPutIntoGraveyardEffect()); game.addDelayedTriggeredAbility(delayed, source); } } return true; } } return false; } }
@Override public boolean apply(Game game, Ability source) { Player controller = game.getPlayer(source.getControllerId()); Permanent sourcePermanent = game.getPermanentOrLKIBattlefield(source.getSourceId()); if (sourcePermanent != null && controller != null && controller.getLibrary().hasCards()) { Library library = controller.getLibrary(); Card card = library.getFromTop(game); if (card != null) { String exileName = sourcePermanent.getIdName() + " <this card may be played the turn it was exiled>"; controller.moveCardsToExile(card, source, game, true, source.getSourceId(), exileName); ContinuousEffect effect = new PlayFromNotOwnHandZoneTargetEffect(Duration.EndOfTurn); effect.setTargetPointer(new FixedTarget(card.getId(), card.getZoneChangeCounter(game))); game.addEffect(effect, source); } return true; } return false; } }
@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.getLogName()); for (Card card : cards) { if (!card.isLand()) { 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; } }
@Override public boolean apply(Game game, Ability source) { Player player = game.getPlayer(source.getControllerId()); if (player == null) { return false; } player.surveil(2, source, game); Target target = new TargetCardInYourGraveyard( new FilterInstantOrSorceryCard("instant or sorcery card from your graveyard")); if (!player.choose(outcome, target, source.getSourceId(), game)) { return true; } Card card = game.getCard(target.getFirstTarget()); if (card != null) { ContinuousEffect effect = new PlayFromNotOwnHandZoneTargetEffect(); effect.setTargetPointer(new FixedTarget(card, game)); game.addEffect(effect, source); effect = new MissionBriefingReplacementEffect(card.getId()); game.addEffect(effect, source); return true; } return false; } }
@Override public boolean apply(Game game, Ability source) { Player controller = game.getPlayer(source.getControllerId()); MageObject sourceObject = source.getSourceObject(game); if (controller != null && sourceObject != null) { TargetCardInLibrary target = new TargetCardInLibrary(new FilterNonlandCard()); target.setCardLimit(10); if (controller.searchLibrary(target, game)) { UUID targetId = target.getFirstTarget(); Card card = game.getCard(targetId); if (card != null) { controller.moveCardsToExile(card, source, game, true, source.getSourceId(), sourceObject.getIdName()); ContinuousEffect effect = new PlayFromNotOwnHandZoneTargetEffect(Zone.EXILED, Duration.EndOfTurn); effect.setTargetPointer(new FixedTarget(card.getId(), game)); game.addEffect(effect, source); } controller.shuffleLibrary(source, game); } return true; } return false; }
@Override public boolean apply(Game game, Ability source) { Player controller = game.getPlayer(source.getControllerId()); if (controller != null) { Card targetCard = game.getCard(getTargetPointer().getFirst(game, source)); if (targetCard != null) { if (controller.moveCards(targetCard, Zone.EXILED, source, game)) { targetCard = game.getCard(targetCard.getId()); if (targetCard != null) { ContinuousEffect effect = new PlayFromNotOwnHandZoneTargetEffect(Zone.EXILED, Duration.EndOfTurn); effect.setTargetPointer(new FixedTarget(targetCard, game)); game.addEffect(effect, source); effect = new DireFleetDaredevilSpendAnyManaEffect(); effect.setTargetPointer(new FixedTarget(targetCard, game)); game.addEffect(effect, source); effect = new DireFleetDaredevilReplacementEffect(); effect.setTargetPointer(new FixedTarget(targetCard, game)); game.addEffect(effect, source); } } } return true; } return false; } }
ContinuousEffect effect = new PlayFromNotOwnHandZoneTargetEffect(Zone.EXILED, Duration.EndOfTurn); effect.setTargetPointer(new FixedTarget(card, game)); game.addEffect(effect, source);
controller.moveCardsToExile(card, source, game, true, exileId, sourceObject.getIdName()); ContinuousEffect effect = new PlayFromNotOwnHandZoneTargetEffect(Zone.EXILED, Duration.Custom); effect.setTargetPointer(new FixedTarget(card, game)); game.addEffect(effect, source);