diff --git a/Mage.Sets/src/mage/cards/a/AbandonedSarcophagus.java b/Mage.Sets/src/mage/cards/a/AbandonedSarcophagus.java
index 2fcc2311642c..362aaf135f2b 100644
--- a/Mage.Sets/src/mage/cards/a/AbandonedSarcophagus.java
+++ b/Mage.Sets/src/mage/cards/a/AbandonedSarcophagus.java
@@ -58,7 +58,7 @@ class AbandonedSarcophagusReplacementEffect extends ReplacementEffectImpl {
AbandonedSarcophagusReplacementEffect() {
super(Duration.WhileOnBattlefield, Outcome.Exile);
- staticText = "If a card with cycling would be put into your graveyard from anywhere and it wasn't cycled, exile it instead";
+ staticText = "If a card that has a cycling ability would be put into your graveyard from anywhere and it wasn't cycled, exile it instead";
}
private AbandonedSarcophagusReplacementEffect(final AbandonedSarcophagusReplacementEffect effect) {
diff --git a/Mage.Sets/src/mage/cards/a/AkutaBornOfAsh.java b/Mage.Sets/src/mage/cards/a/AkutaBornOfAsh.java
index ea228730a7b6..72066fa703da 100644
--- a/Mage.Sets/src/mage/cards/a/AkutaBornOfAsh.java
+++ b/Mage.Sets/src/mage/cards/a/AkutaBornOfAsh.java
@@ -1,13 +1,9 @@
-
package mage.cards.a;
-import java.util.UUID;
import mage.MageInt;
-import mage.abilities.Ability;
import mage.abilities.common.BeginningOfUpkeepTriggeredAbility;
import mage.abilities.condition.common.MoreCardsInHandThanOpponentsCondition;
import mage.abilities.costs.common.SacrificeTargetCost;
-import mage.abilities.decorator.ConditionalInterveningIfTriggeredAbility;
import mage.abilities.effects.common.DoIfCostPaid;
import mage.abilities.effects.common.ReturnSourceFromGraveyardToBattlefieldEffect;
import mage.abilities.keyword.HasteAbility;
@@ -15,7 +11,8 @@
import mage.cards.CardSetInfo;
import mage.constants.*;
import mage.filter.common.FilterControlledPermanent;
-import mage.target.common.TargetControlledPermanent;
+
+import java.util.UUID;
/**
*
@@ -38,14 +35,11 @@ public AkutaBornOfAsh(UUID ownerId, CardSetInfo setInfo) {
// Haste
this.addAbility(HasteAbility.getInstance());
+
// At the beginning of your upkeep, if you have more cards in hand than each opponent, you may sacrifice a Swamp. If you do, return Akuta, Born of Ash from your graveyard to the battlefield.
- Ability ability = new ConditionalInterveningIfTriggeredAbility(
- new BeginningOfUpkeepTriggeredAbility(Zone.GRAVEYARD,
- new DoIfCostPaid(new ReturnSourceFromGraveyardToBattlefieldEffect(), new SacrificeTargetCost(filterSwamp)),
- TargetController.YOU, false),
- MoreCardsInHandThanOpponentsCondition.instance,
- "At the beginning of your upkeep, if you have more cards in hand than each opponent, you may sacrifice a Swamp. If you do, return {this} from your graveyard to the battlefield.");
- this.addAbility(ability);
+ this.addAbility(new BeginningOfUpkeepTriggeredAbility(Zone.GRAVEYARD,
+ new DoIfCostPaid(new ReturnSourceFromGraveyardToBattlefieldEffect(), new SacrificeTargetCost(filterSwamp)),
+ TargetController.YOU, false).withInterveningIf(MoreCardsInHandThanOpponentsCondition.instance));
}
private AkutaBornOfAsh(final AkutaBornOfAsh card) {
diff --git a/Mage.Sets/src/mage/cards/a/ArahboRoarOfTheWorld.java b/Mage.Sets/src/mage/cards/a/ArahboRoarOfTheWorld.java
index 44d05f590247..60af357295bb 100644
--- a/Mage.Sets/src/mage/cards/a/ArahboRoarOfTheWorld.java
+++ b/Mage.Sets/src/mage/cards/a/ArahboRoarOfTheWorld.java
@@ -1,4 +1,3 @@
-
package mage.cards.a;
import mage.MageInt;
@@ -7,7 +6,6 @@
import mage.abilities.common.BeginningOfCombatTriggeredAbility;
import mage.abilities.condition.common.SourceOnBattlefieldOrCommandZoneCondition;
import mage.abilities.costs.mana.ManaCostsImpl;
-import mage.abilities.decorator.ConditionalInterveningIfTriggeredAbility;
import mage.abilities.effects.ContinuousEffect;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.common.DoIfCostPaid;
@@ -54,19 +52,18 @@ public ArahboRoarOfTheWorld(UUID ownerId, CardSetInfo setInfo) {
this.toughness = new MageInt(5);
// Eminence — At the beginning of combat on your turn, if Arahbo, Roar of the World is in the command zone or on the battlefield, another target Cat you control gets +3/+3 until end of turn.
- Ability ability = new ConditionalInterveningIfTriggeredAbility(
- new BeginningOfCombatTriggeredAbility(Zone.ALL, new BoostTargetEffect(3, 3, Duration.EndOfTurn), TargetController.YOU, false, false),
- SourceOnBattlefieldOrCommandZoneCondition.instance,
- "At the beginning of combat on your turn, if {this} is in the command zone or on the battlefield, another target Cat you control gets +3/+3 until end of turn.");
+ Ability ability = new BeginningOfCombatTriggeredAbility(Zone.ALL,
+ new BoostTargetEffect(3, 3, Duration.EndOfTurn),
+ TargetController.YOU, false, false).withInterveningIf(
+ SourceOnBattlefieldOrCommandZoneCondition.instance);
ability.addTarget(new TargetCreaturePermanent(filter));
ability.setAbilityWord(AbilityWord.EMINENCE);
this.addAbility(ability);
// Whenever another Cat you control attacks, you may pay {1}{G}{W}. If you do, it gains trample and gets +X/+X until end of turn, where X is its power.
-// Effect effect = new DoIfCostPaid(new ArahboEffect(), new ManaCostsImpl<>("{1}{G}{W}"));
- ability = new AttacksCreatureYouControlTriggeredAbility(
- new DoIfCostPaid(new ArahboEffect(), new ManaCostsImpl<>("{1}{G}{W}")), false, filter2, true);
- this.addAbility(ability);
+ this.addAbility(new AttacksCreatureYouControlTriggeredAbility(new DoIfCostPaid(
+ new ArahboEffect(), new ManaCostsImpl<>("{1}{G}{W}")
+ ), false, filter2, true));
}
private ArahboRoarOfTheWorld(final ArahboRoarOfTheWorld card) {
diff --git a/Mage.Sets/src/mage/cards/a/ArdenAngel.java b/Mage.Sets/src/mage/cards/a/ArdenAngel.java
index 42f06cc0430f..6f615eb6f0b0 100644
--- a/Mage.Sets/src/mage/cards/a/ArdenAngel.java
+++ b/Mage.Sets/src/mage/cards/a/ArdenAngel.java
@@ -4,7 +4,6 @@
import mage.abilities.Ability;
import mage.abilities.common.BeginningOfUpkeepTriggeredAbility;
import mage.abilities.condition.common.SourceInGraveyardCondition;
-import mage.abilities.decorator.ConditionalInterveningIfTriggeredAbility;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.keyword.FlyingAbility;
import mage.cards.Card;
@@ -32,11 +31,8 @@ public ArdenAngel(UUID ownerId, CardSetInfo setInfo) {
this.addAbility(FlyingAbility.getInstance());
// At the beginning of your upkeep, if Arden Angel is in your graveyard, roll a four-sided die. If the result is 1, return Arden Angel from your graveyard to the battlefield.
- this.addAbility(new ConditionalInterveningIfTriggeredAbility(
- new BeginningOfUpkeepTriggeredAbility(new ArdenAngelEffect(), TargetController.YOU, false),
- SourceInGraveyardCondition.instance, "At the beginning of your upkeep, if {this} is in your graveyard, " +
- "roll a four-sided die. If the result is 1, return {this} from your graveyard to the battlefield."
- ));
+ this.addAbility(new BeginningOfUpkeepTriggeredAbility(Zone.GRAVEYARD, new ArdenAngelEffect(), TargetController.YOU, false)
+ .withInterveningIf(SourceInGraveyardCondition.instance));
}
private ArdenAngel(final ArdenAngel card) {
@@ -53,6 +49,7 @@ class ArdenAngelEffect extends OneShotEffect {
ArdenAngelEffect() {
super(Outcome.Benefit);
+ this.staticText = "roll a four-sided die. If the result is 1, return {this} from your graveyard to the battlefield";
}
private ArdenAngelEffect(final ArdenAngelEffect effect) {
diff --git a/Mage.Sets/src/mage/cards/a/AuntiesSnitch.java b/Mage.Sets/src/mage/cards/a/AuntiesSnitch.java
index 670329993b42..cc27792c2ed5 100644
--- a/Mage.Sets/src/mage/cards/a/AuntiesSnitch.java
+++ b/Mage.Sets/src/mage/cards/a/AuntiesSnitch.java
@@ -1,24 +1,21 @@
-
package mage.cards.a;
-import java.util.UUID;
import mage.MageInt;
-import mage.abilities.TriggeredAbilityImpl;
import mage.abilities.common.CantBlockAbility;
-import mage.abilities.effects.common.ReturnToHandSourceEffect;
+import mage.abilities.common.DealsDamageToAPlayerAllTriggeredAbility;
+import mage.abilities.condition.common.SourceInGraveyardCondition;
+import mage.abilities.effects.common.ReturnSourceFromGraveyardToHandEffect;
import mage.abilities.keyword.ProwlAbility;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
+import mage.constants.SetTargetPointer;
import mage.constants.SubType;
-import mage.constants.TargetController;
import mage.constants.Zone;
-import mage.filter.common.FilterCreaturePermanent;
+import mage.filter.common.FilterControlledCreaturePermanent;
import mage.filter.predicate.Predicates;
-import mage.game.Game;
-import mage.game.events.DamagedPlayerEvent;
-import mage.game.events.GameEvent;
-import mage.game.permanent.Permanent;
+
+import java.util.UUID;
/**
*
@@ -26,6 +23,11 @@
*/
public final class AuntiesSnitch extends CardImpl {
+ private static final FilterControlledCreaturePermanent filter = new FilterControlledCreaturePermanent("Goblin or Rogue you control");
+ static {
+ filter.add(Predicates.or(SubType.GOBLIN.getPredicate(), SubType.ROGUE.getPredicate()));
+ }
+
public AuntiesSnitch(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{2}{B}");
this.subtype.add(SubType.GOBLIN);
@@ -36,10 +38,15 @@ public AuntiesSnitch(UUID ownerId, CardSetInfo setInfo) {
// Auntie's Snitch can't block.
this.addAbility(new CantBlockAbility());
+
// Prowl {1}{B}
this.addAbility(new ProwlAbility("{1}{B}"));
+
// Whenever a Goblin or Rogue you control deals combat damage to a player, if Auntie's Snitch is in your graveyard, you may return Auntie's Snitch to your hand.
- this.addAbility(new AuntiesSnitchTriggeredAbility());
+ this.addAbility(new DealsDamageToAPlayerAllTriggeredAbility(Zone.GRAVEYARD,
+ new ReturnSourceFromGraveyardToHandEffect().setText("return {this} to your hand"),
+ filter, true, SetTargetPointer.NONE, true, false
+ ).withInterveningIf(SourceInGraveyardCondition.instance));
}
private AuntiesSnitch(final AuntiesSnitch card) {
@@ -51,42 +58,3 @@ public AuntiesSnitch copy() {
return new AuntiesSnitch(this);
}
}
-
-class AuntiesSnitchTriggeredAbility extends TriggeredAbilityImpl {
-
- private static final FilterCreaturePermanent filter = new FilterCreaturePermanent("Goblin or Rogue you control");
- static {
- filter.add(TargetController.YOU.getControllerPredicate());
- filter.add(Predicates.or(SubType.GOBLIN.getPredicate(), SubType.ROGUE.getPredicate()));
- }
-
- public AuntiesSnitchTriggeredAbility() {
- super(Zone.GRAVEYARD, new ReturnToHandSourceEffect(), true);
- }
-
- private AuntiesSnitchTriggeredAbility(final AuntiesSnitchTriggeredAbility ability) {
- super(ability);
- }
-
- @Override
- public AuntiesSnitchTriggeredAbility copy() {
- return new AuntiesSnitchTriggeredAbility(this);
- }
-
- @Override
- public boolean checkEventType(GameEvent event, Game game) {
- return event.getType() == GameEvent.EventType.DAMAGED_PLAYER;
- }
-
- @Override
- public boolean checkTrigger(GameEvent event, Game game) {
- DamagedPlayerEvent damageEvent = (DamagedPlayerEvent)event;
- Permanent p = game.getPermanent(event.getSourceId());
- return damageEvent.isCombatDamage() && filter.match(p, getControllerId(), this, game);
- }
-
- @Override
- public String getRule() {
- return "Whenever a Goblin or Rogue you control deals combat damage to a player, if {this} is in your graveyard, you may return {this} to your hand.";
- }
-}
diff --git a/Mage.Sets/src/mage/cards/b/BarbedWire.java b/Mage.Sets/src/mage/cards/b/BarbedWire.java
index d5b838e92b26..f62f7be8f591 100644
--- a/Mage.Sets/src/mage/cards/b/BarbedWire.java
+++ b/Mage.Sets/src/mage/cards/b/BarbedWire.java
@@ -1,41 +1,36 @@
package mage.cards.b;
-import java.util.UUID;
import mage.abilities.Ability;
import mage.abilities.common.BeginningOfUpkeepTriggeredAbility;
import mage.abilities.common.SimpleActivatedAbility;
import mage.abilities.costs.mana.ManaCostsImpl;
-import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.PreventionEffectImpl;
+import mage.abilities.effects.common.DamageTargetEffect;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.Duration;
-import mage.constants.Outcome;
import mage.constants.TargetController;
import mage.constants.Zone;
import mage.game.Game;
import mage.game.events.GameEvent;
-import mage.players.Player;
+
+import java.util.UUID;
/**
- *
* @author jeffwadsworth
*/
public final class BarbedWire extends CardImpl {
- private static final String rule = "At the beginning of each player's upkeep, "
- + "Barbed Wire deals 1 damage to that player.";
-
public BarbedWire(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.ARTIFACT}, "{3}");
// At the beginning of each player's upkeep, Barbed Wire deals 1 damage to that player.
this.addAbility(new BeginningOfUpkeepTriggeredAbility(
Zone.BATTLEFIELD,
- new BarbwireDamageEffect(),
+ new DamageTargetEffect(1).withTargetDescription("that player"),
TargetController.ACTIVE,
- false, true, rule));
+ false, true));
// {2}: Prevent the next 1 damage that would be dealt by Barbed Wire this turn.
this.addAbility(new SimpleActivatedAbility(
@@ -53,34 +48,6 @@ public BarbedWire copy() {
}
}
-class BarbwireDamageEffect extends OneShotEffect {
-
- BarbwireDamageEffect() {
- super(Outcome.Damage);
- this.staticText = "";
- }
-
- private BarbwireDamageEffect(final BarbwireDamageEffect effect) {
- super(effect);
- }
-
- @Override
- public BarbwireDamageEffect copy() {
- return new BarbwireDamageEffect(this);
- }
-
- @Override
- public boolean apply(Game game, Ability source) {
- Player activePlayer = game.getPlayer(getTargetPointer().getFirst(game, source));
- if (activePlayer != null) {
- activePlayer.damage(1, source.getSourceId(), source, game);
- return true;
- }
-
- return false;
- }
-}
-
class BarbedWirePreventionEffect extends PreventionEffectImpl {
BarbedWirePreventionEffect() {
diff --git a/Mage.Sets/src/mage/cards/b/BloodOperative.java b/Mage.Sets/src/mage/cards/b/BloodOperative.java
index 215ac526d599..15708ace7502 100644
--- a/Mage.Sets/src/mage/cards/b/BloodOperative.java
+++ b/Mage.Sets/src/mage/cards/b/BloodOperative.java
@@ -5,6 +5,7 @@
import mage.abilities.Ability;
import mage.abilities.common.EntersBattlefieldTriggeredAbility;
import mage.abilities.common.SurveilTriggeredAbility;
+import mage.abilities.condition.common.SourceInGraveyardCondition;
import mage.abilities.costs.common.PayLifeCost;
import mage.abilities.effects.common.DoIfCostPaid;
import mage.abilities.effects.common.ExileTargetEffect;
@@ -42,7 +43,7 @@ public BloodOperative(UUID ownerId, CardSetInfo setInfo) {
// Whenever you surveil, if Blood Operative is in your graveyard, you may pay 3 life. If you do, return Blood Operative to your hand.
this.addAbility(new SurveilTriggeredAbility(Zone.GRAVEYARD, new DoIfCostPaid(
new ReturnSourceFromGraveyardToHandEffect().setText("return {this} to your hand"), new PayLifeCost(3)
- )));
+ )).withInterveningIf(SourceInGraveyardCondition.instance));
}
private BloodOperative(final BloodOperative card) {
diff --git a/Mage.Sets/src/mage/cards/b/BridgeFromBelow.java b/Mage.Sets/src/mage/cards/b/BridgeFromBelow.java
index dedb23d9374e..a89d8103604a 100644
--- a/Mage.Sets/src/mage/cards/b/BridgeFromBelow.java
+++ b/Mage.Sets/src/mage/cards/b/BridgeFromBelow.java
@@ -1,7 +1,7 @@
package mage.cards.b;
-import java.util.UUID;
import mage.abilities.TriggeredAbilityImpl;
+import mage.abilities.condition.common.SourceInGraveyardCondition;
import mage.abilities.effects.Effect;
import mage.abilities.effects.common.CreateTokenEffect;
import mage.abilities.effects.common.ExileSourceEffect;
@@ -17,7 +17,8 @@
import mage.game.events.ZoneChangeEvent;
import mage.game.permanent.Permanent;
import mage.game.permanent.token.ZombieToken;
-import mage.players.Player;
+
+import java.util.UUID;
/**
*
@@ -25,8 +26,8 @@
*/
public final class BridgeFromBelow extends CardImpl {
- private static final FilterCreaturePermanent filter1 = new FilterCreaturePermanent("Whenever a nontoken creature is put into your graveyard from the battlefield");
- private static final FilterCreaturePermanent filter2 = new FilterCreaturePermanent("When a creature is put into an opponent's graveyard from the battlefield");
+ private static final FilterCreaturePermanent filter1 = new FilterCreaturePermanent("Whenever a nontoken creature is put into your graveyard from the battlefield, ");
+ private static final FilterCreaturePermanent filter2 = new FilterCreaturePermanent("When a creature is put into an opponent's graveyard from the battlefield, ");
static {
filter1.add(TargetController.YOU.getOwnerPredicate());
@@ -59,10 +60,11 @@ class BridgeFromBelowAbility extends TriggeredAbilityImpl {
private final FilterCreaturePermanent filter;
- public BridgeFromBelowAbility(Effect effect, FilterCreaturePermanent filter) {
+ BridgeFromBelowAbility(Effect effect, FilterCreaturePermanent filter) {
super(Zone.GRAVEYARD, effect, false);
this.filter = filter;
- setTriggerPhrase(filter.getMessage() + ", if {this} is in your graveyard, ");
+ this.withInterveningIf(SourceInGraveyardCondition.instance);
+ setTriggerPhrase(filter.getMessage());
}
private BridgeFromBelowAbility(final BridgeFromBelowAbility ability) {
@@ -82,23 +84,11 @@ public boolean checkEventType(GameEvent event, Game game) {
@Override
public boolean checkTrigger(GameEvent event, Game game) {
- ZoneChangeEvent zEvent = (ZoneChangeEvent) event;
- if (!zEvent.isDiesEvent()) {
- return false;
- }
-
Permanent permanent = (Permanent) game.getLastKnownInformation(event.getTargetId(), Zone.BATTLEFIELD);
- if (permanent == null) {
+ if (permanent == null || !((ZoneChangeEvent) event).isDiesEvent()) {
return false;
}
-
return filter.match(permanent, controllerId, this, game);
}
- @Override
- public boolean checkInterveningIfClause(Game game) {
- Player controller = game.getPlayer(this.getControllerId());
- return controller != null
- && controller.getGraveyard().contains(this.getSourceId());
- }
}
diff --git a/Mage.Sets/src/mage/cards/c/CoercivePortal.java b/Mage.Sets/src/mage/cards/c/CoercivePortal.java
index bb6b78084016..dd572d3951be 100644
--- a/Mage.Sets/src/mage/cards/c/CoercivePortal.java
+++ b/Mage.Sets/src/mage/cards/c/CoercivePortal.java
@@ -7,10 +7,7 @@
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.choices.TwoChoiceVote;
-import mage.constants.CardType;
-import mage.constants.Outcome;
-import mage.constants.TargetController;
-import mage.constants.Zone;
+import mage.constants.*;
import mage.filter.StaticFilters;
import mage.game.Game;
import mage.game.permanent.Permanent;
@@ -29,11 +26,8 @@ public CoercivePortal(UUID ownerId, CardSetInfo setInfo) {
// Will of the council - At the beginning of your upkeep, starting with you, each player votes for carnage or homage. If carnage gets more votes, sacrifice Coercive Portal and destroy all nonland permanents. If homage gets more votes or the vote is tied, draw a card.
this.addAbility(new BeginningOfUpkeepTriggeredAbility(
Zone.BATTLEFIELD, new CoercivePortalEffect(), TargetController.YOU,
- false, false, "Will of the council — " +
- "At the beginning of your upkeep, starting with you, each player votes for carnage or homage. " +
- "If carnage gets more votes, sacrifice {this} and destroy all nonland permanents. " +
- "If homage gets more votes or the vote is tied, draw a card."
- ));
+ false, false
+ ).setAbilityWord(AbilityWord.WILL_OF_THE_COUNCIL));
}
private CoercivePortal(final CoercivePortal card) {
@@ -50,6 +44,9 @@ class CoercivePortalEffect extends OneShotEffect {
CoercivePortalEffect() {
super(Outcome.Benefit);
+ this.staticText = "starting with you, each player votes for carnage or homage. " +
+ "If carnage gets more votes, sacrifice {this} and destroy all nonland permanents. " +
+ "If homage gets more votes or the vote is tied, draw a card";
}
private CoercivePortalEffect(final CoercivePortalEffect effect) {
diff --git a/Mage.Sets/src/mage/cards/c/CurseArtifact.java b/Mage.Sets/src/mage/cards/c/CurseArtifact.java
index 5add3042a20e..0b3197e8cfc6 100644
--- a/Mage.Sets/src/mage/cards/c/CurseArtifact.java
+++ b/Mage.Sets/src/mage/cards/c/CurseArtifact.java
@@ -1,7 +1,5 @@
-
package mage.cards.c;
-import java.util.UUID;
import mage.abilities.common.BeginningOfUpkeepTriggeredAbility;
import mage.abilities.costs.Cost;
import mage.abilities.costs.common.SacrificeAttachedCost;
@@ -12,14 +10,12 @@
import mage.abilities.keyword.EnchantAbility;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
-import mage.constants.CardType;
-import mage.constants.SubType;
-import mage.constants.Outcome;
-import mage.constants.TargetController;
-import mage.constants.Zone;
+import mage.constants.*;
import mage.target.TargetPermanent;
import mage.target.common.TargetArtifactPermanent;
+import java.util.UUID;
+
/**
*
* @author LoneFox & L_J
@@ -41,7 +37,8 @@ public CurseArtifact(UUID ownerId, CardSetInfo setInfo) {
cost.setText("sacrifice attached artifact");
Effect effect = new DoUnlessTargetPlayerOrTargetsControllerPaysEffect(new DamageTargetEffect(2), cost, "Sacrifice enchanted artifact? (otherwise {this} deals 2 damage to you)");
effect.setText("{this} deals 2 damage to that player unless they sacrifice that artifact");
- this.addAbility(new BeginningOfUpkeepTriggeredAbility(Zone.BATTLEFIELD, effect, TargetController.CONTROLLER_ATTACHED_TO, false, true, "At the beginning of the upkeep of enchanted artifact's controller, "));
+ this.addAbility(new BeginningOfUpkeepTriggeredAbility(Zone.BATTLEFIELD, effect, TargetController.CONTROLLER_ATTACHED_TO, false, true)
+ .setTriggerPhrase("At the beginning of the upkeep of enchanted artifact's controller, "));
}
private CurseArtifact(final CurseArtifact card) {
diff --git a/Mage.Sets/src/mage/cards/d/DeathOfAThousandStings.java b/Mage.Sets/src/mage/cards/d/DeathOfAThousandStings.java
index 08a931490047..fa4c65a8b3b6 100644
--- a/Mage.Sets/src/mage/cards/d/DeathOfAThousandStings.java
+++ b/Mage.Sets/src/mage/cards/d/DeathOfAThousandStings.java
@@ -1,11 +1,7 @@
-
package mage.cards.d;
-import mage.abilities.Ability;
import mage.abilities.common.BeginningOfUpkeepTriggeredAbility;
import mage.abilities.condition.common.MoreCardsInHandThanOpponentsCondition;
-import mage.abilities.decorator.ConditionalInterveningIfTriggeredAbility;
-import mage.abilities.effects.Effect;
import mage.abilities.effects.common.GainLifeEffect;
import mage.abilities.effects.common.LoseLifeTargetEffect;
import mage.abilities.effects.common.ReturnSourceFromGraveyardToHandEffect;
@@ -32,18 +28,12 @@ public DeathOfAThousandStings(UUID ownerId, CardSetInfo setInfo) {
// Target player loses 1 life and you gain 1 life.
this.getSpellAbility().addEffect(new LoseLifeTargetEffect(1));
this.getSpellAbility().addTarget(new TargetPlayer());
- Effect effect = new GainLifeEffect(1);
- effect.setText("and you gain 1 life");
- this.getSpellAbility().addEffect(effect);
+ this.getSpellAbility().addEffect(new GainLifeEffect(1).concatBy("and"));
// At the beginning of your upkeep, if you have more cards in hand than each opponent, you may return Death of a Thousand Stings from your graveyard to your hand.
- Ability ability = new ConditionalInterveningIfTriggeredAbility(
- new BeginningOfUpkeepTriggeredAbility(Zone.GRAVEYARD,
- new ReturnSourceFromGraveyardToHandEffect(),
- TargetController.YOU, true),
- MoreCardsInHandThanOpponentsCondition.instance,
- "At the beginning of your upkeep, if you have more cards in hand than each opponent, you may return {this} from your graveyard to your hand.");
- this.addAbility(ability);
+ this.addAbility(new BeginningOfUpkeepTriggeredAbility(Zone.GRAVEYARD,
+ new ReturnSourceFromGraveyardToHandEffect(),
+ TargetController.YOU, true).withInterveningIf(MoreCardsInHandThanOpponentsCondition.instance));
}
private DeathOfAThousandStings(final DeathOfAThousandStings card) {
diff --git a/Mage.Sets/src/mage/cards/e/Erosion.java b/Mage.Sets/src/mage/cards/e/Erosion.java
index 61d8aaea8406..8cef7b1832a7 100644
--- a/Mage.Sets/src/mage/cards/e/Erosion.java
+++ b/Mage.Sets/src/mage/cards/e/Erosion.java
@@ -1,7 +1,5 @@
-
package mage.cards.e;
-import java.util.UUID;
import mage.abilities.common.BeginningOfUpkeepTriggeredAbility;
import mage.abilities.costs.OrCost;
import mage.abilities.costs.common.PayLifeCost;
@@ -13,14 +11,12 @@
import mage.abilities.keyword.EnchantAbility;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
-import mage.constants.CardType;
-import mage.constants.SubType;
-import mage.constants.Outcome;
-import mage.constants.TargetController;
-import mage.constants.Zone;
+import mage.constants.*;
import mage.target.TargetPermanent;
import mage.target.common.TargetLandPermanent;
+import java.util.UUID;
+
/**
*
* @author LoneFox & L_J
@@ -40,7 +36,8 @@ public Erosion(UUID ownerId, CardSetInfo setInfo) {
// At the beginning of the upkeep of enchanted land's controller, destroy that land unless that player pays {1} or 1 life.
Effect effect = new DoUnlessTargetPlayerOrTargetsControllerPaysEffect(new DestroyAttachedToEffect("enchanted land"), new OrCost("{1} or 1 life", new ManaCostsImpl<>("{1}"), new PayLifeCost(1)));
effect.setText("destroy that land unless that player pays {1} or 1 life");
- this.addAbility(new BeginningOfUpkeepTriggeredAbility(Zone.BATTLEFIELD, effect, TargetController.CONTROLLER_ATTACHED_TO, false, true, "At the beginning of the upkeep of enchanted land's controller, "));
+ this.addAbility(new BeginningOfUpkeepTriggeredAbility(Zone.BATTLEFIELD, effect, TargetController.CONTROLLER_ATTACHED_TO, false, true)
+ .setTriggerPhrase("At the beginning of the upkeep of enchanted land's controller, "));
}
private Erosion(final Erosion card) {
diff --git a/Mage.Sets/src/mage/cards/e/ExileIntoDarkness.java b/Mage.Sets/src/mage/cards/e/ExileIntoDarkness.java
index 8067eb46fa01..7b71386b1396 100644
--- a/Mage.Sets/src/mage/cards/e/ExileIntoDarkness.java
+++ b/Mage.Sets/src/mage/cards/e/ExileIntoDarkness.java
@@ -1,11 +1,7 @@
-
package mage.cards.e;
-import java.util.UUID;
-import mage.abilities.Ability;
import mage.abilities.common.BeginningOfUpkeepTriggeredAbility;
import mage.abilities.condition.common.MoreCardsInHandThanOpponentsCondition;
-import mage.abilities.decorator.ConditionalInterveningIfTriggeredAbility;
import mage.abilities.effects.common.ReturnSourceFromGraveyardToHandEffect;
import mage.abilities.effects.common.SacrificeEffect;
import mage.cards.CardImpl;
@@ -18,6 +14,8 @@
import mage.filter.predicate.mageobject.ManaValuePredicate;
import mage.target.TargetPlayer;
+import java.util.UUID;
+
/**
*
* @author LevelX2
@@ -33,20 +31,14 @@ public final class ExileIntoDarkness extends CardImpl {
public ExileIntoDarkness(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.SORCERY},"{4}{B}");
-
// Target player sacrifices a creature with converted mana cost 3 or less.
this.getSpellAbility().addEffect(new SacrificeEffect(filter, 1, "Target player"));
this.getSpellAbility().addTarget(new TargetPlayer());
-
// At the beginning of your upkeep, if you have more cards in hand than each opponent, you may return Exile into Darkness from your graveyard to your hand.
- Ability ability = new ConditionalInterveningIfTriggeredAbility(
- new BeginningOfUpkeepTriggeredAbility(Zone.GRAVEYARD,
- new ReturnSourceFromGraveyardToHandEffect(),
- TargetController.YOU, true),
- MoreCardsInHandThanOpponentsCondition.instance,
- "At the beginning of your upkeep, if you have more cards in hand than each opponent, you may return {this} from your graveyard to your hand.");
- this.addAbility(ability);
+ this.addAbility(new BeginningOfUpkeepTriggeredAbility(Zone.GRAVEYARD,
+ new ReturnSourceFromGraveyardToHandEffect(),
+ TargetController.YOU, true).withInterveningIf(MoreCardsInHandThanOpponentsCondition.instance));
}
private ExileIntoDarkness(final ExileIntoDarkness card) {
diff --git a/Mage.Sets/src/mage/cards/f/Feedback.java b/Mage.Sets/src/mage/cards/f/Feedback.java
index 10e644220e15..d3ba338e1e48 100644
--- a/Mage.Sets/src/mage/cards/f/Feedback.java
+++ b/Mage.Sets/src/mage/cards/f/Feedback.java
@@ -1,21 +1,17 @@
package mage.cards.f;
-import java.util.UUID;
import mage.abilities.common.BeginningOfUpkeepTriggeredAbility;
-import mage.abilities.effects.Effect;
import mage.abilities.effects.common.AttachEffect;
import mage.abilities.effects.common.DamageTargetEffect;
import mage.abilities.keyword.EnchantAbility;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
-import mage.constants.CardType;
-import mage.constants.SubType;
-import mage.constants.Outcome;
-import mage.constants.TargetController;
-import mage.constants.Zone;
+import mage.constants.*;
import mage.target.TargetPermanent;
import mage.target.common.TargetEnchantmentPermanent;
+import java.util.UUID;
+
/**
*
* @author LoneFox
@@ -33,11 +29,9 @@ public Feedback(UUID ownerId, CardSetInfo setInfo) {
this.addAbility(new EnchantAbility(auraTarget));
// At the beginning of the upkeep of enchanted enchantment's controller, Feedback deals 1 damage to that player.
- Effect effect = new DamageTargetEffect(1);
- effect.setText("{this} deals 1 damage to that player");
- this.addAbility(new BeginningOfUpkeepTriggeredAbility(Zone.BATTLEFIELD, effect,
- TargetController.CONTROLLER_ATTACHED_TO, false, true,
- "At the beginning of the upkeep of enchanted enchantment's controller, "));
+ this.addAbility(new BeginningOfUpkeepTriggeredAbility(Zone.BATTLEFIELD, new DamageTargetEffect(1).withTargetDescription("that player"),
+ TargetController.CONTROLLER_ATTACHED_TO, false, true
+ ).setTriggerPhrase("At the beginning of the upkeep of enchanted enchantment's controller, "));
}
private Feedback(final Feedback card) {
diff --git a/Mage.Sets/src/mage/cards/g/Genesis.java b/Mage.Sets/src/mage/cards/g/Genesis.java
index 48104c4d0519..606922de75a8 100644
--- a/Mage.Sets/src/mage/cards/g/Genesis.java
+++ b/Mage.Sets/src/mage/cards/g/Genesis.java
@@ -1,10 +1,9 @@
-
package mage.cards.g;
-import java.util.UUID;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.BeginningOfUpkeepTriggeredAbility;
+import mage.abilities.condition.common.SourceInGraveyardCondition;
import mage.abilities.costs.mana.ManaCostsImpl;
import mage.abilities.effects.common.DoIfCostPaid;
import mage.abilities.effects.common.ReturnFromGraveyardToHandTargetEffect;
@@ -17,6 +16,8 @@
import mage.filter.StaticFilters;
import mage.target.common.TargetCardInYourGraveyard;
+import java.util.UUID;
+
/**
*
* @author LevelX2
@@ -31,8 +32,10 @@ public Genesis(UUID ownerId, CardSetInfo setInfo) {
this.toughness = new MageInt(4);
// At the beginning of your upkeep, if Genesis is in your graveyard, you may pay {2}{G}. If you do, return target creature card from your graveyard to your hand.
- Ability ability = new BeginningOfUpkeepTriggeredAbility(
- Zone.GRAVEYARD, new DoIfCostPaid(new ReturnFromGraveyardToHandTargetEffect(), new ManaCostsImpl<>("{2}{G}")), TargetController.YOU, false, false);
+ Ability ability = new BeginningOfUpkeepTriggeredAbility(Zone.GRAVEYARD,
+ new DoIfCostPaid(new ReturnFromGraveyardToHandTargetEffect(), new ManaCostsImpl<>("{2}{G}")),
+ TargetController.YOU, false, false
+ ).withInterveningIf(SourceInGraveyardCondition.instance);
ability.addTarget(new TargetCardInYourGraveyard(StaticFilters.FILTER_CARD_CREATURE_YOUR_GRAVEYARD));
this.addAbility(ability);
}
diff --git a/Mage.Sets/src/mage/cards/g/GhastlyRemains.java b/Mage.Sets/src/mage/cards/g/GhastlyRemains.java
index 37c54ce36b16..f28c43fc3978 100644
--- a/Mage.Sets/src/mage/cards/g/GhastlyRemains.java
+++ b/Mage.Sets/src/mage/cards/g/GhastlyRemains.java
@@ -1,8 +1,8 @@
-
package mage.cards.g;
import mage.MageInt;
import mage.abilities.common.BeginningOfUpkeepTriggeredAbility;
+import mage.abilities.condition.common.SourceInGraveyardCondition;
import mage.abilities.costs.mana.ManaCostsImpl;
import mage.abilities.effects.common.AmplifyEffect;
import mage.abilities.effects.common.DoIfCostPaid;
@@ -14,8 +14,6 @@
import mage.constants.SubType;
import mage.constants.TargetController;
import mage.constants.Zone;
-import mage.game.Game;
-import mage.players.Player;
import java.util.UUID;
@@ -36,7 +34,9 @@ public GhastlyRemains(UUID ownerId, CardSetInfo setInfo) {
this.addAbility(new AmplifyAbility(AmplifyEffect.AmplifyFactor.Amplify1));
// At the beginning of your upkeep, if Ghastly Remains is in your graveyard, you may pay {B}{B}{B}. If you do, return Ghastly Remains to your hand.
- this.addAbility(new GhastlyRemainsTriggeredAbility());
+ this.addAbility(new BeginningOfUpkeepTriggeredAbility(Zone.GRAVEYARD,
+ new DoIfCostPaid(new ReturnSourceFromGraveyardToHandEffect().setText("return {this} to your hand"), new ManaCostsImpl<>("{B}{B}{B}")),
+ TargetController.YOU, false).withInterveningIf(SourceInGraveyardCondition.instance));
}
@@ -49,34 +49,3 @@ public GhastlyRemains copy() {
return new GhastlyRemains(this);
}
}
-
-class GhastlyRemainsTriggeredAbility extends BeginningOfUpkeepTriggeredAbility {
-
- GhastlyRemainsTriggeredAbility() {
- super(Zone.GRAVEYARD, new DoIfCostPaid(new ReturnSourceFromGraveyardToHandEffect(), new ManaCostsImpl<>("{B}{B}{B}")), TargetController.YOU, false);
- }
-
- private GhastlyRemainsTriggeredAbility(final GhastlyRemainsTriggeredAbility ability) {
- super(ability);
- }
-
- @Override
- public GhastlyRemainsTriggeredAbility copy() {
- return new GhastlyRemainsTriggeredAbility(this);
- }
-
- @Override
- public boolean checkInterveningIfClause(Game game) {
- Player controller = game.getPlayer(controllerId);
- if (controller != null && controller.getGraveyard().contains(sourceId)) {
- return super.checkInterveningIfClause(game);
- }
- return false;
- }
-
- @Override
- public String getRule() {
- return "At the beginning of your upkeep, if {this} is in your graveyard, you may pay {B}{B}{B}. If you do, return {this} to your hand.";
- }
-
-}
diff --git a/Mage.Sets/src/mage/cards/g/Gigapede.java b/Mage.Sets/src/mage/cards/g/Gigapede.java
index c3f916a25cbc..8825b8dd394b 100644
--- a/Mage.Sets/src/mage/cards/g/Gigapede.java
+++ b/Mage.Sets/src/mage/cards/g/Gigapede.java
@@ -1,8 +1,8 @@
-
package mage.cards.g;
import mage.MageInt;
import mage.abilities.common.BeginningOfUpkeepTriggeredAbility;
+import mage.abilities.condition.common.SourceInGraveyardCondition;
import mage.abilities.costs.common.DiscardCardCost;
import mage.abilities.effects.common.DoIfCostPaid;
import mage.abilities.effects.common.ReturnSourceFromGraveyardToHandEffect;
@@ -13,8 +13,6 @@
import mage.constants.SubType;
import mage.constants.TargetController;
import mage.constants.Zone;
-import mage.game.Game;
-import mage.players.Player;
import java.util.UUID;
@@ -33,8 +31,11 @@ public Gigapede(UUID ownerId, CardSetInfo setInfo) {
// Shroud
this.addAbility(ShroudAbility.getInstance());
+
// At the beginning of your upkeep, if Gigapede is in your graveyard, you may discard a card. If you do, return Gigapede to your hand.
- this.addAbility(new GigapedeTriggerdAbility());
+ this.addAbility(new BeginningOfUpkeepTriggeredAbility(Zone.GRAVEYARD,
+ new DoIfCostPaid(new ReturnSourceFromGraveyardToHandEffect().setText("return {this} to your hand"), new DiscardCardCost()),
+ TargetController.YOU, false).withInterveningIf(SourceInGraveyardCondition.instance));
}
private Gigapede(final Gigapede card) {
@@ -46,36 +47,3 @@ public Gigapede copy() {
return new Gigapede(this);
}
}
-
-
-class GigapedeTriggerdAbility extends BeginningOfUpkeepTriggeredAbility {
-
- GigapedeTriggerdAbility() {
- super(Zone.GRAVEYARD, new DoIfCostPaid(new ReturnSourceFromGraveyardToHandEffect(), new DiscardCardCost()), TargetController.YOU, false);
- }
-
- private GigapedeTriggerdAbility(final GigapedeTriggerdAbility ability) {
- super(ability);
- }
-
- @Override
- public GigapedeTriggerdAbility copy() {
- return new GigapedeTriggerdAbility(this);
- }
-
-
- @Override
- public boolean checkInterveningIfClause(Game game) {
- Player controller = game.getPlayer(controllerId);
- if(controller != null && controller.getGraveyard().contains(sourceId)){
- return super.checkInterveningIfClause(game);
- }
- return false;
- }
-
- @Override
- public String getRule() {
- return "At the beginning of your upkeep, if {this} is in your graveyard, you may discard a card. If you do, return {this} to your hand";
- }
-
-}
diff --git a/Mage.Sets/src/mage/cards/i/Ichorid.java b/Mage.Sets/src/mage/cards/i/Ichorid.java
index 000dc81d113c..170c48b0d4c0 100644
--- a/Mage.Sets/src/mage/cards/i/Ichorid.java
+++ b/Mage.Sets/src/mage/cards/i/Ichorid.java
@@ -1,10 +1,10 @@
package mage.cards.i;
import mage.MageInt;
-import mage.MageObject;
import mage.ObjectColor;
import mage.abilities.common.BeginningOfEndStepTriggeredAbility;
import mage.abilities.common.BeginningOfUpkeepTriggeredAbility;
+import mage.abilities.condition.common.SourceInGraveyardCondition;
import mage.abilities.costs.common.ExileFromGraveCost;
import mage.abilities.effects.common.DoIfCostPaid;
import mage.abilities.effects.common.ReturnSourceFromGraveyardToBattlefieldEffect;
@@ -20,7 +20,6 @@
import mage.filter.common.FilterCreatureCard;
import mage.filter.predicate.mageobject.AnotherPredicate;
import mage.filter.predicate.mageobject.ColorPredicate;
-import mage.game.Game;
import mage.target.common.TargetCardInYourGraveyard;
import java.util.UUID;
@@ -30,6 +29,13 @@
*/
public final class Ichorid extends CardImpl {
+ private static final FilterCard filter = new FilterCreatureCard("a black creature card other than {this}");
+
+ static {
+ filter.add(AnotherPredicate.instance);
+ filter.add(new ColorPredicate(ObjectColor.BLACK));
+ }
+
public Ichorid(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{3}{B}");
this.subtype.add(SubType.HORROR);
@@ -44,7 +50,10 @@ public Ichorid(UUID ownerId, CardSetInfo setInfo) {
this.addAbility(new BeginningOfEndStepTriggeredAbility(new SacrificeSourceEffect(), TargetController.NEXT, false));
// At the beginning of your upkeep, if Ichorid is in your graveyard, you may exile a black creature card other than Ichorid from your graveyard. If you do, return Ichorid to the battlefield.
- this.addAbility(new IchoridTriggerdAbility());
+ this.addAbility(new BeginningOfUpkeepTriggeredAbility(Zone.GRAVEYARD, new DoIfCostPaid(
+ new ReturnSourceFromGraveyardToBattlefieldEffect().setText("return {this} to the battlefield"),
+ new ExileFromGraveCost(new TargetCardInYourGraveyard(filter))
+ ), TargetController.YOU, false).withInterveningIf(SourceInGraveyardCondition.instance));
}
private Ichorid(final Ichorid card) {
@@ -56,42 +65,3 @@ public Ichorid copy() {
return new Ichorid(this);
}
}
-
-class IchoridTriggerdAbility extends BeginningOfUpkeepTriggeredAbility {
-
- private static final FilterCard filter = new FilterCreatureCard("another black creature card");
-
- static {
- filter.add(AnotherPredicate.instance);
- filter.add(new ColorPredicate(ObjectColor.BLACK));
- }
-
- IchoridTriggerdAbility() {
- super(Zone.GRAVEYARD, new DoIfCostPaid(
- new ReturnSourceFromGraveyardToBattlefieldEffect(),
- new ExileFromGraveCost(new TargetCardInYourGraveyard(filter))
- ), TargetController.YOU, false);
- }
-
- private IchoridTriggerdAbility(IchoridTriggerdAbility ability) {
- super(ability);
- }
-
- @Override
- public IchoridTriggerdAbility copy() {
- return new IchoridTriggerdAbility(this);
- }
-
- @Override
- public boolean checkInterveningIfClause(Game game) {
- MageObject sourceObject = getSourceObjectIfItStillExists(game);
- return sourceObject != null && game.getState().getZone(getSourceId()) == Zone.GRAVEYARD;
- }
-
- @Override
- public String getRule() {
- return "At the beginning of your upkeep, if {this} is in your graveyard, " +
- "you may exile a black creature card other than {this} from your graveyard. " +
- "If you do, return {this} to the battlefield.";
- }
-}
diff --git a/Mage.Sets/src/mage/cards/i/InfestingRadroach.java b/Mage.Sets/src/mage/cards/i/InfestingRadroach.java
index ae2982115a53..284f16c0ac7b 100644
--- a/Mage.Sets/src/mage/cards/i/InfestingRadroach.java
+++ b/Mage.Sets/src/mage/cards/i/InfestingRadroach.java
@@ -5,7 +5,6 @@
import mage.abilities.common.DealsCombatDamageToAPlayerTriggeredAbility;
import mage.abilities.common.MillTriggeredAbility;
import mage.abilities.condition.common.SourceInGraveyardCondition;
-import mage.abilities.decorator.ConditionalInterveningIfTriggeredAbility;
import mage.abilities.dynamicvalue.common.SavedDamageValue;
import mage.abilities.effects.common.ReturnToHandSourceEffect;
import mage.abilities.effects.common.counter.AddCountersTargetEffect;
@@ -50,11 +49,10 @@ public InfestingRadroach(UUID ownerId, CardSetInfo setInfo) {
));
// Whenever an opponent mills a nonland card, if Infesting Radroach is in your graveyard, you may return it to your hand.
- this.addAbility(new ConditionalInterveningIfTriggeredAbility(
- new MillTriggeredAbility(Zone.GRAVEYARD, new ReturnToHandSourceEffect(), TargetController.OPPONENT, filter, true),
- SourceInGraveyardCondition.instance, "Whenever an opponent mills a nonland card, "
- + "if {this} is in your graveyard, you may return it to your hand"
- ));
+ this.addAbility(new MillTriggeredAbility(Zone.GRAVEYARD,
+ new ReturnToHandSourceEffect().setText("return it to your hand"),
+ TargetController.OPPONENT, filter, true
+ ).withInterveningIf(SourceInGraveyardCondition.instance));
}
private InfestingRadroach(final InfestingRadroach card) {
diff --git a/Mage.Sets/src/mage/cards/l/LilianaUntouchedByDeath.java b/Mage.Sets/src/mage/cards/l/LilianaUntouchedByDeath.java
index 5f40643925c4..5573fd6d688a 100644
--- a/Mage.Sets/src/mage/cards/l/LilianaUntouchedByDeath.java
+++ b/Mage.Sets/src/mage/cards/l/LilianaUntouchedByDeath.java
@@ -68,7 +68,7 @@ class LilianaUntouchedByDeathEffect extends OneShotEffect {
LilianaUntouchedByDeathEffect() {
super(Outcome.Benefit);
- this.staticText = "mill three cards. If at least one of them is a Zombie card, each opponent loses 2 life and you gain 2 life";
+ this.staticText = "mill three cards. If at least one Zombie card is milled this way, each opponent loses 2 life and you gain 2 life";
}
private LilianaUntouchedByDeathEffect(final LilianaUntouchedByDeathEffect effect) {
diff --git a/Mage.Sets/src/mage/cards/m/MasterOfDeath.java b/Mage.Sets/src/mage/cards/m/MasterOfDeath.java
index d4fbc80a7ddf..06b177128636 100644
--- a/Mage.Sets/src/mage/cards/m/MasterOfDeath.java
+++ b/Mage.Sets/src/mage/cards/m/MasterOfDeath.java
@@ -3,6 +3,7 @@
import mage.MageInt;
import mage.abilities.common.BeginningOfUpkeepTriggeredAbility;
import mage.abilities.common.EntersBattlefieldTriggeredAbility;
+import mage.abilities.condition.common.SourceInGraveyardCondition;
import mage.abilities.costs.common.PayLifeCost;
import mage.abilities.effects.common.DoIfCostPaid;
import mage.abilities.effects.common.ReturnSourceFromGraveyardToHandEffect;
@@ -36,11 +37,10 @@ public MasterOfDeath(UUID ownerId, CardSetInfo setInfo) {
this.addAbility(new BeginningOfUpkeepTriggeredAbility(
Zone.GRAVEYARD,
new DoIfCostPaid(
- new ReturnSourceFromGraveyardToHandEffect()
- .setText("return it to your hand"),
+ new ReturnSourceFromGraveyardToHandEffect().setText("return it to your hand"),
new PayLifeCost(1)
), TargetController.YOU, false
- ));
+ ).withInterveningIf(SourceInGraveyardCondition.instance));
}
private MasterOfDeath(final MasterOfDeath card) {
diff --git a/Mage.Sets/src/mage/cards/m/MossPitSkeleton.java b/Mage.Sets/src/mage/cards/m/MossPitSkeleton.java
index 462354ce984b..c839f412218d 100644
--- a/Mage.Sets/src/mage/cards/m/MossPitSkeleton.java
+++ b/Mage.Sets/src/mage/cards/m/MossPitSkeleton.java
@@ -4,6 +4,7 @@
import mage.abilities.TriggeredAbilityImpl;
import mage.abilities.common.EntersBattlefieldAbility;
import mage.abilities.condition.common.KickedCondition;
+import mage.abilities.condition.common.SourceInGraveyardCondition;
import mage.abilities.effects.common.PutOnLibrarySourceEffect;
import mage.abilities.effects.common.counter.AddCountersSourceEffect;
import mage.abilities.keyword.KickerAbility;
@@ -58,7 +59,9 @@ public MossPitSkeleton copy() {
class MossPitSkeletonTriggeredAbility extends TriggeredAbilityImpl {
MossPitSkeletonTriggeredAbility() {
- super(Zone.GRAVEYARD, new PutOnLibrarySourceEffect(true), true);
+ super(Zone.GRAVEYARD, new PutOnLibrarySourceEffect(true).setText("put {this} on top of your library"), true);
+ this.withInterveningIf(SourceInGraveyardCondition.instance);
+ setTriggerPhrase("Whenever one or more +1/+1 counters are put on a creature you control, ");
}
private MossPitSkeletonTriggeredAbility(final MossPitSkeletonTriggeredAbility ability) {
@@ -89,14 +92,4 @@ public boolean checkTrigger(GameEvent event, Game game) {
return false;
}
- @Override
- public boolean checkInterveningIfClause(Game game) {
- return game.getState().getZone(getSourceId()) == Zone.GRAVEYARD;
- }
-
- @Override
- public String getRule() {
- return "Whenever one or more +1/+1 counters are put on a creature you control, " +
- "if {this} is in your graveyard, you may put {this} on top of your library.";
- }
}
diff --git a/Mage.Sets/src/mage/cards/m/Musician.java b/Mage.Sets/src/mage/cards/m/Musician.java
index 1ba52b2811a0..af3d056fab58 100644
--- a/Mage.Sets/src/mage/cards/m/Musician.java
+++ b/Mage.Sets/src/mage/cards/m/Musician.java
@@ -8,7 +8,6 @@
import mage.abilities.costs.common.TapSourceCost;
import mage.abilities.costs.mana.ManaCostsImpl;
import mage.abilities.dynamicvalue.common.CountersSourceCount;
-import mage.abilities.effects.Effect;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.common.DestroySourceEffect;
import mage.abilities.effects.common.DoUnlessControllerPaysEffect;
@@ -41,18 +40,14 @@ public Musician(UUID ownerId, CardSetInfo setInfo) {
// Cumulative upkeep {1}
this.addAbility(new CumulativeUpkeepAbility(new ManaCostsImpl<>("{1}")));
- // {tap}: Put a music counter on target creature. If it doesn't have "At the beginning of your upkeep,
- // destroy this creature unless you pay {1} for each music counter on it," it gains that ability
- Effect effect2 = new AddCountersTargetEffect(CounterType.MUSIC.createInstance());
- effect2.setText("Put a music counter on target creature");
-
- Ability ability2 = new SimpleActivatedAbility(
+ // : Put a music counter on target creature. If it doesn’t have "At the beginning of your upkeep, destroy this creature unless you pay {1} for each music counter on it," it gains that ability.
+ Ability ability = new SimpleActivatedAbility(
Zone.BATTLEFIELD,
- effect2,
+ new AddCountersTargetEffect(CounterType.MUSIC.createInstance()),
new TapSourceCost());
- ability2.addTarget(new TargetCreaturePermanent());
- ability2.addEffect(new MusicianEffect());
- this.addAbility(ability2);
+ ability.addTarget(new TargetCreaturePermanent());
+ ability.addEffect(new MusicianEffect());
+ this.addAbility(ability);
}
private Musician(final Musician card) {
@@ -70,8 +65,8 @@ class MusicianEffect extends OneShotEffect {
MusicianEffect() {
super(Outcome.Benefit);
staticText = "If it doesn't have \"At the beginning of your upkeep, " +
- "destroy this creature unless you pay {1} " +
- "for each music counter on it,\" it gains that ability";
+ "destroy this creature unless you pay {1} " +
+ "for each music counter on it,\" it gains that ability";
}
private MusicianEffect(final MusicianEffect effect) {
@@ -89,42 +84,32 @@ public boolean apply(Game game, Ability source) {
if (permanent == null) {
return false;
}
- if(permanent.getAbilities().stream().anyMatch(ability -> ability instanceof MusicianTriggerAbility)){
+ if (permanent.getAbilities().stream().anyMatch(MusicianTriggeredAbility.class::isInstance)) {
return true;
}
-
- OneShotEffect effect = new DoUnlessControllerPaysEffect(
- new DestroySourceEffect(),
- new DynamicValueGenericManaCost(
- new CountersSourceCount(CounterType.MUSIC),
- "{1} for each music counter on {this}"));
- effect.setText("destroy this creature unless you pay {1} for each music counter on it");
-
- game.addEffect(new GainAbilityTargetEffect(
- new MusicianTriggerAbility(effect),
- Duration.WhileOnBattlefield), source);
+ game.addEffect(new GainAbilityTargetEffect(new MusicianTriggeredAbility(), Duration.WhileOnBattlefield), source);
return true;
}
}
-// This wrapper class is used to identify if the targetted creature already has the ability.
-class MusicianTriggerAbility extends BeginningOfUpkeepTriggeredAbility {
- public MusicianTriggerAbility(OneShotEffect effect) {
- super(
- Zone.BATTLEFIELD,
- effect,
- TargetController.YOU,
- false,
- false,
- "At the beginning of your upkeep, ");
+// This wrapper class is used to identify if the targeted creature already has the ability.
+class MusicianTriggeredAbility extends BeginningOfUpkeepTriggeredAbility {
+
+ MusicianTriggeredAbility() {
+ super(Zone.BATTLEFIELD, new DoUnlessControllerPaysEffect(
+ new DestroySourceEffect(),
+ new DynamicValueGenericManaCost(new CountersSourceCount(CounterType.MUSIC),
+ "{1} for each music counter on {this}")
+ ).setText("destroy this creature unless you pay {1} for each music counter on it"),
+ TargetController.YOU, false, false);
}
- private MusicianTriggerAbility(final MusicianTriggerAbility ability) {
+ private MusicianTriggeredAbility(final MusicianTriggeredAbility ability) {
super(ability);
}
@Override
- public MusicianTriggerAbility copy() {
- return new MusicianTriggerAbility(this);
+ public MusicianTriggeredAbility copy() {
+ return new MusicianTriggeredAbility(this);
}
-}
\ No newline at end of file
+}
diff --git a/Mage.Sets/src/mage/cards/n/NetherSpirit.java b/Mage.Sets/src/mage/cards/n/NetherSpirit.java
index a37dd2023dfa..891c50cb45af 100644
--- a/Mage.Sets/src/mage/cards/n/NetherSpirit.java
+++ b/Mage.Sets/src/mage/cards/n/NetherSpirit.java
@@ -1,12 +1,9 @@
package mage.cards.n;
-import java.util.UUID;
import mage.MageInt;
import mage.abilities.Ability;
-import mage.abilities.TriggeredAbility;
import mage.abilities.common.BeginningOfUpkeepTriggeredAbility;
import mage.abilities.condition.Condition;
-import mage.abilities.decorator.ConditionalInterveningIfTriggeredAbility;
import mage.abilities.effects.common.ReturnSourceFromGraveyardToBattlefieldEffect;
import mage.cards.Card;
import mage.cards.CardImpl;
@@ -19,6 +16,8 @@
import mage.game.Game;
import mage.players.Player;
+import java.util.UUID;
+
/**
*
* @author emerald000
@@ -33,8 +32,9 @@ public NetherSpirit(UUID ownerId, CardSetInfo setInfo) {
this.toughness = new MageInt(2);
// At the beginning of your upkeep, if Nether Spirit is the only creature card in your graveyard, you may return Nether Spirit to the battlefield.
- TriggeredAbility ability = new BeginningOfUpkeepTriggeredAbility(Zone.GRAVEYARD, new ReturnSourceFromGraveyardToBattlefieldEffect(), TargetController.YOU, true);
- this.addAbility(new ConditionalInterveningIfTriggeredAbility(ability, new NetherSpiritCondition(), "At the beginning of your upkeep, if {this} is the only creature card in your graveyard, you may return {this} to the battlefield."));
+ this.addAbility(new BeginningOfUpkeepTriggeredAbility(Zone.GRAVEYARD,
+ new ReturnSourceFromGraveyardToBattlefieldEffect().setText("return {this} to the battlefield"),
+ TargetController.YOU, true).withInterveningIf(NetherSpiritCondition.instance));
}
private NetherSpirit(final NetherSpirit card) {
@@ -47,17 +47,19 @@ public NetherSpirit copy() {
}
}
-class NetherSpiritCondition implements Condition {
+enum NetherSpiritCondition implements Condition {
+ instance;
@Override
public boolean apply(Game game, Ability source) {
Player player = game.getPlayer(source.getControllerId());
- if (player != null) {
- Card card = game.getCard(source.getSourceId());
- if (card != null) {
- return player.getGraveyard().contains(card.getId()) && player.getGraveyard().count(StaticFilters.FILTER_CARD_CREATURE, game) == 1;
- }
- }
- return false;
+ Card card = game.getCard(source.getSourceId());
+ return player != null && card != null && player.getGraveyard().contains(card.getId())
+ && player.getGraveyard().count(StaticFilters.FILTER_CARD_CREATURE, game) == 1;
+ }
+
+ @Override
+ public String toString() {
+ return "{this} is the only creature card in your graveyard";
}
}
diff --git a/Mage.Sets/src/mage/cards/p/Paroxysm.java b/Mage.Sets/src/mage/cards/p/Paroxysm.java
index e31bc77c9c2a..2246745327e2 100644
--- a/Mage.Sets/src/mage/cards/p/Paroxysm.java
+++ b/Mage.Sets/src/mage/cards/p/Paroxysm.java
@@ -1,33 +1,24 @@
package mage.cards.p;
-import java.util.UUID;
-import mage.constants.SubType;
-import mage.target.common.TargetCreaturePermanent;
import mage.abilities.Ability;
import mage.abilities.common.BeginningOfUpkeepTriggeredAbility;
import mage.abilities.effects.ContinuousEffect;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.common.AttachEffect;
import mage.abilities.effects.common.continuous.BoostTargetEffect;
-import mage.constants.Outcome;
-import mage.target.TargetPermanent;
import mage.abilities.keyword.EnchantAbility;
-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.Duration;
-import mage.constants.TargetController;
-import mage.constants.Zone;
+import mage.cards.*;
+import mage.constants.*;
import mage.game.Game;
import mage.game.permanent.Permanent;
import mage.players.Player;
+import mage.target.TargetPermanent;
+import mage.target.common.TargetCreaturePermanent;
import mage.target.targetpointer.FixedTarget;
+import java.util.UUID;
+
/**
- *
* @author jeffwadsworth
*/
public final class Paroxysm extends CardImpl {
@@ -46,11 +37,8 @@ public Paroxysm(UUID ownerId, CardSetInfo setInfo) {
// At the beginning of the upkeep of enchanted creature's controller, that player reveals the top card of their library.
// If that card is a land card, destroy that creature. Otherwise, it gets +3/+3 until end of turn.
- this.addAbility(new BeginningOfUpkeepTriggeredAbility(
- Zone.BATTLEFIELD,
- new ParoxysmEffect(),
- TargetController.CONTROLLER_ATTACHED_TO,
- false, false, "At the beginning of the upkeep of enchanted creature's controller, "));
+ this.addAbility(new BeginningOfUpkeepTriggeredAbility(Zone.BATTLEFIELD, new ParoxysmEffect(),
+ TargetController.CONTROLLER_ATTACHED_TO, false, false));
}
private Paroxysm(final Paroxysm card) {
diff --git a/Mage.Sets/src/mage/cards/p/PowerLeak.java b/Mage.Sets/src/mage/cards/p/PowerLeak.java
index fc91cd0efb54..20b92ed34106 100644
--- a/Mage.Sets/src/mage/cards/p/PowerLeak.java
+++ b/Mage.Sets/src/mage/cards/p/PowerLeak.java
@@ -38,7 +38,9 @@ public PowerLeak(UUID ownerId, CardSetInfo setInfo) {
this.addAbility(new EnchantAbility(auraTarget));
// At the beginning of the upkeep of enchanted enchantment's controller, that player may pay any amount of mana. Power Leak deals 2 damage to that player. Prevent X of that damage, where X is the amount of mana that player paid this way.
- this.addAbility(new BeginningOfUpkeepTriggeredAbility(Zone.BATTLEFIELD, new PowerLeakEffect(), TargetController.CONTROLLER_ATTACHED_TO, false, true, "At the beginning of the upkeep of enchanted enchantment's controller, "));
+ this.addAbility(new BeginningOfUpkeepTriggeredAbility(Zone.BATTLEFIELD, new PowerLeakEffect(),
+ TargetController.CONTROLLER_ATTACHED_TO, false, true
+ ).setTriggerPhrase("At the beginning of the upkeep of enchanted enchantment's controller, "));
}
private PowerLeak(final PowerLeak card) {
diff --git a/Mage.Sets/src/mage/cards/p/PowerTaint.java b/Mage.Sets/src/mage/cards/p/PowerTaint.java
index 8b971d640b75..1431fece78b4 100644
--- a/Mage.Sets/src/mage/cards/p/PowerTaint.java
+++ b/Mage.Sets/src/mage/cards/p/PowerTaint.java
@@ -1,34 +1,30 @@
package mage.cards.p;
-import java.util.UUID;
-import mage.constants.SubType;
-import mage.target.common.TargetEnchantmentPermanent;
import mage.abilities.Ability;
import mage.abilities.common.BeginningOfUpkeepTriggeredAbility;
-import mage.abilities.effects.common.AttachEffect;
-import mage.constants.Outcome;
-import mage.target.TargetPermanent;
-import mage.abilities.keyword.EnchantAbility;
import mage.abilities.costs.mana.ManaCostsImpl;
import mage.abilities.effects.Effect;
+import mage.abilities.effects.common.AttachEffect;
import mage.abilities.effects.common.DoUnlessTargetPlayerOrTargetsControllerPaysEffect;
import mage.abilities.effects.common.LoseLifeTargetEffect;
import mage.abilities.keyword.CyclingAbility;
+import mage.abilities.keyword.EnchantAbility;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
-import mage.constants.CardType;
-import mage.constants.TargetController;
-import mage.constants.Zone;
+import mage.constants.*;
+import mage.target.TargetPermanent;
+import mage.target.common.TargetEnchantmentPermanent;
+
+import java.util.UUID;
/**
- *
* @author jeffwadsworth
*/
public final class PowerTaint extends CardImpl {
public PowerTaint(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{1}{U}");
-
+
this.subtype.add(SubType.AURA);
// Enchant enchantment
@@ -39,12 +35,12 @@ public PowerTaint(UUID ownerId, CardSetInfo setInfo) {
this.addAbility(ability);
// At the beginning of the upkeep of enchanted enchantment's controller, that player loses 2 life unless they pay {2}.
- Effect effect = new DoUnlessTargetPlayerOrTargetsControllerPaysEffect(new LoseLifeTargetEffect(2),
- new ManaCostsImpl<>("{2}"), "that player loses 2 life unless they pay {2}");
- this.addAbility(new BeginningOfUpkeepTriggeredAbility(Zone.BATTLEFIELD, effect,
- TargetController.CONTROLLER_ATTACHED_TO, false, true,
- "At the beginning of the upkeep of enchanted enchantment's controller, "));
-
+ Effect effect = new DoUnlessTargetPlayerOrTargetsControllerPaysEffect(new LoseLifeTargetEffect(2),
+ new ManaCostsImpl<>("{2}")).setText("that player loses 2 life unless they pay {2}");
+ this.addAbility(new BeginningOfUpkeepTriggeredAbility(Zone.BATTLEFIELD, effect,
+ TargetController.CONTROLLER_ATTACHED_TO, false, true)
+ .setTriggerPhrase("At the beginning of the upkeep of enchanted enchantment's controller, "));
+
// Cycling {2}
this.addAbility(new CyclingAbility(new ManaCostsImpl<>("{2}")));
diff --git a/Mage.Sets/src/mage/cards/p/Precognition.java b/Mage.Sets/src/mage/cards/p/Precognition.java
index ba988c77662b..22c74cd511d0 100644
--- a/Mage.Sets/src/mage/cards/p/Precognition.java
+++ b/Mage.Sets/src/mage/cards/p/Precognition.java
@@ -1,15 +1,9 @@
-
package mage.cards.p;
-import java.util.UUID;
import mage.abilities.Ability;
import mage.abilities.common.BeginningOfUpkeepTriggeredAbility;
import mage.abilities.effects.OneShotEffect;
-import mage.cards.Card;
-import mage.cards.CardImpl;
-import mage.cards.CardSetInfo;
-import mage.cards.Cards;
-import mage.cards.CardsImpl;
+import mage.cards.*;
import mage.constants.CardType;
import mage.constants.Outcome;
import mage.constants.TargetController;
@@ -18,19 +12,18 @@
import mage.players.Player;
import mage.target.common.TargetOpponent;
+import java.util.UUID;
+
/**
- *
* @author fireshoes
*/
public final class Precognition extends CardImpl {
-
- private static final String rule = "At the beginning of your upkeep, you may look at the top card of target opponent's library. You may put that card on the bottom of that player's library.";
public Precognition(UUID ownerId, CardSetInfo setInfo) {
- super(ownerId,setInfo,new CardType[]{CardType.ENCHANTMENT},"{4}{U}");
+ super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{4}{U}");
// At the beginning of your upkeep, you may look at the top card of target opponent's library. If you do, you may put that card on the bottom of that player's library.
- Ability ability = new BeginningOfUpkeepTriggeredAbility(Zone.BATTLEFIELD, new PrecognitionEffect(), TargetController.YOU, true, false, rule);
+ Ability ability = new BeginningOfUpkeepTriggeredAbility(Zone.BATTLEFIELD, new PrecognitionEffect(), TargetController.YOU, true, false);
ability.addTarget(new TargetOpponent());
this.addAbility(ability);
}
@@ -49,7 +42,7 @@ class PrecognitionEffect extends OneShotEffect {
PrecognitionEffect() {
super(Outcome.Detriment);
- staticText = "";
+ staticText = "you may look at the top card of target opponent's library. You may put that card on the bottom of that player's library";
}
private PrecognitionEffect(final PrecognitionEffect effect) {
diff --git a/Mage.Sets/src/mage/cards/p/PyreZombie.java b/Mage.Sets/src/mage/cards/p/PyreZombie.java
index 7db45356df95..026b3e6f6419 100644
--- a/Mage.Sets/src/mage/cards/p/PyreZombie.java
+++ b/Mage.Sets/src/mage/cards/p/PyreZombie.java
@@ -1,11 +1,10 @@
-
package mage.cards.p;
-import java.util.UUID;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.BeginningOfUpkeepTriggeredAbility;
import mage.abilities.common.SimpleActivatedAbility;
+import mage.abilities.condition.common.SourceInGraveyardCondition;
import mage.abilities.costs.common.SacrificeSourceCost;
import mage.abilities.costs.mana.ManaCostsImpl;
import mage.abilities.effects.common.DamageTargetEffect;
@@ -19,6 +18,8 @@
import mage.constants.Zone;
import mage.target.common.TargetAnyTarget;
+import java.util.UUID;
+
/**
*
* @author LoneFox
@@ -34,7 +35,8 @@ public PyreZombie(UUID ownerId, CardSetInfo setInfo) {
// At the beginning of your upkeep, if Pyre Zombie is in your graveyard, you may pay {1}{B}{B}. If you do, return Pyre Zombie to your hand.
this.addAbility(new BeginningOfUpkeepTriggeredAbility(Zone.GRAVEYARD,
new DoIfCostPaid(new ReturnToHandSourceEffect().setText("return {this} to your hand"), new ManaCostsImpl<>("{1}{B}{B}")),
- TargetController.YOU, false));
+ TargetController.YOU, false).withInterveningIf(SourceInGraveyardCondition.instance));
+
// {1}{R}{R}, Sacrifice Pyre Zombie: Pyre Zombie deals 2 damage to any target.
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new DamageTargetEffect(2, "it"), new ManaCostsImpl<>("{1}{R}{R}"));
ability.addCost(new SacrificeSourceCost());
diff --git a/Mage.Sets/src/mage/cards/p/PyrewildShaman.java b/Mage.Sets/src/mage/cards/p/PyrewildShaman.java
index 443344c07479..14712f055351 100644
--- a/Mage.Sets/src/mage/cards/p/PyrewildShaman.java
+++ b/Mage.Sets/src/mage/cards/p/PyrewildShaman.java
@@ -1,9 +1,8 @@
-
package mage.cards.p;
-import java.util.UUID;
import mage.MageInt;
import mage.abilities.common.DealCombatDamageControlledTriggeredAbility;
+import mage.abilities.condition.common.SourceInGraveyardCondition;
import mage.abilities.costs.mana.ManaCostsImpl;
import mage.abilities.effects.common.DoIfCostPaid;
import mage.abilities.effects.common.ReturnToHandSourceEffect;
@@ -11,13 +10,11 @@
import mage.abilities.keyword.BloodrushAbility;
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.constants.*;
import mage.filter.StaticFilters;
+import java.util.UUID;
+
public final class PyrewildShaman extends CardImpl {
public PyrewildShaman(UUID ownerId, CardSetInfo setInfo) {
@@ -32,10 +29,11 @@ public PyrewildShaman(UUID ownerId, CardSetInfo setInfo) {
this.addAbility(new BloodrushAbility("{1}{R}", new BoostTargetEffect(3, 1, Duration.EndOfTurn)));
// Whenever one or more creatures you control deal combat damage to a player, if Pyrewild Shaman is in your graveyard, you may pay {3}. If you do, return Pyrewild Shaman to your hand.
- this.addAbility(new DealCombatDamageControlledTriggeredAbility(Zone.GRAVEYARD,
- new DoIfCostPaid(new ReturnToHandSourceEffect(), new ManaCostsImpl<>("{3}"))
- .setText("if {this} is in your graveyard, you may pay {3}. If you do, return {this} to your hand"),
- StaticFilters.FILTER_PERMANENT_CREATURES, SetTargetPointer.NONE, false));
+ this.addAbility(new DealCombatDamageControlledTriggeredAbility(Zone.GRAVEYARD, new DoIfCostPaid(
+ new ReturnToHandSourceEffect().setText("return {this} to your hand"),
+ new ManaCostsImpl<>("{3}")
+ ), StaticFilters.FILTER_PERMANENT_CREATURES, SetTargetPointer.NONE, false)
+ .withInterveningIf(SourceInGraveyardCondition.instance));
}
diff --git a/Mage.Sets/src/mage/cards/r/RiftmarkedKnight.java b/Mage.Sets/src/mage/cards/r/RiftmarkedKnight.java
index 1e8341df9a2c..144d16127c15 100644
--- a/Mage.Sets/src/mage/cards/r/RiftmarkedKnight.java
+++ b/Mage.Sets/src/mage/cards/r/RiftmarkedKnight.java
@@ -1,6 +1,5 @@
package mage.cards.r;
-import java.util.UUID;
import mage.MageInt;
import mage.ObjectColor;
import mage.abilities.TriggeredAbilityImpl;
@@ -17,9 +16,10 @@
import mage.counters.CounterType;
import mage.game.Game;
import mage.game.events.GameEvent;
-import mage.game.events.GameEvent.EventType;
import mage.game.permanent.token.RiftmarkedKnightToken;
+import java.util.UUID;
+
/**
*
* @author JRHerlehy
@@ -74,7 +74,9 @@ public boolean checkEventType(GameEvent event, Game game) {
@Override
public boolean checkTrigger(GameEvent event, Game game) {
- return (event.getTargetId().equals(this.getSourceId()) && game.getCard(event.getTargetId()).getCounters(game).getCount(CounterType.TIME) == 0);
+ return (event.getTargetId().equals(this.getSourceId())
+ && event.getData().equals(CounterType.TIME.getName())
+ && game.getCard(event.getTargetId()).getCounters(game).getCount(CounterType.TIME) == 0);
}
@Override
diff --git a/Mage.Sets/src/mage/cards/s/SqueeGoblinNabob.java b/Mage.Sets/src/mage/cards/s/SqueeGoblinNabob.java
index 1db64177fdb6..1d65d4b4a4f7 100644
--- a/Mage.Sets/src/mage/cards/s/SqueeGoblinNabob.java
+++ b/Mage.Sets/src/mage/cards/s/SqueeGoblinNabob.java
@@ -1,16 +1,13 @@
package mage.cards.s;
-import java.util.UUID;
import mage.MageInt;
import mage.abilities.common.BeginningOfUpkeepTriggeredAbility;
import mage.abilities.effects.common.ReturnSourceFromGraveyardToHandEffect;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
-import mage.constants.CardType;
-import mage.constants.SubType;
-import mage.constants.SuperType;
-import mage.constants.TargetController;
-import mage.constants.Zone;
+import mage.constants.*;
+
+import java.util.UUID;
/**
*
@@ -27,8 +24,8 @@ public SqueeGoblinNabob(UUID ownerId, CardSetInfo setInfo) {
this.toughness = new MageInt(1);
// At the beginning of your upkeep, you may return Squee, Goblin Nabob from your graveyard to your hand.
- this.addAbility(new BeginningOfUpkeepTriggeredAbility(Zone.GRAVEYARD, new ReturnSourceFromGraveyardToHandEffect(), TargetController.YOU, true)
- .setTriggerPhrase("At the beginning of your upkeep, "));
+ this.addAbility(new BeginningOfUpkeepTriggeredAbility(Zone.GRAVEYARD,
+ new ReturnSourceFromGraveyardToHandEffect(), TargetController.YOU, true));
}
private SqueeGoblinNabob(final SqueeGoblinNabob card) {
diff --git a/Mage.Sets/src/mage/cards/t/ThunderbladeCharge.java b/Mage.Sets/src/mage/cards/t/ThunderbladeCharge.java
index 33c4a7c841b4..3a803f8ca512 100644
--- a/Mage.Sets/src/mage/cards/t/ThunderbladeCharge.java
+++ b/Mage.Sets/src/mage/cards/t/ThunderbladeCharge.java
@@ -1,9 +1,9 @@
package mage.cards.t;
-import java.util.UUID;
import mage.ApprovingObject;
import mage.abilities.Ability;
import mage.abilities.common.DealCombatDamageControlledTriggeredAbility;
+import mage.abilities.condition.common.SourceInGraveyardCondition;
import mage.abilities.costs.mana.ManaCostsImpl;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.common.DamageTargetEffect;
@@ -20,8 +20,9 @@
import mage.players.Player;
import mage.target.common.TargetAnyTarget;
+import java.util.UUID;
+
/**
- *
* @author LevelX2
*/
public final class ThunderbladeCharge extends CardImpl {
@@ -36,12 +37,10 @@ public ThunderbladeCharge(UUID ownerId, CardSetInfo setInfo) {
// Whenever one or more creatures you control deal combat damage to a player,
// if Thunderblade Charge is in your graveyard, you may pay {2}{R}{R}{R}.
// If you do, you may cast it without paying its mana cost.
- this.addAbility(new DealCombatDamageControlledTriggeredAbility(
- Zone.GRAVEYARD,
- new DoIfCostPaid(new ThunderbladeChargeCastEffect(), new ManaCostsImpl<>("{2}{R}{R}{R}"))
- .setText("if {this} is in your graveyard, you may pay {2}{R}{R}{R}. If you do, you may cast it without paying its mana cost"),
- StaticFilters.FILTER_PERMANENT_CREATURES, SetTargetPointer.NONE, false)
- );
+ this.addAbility(new DealCombatDamageControlledTriggeredAbility(Zone.GRAVEYARD,
+ new DoIfCostPaid(new ThunderbladeChargeCastEffect(), new ManaCostsImpl<>("{2}{R}{R}{R}")),
+ StaticFilters.FILTER_PERMANENT_CREATURES, SetTargetPointer.NONE, false
+ ).withInterveningIf(SourceInGraveyardCondition.instance));
}
private ThunderbladeCharge(final ThunderbladeCharge card) {
@@ -58,7 +57,7 @@ class ThunderbladeChargeCastEffect extends OneShotEffect {
ThunderbladeChargeCastEffect() {
super(Outcome.PutCreatureInPlay);
- this.staticText = "you may cast {this} without paying its mana cost";
+ this.staticText = "you may cast it without paying its mana cost";
}
private ThunderbladeChargeCastEffect(final ThunderbladeChargeCastEffect effect) {
@@ -78,7 +77,7 @@ public boolean apply(Game game, Ability source) {
&& sourceCard != null
&& Zone.GRAVEYARD == game.getState().getZone(sourceCard.getId())) {
game.getState().setValue("PlayFromNotOwnHandZone" + sourceCard.getId(), Boolean.TRUE);
- Boolean cardWasCast = controller.cast(controller.chooseAbilityForCast(sourceCard, game, true),
+ boolean cardWasCast = controller.cast(controller.chooseAbilityForCast(sourceCard, game, true),
game, true, new ApprovingObject(source, game));
game.getState().setValue("PlayFromNotOwnHandZone" + sourceCard.getId(), null);
return cardWasCast;
diff --git a/Mage.Sets/src/mage/cards/v/VeilingOddity.java b/Mage.Sets/src/mage/cards/v/VeilingOddity.java
index 9d2d762aff16..214be4019182 100644
--- a/Mage.Sets/src/mage/cards/v/VeilingOddity.java
+++ b/Mage.Sets/src/mage/cards/v/VeilingOddity.java
@@ -1,23 +1,24 @@
package mage.cards.v;
-import java.util.UUID;
import mage.MageInt;
import mage.abilities.TriggeredAbilityImpl;
import mage.abilities.costs.mana.ManaCostsImpl;
import mage.abilities.effects.common.combat.CantBeBlockedAllEffect;
import mage.abilities.keyword.SuspendAbility;
-import mage.constants.SubType;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.Duration;
+import mage.constants.SubType;
import mage.constants.Zone;
import mage.counters.CounterType;
import mage.filter.StaticFilters;
import mage.game.Game;
import mage.game.events.GameEvent;
+import java.util.UUID;
+
/**
*
* @author TheElk801
@@ -66,7 +67,9 @@ public boolean checkEventType(GameEvent event, Game game) {
@Override
public boolean checkTrigger(GameEvent event, Game game) {
- return (event.getTargetId().equals(this.getSourceId()) && game.getCard(event.getTargetId()).getCounters(game).getCount(CounterType.TIME) == 0);
+ return (event.getTargetId().equals(this.getSourceId())
+ && event.getData().equals(CounterType.TIME.getName())
+ && game.getCard(event.getTargetId()).getCounters(game).getCount(CounterType.TIME) == 0);
}
@Override
diff --git a/Mage.Sets/src/mage/cards/v/VengefulPharaoh.java b/Mage.Sets/src/mage/cards/v/VengefulPharaoh.java
index 98f75e574e16..1cd0062751a9 100644
--- a/Mage.Sets/src/mage/cards/v/VengefulPharaoh.java
+++ b/Mage.Sets/src/mage/cards/v/VengefulPharaoh.java
@@ -1,22 +1,21 @@
-
package mage.cards.v;
import mage.MageInt;
-import mage.abilities.Ability;
import mage.abilities.TriggeredAbilityImpl;
-import mage.abilities.effects.OneShotEffect;
+import mage.abilities.condition.common.SourceInGraveyardCondition;
+import mage.abilities.effects.common.DestroyTargetEffect;
+import mage.abilities.effects.common.PutOnLibrarySourceEffect;
import mage.abilities.keyword.DeathtouchAbility;
-import mage.cards.Card;
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.game.Game;
-import mage.game.events.*;
+import mage.game.events.DamagedBatchForOnePermanentEvent;
+import mage.game.events.DamagedBatchForOnePlayerEvent;
+import mage.game.events.GameEvent;
import mage.game.permanent.Permanent;
-import mage.players.Player;
import mage.target.common.TargetAttackingCreature;
import java.util.UUID;
@@ -52,9 +51,12 @@ public VengefulPharaoh copy() {
class VengefulPharaohTriggeredAbility extends TriggeredAbilityImpl {
- public VengefulPharaohTriggeredAbility() {
- super(Zone.GRAVEYARD, new VengefulPharaohEffect(), false);
+ VengefulPharaohTriggeredAbility() {
+ super(Zone.GRAVEYARD, new DestroyTargetEffect(), false);
this.addTarget(new TargetAttackingCreature());
+ this.addEffect(new PutOnLibrarySourceEffect(true).setText(", then put {this} on top of your library"));
+ this.withInterveningIf(SourceInGraveyardCondition.instance);
+ setTriggerPhrase("Whenever combat damage is dealt to you or a planeswalker you control, ");
}
private VengefulPharaohTriggeredAbility(final VengefulPharaohTriggeredAbility ability) {
@@ -66,17 +68,6 @@ public VengefulPharaohTriggeredAbility copy() {
return new VengefulPharaohTriggeredAbility(this);
}
- @Override
- public boolean checkInterveningIfClause(Game game) {
- // Vengeful Pharaoh must be in your graveyard when combat damage is dealt to you or a planeswalker you control
- // in order for its ability to trigger. That is, it can’t die and trigger from your graveyard during the same
- // combat damage step. (2011-09-22)
-
- // If Vengeful Pharaoh is no longer in your graveyard when the triggered ability would resolve, the triggered
- // ability won’t do anything. (2011-09-22)
- return game.getState().getZone(getSourceId()) == Zone.GRAVEYARD;
- }
-
@Override
public boolean checkEventType(GameEvent event, Game game) {
// If multiple creatures deal combat damage to you simultaneously, Vengeful Pharaoh will only trigger once.
@@ -87,7 +78,6 @@ public boolean checkEventType(GameEvent event, Game game) {
@Override
public boolean checkTrigger(GameEvent event, Game game) {
-
if ((event.getType() == GameEvent.EventType.DAMAGED_BATCH_FOR_ONE_PLAYER
&& event.getTargetId().equals(this.getControllerId()))) {
DamagedBatchForOnePlayerEvent dEvent = (DamagedBatchForOnePlayerEvent) event;
@@ -104,45 +94,4 @@ public boolean checkTrigger(GameEvent event, Game game) {
return false;
}
- @Override
- public String getRule() {
- return "Whenever combat damage is dealt to you or a planeswalker you control, if {this} is in your " +
- "graveyard, destroy target attacking creature, then put {this} on top of your library.";
- }
-}
-
-class VengefulPharaohEffect extends OneShotEffect {
-
- VengefulPharaohEffect() {
- super(Outcome.DestroyPermanent);
- this.staticText = "destroy target attacking creature, then put {this} on top of your library";
- }
-
- private VengefulPharaohEffect(final VengefulPharaohEffect effect) {
- super(effect);
- }
-
- @Override
- public VengefulPharaohEffect copy() {
- return new VengefulPharaohEffect(this);
- }
-
- @Override
- public boolean apply(Game game, Ability source) {
- Player controller = game.getPlayer(source.getControllerId());
- Card card = game.getCard(source.getSourceId());
- if (card != null && controller != null) {
- Permanent permanent = game.getPermanent(source.getFirstTarget());
- if (permanent == null) {
- // If the attacking creature is an illegal target when the triggered ability tries to resolve,
- // it won’t resolve and none of its effects will happen. Vengeful Pharaoh will remain in your graveyard.
- // (2011-09-22)
- return false;
- }
- permanent.destroy(source, game, false);
- controller.moveCardToLibraryWithInfo(card, source, game, Zone.GRAVEYARD, true, true);
- return true;
- }
- return false;
- }
}
diff --git a/Mage.Sets/src/mage/cards/v/VesuvanDoppelganger.java b/Mage.Sets/src/mage/cards/v/VesuvanDoppelganger.java
index 359ac3d71d2f..e90d9787ca5f 100644
--- a/Mage.Sets/src/mage/cards/v/VesuvanDoppelganger.java
+++ b/Mage.Sets/src/mage/cards/v/VesuvanDoppelganger.java
@@ -1,7 +1,5 @@
-
package mage.cards.v;
-import java.util.UUID;
import mage.MageInt;
import mage.MageObject;
import mage.abilities.Ability;
@@ -11,11 +9,7 @@
import mage.abilities.effects.OneShotEffect;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
-import mage.constants.CardType;
-import mage.constants.SubType;
-import mage.constants.Outcome;
-import mage.constants.TargetController;
-import mage.constants.Zone;
+import mage.constants.*;
import mage.filter.common.FilterCreaturePermanent;
import mage.game.Game;
import mage.game.permanent.Permanent;
@@ -24,8 +18,9 @@
import mage.target.TargetPermanent;
import mage.util.functions.CopyApplier;
+import java.util.UUID;
+
/**
- *
* @author jeffwadsworth
*/
public final class VesuvanDoppelganger extends CardImpl {
@@ -56,10 +51,9 @@ public VesuvanDoppelganger copy() {
class VesuvanDoppelgangerCopyEffect extends OneShotEffect {
- private static final String rule2 = "At the beginning of your upkeep, you may have this creature become a copy of target creature, except it doesn't copy that creature's color and it has this ability.";
-
- public VesuvanDoppelgangerCopyEffect() {
+ VesuvanDoppelgangerCopyEffect() {
super(Outcome.Copy);
+ this.staticText = "have this creature become a copy of target creature, except it doesn't copy that creature's color and it has this ability";
}
private VesuvanDoppelgangerCopyEffect(final VesuvanDoppelgangerCopyEffect effect) {
@@ -91,7 +85,7 @@ public boolean apply(Game game, Ability source) {
public boolean apply(Game game, MageObject blueprint, Ability source, UUID copyToObjectId) {
blueprint.getColor().setColor(sourcePermanent.getColor(game));
blueprint.getAbilities().add(new BeginningOfUpkeepTriggeredAbility(Zone.BATTLEFIELD,
- new VesuvanDoppelgangerCopyEffect(), TargetController.YOU, true, false, rule2));
+ new VesuvanDoppelgangerCopyEffect(), TargetController.YOU, true, false));
return true;
}
});
diff --git a/Mage.Sets/src/mage/cards/w/WarpArtifact.java b/Mage.Sets/src/mage/cards/w/WarpArtifact.java
index 4dfb309f8612..577279e3adba 100644
--- a/Mage.Sets/src/mage/cards/w/WarpArtifact.java
+++ b/Mage.Sets/src/mage/cards/w/WarpArtifact.java
@@ -1,30 +1,24 @@
-
package mage.cards.w;
-import java.util.UUID;
import mage.abilities.common.BeginningOfUpkeepTriggeredAbility;
-import mage.abilities.effects.Effect;
import mage.abilities.effects.common.AttachEffect;
import mage.abilities.effects.common.DamageTargetEffect;
import mage.abilities.keyword.EnchantAbility;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
-import mage.constants.CardType;
-import mage.constants.SubType;
-import mage.constants.Outcome;
-import mage.constants.TargetController;
-import mage.constants.Zone;
+import mage.constants.*;
import mage.target.TargetPermanent;
import mage.target.common.TargetArtifactPermanent;
+import java.util.UUID;
+
/**
- *
* @author LoneFox
*/
public final class WarpArtifact extends CardImpl {
public WarpArtifact(UUID ownerId, CardSetInfo setInfo) {
- super(ownerId,setInfo,new CardType[]{CardType.ENCHANTMENT},"{B}{B}");
+ super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{B}{B}");
this.subtype.add(SubType.AURA);
// Enchant artifact
@@ -32,11 +26,12 @@ public WarpArtifact(UUID ownerId, CardSetInfo setInfo) {
this.getSpellAbility().addTarget(auraTarget);
this.getSpellAbility().addEffect(new AttachEffect(Outcome.Detriment));
this.addAbility(new EnchantAbility(auraTarget));
+
// At the beginning of the upkeep of enchanted artifact's controller, Warp Artifact deals 1 damage to that player.
- Effect effect = new DamageTargetEffect(1);
- effect.setText("{this} deals 1 damage to that player");
- this.addAbility(new BeginningOfUpkeepTriggeredAbility(Zone.BATTLEFIELD, effect,
- TargetController.CONTROLLER_ATTACHED_TO, false, true, "At the beginning of the upkeep of enchanted artifact's controller, "));
+ this.addAbility(new BeginningOfUpkeepTriggeredAbility(Zone.BATTLEFIELD,
+ new DamageTargetEffect(1).withTargetDescription("that player"),
+ TargetController.CONTROLLER_ATTACHED_TO, false, true
+ ).setTriggerPhrase("At the beginning of the upkeep of enchanted artifact's controller, "));
}
private WarpArtifact(final WarpArtifact card) {
diff --git a/Mage.Sets/src/mage/cards/w/Withercrown.java b/Mage.Sets/src/mage/cards/w/Withercrown.java
index 1b4b48153116..3277349a7407 100644
--- a/Mage.Sets/src/mage/cards/w/Withercrown.java
+++ b/Mage.Sets/src/mage/cards/w/Withercrown.java
@@ -1,6 +1,5 @@
package mage.cards.w;
-import java.util.UUID;
import mage.abilities.Ability;
import mage.abilities.common.BeginningOfUpkeepTriggeredAbility;
import mage.abilities.common.SimpleStaticAbility;
@@ -14,17 +13,13 @@
import mage.abilities.keyword.EnchantAbility;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
-import mage.constants.AttachmentType;
-import mage.constants.CardType;
-import mage.constants.Outcome;
-import mage.constants.SubType;
-import mage.constants.TargetController;
-import mage.constants.Zone;
+import mage.constants.*;
import mage.target.TargetPermanent;
import mage.target.common.TargetCreaturePermanent;
+import java.util.UUID;
+
/**
- *
* @author jeffwadsworth
*/
public final class Withercrown extends CardImpl {
@@ -49,7 +44,7 @@ public Withercrown(UUID ownerId, CardSetInfo setInfo) {
new SacrificeSourceCost(), rule);
effect2.setText("you lose 1 life unless you sacrifice this creature.");
Effect effect3 = new GainAbilityAttachedEffect(new BeginningOfUpkeepTriggeredAbility(Zone.BATTLEFIELD,
- effect2, TargetController.YOU, false, false, null), AttachmentType.AURA);
+ effect2, TargetController.YOU, false, false), AttachmentType.AURA);
effect3.setText("and has \"At the beginning of your upkeep, you lose 1 life unless you sacrifice this creature.\"");
abilityTest.addEffect(effect3);
this.addAbility(abilityTest);
diff --git a/Mage/src/main/java/mage/abilities/common/BeginningOfCombatTriggeredAbility.java b/Mage/src/main/java/mage/abilities/common/BeginningOfCombatTriggeredAbility.java
index eff815c13650..b11f650f9fb4 100644
--- a/Mage/src/main/java/mage/abilities/common/BeginningOfCombatTriggeredAbility.java
+++ b/Mage/src/main/java/mage/abilities/common/BeginningOfCombatTriggeredAbility.java
@@ -78,21 +78,15 @@ public boolean checkTrigger(GameEvent event, Game game) {
private String generateTriggerPhrase() {
switch (targetController) {
case YOU:
- return "At the beginning of combat on your turn, " + generateZoneString();
+ return "At the beginning of combat on your turn, ";
case OPPONENT:
- return "At the beginning of combat on each opponent's turn, " + generateZoneString();
+ return "At the beginning of combat on each opponent's turn, ";
case EACH_PLAYER:
- return "At the beginning of combat on each player's turn, " + generateZoneString();
+ return "At the beginning of combat on each player's turn, ";
case ANY:
- return "At the beginning of each combat, " + generateZoneString();
+ return "At the beginning of each combat, ";
}
return "";
}
- private String generateZoneString() {
- if (getZone() == Zone.GRAVEYARD) {
- return "if {this} is in your graveyard, ";
- }
- return "";
- }
}
diff --git a/Mage/src/main/java/mage/abilities/common/BeginningOfDrawTriggeredAbility.java b/Mage/src/main/java/mage/abilities/common/BeginningOfDrawTriggeredAbility.java
index 008f2b64a4d6..56c1d966566e 100644
--- a/Mage/src/main/java/mage/abilities/common/BeginningOfDrawTriggeredAbility.java
+++ b/Mage/src/main/java/mage/abilities/common/BeginningOfDrawTriggeredAbility.java
@@ -16,10 +16,6 @@ public class BeginningOfDrawTriggeredAbility extends TriggeredAbilityImpl {
/**
* The Ability sets if no target is defined the target pointer to the active
* player of the current draw phase
- *
- * @param effect
- * @param targetController
- * @param isOptional
*/
public BeginningOfDrawTriggeredAbility(Effect effect, TargetController targetController, boolean isOptional) {
this(Zone.BATTLEFIELD, effect, targetController, isOptional);
@@ -106,26 +102,19 @@ private String generateTriggerPhrase() {
switch (targetController) {
case ACTIVE:
case YOU:
- return "At the beginning of your draw step, " + generateZoneString();
+ return "At the beginning of your draw step, ";
case OPPONENT:
- return "At the beginning of each opponent's draw step, " + generateZoneString();
+ return "At the beginning of each opponent's draw step, ";
case NOT_YOU:
- return "At the beginning of each other player's draw step, " + generateZoneString();
+ return "At the beginning of each other player's draw step, ";
case ANY:
- return "At the beginning of each player's draw step, " + generateZoneString();
+ return "At the beginning of each player's draw step, ";
case CONTROLLER_ATTACHED_TO:
- return "At the beginning of the draw step of enchanted creature's controller, " + generateZoneString();
+ return "At the beginning of the draw step of enchanted creature's controller, ";
case ENCHANTED:
- return "At the beginning of enchanted player's draw step, " + generateZoneString();
+ return "At the beginning of enchanted player's draw step, ";
}
return "";
}
- private String generateZoneString() {
- switch (getZone()) {
- case GRAVEYARD:
- return "if {this} is in your graveyard, ";
- }
- return "";
- }
}
diff --git a/Mage/src/main/java/mage/abilities/common/BeginningOfFirstMainTriggeredAbility.java b/Mage/src/main/java/mage/abilities/common/BeginningOfFirstMainTriggeredAbility.java
index 773a9afe92e3..64c6e65c6e92 100644
--- a/Mage/src/main/java/mage/abilities/common/BeginningOfFirstMainTriggeredAbility.java
+++ b/Mage/src/main/java/mage/abilities/common/BeginningOfFirstMainTriggeredAbility.java
@@ -14,8 +14,8 @@
public class BeginningOfFirstMainTriggeredAbility extends TriggeredAbilityImpl {
- private TargetController targetController;
- private boolean setTargetPointer;
+ private final TargetController targetController;
+ private final boolean setTargetPointer;
public BeginningOfFirstMainTriggeredAbility(Effect effect, TargetController targetController, boolean isOptional) {
this(Zone.BATTLEFIELD, effect, targetController, isOptional, false);
@@ -81,20 +81,13 @@ public boolean checkTrigger(GameEvent event, Game game) {
private String generateTriggerPhrase() {
switch (targetController) {
case YOU:
- return "At the beginning of your first main phase, " + generateZoneString();
+ return "At the beginning of your first main phase, ";
case OPPONENT:
- return "At the beginning of each opponent's first main phase, " + generateZoneString();
+ return "At the beginning of each opponent's first main phase, ";
case ANY:
- return "At the beginning of each player's first main phase, " + generateZoneString();
+ return "At the beginning of each player's first main phase, ";
}
return "";
}
- private String generateZoneString() {
- switch (getZone()) {
- case GRAVEYARD:
- return "if {this} is in your graveyard, ";
- }
- return "";
- }
}
diff --git a/Mage/src/main/java/mage/abilities/common/BeginningOfPostCombatMainTriggeredAbility.java b/Mage/src/main/java/mage/abilities/common/BeginningOfPostCombatMainTriggeredAbility.java
index 229e868e9693..19beaacbf5a4 100644
--- a/Mage/src/main/java/mage/abilities/common/BeginningOfPostCombatMainTriggeredAbility.java
+++ b/Mage/src/main/java/mage/abilities/common/BeginningOfPostCombatMainTriggeredAbility.java
@@ -14,8 +14,8 @@
*/
public class BeginningOfPostCombatMainTriggeredAbility extends TriggeredAbilityImpl {
- private TargetController targetController;
- private boolean setTargetPointer;
+ private final TargetController targetController;
+ private final boolean setTargetPointer;
public BeginningOfPostCombatMainTriggeredAbility(Effect effect, TargetController targetController, boolean isOptional) {
this(Zone.BATTLEFIELD, effect, targetController, isOptional, false);
@@ -90,22 +90,15 @@ public boolean checkTrigger(GameEvent event, Game game) {
private String generateTriggerPhrase() {
switch (targetController) {
case YOU:
- return "At the beginning of each of your postcombat main phases, " + generateZoneString();
+ return "At the beginning of each of your postcombat main phases, ";
case OPPONENT:
- return "At the beginning of each of your opponent's postcombat main phases, " + generateZoneString();
+ return "At the beginning of each of your opponent's postcombat main phases, ";
case ANY:
- return "At the beginning of each postcombat main phase, " + generateZoneString();
+ return "At the beginning of each postcombat main phase, ";
case ENCHANTED:
- return "At the beginning of each of enchanted player's postcombat main phases, " + generateZoneString();
+ return "At the beginning of each of enchanted player's postcombat main phases, ";
}
return "";
}
- private String generateZoneString() {
- switch (getZone()) {
- case GRAVEYARD:
- return "if {this} is in your graveyard, ";
- }
- return "";
- }
}
diff --git a/Mage/src/main/java/mage/abilities/common/BeginningOfSecondMainTriggeredAbility.java b/Mage/src/main/java/mage/abilities/common/BeginningOfSecondMainTriggeredAbility.java
index 9db49f58cbf6..7ed2eba43d90 100644
--- a/Mage/src/main/java/mage/abilities/common/BeginningOfSecondMainTriggeredAbility.java
+++ b/Mage/src/main/java/mage/abilities/common/BeginningOfSecondMainTriggeredAbility.java
@@ -16,8 +16,8 @@
*/
public class BeginningOfSecondMainTriggeredAbility extends TriggeredAbilityImpl {
- private TargetController targetController;
- private boolean setTargetPointer;
+ private final TargetController targetController;
+ private final boolean setTargetPointer;
public BeginningOfSecondMainTriggeredAbility(Effect effect, TargetController targetController, boolean isOptional) {
this(Zone.BATTLEFIELD, effect, targetController, isOptional, false);
@@ -101,24 +101,17 @@ public boolean checkTrigger(GameEvent event, Game game) {
private String generateTriggerPhrase() {
switch (targetController) {
case YOU:
- return "At the beginning of your second main phase, " + generateZoneString();
+ return "At the beginning of your second main phase, ";
case OPPONENT:
- return "At the beginning of each opponent's second main phase, " + generateZoneString();
+ return "At the beginning of each opponent's second main phase, ";
case ANY:
- return "At the beginning of each player's second main phase, " + generateZoneString();
+ return "At the beginning of each player's second main phase, ";
case ENCHANTED:
- return "At the beginning of enchanted player's second main phase, " + generateZoneString();
+ return "At the beginning of enchanted player's second main phase, ";
}
return "";
}
- private String generateZoneString() {
- switch (getZone()) {
- case GRAVEYARD:
- return "if {this} is in your graveyard, ";
- }
- return "";
- }
}
class MainPhaseWatcher extends Watcher {
diff --git a/Mage/src/main/java/mage/abilities/common/BeginningOfUpkeepTriggeredAbility.java b/Mage/src/main/java/mage/abilities/common/BeginningOfUpkeepTriggeredAbility.java
index 29f470c0ee0e..8dd7347b77f3 100644
--- a/Mage/src/main/java/mage/abilities/common/BeginningOfUpkeepTriggeredAbility.java
+++ b/Mage/src/main/java/mage/abilities/common/BeginningOfUpkeepTriggeredAbility.java
@@ -16,7 +16,6 @@ public class BeginningOfUpkeepTriggeredAbility extends TriggeredAbilityImpl {
private final TargetController targetController;
private final boolean setTargetPointer;
- protected String ruleTrigger;
public BeginningOfUpkeepTriggeredAbility(Effect effect, TargetController targetController, boolean isOptional) {
this(Zone.BATTLEFIELD, effect, targetController, isOptional);
@@ -27,14 +26,9 @@ public BeginningOfUpkeepTriggeredAbility(Zone zone, Effect effect, TargetControl
}
public BeginningOfUpkeepTriggeredAbility(Zone zone, Effect effect, TargetController targetController, boolean isOptional, boolean setTargetPointer) {
- this(zone, effect, targetController, isOptional, setTargetPointer, null);
- }
-
- public BeginningOfUpkeepTriggeredAbility(Zone zone, Effect effect, TargetController targetController, boolean isOptional, boolean setTargetPointer, String ruleTrigger) {
super(zone, effect, isOptional);
this.targetController = targetController;
this.setTargetPointer = setTargetPointer;
- this.ruleTrigger = ruleTrigger;
setTriggerPhrase(generateTriggerPhrase());
}
@@ -42,7 +36,6 @@ protected BeginningOfUpkeepTriggeredAbility(final BeginningOfUpkeepTriggeredAbil
super(ability);
this.targetController = ability.targetController;
this.setTargetPointer = ability.setTargetPointer;
- this.ruleTrigger = ability.ruleTrigger;
}
@Override
@@ -113,32 +106,22 @@ public boolean checkTrigger(GameEvent event, Game game) {
}
private String generateTriggerPhrase() {
- if (ruleTrigger != null && !ruleTrigger.isEmpty()) {
- return ruleTrigger;
- }
switch (targetController) {
case YOU:
- return "At the beginning of your upkeep, " + generateZoneString();
+ return "At the beginning of your upkeep, ";
case OPPONENT:
- return "At the beginning of each opponent's upkeep, " + generateZoneString();
+ return "At the beginning of each opponent's upkeep, ";
case ANY:
case ACTIVE:
- return "At the beginning of each player's upkeep, " + generateZoneString();
+ return "At the beginning of each player's upkeep, ";
case EACH_PLAYER:
- return "At the beginning of each upkeep, " + generateZoneString();
+ return "At the beginning of each upkeep, ";
case CONTROLLER_ATTACHED_TO:
- return "At the beginning of the upkeep of enchanted creature's controller, " + generateZoneString();
+ return "At the beginning of the upkeep of enchanted creature's controller, ";
case ENCHANTED:
- return "At the beginning of enchanted player's upkeep, " + generateZoneString();
+ return "At the beginning of enchanted player's upkeep, ";
}
return "";
}
- private String generateZoneString() {
- switch (getZone()) {
- case GRAVEYARD:
- return "if {this} is in your graveyard, ";
- }
- return "";
- }
}
diff --git a/Mage/src/main/java/mage/abilities/common/SurveilTriggeredAbility.java b/Mage/src/main/java/mage/abilities/common/SurveilTriggeredAbility.java
index e4eee23d3849..81deeac70359 100644
--- a/Mage/src/main/java/mage/abilities/common/SurveilTriggeredAbility.java
+++ b/Mage/src/main/java/mage/abilities/common/SurveilTriggeredAbility.java
@@ -17,7 +17,7 @@ public SurveilTriggeredAbility(Effect effect) {
public SurveilTriggeredAbility(Zone zone, Effect effect) {
super(zone, effect);
- setTriggerPhrase("Whenever you surveil, " + (zone == Zone.GRAVEYARD ? "if {this} is in your graveyard, " : ""));
+ setTriggerPhrase("Whenever you surveil, ");
}
private SurveilTriggeredAbility(final SurveilTriggeredAbility ability) {
diff --git a/Mage/src/main/java/mage/abilities/condition/common/SourceInGraveyardCondition.java b/Mage/src/main/java/mage/abilities/condition/common/SourceInGraveyardCondition.java
index 700da660e0bf..f224a7d58600 100644
--- a/Mage/src/main/java/mage/abilities/condition/common/SourceInGraveyardCondition.java
+++ b/Mage/src/main/java/mage/abilities/condition/common/SourceInGraveyardCondition.java
@@ -10,7 +10,6 @@
*
* @author Susucr
*/
-
public enum SourceInGraveyardCondition implements Condition {
instance;
@@ -18,4 +17,10 @@ public enum SourceInGraveyardCondition implements Condition {
public boolean apply(Game game, Ability source) {
return game.getState().getZone(source.getSourceId()) == Zone.GRAVEYARD;
}
+
+ @Override
+ public String toString() {
+ return "{this} is in your graveyard";
+ }
+
}
diff --git a/Mage/src/main/java/mage/abilities/condition/common/SourceOnBattlefieldOrCommandZoneCondition.java b/Mage/src/main/java/mage/abilities/condition/common/SourceOnBattlefieldOrCommandZoneCondition.java
index 8229c464364d..c316f3449293 100644
--- a/Mage/src/main/java/mage/abilities/condition/common/SourceOnBattlefieldOrCommandZoneCondition.java
+++ b/Mage/src/main/java/mage/abilities/condition/common/SourceOnBattlefieldOrCommandZoneCondition.java
@@ -1,28 +1,20 @@
-
package mage.abilities.condition.common;
-import java.util.Iterator;
-import java.util.UUID;
import mage.abilities.Ability;
import mage.abilities.condition.Condition;
import mage.game.Game;
import mage.game.command.CommandObject;
-/**
- * As long as the sourceId permanent is on the battlefield, the condition is
- * true.
- *
- * @author LevelX2
- */
+import java.util.UUID;
+
public enum SourceOnBattlefieldOrCommandZoneCondition implements Condition {
instance;
@Override
public boolean apply(Game game, Ability source) {
- Iterator commandZone = game.getState().getCommand().iterator();
- while (commandZone.hasNext()) {
- UUID thing = commandZone.next().getId();
+ for (CommandObject commandObject : game.getState().getCommand()) {
+ UUID thing = commandObject.getId();
if (thing.equals(source.getSourceId())) {
return true;
}
@@ -32,7 +24,7 @@ public boolean apply(Game game, Ability source) {
@Override
public String toString() {
- return "if {this} is on the battlefield";
+ return "if {this} is in the command zone or on the battlefield";
}
}
diff --git a/Mage/src/main/java/mage/abilities/effects/common/counter/RemoveCounterSourceEffect.java b/Mage/src/main/java/mage/abilities/effects/common/counter/RemoveCounterSourceEffect.java
index 27e4f360778d..989f3746c35e 100644
--- a/Mage/src/main/java/mage/abilities/effects/common/counter/RemoveCounterSourceEffect.java
+++ b/Mage/src/main/java/mage/abilities/effects/common/counter/RemoveCounterSourceEffect.java
@@ -33,26 +33,20 @@ public boolean apply(Game game, Ability source) {
int toRemove = Math.min(counter.getCount(), permanent.getCounters(game).getCount(counter.getName()));
if (toRemove > 0) {
permanent.removeCounters(counter.getName(), toRemove, source, game);
- if (!game.isSimulation()) {
- game.informPlayers("Removed " + toRemove + ' ' + counter.getName() + " counter from " + permanent.getLogName());
- }
+ game.informPlayers("Removed " + toRemove + ' ' + counter.getName() + " counter from " + permanent.getLogName());
}
return true;
}
- if (!(source.getSourceObject(game) instanceof Permanent)) {
- Card card = game.getCard(source.getSourceId());
- if (card != null) {
- int toRemove = Math.min(counter.getCount(), card.getCounters(game).getCount(counter.getName()));
- if (toRemove > 0) {
- card.removeCounters(counter.getName(), toRemove, source, game);
- if (!game.isSimulation()) {
- game.informPlayers("Removed " + toRemove + ' ' + counter.getName()
- + " counter from " + card.getLogName()
- + " (" + card.getCounters(game).getCount(counter.getName()) + " left)");
- }
- }
- return true;
+ Card card = source.getSourceCardIfItStillExists(game);
+ if (card != null) {
+ int toRemove = Math.min(counter.getCount(), card.getCounters(game).getCount(counter.getName()));
+ if (toRemove > 0) {
+ card.removeCounters(counter.getName(), toRemove, source, game);
+ game.informPlayers("Removed " + toRemove + ' ' + counter.getName()
+ + " counter from " + card.getLogName()
+ + " (" + card.getCounters(game).getCount(counter.getName()) + " left)");
}
+ return true;
}
return false;
}
diff --git a/Mage/src/main/java/mage/abilities/keyword/RepairAbility.java b/Mage/src/main/java/mage/abilities/keyword/RepairAbility.java
index e073fe52e89c..ea06fade7e3b 100644
--- a/Mage/src/main/java/mage/abilities/keyword/RepairAbility.java
+++ b/Mage/src/main/java/mage/abilities/keyword/RepairAbility.java
@@ -4,8 +4,6 @@
import mage.abilities.TriggeredAbilityImpl;
import mage.abilities.common.BeginningOfUpkeepTriggeredAbility;
import mage.abilities.common.DiesSourceTriggeredAbility;
-import mage.abilities.condition.common.SourceHasCounterCondition;
-import mage.abilities.decorator.ConditionalInterveningIfTriggeredAbility;
import mage.abilities.dynamicvalue.common.StaticValue;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.common.asthought.PlayFromNotOwnHandZoneTargetEffect;
@@ -27,28 +25,28 @@
*/
public class RepairAbility extends DiesSourceTriggeredAbility {
- private final String ruleText;
+ private final int count;
public RepairAbility(int count) {
super(new AddCountersSourceEffect(
CounterType.REPAIR.createInstance(), StaticValue.get(count), false, true));
- addSubAbility(new RepairBeginningOfUpkeepInterveningIfTriggeredAbility());
+ addSubAbility(new BeginningOfUpkeepTriggeredAbility(Zone.GRAVEYARD,
+ new RemoveCounterSourceEffect(CounterType.REPAIR.createInstance()), TargetController.YOU, false)
+ .setRuleVisible(false));
addSubAbility(new RepairCastFromGraveyardTriggeredAbility());
-
- ruleText = "Repair " + count + " (When this creature dies, put " + count
- + " repair counters on it. At the beginning of your upkeep, remove a repair counter. "
- + "Whenever the last is removed, you may cast it from graveyard until end of turn.)";
-
+ this.count = count;
}
protected RepairAbility(final RepairAbility ability) {
super(ability);
- this.ruleText = ability.ruleText;
+ this.count = ability.count;
}
@Override
public String getRule() {
- return ruleText;
+ return "Repair " + count + " (When this creature dies, put " + count
+ + " repair counters on it. At the beginning of your upkeep, remove a repair counter. "
+ + "Whenever the last is removed, you may cast it from graveyard until end of turn.)";
}
@Override
@@ -59,7 +57,7 @@ public RepairAbility copy() {
class RepairedCastFromGraveyardEffect extends OneShotEffect {
- public RepairedCastFromGraveyardEffect() {
+ RepairedCastFromGraveyardEffect() {
super(Outcome.Benefit);
}
@@ -75,11 +73,8 @@ public RepairedCastFromGraveyardEffect copy() {
@Override
public boolean apply(Game game, Ability source) {
Player controller = game.getPlayer(source.getControllerId());
- if (controller == null) {
- return false;
- }
- Card card = game.getCard(source.getSourceId());
- if (card == null) {
+ Card card = source.getSourceCardIfItStillExists(game);
+ if (controller == null || card == null) {
return false;
}
game.addEffect(new PlayFromNotOwnHandZoneTargetEffect(Zone.GRAVEYARD, Duration.UntilYourNextEndStep)
@@ -90,12 +85,12 @@ public boolean apply(Game game, Ability source) {
class RepairCastFromGraveyardTriggeredAbility extends TriggeredAbilityImpl {
- public RepairCastFromGraveyardTriggeredAbility() {
+ RepairCastFromGraveyardTriggeredAbility() {
super(Zone.GRAVEYARD, new RepairedCastFromGraveyardEffect());
setRuleVisible(false);
}
- public RepairCastFromGraveyardTriggeredAbility(RepairCastFromGraveyardTriggeredAbility ability) {
+ private RepairCastFromGraveyardTriggeredAbility(RepairCastFromGraveyardTriggeredAbility ability) {
super(ability);
}
@@ -109,6 +104,7 @@ public boolean checkTrigger(GameEvent event, Game game) {
if (event.getTargetId().equals(getSourceId())) {
Card card = game.getCard(getSourceId());
return card != null && game.getState().getZone(card.getId()) == Zone.GRAVEYARD
+ && event.getData().equals(CounterType.REPAIR.getName())
&& card.getCounters(game).getCount(CounterType.REPAIR) == 0;
}
return false;
@@ -124,23 +120,3 @@ public RepairCastFromGraveyardTriggeredAbility copy() {
return new RepairCastFromGraveyardTriggeredAbility(this);
}
}
-
-class RepairBeginningOfUpkeepInterveningIfTriggeredAbility extends ConditionalInterveningIfTriggeredAbility {
-
- public RepairBeginningOfUpkeepInterveningIfTriggeredAbility() {
- super(new BeginningOfUpkeepTriggeredAbility(Zone.GRAVEYARD,
- new RemoveCounterSourceEffect(CounterType.REPAIR.createInstance()), TargetController.YOU, false),
- new SourceHasCounterCondition(CounterType.REPAIR),
- "At the beginning of your upkeep, remove a repair counter from {this}");
- this.setRuleVisible(false);
- }
-
- protected RepairBeginningOfUpkeepInterveningIfTriggeredAbility(final RepairBeginningOfUpkeepInterveningIfTriggeredAbility effect) {
- super(effect);
- }
-
- @Override
- public RepairBeginningOfUpkeepInterveningIfTriggeredAbility copy() {
- return new RepairBeginningOfUpkeepInterveningIfTriggeredAbility(this);
- }
-}