diff --git a/Mage.Sets/src/mage/cards/a/AetherstormRoc.java b/Mage.Sets/src/mage/cards/a/AetherstormRoc.java
index aff1bf10b0..a476bfef1a 100644
--- a/Mage.Sets/src/mage/cards/a/AetherstormRoc.java
+++ b/Mage.Sets/src/mage/cards/a/AetherstormRoc.java
@@ -4,7 +4,7 @@ package mage.cards.a;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.AttacksTriggeredAbility;
-import mage.abilities.common.EntersBattlefieldControlledTriggeredAbility;
+import mage.abilities.common.EntersBattlefieldThisOrAnotherTriggeredAbility;
import mage.abilities.costs.common.PayEnergyCost;
import mage.abilities.effects.common.DoIfCostPaid;
import mage.abilities.effects.common.TapTargetEffect;
@@ -16,11 +16,11 @@ import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.SubType;
import mage.counters.CounterType;
+import mage.filter.FilterPermanent;
+import mage.filter.StaticFilters;
import mage.filter.common.FilterCreaturePermanent;
-import mage.filter.predicate.permanent.ControllerIdPredicate;
-import mage.game.Game;
-import mage.target.common.TargetCreaturePermanent;
-import mage.target.targetadjustment.TargetAdjuster;
+import mage.filter.predicate.permanent.DefendingPlayerControlsPredicate;
+import mage.target.TargetPermanent;
import java.util.UUID;
@@ -29,6 +29,13 @@ import java.util.UUID;
*/
public final class AetherstormRoc extends CardImpl {
+ private static final FilterPermanent filter
+ = new FilterCreaturePermanent("creature defending player controls");
+
+ static {
+ filter.add(DefendingPlayerControlsPredicate.instance);
+ }
+
public AetherstormRoc(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{2}{W}{W}");
this.subtype.add(SubType.BIRD);
@@ -37,21 +44,24 @@ public final class AetherstormRoc extends CardImpl {
// Flying
this.addAbility(FlyingAbility.getInstance());
+
// Whenever Aetherstorm Roc or another creature enters the battlefield under your control, you get {E}.
- this.addAbility(new EntersBattlefieldControlledTriggeredAbility(new GetEnergyCountersControllerEffect(1), new FilterCreaturePermanent("{this} or another creature")));
+ this.addAbility(new EntersBattlefieldThisOrAnotherTriggeredAbility(
+ new GetEnergyCountersControllerEffect(1),
+ StaticFilters.FILTER_PERMANENT_CREATURE, false, true
+ ));
// Whenever Aetherstorm Roc attacks, you may pay {E}{E}. If you do, put a +1/+1 counter on it and tap up to one target creature defending player controls.
- DoIfCostPaid doIfCostPaidEffect = new DoIfCostPaid(new AddCountersSourceEffect(CounterType.P1P1.createInstance()), new PayEnergyCost(2));
- doIfCostPaidEffect.addEffect(new TapTargetEffect());
- Ability ability = new AttacksTriggeredAbility(doIfCostPaidEffect, false,
- "Whenever {this} attacks you may pay {E}{E}. If you do, put a +1/+1 counter on it and tap up to one target creature defending player controls.");
- ability.addTarget(new TargetCreaturePermanent(0, 1, new FilterCreaturePermanent("creature defending player controls"), false));
- ability.setTargetAdjuster(AetherstormRocAdjuster.instance);
+ Ability ability = new AttacksTriggeredAbility(new DoIfCostPaid(
+ new AddCountersSourceEffect(CounterType.P1P1.createInstance())
+ .setText("put a +1/+1 counter on it"),
+ new PayEnergyCost(2)
+ ).addEffect(new TapTargetEffect().concatBy("and")), false);
+ ability.addTarget(new TargetPermanent(0, 1, filter, false));
this.addAbility(ability);
-
}
- public AetherstormRoc(final AetherstormRoc card) {
+ private AetherstormRoc(final AetherstormRoc card) {
super(card);
}
@@ -61,17 +71,3 @@ public final class AetherstormRoc extends CardImpl {
return new AetherstormRoc(this);
}
}
-
-enum AetherstormRocAdjuster implements TargetAdjuster {
- instance;
-
- @Override
- public void adjustTargets(Ability ability, Game game) {
- ability.getTargets().clear();
- FilterCreaturePermanent filter = new FilterCreaturePermanent("creature defending player controls");
- UUID defenderId = game.getCombat().getDefenderId(ability.getSourceId());
- filter.add(new ControllerIdPredicate(defenderId));
- TargetCreaturePermanent target = new TargetCreaturePermanent(0, 1, filter, false);
- ability.addTarget(target);
- }
-}
\ No newline at end of file
diff --git a/Mage.Sets/src/mage/cards/a/AmbuscadeShaman.java b/Mage.Sets/src/mage/cards/a/AmbuscadeShaman.java
index 2c8e04683a..65390caee2 100644
--- a/Mage.Sets/src/mage/cards/a/AmbuscadeShaman.java
+++ b/Mage.Sets/src/mage/cards/a/AmbuscadeShaman.java
@@ -1,25 +1,20 @@
-
package mage.cards.a;
-import java.util.UUID;
import mage.MageInt;
-import mage.abilities.TriggeredAbilityImpl;
-import mage.abilities.effects.Effect;
+import mage.abilities.common.EntersBattlefieldThisOrAnotherTriggeredAbility;
import mage.abilities.effects.common.continuous.BoostTargetEffect;
import mage.abilities.keyword.DashAbility;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.Duration;
+import mage.constants.SetTargetPointer;
import mage.constants.SubType;
-import mage.constants.Zone;
-import mage.game.Game;
-import mage.game.events.GameEvent;
-import mage.game.permanent.Permanent;
-import mage.target.targetpointer.FixedTarget;
+import mage.filter.StaticFilters;
+
+import java.util.UUID;
/**
- *
* @author LevelX2
*/
public final class AmbuscadeShaman extends CardImpl {
@@ -32,16 +27,18 @@ public final class AmbuscadeShaman extends CardImpl {
this.toughness = new MageInt(2);
// Whenever Ambuscade Shaman or another creature enters the battlefield under your control, that creature gets +2/+2 until end of turn.
- Effect effect = new BoostTargetEffect(2, 2, Duration.EndOfTurn);
- effect.setText("that creature gets +2/+2 until end of turn");
- this.addAbility(new AmbuscadeShamanTriggeredAbility(effect));
+ this.addAbility(new EntersBattlefieldThisOrAnotherTriggeredAbility(
+ new BoostTargetEffect(2, 2, Duration.EndOfTurn)
+ .setText("that creature gets +2/+2 until end of turn"),
+ StaticFilters.FILTER_PERMANENT_CREATURE, false,
+ SetTargetPointer.PERMANENT, true
+ ));
// Dash {3}{B} (You may cast this spell for its dash cost. If you do, it gains haste, and it's returned from the battlefield to its owner's hand at the beginning of the next end step.));
this.addAbility(new DashAbility(this, "{3}{B}"));
-
}
- public AmbuscadeShaman(final AmbuscadeShaman card) {
+ private AmbuscadeShaman(final AmbuscadeShaman card) {
super(card);
}
@@ -50,41 +47,3 @@ public final class AmbuscadeShaman extends CardImpl {
return new AmbuscadeShaman(this);
}
}
-
-class AmbuscadeShamanTriggeredAbility extends TriggeredAbilityImpl {
-
- AmbuscadeShamanTriggeredAbility(Effect effect) {
- super(Zone.BATTLEFIELD, effect, false);
- }
-
- AmbuscadeShamanTriggeredAbility(final AmbuscadeShamanTriggeredAbility ability) {
- super(ability);
- }
-
- @Override
- public AmbuscadeShamanTriggeredAbility copy() {
- return new AmbuscadeShamanTriggeredAbility(this);
- }
-
- @Override
- public boolean checkEventType(GameEvent event, Game game) {
- return event.getType() == GameEvent.EventType.ENTERS_THE_BATTLEFIELD;
- }
-
- @Override
- public boolean checkTrigger(GameEvent event, Game game) {
- UUID targetId = event.getTargetId();
- Permanent permanent = game.getPermanent(targetId);
- if (permanent.isControlledBy(this.controllerId)
- && permanent.isCreature()) {
- this.getEffects().setTargetPointer(new FixedTarget(permanent, game));
- return true;
- }
- return false;
- }
-
- @Override
- public String getRule() {
- return "Whenever {this} or another creature enters the battlefield under your control, that creature gets +2/+2 until end of turn.";
- }
-}
diff --git a/Mage.Sets/src/mage/cards/a/ArchonOfRedemption.java b/Mage.Sets/src/mage/cards/a/ArchonOfRedemption.java
index c450ed3074..f382139061 100644
--- a/Mage.Sets/src/mage/cards/a/ArchonOfRedemption.java
+++ b/Mage.Sets/src/mage/cards/a/ArchonOfRedemption.java
@@ -1,18 +1,22 @@
package mage.cards.a;
import mage.MageInt;
-import mage.abilities.TriggeredAbilityImpl;
-import mage.abilities.effects.common.GainLifeEffect;
+import mage.abilities.Ability;
+import mage.abilities.common.EntersBattlefieldThisOrAnotherTriggeredAbility;
+import mage.abilities.effects.OneShotEffect;
import mage.abilities.keyword.FlyingAbility;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
+import mage.constants.Outcome;
+import mage.constants.SetTargetPointer;
import mage.constants.SubType;
-import mage.constants.Zone;
+import mage.filter.FilterPermanent;
+import mage.filter.common.FilterCreaturePermanent;
+import mage.filter.predicate.mageobject.AbilityPredicate;
import mage.game.Game;
-import mage.game.events.GameEvent;
-import mage.game.events.GameEvent.EventType;
import mage.game.permanent.Permanent;
+import mage.players.Player;
import java.util.UUID;
@@ -21,6 +25,12 @@ import java.util.UUID;
*/
public final class ArchonOfRedemption extends CardImpl {
+ private static final FilterPermanent filter = new FilterCreaturePermanent("creature with flying");
+
+ static {
+ filter.add(new AbilityPredicate(FlyingAbility.class));
+ }
+
public ArchonOfRedemption(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{3}{W}{W}");
this.subtype.add(SubType.ARCHON);
@@ -29,11 +39,14 @@ public final class ArchonOfRedemption extends CardImpl {
this.toughness = new MageInt(4);
this.addAbility(FlyingAbility.getInstance());
+
// Whenever Archon of Redemption or another creature with flying enters the battlefield under your control, you may gain life equal to that creature's power.
- this.addAbility(new ArchonOfRedemptionTriggeredAbility());
+ this.addAbility(new EntersBattlefieldThisOrAnotherTriggeredAbility(
+ new ArchonOfRedemptionEffect(), filter, true, SetTargetPointer.PERMANENT, true
+ ));
}
- public ArchonOfRedemption(final ArchonOfRedemption card) {
+ private ArchonOfRedemption(final ArchonOfRedemption card) {
super(card);
}
@@ -43,43 +56,29 @@ public final class ArchonOfRedemption extends CardImpl {
}
}
-class ArchonOfRedemptionTriggeredAbility extends TriggeredAbilityImpl {
+class ArchonOfRedemptionEffect extends OneShotEffect {
- ArchonOfRedemptionTriggeredAbility() {
- super(Zone.BATTLEFIELD, null, true);
+ ArchonOfRedemptionEffect() {
+ super(Outcome.Benefit);
+ staticText = "gain life equal to that creature's power";
}
- ArchonOfRedemptionTriggeredAbility(final ArchonOfRedemptionTriggeredAbility ability) {
- super(ability);
+ private ArchonOfRedemptionEffect(final ArchonOfRedemptionEffect effect) {
+ super(effect);
}
@Override
- public ArchonOfRedemptionTriggeredAbility copy() {
- return new ArchonOfRedemptionTriggeredAbility(this);
+ public ArchonOfRedemptionEffect copy() {
+ return new ArchonOfRedemptionEffect(this);
}
@Override
- public boolean checkEventType(GameEvent event, Game game) {
- return event.getType() == EventType.ENTERS_THE_BATTLEFIELD;
- }
-
- @Override
- public boolean checkTrigger(GameEvent event, Game game) {
- Permanent permanent = game.getPermanent(event.getTargetId());
- if (permanent != null
- && permanent.isControlledBy(getControllerId())
- && permanent.isCreature()
- && (permanent.getId().equals(getSourceId())
- || (permanent.getAbilities().contains(FlyingAbility.getInstance())))) {
- this.getEffects().clear();
- this.addEffect(new GainLifeEffect(permanent.getPower().getValue()));
- return true;
+ public boolean apply(Game game, Ability source) {
+ Player player = game.getPlayer(source.getControllerId());
+ Permanent permanent = game.getPermanent(getTargetPointer().getFirst(game, source));
+ if (player == null || permanent == null) {
+ return false;
}
- return false;
- }
-
- @Override
- public String getRule() {
- return "Whenever {this} or another creature with flying enters the battlefield under your control, you may gain life equal to that creature's power.";
+ return player.gainLife(permanent.getPower().getValue(), game, source) > 0;
}
}
diff --git a/Mage.Sets/src/mage/cards/a/AyaraFirstOfLocthwain.java b/Mage.Sets/src/mage/cards/a/AyaraFirstOfLocthwain.java
index b7f6b297ca..0e45252d44 100644
--- a/Mage.Sets/src/mage/cards/a/AyaraFirstOfLocthwain.java
+++ b/Mage.Sets/src/mage/cards/a/AyaraFirstOfLocthwain.java
@@ -3,7 +3,7 @@ package mage.cards.a;
import mage.MageInt;
import mage.ObjectColor;
import mage.abilities.Ability;
-import mage.abilities.common.EntersBattlefieldControlledTriggeredAbility;
+import mage.abilities.common.EntersBattlefieldThisOrAnotherTriggeredAbility;
import mage.abilities.common.SimpleActivatedAbility;
import mage.abilities.costs.common.SacrificeTargetCost;
import mage.abilities.costs.common.TapSourceCost;
@@ -20,10 +20,10 @@ import mage.filter.common.FilterControlledCreaturePermanent;
import mage.filter.common.FilterControlledPermanent;
import mage.filter.common.FilterCreaturePermanent;
import mage.filter.predicate.mageobject.ColorPredicate;
+import mage.filter.predicate.permanent.AnotherPredicate;
import mage.target.common.TargetControlledPermanent;
import java.util.UUID;
-import mage.filter.predicate.permanent.AnotherPredicate;
/**
* @author TheElk801
@@ -31,7 +31,7 @@ import mage.filter.predicate.permanent.AnotherPredicate;
public final class AyaraFirstOfLocthwain extends CardImpl {
private static final FilterPermanent filter
- = new FilterCreaturePermanent("{this} or another black creature");
+ = new FilterCreaturePermanent("black creature");
private static final FilterControlledPermanent filter2
= new FilterControlledCreaturePermanent("another black creature");
@@ -51,7 +51,9 @@ public final class AyaraFirstOfLocthwain extends CardImpl {
this.toughness = new MageInt(3);
// Whenever Ayara, First of Locthwain or another black creature enters the battlefield under your control, each opponent loses 1 life and you gain 1 life.
- Ability ability = new EntersBattlefieldControlledTriggeredAbility(new LoseLifeOpponentsEffect(1), filter);
+ Ability ability = new EntersBattlefieldThisOrAnotherTriggeredAbility(
+ new LoseLifeOpponentsEffect(1), filter, false, true
+ );
ability.addEffect(new GainLifeEffect(1).concatBy("and"));
this.addAbility(ability);
diff --git a/Mage.Sets/src/mage/cards/f/FieldOfTheDead.java b/Mage.Sets/src/mage/cards/f/FieldOfTheDead.java
index e4eca676bd..f224145654 100644
--- a/Mage.Sets/src/mage/cards/f/FieldOfTheDead.java
+++ b/Mage.Sets/src/mage/cards/f/FieldOfTheDead.java
@@ -1,8 +1,8 @@
package mage.cards.f;
import mage.abilities.Ability;
-import mage.abilities.common.EntersBattlefieldControlledTriggeredAbility;
import mage.abilities.common.EntersBattlefieldTappedAbility;
+import mage.abilities.common.EntersBattlefieldThisOrAnotherTriggeredAbility;
import mage.abilities.condition.Condition;
import mage.abilities.decorator.ConditionalInterveningIfTriggeredAbility;
import mage.abilities.effects.common.CreateTokenEffect;
@@ -33,8 +33,8 @@ public final class FieldOfTheDead extends CardImpl {
// Whenever Field of the Dead or another land enters the battlefield under your control, if you control seven or more lands with different names, create a 2/2 black Zombie creature token.
this.addAbility(new ConditionalInterveningIfTriggeredAbility(
- new EntersBattlefieldControlledTriggeredAbility(
- new CreateTokenEffect(new ZombieToken()), StaticFilters.FILTER_LAND
+ new EntersBattlefieldThisOrAnotherTriggeredAbility(
+ new CreateTokenEffect(new ZombieToken()), StaticFilters.FILTER_LAND, false, true
), FieldOfTheDeadCondition.instance, "Whenever {this} or another land " +
"enters the battlefield under your control, if you control seven or more lands with different names, " +
"create a 2/2 black Zombie creature token."
diff --git a/Mage.Sets/src/mage/cards/f/FlayerOfTheHatebound.java b/Mage.Sets/src/mage/cards/f/FlayerOfTheHatebound.java
index b22d7cd689..c25c1cc6fb 100644
--- a/Mage.Sets/src/mage/cards/f/FlayerOfTheHatebound.java
+++ b/Mage.Sets/src/mage/cards/f/FlayerOfTheHatebound.java
@@ -73,7 +73,7 @@ class FlayerTriggeredAbility extends TriggeredAbilityImpl {
if (permanent != null
&& ((EntersTheBattlefieldEvent) event).getFromZone() == Zone.GRAVEYARD
&& permanent.isOwnedBy(controllerId)
- && permanent.isCreature()) {
+ && (permanent.isCreature() || permanent.getId().equals(getSourceId()))) {
Effect effect = this.getEffects().get(0);
effect.setValue("damageSource", event.getTargetId());
return true;
diff --git a/Mage.Sets/src/mage/cards/g/GeneralKudroOfDrannith.java b/Mage.Sets/src/mage/cards/g/GeneralKudroOfDrannith.java
index 4a24e6d934..a9c81282e6 100644
--- a/Mage.Sets/src/mage/cards/g/GeneralKudroOfDrannith.java
+++ b/Mage.Sets/src/mage/cards/g/GeneralKudroOfDrannith.java
@@ -2,7 +2,7 @@ package mage.cards.g;
import mage.MageInt;
import mage.abilities.Ability;
-import mage.abilities.common.EntersBattlefieldControlledTriggeredAbility;
+import mage.abilities.common.EntersBattlefieldThisOrAnotherTriggeredAbility;
import mage.abilities.common.SimpleActivatedAbility;
import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.costs.common.SacrificeTargetCost;
@@ -32,7 +32,7 @@ public final class GeneralKudroOfDrannith extends CardImpl {
private static final FilterCreaturePermanent filter
= new FilterCreaturePermanent(SubType.HUMAN, "Humans");
private static final FilterPermanent filter2
- = new FilterPermanent(SubType.HUMAN, "{this} or another Human");
+ = new FilterPermanent(SubType.HUMAN, "Human");
private static final FilterCard filter3
= new FilterCard("card from an opponent's graveyard");
private static final FilterControlledPermanent filter4
@@ -59,7 +59,7 @@ public final class GeneralKudroOfDrannith extends CardImpl {
)));
// Whenever General Kudro of Drannith or another Human enters the battlefield under your control, exile target card from an opponent's graveyard.
- Ability ability = new EntersBattlefieldControlledTriggeredAbility(new ExileTargetEffect(), filter2);
+ Ability ability = new EntersBattlefieldThisOrAnotherTriggeredAbility(new ExileTargetEffect(), filter2, false, true);
ability.addTarget(new TargetCardInOpponentsGraveyard(filter3));
this.addAbility(ability);
diff --git a/Mage.Sets/src/mage/cards/g/GoblinAssassin.java b/Mage.Sets/src/mage/cards/g/GoblinAssassin.java
index c94cb90e39..20e0ebebe1 100644
--- a/Mage.Sets/src/mage/cards/g/GoblinAssassin.java
+++ b/Mage.Sets/src/mage/cards/g/GoblinAssassin.java
@@ -1,44 +1,44 @@
-
package mage.cards.g;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.UUID;
import mage.MageInt;
import mage.abilities.Ability;
-import mage.abilities.TriggeredAbilityImpl;
+import mage.abilities.common.EntersBattlefieldThisOrAnotherTriggeredAbility;
import mage.abilities.effects.OneShotEffect;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.Outcome;
import mage.constants.SubType;
-import mage.constants.Zone;
+import mage.filter.FilterPermanent;
import mage.game.Game;
-import mage.game.events.GameEvent;
-import mage.game.events.GameEvent.EventType;
import mage.game.permanent.Permanent;
import mage.players.Player;
import mage.target.common.TargetControlledCreaturePermanent;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.UUID;
+
/**
* @author BursegSardaukar
*/
public final class GoblinAssassin extends CardImpl {
+ private static final FilterPermanent filter = new FilterPermanent(SubType.GOBLIN, "Goblin");
+
public GoblinAssassin(UUID ownerId, CardSetInfo setInfo) {
- super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{3}{R}{R}");
+ super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{3}{R}{R}");
this.subtype.add(SubType.GOBLIN);
this.subtype.add(SubType.ASSASSIN);
-
+
this.power = new MageInt(2);
this.toughness = new MageInt(2);
// Whenever Goblin Assassin or another Goblin enters the battlefield, each player flips a coin. Each player whose coin comes up tails sacrifices a creature.
- this.addAbility(new GoblinAssassinTriggeredAbiliy());
+ this.addAbility(new EntersBattlefieldThisOrAnotherTriggeredAbility(new GoblinAssassinTriggeredEffect(), filter));
}
- public GoblinAssassin(final GoblinAssassin card) {
+ private GoblinAssassin(final GoblinAssassin card) {
super(card);
}
@@ -48,55 +48,21 @@ public final class GoblinAssassin extends CardImpl {
}
}
-class GoblinAssassinTriggeredAbiliy extends TriggeredAbilityImpl {
- GoblinAssassinTriggeredAbiliy() {
- super(Zone.BATTLEFIELD, new GoblinAssassinTriggeredEffect(), false);
- }
-
- GoblinAssassinTriggeredAbiliy(final GoblinAssassinTriggeredAbiliy ability) {
- super(ability);
- }
-
- @Override
- public GoblinAssassinTriggeredAbiliy copy() {
- return new GoblinAssassinTriggeredAbiliy(this);
- }
-
- @Override
- public boolean checkEventType(GameEvent event, Game game) {
- return event.getType() == EventType.ENTERS_THE_BATTLEFIELD;
- }
-
- @Override
- public boolean checkTrigger(GameEvent event, Game game) {
- UUID targetId = event.getTargetId();
- Permanent permanent = game.getPermanent(targetId);
- if ((targetId.equals(this.getSourceId())) || (permanent.hasSubtype(SubType.GOBLIN, game) && !targetId.equals(this.getSourceId()))) {
- return true;
- }
- return false;
- }
-
- @Override
- public String getRule() {
- return "Whenever {this} or another Goblin enters battlefield, each player flips a coin. Each player whose coin comes up tails sacrifices a creature.";
- }
-}
-
class GoblinAssassinTriggeredEffect extends OneShotEffect {
+
GoblinAssassinTriggeredEffect() {
super(Outcome.Sacrifice);
}
- GoblinAssassinTriggeredEffect(final GoblinAssassinTriggeredEffect effect) {
+ private GoblinAssassinTriggeredEffect(final GoblinAssassinTriggeredEffect effect) {
super(effect);
}
@Override
public boolean apply(Game game, Ability source) {
- List perms = new ArrayList<>();
+ List perms = new ArrayList<>();
Player controller = game.getPlayer(source.getControllerId());
- if (controller != null) {
+ if (controller != null) {
for (UUID playerId : game.getState().getPlayersInRange(controller.getId(), game)) {
Player player = game.getPlayer(playerId);
if (player != null && !player.flipCoin(source, game, false)) {
@@ -114,7 +80,7 @@ class GoblinAssassinTriggeredEffect extends OneShotEffect {
permanent.sacrifice(source.getSourceId(), game);
}
}
- return true;
+ return true;
}
return false;
}
@@ -123,4 +89,4 @@ class GoblinAssassinTriggeredEffect extends OneShotEffect {
public GoblinAssassinTriggeredEffect copy() {
return new GoblinAssassinTriggeredEffect(this);
}
-}
\ No newline at end of file
+}
diff --git a/Mage.Sets/src/mage/cards/g/GontisAetherHeart.java b/Mage.Sets/src/mage/cards/g/GontisAetherHeart.java
index edac7052ff..4f35197bd9 100644
--- a/Mage.Sets/src/mage/cards/g/GontisAetherHeart.java
+++ b/Mage.Sets/src/mage/cards/g/GontisAetherHeart.java
@@ -1,9 +1,8 @@
package mage.cards.g;
-import java.util.UUID;
import mage.abilities.Ability;
-import mage.abilities.common.EntersBattlefieldControlledTriggeredAbility;
+import mage.abilities.common.EntersBattlefieldThisOrAnotherTriggeredAbility;
import mage.abilities.common.SimpleActivatedAbility;
import mage.abilities.costs.common.ExileSourceCost;
import mage.abilities.costs.common.PayEnergyCost;
@@ -13,37 +12,33 @@ import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.SuperType;
-import mage.constants.TargetController;
-import mage.constants.Zone;
-import mage.filter.common.FilterArtifactPermanent;
+import mage.filter.StaticFilters;
+
+import java.util.UUID;
/**
- *
* @author fireshoes
*/
public final class GontisAetherHeart extends CardImpl {
- private static final FilterArtifactPermanent filter = new FilterArtifactPermanent("{this} or another artifact");
-
- static {
- filter.add(TargetController.YOU.getControllerPredicate());
- }
-
public GontisAetherHeart(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.ARTIFACT}, "{6}");
addSuperType(SuperType.LEGENDARY);
// Whenever Gonti's Aether Heart or another artifact enters the battlefield under your control, you get {E}{E} (two energy counters).
- this.addAbility(new EntersBattlefieldControlledTriggeredAbility(Zone.BATTLEFIELD, new GetEnergyCountersControllerEffect(2), filter, false));
+ this.addAbility(new EntersBattlefieldThisOrAnotherTriggeredAbility(
+ new GetEnergyCountersControllerEffect(2),
+ StaticFilters.FILTER_PERMANENT_ARTIFACT, false, true
+ ));
// Pay {E}{E}{E}{E}{E}{E}{E}{E}, Exile Gonti's Aether Heart: Take an extra turn after this one.
- Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new AddExtraTurnControllerEffect(), new PayEnergyCost(8));
+ Ability ability = new SimpleActivatedAbility(new AddExtraTurnControllerEffect(), new PayEnergyCost(8));
ability.addCost(new ExileSourceCost());
this.addAbility(ability);
}
- public GontisAetherHeart(final GontisAetherHeart card) {
+ private GontisAetherHeart(final GontisAetherHeart card) {
super(card);
}
diff --git a/Mage.Sets/src/mage/cards/g/GruulRagebeast.java b/Mage.Sets/src/mage/cards/g/GruulRagebeast.java
index 7a7ec1517a..2ac9f509ae 100644
--- a/Mage.Sets/src/mage/cards/g/GruulRagebeast.java
+++ b/Mage.Sets/src/mage/cards/g/GruulRagebeast.java
@@ -20,6 +20,7 @@ import mage.game.events.GameEvent;
import mage.game.events.GameEvent.EventType;
import mage.game.permanent.Permanent;
import mage.target.common.TargetCreaturePermanent;
+import mage.target.common.TargetOpponentsCreaturePermanent;
import mage.target.targetpointer.FixedTarget;
/**
@@ -28,12 +29,6 @@ import mage.target.targetpointer.FixedTarget;
*/
public final class GruulRagebeast extends CardImpl {
- private static final FilterCreaturePermanent filter2 = new FilterCreaturePermanent("creature an opponent controls");
-
- static {
- filter2.add(TargetController.OPPONENT.getControllerPredicate());
- }
-
public GruulRagebeast(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{5}{R}{G}");
this.subtype.add(SubType.BEAST);
@@ -42,10 +37,7 @@ public final class GruulRagebeast extends CardImpl {
this.toughness = new MageInt(6);
// Whenever Gruul Ragebeast or another creature enters the battlefield under your control, that creature fights target creature an opponent controls.
- Ability ability = new GruulRagebeastTriggeredAbility();
-
- ability.addTarget(new TargetCreaturePermanent(filter2));
- this.addAbility(ability);
+ this.addAbility(new GruulRagebeastTriggeredAbility());
}
public GruulRagebeast(final GruulRagebeast card) {
@@ -61,10 +53,10 @@ public final class GruulRagebeast extends CardImpl {
class GruulRagebeastTriggeredAbility extends TriggeredAbilityImpl {
GruulRagebeastTriggeredAbility() {
- super(Zone.BATTLEFIELD, new GruulRagebeastEffect(), false);
+ super(Zone.BATTLEFIELD, new GruulRagebeastEffect(), false);this.addTarget(new TargetOpponentsCreaturePermanent());
}
- GruulRagebeastTriggeredAbility(final GruulRagebeastTriggeredAbility ability) {
+ private GruulRagebeastTriggeredAbility(final GruulRagebeastTriggeredAbility ability) {
super(ability);
}
@@ -106,7 +98,7 @@ class GruulRagebeastEffect extends OneShotEffect {
super(Outcome.Damage);
}
- GruulRagebeastEffect(final GruulRagebeastEffect effect) {
+ private GruulRagebeastEffect(final GruulRagebeastEffect effect) {
super(effect);
}
diff --git a/Mage.Sets/src/mage/cards/h/HammerOfNazahn.java b/Mage.Sets/src/mage/cards/h/HammerOfNazahn.java
index a973a49601..44e9f58776 100644
--- a/Mage.Sets/src/mage/cards/h/HammerOfNazahn.java
+++ b/Mage.Sets/src/mage/cards/h/HammerOfNazahn.java
@@ -1,9 +1,8 @@
package mage.cards.h;
-import java.util.UUID;
import mage.abilities.Ability;
-import mage.abilities.common.EntersBattlefieldControlledTriggeredAbility;
+import mage.abilities.common.EntersBattlefieldThisOrAnotherTriggeredAbility;
import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.costs.mana.GenericManaCost;
import mage.abilities.effects.Effect;
@@ -14,34 +13,29 @@ import mage.abilities.keyword.EquipAbility;
import mage.abilities.keyword.IndestructibleAbility;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
-import mage.constants.AttachmentType;
-import mage.constants.CardType;
-import mage.constants.Outcome;
-import mage.constants.SetTargetPointer;
-import mage.constants.SubType;
-import mage.constants.SuperType;
-import mage.constants.Zone;
-import mage.filter.common.FilterEquipmentPermanent;
+import mage.constants.*;
+import mage.filter.StaticFilters;
import mage.game.Game;
import mage.game.permanent.Permanent;
import mage.players.Player;
import mage.target.common.TargetControlledCreaturePermanent;
+import java.util.UUID;
+
/**
- *
* @author Saga
*/
public final class HammerOfNazahn extends CardImpl {
-
- private static final FilterEquipmentPermanent filter = new FilterEquipmentPermanent("{this} or another Equipment");
public HammerOfNazahn(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.ARTIFACT}, "{4}");
this.addSuperType(SuperType.LEGENDARY);
this.subtype.add(SubType.EQUIPMENT);
-
+
// Whenever Hammer of Nazahn or another Equipment enters the battlefiend under your control, you may attach that Equipment to target creature you control.
- Ability ability = new EntersBattlefieldControlledTriggeredAbility(Zone.BATTLEFIELD, new HammerOfNazahnEffect(), filter, true, SetTargetPointer.PERMANENT, "");
+ Ability ability = new EntersBattlefieldThisOrAnotherTriggeredAbility(
+ new HammerOfNazahnEffect(), StaticFilters.FILTER_PERMANENT_EQUIPMENT, true, SetTargetPointer.PERMANENT, true
+ );
ability.addTarget(new TargetControlledCreaturePermanent());
this.addAbility(ability);
diff --git a/Mage.Sets/src/mage/cards/k/KapshoKitefins.java b/Mage.Sets/src/mage/cards/k/KapshoKitefins.java
index db6aa7c954..da025e429c 100644
--- a/Mage.Sets/src/mage/cards/k/KapshoKitefins.java
+++ b/Mage.Sets/src/mage/cards/k/KapshoKitefins.java
@@ -1,37 +1,26 @@
-
package mage.cards.k;
-import java.util.UUID;
import mage.MageInt;
import mage.abilities.Ability;
-import mage.abilities.common.EntersBattlefieldControlledTriggeredAbility;
+import mage.abilities.common.EntersBattlefieldThisOrAnotherTriggeredAbility;
import mage.abilities.effects.common.TapTargetEffect;
import mage.abilities.keyword.FlyingAbility;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.SubType;
-import mage.constants.TargetController;
-import mage.constants.Zone;
-import mage.filter.common.FilterCreaturePermanent;
-import mage.target.common.TargetCreaturePermanent;
+import mage.filter.StaticFilters;
+import mage.target.common.TargetOpponentsCreaturePermanent;
+
+import java.util.UUID;
/**
- *
* @author LevelX2
*/
public final class KapshoKitefins extends CardImpl {
- private static final FilterCreaturePermanent filter = new FilterCreaturePermanent("{this} or another creature");
- private static final FilterCreaturePermanent filterTarget = new FilterCreaturePermanent("creature an opponent controls");
-
- static {
- filter.add(TargetController.YOU.getControllerPredicate());
- filterTarget.add(TargetController.OPPONENT.getControllerPredicate());
- }
-
public KapshoKitefins(UUID ownerId, CardSetInfo setInfo) {
- super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{4}{U}{U}");
+ super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{4}{U}{U}");
this.subtype.add(SubType.FISH);
this.color.setBlue(true);
@@ -40,14 +29,16 @@ public final class KapshoKitefins extends CardImpl {
// Flying
this.addAbility(FlyingAbility.getInstance());
- // Whenever Kapsho Kitefins or another creature enters the battlefield under your control, tap target creature an opponent controls.
- Ability ability = new EntersBattlefieldControlledTriggeredAbility(Zone.BATTLEFIELD, new TapTargetEffect(), filter, false);
- ability.addTarget(new TargetCreaturePermanent(filterTarget));
- this.addAbility(ability);
+ // Whenever Kapsho Kitefins or another creature enters the battlefield under your control, tap target creature an opponent controls.
+ Ability ability = new EntersBattlefieldThisOrAnotherTriggeredAbility(
+ new TapTargetEffect(), StaticFilters.FILTER_PERMANENT_CREATURE, false, true
+ );
+ ability.addTarget(new TargetOpponentsCreaturePermanent());
+ this.addAbility(ability);
}
- public KapshoKitefins(final KapshoKitefins card) {
+ private KapshoKitefins(final KapshoKitefins card) {
super(card);
}
diff --git a/Mage.Sets/src/mage/cards/m/MarduWoeReaper.java b/Mage.Sets/src/mage/cards/m/MarduWoeReaper.java
index c87fd0e508..4a9e2061cc 100644
--- a/Mage.Sets/src/mage/cards/m/MarduWoeReaper.java
+++ b/Mage.Sets/src/mage/cards/m/MarduWoeReaper.java
@@ -1,45 +1,46 @@
package mage.cards.m;
-import java.util.UUID;
import mage.MageInt;
import mage.abilities.Ability;
-import mage.abilities.TriggeredAbilityImpl;
-import mage.abilities.effects.OneShotEffect;
-import mage.cards.Card;
+import mage.abilities.common.EntersBattlefieldThisOrAnotherTriggeredAbility;
+import mage.abilities.effects.common.ExileTargetEffect;
+import mage.abilities.effects.common.GainLifeEffect;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
-import mage.constants.Outcome;
import mage.constants.SubType;
-import mage.constants.Zone;
-import mage.filter.common.FilterCreatureCard;
-import mage.game.Game;
-import mage.game.events.GameEvent;
-import mage.game.permanent.Permanent;
-import mage.players.Player;
+import mage.filter.FilterPermanent;
+import mage.filter.StaticFilters;
import mage.target.common.TargetCardInGraveyard;
+import java.util.UUID;
+
/**
- *
* @author emerald000
*/
public final class MarduWoeReaper extends CardImpl {
+ private static final FilterPermanent filter = new FilterPermanent(SubType.WARRIOR, "Warrior");
+
public MarduWoeReaper(UUID ownerId, CardSetInfo setInfo) {
- super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{W}");
+ super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{W}");
this.subtype.add(SubType.HUMAN);
this.subtype.add(SubType.WARRIOR);
this.power = new MageInt(2);
this.toughness = new MageInt(1);
// Whenever Mardu Woe-Reaper or another Warrior enters the battlefield under your control, you may exile target creature card from a graveyard. If you do, you gain 1 life.
- Ability ability = new MarduWoeReaperTriggeredAbility();
- ability.addTarget(new TargetCardInGraveyard(new FilterCreatureCard("creature card from a graveyard")));
+ Ability ability = new EntersBattlefieldThisOrAnotherTriggeredAbility(
+ new ExileTargetEffect("exile target creature card from a graveyard.")
+ , filter, true, true
+ );
+ ability.addEffect(new GainLifeEffect(1).concatBy("If you do,"));
+ ability.addTarget(new TargetCardInGraveyard(StaticFilters.FILTER_CARD_CREATURE));
this.addAbility(ability);
}
- public MarduWoeReaper(final MarduWoeReaper card) {
+ private MarduWoeReaper(final MarduWoeReaper card) {
super(card);
}
@@ -48,70 +49,3 @@ public final class MarduWoeReaper extends CardImpl {
return new MarduWoeReaper(this);
}
}
-
-class MarduWoeReaperTriggeredAbility extends TriggeredAbilityImpl {
-
- MarduWoeReaperTriggeredAbility() {
- super(Zone.BATTLEFIELD, new MarduWoeReaperEffect(), true);
- }
-
- MarduWoeReaperTriggeredAbility(final MarduWoeReaperTriggeredAbility ability) {
- super(ability);
- }
-
- @Override
- public MarduWoeReaperTriggeredAbility copy() {
- return new MarduWoeReaperTriggeredAbility(this);
- }
-
- @Override
- public boolean checkEventType(GameEvent event, Game game) {
- return event.getType() == GameEvent.EventType.ENTERS_THE_BATTLEFIELD;
- }
-
- @Override
- public boolean checkTrigger(GameEvent event, Game game) {
- if (event.getPlayerId().equals(this.getControllerId())) {
- Permanent permanent = game.getPermanent(event.getTargetId());
- if (permanent != null && (permanent.getId().equals(this.getSourceId()) || permanent.hasSubtype(SubType.WARRIOR, game))) {
- return true;
- }
- }
- return false;
- }
-
- @Override
- public String getRule() {
- return "Whenever {this} or another Warrior enters the battlefield under your control, " + super.getRule();
- }
-}
-
-class MarduWoeReaperEffect extends OneShotEffect {
-
- MarduWoeReaperEffect() {
- super(Outcome.GainLife);
- this.staticText = "you may exile target creature card from a graveyard. If you do, you gain 1 life";
- }
-
- MarduWoeReaperEffect(final MarduWoeReaperEffect effect) {
- super(effect);
- }
-
- @Override
- public MarduWoeReaperEffect copy() {
- return new MarduWoeReaperEffect(this);
- }
-
- @Override
- public boolean apply(Game game, Ability source) {
- Player player = game.getPlayer(source.getControllerId());
- Card card = game.getCard(this.getTargetPointer().getFirst(game, source));
- if (player != null && card != null) {
- if (player.moveCardToExileWithInfo(card, null, "", source.getSourceId(), game, Zone.GRAVEYARD, true)) {
- player.gainLife(1, game, source);
- }
- return true;
- }
- return false;
- }
-}
diff --git a/Mage.Sets/src/mage/cards/m/MaritLagesSlumber.java b/Mage.Sets/src/mage/cards/m/MaritLagesSlumber.java
index 4588829ab9..5f2890ac7d 100644
--- a/Mage.Sets/src/mage/cards/m/MaritLagesSlumber.java
+++ b/Mage.Sets/src/mage/cards/m/MaritLagesSlumber.java
@@ -1,7 +1,7 @@
package mage.cards.m;
import mage.abilities.common.BeginningOfUpkeepTriggeredAbility;
-import mage.abilities.common.EntersBattlefieldControlledTriggeredAbility;
+import mage.abilities.common.EntersBattlefieldThisOrAnotherTriggeredAbility;
import mage.abilities.condition.Condition;
import mage.abilities.condition.common.PermanentsOnTheBattlefieldCondition;
import mage.abilities.costs.common.SacrificeSourceCost;
@@ -27,7 +27,7 @@ import java.util.UUID;
public final class MaritLagesSlumber extends CardImpl {
private static final FilterPermanent filter
- = new FilterControlledPermanent("{this} or another snow permanent");
+ = new FilterControlledPermanent("snow permanent");
static {
filter.add(SuperType.SNOW.getPredicate());
@@ -43,7 +43,9 @@ public final class MaritLagesSlumber extends CardImpl {
this.addSuperType(SuperType.SNOW);
// Whenever Marit Lage's Slumber or another snow permanent enters the battlefield under your control, scry 1.
- this.addAbility(new EntersBattlefieldControlledTriggeredAbility(new ScryEffect(1), filter));
+ this.addAbility(new EntersBattlefieldThisOrAnotherTriggeredAbility(
+ new ScryEffect(1), filter, false, true
+ ));
// At the beginning of your upkeep, if you control ten or more snow permanents, sacrifice Marit Lage's Slumber. If you do, create Marit Lage, a legendary 20/20 black Avatar creature token with flying and indestructible.
this.addAbility(new ConditionalInterveningIfTriggeredAbility(
diff --git a/Mage.Sets/src/mage/cards/n/NebelgastHerald.java b/Mage.Sets/src/mage/cards/n/NebelgastHerald.java
index 833bae9953..115a9c4d25 100644
--- a/Mage.Sets/src/mage/cards/n/NebelgastHerald.java
+++ b/Mage.Sets/src/mage/cards/n/NebelgastHerald.java
@@ -1,10 +1,9 @@
package mage.cards.n;
-import java.util.UUID;
import mage.MageInt;
import mage.abilities.Ability;
-import mage.abilities.common.EntersBattlefieldControlledTriggeredAbility;
+import mage.abilities.common.EntersBattlefieldThisOrAnotherTriggeredAbility;
import mage.abilities.effects.common.TapTargetEffect;
import mage.abilities.keyword.FlashAbility;
import mage.abilities.keyword.FlyingAbility;
@@ -12,39 +11,35 @@ import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.SubType;
-import mage.constants.TargetController;
-import mage.constants.Zone;
-import mage.filter.common.FilterCreaturePermanent;
-import mage.target.common.TargetCreaturePermanent;
+import mage.filter.FilterPermanent;
+import mage.target.common.TargetOpponentsCreaturePermanent;
+
+import java.util.UUID;
/**
- *
* @author LevelX2
*/
public final class NebelgastHerald extends CardImpl {
- private static final FilterCreaturePermanent filter = new FilterCreaturePermanent("{this} or another Spirit");
- private static final FilterCreaturePermanent filterTarget = new FilterCreaturePermanent("creature an opponent controls");
-
- static {
- filter.add(TargetController.YOU.getControllerPredicate());
- filter.add(SubType.SPIRIT.getPredicate());
- filterTarget.add(TargetController.OPPONENT.getControllerPredicate());
- }
+ private static final FilterPermanent filter = new FilterPermanent(SubType.SPIRIT, "Spirit");
public NebelgastHerald(UUID ownerId, CardSetInfo setInfo) {
- super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{2}{U}");
+ super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{2}{U}");
this.subtype.add(SubType.SPIRIT);
this.power = new MageInt(2);
this.toughness = new MageInt(1);
// Flash
this.addAbility(FlashAbility.getInstance());
+
// Flying
this.addAbility(FlyingAbility.getInstance());
+
// Whenever Nebelgast Herald or another Spirit enters the battlefield under your control, tap target creature an opponent controls.
- Ability ability = new EntersBattlefieldControlledTriggeredAbility(Zone.BATTLEFIELD, new TapTargetEffect(), filter, false);
- ability.addTarget(new TargetCreaturePermanent(filterTarget));
+ Ability ability = new EntersBattlefieldThisOrAnotherTriggeredAbility(
+ new TapTargetEffect(), filter, false, true
+ );
+ ability.addTarget(new TargetOpponentsCreaturePermanent());
this.addAbility(ability);
}
diff --git a/Mage.Sets/src/mage/cards/n/NoxiousGhoul.java b/Mage.Sets/src/mage/cards/n/NoxiousGhoul.java
index c8bf3c0ffe..1409bedb6f 100644
--- a/Mage.Sets/src/mage/cards/n/NoxiousGhoul.java
+++ b/Mage.Sets/src/mage/cards/n/NoxiousGhoul.java
@@ -1,8 +1,7 @@
-
package mage.cards.n;
import mage.MageInt;
-import mage.abilities.common.EntersBattlefieldAllTriggeredAbility;
+import mage.abilities.common.EntersBattlefieldThisOrAnotherTriggeredAbility;
import mage.abilities.effects.common.continuous.BoostAllEffect;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
@@ -11,11 +10,7 @@ import mage.constants.Duration;
import mage.constants.SubType;
import mage.filter.FilterPermanent;
import mage.filter.common.FilterCreaturePermanent;
-import mage.filter.predicate.ObjectSourcePlayer;
-import mage.filter.predicate.ObjectSourcePlayerPredicate;
import mage.filter.predicate.Predicates;
-import mage.game.Game;
-import mage.game.permanent.Permanent;
import java.util.UUID;
@@ -24,13 +19,11 @@ import java.util.UUID;
*/
public final class NoxiousGhoul extends CardImpl {
- private static final FilterCreaturePermanent filter = new FilterCreaturePermanent();
- private static final FilterPermanent filter2 = new FilterPermanent();
+ private static final FilterCreaturePermanent filter = new FilterCreaturePermanent("all non-Zombie creatures");
+ private static final FilterPermanent filter2 = new FilterPermanent(SubType.ZOMBIE, "Zombie");
static {
- filter.add(CardType.CREATURE.getPredicate());
filter.add(Predicates.not(SubType.ZOMBIE.getPredicate()));
- filter2.add(NoxiousGhoulPredicate.instance);
}
public NoxiousGhoul(UUID ownerId, CardSetInfo setInfo) {
@@ -41,14 +34,12 @@ public final class NoxiousGhoul extends CardImpl {
this.toughness = new MageInt(3);
// Whenever Noxious Ghoul or another Zombie enters the battlefield, all non-Zombie creatures get -1/-1 until end of turn.
- this.addAbility(new EntersBattlefieldAllTriggeredAbility(
- new BoostAllEffect(-1, -1, Duration.EndOfTurn, filter, false),
- filter2, "Whenever {this} or another Zombie enters the battlefield, " +
- "all non-Zombie creatures get -1/-1 until end of turn."
- ));
+ this.addAbility(new EntersBattlefieldThisOrAnotherTriggeredAbility(new BoostAllEffect(
+ -1, -1, Duration.EndOfTurn, filter, false
+ ), filter2, false, true));
}
- public NoxiousGhoul(final NoxiousGhoul card) {
+ private NoxiousGhoul(final NoxiousGhoul card) {
super(card);
}
@@ -57,13 +48,3 @@ public final class NoxiousGhoul extends CardImpl {
return new NoxiousGhoul(this);
}
}
-
-enum NoxiousGhoulPredicate implements ObjectSourcePlayerPredicate> {
- instance;
-
- @Override
- public boolean apply(ObjectSourcePlayer input, Game game) {
- return input.getObject().hasSubtype(SubType.ZOMBIE, game)
- || input.getObject().getId().equals(input.getSourceId());
- }
-}
\ No newline at end of file
diff --git a/Mage.Sets/src/mage/cards/o/OathOfTheAncientWood.java b/Mage.Sets/src/mage/cards/o/OathOfTheAncientWood.java
index a2f1acfa26..8723578699 100644
--- a/Mage.Sets/src/mage/cards/o/OathOfTheAncientWood.java
+++ b/Mage.Sets/src/mage/cards/o/OathOfTheAncientWood.java
@@ -1,44 +1,35 @@
-
package mage.cards.o;
-import java.util.UUID;
import mage.abilities.Ability;
-import mage.abilities.common.EntersBattlefieldAllTriggeredAbility;
-import mage.abilities.effects.Effect;
+import mage.abilities.common.EntersBattlefieldThisOrAnotherTriggeredAbility;
import mage.abilities.effects.common.counter.AddCountersTargetEffect;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
-import mage.constants.SetTargetPointer;
-import mage.constants.TargetController;
-import mage.constants.Zone;
import mage.counters.CounterType;
-import mage.filter.common.FilterEnchantmentPermanent;
+import mage.filter.StaticFilters;
import mage.target.common.TargetCreaturePermanent;
+import java.util.UUID;
+
/**
- *
* @author LevelX2
*/
public final class OathOfTheAncientWood extends CardImpl {
- private static final FilterEnchantmentPermanent filter = new FilterEnchantmentPermanent("Oath of the Ancient Wood or another enchantment");
-
- static {
- filter.add(TargetController.YOU.getControllerPredicate());
- }
-
public OathOfTheAncientWood(UUID ownerId, CardSetInfo setInfo) {
- super(ownerId,setInfo,new CardType[]{CardType.ENCHANTMENT},"{2}{G}");
+ super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{2}{G}");
// Whenever Oath of the Ancient Wood or another enchantment enters the battlefield under your control, you may put a +1/+1 counter on target creature.
- Effect effect = new AddCountersTargetEffect(CounterType.P1P1.createInstance());
- Ability ability = new EntersBattlefieldAllTriggeredAbility(Zone.BATTLEFIELD, effect, filter, true, SetTargetPointer.NONE, null, true);
+ Ability ability = new EntersBattlefieldThisOrAnotherTriggeredAbility(
+ new AddCountersTargetEffect(CounterType.P1P1.createInstance()),
+ StaticFilters.FILTER_ENCHANTMENT_PERMANENT, true, true
+ );
ability.addTarget(new TargetCreaturePermanent());
this.addAbility(ability);
}
- public OathOfTheAncientWood(final OathOfTheAncientWood card) {
+ private OathOfTheAncientWood(final OathOfTheAncientWood card) {
super(card);
}
diff --git a/Mage.Sets/src/mage/cards/q/QasaliSlingers.java b/Mage.Sets/src/mage/cards/q/QasaliSlingers.java
index a68dd90737..457e83c16f 100644
--- a/Mage.Sets/src/mage/cards/q/QasaliSlingers.java
+++ b/Mage.Sets/src/mage/cards/q/QasaliSlingers.java
@@ -1,28 +1,27 @@
-
package mage.cards.q;
-import java.util.UUID;
import mage.MageInt;
-import mage.abilities.TriggeredAbilityImpl;
+import mage.abilities.Ability;
+import mage.abilities.common.EntersBattlefieldThisOrAnotherTriggeredAbility;
import mage.abilities.effects.common.DestroyTargetEffect;
import mage.abilities.keyword.ReachAbility;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.SubType;
-import mage.constants.Zone;
+import mage.filter.FilterPermanent;
import mage.filter.StaticFilters;
-import mage.game.Game;
-import mage.game.events.GameEvent;
-import mage.game.permanent.Permanent;
import mage.target.TargetPermanent;
+import java.util.UUID;
+
/**
- *
* @author spjspj
*/
public final class QasaliSlingers extends CardImpl {
+ private static final FilterPermanent filter = new FilterPermanent(SubType.CAT, "Cat");
+
public QasaliSlingers(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{4}{G}");
@@ -35,10 +34,14 @@ public final class QasaliSlingers extends CardImpl {
this.addAbility(ReachAbility.getInstance());
// Whenever Qasali Slingers or another Cat enters the battlefield under your control, you may destroy target artifact or enchantment.
- this.addAbility(new QasaliSlingersTriggeredAbility());
+ Ability ability = new EntersBattlefieldThisOrAnotherTriggeredAbility(
+ new DestroyTargetEffect(), filter, true, true
+ );
+ ability.addTarget(new TargetPermanent(StaticFilters.FILTER_PERMANENT_ARTIFACT_OR_ENCHANTMENT));
+ this.addAbility(ability);
}
- public QasaliSlingers(final QasaliSlingers card) {
+ private QasaliSlingers(final QasaliSlingers card) {
super(card);
}
@@ -47,44 +50,3 @@ public final class QasaliSlingers extends CardImpl {
return new QasaliSlingers(this);
}
}
-
-class QasaliSlingersTriggeredAbility extends TriggeredAbilityImpl {
-
- public QasaliSlingersTriggeredAbility() {
- super(Zone.BATTLEFIELD, new DestroyTargetEffect(), true);
- this.addTarget(new TargetPermanent(StaticFilters.FILTER_PERMANENT_ARTIFACT_OR_ENCHANTMENT));
- }
-
- public QasaliSlingersTriggeredAbility(final QasaliSlingersTriggeredAbility ability) {
- super(ability);
- }
-
- @Override
- public QasaliSlingersTriggeredAbility copy() {
- return new QasaliSlingersTriggeredAbility(this);
- }
-
- @Override
- public boolean checkEventType(GameEvent event, Game game) {
- return event.getType() == GameEvent.EventType.ENTERS_THE_BATTLEFIELD;
- }
-
- @Override
- public boolean checkTrigger(GameEvent event, Game game) {
- Permanent permanent = game.getPermanent(event.getTargetId());
- if (permanent != null) {
- if (permanent.getId().equals(this.getSourceId())) {
- return true;
- }
- if (permanent.hasSubtype(SubType.CAT, game) && permanent.isControlledBy(this.getControllerId())) {
- return true;
- }
- }
- return false;
- }
-
- @Override
- public String getRule() {
- return "Whenever {this} or another Cat enters the battlefield under your control, you may destroy target artifact or enchantment.";
- }
-}
diff --git a/Mage.Sets/src/mage/cards/r/RisenReef.java b/Mage.Sets/src/mage/cards/r/RisenReef.java
index 71c38de59a..8b58944b89 100644
--- a/Mage.Sets/src/mage/cards/r/RisenReef.java
+++ b/Mage.Sets/src/mage/cards/r/RisenReef.java
@@ -2,7 +2,7 @@ package mage.cards.r;
import mage.MageInt;
import mage.abilities.Ability;
-import mage.abilities.common.EntersBattlefieldControlledTriggeredAbility;
+import mage.abilities.common.EntersBattlefieldThisOrAnotherTriggeredAbility;
import mage.abilities.effects.OneShotEffect;
import mage.cards.Card;
import mage.cards.CardImpl;
@@ -22,8 +22,7 @@ import java.util.UUID;
*/
public final class RisenReef extends CardImpl {
- private static final FilterPermanent filter
- = new FilterPermanent(SubType.ELEMENTAL, "{this} or another Elemental");
+ private static final FilterPermanent filter = new FilterPermanent(SubType.ELEMENTAL, "Elemental");
public RisenReef(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{1}{G}{U}");
@@ -33,7 +32,9 @@ public final class RisenReef extends CardImpl {
this.toughness = new MageInt(1);
// Whenever Risen Reef or another Elemental enters the battlefield under your control, look at the top card of your library. If it's a land card, you may put it onto the battlefield tapped. If you don't put the card onto the battlefield, put it into your hand.
- this.addAbility(new EntersBattlefieldControlledTriggeredAbility(new RisenReefEffect(), filter));
+ this.addAbility(new EntersBattlefieldThisOrAnotherTriggeredAbility(
+ new RisenReefEffect(), filter, false, true
+ ));
}
private RisenReef(final RisenReef card) {
@@ -85,4 +86,4 @@ class RisenReefEffect extends OneShotEffect {
}
return true;
}
-}
\ No newline at end of file
+}
diff --git a/Mage.Sets/src/mage/cards/s/SageOfTheFalls.java b/Mage.Sets/src/mage/cards/s/SageOfTheFalls.java
index 29ad92531e..b40b05b3e3 100644
--- a/Mage.Sets/src/mage/cards/s/SageOfTheFalls.java
+++ b/Mage.Sets/src/mage/cards/s/SageOfTheFalls.java
@@ -1,7 +1,7 @@
package mage.cards.s;
import mage.MageInt;
-import mage.abilities.common.EntersBattlefieldControlledTriggeredAbility;
+import mage.abilities.common.EntersBattlefieldThisOrAnotherTriggeredAbility;
import mage.abilities.effects.common.DrawDiscardControllerEffect;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
@@ -18,8 +18,7 @@ import java.util.UUID;
*/
public final class SageOfTheFalls extends CardImpl {
- private static final FilterPermanent filter
- = new FilterCreaturePermanent("{this} or another non-Human creature");
+ private static final FilterPermanent filter = new FilterCreaturePermanent("non-Human creature");
static {
filter.add(Predicates.not(SubType.HUMAN.getPredicate()));
@@ -34,9 +33,9 @@ public final class SageOfTheFalls extends CardImpl {
this.toughness = new MageInt(5);
// Whenever Sage of the Falls or another non-Human creature enters the battlefield under you control, you may draw a card. If you do, discard a card.
- this.addAbility(new EntersBattlefieldControlledTriggeredAbility(
- new DrawDiscardControllerEffect(1, 1, true), filter
- ));
+ this.addAbility(new EntersBattlefieldThisOrAnotherTriggeredAbility(new DrawDiscardControllerEffect(
+ 1, 1, true
+ ), filter, false, true));
}
private SageOfTheFalls(final SageOfTheFalls card) {
diff --git a/Mage.Sets/src/mage/cards/s/ScourgeOfValkas.java b/Mage.Sets/src/mage/cards/s/ScourgeOfValkas.java
index c2332f8c6a..e6e7f1c6c7 100644
--- a/Mage.Sets/src/mage/cards/s/ScourgeOfValkas.java
+++ b/Mage.Sets/src/mage/cards/s/ScourgeOfValkas.java
@@ -2,7 +2,7 @@ package mage.cards.s;
import mage.MageInt;
import mage.abilities.Ability;
-import mage.abilities.common.EntersBattlefieldControlledTriggeredAbility;
+import mage.abilities.common.EntersBattlefieldThisOrAnotherTriggeredAbility;
import mage.abilities.common.SimpleActivatedAbility;
import mage.abilities.costs.mana.ManaCostsImpl;
import mage.abilities.effects.OneShotEffect;
@@ -10,9 +10,12 @@ import mage.abilities.effects.common.continuous.BoostSourceEffect;
import mage.abilities.keyword.FlyingAbility;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
-import mage.constants.*;
+import mage.constants.CardType;
+import mage.constants.Duration;
+import mage.constants.Outcome;
+import mage.constants.SubType;
import mage.filter.FilterPermanent;
-import mage.filter.common.FilterCreaturePermanent;
+import mage.filter.common.FilterControlledPermanent;
import mage.game.Game;
import mage.game.permanent.Permanent;
import mage.players.Player;
@@ -25,13 +28,7 @@ import java.util.UUID;
*/
public final class ScourgeOfValkas extends CardImpl {
- private static final FilterCreaturePermanent filter = new FilterCreaturePermanent("{this} or another Dragon");
-
- static {
- filter.add(SubType.DRAGON.getPredicate());
- }
-
- private static final String rule = "Whenever {this} or another Dragon enters the battlefield under your control, it deals X damage to any target, where X is the number of Dragons you control.";
+ private static final FilterPermanent filter = new FilterPermanent(SubType.DRAGON, "Dragon");
public ScourgeOfValkas(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{2}{R}{R}{R}");
@@ -45,16 +42,17 @@ public final class ScourgeOfValkas extends CardImpl {
this.addAbility(FlyingAbility.getInstance());
// Whenever Scourge of Valkas or another Dragon enters the battlefield under your control, it deals X damage to any target, where X is the number of Dragons you control.
- Ability ability = new EntersBattlefieldControlledTriggeredAbility(Zone.BATTLEFIELD, new ScourgeOfValkasDamageEffect(), filter, false, rule);
+ Ability ability = new EntersBattlefieldThisOrAnotherTriggeredAbility(
+ new ScourgeOfValkasDamageEffect(), filter, false, true
+ );
ability.addTarget(new TargetAnyTarget());
this.addAbility(ability);
// {R}: Scourge of Valkas gets +1/+0 until end of turn.
- this.addAbility(new SimpleActivatedAbility(Zone.BATTLEFIELD, new BoostSourceEffect(1, 0, Duration.EndOfTurn), new ManaCostsImpl("{R}")));
-
+ this.addAbility(new SimpleActivatedAbility(new BoostSourceEffect(1, 0, Duration.EndOfTurn), new ManaCostsImpl("{R}")));
}
- public ScourgeOfValkas(final ScourgeOfValkas card) {
+ private ScourgeOfValkas(final ScourgeOfValkas card) {
super(card);
}
@@ -66,12 +64,14 @@ public final class ScourgeOfValkas extends CardImpl {
class ScourgeOfValkasDamageEffect extends OneShotEffect {
- public ScourgeOfValkasDamageEffect() {
+ private static final FilterPermanent filter = new FilterControlledPermanent(SubType.DRAGON, "");
+
+ ScourgeOfValkasDamageEffect() {
super(Outcome.Damage);
this.staticText = "it deals X damage to any target, where X is the number of Dragons you control";
}
- public ScourgeOfValkasDamageEffect(final ScourgeOfValkasDamageEffect effect) {
+ private ScourgeOfValkasDamageEffect(final ScourgeOfValkasDamageEffect effect) {
super(effect);
}
@@ -84,24 +84,23 @@ class ScourgeOfValkasDamageEffect extends OneShotEffect {
public boolean apply(Game game, Ability source) {
Player controller = game.getPlayer(source.getControllerId());
Permanent enteringDragon = (Permanent) getValue("permanentEnteringBattlefield");
- if (controller != null && enteringDragon != null) {
- FilterPermanent filter = new FilterPermanent();
- filter.add(SubType.DRAGON.getPredicate());
- int dragons = game.getBattlefield().countAll(filter, source.getControllerId(), game);
- if (dragons > 0) {
- Permanent permanent = game.getPermanent(getTargetPointer().getFirst(game, source));
- if (permanent != null) {
- permanent.damage(dragons, enteringDragon.getId(), game, false, true);
- } else {
- Player player = game.getPlayer(getTargetPointer().getFirst(game, source));
- if (player != null
- && player.isInGame()) {
- player.damage(dragons, enteringDragon.getId(), game);
- }
- }
- }
+ if (controller == null || enteringDragon == null) {
+ return false;
+ }
+ int dragons = game.getBattlefield().count(filter, source.getSourceId(), source.getControllerId(), game);
+ if (dragons < 1) {
return true;
}
- return false;
+ Permanent permanent = game.getPermanent(getTargetPointer().getFirst(game, source));
+ if (permanent != null) {
+ permanent.damage(dragons, enteringDragon.getId(), game, false, true);
+ } else {
+ Player player = game.getPlayer(getTargetPointer().getFirst(game, source));
+ if (player != null
+ && player.isInGame()) {
+ player.damage(dragons, enteringDragon.getId(), game);
+ }
+ }
+ return true;
}
}
diff --git a/Mage.Sets/src/mage/cards/s/SerumTank.java b/Mage.Sets/src/mage/cards/s/SerumTank.java
index 59b4f5bbbe..52875eee5c 100644
--- a/Mage.Sets/src/mage/cards/s/SerumTank.java
+++ b/Mage.Sets/src/mage/cards/s/SerumTank.java
@@ -1,48 +1,44 @@
-
package mage.cards.s;
-import java.util.UUID;
import mage.abilities.Ability;
-import mage.abilities.TriggeredAbilityImpl;
+import mage.abilities.common.EntersBattlefieldThisOrAnotherTriggeredAbility;
import mage.abilities.common.SimpleActivatedAbility;
import mage.abilities.costs.common.RemoveCountersSourceCost;
import mage.abilities.costs.common.TapSourceCost;
-import mage.abilities.costs.mana.ManaCostsImpl;
-import mage.abilities.effects.Effect;
+import mage.abilities.costs.mana.GenericManaCost;
import mage.abilities.effects.common.DrawCardSourceControllerEffect;
import mage.abilities.effects.common.counter.AddCountersSourceEffect;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
-import mage.constants.Zone;
import mage.counters.CounterType;
-import mage.game.Game;
-import mage.game.events.GameEvent;
-import mage.game.permanent.Permanent;
-import mage.target.targetpointer.FixedTarget;
+import mage.filter.StaticFilters;
+
+import java.util.UUID;
/**
- *
* @author CountAndromalius
*/
public final class SerumTank extends CardImpl {
public SerumTank(UUID ownerId, CardSetInfo setInfo) {
- super(ownerId,setInfo,new CardType[]{CardType.ARTIFACT},"{3}");
+ super(ownerId, setInfo, new CardType[]{CardType.ARTIFACT}, "{3}");
// Whenever {this} or another artifact comes into play, put a charge counter on {this}.
- Effect effect = new AddCountersSourceEffect(CounterType.CHARGE.createInstance());
- effect.setText("put a charge counter on {this}");
- this.addAbility(new SerumTankTriggeredAbility(effect));
+ this.addAbility(new EntersBattlefieldThisOrAnotherTriggeredAbility(
+ new AddCountersSourceEffect(CounterType.CHARGE.createInstance()), StaticFilters.FILTER_PERMANENT_ARTIFACT
+ ));
// {3}, {tap}, Remove a charge counter from {this}: Draw a card.
- Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new DrawCardSourceControllerEffect(1), new ManaCostsImpl("{3}"));
- ability.addCost(new RemoveCountersSourceCost(CounterType.CHARGE.createInstance(1)));
+ Ability ability = new SimpleActivatedAbility(
+ new DrawCardSourceControllerEffect(1), new GenericManaCost(3)
+ );
ability.addCost(new TapSourceCost());
+ ability.addCost(new RemoveCountersSourceCost(CounterType.CHARGE.createInstance()));
this.addAbility(ability);
}
- public SerumTank(final SerumTank card) {
+ private SerumTank(final SerumTank card) {
super(card);
}
@@ -51,42 +47,3 @@ public final class SerumTank extends CardImpl {
return new SerumTank(this);
}
}
-
-class SerumTankTriggeredAbility extends TriggeredAbilityImpl {
-
- SerumTankTriggeredAbility(Effect effect) {
- super(Zone.BATTLEFIELD, effect, false);
- }
-
- SerumTankTriggeredAbility(final SerumTankTriggeredAbility ability) {
- super(ability);
- }
-
- @Override
- public SerumTankTriggeredAbility copy() {
- return new SerumTankTriggeredAbility(this);
- }
-
- @Override
- public boolean checkEventType(GameEvent event, Game game) {
- return event.getType() == GameEvent.EventType.ENTERS_THE_BATTLEFIELD;
- }
-
- @Override
- public boolean checkTrigger(GameEvent event, Game game) {
- UUID targetId = event.getTargetId();
- Permanent permanent = game.getPermanent(targetId);
- if (permanent.isArtifact()) {
- for (Effect effect : this.getEffects()) {
- effect.setTargetPointer(new FixedTarget(permanent, game));
- }
- return true;
- }
- return false;
- }
-
- @Override
- public String getRule() {
- return "Whenever {this} or another artifact enters the battlefield, put a charge counter on {this}.";
- }
-}
diff --git a/Mage.Sets/src/mage/cards/s/SethronHurloonGeneral.java b/Mage.Sets/src/mage/cards/s/SethronHurloonGeneral.java
index 11260153d0..596757a7dd 100644
--- a/Mage.Sets/src/mage/cards/s/SethronHurloonGeneral.java
+++ b/Mage.Sets/src/mage/cards/s/SethronHurloonGeneral.java
@@ -2,7 +2,7 @@ package mage.cards.s;
import mage.MageInt;
import mage.abilities.Ability;
-import mage.abilities.common.EntersBattlefieldControlledTriggeredAbility;
+import mage.abilities.common.EntersBattlefieldThisOrAnotherTriggeredAbility;
import mage.abilities.common.SimpleActivatedAbility;
import mage.abilities.costs.mana.ManaCostsImpl;
import mage.abilities.effects.common.CreateTokenEffect;
@@ -17,7 +17,6 @@ import mage.constants.Duration;
import mage.constants.SubType;
import mage.constants.SuperType;
import mage.filter.FilterPermanent;
-import mage.filter.common.FilterControlledPermanent;
import mage.filter.common.FilterCreaturePermanent;
import mage.filter.predicate.Predicates;
import mage.filter.predicate.permanent.TokenPredicate;
@@ -30,9 +29,8 @@ import java.util.UUID;
*/
public final class SethronHurloonGeneral extends CardImpl {
- private static final FilterPermanent filter = new FilterControlledPermanent(
- SubType.MINOTAUR, "{this} or another nontoken Minotaur"
- );
+ private static final FilterPermanent filter
+ = new FilterPermanent(SubType.MINOTAUR, "nontoken Minotaur");
private static final FilterCreaturePermanent filter2 = new FilterCreaturePermanent(SubType.MINOTAUR, "");
private static final FilterPermanent filter3 = new FilterPermanent(SubType.MINOTAUR, "");
@@ -50,7 +48,9 @@ public final class SethronHurloonGeneral extends CardImpl {
this.toughness = new MageInt(4);
// Whenever Sethron, Hurloon General or another nontoken Minotaur enters the battlefield under your control, create a 2/3 red Minotaur creature token.
- this.addAbility(new EntersBattlefieldControlledTriggeredAbility(new CreateTokenEffect(new MinotaurToken()), filter));
+ this.addAbility(new EntersBattlefieldThisOrAnotherTriggeredAbility(
+ new CreateTokenEffect(new MinotaurToken()), filter, false, true
+ ));
// {2}{B/R}: Minotaurs you control get +1/+0 and gain menace and haste until end of turn.
Ability ability = new SimpleActivatedAbility(new BoostControlledEffect(
diff --git a/Mage.Sets/src/mage/cards/t/ThievesGuildEnforcer.java b/Mage.Sets/src/mage/cards/t/ThievesGuildEnforcer.java
index c62d5c63f3..40d870a3ef 100644
--- a/Mage.Sets/src/mage/cards/t/ThievesGuildEnforcer.java
+++ b/Mage.Sets/src/mage/cards/t/ThievesGuildEnforcer.java
@@ -1,11 +1,8 @@
package mage.cards.t;
-import java.util.Objects;
-import java.util.UUID;
-
import mage.MageInt;
import mage.abilities.Ability;
-import mage.abilities.common.EntersBattlefieldControlledTriggeredAbility;
+import mage.abilities.common.EntersBattlefieldThisOrAnotherTriggeredAbility;
import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.condition.Condition;
import mage.abilities.decorator.ConditionalContinuousEffect;
@@ -25,6 +22,9 @@ import mage.game.Game;
import mage.game.Graveyard;
import mage.players.Player;
+import java.util.Objects;
+import java.util.UUID;
+
/**
* @author TheElk801
*/
@@ -44,10 +44,10 @@ public final class ThievesGuildEnforcer extends CardImpl {
this.addAbility(FlashAbility.getInstance());
// Whenever Thieves' Guild Enforcer or another Rogue enters the battlefield under your control, each opponent mills two cards.
- this.addAbility(new EntersBattlefieldControlledTriggeredAbility(
+ this.addAbility(new EntersBattlefieldThisOrAnotherTriggeredAbility(
new PutTopCardOfLibraryIntoGraveEachPlayerEffect(
2, TargetController.OPPONENT
- ), filter
+ ), filter, false, true
));
// As long as an opponent has eight or more cards in their graveyard, Thieves' Guild Enforcer gets +2/+1 and has deathtouch.
diff --git a/Mage.Sets/src/mage/cards/t/ThornMammoth.java b/Mage.Sets/src/mage/cards/t/ThornMammoth.java
index 6d5a1e9627..9435c6c1ac 100644
--- a/Mage.Sets/src/mage/cards/t/ThornMammoth.java
+++ b/Mage.Sets/src/mage/cards/t/ThornMammoth.java
@@ -2,7 +2,7 @@ package mage.cards.t;
import mage.MageInt;
import mage.abilities.Ability;
-import mage.abilities.common.EntersBattlefieldControlledTriggeredAbility;
+import mage.abilities.common.EntersBattlefieldThisOrAnotherTriggeredAbility;
import mage.abilities.effects.common.FightTargetSourceEffect;
import mage.abilities.keyword.TrampleAbility;
import mage.cards.CardImpl;
@@ -30,10 +30,9 @@ public final class ThornMammoth extends CardImpl {
this.addAbility(TrampleAbility.getInstance());
// Whenever Thorn Mammoth or another creature enters the battlefield under your control, Thorn Mammoth fights up to one target creature you don't control.
- Ability ability = new EntersBattlefieldControlledTriggeredAbility(
- new FightTargetSourceEffect(), StaticFilters.FILTER_PERMANENT_CREATURE,
- "Whenever {this} or another creature enters the battlefield under your control, " +
- "{this} fights up to one target creature you don't control."
+ Ability ability = new EntersBattlefieldThisOrAnotherTriggeredAbility(
+ new FightTargetSourceEffect().setText("{this} fights up to one target creature you don't control"),
+ StaticFilters.FILTER_PERMANENT_CREATURE, false, true
);
ability.addTarget(new TargetPermanent(0, 1, StaticFilters.FILTER_CREATURE_YOU_DONT_CONTROL, false));
this.addAbility(ability);
diff --git a/Mage.Sets/src/mage/cards/t/ThrasherBrute.java b/Mage.Sets/src/mage/cards/t/ThrasherBrute.java
index e841325ff7..640395a0e4 100644
--- a/Mage.Sets/src/mage/cards/t/ThrasherBrute.java
+++ b/Mage.Sets/src/mage/cards/t/ThrasherBrute.java
@@ -1,24 +1,24 @@
package mage.cards.t;
-import java.util.UUID;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.EntersBattlefieldAllTriggeredAbility;
import mage.abilities.effects.common.GainLifeEffect;
import mage.abilities.effects.common.LoseLifeTargetEffect;
-import mage.constants.SubType;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
+import mage.constants.SubType;
import mage.constants.Zone;
import mage.filter.common.FilterTeamPermanent;
import mage.game.Game;
import mage.game.permanent.Permanent;
import mage.target.common.TargetOpponent;
+import java.util.UUID;
+
/**
- *
* @author TheElk801
*/
public final class ThrasherBrute extends CardImpl {
@@ -35,12 +35,9 @@ public final class ThrasherBrute extends CardImpl {
// Whenever Thrasher Brute or another Warrior enters the battlefield under your team's control, target opponent loses 1 life and you gain 1 life.
Ability ability = new EntersBattlefieldAllTriggeredAbility(
- Zone.BATTLEFIELD,
- new LoseLifeTargetEffect(1),
- filter,
- false,
+ Zone.BATTLEFIELD, new LoseLifeTargetEffect(1), filter, false,
"Whenever {this} or another Warrior enters the battlefield under your team's control, "
- + "target opponent loses 1 life and you gain 1 life."
+ + "target opponent loses 1 life and you gain 1 life."
);
ability.addEffect(new GainLifeEffect(1));
ability.addTarget(new TargetOpponent());
@@ -63,8 +60,8 @@ class ThrasherBruteFilter extends FilterTeamPermanent {
super();
}
- ThrasherBruteFilter(final ThrasherBruteFilter effect) {
- super(effect);
+ private ThrasherBruteFilter(final ThrasherBruteFilter filter) {
+ super(filter);
}
@Override
@@ -74,16 +71,8 @@ class ThrasherBruteFilter extends FilterTeamPermanent {
@Override
public boolean match(Permanent permanent, UUID sourceId, UUID playerId, Game game) {
- if (super.match(permanent, sourceId, playerId, game)) {
- if (sourceId.equals(permanent.getId())) {
- return true;
- } else {
- if (permanent.hasSubtype(SubType.WARRIOR, game)) {
- return true;
- }
- }
- }
- return false;
+ return super.match(permanent, sourceId, playerId, game)
+ && (sourceId.equals(permanent.getId())
+ || permanent.hasSubtype(SubType.WARRIOR, game));
}
-
}
diff --git a/Mage.Sets/src/mage/cards/u/UneshCriosphinxSovereign.java b/Mage.Sets/src/mage/cards/u/UneshCriosphinxSovereign.java
index a3539f9a0a..61a7d71316 100644
--- a/Mage.Sets/src/mage/cards/u/UneshCriosphinxSovereign.java
+++ b/Mage.Sets/src/mage/cards/u/UneshCriosphinxSovereign.java
@@ -1,44 +1,33 @@
-
package mage.cards.u;
+import mage.MageInt;
+import mage.MageObject;
+import mage.abilities.Ability;
+import mage.abilities.common.EntersBattlefieldThisOrAnotherTriggeredAbility;
+import mage.abilities.common.SimpleStaticAbility;
+import mage.abilities.effects.OneShotEffect;
+import mage.abilities.effects.common.cost.SpellsCostReductionControllerEffect;
+import mage.abilities.keyword.FlyingAbility;
+import mage.cards.*;
+import mage.constants.*;
+import mage.filter.FilterCard;
+import mage.filter.FilterPermanent;
+import mage.game.Game;
+import mage.players.Player;
+import mage.target.TargetCard;
+
import java.util.ArrayList;
import java.util.List;
import java.util.Set;
import java.util.UUID;
-import mage.MageInt;
-import mage.MageObject;
-import mage.abilities.Ability;
-import mage.abilities.TriggeredAbilityImpl;
-import mage.abilities.common.SimpleStaticAbility;
-import mage.abilities.effects.OneShotEffect;
-import mage.abilities.effects.common.cost.SpellsCostReductionControllerEffect;
-import mage.abilities.keyword.FlyingAbility;
-import mage.cards.Card;
-import mage.cards.CardImpl;
-import mage.cards.CardSetInfo;
-import mage.cards.Cards;
-import mage.cards.CardsImpl;
-import mage.constants.CardType;
-import mage.constants.Outcome;
-import mage.constants.SubType;
-import mage.constants.SuperType;
-import mage.constants.Zone;
-import mage.filter.FilterCard;
-import mage.filter.common.FilterCreaturePermanent;
-import mage.game.Game;
-import mage.game.events.GameEvent;
-import mage.game.events.GameEvent.EventType;
-import mage.game.permanent.Permanent;
-import mage.players.Player;
-import mage.target.TargetCard;
/**
- *
* @author spjspj
*/
public final class UneshCriosphinxSovereign extends CardImpl {
private static final FilterCard filter = new FilterCard("Sphinx spells");
+ private static final FilterPermanent filter2 = new FilterPermanent(SubType.SPHINX, "Sphinx");
static {
filter.add(SubType.SPHINX.getPredicate());
@@ -56,13 +45,15 @@ public final class UneshCriosphinxSovereign extends CardImpl {
this.addAbility(FlyingAbility.getInstance());
// Sphinx spells you cast cost {2} less to cast.
- this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new SpellsCostReductionControllerEffect(filter, 2)));
+ this.addAbility(new SimpleStaticAbility(new SpellsCostReductionControllerEffect(filter, 2)));
// Whenever Unesh, Criosphinx Sovereign or another Sphinx enters the battlefield under your control, reveal the top four cards of your library. An opponent seperates those cards into two piles. Put one pile into your hand and the other into your graveyard.
- this.addAbility(new UneshCriosphinxSovereignTriggeredAbility());
+ this.addAbility(new EntersBattlefieldThisOrAnotherTriggeredAbility(
+ new UneshCriosphinxSovereignEffect(), filter2, false, true
+ ));
}
- public UneshCriosphinxSovereign(final UneshCriosphinxSovereign card) {
+ private UneshCriosphinxSovereign(final UneshCriosphinxSovereign card) {
super(card);
}
@@ -72,58 +63,14 @@ public final class UneshCriosphinxSovereign extends CardImpl {
}
}
-class UneshCriosphinxSovereignTriggeredAbility extends TriggeredAbilityImpl {
-
- private static final FilterCreaturePermanent filter = new FilterCreaturePermanent();
-
- static {
- filter.add(SubType.SPHINX.getPredicate());
- }
-
- public UneshCriosphinxSovereignTriggeredAbility() {
- super(Zone.BATTLEFIELD, new UneshCriosphinxSovereignEffect(), false);
- }
-
- public UneshCriosphinxSovereignTriggeredAbility(UneshCriosphinxSovereignTriggeredAbility ability) {
- super(ability);
- }
-
- @Override
- public boolean checkEventType(GameEvent event, Game game) {
- return event.getType() == EventType.ENTERS_THE_BATTLEFIELD;
- }
-
- @Override
- public boolean checkTrigger(GameEvent event, Game game) {
- Permanent permanent = game.getPermanent(event.getTargetId());
- if (permanent != null
- && permanent.isOwnedBy(controllerId)
- && permanent.isCreature()
- && (event.getTargetId().equals(getSourceId()) || filter.match(permanent, game))) {
- return true;
- }
- return false;
- }
-
- @Override
- public String getRule() {
- return "Whenever {this} or another Sphinx enters the battlefield under your control, " + super.getRule();
- }
-
- @Override
- public UneshCriosphinxSovereignTriggeredAbility copy() {
- return new UneshCriosphinxSovereignTriggeredAbility(this);
- }
-}
-
class UneshCriosphinxSovereignEffect extends OneShotEffect {
- public UneshCriosphinxSovereignEffect() {
+ UneshCriosphinxSovereignEffect() {
super(Outcome.DrawCard);
this.staticText = "reveal the top four cards of your library. An opponent separates those cards into two piles. Put one pile into your hand and the other into your graveyard";
}
- public UneshCriosphinxSovereignEffect(final UneshCriosphinxSovereignEffect effect) {
+ private UneshCriosphinxSovereignEffect(final UneshCriosphinxSovereignEffect effect) {
super(effect);
}
diff --git a/Mage/src/main/java/mage/abilities/abilityword/ConstellationAbility.java b/Mage/src/main/java/mage/abilities/abilityword/ConstellationAbility.java
index 5af021988b..1c5a4b23f5 100644
--- a/Mage/src/main/java/mage/abilities/abilityword/ConstellationAbility.java
+++ b/Mage/src/main/java/mage/abilities/abilityword/ConstellationAbility.java
@@ -53,7 +53,7 @@ public class ConstellationAbility extends TriggeredAbilityImpl {
return false;
}
Permanent permanent = game.getPermanent(event.getTargetId());
- return permanent != null && permanent.isEnchantment();
+ return permanent != null && ((thisOr && permanent.getId().equals(getSourceId())) || permanent.isEnchantment());
}
@Override
diff --git a/Mage/src/main/java/mage/abilities/common/EntersBattlefieldAllTriggeredAbility.java b/Mage/src/main/java/mage/abilities/common/EntersBattlefieldAllTriggeredAbility.java
index 3a7125f87a..41fb6e3d6d 100644
--- a/Mage/src/main/java/mage/abilities/common/EntersBattlefieldAllTriggeredAbility.java
+++ b/Mage/src/main/java/mage/abilities/common/EntersBattlefieldAllTriggeredAbility.java
@@ -1,7 +1,6 @@
package mage.abilities.common;
-import java.util.UUID;
import mage.abilities.TriggeredAbilityImpl;
import mage.abilities.effects.Effect;
import mage.constants.SetTargetPointer;
@@ -12,8 +11,9 @@ import mage.game.events.GameEvent;
import mage.game.permanent.Permanent;
import mage.target.targetpointer.FixedTarget;
+import java.util.UUID;
+
/**
- *
* @author LevelX2
*/
public class EntersBattlefieldAllTriggeredAbility extends TriggeredAbilityImpl {
@@ -22,6 +22,7 @@ public class EntersBattlefieldAllTriggeredAbility extends TriggeredAbilityImpl {
protected String rule;
protected boolean controlledText;
protected SetTargetPointer setTargetPointer;
+ protected final boolean thisOrAnother;
/**
* zone = BATTLEFIELD optional = false
@@ -54,11 +55,16 @@ public class EntersBattlefieldAllTriggeredAbility extends TriggeredAbilityImpl {
}
public EntersBattlefieldAllTriggeredAbility(Zone zone, Effect effect, FilterPermanent filter, boolean optional, SetTargetPointer setTargetPointer, String rule, boolean controlledText) {
+ this(zone, effect, filter, optional, setTargetPointer, rule, controlledText, false);
+ }
+
+ protected EntersBattlefieldAllTriggeredAbility(Zone zone, Effect effect, FilterPermanent filter, boolean optional, SetTargetPointer setTargetPointer, String rule, boolean controlledText, boolean thisOrAnother) {
super(zone, effect, optional);
this.filter = filter;
this.rule = rule;
this.controlledText = controlledText;
this.setTargetPointer = setTargetPointer;
+ this.thisOrAnother = thisOrAnother;
}
public EntersBattlefieldAllTriggeredAbility(final EntersBattlefieldAllTriggeredAbility ability) {
@@ -67,6 +73,7 @@ public class EntersBattlefieldAllTriggeredAbility extends TriggeredAbilityImpl {
this.rule = ability.rule;
this.controlledText = ability.controlledText;
this.setTargetPointer = ability.setTargetPointer;
+ this.thisOrAnother = ability.thisOrAnother;
}
@Override
@@ -105,7 +112,11 @@ public class EntersBattlefieldAllTriggeredAbility extends TriggeredAbilityImpl {
if (rule != null && !rule.isEmpty()) {
return rule;
}
- StringBuilder sb = new StringBuilder("Whenever ").append(filter.getMessage());
+ StringBuilder sb = new StringBuilder("Whenever ");
+ if (thisOrAnother) {
+ sb.append("{this} or another ");
+ }
+ sb.append(filter.getMessage());
sb.append(" enters the battlefield");
if (controlledText) {
sb.append(" under your control, ");
diff --git a/Mage/src/main/java/mage/abilities/common/EntersBattlefieldThisOrAnotherTriggeredAbility.java b/Mage/src/main/java/mage/abilities/common/EntersBattlefieldThisOrAnotherTriggeredAbility.java
new file mode 100644
index 0000000000..ce631a0a3b
--- /dev/null
+++ b/Mage/src/main/java/mage/abilities/common/EntersBattlefieldThisOrAnotherTriggeredAbility.java
@@ -0,0 +1,62 @@
+package mage.abilities.common;
+
+import mage.abilities.effects.Effect;
+import mage.constants.SetTargetPointer;
+import mage.constants.Zone;
+import mage.filter.FilterPermanent;
+import mage.game.Game;
+import mage.game.events.GameEvent;
+import mage.game.permanent.Permanent;
+
+/**
+ * @author TheElk801
+ */
+public class EntersBattlefieldThisOrAnotherTriggeredAbility extends EntersBattlefieldAllTriggeredAbility {
+
+ private final boolean onlyControlled;
+
+ public EntersBattlefieldThisOrAnotherTriggeredAbility(Effect effect, FilterPermanent filter) {
+ this(effect, filter, false, false);
+ }
+
+ public EntersBattlefieldThisOrAnotherTriggeredAbility(Effect effect, FilterPermanent filter, boolean optional, boolean onlyControlled) {
+ this(effect, filter, optional, SetTargetPointer.NONE, onlyControlled);
+ }
+
+ public EntersBattlefieldThisOrAnotherTriggeredAbility(Effect effect, FilterPermanent filter, boolean optional, SetTargetPointer setTargetPointer, boolean onlyControlled) {
+ this(Zone.BATTLEFIELD, effect, filter, optional, setTargetPointer, onlyControlled);
+ }
+
+ public EntersBattlefieldThisOrAnotherTriggeredAbility(Zone zone, Effect effect, FilterPermanent filter, boolean optional, SetTargetPointer setTargetPointer, boolean onlyControlled) {
+ super(zone, effect, filter, optional, setTargetPointer, null, onlyControlled, true);
+ this.onlyControlled = onlyControlled;
+ }
+
+ private EntersBattlefieldThisOrAnotherTriggeredAbility(final EntersBattlefieldThisOrAnotherTriggeredAbility ability) {
+ super(ability);
+ this.onlyControlled = ability.onlyControlled;
+ }
+
+ @Override
+ public boolean checkTrigger(GameEvent event, Game game) {
+ if (!super.checkTrigger(event, game)) {
+ return false;
+ }
+ Permanent permanent = game.getPermanent(event.getTargetId());
+ if (permanent == null) {
+ return false;
+ }
+ if (permanent.getId().equals(getSourceId())) {
+ return true;
+ }
+ if (onlyControlled && !permanent.isControlledBy(this.getControllerId())) {
+ return false;
+ }
+ return filter.match(permanent, getSourceId(), getControllerId(), game);
+ }
+
+ @Override
+ public EntersBattlefieldThisOrAnotherTriggeredAbility copy() {
+ return new EntersBattlefieldThisOrAnotherTriggeredAbility(this);
+ }
+}
diff --git a/Mage/src/main/java/mage/filter/StaticFilters.java b/Mage/src/main/java/mage/filter/StaticFilters.java
index 2a0dc193e1..1727c44168 100644
--- a/Mage/src/main/java/mage/filter/StaticFilters.java
+++ b/Mage/src/main/java/mage/filter/StaticFilters.java
@@ -615,13 +615,7 @@ public final class StaticFilters {
FILTER_PERMANENT_AURA.setLockedFilter(true);
}
- public static final FilterPermanent FILTER_PERMANENT_EQUIPMENT = new FilterPermanent();
-
- static {
- FILTER_PERMANENT_EQUIPMENT.add(CardType.ARTIFACT.getPredicate());
- FILTER_PERMANENT_EQUIPMENT.add(SubType.EQUIPMENT.getPredicate());
- FILTER_PERMANENT_EQUIPMENT.setLockedFilter(true);
- }
+ public static final FilterPermanent FILTER_PERMANENT_EQUIPMENT = new FilterEquipmentPermanent();
public static final FilterPermanent FILTER_PERMANENT_FORTIFICATION = new FilterPermanent();
diff --git a/Mage/src/main/java/mage/filter/common/FilterEquipmentPermanent.java b/Mage/src/main/java/mage/filter/common/FilterEquipmentPermanent.java
index 34d729d289..40748c5e52 100644
--- a/Mage/src/main/java/mage/filter/common/FilterEquipmentPermanent.java
+++ b/Mage/src/main/java/mage/filter/common/FilterEquipmentPermanent.java
@@ -12,7 +12,7 @@ import mage.filter.FilterPermanent;
public class FilterEquipmentPermanent extends FilterPermanent {
public FilterEquipmentPermanent() {
- this("equipment");
+ this("Equipment");
}
public FilterEquipmentPermanent(String name) {