Tabnine Logo
SearchLibraryPutInPlayEffect.apply
Code IndexAdd Tabnine to your IDE (free)

How to use
apply
method
in
mage.abilities.effects.common.search.SearchLibraryPutInPlayEffect

Best Java code snippets using mage.abilities.effects.common.search.SearchLibraryPutInPlayEffect.apply (Showing top 7 results out of 315)

origin: magefree/mage

  @Override
  public boolean apply(Game game, Ability source) {
    Permanent permanent = game.getPermanent(source.getFirstTarget());
    FilterCard filter = new FilterPermanentCard();
    filter.add(new NamePredicate(permanent.getName()));
    return new SearchLibraryPutInPlayEffect(new TargetCardInLibrary(filter)).apply(game, source);
  }
}
origin: magefree/mage

  @Override
  public boolean apply(Game game, Ability source) {
    boolean result = false;
    int destroyedCreatures = 0;
    for (Target target : source.getTargets()) {
      if (target instanceof TargetPermanent) {
        Permanent targetPermanent = game.getPermanent(target.getFirstTarget());
        if (targetPermanent != null) {
          if (targetPermanent.destroy(source.getSourceId(), game, false)) {
            destroyedCreatures++;
          }
        }
      }
    }
    if (destroyedCreatures > 0) {
      new SearchLibraryPutInPlayEffect(new TargetCardInLibrary(destroyedCreatures, filterForest), true, true).apply(game, source);
    }
    return result;
  }
}
origin: magefree/mage

  @Override
  public boolean apply(Game game, Ability source) {
    Permanent creature = game.getPermanent(source.getFirstTarget());
    if (creature == null) {
      return false;
    }
    FilterCard filter = new FilterCard("a card named " + creature.getName());
    filter.add(new NamePredicate(creature.getName()));
    return new SearchLibraryPutInPlayEffect(new TargetCardInLibrary(filter)).apply(game, source);
  }
}
origin: magefree/mage

  @Override
  public boolean apply(Game game, Ability source) {
    Player player = game.getPlayer(source.getControllerId());
    Permanent sourcePermanent = game.getPermanentOrLKIBattlefield(source.getSourceId());
    if (sourcePermanent != null && player != null) {
      int newConvertedCost = sourcePermanent.getCounters(game).getCount("age");
      FilterCard filter = new FilterCard("creature card with converted mana cost " + newConvertedCost);
      filter.add(new ConvertedManaCostPredicate(ComparisonType.EQUAL_TO, newConvertedCost));
      filter.add(new CardTypePredicate(CardType.CREATURE));
      TargetCardInLibrary target = new TargetCardInLibrary(filter);
      return new SearchLibraryPutInPlayEffect(target).apply(game, source);
    }
    return false;
  }
}
origin: magefree/mage

  @Override
  public boolean apply(Game game, Ability source) {
    Player controller = game.getPlayer(source.getControllerId());
    if (controller != null) {
      int numberOfLands = 0;
      int ownLands = game.getBattlefield().countAll(new FilterLandPermanent(), controller.getId(), game);
      for (UUID playerId: game.getState().getPlayersInRange(controller.getId(), game)) {
        if (!playerId.equals(controller.getId())) {
          if (game.getBattlefield().countAll(new FilterLandPermanent(), playerId, game) > ownLands + 1) {
            numberOfLands++;
          }
        }
      }
      game.informPlayers("Surveyor's Scope: X = " + numberOfLands);
      // 10/17/2013 	If no players control at least two more lands than you when the ability resolves, you'll still search and shuffle your library.
      return new SearchLibraryPutInPlayEffect(new TargetCardInLibrary(0, numberOfLands, StaticFilters.FILTER_CARD_BASIC_LAND)).apply(game, source);
    }
    return false;
  }
}
origin: magefree/mage

  @Override
  public boolean apply(Game game, Ability source) {
    Player player = game.getPlayer(source.getControllerId());
    if(player != null) {
      if(player.chooseUse(Outcome.BoostCreature, "Do you want to to pay {1}{G}?", source, game)) {
        Cost cost = new ManaCostsImpl("{1}{G}");
        if(cost.pay(source, game, source.getSourceId(), source.getControllerId(), false, null)) {
          FilterCard filter = new FilterCard("card named Llanowar Sentinel");
          filter.add(new NamePredicate("Llanowar Sentinel"));
          new SearchLibraryPutInPlayEffect(new TargetCardInLibrary(0, 1, filter), false, true).apply(game, source);
        }
        return true;
      }
    }
    return false;
  }
}
origin: magefree/mage

  @Override
  public boolean apply(Game game, Ability source) {
    Player player = game.getPlayer(source.getControllerId());
    if (player != null && player.chooseUse(Outcome.BoostCreature, "Do you want to to pay {X}?", source, game)) {
      int costX = player.announceXMana(0, Integer.MAX_VALUE, "Announce the value for {X}", game, source);
      Cost cost = new GenericManaCost(costX);
      if (cost.pay(source, game, source.getSourceId(), source.getControllerId(), false, null)) {
        FilterCard filter = new FilterCard("Equipment card with converted mana cost " + costX + " or less");
        filter.add(new SubtypePredicate(SubType.EQUIPMENT));
        filter.add(new ConvertedManaCostPredicate(ComparisonType.FEWER_THAN, costX + 1));
        new SearchLibraryPutInPlayEffect(new TargetCardInLibrary(0, 1, filter), false, true).apply(game, source);
        return true;
      }
    }
    return false;
  }
}
mage.abilities.effects.common.searchSearchLibraryPutInPlayEffectapply

Popular methods of SearchLibraryPutInPlayEffect

  • <init>
  • setText
  • getTargets

Popular in Java

  • Start an intent from android
  • getResourceAsStream (ClassLoader)
  • setContentView (Activity)
  • addToBackStack (FragmentTransaction)
  • SocketException (java.net)
    This SocketException may be thrown during socket creation or setting options, and is the superclass
  • SQLException (java.sql)
    An exception that indicates a failed JDBC operation. It provides the following information about pro
  • Collection (java.util)
    Collection is the root of the collection hierarchy. It defines operations on data collections and t
  • Enumeration (java.util)
    A legacy iteration interface.New code should use Iterator instead. Iterator replaces the enumeration
  • Cipher (javax.crypto)
    This class provides access to implementations of cryptographic ciphers for encryption and decryption
  • JFrame (javax.swing)
  • Github Copilot alternatives
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now