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

How to use
PermanentsOnTheBattlefieldCondition
in
mage.abilities.condition.common

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

origin: magefree/mage

public ThornwatchScarecrow(UUID ownerId, CardSetInfo setInfo) {
  super(ownerId,setInfo,new CardType[]{CardType.ARTIFACT,CardType.CREATURE},"{6}");
  this.subtype.add(SubType.SCARECROW);
  this.power = new MageInt(4);
  this.toughness = new MageInt(4);
  // Thornwatch Scarecrow has wither as long as you control a green creature.
  ContinuousEffect effect = new GainAbilitySourceEffect(WitherAbility.getInstance(), Duration.WhileOnBattlefield);
  this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new ConditionalContinuousEffect(effect, new PermanentsOnTheBattlefieldCondition(filter), rule)));
  // Thornwatch Scarecrow has vigilance as long as you control a white creature.
  ContinuousEffect effect2 = new GainAbilitySourceEffect(VigilanceAbility.getInstance(), Duration.WhileOnBattlefield);
  this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new ConditionalContinuousEffect(effect2, new PermanentsOnTheBattlefieldCondition(filter2), rule2)));
  
}
origin: magefree/mage

  @Override
  public boolean apply(Game game, Ability source) {
    Player controller = game.getPlayer(source.getControllerId());
    if (controller != null) {
      if (new PermanentsOnTheBattlefieldCondition(filter).apply(game, source)) {
        controller.drawCards(1, game);
      }
      return true;
    }
    return false;
  }
}
origin: magefree/mage

@Override
public boolean applies(UUID sourceId, Ability source, UUID affectedControllerId, Game game) {
  if (sourceId.equals(source.getSourceId()) && gateCondition.apply(game, source))  {
    return true;
  }
  return false;
}
origin: magefree/mage

public WatchwingScarecrow(UUID ownerId, CardSetInfo setInfo) {
  super(ownerId,setInfo,new CardType[]{CardType.ARTIFACT,CardType.CREATURE},"{4}");
  this.subtype.add(SubType.SCARECROW);
  this.power = new MageInt(2);
  this.toughness = new MageInt(4);
  // Watchwing Scarecrow has vigilance as long as you control a white creature.
  ContinuousEffect effect = new GainAbilitySourceEffect(VigilanceAbility.getInstance(), Duration.WhileOnBattlefield);
  this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new ConditionalContinuousEffect(effect, new PermanentsOnTheBattlefieldCondition(filter), rule)));
  // Watchwing Scarecrow has flying as long as you control a blue creature.
  ContinuousEffect effect2 = new GainAbilitySourceEffect(FlyingAbility.getInstance(), Duration.WhileOnBattlefield);
  this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new ConditionalContinuousEffect(effect2, new PermanentsOnTheBattlefieldCondition(filter2), rule2)));
}
origin: magefree/mage

public WingrattleScarecrow(UUID ownerId, CardSetInfo setInfo) {
  super(ownerId,setInfo,new CardType[]{CardType.ARTIFACT,CardType.CREATURE},"{3}");
  this.subtype.add(SubType.SCARECROW);
  this.power = new MageInt(2);
  this.toughness = new MageInt(2);
  // Wingrattle Scarecrow has flying as long as you control a blue creature.
  ContinuousEffect effect = new GainAbilitySourceEffect(FlyingAbility.getInstance(), Duration.WhileOnBattlefield);
  this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new ConditionalContinuousEffect(effect, new PermanentsOnTheBattlefieldCondition(filter), rule)));
  
  // Wingrattle Scarecrow has persist as long as you control a black creature.
  ContinuousEffect effect2 = new GainAbilitySourceEffect(new PersistAbility(), Duration.WhileOnBattlefield);
  this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new ConditionalContinuousEffect(effect2, new PermanentsOnTheBattlefieldCondition(filter2), rule2)));
  
}
origin: magefree/mage

