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

How to use
apply
method
in
mage.abilities.effects.common.PhaseOutAllEffect

Best Java code snippets using mage.abilities.effects.common.PhaseOutAllEffect.apply (Showing top 4 results out of 315)

origin: magefree/mage

  @Override
  public boolean apply(Game game, Ability source) {
    Player controller = game.getPlayer(source.getControllerId());
    if (controller != null) {
      List<UUID> permIds = new ArrayList<>();
      for (Permanent permanent : game.getBattlefield().getActivePermanents(StaticFilters.FILTER_CONTROLLED_PERMANENT, controller.getId(), game)) {
        permIds.add(permanent.getId());
      }
      return new PhaseOutAllEffect(permIds).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) {
      List<UUID> permIds = new ArrayList<>();
      for (Permanent permanent : game.getBattlefield().getActivePermanents(new FilterControlledLandPermanent(), controller.getId(), game)) {
        permIds.add(permanent.getId());
      }
      return new PhaseOutAllEffect(permIds).apply(game, source);
    }
    return false;
  }
}
origin: magefree/mage

  private void phaseOutCardType(Player controller, Player targetPlayer, CardType cardType, Ability source, Game game) {
    FilterPermanent filter = new FilterControlledPermanent();
    filter.add(new CardTypePredicate(cardType));
    int numberController = game.getBattlefield().count(filter, source.getSourceId(), controller.getId(), game);
    int numberTargetPlayer = game.getBattlefield().count(filter, source.getSourceId(), targetPlayer.getId(), game);
    int excess = numberTargetPlayer - numberController;
    if (excess > 0) {
      FilterPermanent filterChoose = new FilterPermanent(cardType.toString().toLowerCase(Locale.ENGLISH) + (excess > 1 ? "s" : "") + " of target player");
      filterChoose.add(new ControllerIdPredicate(targetPlayer.getId()));
      filterChoose.add(new CardTypePredicate(cardType));
      Target target = new TargetPermanent(excess, excess, filterChoose, true);
      controller.chooseTarget(outcome, target, source, game);
      new PhaseOutAllEffect(target.getTargets()).apply(game, source);
    }
  }
}
origin: magefree/mage

  permIds.add(permanent.getId());
return new PhaseOutAllEffect(permIds).apply(game, source);
mage.abilities.effects.commonPhaseOutAllEffectapply

Popular methods of PhaseOutAllEffect

  • <init>

Popular in Java

  • Updating database using SQL prepared statement
  • scheduleAtFixedRate (ScheduledExecutorService)
  • getContentResolver (Context)
  • startActivity (Activity)
  • Table (com.google.common.collect)
    A collection that associates an ordered pair of keys, called a row key and a column key, with a sing
  • VirtualMachine (com.sun.tools.attach)
    A Java virtual machine. A VirtualMachine represents a Java virtual machine to which this Java vir
  • BufferedInputStream (java.io)
    A BufferedInputStream adds functionality to another input stream-namely, the ability to buffer the i
  • InputStreamReader (java.io)
    A class for turning a byte stream into a character stream. Data read from the source input stream is
  • BigDecimal (java.math)
    An immutable arbitrary-precision signed decimal.A value is represented by an arbitrary-precision "un
  • StringTokenizer (java.util)
    Breaks a string into tokens; new code should probably use String#split.> // Legacy code: StringTo
  • 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