diff --git a/Mage.Sets/src/mage/cards/p/PlatedPegasus.java b/Mage.Sets/src/mage/cards/p/PlatedPegasus.java new file mode 100644 index 0000000000..ab53c9aab3 --- /dev/null +++ b/Mage.Sets/src/mage/cards/p/PlatedPegasus.java @@ -0,0 +1,83 @@ +package mage.cards.p; + +import java.util.UUID; +import mage.MageInt; +import mage.abilities.Ability; +import mage.abilities.common.SimpleStaticAbility; +import mage.abilities.effects.ContinuousEffect; +import mage.abilities.effects.PreventionEffectImpl; +import mage.constants.Duration; +import mage.constants.SubType; +import mage.abilities.keyword.FlashAbility; +import mage.abilities.keyword.FlyingAbility; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.constants.CardType; +import mage.constants.Zone; +import mage.game.Game; +import mage.game.events.DamageEvent; +import mage.game.events.GameEvent; +import mage.game.stack.Spell; +import mage.game.stack.StackObject; + +/** + * + * @author noahg + */ +public final class PlatedPegasus extends CardImpl { + + public PlatedPegasus(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{2}{W}"); + + this.subtype.add(SubType.PEGASUS); + this.power = new MageInt(1); + this.toughness = new MageInt(2); + + // Flash + this.addAbility(FlashAbility.getInstance()); + + // Flying + this.addAbility(FlyingAbility.getInstance()); + + // If a spell would deal damage to a permanent or player, prevent 1 damage that spell would deal to that permanent or player. + this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new PlatedPegasusEffect())); + } + + public PlatedPegasus(final PlatedPegasus card) { + super(card); + } + + @Override + public PlatedPegasus copy() { + return new PlatedPegasus(this); + } +} + +class PlatedPegasusEffect extends PreventionEffectImpl { + + public PlatedPegasusEffect() { + super(Duration.WhileOnBattlefield, 1, false, false); + staticText = "If a spell would deal damage to a permanent or player, prevent 1 damage that spell would deal to that permanent or player."; + } + + public PlatedPegasusEffect(PlatedPegasusEffect effect) { + super(effect); + } + + @Override + public boolean applies(GameEvent event, Ability source, Game game) { + StackObject stackObject = game.getStack().getStackObject(event.getSourceId()); + if (stackObject == null) { + stackObject = (StackObject) game.getLastKnownInformation(event.getSourceId(), Zone.STACK); + } + if (stackObject instanceof Spell) { + return super.applies(event, source, game); + } + return false; + } + + @Override + public PlatedPegasusEffect copy() { + return new PlatedPegasusEffect(this); + } +} \ No newline at end of file diff --git a/Mage.Sets/src/mage/sets/TimeSpiral.java b/Mage.Sets/src/mage/sets/TimeSpiral.java index dd82083812..bde4860769 100644 --- a/Mage.Sets/src/mage/sets/TimeSpiral.java +++ b/Mage.Sets/src/mage/sets/TimeSpiral.java @@ -211,6 +211,7 @@ public final class TimeSpiral extends ExpansionSet { cards.add(new SetCardInfo("Plains", 283, Rarity.LAND, mage.cards.basiclands.Plains.class, NON_FULL_USE_VARIOUS)); cards.add(new SetCardInfo("Plains", 284, Rarity.LAND, mage.cards.basiclands.Plains.class, NON_FULL_USE_VARIOUS)); cards.add(new SetCardInfo("Plains", 285, Rarity.LAND, mage.cards.basiclands.Plains.class, NON_FULL_USE_VARIOUS)); + cards.add(new SetCardInfo("Plated Pegasus", 34, Rarity.UNCOMMON, mage.cards.p.PlatedPegasus.class)); cards.add(new SetCardInfo("Plunder", 174, Rarity.COMMON, mage.cards.p.Plunder.class)); cards.add(new SetCardInfo("Primal Forcemage", 212, Rarity.UNCOMMON, mage.cards.p.PrimalForcemage.class)); cards.add(new SetCardInfo("Prismatic Lens", 262, Rarity.COMMON, mage.cards.p.PrismaticLens.class));