public RattleblazeScarecrow(UUID ownerId, CardSetInfo setInfo) {
  super(ownerId,setInfo,new CardType[]{CardType.ARTIFACT,CardType.CREATURE},"{6}");
  this.subtype.add(SubType.SCARECROW);
  this.power = new MageInt(5);
  this.toughness = new MageInt(3);
  // Rattleblaze Scarecrow has persist as long as you control a black creature.
  ContinuousEffect effect = new GainAbilitySourceEffect(new PersistAbility(), Duration.WhileOnBattlefield);
  this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new ConditionalContinuousEffect(effect, new PermanentsOnTheBattlefieldCondition(filter), rule)));
  // Rattleblaze Scarecrow has haste as long as you control a red creature.
  ContinuousEffect effect2 = new GainAbilitySourceEffect(HasteAbility.getInstance(), Duration.WhileOnBattlefield);
  this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new ConditionalContinuousEffect(effect2, new PermanentsOnTheBattlefieldCondition(filter2), rule2)));
}
origin: magefree/mage

public WellOfLife(UUID ownerId, CardSetInfo setInfo) {
  super(ownerId,setInfo,new CardType[]{CardType.ARTIFACT},"{4}");
  // At the beginning of your end step, if you control no untapped lands, you gain 2 life.
  this.addAbility(new ConditionalInterveningIfTriggeredAbility(new BeginningOfEndStepTriggeredAbility(
    new GainLifeEffect(2), TargetController.YOU, false), new InvertCondition(new PermanentsOnTheBattlefieldCondition(filter)),
    "At the beginning of your end step, if you control no untapped lands, you gain 2 life."));
}
origin: magefree/mage

public WellOfDiscovery(UUID ownerId, CardSetInfo setInfo) {
  super(ownerId,setInfo,new CardType[]{CardType.ARTIFACT},"{6}");
  // At the beginning of your end step, if you control no untapped lands, draw a card.
  this.addAbility(new ConditionalInterveningIfTriggeredAbility(new BeginningOfEndStepTriggeredAbility(
    new DrawCardSourceControllerEffect(1), TargetController.YOU, false),
    new InvertCondition(new PermanentsOnTheBattlefieldCondition(filter)),
    "At the beginning of your end step, if you control no untapped lands, draw a card."));
}
origin: magefree/mage

public HungeringYeti(UUID ownerId, CardSetInfo setInfo) {
  super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{4}{R}");
  this.subtype.add(SubType.YETI);
  this.power = new MageInt(4);
  this.toughness = new MageInt(4);
  // As long as you control a green or blue permanent, you may cast Hungering Yeti as though it had flash.
  AsThoughEffect effect = new CastAsThoughItHadFlashSourceEffect(Duration.EndOfGame);
  effect.setText("As long as you control a green or blue permanent, you may cast {this} as though it had flash");
  this.addAbility(new SimpleStaticAbility(Zone.ALL, new ConditionalAsThoughEffect(effect,
          new PermanentsOnTheBattlefieldCondition(filter))));
}
origin: magefree/mage

public SkittishKavu(UUID ownerId, CardSetInfo setInfo) {
  super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{1}{R}");
  this.subtype.add(SubType.KAVU);
  this.power = new MageInt(1);
  this.toughness = new MageInt(1);
  // Skittish Kavu gets +1/+1 as long as no opponent controls a white or blue creature.
  this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD,
    new ConditionalContinuousEffect(new BoostSourceEffect(1, 1, Duration.WhileOnBattlefield),
    new InvertCondition(new PermanentsOnTheBattlefieldCondition(filter, ComparisonType.MORE_THAN, 0, false)),
    "{this} gets +1/+1 as long as no opponent controls a white or blue creature")));
}
origin: magefree/mage

