Tabnine Logo
ExileTargetCost
Code IndexAdd Tabnine to your IDE (free)

How to use
ExileTargetCost
in
mage.abilities.costs.common

Best Java code snippets using mage.abilities.costs.common.ExileTargetCost (Showing top 9 results out of 315)

origin: magefree/mage

@Override
public ExileTargetCost copy() {
  return new ExileTargetCost(this);
}
origin: magefree/mage

public ExileTargetCost(TargetControlledPermanent target, boolean noText) {
  this.addTarget(target);
}
origin: magefree/mage

  @Override
  public boolean apply(Game game, Ability source) {
    Player player = game.getPlayer(source.getControllerId());
    Permanent permanent = source.getSourcePermanentIfItStillExists(game);
    if (player == null || permanent == null) {
      return false;
    }
    FilterControlledPermanent filter = new FilterControlledPermanent("tokens created with " + permanent.getName());
    filter.add(new TetravusPredicate(new MageObjectReference(permanent, game)));
    filter.add(TokenPredicate.instance);
    ExileTargetCost cost = new ExileTargetCost(new TargetControlledPermanent(0, Integer.MAX_VALUE, filter, true));
    if (cost.pay(source, game, source.getSourceId(), player.getId(), true)) {
      return new AddCountersSourceEffect(CounterType.P1P1.createInstance(cost.getPermanents().size())).apply(game, source);
    }
    return false;
  }
}
origin: magefree/mage

  @Override
  public boolean apply(Game game, Ability source) {
    ReturnFromGraveyardToBattlefieldTargetEffect effect = new ReturnFromGraveyardToBattlefieldTargetEffect();
    if (!effect.apply(game, source)) {
      return false;
    }

    for (Cost c : source.getCosts()) {
      /*   if (!c.getTargets().isEmpty()){
        UUID t = c.getTargets().getFirstTarget();
        Permanent exiled = game.getPermanentOrLKIBattlefield(t);*/
      if (c.isPaid() && c instanceof ExileTargetCost) {
        for (Permanent exiled : ((ExileTargetCost) c).getPermanents()) {
          if (exiled != null) {
            if (exiled.hasSubtype(SubType.THRULL, game)) {
              game.getPermanent(source.getFirstTarget()).addCounters(CounterType.P2P2.createInstance(), source, game);
              return true;
            }
          } else {
            return false;
          }
        }
      }
    }
    return true;
  }
}
origin: magefree/mage

@Override
public Mana produceMana(boolean netMana, Game game, Ability source) {
  if (netMana) {
    return null;
  }
  Player controller = game.getPlayer(source.getControllerId());
  if (controller != null) {
    int manaCostExiled = 0;
    for (Cost cost : source.getCosts()) {
      if (cost.isPaid() && cost instanceof ExileTargetCost) {
        for (Card card : ((ExileTargetCost) cost).getPermanents()) {
          manaCostExiled += card.getConvertedManaCost();
        }
      }
    }
    ChoiceColor choice = new ChoiceColor();
    if (!controller.choose(Outcome.PutManaInPool, choice, game)) {
      return null;
    }
    Mana chosen = choice.getMana(manaCostExiled + 1);
    return manaBuilder.setMana(chosen, source, game).build();
  }
  return null;
}
origin: magefree/mage

public FoodChain(UUID ownerId, CardSetInfo setInfo) {
  super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{2}{G}");
  // Exile a creature you control: Add X mana of any one color, where X is the exiled creature's converted mana cost plus one. Spend this mana only to cast creature spells.
  Ability ability = new SimpleManaAbility(Zone.BATTLEFIELD, new FoodChainManaEffect(),
      new ExileTargetCost(new TargetControlledCreaturePermanent(1, 1, StaticFilters.FILTER_CONTROLLED_A_CREATURE, true)));
  this.addAbility(ability);
}
origin: magefree/mage

public ExileTargetCost(TargetControlledPermanent target) {
  this.addTarget(target);
  this.text = "Exile " + target.getTargetName();
}

origin: magefree/mage

public SoulExchange(UUID ownerId, CardSetInfo setInfo) {
  super(ownerId, setInfo, new CardType[]{CardType.SORCERY}, "{B}{B}");
  // As an additional cost to cast Soul Exchange, exile a creature you control.
  Cost cost = new ExileTargetCost(new TargetControlledCreaturePermanent());
  this.getSpellAbility().addCost(cost);
  // Return target creature card from your graveyard to the battlefield. Put a +2/+2 counter on that creature if the exiled creature was a Thrull.
  this.getSpellAbility().addTarget(new TargetCardInYourGraveyard(StaticFilters.FILTER_CARD_CREATURE_YOUR_GRAVEYARD));
  this.getSpellAbility().addEffect(new SoulExchangeEffect());
}
origin: magefree/mage

public CityOfShadows(UUID ownerId, CardSetInfo setInfo) {
  super(ownerId,setInfo,new CardType[]{CardType.LAND},"");
  // {T}, Exile a creature you control: Put a storage counter on City of Shadows.
  Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new AddCountersSourceEffect(CounterType.STORAGE.createInstance()), new TapSourceCost());
  ability.addCost(new ExileTargetCost(new TargetControlledCreaturePermanent()));
  this.addAbility(ability);
  // {T}: Add X mana of {C}, where X is the number of storage counters on City of Shadows.
  ability = new DynamicManaAbility(Mana.ColorlessMana(1), new CountersSourceCount(CounterType.STORAGE),
      "Add X mana of {C}, where X is the number of storage counters on {this}");
  this.addAbility(ability);
}
mage.abilities.costs.commonExileTargetCost

Most used methods

  • <init>
  • addTarget
  • getPermanents
  • pay

Popular in Java

  • Finding current android device location
  • runOnUiThread (Activity)
  • putExtra (Intent)
  • scheduleAtFixedRate (Timer)
  • BorderLayout (java.awt)
    A border layout lays out a container, arranging and resizing its components to fit in five regions:
  • MessageFormat (java.text)
    Produces concatenated messages in language-neutral way. New code should probably use java.util.Forma
  • Manifest (java.util.jar)
    The Manifest class is used to obtain attribute information for a JarFile and its entries.
  • JLabel (javax.swing)
  • JList (javax.swing)
  • JOptionPane (javax.swing)
  • CodeWhisperer 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