Ejemplo n.º 1
0
 @Override
 public boolean apply(Game game, Ability source) {
   Player controller = game.getPlayer(source.getControllerId());
   MageObject sourceObject = source.getSourceObject(game);
   if (sourceObject != null && controller != null) {
     TargetCardInYourGraveyard target =
         new TargetCardInYourGraveyard(
             new FilterInstantOrSorceryCard("instant or sorcery card from your graveyard"));
     if (controller.chooseTarget(outcome, target, source, game)) {
       UUID exileId =
           CardUtil.getExileZoneId(
               game, source.getSourceId(), source.getSourceObjectZoneChangeCounter());
       Card card = controller.getGraveyard().get(target.getFirstTarget(), game);
       if (card != null) {
         controller.moveCardToExileWithInfo(
             card,
             exileId,
             sourceObject.getIdName(),
             source.getSourceId(),
             game,
             Zone.GRAVEYARD,
             true);
       }
     }
     return true;
   }
   return false;
 }
Ejemplo n.º 2
0
 @Override
 public boolean apply(Game game, Ability source) {
   Player targetPlayer = game.getPlayer(source.getFirstTarget());
   Player controller = game.getPlayer(source.getControllerId());
   if (targetPlayer != null && controller != null) {
     TargetCardInYourGraveyard target = new TargetCardInYourGraveyard();
     target.setRequired(true);
     if (targetPlayer.chooseTarget(Outcome.Exile, target, source, game)) {
       Card card = game.getCard(target.getFirstTarget());
       if (card != null) {
         targetPlayer.getGraveyard().remove(card);
         card.moveToExile(null, "", source.getId(), game);
         if (card.getCardType().contains(CardType.CREATURE)) {
           controller.gainLife(2, game);
         }
       }
       return true;
     }
   }
   return false;
 }
 public ReturnToHandFromGraveyardCost(TargetCardInYourGraveyard target) {
   this.addTarget(target);
   if (target.getMaxNumberOfTargets() > 1
       && target.getMaxNumberOfTargets() == target.getNumberOfTargets()) {
     this.text =
         new StringBuilder("return ")
             .append(target.getMaxNumberOfTargets())
             .append(" ")
             .append(target.getTargetName())
             .append(" from graveyard to it's owner's hand")
             .toString();
   } else {
     this.text =
         new StringBuilder("return ")
             .append(target.getTargetName())
             .append(" from graveyard to it's owner's hand")
             .toString();
   }
 }