Implement Plated Pegasus

This commit is contained in:
Noah Gleason 2018-07-05 22:21:47 -04:00
parent 6c000d9177
commit cc0c8cb6ae
No known key found for this signature in database
GPG key ID: EC030EC6B0650A40
2 changed files with 84 additions and 0 deletions

View file

@ -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);
}
}

View file

@ -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));