refactor: remove OnEventTriggeredAbility

This commit is contained in:
theelk801 2025-06-15 15:28:08 -04:00
parent d893d52190
commit 6d3bd7a19f
30 changed files with 229 additions and 339 deletions

View file

@ -1,24 +1,22 @@
package mage.cards.a; package mage.cards.a;
import java.util.UUID;
import mage.abilities.common.OnEventTriggeredAbility;
import mage.abilities.effects.common.GainLifeEffect; import mage.abilities.effects.common.GainLifeEffect;
import mage.abilities.triggers.BeginningOfUpkeepTriggeredAbility;
import mage.cards.CardImpl; import mage.cards.CardImpl;
import mage.cards.CardSetInfo; import mage.cards.CardSetInfo;
import mage.constants.CardType; import mage.constants.CardType;
import mage.game.events.GameEvent.EventType;
import java.util.UUID;
/** /**
*
* @author BetaSteward_at_googlemail.com * @author BetaSteward_at_googlemail.com
*/ */
public final class AjanisMantra extends CardImpl { public final class AjanisMantra extends CardImpl {
public AjanisMantra(UUID ownerId, CardSetInfo setInfo) { public AjanisMantra(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.ENCHANTMENT},"{1}{W}"); super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{1}{W}");
this.addAbility(new OnEventTriggeredAbility(EventType.UPKEEP_STEP_PRE, "beginning of your upkeep", new GainLifeEffect(1), true));
this.addAbility(new BeginningOfUpkeepTriggeredAbility(new GainLifeEffect(1), true));
} }
private AjanisMantra(final AjanisMantra card) { private AjanisMantra(final AjanisMantra card) {
@ -29,5 +27,4 @@ public final class AjanisMantra extends CardImpl {
public AjanisMantra copy() { public AjanisMantra copy() {
return new AjanisMantra(this); return new AjanisMantra(this);
} }
} }

View file

@ -1,26 +1,24 @@
package mage.cards.a; package mage.cards.a;
import java.util.UUID;
import mage.MageInt; import mage.MageInt;
import mage.abilities.common.OnEventTriggeredAbility;
import mage.abilities.effects.common.SacrificeSourceEffect; import mage.abilities.effects.common.SacrificeSourceEffect;
import mage.abilities.keyword.HasteAbility; import mage.abilities.keyword.HasteAbility;
import mage.abilities.triggers.BeginningOfEndStepTriggeredAbility;
import mage.cards.CardImpl; import mage.cards.CardImpl;
import mage.cards.CardSetInfo; import mage.cards.CardSetInfo;
import mage.constants.CardType; import mage.constants.CardType;
import mage.constants.SubType; import mage.constants.SubType;
import mage.game.events.GameEvent.EventType; import mage.constants.TargetController;
import java.util.UUID;
/** /**
*
* @author BetaSteward_at_googlemail.com * @author BetaSteward_at_googlemail.com
*/ */
public final class ArcRunner extends CardImpl { public final class ArcRunner extends CardImpl {
public ArcRunner(UUID ownerId, CardSetInfo setInfo) { public ArcRunner(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{2}{R}"); super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{2}{R}");
this.subtype.add(SubType.ELEMENTAL); this.subtype.add(SubType.ELEMENTAL);
this.subtype.add(SubType.OX); this.subtype.add(SubType.OX);
@ -28,7 +26,10 @@ public final class ArcRunner extends CardImpl {
this.toughness = new MageInt(1); this.toughness = new MageInt(1);
this.addAbility(HasteAbility.getInstance()); this.addAbility(HasteAbility.getInstance());
this.addAbility(new OnEventTriggeredAbility(EventType.END_TURN_STEP_PRE, "beginning of the end step", true, new SacrificeSourceEffect()));
this.addAbility(new BeginningOfEndStepTriggeredAbility(
TargetController.NEXT, new SacrificeSourceEffect(), false
));
} }
private ArcRunner(final ArcRunner card) { private ArcRunner(final ArcRunner card) {

View file

@ -1,27 +1,26 @@
package mage.cards.a; package mage.cards.a;
import java.util.UUID;
import mage.MageInt; import mage.MageInt;
import mage.abilities.common.OnEventTriggeredAbility;
import mage.abilities.effects.common.counter.AddCountersAllEffect; import mage.abilities.effects.common.counter.AddCountersAllEffect;
import mage.abilities.keyword.ModularAbility; import mage.abilities.keyword.ModularAbility;
import mage.abilities.triggers.BeginningOfUpkeepTriggeredAbility;
import mage.cards.CardImpl; import mage.cards.CardImpl;
import mage.cards.CardSetInfo; import mage.cards.CardSetInfo;
import mage.constants.CardType; import mage.constants.CardType;
import mage.constants.SubType; import mage.constants.SubType;
import mage.counters.CounterType; import mage.counters.CounterType;
import mage.filter.FilterPermanent;
import mage.filter.common.FilterControlledCreaturePermanent; import mage.filter.common.FilterControlledCreaturePermanent;
import mage.filter.predicate.mageobject.AbilityPredicate; import mage.filter.predicate.mageobject.AbilityPredicate;
import mage.game.events.GameEvent;
import java.util.UUID;
/** /**
*
* @author jonubuu * @author jonubuu
*/ */
public final class ArcboundOverseer extends CardImpl { public final class ArcboundOverseer extends CardImpl {
private static final FilterControlledCreaturePermanent filter; private static final FilterPermanent filter;
static { static {
filter = new FilterControlledCreaturePermanent("creature you control with modular"); filter = new FilterControlledCreaturePermanent("creature you control with modular");
@ -29,16 +28,16 @@ public final class ArcboundOverseer extends CardImpl {
} }
public ArcboundOverseer(UUID ownerId, CardSetInfo setInfo) { public ArcboundOverseer(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.ARTIFACT,CardType.CREATURE},"{8}"); super(ownerId, setInfo, new CardType[]{CardType.ARTIFACT, CardType.CREATURE}, "{8}");
this.subtype.add(SubType.GOLEM); this.subtype.add(SubType.GOLEM);
this.power = new MageInt(0); this.power = new MageInt(0);
this.toughness = new MageInt(0); this.toughness = new MageInt(0);
// At the beginning of your upkeep, put a +1/+1 counter on each creature with modular you control. // At the beginning of your upkeep, put a +1/+1 counter on each creature with modular you control.
this.addAbility(new OnEventTriggeredAbility( this.addAbility(new BeginningOfUpkeepTriggeredAbility(
GameEvent.EventType.UPKEEP_STEP_PRE, new AddCountersAllEffect(CounterType.P1P1.createInstance(), filter)
"beginning of your upkeep", ));
new AddCountersAllEffect(CounterType.P1P1.createInstance(), filter)));
// Modular 6 // Modular 6
this.addAbility(new ModularAbility(this, 6)); this.addAbility(new ModularAbility(this, 6));
} }

View file

@ -2,10 +2,10 @@ package mage.cards.a;
import mage.MageInt; import mage.MageInt;
import mage.abilities.Ability; import mage.abilities.Ability;
import mage.abilities.common.OnEventTriggeredAbility;
import mage.abilities.effects.OneShotEffect; import mage.abilities.effects.OneShotEffect;
import mage.abilities.keyword.FlyingAbility; import mage.abilities.keyword.FlyingAbility;
import mage.abilities.keyword.TrampleAbility; import mage.abilities.keyword.TrampleAbility;
import mage.abilities.triggers.BeginningOfUpkeepTriggeredAbility;
import mage.cards.CardImpl; import mage.cards.CardImpl;
import mage.cards.CardSetInfo; import mage.cards.CardSetInfo;
import mage.constants.CardType; import mage.constants.CardType;
@ -13,7 +13,6 @@ import mage.constants.Outcome;
import mage.constants.SubType; import mage.constants.SubType;
import mage.filter.common.FilterControlledPermanent; import mage.filter.common.FilterControlledPermanent;
import mage.game.Game; import mage.game.Game;
import mage.game.events.GameEvent;
import mage.game.permanent.Permanent; import mage.game.permanent.Permanent;
import mage.players.Player; import mage.players.Player;
import mage.target.common.TargetSacrifice; import mage.target.common.TargetSacrifice;
@ -43,8 +42,9 @@ public final class ArchdemonOfGreed extends CardImpl {
this.addAbility(FlyingAbility.getInstance()); this.addAbility(FlyingAbility.getInstance());
this.addAbility(TrampleAbility.getInstance()); this.addAbility(TrampleAbility.getInstance());
// At the beginning of your upkeep, sacrifice a Human. If you can't, tap Archdemon of Greed and it deals 9 damage to you. // At the beginning of your upkeep, sacrifice a Human. If you can't, tap Archdemon of Greed and it deals 9 damage to you.
this.addAbility(new OnEventTriggeredAbility(GameEvent.EventType.UPKEEP_STEP_PRE, "beginning of your upkeep", new ArchdemonOfGreedEffect(), false)); this.addAbility(new BeginningOfUpkeepTriggeredAbility(new ArchdemonOfGreedEffect()));
} }
private ArchdemonOfGreed(final ArchdemonOfGreed card) { private ArchdemonOfGreed(final ArchdemonOfGreed card) {
@ -60,7 +60,7 @@ public final class ArchdemonOfGreed extends CardImpl {
public ArchdemonOfGreedEffect() { public ArchdemonOfGreedEffect() {
super(Outcome.Damage); super(Outcome.Damage);
this.staticText = "Sacrifice a Human. If you can't, tap {this} and it deals 9 damage to you."; this.staticText = "sacrifice a Human. If you can't, tap {this} and it deals 9 damage to you.";
} }
private ArchdemonOfGreedEffect(final ArchdemonOfGreedEffect effect) { private ArchdemonOfGreedEffect(final ArchdemonOfGreedEffect effect) {

View file

@ -1,27 +1,25 @@
package mage.cards.b; package mage.cards.b;
import java.util.UUID;
import mage.MageInt; import mage.MageInt;
import mage.abilities.common.OnEventTriggeredAbility;
import mage.abilities.effects.common.SacrificeSourceEffect; import mage.abilities.effects.common.SacrificeSourceEffect;
import mage.abilities.keyword.HasteAbility; import mage.abilities.keyword.HasteAbility;
import mage.abilities.keyword.TrampleAbility; import mage.abilities.keyword.TrampleAbility;
import mage.abilities.triggers.BeginningOfEndStepTriggeredAbility;
import mage.cards.CardImpl; import mage.cards.CardImpl;
import mage.cards.CardSetInfo; import mage.cards.CardSetInfo;
import mage.constants.CardType; import mage.constants.CardType;
import mage.constants.SubType; import mage.constants.SubType;
import mage.game.events.GameEvent.EventType; import mage.constants.TargetController;
import java.util.UUID;
/** /**
*
* @author BetaSteward_at_googlemail.com * @author BetaSteward_at_googlemail.com
*/ */
public final class BallLightning extends CardImpl { public final class BallLightning extends CardImpl {
public BallLightning(UUID ownerId, CardSetInfo setInfo) { public BallLightning(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{R}{R}{R}"); super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{R}{R}{R}");
this.subtype.add(SubType.ELEMENTAL); this.subtype.add(SubType.ELEMENTAL);
this.power = new MageInt(6); this.power = new MageInt(6);
@ -29,7 +27,9 @@ public final class BallLightning extends CardImpl {
this.addAbility(TrampleAbility.getInstance()); this.addAbility(TrampleAbility.getInstance());
this.addAbility(HasteAbility.getInstance()); this.addAbility(HasteAbility.getInstance());
this.addAbility(new OnEventTriggeredAbility(EventType.END_TURN_STEP_PRE, "beginning of the end step", true, new SacrificeSourceEffect())); this.addAbility(new BeginningOfEndStepTriggeredAbility(
TargetController.NEXT, new SacrificeSourceEffect(), false
));
} }
private BallLightning(final BallLightning card) { private BallLightning(final BallLightning card) {

View file

@ -1,28 +1,28 @@
package mage.cards.b; package mage.cards.b;
import java.util.UUID;
import mage.MageInt; import mage.MageInt;
import mage.abilities.common.OnEventTriggeredAbility;
import mage.abilities.costs.mana.ManaCostsImpl; import mage.abilities.costs.mana.ManaCostsImpl;
import mage.abilities.effects.common.SacrificeSourceEffect; import mage.abilities.effects.common.SacrificeSourceEffect;
import mage.abilities.keyword.HasteAbility; import mage.abilities.keyword.HasteAbility;
import mage.abilities.keyword.MorphAbility; import mage.abilities.keyword.MorphAbility;
import mage.abilities.keyword.TrampleAbility; import mage.abilities.keyword.TrampleAbility;
import mage.abilities.triggers.BeginningOfEndStepTriggeredAbility;
import mage.cards.CardImpl; import mage.cards.CardImpl;
import mage.cards.CardSetInfo; import mage.cards.CardSetInfo;
import mage.constants.CardType; import mage.constants.CardType;
import mage.constants.SubType; import mage.constants.SubType;
import mage.game.events.GameEvent; import mage.constants.TargetController;
import java.util.UUID;
/** /**
*
* @author LevelX2 * @author LevelX2
*/ */
public final class BlisteringFirecat extends CardImpl { public final class BlisteringFirecat extends CardImpl {
public BlisteringFirecat(UUID ownerId, CardSetInfo setInfo) { public BlisteringFirecat(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{1}{R}{R}{R}"); super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{1}{R}{R}{R}");
this.subtype.add(SubType.ELEMENTAL, SubType.CAT); this.subtype.add(SubType.ELEMENTAL, SubType.CAT);
this.power = new MageInt(7); this.power = new MageInt(7);
@ -30,10 +30,15 @@ public final class BlisteringFirecat extends CardImpl {
// Trample // Trample
this.addAbility(TrampleAbility.getInstance()); this.addAbility(TrampleAbility.getInstance());
// Haste // Haste
this.addAbility(HasteAbility.getInstance()); this.addAbility(HasteAbility.getInstance());
// At the beginning of the end step, sacrifice Blistering Firecat. // At the beginning of the end step, sacrifice Blistering Firecat.
this.addAbility(new OnEventTriggeredAbility(GameEvent.EventType.END_TURN_STEP_PRE, "beginning of the end step", true, new SacrificeSourceEffect())); this.addAbility(new BeginningOfEndStepTriggeredAbility(
TargetController.NEXT, new SacrificeSourceEffect(), false
));
// Morph {R}{R} // Morph {R}{R}
this.addAbility(new MorphAbility(this, new ManaCostsImpl<>("{R}{R}"))); this.addAbility(new MorphAbility(this, new ManaCostsImpl<>("{R}{R}")));
} }

View file

@ -1,40 +1,36 @@
package mage.cards.b; package mage.cards.b;
import java.util.UUID;
import mage.MageInt; import mage.MageInt;
import mage.abilities.Ability; import mage.abilities.Ability;
import mage.abilities.common.OnEventTriggeredAbility;
import mage.abilities.effects.Effect;
import mage.abilities.effects.common.DrawCardTargetEffect; import mage.abilities.effects.common.DrawCardTargetEffect;
import mage.abilities.effects.common.LoseLifeTargetEffect; import mage.abilities.effects.common.LoseLifeTargetEffect;
import mage.abilities.keyword.FlyingAbility; import mage.abilities.keyword.FlyingAbility;
import mage.abilities.triggers.BeginningOfUpkeepTriggeredAbility;
import mage.cards.CardImpl; import mage.cards.CardImpl;
import mage.cards.CardSetInfo; import mage.cards.CardSetInfo;
import mage.constants.CardType; import mage.constants.CardType;
import mage.constants.SubType; import mage.constants.SubType;
import mage.game.events.GameEvent.EventType;
import mage.target.TargetPlayer; import mage.target.TargetPlayer;
import java.util.UUID;
/** /**
*
* @author North * @author North
*/ */
public final class BloodgiftDemon extends CardImpl { public final class BloodgiftDemon extends CardImpl {
public BloodgiftDemon(UUID ownerId, CardSetInfo setInfo) { public BloodgiftDemon(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{3}{B}{B}"); super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{3}{B}{B}");
this.subtype.add(SubType.DEMON); this.subtype.add(SubType.DEMON);
this.power = new MageInt(5); this.power = new MageInt(5);
this.toughness = new MageInt(4); this.toughness = new MageInt(4);
this.addAbility(FlyingAbility.getInstance()); this.addAbility(FlyingAbility.getInstance());
// At the beginning of your upkeep, target player draws a card and loses 1 life. // At the beginning of your upkeep, target player draws a card and loses 1 life.
Ability ability = new OnEventTriggeredAbility(EventType.UPKEEP_STEP_PRE, "beginning of your upkeep", new DrawCardTargetEffect(1), false); Ability ability = new BeginningOfUpkeepTriggeredAbility(new DrawCardTargetEffect(1));
Effect effect = new LoseLifeTargetEffect(1); ability.addEffect(new LoseLifeTargetEffect(1).setText("and loses 1 life"));
effect.setText("and loses 1 life");
ability.addEffect(effect);
ability.addTarget(new TargetPlayer()); ability.addTarget(new TargetPlayer());
this.addAbility(ability); this.addAbility(ability);
} }

View file

@ -1,10 +1,10 @@
package mage.cards.c; package mage.cards.c;
import mage.abilities.Ability; import mage.abilities.Ability;
import mage.abilities.common.OnEventTriggeredAbility;
import mage.abilities.effects.OneShotEffect; import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.common.AttachEffect; import mage.abilities.effects.common.AttachEffect;
import mage.abilities.keyword.EnchantAbility; import mage.abilities.keyword.EnchantAbility;
import mage.abilities.triggers.BeginningOfUpkeepTriggeredAbility;
import mage.cards.*; import mage.cards.*;
import mage.constants.CardType; import mage.constants.CardType;
import mage.constants.Outcome; import mage.constants.Outcome;
@ -13,7 +13,6 @@ import mage.constants.Zone;
import mage.filter.common.FilterCreatureCard; import mage.filter.common.FilterCreatureCard;
import mage.filter.predicate.mageobject.SharesCreatureTypePredicate; import mage.filter.predicate.mageobject.SharesCreatureTypePredicate;
import mage.game.Game; import mage.game.Game;
import mage.game.events.GameEvent;
import mage.game.permanent.Permanent; import mage.game.permanent.Permanent;
import mage.players.Player; import mage.players.Player;
import mage.target.TargetCard; import mage.target.TargetCard;
@ -41,7 +40,7 @@ public final class CallToTheKindred extends CardImpl {
// At the beginning of your upkeep, you may look at the top five cards of your library. // At the beginning of your upkeep, you may look at the top five cards of your library.
// If you do, you may put a creature card that shares a creature type with enchanted creature from among them onto the battlefield, // If you do, you may put a creature card that shares a creature type with enchanted creature from among them onto the battlefield,
// then you put the rest of those cards on the bottom of your library in any order. // then you put the rest of those cards on the bottom of your library in any order.
this.addAbility(new OnEventTriggeredAbility(GameEvent.EventType.UPKEEP_STEP_PRE, "beginning of your upkeep", new CallToTheKindredEffect(), true)); this.addAbility(new BeginningOfUpkeepTriggeredAbility(new CallToTheKindredEffect(), true));
} }
private CallToTheKindred(final CallToTheKindred card) { private CallToTheKindred(final CallToTheKindred card) {

View file

@ -1,20 +1,17 @@
package mage.cards.c; package mage.cards.c;
import mage.abilities.Ability; import mage.abilities.Ability;
import mage.abilities.Mode;
import mage.abilities.TriggeredAbility;
import mage.abilities.common.OnEventTriggeredAbility;
import mage.abilities.effects.Effect;
import mage.abilities.effects.OneShotEffect; import mage.abilities.effects.OneShotEffect;
import mage.abilities.triggers.BeginningOfEndStepTriggeredAbility;
import mage.cards.CardImpl; import mage.cards.CardImpl;
import mage.cards.CardSetInfo; import mage.cards.CardSetInfo;
import mage.constants.CardType; import mage.constants.CardType;
import mage.constants.Outcome; import mage.constants.Outcome;
import mage.constants.TargetController;
import mage.filter.FilterPermanent; import mage.filter.FilterPermanent;
import mage.filter.common.FilterControlledLandPermanent; import mage.filter.common.FilterControlledLandPermanent;
import mage.filter.predicate.permanent.TappedPredicate; import mage.filter.predicate.permanent.TappedPredicate;
import mage.game.Game; import mage.game.Game;
import mage.game.events.GameEvent;
import mage.players.Player; import mage.players.Player;
import java.util.UUID; import java.util.UUID;
@ -28,10 +25,9 @@ public final class CitadelOfPain extends CardImpl {
super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{2}{R}"); super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{2}{R}");
// At the beginning of each player's end step, Citadel of Pain deals X damage to that player, where X is the number of untapped lands they control. // At the beginning of each player's end step, Citadel of Pain deals X damage to that player, where X is the number of untapped lands they control.
TriggeredAbility triggered = new OnEventTriggeredAbility(GameEvent.EventType.END_TURN_STEP_PRE, this.addAbility(new BeginningOfEndStepTriggeredAbility(
"beginning of the end step", true, TargetController.EACH_PLAYER, new CitadelOfPainEffect(), false
new CitadelOfPainEffect()); ));
this.addAbility(triggered);
} }
private CitadelOfPain(final CitadelOfPain card) { private CitadelOfPain(final CitadelOfPain card) {
@ -64,13 +60,12 @@ class CitadelOfPainEffect extends OneShotEffect {
@Override @Override
public boolean apply(Game game, Ability source) { public boolean apply(Game game, Ability source) {
Player player = game.getPlayer(game.getActivePlayerId()); Player player = game.getPlayer(game.getActivePlayerId());
if (player != null) { if (player == null) {
int damage = game.getBattlefield().countAll(filter, game.getActivePlayerId(), game);
player.damage(damage, source.getSourceId(), source, game);
return true;
}
return false; return false;
} }
int damage = game.getBattlefield().count(filter, game.getActivePlayerId(), source, game);
return damage > 0 && player.damage(damage, source.getSourceId(), source, game) > 0;
}
@Override @Override
public CitadelOfPainEffect copy() { public CitadelOfPainEffect copy() {

View file

@ -1,10 +1,9 @@
package mage.cards.c; package mage.cards.c;
import java.util.UUID;
import mage.abilities.TriggeredAbilityImpl; import mage.abilities.TriggeredAbilityImpl;
import mage.abilities.common.OnEventTriggeredAbility;
import mage.abilities.effects.common.CreateTokenEffect; import mage.abilities.effects.common.CreateTokenEffect;
import mage.abilities.effects.common.MillCardsControllerEffect; import mage.abilities.effects.common.MillCardsControllerEffect;
import mage.abilities.triggers.BeginningOfUpkeepTriggeredAbility;
import mage.cards.Card; import mage.cards.Card;
import mage.cards.CardImpl; import mage.cards.CardImpl;
import mage.cards.CardSetInfo; import mage.cards.CardSetInfo;
@ -15,8 +14,9 @@ import mage.game.events.GameEvent;
import mage.game.events.ZoneChangeGroupEvent; import mage.game.events.ZoneChangeGroupEvent;
import mage.game.permanent.token.InsectToken; import mage.game.permanent.token.InsectToken;
import java.util.UUID;
/** /**
*
* @author LevelX2 * @author LevelX2
*/ */
public final class CrawlingSensation extends CardImpl { public final class CrawlingSensation extends CardImpl {
@ -25,7 +25,7 @@ public final class CrawlingSensation extends CardImpl {
super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{2}{G}"); super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{2}{G}");
// At the beginning of your upkeep, you may put the top two cards of your library into your graveyard. // At the beginning of your upkeep, you may put the top two cards of your library into your graveyard.
this.addAbility(new OnEventTriggeredAbility(GameEvent.EventType.UPKEEP_STEP_PRE, "beginning of your upkeep", new MillCardsControllerEffect(2), true)); this.addAbility(new BeginningOfUpkeepTriggeredAbility(new MillCardsControllerEffect(2), true));
// Whenever one or more land cards are put into your graveyard from anywhere for the first time each turn, create a 1/1 green Insect creature token. // Whenever one or more land cards are put into your graveyard from anywhere for the first time each turn, create a 1/1 green Insect creature token.
this.addAbility(new CrawlingSensationTriggeredAbility()); this.addAbility(new CrawlingSensationTriggeredAbility());

View file

@ -1,31 +1,29 @@
package mage.cards.c; package mage.cards.c;
import java.util.UUID;
import mage.MageInt; import mage.MageInt;
import mage.abilities.common.OnEventTriggeredAbility;
import mage.abilities.effects.common.discard.DiscardEachPlayerEffect; import mage.abilities.effects.common.discard.DiscardEachPlayerEffect;
import mage.abilities.triggers.BeginningOfUpkeepTriggeredAbility;
import mage.cards.CardImpl; import mage.cards.CardImpl;
import mage.cards.CardSetInfo; import mage.cards.CardSetInfo;
import mage.constants.CardType; import mage.constants.CardType;
import mage.constants.SubType; import mage.constants.SubType;
import mage.game.events.GameEvent.EventType;
import java.util.UUID;
/** /**
*
* @author North * @author North
*/ */
public final class CunningLethemancer extends CardImpl { public final class CunningLethemancer extends CardImpl {
public CunningLethemancer(UUID ownerId, CardSetInfo setInfo) { public CunningLethemancer(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{2}{B}"); super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{2}{B}");
this.subtype.add(SubType.HUMAN); this.subtype.add(SubType.HUMAN);
this.subtype.add(SubType.WIZARD); this.subtype.add(SubType.WIZARD);
this.power = new MageInt(2); this.power = new MageInt(2);
this.toughness = new MageInt(2); this.toughness = new MageInt(2);
this.addAbility(new OnEventTriggeredAbility(EventType.UPKEEP_STEP_PRE, "beginning of your upkeep", new DiscardEachPlayerEffect())); this.addAbility(new BeginningOfUpkeepTriggeredAbility(new DiscardEachPlayerEffect()));
} }
private CunningLethemancer(final CunningLethemancer card) { private CunningLethemancer(final CunningLethemancer card) {

View file

@ -1,11 +1,10 @@
package mage.cards.c; package mage.cards.c;
import mage.abilities.Ability; import mage.abilities.Ability;
import mage.abilities.common.OnEventTriggeredAbility;
import mage.abilities.effects.OneShotEffect; import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.common.AttachEffect; import mage.abilities.effects.common.AttachEffect;
import mage.abilities.keyword.EnchantAbility; import mage.abilities.keyword.EnchantAbility;
import mage.abilities.triggers.BeginningOfUpkeepTriggeredAbility;
import mage.cards.Card; import mage.cards.Card;
import mage.cards.CardImpl; import mage.cards.CardImpl;
import mage.cards.CardSetInfo; import mage.cards.CardSetInfo;
@ -17,7 +16,6 @@ import mage.filter.FilterCard;
import mage.filter.predicate.Predicates; import mage.filter.predicate.Predicates;
import mage.filter.predicate.mageobject.NamePredicate; import mage.filter.predicate.mageobject.NamePredicate;
import mage.game.Game; import mage.game.Game;
import mage.game.events.GameEvent;
import mage.game.permanent.Permanent; import mage.game.permanent.Permanent;
import mage.players.Player; import mage.players.Player;
import mage.target.TargetPlayer; import mage.target.TargetPlayer;
@ -27,16 +25,14 @@ import mage.target.targetpointer.FixedTarget;
import java.util.UUID; import java.util.UUID;
/** /**
*
* @author BetaSteward * @author BetaSteward
*/ */
public final class CurseOfMisfortunes extends CardImpl { public final class CurseOfMisfortunes extends CardImpl {
public CurseOfMisfortunes(UUID ownerId, CardSetInfo setInfo) { public CurseOfMisfortunes(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.ENCHANTMENT},"{4}{B}"); super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{4}{B}");
this.subtype.add(SubType.AURA, SubType.CURSE); this.subtype.add(SubType.AURA, SubType.CURSE);
// Enchant player // Enchant player
TargetPlayer auraTarget = new TargetPlayer(); TargetPlayer auraTarget = new TargetPlayer();
this.getSpellAbility().addTarget(auraTarget); this.getSpellAbility().addTarget(auraTarget);
@ -44,7 +40,7 @@ public final class CurseOfMisfortunes extends CardImpl {
this.addAbility(new EnchantAbility(auraTarget)); this.addAbility(new EnchantAbility(auraTarget));
// At the beginning of your upkeep, you may search your library for a Curse card that doesn't have the same name as a Curse attached to enchanted player, put it onto the battlefield attached to that player, then shuffle your library. // At the beginning of your upkeep, you may search your library for a Curse card that doesn't have the same name as a Curse attached to enchanted player, put it onto the battlefield attached to that player, then shuffle your library.
this.addAbility(new OnEventTriggeredAbility(GameEvent.EventType.UPKEEP_STEP_PRE, "beginning of your upkeep", new CurseOfMisfortunesEffect(), true)); this.addAbility(new BeginningOfUpkeepTriggeredAbility(new CurseOfMisfortunesEffect(), true));
} }
private CurseOfMisfortunes(final CurseOfMisfortunes card) { private CurseOfMisfortunes(final CurseOfMisfortunes card) {
@ -79,7 +75,7 @@ class CurseOfMisfortunesEffect extends OneShotEffect {
FilterCard filter = new FilterCard("Curse card that doesn't have the same name as a Curse attached to enchanted player"); FilterCard filter = new FilterCard("Curse card that doesn't have the same name as a Curse attached to enchanted player");
filter.add(SubType.CURSE.getPredicate()); filter.add(SubType.CURSE.getPredicate());
// get the names of attached Curses // get the names of attached Curses
for (UUID attachmentId: targetPlayer.getAttachments()) { for (UUID attachmentId : targetPlayer.getAttachments()) {
Permanent attachment = game.getPermanent(attachmentId); Permanent attachment = game.getPermanent(attachmentId);
if (attachment != null && attachment.hasSubtype(SubType.CURSE, game)) { if (attachment != null && attachment.hasSubtype(SubType.CURSE, game)) {
filter.add(Predicates.not(new NamePredicate(attachment.getName()))); filter.add(Predicates.not(new NamePredicate(attachment.getName())));

View file

@ -1,23 +1,22 @@
package mage.cards.d; package mage.cards.d;
import java.util.UUID;
import mage.abilities.common.EntersBattlefieldTriggeredAbility; import mage.abilities.common.EntersBattlefieldTriggeredAbility;
import mage.abilities.common.OnEventTriggeredAbility;
import mage.abilities.common.SimpleStaticAbility; import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.effects.common.DrawCardSourceControllerEffect; import mage.abilities.effects.common.DrawCardSourceControllerEffect;
import mage.abilities.effects.common.SacrificeSourceEffect; import mage.abilities.effects.common.SacrificeSourceEffect;
import mage.abilities.effects.common.continuous.LoseAllAbilitiesAllEffect; import mage.abilities.effects.common.continuous.LoseAllAbilitiesAllEffect;
import mage.abilities.keyword.FlashAbility; import mage.abilities.keyword.FlashAbility;
import mage.abilities.triggers.BeginningOfEndStepTriggeredAbility;
import mage.cards.CardImpl; import mage.cards.CardImpl;
import mage.cards.CardSetInfo; import mage.cards.CardSetInfo;
import mage.constants.CardType; import mage.constants.CardType;
import mage.constants.Duration; import mage.constants.Duration;
import mage.constants.TargetController;
import mage.filter.StaticFilters; import mage.filter.StaticFilters;
import mage.game.events.GameEvent;
import java.util.UUID;
/** /**
*
* @author weirddan455 * @author weirddan455
*/ */
public final class DressDown extends CardImpl { public final class DressDown extends CardImpl {
@ -32,12 +31,13 @@ public final class DressDown extends CardImpl {
this.addAbility(new EntersBattlefieldTriggeredAbility(new DrawCardSourceControllerEffect(1))); this.addAbility(new EntersBattlefieldTriggeredAbility(new DrawCardSourceControllerEffect(1)));
// Creatures lose all abilities. // Creatures lose all abilities.
this.addAbility(new SimpleStaticAbility(new LoseAllAbilitiesAllEffect(StaticFilters.FILTER_PERMANENT_CREATURES, Duration.WhileOnBattlefield))); this.addAbility(new SimpleStaticAbility(new LoseAllAbilitiesAllEffect(
StaticFilters.FILTER_PERMANENT_CREATURES, Duration.WhileOnBattlefield
)));
// At the beginning of the end step, sacrifice Dress Down. // At the beginning of the end step, sacrifice Dress Down.
this.addAbility(new OnEventTriggeredAbility( this.addAbility(new BeginningOfEndStepTriggeredAbility(
GameEvent.EventType.END_TURN_STEP_PRE, "beginning of the end step", TargetController.NEXT, new SacrificeSourceEffect(), false
true, new SacrificeSourceEffect()
)); ));
} }

View file

@ -1,34 +1,34 @@
package mage.cards.e; package mage.cards.e;
import java.util.UUID;
import mage.abilities.Ability; import mage.abilities.Ability;
import mage.abilities.common.OnEventTriggeredAbility;
import mage.abilities.dynamicvalue.DynamicValue; import mage.abilities.dynamicvalue.DynamicValue;
import mage.abilities.effects.Effect; import mage.abilities.effects.Effect;
import mage.abilities.effects.common.CreateTokenEffect; import mage.abilities.effects.common.CreateTokenEffect;
import mage.abilities.triggers.BeginningOfUpkeepTriggeredAbility;
import mage.cards.CardImpl; import mage.cards.CardImpl;
import mage.cards.CardSetInfo; import mage.cards.CardSetInfo;
import mage.constants.CardType; import mage.constants.CardType;
import mage.constants.SubType; import mage.constants.SubType;
import mage.filter.common.FilterCreaturePermanent; import mage.filter.FilterPermanent;
import mage.filter.common.FilterControlledPermanent;
import mage.game.Game; import mage.game.Game;
import mage.game.events.GameEvent.EventType;
import mage.game.permanent.token.ZombieToken; import mage.game.permanent.token.ZombieToken;
import java.util.UUID;
/** /**
*
* @author BetaSteward * @author BetaSteward
*/ */
public final class EndlessRanksOfTheDead extends CardImpl { public final class EndlessRanksOfTheDead extends CardImpl {
public EndlessRanksOfTheDead(UUID ownerId, CardSetInfo setInfo) { public EndlessRanksOfTheDead(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.ENCHANTMENT},"{2}{B}{B}"); super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{2}{B}{B}");
// At the beginning of your upkeep, create X 2/2 black Zombie creature tokens, // At the beginning of your upkeep, create X 2/2 black Zombie creature tokens,
// where X is half the number of Zombies you control, rounded down. // where X is half the number of Zombies you control, rounded down.
this.addAbility(new OnEventTriggeredAbility(EventType.UPKEEP_STEP_PRE, "beginning of your upkeep", this.addAbility(new BeginningOfUpkeepTriggeredAbility(
new CreateTokenEffect(new ZombieToken(), new HalfZombiesCount()))); new CreateTokenEffect(new ZombieToken(), HalfZombiesCount.instance)
));
} }
@ -42,23 +42,19 @@ public final class EndlessRanksOfTheDead extends CardImpl {
} }
} }
class HalfZombiesCount implements DynamicValue { enum HalfZombiesCount implements DynamicValue {
instance;
private static final FilterCreaturePermanent filter = new FilterCreaturePermanent(); private static final FilterPermanent filter = new FilterControlledPermanent(SubType.ZOMBIE);
static {
filter.add(SubType.ZOMBIE.getPredicate());
}
@Override @Override
public int calculate(Game game, Ability sourceAbility, Effect effect) { public int calculate(Game game, Ability sourceAbility, Effect effect) {
int amount = game.getBattlefield().countAll(filter, sourceAbility.getControllerId(), game) / 2; return game.getBattlefield().count(filter, sourceAbility.getControllerId(), sourceAbility, game) / 2;
return amount;
} }
@Override @Override
public HalfZombiesCount copy() { public HalfZombiesCount copy() {
return new HalfZombiesCount(); return this;
} }
@Override @Override

View file

@ -1,29 +1,27 @@
package mage.cards.f; package mage.cards.f;
import java.util.UUID;
import mage.abilities.Ability; import mage.abilities.Ability;
import mage.abilities.common.OnEventTriggeredAbility;
import mage.abilities.effects.Effect; import mage.abilities.effects.Effect;
import mage.abilities.effects.OneShotEffect; import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.common.AttachEffect; import mage.abilities.effects.common.AttachEffect;
import mage.abilities.effects.common.CreateTokenCopyTargetEffect; import mage.abilities.effects.common.CreateTokenCopyTargetEffect;
import mage.abilities.keyword.EnchantAbility; import mage.abilities.keyword.EnchantAbility;
import mage.abilities.triggers.BeginningOfUpkeepTriggeredAbility;
import mage.cards.CardImpl; import mage.cards.CardImpl;
import mage.cards.CardSetInfo; import mage.cards.CardSetInfo;
import mage.constants.CardType; import mage.constants.CardType;
import mage.constants.SubType;
import mage.constants.Outcome; import mage.constants.Outcome;
import mage.constants.SubType;
import mage.game.Game; import mage.game.Game;
import mage.game.events.GameEvent;
import mage.game.permanent.Permanent; import mage.game.permanent.Permanent;
import mage.target.TargetPermanent; import mage.target.TargetPermanent;
import mage.target.common.TargetCreaturePermanent; import mage.target.common.TargetCreaturePermanent;
import mage.target.targetpointer.FixedTarget; import mage.target.targetpointer.FixedTarget;
import java.util.UUID;
/** /**
*
* @author LoneFox * @author LoneFox
*
*/ */
public final class FollowedFootsteps extends CardImpl { public final class FollowedFootsteps extends CardImpl {
@ -35,11 +33,10 @@ public final class FollowedFootsteps extends CardImpl {
TargetPermanent auraTarget = new TargetCreaturePermanent(); TargetPermanent auraTarget = new TargetCreaturePermanent();
this.getSpellAbility().addTarget(auraTarget); this.getSpellAbility().addTarget(auraTarget);
this.getSpellAbility().addEffect(new AttachEffect(Outcome.Copy)); this.getSpellAbility().addEffect(new AttachEffect(Outcome.Copy));
Ability ability = new EnchantAbility(auraTarget); this.addAbility(new EnchantAbility(auraTarget));
this.addAbility(ability);
// At the beginning of your upkeep, create a token that's a copy of enchanted creature. // At the beginning of your upkeep, create a token that's a copy of enchanted creature.
this.addAbility(new OnEventTriggeredAbility(GameEvent.EventType.UPKEEP_STEP_PRE, "beginning of your upkeep", new FollowedFootstepsEffect(), false)); this.addAbility(new BeginningOfUpkeepTriggeredAbility(new FollowedFootstepsEffect()));
} }
private FollowedFootsteps(final FollowedFootsteps card) { private FollowedFootsteps(final FollowedFootsteps card) {

View file

@ -1,29 +1,27 @@
package mage.cards.h; package mage.cards.h;
import java.util.UUID;
import mage.MageInt; import mage.MageInt;
import mage.abilities.common.OnEventTriggeredAbility;
import mage.abilities.costs.mana.ManaCostsImpl; import mage.abilities.costs.mana.ManaCostsImpl;
import mage.abilities.effects.common.SacrificeSourceEffect; import mage.abilities.effects.common.SacrificeSourceEffect;
import mage.abilities.keyword.FlyingAbility; import mage.abilities.keyword.FlyingAbility;
import mage.abilities.keyword.HasteAbility; import mage.abilities.keyword.HasteAbility;
import mage.abilities.keyword.UnearthAbility; import mage.abilities.keyword.UnearthAbility;
import mage.abilities.triggers.BeginningOfEndStepTriggeredAbility;
import mage.cards.CardImpl; import mage.cards.CardImpl;
import mage.cards.CardSetInfo; import mage.cards.CardSetInfo;
import mage.constants.CardType; import mage.constants.CardType;
import mage.constants.SubType; import mage.constants.SubType;
import mage.game.events.GameEvent.EventType; import mage.constants.TargetController;
import java.util.UUID;
/** /**
*
* @author BetaSteward_at_googlemail.com * @author BetaSteward_at_googlemail.com
*/ */
public final class HellsThunder extends CardImpl { public final class HellsThunder extends CardImpl {
public HellsThunder(UUID ownerId, CardSetInfo setInfo) { public HellsThunder(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{1}{R}{R}"); super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{1}{R}{R}");
this.subtype.add(SubType.ELEMENTAL); this.subtype.add(SubType.ELEMENTAL);
this.power = new MageInt(4); this.power = new MageInt(4);
@ -31,9 +29,10 @@ public final class HellsThunder extends CardImpl {
this.addAbility(FlyingAbility.getInstance()); this.addAbility(FlyingAbility.getInstance());
this.addAbility(HasteAbility.getInstance()); this.addAbility(HasteAbility.getInstance());
this.addAbility(new OnEventTriggeredAbility(EventType.END_TURN_STEP_PRE, "beginning of the end step", true, new SacrificeSourceEffect())); this.addAbility(new BeginningOfEndStepTriggeredAbility(
TargetController.NEXT, new SacrificeSourceEffect(), false
));
this.addAbility(new UnearthAbility(new ManaCostsImpl<>("{4}{R}"))); this.addAbility(new UnearthAbility(new ManaCostsImpl<>("{4}{R}")));
} }
private HellsThunder(final HellsThunder card) { private HellsThunder(final HellsThunder card) {

View file

@ -1,21 +1,19 @@
package mage.cards.h; package mage.cards.h;
import java.util.UUID;
import mage.MageInt; import mage.MageInt;
import mage.abilities.common.OnEventTriggeredAbility;
import mage.abilities.costs.mana.ManaCostsImpl; import mage.abilities.costs.mana.ManaCostsImpl;
import mage.abilities.effects.common.SacrificeSourceEffect; import mage.abilities.effects.common.SacrificeSourceEffect;
import mage.abilities.keyword.HasteAbility; import mage.abilities.keyword.HasteAbility;
import mage.abilities.keyword.TrampleAbility; import mage.abilities.keyword.TrampleAbility;
import mage.abilities.keyword.UnearthAbility; import mage.abilities.keyword.UnearthAbility;
import mage.abilities.triggers.BeginningOfEndStepTriggeredAbility;
import mage.cards.CardImpl; import mage.cards.CardImpl;
import mage.cards.CardSetInfo; import mage.cards.CardSetInfo;
import mage.constants.CardType; import mage.constants.CardType;
import mage.constants.SubType; import mage.constants.SubType;
import mage.game.events.GameEvent.EventType; import mage.constants.TargetController;
import java.util.UUID;
/** /**
* @author BetaSteward_at_googlemail.com * @author BetaSteward_at_googlemail.com
@ -23,7 +21,7 @@ import mage.game.events.GameEvent.EventType;
public final class HellsparkElemental extends CardImpl { public final class HellsparkElemental extends CardImpl {
public HellsparkElemental(UUID ownerId, CardSetInfo setInfo) { public HellsparkElemental(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{1}{R}"); super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{1}{R}");
this.subtype.add(SubType.ELEMENTAL); this.subtype.add(SubType.ELEMENTAL);
this.power = new MageInt(3); this.power = new MageInt(3);
@ -34,7 +32,9 @@ public final class HellsparkElemental extends CardImpl {
this.addAbility(HasteAbility.getInstance()); this.addAbility(HasteAbility.getInstance());
// At the beginning of the end step, sacrifice Hellspark Elemental. // At the beginning of the end step, sacrifice Hellspark Elemental.
this.addAbility(new OnEventTriggeredAbility(EventType.END_TURN_STEP_PRE, "beginning of the end step", true, new SacrificeSourceEffect())); this.addAbility(new BeginningOfEndStepTriggeredAbility(
TargetController.NEXT, new SacrificeSourceEffect(), false
));
// Unearth {1}{R}: Return this card from your graveyard to the battlefield. It gains haste. Exile it at the beginning of the next end step or if it would leave the battlefield. Unearth only as a sorcery.) // Unearth {1}{R}: Return this card from your graveyard to the battlefield. It gains haste. Exile it at the beginning of the next end step or if it would leave the battlefield. Unearth only as a sorcery.)
this.addAbility(new UnearthAbility(new ManaCostsImpl<>("{1}{R}"))); this.addAbility(new UnearthAbility(new ManaCostsImpl<>("{1}{R}")));

View file

@ -1,23 +1,22 @@
package mage.cards.l; package mage.cards.l;
import java.util.UUID;
import mage.MageInt; import mage.MageInt;
import mage.abilities.common.EntersBattlefieldAbility; import mage.abilities.common.EntersBattlefieldAbility;
import mage.abilities.common.OnEventTriggeredAbility;
import mage.abilities.effects.common.EntersBattlefieldWithXCountersEffect; import mage.abilities.effects.common.EntersBattlefieldWithXCountersEffect;
import mage.abilities.effects.common.SacrificeSourceEffect; import mage.abilities.effects.common.SacrificeSourceEffect;
import mage.abilities.keyword.HasteAbility; import mage.abilities.keyword.HasteAbility;
import mage.abilities.keyword.TrampleAbility; import mage.abilities.keyword.TrampleAbility;
import mage.abilities.triggers.BeginningOfEndStepTriggeredAbility;
import mage.cards.CardImpl; import mage.cards.CardImpl;
import mage.cards.CardSetInfo; import mage.cards.CardSetInfo;
import mage.constants.CardType; import mage.constants.CardType;
import mage.constants.SubType; import mage.constants.SubType;
import mage.constants.TargetController;
import mage.counters.CounterType; import mage.counters.CounterType;
import mage.game.events.GameEvent;
import java.util.UUID;
/** /**
*
* @author LoneFox * @author LoneFox
*/ */
public final class LightningSerpent extends CardImpl { public final class LightningSerpent extends CardImpl {
@ -31,12 +30,17 @@ public final class LightningSerpent extends CardImpl {
// Trample // Trample
this.addAbility(TrampleAbility.getInstance()); this.addAbility(TrampleAbility.getInstance());
// Haste // Haste
this.addAbility(HasteAbility.getInstance()); this.addAbility(HasteAbility.getInstance());
// Lightning Serpent enters the battlefield with X +1/+0 counters on it. // Lightning Serpent enters the battlefield with X +1/+0 counters on it.
this.addAbility(new EntersBattlefieldAbility(new EntersBattlefieldWithXCountersEffect(CounterType.P1P0.createInstance()))); this.addAbility(new EntersBattlefieldAbility(new EntersBattlefieldWithXCountersEffect(CounterType.P1P0.createInstance())));
// At the beginning of the end step, sacrifice Lightning Serpent. // At the beginning of the end step, sacrifice Lightning Serpent.
this.addAbility(new OnEventTriggeredAbility(GameEvent.EventType.END_TURN_STEP_PRE, "beginning of the end step", true, new SacrificeSourceEffect())); this.addAbility(new BeginningOfEndStepTriggeredAbility(
TargetController.NEXT, new SacrificeSourceEffect(), false
));
} }
private LightningSerpent(final LightningSerpent card) { private LightningSerpent(final LightningSerpent card) {

View file

@ -2,16 +2,16 @@ package mage.cards.l;
import mage.MageInt; import mage.MageInt;
import mage.abilities.common.DealsCombatDamageToAPlayerTriggeredAbility; import mage.abilities.common.DealsCombatDamageToAPlayerTriggeredAbility;
import mage.abilities.common.OnEventTriggeredAbility;
import mage.abilities.effects.common.SacrificeSourceEffect; import mage.abilities.effects.common.SacrificeSourceEffect;
import mage.abilities.effects.common.discard.DiscardTargetEffect; import mage.abilities.effects.common.discard.DiscardTargetEffect;
import mage.abilities.keyword.HasteAbility; import mage.abilities.keyword.HasteAbility;
import mage.abilities.keyword.TrampleAbility; import mage.abilities.keyword.TrampleAbility;
import mage.abilities.triggers.BeginningOfEndStepTriggeredAbility;
import mage.cards.CardImpl; import mage.cards.CardImpl;
import mage.cards.CardSetInfo; import mage.cards.CardSetInfo;
import mage.constants.CardType; import mage.constants.CardType;
import mage.constants.SubType; import mage.constants.SubType;
import mage.game.events.GameEvent; import mage.constants.TargetController;
import java.util.UUID; import java.util.UUID;
@ -40,9 +40,8 @@ public final class LightningSkelemental extends CardImpl {
)); ));
// At the beginning of the end step, sacrifice Lightning Skelemental. // At the beginning of the end step, sacrifice Lightning Skelemental.
this.addAbility(new OnEventTriggeredAbility( this.addAbility(new BeginningOfEndStepTriggeredAbility(
GameEvent.EventType.END_TURN_STEP_PRE, "beginning of the end step", TargetController.NEXT, new SacrificeSourceEffect(), false
true, new SacrificeSourceEffect()
)); ));
} }

View file

@ -1,40 +1,52 @@
package mage.cards.m; package mage.cards.m;
import mage.Mana; import mage.Mana;
import mage.abilities.Ability;
import mage.abilities.TriggeredAbility;
import mage.abilities.common.OnEventTriggeredAbility;
import mage.abilities.costs.common.RemoveCountersSourceCost; import mage.abilities.costs.common.RemoveCountersSourceCost;
import mage.abilities.effects.Effect; import mage.abilities.dynamicvalue.DynamicValue;
import mage.abilities.effects.OneShotEffect; import mage.abilities.dynamicvalue.common.CountersSourceCount;
import mage.abilities.dynamicvalue.common.PermanentsOnBattlefieldCount;
import mage.abilities.effects.common.counter.AddCountersSourceEffect;
import mage.abilities.effects.mana.BasicManaEffect; import mage.abilities.effects.mana.BasicManaEffect;
import mage.abilities.mana.ActivatedManaAbilityImpl; import mage.abilities.mana.ActivatedManaAbilityImpl;
import mage.abilities.triggers.BeginningOfEndStepTriggeredAbility;
import mage.cards.CardImpl; import mage.cards.CardImpl;
import mage.cards.CardSetInfo; import mage.cards.CardSetInfo;
import mage.constants.*; import mage.constants.CardType;
import mage.constants.PhaseStep;
import mage.constants.TargetController;
import mage.constants.Zone;
import mage.counters.CounterType; import mage.counters.CounterType;
import mage.filter.FilterPermanent; import mage.filter.FilterPermanent;
import mage.filter.common.FilterControlledLandPermanent; import mage.filter.common.FilterLandPermanent;
import mage.filter.predicate.permanent.TappedPredicate; import mage.filter.predicate.permanent.TappedPredicate;
import mage.game.Game; import mage.game.Game;
import mage.game.events.GameEvent;
import mage.game.permanent.Permanent;
import mage.players.Player; import mage.players.Player;
import java.util.UUID; import java.util.UUID;
import mage.abilities.dynamicvalue.common.CountersSourceCount;
/** /**
* @author L_J * @author L_J
*/ */
public final class ManaCache extends CardImpl { public final class ManaCache extends CardImpl {
private static final FilterPermanent filter = new FilterLandPermanent("untapped land that player controls");
static {
filter.add(TappedPredicate.UNTAPPED);
filter.add(TargetController.ACTIVE.getControllerPredicate());
}
private static final DynamicValue xValue = new PermanentsOnBattlefieldCount(filter);
public ManaCache(UUID ownerId, CardSetInfo setInfo) { public ManaCache(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{1}{R}{R}"); super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{1}{R}{R}");
// At the beginning of each player's end step, put a charge counter on Mana Cache for each untapped land that player controls. // At the beginning of each player's end step, put a charge counter on Mana Cache for each untapped land that player controls.
TriggeredAbility ability = new OnEventTriggeredAbility(GameEvent.EventType.END_TURN_STEP_PRE, "beginning of each player's end step", true, new ManaCacheEffect()); this.addAbility(new BeginningOfEndStepTriggeredAbility(
this.addAbility(ability); TargetController.EACH_PLAYER,
new AddCountersSourceEffect(CounterType.CHARGE.createInstance(), xValue),
false
));
// Remove a charge counter from Mana Cache: Add {C}. Any player may activate this ability but only during their turn before the end step. // Remove a charge counter from Mana Cache: Add {C}. Any player may activate this ability but only during their turn before the end step.
this.addAbility(new ManaCacheManaAbility()); this.addAbility(new ManaCacheManaAbility());
@ -50,41 +62,6 @@ public final class ManaCache extends CardImpl {
} }
} }
class ManaCacheEffect extends OneShotEffect {
private static final FilterPermanent filter = new FilterControlledLandPermanent();
static {
filter.add(TappedPredicate.UNTAPPED);
}
public ManaCacheEffect() {
super(Outcome.Damage);
this.staticText = "put a charge counter on {this} for each untapped land that player controls";
}
private ManaCacheEffect(final ManaCacheEffect effect) {
super(effect);
}
@Override
public ManaCacheEffect copy() {
return new ManaCacheEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
Player player = game.getPlayer(game.getActivePlayerId());
Permanent sourcePermanent = game.getPermanent(source.getSourceId());
if (player != null && sourcePermanent != null) {
int controlledUntappedLands = game.getBattlefield().countAll(filter, game.getActivePlayerId(), game);
sourcePermanent.addCounters(CounterType.CHARGE.createInstance(controlledUntappedLands), source.getControllerId(), source, game);
return true;
}
return false;
}
}
class ManaCacheManaAbility extends ActivatedManaAbilityImpl { class ManaCacheManaAbility extends ActivatedManaAbilityImpl {
public ManaCacheManaAbility() { public ManaCacheManaAbility() {

View file

@ -2,20 +2,22 @@ package mage.cards.m;
import mage.MageInt; import mage.MageInt;
import mage.abilities.Ability; import mage.abilities.Ability;
import mage.abilities.common.OnEventTriggeredAbility;
import mage.abilities.common.SimpleActivatedAbility; import mage.abilities.common.SimpleActivatedAbility;
import mage.abilities.costs.common.TapSourceCost; import mage.abilities.costs.common.TapSourceCost;
import mage.abilities.dynamicvalue.common.PermanentsOnBattlefieldCount; import mage.abilities.dynamicvalue.common.PermanentsOnBattlefieldCount;
import mage.abilities.effects.OneShotEffect; import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.common.CreateTokenEffect; import mage.abilities.effects.common.CreateTokenEffect;
import mage.abilities.hint.ValueHint; import mage.abilities.hint.ValueHint;
import mage.abilities.triggers.BeginningOfUpkeepTriggeredAbility;
import mage.cards.CardImpl; import mage.cards.CardImpl;
import mage.cards.CardSetInfo; import mage.cards.CardSetInfo;
import mage.constants.*; import mage.constants.CardType;
import mage.constants.MultiAmountType;
import mage.constants.Outcome;
import mage.constants.SubType;
import mage.filter.common.FilterCreaturePermanent; import mage.filter.common.FilterCreaturePermanent;
import mage.filter.predicate.permanent.TappedPredicate; import mage.filter.predicate.permanent.TappedPredicate;
import mage.game.Game; import mage.game.Game;
import mage.game.events.GameEvent.EventType;
import mage.game.permanent.Permanent; import mage.game.permanent.Permanent;
import mage.game.permanent.token.WolfToken; import mage.game.permanent.token.WolfToken;
import mage.players.Player; import mage.players.Player;
@ -39,8 +41,7 @@ public final class MasterOfTheWildHunt extends CardImpl {
this.toughness = new MageInt(3); this.toughness = new MageInt(3);
// At the beginning of your upkeep, create a 2/2 green Wolf creature token. // At the beginning of your upkeep, create a 2/2 green Wolf creature token.
this.addAbility(new OnEventTriggeredAbility(EventType.UPKEEP_STEP_PRE, "beginning of your upkeep", this.addAbility(new BeginningOfUpkeepTriggeredAbility(new CreateTokenEffect(new WolfToken())));
new CreateTokenEffect(new WolfToken())));
// {T}: Tap all untapped Wolf creatures you control. Each Wolf tapped this way deals damage equal to its power to target creature. That creature deals damage equal to its power divided as its controller chooses among any number of those Wolves. // {T}: Tap all untapped Wolf creatures you control. Each Wolf tapped this way deals damage equal to its power to target creature. That creature deals damage equal to its power divided as its controller chooses among any number of those Wolves.
Ability ability = new SimpleActivatedAbility(new MasterOfTheWildHuntEffect(), new TapSourceCost()); Ability ability = new SimpleActivatedAbility(new MasterOfTheWildHuntEffect(), new TapSourceCost());

View file

@ -1,19 +1,17 @@
package mage.cards.m; package mage.cards.m;
import mage.abilities.Ability; import mage.abilities.Ability;
import mage.abilities.TriggeredAbility;
import mage.abilities.common.OnEventTriggeredAbility;
import mage.abilities.effects.Effect;
import mage.abilities.effects.OneShotEffect; import mage.abilities.effects.OneShotEffect;
import mage.abilities.triggers.BeginningOfEndStepTriggeredAbility;
import mage.cards.CardImpl; import mage.cards.CardImpl;
import mage.cards.CardSetInfo; import mage.cards.CardSetInfo;
import mage.constants.CardType; import mage.constants.CardType;
import mage.constants.Outcome; import mage.constants.Outcome;
import mage.constants.SubType; import mage.constants.SubType;
import mage.constants.TargetController;
import mage.filter.FilterPermanent; import mage.filter.FilterPermanent;
import mage.filter.predicate.permanent.TappedPredicate; import mage.filter.predicate.permanent.TappedPredicate;
import mage.game.Game; import mage.game.Game;
import mage.game.events.GameEvent;
import mage.game.permanent.Permanent; import mage.game.permanent.Permanent;
import mage.players.Player; import mage.players.Player;
@ -28,8 +26,9 @@ public final class Monsoon extends CardImpl {
super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{2}{R}{G}"); super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{2}{R}{G}");
// At the beginning of each player's end step, tap all untapped Islands that player controls and Monsoon deals X damage to the player, where X is the number of Islands tapped this way. // At the beginning of each player's end step, tap all untapped Islands that player controls and Monsoon deals X damage to the player, where X is the number of Islands tapped this way.
TriggeredAbility ability = new OnEventTriggeredAbility(GameEvent.EventType.END_TURN_STEP_PRE, "beginning of each player's end step", true, new MonsoonEffect()); this.addAbility(new BeginningOfEndStepTriggeredAbility(
this.addAbility(ability); TargetController.EACH_PLAYER, new MonsoonEffect(), false
));
} }
private Monsoon(final Monsoon card) { private Monsoon(final Monsoon card) {

View file

@ -1,27 +1,25 @@
package mage.cards.p; package mage.cards.p;
import java.util.UUID;
import mage.MageInt; import mage.MageInt;
import mage.abilities.common.OnEventTriggeredAbility;
import mage.abilities.dynamicvalue.common.OpponentsPoisonCountersCount; import mage.abilities.dynamicvalue.common.OpponentsPoisonCountersCount;
import mage.abilities.effects.common.CreateTokenEffect; import mage.abilities.effects.common.CreateTokenEffect;
import mage.abilities.keyword.InfectAbility; import mage.abilities.keyword.InfectAbility;
import mage.abilities.triggers.BeginningOfUpkeepTriggeredAbility;
import mage.cards.CardImpl; import mage.cards.CardImpl;
import mage.cards.CardSetInfo; import mage.cards.CardSetInfo;
import mage.constants.CardType; import mage.constants.CardType;
import mage.constants.SubType; import mage.constants.SubType;
import mage.game.events.GameEvent.EventType;
import mage.game.permanent.token.InsectInfectToken; import mage.game.permanent.token.InsectInfectToken;
import java.util.UUID;
/** /**
*
* @author North * @author North
*/ */
public final class PhyrexianSwarmlord extends CardImpl { public final class PhyrexianSwarmlord extends CardImpl {
public PhyrexianSwarmlord(UUID ownerId, CardSetInfo setInfo) { public PhyrexianSwarmlord(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{4}{G}{G}"); super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{4}{G}{G}");
this.subtype.add(SubType.PHYREXIAN); this.subtype.add(SubType.PHYREXIAN);
this.subtype.add(SubType.INSECT); this.subtype.add(SubType.INSECT);
this.subtype.add(SubType.HORROR); this.subtype.add(SubType.HORROR);
@ -30,8 +28,9 @@ public final class PhyrexianSwarmlord extends CardImpl {
this.toughness = new MageInt(4); this.toughness = new MageInt(4);
this.addAbility(InfectAbility.getInstance()); this.addAbility(InfectAbility.getInstance());
this.addAbility(new OnEventTriggeredAbility(EventType.UPKEEP_STEP_PRE, "beginning of your upkeep", this.addAbility(new BeginningOfUpkeepTriggeredAbility(
new CreateTokenEffect(new InsectInfectToken(), OpponentsPoisonCountersCount.instance))); new CreateTokenEffect(new InsectInfectToken(), OpponentsPoisonCountersCount.instance)
));
} }
private PhyrexianSwarmlord(final PhyrexianSwarmlord card) { private PhyrexianSwarmlord(final PhyrexianSwarmlord card) {
@ -43,4 +42,3 @@ public final class PhyrexianSwarmlord extends CardImpl {
return new PhyrexianSwarmlord(this); return new PhyrexianSwarmlord(this);
} }
} }

View file

@ -1,28 +1,26 @@
package mage.cards.p; package mage.cards.p;
import java.util.UUID;
import mage.MageInt; import mage.MageInt;
import mage.abilities.common.OnEventTriggeredAbility;
import mage.abilities.effects.common.SacrificeSourceEffect; import mage.abilities.effects.common.SacrificeSourceEffect;
import mage.abilities.keyword.HasteAbility; import mage.abilities.keyword.HasteAbility;
import mage.abilities.keyword.InfectAbility; import mage.abilities.keyword.InfectAbility;
import mage.abilities.keyword.TrampleAbility; import mage.abilities.keyword.TrampleAbility;
import mage.abilities.triggers.BeginningOfEndStepTriggeredAbility;
import mage.cards.CardImpl; import mage.cards.CardImpl;
import mage.cards.CardSetInfo; import mage.cards.CardSetInfo;
import mage.constants.CardType; import mage.constants.CardType;
import mage.constants.SubType; import mage.constants.SubType;
import mage.game.events.GameEvent; import mage.constants.TargetController;
import java.util.UUID;
/** /**
*
* @author Loki * @author Loki
*/ */
public final class Putrefax extends CardImpl { public final class Putrefax extends CardImpl {
public Putrefax (UUID ownerId, CardSetInfo setInfo) { public Putrefax(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{3}{G}{G}"); super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{3}{G}{G}");
this.subtype.add(SubType.PHYREXIAN); this.subtype.add(SubType.PHYREXIAN);
this.subtype.add(SubType.HORROR); this.subtype.add(SubType.HORROR);
@ -31,7 +29,9 @@ public final class Putrefax extends CardImpl {
this.addAbility(TrampleAbility.getInstance()); this.addAbility(TrampleAbility.getInstance());
this.addAbility(HasteAbility.getInstance()); this.addAbility(HasteAbility.getInstance());
this.addAbility(InfectAbility.getInstance()); this.addAbility(InfectAbility.getInstance());
this.addAbility(new OnEventTriggeredAbility(GameEvent.EventType.END_TURN_STEP_PRE, "beginning of the end step", true, new SacrificeSourceEffect())); this.addAbility(new BeginningOfEndStepTriggeredAbility(
TargetController.NEXT, new SacrificeSourceEffect(), false
));
} }
private Putrefax(final Putrefax card) { private Putrefax(final Putrefax card) {

View file

@ -1,31 +1,32 @@
package mage.cards.r; package mage.cards.r;
import java.util.UUID;
import mage.MageInt; import mage.MageInt;
import mage.abilities.common.OnEventTriggeredAbility;
import mage.abilities.effects.common.ReturnToHandChosenControlledPermanentEffect; import mage.abilities.effects.common.ReturnToHandChosenControlledPermanentEffect;
import mage.abilities.triggers.BeginningOfUpkeepTriggeredAbility;
import mage.cards.CardImpl; import mage.cards.CardImpl;
import mage.cards.CardSetInfo; import mage.cards.CardSetInfo;
import mage.constants.CardType; import mage.constants.CardType;
import mage.constants.SubType; import mage.constants.SubType;
import mage.filter.StaticFilters; import mage.filter.StaticFilters;
import mage.game.events.GameEvent.EventType;
import java.util.UUID;
/** /**
*
* @author North * @author North
*/ */
public final class RoaringPrimadox extends CardImpl { public final class RoaringPrimadox extends CardImpl {
public RoaringPrimadox(UUID ownerId, CardSetInfo setInfo) { public RoaringPrimadox(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{3}{G}"); super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{3}{G}");
this.subtype.add(SubType.BEAST); this.subtype.add(SubType.BEAST);
this.power = new MageInt(4); this.power = new MageInt(4);
this.toughness = new MageInt(4); this.toughness = new MageInt(4);
// At the beginning of your upkeep, return a creature you control to its owner's hand. // At the beginning of your upkeep, return a creature you control to its owner's hand.
this.addAbility(new OnEventTriggeredAbility(EventType.UPKEEP_STEP_PRE, "beginning of your upkeep", new ReturnToHandChosenControlledPermanentEffect(StaticFilters.FILTER_CONTROLLED_CREATURE))); this.addAbility(new BeginningOfUpkeepTriggeredAbility(
new ReturnToHandChosenControlledPermanentEffect(StaticFilters.FILTER_CONTROLLED_CREATURE)
));
} }
private RoaringPrimadox(final RoaringPrimadox card) { private RoaringPrimadox(final RoaringPrimadox card) {

View file

@ -1,31 +1,26 @@
package mage.cards.s; package mage.cards.s;
import java.util.UUID;
import mage.abilities.Ability;
import mage.abilities.common.OnEventTriggeredAbility;
import mage.abilities.effects.Effect;
import mage.abilities.effects.common.DestroyAllEffect; import mage.abilities.effects.common.DestroyAllEffect;
import mage.abilities.triggers.BeginningOfUpkeepTriggeredAbility;
import mage.cards.CardImpl; import mage.cards.CardImpl;
import mage.cards.CardSetInfo; import mage.cards.CardSetInfo;
import mage.constants.CardType; import mage.constants.CardType;
import mage.filter.StaticFilters; import mage.filter.StaticFilters;
import mage.game.events.GameEvent.EventType;
import java.util.UUID;
/** /**
*
* @author Quercitron * @author Quercitron
*/ */
public final class Serenity extends CardImpl { public final class Serenity extends CardImpl {
public Serenity(UUID ownerId, CardSetInfo setInfo) { public Serenity(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.ENCHANTMENT},"{1}{W}"); super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{1}{W}");
// At the beginning of your upkeep, destroy all artifacts and enchantments. They can't be regenerated. // At the beginning of your upkeep, destroy all artifacts and enchantments. They can't be regenerated.
Effect effect = new DestroyAllEffect(StaticFilters.FILTER_PERMANENT_ARTIFACTS_AND_ENCHANTMENTS, true); this.addAbility(new BeginningOfUpkeepTriggeredAbility(new DestroyAllEffect(
Ability ability = new OnEventTriggeredAbility(EventType.UPKEEP_STEP_PRE, "beginning of your upkeep", effect, false); StaticFilters.FILTER_PERMANENT_ARTIFACTS_AND_ENCHANTMENTS, true
this.addAbility(ability); )));
} }
private Serenity(final Serenity card) { private Serenity(final Serenity card) {

View file

@ -1,26 +1,25 @@
package mage.cards.s; package mage.cards.s;
import java.util.UUID;
import mage.MageInt; import mage.MageInt;
import mage.abilities.common.OnEventTriggeredAbility;
import mage.abilities.effects.common.SacrificeSourceEffect; import mage.abilities.effects.common.SacrificeSourceEffect;
import mage.abilities.keyword.HasteAbility; import mage.abilities.keyword.HasteAbility;
import mage.abilities.keyword.TrampleAbility; import mage.abilities.keyword.TrampleAbility;
import mage.abilities.triggers.BeginningOfEndStepTriggeredAbility;
import mage.cards.CardImpl; import mage.cards.CardImpl;
import mage.cards.CardSetInfo; import mage.cards.CardSetInfo;
import mage.constants.CardType; import mage.constants.CardType;
import mage.constants.SubType; import mage.constants.SubType;
import mage.game.events.GameEvent.EventType; import mage.constants.TargetController;
import java.util.UUID;
/** /**
*
* @author North * @author North
*/ */
public final class SparkElemental extends CardImpl { public final class SparkElemental extends CardImpl {
public SparkElemental(UUID ownerId, CardSetInfo setInfo) { public SparkElemental(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{R}"); super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{R}");
this.subtype.add(SubType.ELEMENTAL); this.subtype.add(SubType.ELEMENTAL);
this.power = new MageInt(3); this.power = new MageInt(3);
@ -28,7 +27,9 @@ public final class SparkElemental extends CardImpl {
this.addAbility(TrampleAbility.getInstance()); this.addAbility(TrampleAbility.getInstance());
this.addAbility(HasteAbility.getInstance()); this.addAbility(HasteAbility.getInstance());
this.addAbility(new OnEventTriggeredAbility(EventType.END_TURN_STEP_PRE, "beginning of the end step", true, new SacrificeSourceEffect())); this.addAbility(new BeginningOfEndStepTriggeredAbility(
TargetController.NEXT, new SacrificeSourceEffect(), false
));
} }
private SparkElemental(final SparkElemental card) { private SparkElemental(final SparkElemental card) {

View file

@ -1,41 +1,43 @@
package mage.cards.s; package mage.cards.s;
import java.util.UUID;
import mage.MageInt; import mage.MageInt;
import mage.abilities.common.OnEventTriggeredAbility;
import mage.abilities.common.SimpleStaticAbility; import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.dynamicvalue.DynamicValue;
import mage.abilities.dynamicvalue.common.CardsInControllerGraveyardCount; import mage.abilities.dynamicvalue.common.CardsInControllerGraveyardCount;
import mage.abilities.effects.common.MillCardsControllerEffect; import mage.abilities.effects.common.MillCardsControllerEffect;
import mage.abilities.effects.common.continuous.SetBasePowerToughnessSourceEffect; import mage.abilities.effects.common.continuous.SetBasePowerToughnessSourceEffect;
import mage.abilities.keyword.TrampleAbility; import mage.abilities.keyword.TrampleAbility;
import mage.abilities.triggers.BeginningOfUpkeepTriggeredAbility;
import mage.cards.CardImpl; import mage.cards.CardImpl;
import mage.cards.CardSetInfo; import mage.cards.CardSetInfo;
import mage.constants.CardType; import mage.constants.CardType;
import mage.constants.SubType; import mage.constants.SubType;
import mage.constants.Zone; import mage.constants.Zone;
import mage.filter.common.FilterCreatureCard; import mage.filter.StaticFilters;
import mage.game.events.GameEvent.EventType;
import java.util.UUID;
/** /**
*
* @author North * @author North
*/ */
public final class Splinterfright extends CardImpl { public final class Splinterfright extends CardImpl {
private static final DynamicValue xValue = new CardsInControllerGraveyardCount(StaticFilters.FILTER_CARD_CREATURES);
public Splinterfright(UUID ownerId, CardSetInfo setInfo) { public Splinterfright(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{2}{G}"); super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{2}{G}");
this.subtype.add(SubType.ELEMENTAL); this.subtype.add(SubType.ELEMENTAL);
this.power = new MageInt(0); this.power = new MageInt(0);
this.toughness = new MageInt(0); this.toughness = new MageInt(0);
this.addAbility(TrampleAbility.getInstance()); this.addAbility(TrampleAbility.getInstance());
// Splinterfright's power and toughness are each equal to the number of creature cards in your graveyard. // Splinterfright's power and toughness are each equal to the number of creature cards in your graveyard.
CardsInControllerGraveyardCount count = new CardsInControllerGraveyardCount(new FilterCreatureCard("creature cards")); this.addAbility(new SimpleStaticAbility(Zone.ALL, new SetBasePowerToughnessSourceEffect(xValue)));
this.addAbility(new SimpleStaticAbility(Zone.ALL, new SetBasePowerToughnessSourceEffect(count)));
// At the beginning of your upkeep, put the top two cards of your library into your graveyard. // At the beginning of your upkeep, put the top two cards of your library into your graveyard.
this.addAbility(new OnEventTriggeredAbility(EventType.UPKEEP_STEP_PRE, "beginning of your upkeep", new MillCardsControllerEffect(2), false)); this.addAbility(new BeginningOfUpkeepTriggeredAbility(new MillCardsControllerEffect(2)));
} }
private Splinterfright(final Splinterfright card) { private Splinterfright(final Splinterfright card) {

View file

@ -1,32 +1,29 @@
package mage.cards.t; package mage.cards.t;
import java.util.UUID;
import mage.MageInt; import mage.MageInt;
import mage.abilities.common.OnEventTriggeredAbility;
import mage.abilities.effects.common.MillCardsControllerEffect; import mage.abilities.effects.common.MillCardsControllerEffect;
import mage.abilities.triggers.BeginningOfUpkeepTriggeredAbility;
import mage.cards.CardImpl; import mage.cards.CardImpl;
import mage.cards.CardSetInfo; import mage.cards.CardSetInfo;
import mage.constants.CardType; import mage.constants.CardType;
import mage.constants.SubType; import mage.constants.SubType;
import mage.game.events.GameEvent.EventType;
import java.util.UUID;
/** /**
*
* @author fireshoes * @author fireshoes
*/ */
public final class TolarianSerpent extends CardImpl { public final class TolarianSerpent extends CardImpl {
public TolarianSerpent(UUID ownerId, CardSetInfo setInfo) { public TolarianSerpent(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{5}{U}{U}"); super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{5}{U}{U}");
this.subtype.add(SubType.SERPENT); this.subtype.add(SubType.SERPENT);
this.power = new MageInt(7); this.power = new MageInt(7);
this.toughness = new MageInt(7); this.toughness = new MageInt(7);
// At the beginning of your upkeep, put the top seven cards of your library into your graveyard. // At the beginning of your upkeep, put the top seven cards of your library into your graveyard.
this.addAbility(new OnEventTriggeredAbility(EventType.UPKEEP_STEP_PRE, this.addAbility(new BeginningOfUpkeepTriggeredAbility(new MillCardsControllerEffect(7)));
"beginning of your upkeep",
new MillCardsControllerEffect(7), false));
} }
private TolarianSerpent(final TolarianSerpent card) { private TolarianSerpent(final TolarianSerpent card) {

View file

@ -1,62 +0,0 @@
package mage.abilities.common;
import mage.abilities.TriggeredAbilityImpl;
import mage.abilities.effects.Effect;
import mage.constants.Zone;
import mage.game.Game;
import mage.game.events.GameEvent;
import mage.game.events.GameEvent.EventType;
/**
* @author BetaSteward_at_googlemail.com
*/
public class OnEventTriggeredAbility extends TriggeredAbilityImpl {
private final EventType eventType;
private final String eventName;
private final boolean allPlayers;
public OnEventTriggeredAbility(EventType eventType, String eventName, Effect effect) {
this(eventType, eventName, effect, false);
}
public OnEventTriggeredAbility(EventType eventType, String eventName, Effect effect, boolean optional) {
this(eventType, eventName, false, effect, optional);
}
public OnEventTriggeredAbility(EventType eventType, String eventName, boolean allPlayers, Effect effect) {
this(eventType, eventName, allPlayers, effect, false);
}
public OnEventTriggeredAbility(EventType eventType, String eventName, boolean allPlayers, Effect effect, boolean optional) {
super(Zone.BATTLEFIELD, effect, optional);
this.eventType = eventType;
this.eventName = eventName;
this.allPlayers = allPlayers;
setTriggerPhrase("At the " + eventName + ", ");
}
protected OnEventTriggeredAbility(final OnEventTriggeredAbility ability) {
super(ability);
this.eventType = ability.eventType;
this.eventName = ability.eventName;
this.allPlayers = ability.allPlayers;
}
@Override
public boolean checkEventType(GameEvent event, Game game) {
return event.getType() == eventType;
}
@Override
public boolean checkTrigger(GameEvent event, Game game) {
return allPlayers || event.getPlayerId().equals(this.controllerId);
}
@Override
public OnEventTriggeredAbility copy() {
return new OnEventTriggeredAbility(this);
}
}