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

How to use
CompoundCondition
in
mage.abilities.condition

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

origin: magefree/mage

public Reset(UUID ownerId, CardSetInfo setInfo) {
  super(ownerId, setInfo, new CardType[]{CardType.INSTANT}, "{U}{U}");
  // Cast Reset only during an opponent's turn after their upkeep step.
  this.addAbility(new CastOnlyDuringPhaseStepSourceAbility(null, null,
      new CompoundCondition(OnOpponentsTurnCondition.instance, AfterUpkeepStepCondtion.instance),
      "Cast this spell only during an opponent's turn after their upkeep step"));
  // Untap all lands you control.
  this.getSpellAbility().addEffect(new UntapAllLandsControllerEffect());
}
origin: magefree/mage

@Override
public boolean apply(Layer layer, SubLayer sublayer, Ability source, Game game) {
  Player controller = game.getPlayer(source.getControllerId());
  if (controller != null) {
    controller.getAlternativeSourceCosts().add(new AlternativeCostSourceAbility(
        null, new CompoundCondition(SourceIsSpellCondition.instance, new IsBeingCastFromHandCondition()), null, new FilterNonlandCard(), true));
    return true;
  }
  return false;
}
origin: magefree/mage

  @Override
  public boolean apply(Game game, Ability source) {

    Permanent sourcePermanent = game.getPermanent(source.getSourceId());
    Player controller = game.getPlayer(source.getControllerId());

    
    if (controller != null && sourcePermanent != null 
        && controller.getId().equals(sourcePermanent.getControllerId())) {
      UUID target = source.getFirstTarget();
      if (target != null && game.getPermanent(target) != null) {
        Permanent targetPermanent = game.getPermanent(target);
        
        SourceHasRemainedInSameZoneCondition condition = new SourceHasRemainedInSameZoneCondition(sourcePermanent.getId());
        SourceHasRemainedInSameZoneCondition conditionTarget = new SourceHasRemainedInSameZoneCondition(target);
        
        ConditionalContinuousEffect effect = new ConditionalContinuousEffect(
            new GainControlTargetEffect(Duration.Custom),
            new CompoundCondition(SourceTappedCondition.instance, new CompoundCondition (condition, conditionTarget)),
            "Gain control of target creature of an opponent's choice that he or she controls for as long as {this} remains tapped");
        game.addEffect(effect, source);
      }
    }
    return false;
  }
}
origin: magefree/mage

public SwordOfTheParuns(UUID ownerId, CardSetInfo setInfo) {
  super(ownerId,setInfo,new CardType[]{CardType.ARTIFACT},"{4}");
  this.subtype.add(SubType.EQUIPMENT);
  // As long as equipped creature is tapped, tapped creatures you control get +2/+0.
  this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new ConditionalContinuousEffect(
      new BoostControlledEffect(2,0, Duration.WhileOnBattlefield, filterTapped),
      new CompoundCondition(EquipmentAttachedCondition.instance, AttachedToTappedCondition.instance),
      "As long as equipped creature is tapped, tapped creatures you control get +2/+0"
  )));
  // As long as equipped creature is untapped, untapped creatures you control get +0/+2.
  this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new ConditionalContinuousEffect(
      new BoostControlledEffect(0,2, Duration.WhileOnBattlefield, filterUntapped),
      new CompoundCondition(EquipmentAttachedCondition.instance, new InvertCondition(AttachedToTappedCondition.instance)),
      "As long as equipped creature is untapped, untapped creatures you control get +0/+2"
  )));
  // {3}: You may tap or untap equipped creature.
  this.addAbility(new SimpleActivatedAbility(Zone.BATTLEFIELD, new MayTapOrUntapAttachedEffect(), new GenericManaCost(3)));
  // Equip {3}
  this.addAbility(new EquipAbility(Outcome.BoostCreature, new GenericManaCost(3)));
}
origin: magefree/mage

public BarrenGlory(UUID ownerId, CardSetInfo setInfo) {
  super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{4}{W}{W}");
  // At the beginning of your upkeep, if you control no permanents other than Barren Glory and have no cards in hand, you win the game.
  this.addAbility(new ConditionalInterveningIfTriggeredAbility(
      new BeginningOfUpkeepTriggeredAbility(new WinGameSourceControllerEffect(), TargetController.YOU, false),
      new CompoundCondition(
          new CardsInHandCondition(ComparisonType.EQUAL_TO, 0),
          new PermanentsOnTheBattlefieldCondition(filter, ComparisonType.EQUAL_TO, 0)
      ),
      "At the beginning of your upkeep, if you control no permanents other than {this} and have no cards in hand, you win the game"));
}
origin: magefree/mage

public TrapRunner(UUID ownerId, CardSetInfo setInfo) {
  super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{2}{W}{W}");
  this.subtype.add(SubType.HUMAN);
  this.subtype.add(SubType.SOLDIER);
  this.power = new MageInt(2);
  this.toughness = new MageInt(3);
  // {T}: Target unblocked attacking creature becomes blocked. Activate this ability only during combat after blockers are declared.
  Ability ability = new ConditionalActivatedAbility(Zone.BATTLEFIELD, new TrapRunnerEffect(), new TapSourceCost(), 
    new CompoundCondition("during combat after blockers are declared", new IsPhaseCondition(TurnPhase.COMBAT), AfterBlockersAreDeclaredCondition.instance));
  ability.addTarget(new TargetCreaturePermanent(filter));
  this.addAbility(ability);
}
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 SirensCall(UUID ownerId, CardSetInfo setInfo) {
  super(ownerId, setInfo, new CardType[]{CardType.INSTANT}, "{U}");
  // Cast Siren's Call only during an opponent's turn, before attackers are declared.
  this.addAbility(new CastOnlyDuringPhaseStepSourceAbility(null, null,
      new CompoundCondition(OnOpponentsTurnCondition.instance, BeforeAttackersAreDeclaredCondition.instance),
      "Cast this spell only during an opponent's turn, before attackers are declared"));
  // Creatures the active player controls attack this turn if able.
  this.getSpellAbility().addEffect(new SirensCallMustAttackEffect());
  // At the beginning of the next end step, destroy all non-Wall creatures that player controls that didn't attack this turn. Ignore this effect for each creature the player didn't control continuously since the beginning of the turn.
  this.getSpellAbility().addEffect(new CreateDelayedTriggeredAbilityEffect(new AtTheBeginOfNextEndStepDelayedTriggeredAbility(new SirensCallDestroyEffect())));
  this.getSpellAbility().addWatcher(new AttackedThisTurnWatcher());
}
origin: magefree/mage

public RushwoodLegate(UUID ownerId, CardSetInfo setInfo) {
  super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{2}{G}");
  this.subtype.add(SubType.DRYAD);
  this.power = new MageInt(2);
  this.toughness = new MageInt(1);
  // If an opponent controls an Island and you control a Forest, you may cast this spell without paying its mana cost.
  Condition condition = new CompoundCondition("If an opponent controls an Island and you control a Forest",
      new OpponentControlsPermanentCondition(filterIsland),
      new PermanentsOnTheBattlefieldCondition(filterForest));
  this.addAbility(new AlternativeCostSourceAbility(null, condition));
}
origin: magefree/mage

public Massacre(UUID ownerId, CardSetInfo setInfo) {
  super(ownerId,setInfo,new CardType[]{CardType.SORCERY},"{2}{B}{B}");
  // If an opponent controls a Plains and you control a Swamp, you may cast this spell without paying its mana cost.
  Condition condition = new CompoundCondition("If an opponent controls a Plains and you control a Swamp", 
      new OpponentControlsPermanentCondition(filterPlains),
      new PermanentsOnTheBattlefieldCondition(filterSwamp));
  this.addAbility(new AlternativeCostSourceAbility(null, condition));
  // All creatures get -2/-2 until end of turn.
  this.getSpellAbility().addEffect(new BoostAllEffect(-2, -2, Duration.EndOfTurn));
}
origin: magefree/mage

public WillowSatyr(UUID ownerId, CardSetInfo setInfo) {
  super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{2}{G}{G}");
  this.subtype.add(SubType.SATYR);
  this.power = new MageInt(1);
  this.toughness = new MageInt(1);
  // You may choose not to untap Willow Satyr during your untap step.
  this.addAbility(new SkipUntapOptionalAbility());
  // {tap}: Gain control of target legendary creature for as long as you control Willow Satyr and Willow Satyr remains tapped.
  ConditionalContinuousEffect effect = new ConditionalContinuousEffect(
    new GainControlTargetEffect(Duration.Custom), new CompoundCondition(SourceTappedCondition.instance, new SourceOnBattlefieldControlUnchangedCondition()),
    "Gain control of target legendary creature for as long as you control {this} and {this} remains tapped");
  Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, effect, new TapSourceCost());
  ability.addTarget(new TargetCreaturePermanent(filter));
  this.addAbility(ability);
}
origin: magefree/mage

