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

How to use
CounterTargetEffect
in
mage.abilities.effects.common

Best Java code snippets using mage.abilities.effects.common.CounterTargetEffect (Showing top 20 results out of 315)

origin: magefree/mage

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

  @Override
  public boolean apply(Game game, Ability source) {
    Player player = game.getPlayer(game.getControllerId(source.getFirstTarget()));
    if (player == null) {
      return false;
    }
    player.moveCards(player.getLibrary().getTopCards(game, 3), Zone.GRAVEYARD, source, game);
    return new CounterTargetEffect().apply(game, source);
  }
}
origin: magefree/mage

@Override
public boolean apply(Game game, Ability source) {
  boolean countered = false;
  for (UUID targetId : getTargetPointer().getTargets(game, source)) {
    if (game.getStack().counter(targetId, source.getSourceId(), game)) {
      countered = true;
    }
  }
  return countered;
}
origin: magefree/mage

ImprisonTriggeredAbility() {
  super(Zone.BATTLEFIELD, new DoIfCostPaid(new CounterTargetEffect().setText("counter that ability"), new DestroySourceEffect(), new ManaCostsImpl("1")));
}
origin: magefree/mage

@Override
public boolean apply(Game game, Ability source) {
  Spell targetSpell = game.getStack().getSpell(source.getFirstTarget());
  if(targetSpell != null && KickedCondition.instance.apply(game, targetSpell.getSpellAbility())) {
    return super.apply(game, source);
  }
  return false;
}
origin: magefree/mage

public SpellBlast(UUID ownerId, CardSetInfo setInfo) {
  super(ownerId, setInfo, new CardType[]{CardType.INSTANT}, "{X}{U}");
  // Counter target spell with converted mana cost X.
  this.getSpellAbility().addEffect(new CounterTargetEffect().setText("counter target spell with converted mana cost X"));
  this.getSpellAbility().setTargetAdjuster(SpellBlastAdjuster.instance);
}
origin: magefree/mage

  @Override
  public boolean apply(Game game, Ability source) {
    Spell targetSpell = game.getStack().getSpell(getTargetPointer().getFirst(game, source));
    if (targetSpell != null) {
      int spellCMC = targetSpell.getConvertedManaCost();
      super.apply(game, source);
      new AddCountersSourceEffect(CounterType.P1P1.createInstance(spellCMC)).apply(game, source);
      return true;
    }
    return false;
  }
}
origin: magefree/mage

public Douse(UUID ownerId, CardSetInfo setInfo) {
  super(ownerId,setInfo,new CardType[]{CardType.ENCHANTMENT},"{2}{U}");
  
  // {1}{U}: Counter target red spell.
  SimpleActivatedAbility ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new CounterTargetEffect(), new ManaCostsImpl("{1}{U}"));
  ability.addTarget(new TargetSpell(filter));
  this.addAbility(ability);
}
origin: magefree/mage

public SpellBurst(UUID ownerId, CardSetInfo setInfo) {
  super(ownerId, setInfo, new CardType[]{CardType.INSTANT}, "{X}{U}");
  // Buyback {3}
  this.addAbility(new BuybackAbility("{3}"));
  // Counter target spell with converted mana cost X.
  this.getSpellAbility().addEffect(new CounterTargetEffect().setText("counter target spell with converted mana cost X"));
  this.getSpellAbility().setTargetAdjuster(SpellBurstAdjuster.instance);
}
origin: magefree/mage

  @Override
  public boolean apply(Game game, Ability source) {
    StackObject stackObject = game.getStack().getStackObject(source.getFirstTarget());
    if (stackObject == null) {
      return false;
    }
    ObjectColor creatureColors = new ObjectColor();
    for (Permanent creature : game.getBattlefield().getActivePermanents(StaticFilters.FILTER_CONTROLLED_CREATURES, source.getControllerId(), game)) {
      creatureColors = creatureColors.union(creature.getColor(game));
      if (!creatureColors.intersection(stackObject.getColor(game)).isColorless()) {
        return new CounterTargetEffect().apply(game, source);
      }
    }
    return false;
  }
}
origin: magefree/mage

public Deathgrip(UUID ownerId, CardSetInfo setInfo) {
  super(ownerId,setInfo,new CardType[]{CardType.ENCHANTMENT},"{B}{B}");
  // {B}{B}: Counter target green spell.
  Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new CounterTargetEffect(), new ManaCostsImpl("{B}{B}"));
  ability.addTarget(new TargetSpell(filter));
  this.addAbility(ability);
}
origin: magefree/mage

public Mistfolk(UUID ownerId, CardSetInfo setInfo) {
  super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{U}{U}");
  this.subtype.add(SubType.ILLUSION);
  this.power = new MageInt(1);
  this.toughness = new MageInt(2);
  // {U}: Counter target spell that targets Mistfolk.
  Ability ability = new SimpleActivatedAbility(
      new CounterTargetEffect()
          .setText("counter target spell that targets {this}"),
      new ManaCostsImpl("{U}")
  );
  ability.addTarget(new TargetSpell(filter));
  this.addAbility(ability);
}
origin: magefree/mage