public SpurGrappler(UUID ownerId, CardSetInfo setInfo) {
  super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{2}{R}");
  this.subtype.add(SubType.BEAST);
  this.power = new MageInt(2);
  this.toughness = new MageInt(1);
  // Spur Grappler gets +2/+1 as long as you control no untapped lands.
  this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD,
    new ConditionalContinuousEffect(new BoostSourceEffect(2, 1, Duration.WhileOnBattlefield),
    new InvertCondition(new PermanentsOnTheBattlefieldCondition(filter)),
    "{this} gets +2/+1 as long as you control no untapped lands")));
}
origin: magefree/mage

public ScoriaCat(UUID ownerId, CardSetInfo setInfo) {
  super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{3}{R}{R}");
  this.subtype.add(SubType.CAT);
  this.power = new MageInt(3);
  this.toughness = new MageInt(3);
  // Scoria Cat gets +3/+3 as long as you control no untapped lands.
  this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD,
    new ConditionalContinuousEffect(new BoostSourceEffect(3, 3, Duration.WhileOnBattlefield),
    new InvertCondition(new PermanentsOnTheBattlefieldCondition(filter)),
    "{this} gets +3/+3 as long as you control no untapped lands")));
}
origin: magefree/mage

private static Condition makeAndCondition(ObjectColor color1, ObjectColor color2) {
  FilterPermanent filter1 = new FilterPermanent();
  filter1.add(new ColorPredicate(color1));
  Condition condition1 = new PermanentsOnTheBattlefieldCondition(filter1);
  FilterPermanent filter2 = new FilterPermanent();
  filter2.add(new ColorPredicate(color2));
  Condition condition2 = new PermanentsOnTheBattlefieldCondition(filter2);
  return new CompoundCondition(condition1, condition2);
}
origin: magefree/mage

public TempleOfTheFalseGod(UUID ownerId, CardSetInfo setInfo) {
  super(ownerId,setInfo,new CardType[]{CardType.LAND},"");
  // {tap}: Add {C}{C}. Activate this ability only if you control five or more lands.
  this.addAbility(new ActivateIfConditionManaAbility(
      Zone.BATTLEFIELD,
      new BasicManaEffect(Mana.ColorlessMana(2)),
      new TapSourceCost(),
      new PermanentsOnTheBattlefieldCondition(filter, ComparisonType.MORE_THAN, 4)));
}
origin: magefree/mage

public EpicStruggle(UUID ownerId, CardSetInfo setInfo) {
  super(ownerId,setInfo,new CardType[]{CardType.ENCHANTMENT},"{2}{G}{G}");
  // At the beginning of your upkeep, if you control twenty or more creatures, you win the game.
  this.addAbility(new ConditionalInterveningIfTriggeredAbility(
      new BeginningOfUpkeepTriggeredAbility(new WinGameSourceControllerEffect(), TargetController.YOU, false),
      new PermanentsOnTheBattlefieldCondition(filter, ComparisonType.MORE_THAN, 19),
      "At the beginning of your upkeep, if you control twenty or more creatures, you win the game."));
}
origin: magefree/mage

public Lifeline(UUID ownerId, CardSetInfo setInfo) {
  super(ownerId, setInfo, new CardType[]{CardType.ARTIFACT}, "{5}");
      
  // Whenever a creature dies, if another creature is on the battlefield, return the first card to the battlefield under its owner's control at the beginning of the next end step.
  Ability ability = new ConditionalInterveningIfTriggeredAbility(
            new DiesCreatureTriggeredAbility( Zone.BATTLEFIELD, new LifelineEffect(), false, StaticFilters.FILTER_PERMANENT_CREATURE, true),
            new PermanentsOnTheBattlefieldCondition(StaticFilters.FILTER_PERMANENT_CREATURE, ComparisonType.MORE_THAN, 0, false),
            "Whenever a creature dies, if another creature is on the battlefield, return the first card to the battlefield under its owner's control at the beginning of the next end step.");
  this.addAbility(ability);
}
origin: magefree/mage

