Esempio n. 1
0
  @Override
  public boolean apply(Game game, Ability source) {
    Permanent permanent = game.getPermanent(source.getFirstTarget());
    String name = permanent.getName();

    permanent.moveToZone(Zone.HAND, source.getSourceId(), game, false);
    for (Permanent perm :
        game.getBattlefield().getActivePermanents(source.getControllerId(), game)) {
      if (perm.getName().equals(name))
        permanent.moveToZone(Zone.HAND, source.getSourceId(), game, false);
    }

    return true;
  }
Esempio n. 2
0
  @Override
  public boolean apply(Game game, Ability source) {
    boolean result = false;

    Permanent permanent = game.getPermanent(source.getFirstTarget());
    if (permanent != null) {
      result |= permanent.moveToZone(Zone.HAND, source.getId(), game, false);
    }
    permanent = game.getPermanent(source.getTargets().get(1).getFirstTarget());
    if (permanent != null) {
      result |= permanent.moveToZone(Zone.HAND, source.getId(), game, false);
    }

    return result;
  }
Esempio n. 3
0
 @Override
 public boolean apply(Game game, Ability source) {
   Player player = game.getPlayer(targetPointer.getFirst(game, source));
   if (player == null) {
     return false;
   }
   if (player.getLife() > 2
       && player.chooseUse(
           Outcome.Neutral,
           "Pay 2 life? If you don't, return a permanent you control to its owner's hand.",
           game)) {
     player.loseLife(2, game);
     game.informPlayers(
         player.getName() + " pays 2 life. He will not return a permanent he or she controls.");
     return true;
   } else {
     Target target = new TargetControlledPermanent();
     if (target.canChoose(source.getSourceId(), player.getId(), game)
         && player.chooseTarget(outcome, target, source, game)) {
       Permanent permanent = game.getPermanent(target.getFirstTarget());
       if (permanent != null) {
         game.informPlayers(player.getName() + " returns " + permanent.getName() + " to hand.");
         return permanent.moveToZone(Zone.HAND, source.getSourceId(), game, false);
       }
     }
   }
   return false;
 }
Esempio n. 4
0
 @Override
 public boolean apply(Game game, Ability source) {
   for (Permanent creature :
       game.getBattlefield().getAllActivePermanents(new FilterNonlandPermanent(), game)) {
     creature.moveToZone(Constants.Zone.HAND, source.getSourceId(), game, true);
   }
   return true;
 }
Esempio n. 5
0
 @Override
 public boolean apply(Game game, Ability source) {
   Permanent permanent = game.getPermanent(targetPointer.getFirst(game, source));
   if (permanent != null) {
     if (permanent.moveToZone(Zone.LIBRARY, source.getSourceId(), game, true)) {
       game.getState().getPlayer(permanent.getOwnerId()).getLibrary().shuffle();
       return true;
     }
   }
   return false;
 }
Esempio n. 6
0
 @Override
 public boolean apply(Game game, Ability source) {
   for (UUID target : targetPointer.getTargets(game, source)) {
     Permanent creature = game.getPermanent(target);
     if (creature != null) {
       creature.damage(1, attachmentid, game, false, true);
     }
     Player player = game.getPlayer(target);
     if (player != null) {
       player.damage(1, attachmentid, game, false, true);
     }
   }
   Permanent razor = game.getPermanent(attachmentid);
   if (razor != null) {
     razor.moveToZone(Zone.HAND, id, game, true);
   }
   return true;
 }
Esempio n. 7
0
  @Override
  public boolean apply(Game game, Ability source) {
    Player controller = game.getPlayer(source.getControllerId());
    if (controller != null) {
      boolean targetChosen = false;
      TargetPermanent target = new TargetPermanent(1, 1, filter, true);
      if (target.canChoose(controller.getId(), game)
          && controller.chooseUse(
              outcome, "Return another creature you control to its owner's hand?", source, game)) {
        controller.chooseTarget(Outcome.ReturnToHand, target, source, game);
        Permanent permanent = game.getPermanent(target.getFirstTarget());
        if (permanent != null) {
          targetChosen = true;
          permanent.moveToZone(Zone.HAND, this.getId(), game, false);
        }
      }

      if (!targetChosen) {
        new SacrificeSourceEffect().apply(game, source);
      }
      return true;
    }
    return false;
  }