Package mage.target.common

Examples of mage.target.common.TargetCardInLibrary


  @Override
  public boolean searchLibrary(TargetCardInLibrary target, Game game) {
    //20091005 - 701.14c
    if (!game.replaceEvent(GameEvent.getEvent(GameEvent.EventType.SEARCH_LIBRARY, playerId, playerId))) {
      TargetCardInLibrary newTarget;
      if (library.count(target.getFilter(), game) < target.getNumberOfTargets())
        newTarget = new TargetCardInLibrary(library.count(target.getFilter(), game), target.getMaxNumberOfTargets(), target.getFilter());
      else
        newTarget = target;
      if (newTarget.choose(Outcome.Neutral, playerId, game)) {
        game.fireEvent(GameEvent.getEvent(GameEvent.EventType.LIBRARY_SEARCHED, playerId, playerId));
        return true;
      }
    }
    return false;
View Full Code Here


    this.color.setWhite(true);
    this.power = new MageInt(1);
    this.toughness = new MageInt(1);

    this.addAbility(FlyingAbility.getInstance());
    TargetCardInLibrary target = new TargetCardInLibrary(3, filter);
    this.addAbility(new EntersBattlefieldTriggeredAbility(new SearchLibraryRevealPutInHandEffect(target), true));
  }
View Full Code Here

    return new CultivateEffect(this);
  }

  @Override
  public boolean apply(Game game, Ability source) {
    TargetCardInLibrary target = new TargetCardInLibrary(0, 2, new FilterBasicLandCard());
    Player player = game.getPlayer(source.getControllerId());
    player.searchLibrary(target, game);
    if (target.getTargets().size() > 0) {
      Cards revealed = new CardsImpl();
      for (UUID cardId: (List<UUID>)target.getTargets()) {
        Card card = player.getLibrary().remove(cardId, game);
        revealed.add(card);
      }
      player.revealCards(revealed, game);
      if (target.getTargets().size() == 2) {
        TargetCard target2 = new TargetCard(Zone.PICK, filter);
        target2.setRequired(true);
        player.choose(revealed, target2, game);
        Card card = revealed.get(target2.getFirstTarget(), game);
        card.putOntoBattlefield(game, Zone.LIBRARY, source.getId(), source.getControllerId());
        revealed.remove(card);
        Permanent permanent = game.getPermanent(card.getId());
        if (permanent != null)
          permanent.setTapped(true);
        card = revealed.getCards(game).iterator().next();
        card.moveToZone(Zone.HAND, source.getId(), game, false);
      }
      else if (target.getTargets().size() == 1) {
        Card card = revealed.getCards(game).iterator().next();
        card.putOntoBattlefield(game, Zone.LIBRARY, source.getId(), source.getControllerId());
        Permanent permanent = game.getPermanent(card.getId());
        if (permanent != null)
          permanent.setTapped(true);
View Full Code Here

    LoyaltyAbility ability1 = new LoyaltyAbility(new DiscardTargetEffect(1), 1);
    ability1.addTarget(new TargetPlayer());
    this.addAbility(ability1);

    this.addAbility(new LoyaltyAbility(new SearchLibraryPutOnLibraryEffect(new TargetCardInLibrary()), -2));

    this.addAbility(new LoyaltyAbility(new LilianaVessEffect(), -8));

  }
View Full Code Here

    addCost(new SacrificeSourceCost());
    FilterCard filter = new FilterCard("Swamp, Mountain, or Forest");
    filter.getName().add("Swamp");
    filter.getName().add("Mountain");
    filter.getName().add("Forest");
    TargetCardInLibrary target = new TargetCardInLibrary(filter);
    addEffect(new SearchLibraryPutInPlayEffect(target, true, Outcome.PutLandInPlay));
  }
View Full Code Here

    this.subtype.add("Scout");
    this.color.setGreen(true);
    this.power = new MageInt(1);
    this.toughness = new MageInt(1);

    TargetCardInLibrary target = new TargetCardInLibrary(filter);
    this.addAbility(new EntersBattlefieldTriggeredAbility(new SearchLibraryRevealPutInHandEffect(target)));
  }
View Full Code Here

    filter1.getName().add("Plains");
  }

  public KnightOfTheWhiteOrchidAbility() {
    super(Zone.BATTLEFIELD, null, "When {this} enters the battlefield, if an opponent controls more lands than you, you may ", true);
    TargetCardInLibrary target = new TargetCardInLibrary(filter1);
    addEffect(new SearchLibraryPutInPlayEffect(target, false, Outcome.PutLandInPlay));
  }
View Full Code Here

    this.subtype.add("Human");
    this.subtype.add("Soldier");
    this.power = new MageInt(3);
    this.toughness = new MageInt(2);

    TargetCardInLibrary target = new TargetCardInLibrary(0, 2, filter);
    this.addAbility(new EntersBattlefieldTriggeredAbility(new SearchLibraryRevealPutInHandEffect(target), true));
  }
View Full Code Here

    this.subtype.add("Kor");
    this.subtype.add("Artificer");
    this.power = new MageInt(1);
    this.toughness = new MageInt(2);

    TargetCardInLibrary target = new TargetCardInLibrary(1, 1, filter);
    this.addAbility(new EntersBattlefieldTriggeredAbility(new SearchLibraryRevealPutInHandEffect(target), true));

    SimpleActivatedAbility ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new PlayTargetWithoutPayingManaEffect(), new ManaCostsImpl("{1}{W}"));
    ability.addCost(new TapSourceCost());
    ability.addTarget(new TargetCardInHand(0, 1, filter));
View Full Code Here

    Permanent permanent = game.getPermanent(source.getFirstTarget());
    if (permanent != null) {
      Player player = game.getPlayer(permanent.getControllerId());
      if (permanent.moveToZone(Zone.EXILED, source.getId(), game, false)) {
        if (player.chooseUse(Outcome.PutCardInPlay, "Use Path to Exile effect?", game)) {
          TargetCardInLibrary target = new TargetCardInLibrary(new FilterBasicLandCard());
          player.searchLibrary(target, game);
          Card card = player.getLibrary().remove(target.getFirstTarget(), game);
          if (card != null) {
            if (card.putOntoBattlefield(game, Zone.LIBRARY, source.getId(), permanent.getControllerId())) {
              Permanent land = game.getPermanent(card.getId());
              if (land != null)
                land.setTapped(true);
View Full Code Here

TOP

Related Classes of mage.target.common.TargetCardInLibrary

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.