public FenStalker(UUID ownerId, CardSetInfo setInfo) {
  super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{3}{B}");
  this.subtype.add(SubType.NIGHTSTALKER);
  this.power = new MageInt(3);
  this.toughness = new MageInt(2);
  // Fen Stalker has fear as long as you control no untapped lands.
  this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD,
    new ConditionalContinuousEffect(new GainAbilitySourceEffect(FearAbility.getInstance(),
    Duration.WhileOnBattlefield), new InvertCondition(new PermanentsOnTheBattlefieldCondition(filter)),
    "{this} has fear as long as you control no untapped lands")));
}
origin: magefree/mage

public VintaraSnapper(UUID ownerId, CardSetInfo setInfo) {
  super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{G}{G}");
  this.subtype.add(SubType.TURTLE);
  this.power = new MageInt(2);
  this.toughness = new MageInt(2);
  // Vintara Snapper has shroud as long as you control no untapped lands.
  this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD,
    new ConditionalContinuousEffect(new GainAbilitySourceEffect(ShroudAbility.getInstance(),
    Duration.WhileOnBattlefield), new InvertCondition(new PermanentsOnTheBattlefieldCondition(filter)),
    "{this} has shroud as long as you control no untapped lands")));
}
origin: magefree/mage

public Biovisionary(UUID ownerId, CardSetInfo setInfo) {
  super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{1}{G}{U}");
  this.subtype.add(SubType.HUMAN, SubType.WIZARD);
  this.power = new MageInt(2);
  this.toughness = new MageInt(3);
  //At the beginning of the end step, if you control four or more creatures named Biovisionary, you win the game.
  this.addAbility(new BeginningOfEndStepTriggeredAbility(
      Zone.BATTLEFIELD, new WinGameSourceControllerEffect(), 
      TargetController.ANY, 
      new PermanentsOnTheBattlefieldCondition(filter, ComparisonType.MORE_THAN, 3),
      false));
}
origin: magefree/mage

public WizardsLightning(UUID ownerId, CardSetInfo setInfo) {
  super(ownerId, setInfo, new CardType[]{CardType.INSTANT}, "{2}{R}");
  // Wizard's Lightning costs {2} less to cast if you control a Wizard.
  Ability ability = new SimpleStaticAbility(Zone.STACK, new SpellCostReductionSourceEffect(2, new PermanentsOnTheBattlefieldCondition(filter)));
  ability.setRuleAtTheTop(true);
  this.addAbility(ability);
  // Wizard's Lightning deals 3 damage to any target.
  this.getSpellAbility().addTarget(new TargetAnyTarget());
  this.getSpellAbility().addEffect(new DamageTargetEffect(3));
}
mage.abilities.condition.commonPermanentsOnTheBattlefieldCondition

Javadoc

Battlefield checking condition. This condition can decorate other conditions as well as be used standalone.

Most used methods

  • <init>
  • apply

Popular in Java

  • Start an intent from android
  • scheduleAtFixedRate (Timer)
  • orElseThrow (Optional)
    Return the contained value, if present, otherwise throw an exception to be created by the provided s
  • startActivity (Activity)
  • OutputStream (java.io)
    A writable sink for bytes.Most clients will use output streams that write data to the file system (
  • MalformedURLException (java.net)
    This exception is thrown when a program attempts to create an URL from an incorrect specification.
  • Charset (java.nio.charset)
    A charset is a named mapping between Unicode characters and byte sequences. Every Charset can decode
  • MessageDigest (java.security)
    Uses a one-way hash function to turn an arbitrary number of bytes into a fixed-length byte sequence.
  • Properties (java.util)
    A Properties object is a Hashtable where the keys and values must be Strings. Each property can have
  • Get (org.apache.hadoop.hbase.client)
    Used to perform Get operations on a single row. To get everything for a row, instantiate a Get objec
  • 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