public Nix(UUID ownerId, CardSetInfo setInfo) {
  super(ownerId, setInfo, new CardType[]{CardType.INSTANT}, "{U}");
  // Counter target spell if no mana was spent to cast it.
  Effect effect = new ConditionalOneShotEffect(new CounterTargetEffect(), NoManaSpentToCastTargetCondition.instance);
  effect.setText("Counter target spell if no mana was spent to cast it");
  this.getSpellAbility().addEffect(effect);
  this.getSpellAbility().addTarget(new TargetSpell());
}
origin: magefree/mage

ErayosEssenceToken() {
  super("Erayo's Essence", "");
  addSuperType(SuperType.LEGENDARY);
  cardType.add(CardType.ENCHANTMENT);
  color.setBlue(true);
  // Whenever an opponent casts a spell for the first time in a turn, counter that spell.
  Effect effect = new CounterTargetEffect();
  effect.setText("counter that spell");
  this.addAbility(new ErayosEssenceTriggeredAbility(effect));
}
public ErayosEssenceToken(final ErayosEssenceToken token) {
origin: magefree/mage

public PsychicTrance(UUID ownerId, CardSetInfo setInfo) {
  super(ownerId, setInfo, new CardType[]{CardType.INSTANT}, "{2}{U}{U}");
  // Until end of turn, Wizards you control gain "{tap}: Counter target spell."
  Ability abilityToAdd = new SimpleActivatedAbility(Zone.BATTLEFIELD, new CounterTargetEffect(), new TapSourceCost());
  abilityToAdd.addTarget(new TargetSpell());
  Effect effect = new GainAbilityControlledEffect(abilityToAdd, Duration.EndOfTurn, filter);
  effect.setText("until end of turn, Wizards you control gain \"{tap}: Counter target spell\"");
  this.getSpellAbility().addEffect(effect);
}
origin: magefree/mage

public MysticSnake(UUID ownerId, CardSetInfo setInfo) {
  super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{1}{G}{U}{U}");
  this.subtype.add(SubType.SNAKE);
  this.power = new MageInt(2);
  this.toughness = new MageInt(2);
  this.addAbility(FlashAbility.getInstance());
  Ability ability = new EntersBattlefieldTriggeredAbility(new CounterTargetEffect());
  ability.addTarget(new TargetSpell());
  this.addAbility(ability);
}
origin: magefree/mage

public GutturalResponse(UUID ownerId, CardSetInfo setInfo) {
  super(ownerId,setInfo,new CardType[]{CardType.INSTANT},"{R/G}");
  // Counter target blue instant spell.
  this.getSpellAbility().addEffect(new CounterTargetEffect());
  this.getSpellAbility().addTarget(new TargetSpell(filter));
}
origin: magefree/mage

public RemoveSoul(UUID ownerId, CardSetInfo setInfo) {
  super(ownerId, setInfo, new CardType[]{CardType.INSTANT}, "{1}{U}");
  this.getSpellAbility().addTarget(new TargetSpell(StaticFilters.FILTER_SPELL_CREATURE));
  this.getSpellAbility().addEffect(new CounterTargetEffect());
}
origin: magefree/mage

public Envelop(UUID ownerId, CardSetInfo setInfo) {
  super(ownerId,setInfo,new CardType[]{CardType.INSTANT},"{U}");
  // Counter target sorcery spell.
  this.getSpellAbility().addEffect(new CounterTargetEffect());
  this.getSpellAbility().addTarget(new TargetSpell(filter));
}
origin: magefree/mage

public AvoidFate(UUID ownerId, CardSetInfo setInfo) {
  super(ownerId,setInfo,new CardType[]{CardType.INSTANT},"{G}");
  // Counter target instant or Aura spell that targets a permanent you control.
  this.getSpellAbility().addEffect(new CounterTargetEffect());
  this.getSpellAbility().addTarget(new TargetSpell(filter));
}
mage.abilities.effects.commonCounterTargetEffect

Most used methods

  • <init>
  • apply
  • getTargetPointer
  • setText

Popular in Java

  • Creating JSON documents from java classes using gson
  • getExternalFilesDir (Context)
  • compareTo (BigDecimal)
  • orElseThrow (Optional)
    Return the contained value, if present, otherwise throw an exception to be created by the provided s
  • BorderLayout (java.awt)
    A border layout lays out a container, arranging and resizing its components to fit in five regions:
  • BufferedImage (java.awt.image)
    The BufferedImage subclass describes an java.awt.Image with an accessible buffer of image data. All
  • KeyStore (java.security)
    KeyStore is responsible for maintaining cryptographic keys and their owners. The type of the syste
  • ThreadPoolExecutor (java.util.concurrent)
    An ExecutorService that executes each submitted task using one of possibly several pooled threads, n
  • ImageIO (javax.imageio)
  • IOUtils (org.apache.commons.io)
    General IO stream manipulation utilities. This class provides static utility methods for input/outpu
  • 21 Best Atom Packages for 2021
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

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