public KongmingsContraptions(UUID ownerId, CardSetInfo setInfo) {
  super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{3}{W}");
  this.subtype.add(SubType.HUMAN);
  this.subtype.add(SubType.SOLDIER);
  this.power = new MageInt(2);
  this.toughness = new MageInt(4);
  // {T}: Kongming's Contraptions deals 2 damage to target attacking creature. Activate this ability only during the declare attackers step and only if you've been attacked this step.
  Ability ability = new ConditionalActivatedAbility(Zone.BATTLEFIELD, new DamageTargetEffect(2), new TapSourceCost(), 
      new CompoundCondition("during the declare attackers step and only if you've been attacked this step", 
      new IsStepCondition(PhaseStep.DECLARE_ATTACKERS, false), AttackedThisStepCondition.instance)
  );
  ability.addTarget(new TargetPermanent(new FilterAttackingCreature()));
  this.addAbility(ability, new PlayerAttackedStepWatcher());
}
origin: magefree/mage

public KuldothaPhoenix(UUID ownerId, CardSetInfo setInfo) {
  super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{2}{R}{R}{R}");
  this.subtype.add(SubType.PHOENIX);
  this.power = new MageInt(4);
  this.toughness = new MageInt(4);
  // Flying, haste        
  this.addAbility(FlyingAbility.getInstance());
  this.addAbility(HasteAbility.getInstance());
  
  // <i>Metalcraft</i> &mdash; {4}: Return Kuldotha Phoenix from your graveyard to the battlefield.
  // Activate this ability only during your upkeep and only if you control three or more artifacts.        
  Ability ability = new ConditionalActivatedAbility(Zone.GRAVEYARD, 
      new ReturnSourceFromGraveyardToBattlefieldEffect(), 
      new ManaCostsImpl("{4}"), 
      new CompoundCondition("during your upkeep and only if you control three or more artifacts",
          new IsStepCondition(PhaseStep.UPKEEP), MetalcraftCondition.instance)
  );
  ability.setAbilityWord(AbilityWord.METALCRAFT);
  this.addAbility(ability);
}
origin: magefree/mage

public SivvisRuse(UUID ownerId, CardSetInfo setInfo) {
  super(ownerId,setInfo,new CardType[]{CardType.INSTANT},"{2}{W}{W}");
  // If an opponent controls a Mountain and you control a Plains, you may cast this spell without paying its mana cost.
  Condition condition = new CompoundCondition("If an opponent controls a Mountain and you control a Plains",
      new OpponentControlsPermanentCondition(filterMountain),
      new PermanentsOnTheBattlefieldCondition(filterPlains));
  this.addAbility(new AlternativeCostSourceAbility(null, condition));
  
  // Prevent all damage that would be dealt this turn to creatures you control.
  this.getSpellAbility().addEffect(new PreventAllDamageToAllEffect(Duration.EndOfTurn, new FilterControlledCreatureInPlay()));
}
origin: magefree/mage

public TradeCaravan(UUID ownerId, CardSetInfo setInfo) {
  super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{W}");
  this.subtype.add(SubType.HUMAN);
  this.subtype.add(SubType.NOMAD);
  this.power = new MageInt(1);
  this.toughness = new MageInt(1);
  // At the beginning of your upkeep, put a currency counter on Trade Caravan.
  this.addAbility(new BeginningOfUpkeepTriggeredAbility(new AddCountersSourceEffect(CounterType.CURRENCY.createInstance()), TargetController.YOU, false));
  // Remove two currency counters from Trade Caravan: Untap target basic land. Activate this ability only during an opponent's upkeep.
  Ability ability = new ConditionalActivatedAbility(Zone.BATTLEFIELD, new UntapTargetEffect(), new RemoveCountersSourceCost(CounterType.CURRENCY.createInstance(2)), 
      new CompoundCondition(OnOpponentsTurnCondition.instance, new IsStepCondition(PhaseStep.UPKEEP, false)), 
      "Remove two currency counters from {this}: Untap target basic land. Activate this ability only during an opponent's upkeep.");
  ability.addTarget(new TargetPermanent(filter));
  this.addAbility(ability);
}
origin: magefree/mage

