mirror of
https://github.com/correl/mage.git
synced 2024-11-25 03:00:11 +00:00
remove the SimpleTriggeredAbility class and rewrite old cards using it
This commit is contained in:
parent
b640646cab
commit
895430b554
5 changed files with 6 additions and 80 deletions
|
@ -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) {
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue