diff --git a/Mage.Sets/src/mage/cards/c/Confessor.java b/Mage.Sets/src/mage/cards/c/Confessor.java index 47943470f4..66bd1bfdf9 100644 --- a/Mage.Sets/src/mage/cards/c/Confessor.java +++ b/Mage.Sets/src/mage/cards/c/Confessor.java @@ -3,14 +3,12 @@ package mage.cards.c; import java.util.UUID; import mage.MageInt; -import mage.abilities.common.SimpleTriggeredAbility; +import mage.abilities.effects.common.DiscardCardPlayerTriggeredAbility; import mage.abilities.effects.common.GainLifeEffect; import mage.cards.CardImpl; import mage.cards.CardSetInfo; import mage.constants.CardType; import mage.constants.SubType; -import mage.constants.Zone; -import mage.game.events.GameEvent.EventType; /** * @@ -27,8 +25,7 @@ public final class Confessor extends CardImpl { this.toughness = new MageInt(1); // Whenever a player discards a card, you may gain 1 life. - this.addAbility(new SimpleTriggeredAbility( - Zone.BATTLEFIELD, EventType.DISCARDED_CARD, new GainLifeEffect(1), "Whenever a player discards a card, ", false, true)); + this.addAbility(new DiscardCardPlayerTriggeredAbility(new GainLifeEffect(1), true)); } private Confessor(final Confessor card) { diff --git a/Mage.Sets/src/mage/cards/s/SearingMeditation.java b/Mage.Sets/src/mage/cards/s/SearingMeditation.java index a9996c5efb..e030a1144f 100644 --- a/Mage.Sets/src/mage/cards/s/SearingMeditation.java +++ b/Mage.Sets/src/mage/cards/s/SearingMeditation.java @@ -3,15 +3,13 @@ package mage.cards.s; import java.util.UUID; import mage.abilities.Ability; -import mage.abilities.common.SimpleTriggeredAbility; +import mage.abilities.common.GainLifeControllerTriggeredAbility; import mage.abilities.costs.mana.GenericManaCost; import mage.abilities.effects.common.DamageTargetEffect; import mage.abilities.effects.common.DoIfCostPaid; import mage.cards.CardImpl; import mage.cards.CardSetInfo; import mage.constants.CardType; -import mage.constants.Zone; -import mage.game.events.GameEvent; import mage.target.common.TargetAnyTarget; /** @@ -25,7 +23,7 @@ public final class SearingMeditation extends CardImpl { // Whenever you gain life, you may pay {2}. If you do, Searing Meditation deals 2 damage to any target. - Ability ability = new SimpleTriggeredAbility(Zone.BATTLEFIELD, GameEvent.EventType.GAINED_LIFE, new DoIfCostPaid(new DamageTargetEffect(2), new GenericManaCost(2)), "Whenever you gain life, ", true); + Ability ability = new GainLifeControllerTriggeredAbility(new DoIfCostPaid(new DamageTargetEffect(2), new GenericManaCost(2)), false, true); ability.addTarget(new TargetAnyTarget()); this.addAbility(ability); } diff --git a/Mage.Sets/src/mage/cards/s/SpiritCairn.java b/Mage.Sets/src/mage/cards/s/SpiritCairn.java index fa1ca494e0..bc1eea191e 100644 --- a/Mage.Sets/src/mage/cards/s/SpiritCairn.java +++ b/Mage.Sets/src/mage/cards/s/SpiritCairn.java @@ -2,15 +2,13 @@ package mage.cards.s; import java.util.UUID; -import mage.abilities.common.SimpleTriggeredAbility; import mage.abilities.costs.mana.ManaCostsImpl; import mage.abilities.effects.common.CreateTokenEffect; +import mage.abilities.effects.common.DiscardCardPlayerTriggeredAbility; import mage.abilities.effects.common.DoIfCostPaid; import mage.cards.CardImpl; import mage.cards.CardSetInfo; import mage.constants.CardType; -import mage.constants.Zone; -import mage.game.events.GameEvent; import mage.game.permanent.token.SpiritWhiteToken; /** @@ -23,10 +21,7 @@ public final class SpiritCairn extends CardImpl { super(ownerId,setInfo,new CardType[]{CardType.ENCHANTMENT},"{2}{W}"); // Whenever a player discards a card, you may pay {W}. If you do, create a 1/1 white Spirit creature token with flying. - this.addAbility(new SimpleTriggeredAbility(Zone.BATTLEFIELD, GameEvent.EventType.DISCARDED_CARD, - new DoIfCostPaid(new CreateTokenEffect(new SpiritWhiteToken()), new ManaCostsImpl("{W}")), - "Whenever a player discards a card, ", - false, false)); + this.addAbility(new DiscardCardPlayerTriggeredAbility(new DoIfCostPaid(new CreateTokenEffect(new SpiritWhiteToken()), new ManaCostsImpl("{W}")),false)); } private SpiritCairn(final SpiritCairn card) { diff --git a/Mage.Tests/src/test/java/org/mage/test/cards/abilities/keywords/LandfallTest.java b/Mage.Tests/src/test/java/org/mage/test/cards/abilities/keywords/LandfallTest.java index 4599e920e7..18be53c551 100644 --- a/Mage.Tests/src/test/java/org/mage/test/cards/abilities/keywords/LandfallTest.java +++ b/Mage.Tests/src/test/java/org/mage/test/cards/abilities/keywords/LandfallTest.java @@ -94,7 +94,6 @@ public class LandfallTest extends CardTestPlayerBase { * Fang. It only dealt 1 damage to me, where it should've dealt 3, because * my opponent had played a land. */ - @Ignore @Test public void testSearingBlaze() { // Searing Blaze deals 1 damage to target player and 1 damage to target creature that player controls. diff --git a/Mage/src/main/java/mage/abilities/common/SimpleTriggeredAbility.java b/Mage/src/main/java/mage/abilities/common/SimpleTriggeredAbility.java deleted file mode 100644 index 2ca4e134b5..0000000000 --- a/Mage/src/main/java/mage/abilities/common/SimpleTriggeredAbility.java +++ /dev/null @@ -1,63 +0,0 @@ - - -package mage.abilities.common; - -import mage.constants.Zone; -import mage.abilities.TriggeredAbilityImpl; -import mage.abilities.effects.Effect; -import mage.game.Game; -import mage.game.events.GameEvent; -import mage.game.events.GameEvent.EventType; - -/** - * - * @author BetaSteward_at_googlemail.com - */ -public class SimpleTriggeredAbility extends TriggeredAbilityImpl { - - private EventType eventType; - private boolean onlyController; - private String prefix; - - public SimpleTriggeredAbility(Zone zone, EventType eventType, Effect effect, String prefix) { - this(zone, eventType, effect, prefix, false); - } - - public SimpleTriggeredAbility(Zone zone, EventType eventType, Effect effect, String prefix, boolean onlyController) { - this(zone, eventType, effect, prefix, onlyController, false); - } - - public SimpleTriggeredAbility(Zone zone, EventType eventType, Effect effect, String prefix, boolean onlyController, boolean optional) { - super(zone, effect, optional); - this.eventType = eventType; - this.onlyController = onlyController; - this.prefix = prefix; - } - - public SimpleTriggeredAbility(final SimpleTriggeredAbility ability) { - super(ability); - this.eventType = ability.eventType; - this.onlyController = ability.onlyController; - this.prefix = ability.prefix; - } - - @Override - public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == eventType; - } - - @Override - public boolean checkTrigger(GameEvent event, Game game) { - return !onlyController || event.getPlayerId().equals(this.controllerId); - } - - @Override - public SimpleTriggeredAbility copy() { - return new SimpleTriggeredAbility(this); - } - - @Override - public String getRule() { - return prefix + super.getRule(); - } -}