public SaprazzanLegate(UUID ownerId, CardSetInfo setInfo) {
  super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{3}{U}");
  this.subtype.add(SubType.MERFOLK, SubType.SOLDIER);
  this.power = new MageInt(1);
  this.toughness = new MageInt(3);
  // Flying
  this.addAbility(FlyingAbility.getInstance());
  // If an opponent controls a Mountain and you control an Island, you may cast this spell without paying its mana cost.
  Condition condition = new CompoundCondition("If an opponent controls a Mountain and you control an Island",
      new OpponentControlsPermanentCondition(filterMountain),
      new PermanentsOnTheBattlefieldCondition(filterIsland));
  this.addAbility(new AlternativeCostSourceAbility(null, condition));
}
origin: magefree/mage

public KyrenLegate(UUID ownerId, CardSetInfo setInfo) {
  super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{1}{R}");
  this.subtype.add(SubType.GOBLIN);
  this.power = new MageInt(1);
  this.toughness = new MageInt(1);
  // Haste
  this.addAbility(HasteAbility.getInstance());
  // If an opponent controls a Plains and you control a Mountain, you may cast this spell without paying its mana cost.
  Condition condition = new CompoundCondition("If an opponent controls a Plains and you control a Mountain",
      new OpponentControlsPermanentCondition(filterPlains),
      new PermanentsOnTheBattlefieldCondition(filterMountain));
  this.addAbility(new AlternativeCostSourceAbility(null, condition));
}
origin: magefree/mage

public Submerge(UUID ownerId, CardSetInfo setInfo) {
  super(ownerId,setInfo,new CardType[]{CardType.INSTANT},"{4}{U}");
  // If an opponent controls a Forest and you control an Island, you may cast this spell without paying its mana cost.
  Condition condition = new CompoundCondition("If an opponent controls a Forest and you control an Island", 
      new OpponentControlsPermanentCondition(filterForest),
      new PermanentsOnTheBattlefieldCondition(filterIsland));
  this.addAbility(new AlternativeCostSourceAbility(null, condition));        
  // Put target creature on top of its owner's library.
  this.getSpellAbility().addEffect(new PutOnLibraryTargetEffect(true));
  this.getSpellAbility().addTarget(new TargetCreaturePermanent());
      
}
origin: magefree/mage

public MoggSalvage(UUID ownerId, CardSetInfo setInfo) {
  super(ownerId,setInfo,new CardType[]{CardType.INSTANT},"{2}{R}");
  // If an opponent controls an Island and you control a Mountain, you may cast this spell without paying its mana cost.
  Condition condition = new CompoundCondition("If an opponent controls an Island and you control a Mountain",
      new OpponentControlsPermanentCondition(filterIsland),
      new PermanentsOnTheBattlefieldCondition(filterMountain));
  this.addAbility(new AlternativeCostSourceAbility(null, condition));
  // Destroy target artifact.
  this.getSpellAbility().addEffect(new DestroyTargetEffect());
  this.getSpellAbility().addTarget(new TargetArtifactPermanent());
}
origin: magefree/mage

public RefreshingRain(UUID ownerId, CardSetInfo setInfo) {
  super(ownerId,setInfo,new CardType[]{CardType.INSTANT},"{3}{G}");
  // If an opponent controls a Swamp and you control a Forest, you may cast this spell without paying its mana cost.
  Condition condition = new CompoundCondition("If an opponent controls a Swamp and you control a Forest",
      new OpponentControlsPermanentCondition(filterSwamp),
      new PermanentsOnTheBattlefieldCondition(filterForest));
  this.addAbility(new AlternativeCostSourceAbility(null, condition));
  // Target player gains 6 life.
  this.getSpellAbility().addEffect(new GainLifeTargetEffect(6));
  this.getSpellAbility().addTarget(new TargetPlayer());
}
mage.abilities.conditionCompoundCondition

Javadoc

Combines conditions to one compound conditon, all single conditons must be true to return true for the compound condtion.

Most used methods

  • <init>

Popular in Java

  • Parsing JSON documents to java classes using gson
  • notifyDataSetChanged (ArrayAdapter)
  • setContentView (Activity)
  • getSharedPreferences (Context)
  • Component (java.awt)
    A component is an object having a graphical representation that can be displayed on the screen and t
  • DecimalFormat (java.text)
    A concrete subclass of NumberFormat that formats decimal numbers. It has a variety of features desig
  • Dictionary (java.util)
    Note: Do not use this class since it is obsolete. Please use the Map interface for new implementatio
  • Filter (javax.servlet)
    A filter is an object that performs filtering tasks on either the request to a resource (a servlet o
  • JCheckBox (javax.swing)
  • JFrame (javax.swing)
  • Best IntelliJ plugins
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