- Added Phantasmal Mount and Snow Devil.

This commit is contained in:
Jeff 2019-01-09 09:42:47 -06:00
parent 942ecc5328
commit fa7ff49f06
4 changed files with 257 additions and 0 deletions

View file

@ -0,0 +1,156 @@
package mage.cards.p;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.DelayedTriggeredAbility;
import mage.abilities.common.SimpleActivatedAbility;
import mage.abilities.costs.common.TapSourceCost;
import mage.abilities.effects.ContinuousEffect;
import mage.abilities.effects.Effect;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.common.SacrificeTargetEffect;
import mage.abilities.effects.common.continuous.BoostTargetEffect;
import mage.abilities.effects.common.continuous.GainAbilityTargetEffect;
import mage.constants.SubType;
import mage.abilities.keyword.FlyingAbility;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.ComparisonType;
import mage.constants.Duration;
import mage.constants.Outcome;
import mage.constants.Zone;
import mage.filter.common.FilterControlledCreaturePermanent;
import mage.filter.predicate.mageobject.ToughnessPredicate;
import mage.game.Game;
import mage.game.events.GameEvent;
import mage.game.events.GameEvent.EventType;
import mage.game.permanent.Permanent;
import mage.target.common.TargetControlledCreaturePermanent;
import mage.target.targetpointer.FixedTarget;
/**
*
* @author jeffwadsworth
*/
public final class PhantasmalMount extends CardImpl {
private static final FilterControlledCreaturePermanent filter = new FilterControlledCreaturePermanent("with toughness 2 or less");
static {
filter.add(new ToughnessPredicate(ComparisonType.FEWER_THAN, 3));
}
public PhantasmalMount(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{1}{U}");
this.subtype.add(SubType.ILLUSION);
this.subtype.add(SubType.HORSE);
this.power = new MageInt(1);
this.toughness = new MageInt(1);
// Flying
this.addAbility(FlyingAbility.getInstance());
// {tap}: Target creature you control with toughness 2 or less gets +1/+1 and gains flying until end of turn. When Phantasmal Mount leaves the battlefield this turn, sacrifice that creature. When the creature leaves the battlefield this turn, sacrifice Phantasmal Mount.
Ability activatedAbility = new SimpleActivatedAbility(Zone.BATTLEFIELD, new PhantasmalMountEffect(), new TapSourceCost());
activatedAbility.addTarget(new TargetControlledCreaturePermanent(filter));
this.addAbility(activatedAbility);
}
private PhantasmalMount(final PhantasmalMount card) {
super(card);
}
@Override
public PhantasmalMount copy() {
return new PhantasmalMount(this);
}
}
class PhantasmalMountEffect extends OneShotEffect {
PhantasmalMountEffect() {
super(Outcome.Neutral);
staticText = "Target creature you control with toughness 2 or less gets +1/+1 "
+ "and gains flying until end of turn. When {this} leaves the battlefield this turn, "
+ "sacrifice that creature. When the creature leaves the battlefield this turn, sacrifice {this}";
}
PhantasmalMountEffect(PhantasmalMountEffect effect) {
super(effect);
}
@Override
public boolean apply(Game game, Ability source) {
Permanent targetCreature = game.getPermanent(source.getFirstTarget());
if (targetCreature != null) {
ContinuousEffect effect = new BoostTargetEffect(1, 1, Duration.EndOfTurn);
effect.setTargetPointer(new FixedTarget(source.getFirstTarget()));
game.addEffect(effect, source);
Effect sacrificeCreatureEffect = new SacrificeTargetEffect();
Effect sacrificePhantasmalMountEffect = new SacrificeTargetEffect();
ContinuousEffect gainAbility = new GainAbilityTargetEffect(FlyingAbility.getInstance(), Duration.EndOfTurn);
gainAbility.setTargetPointer(new FixedTarget(source.getFirstTarget()));
game.addEffect(gainAbility, source);
sacrificeCreatureEffect.setTargetPointer(new FixedTarget(source.getFirstTarget()));
sacrificePhantasmalMountEffect.setTargetPointer(new FixedTarget(source.getSourceId()));
DelayedTriggeredAbility dTA = new PhantasmalMountDelayedTriggeredAbility(
sacrificeCreatureEffect,
source.getSourceId());
DelayedTriggeredAbility dTA2 = new PhantasmalMountDelayedTriggeredAbility(
sacrificePhantasmalMountEffect,
source.getFirstTarget());
game.addDelayedTriggeredAbility(dTA, source);
game.addDelayedTriggeredAbility(dTA2, source);
return true;
}
return false;
}
@Override
public PhantasmalMountEffect copy() {
return new PhantasmalMountEffect(this);
}
}
class PhantasmalMountDelayedTriggeredAbility extends DelayedTriggeredAbility {
UUID creatureId;
PhantasmalMountDelayedTriggeredAbility(Effect effect, UUID creatureId) {
super(effect, Duration.EndOfTurn, true);
this.creatureId = creatureId;
}
PhantasmalMountDelayedTriggeredAbility(PhantasmalMountDelayedTriggeredAbility ability) {
super(ability);
this.creatureId = ability.creatureId;
}
@Override
public boolean checkEventType(GameEvent event, Game game) {
return event.getType() == EventType.ZONE_CHANGE;
}
@Override
public boolean checkTrigger(GameEvent event, Game game) {
if (event.getType() == EventType.ZONE_CHANGE
&& event.getTargetId().equals(creatureId)) {
return true;
}
return false;
}
@Override
public PhantasmalMountDelayedTriggeredAbility copy() {
return new PhantasmalMountDelayedTriggeredAbility(this);
}
@Override
public String getRule() {
return "this left the battlefield";
}
}

View file

@ -0,0 +1,98 @@
package mage.cards.s;
import java.util.UUID;
import mage.constants.SubType;
import mage.target.common.TargetCreaturePermanent;
import mage.abilities.Ability;
import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.condition.Condition;
import mage.abilities.decorator.ConditionalContinuousEffect;
import mage.abilities.effects.common.AttachEffect;
import mage.abilities.effects.common.continuous.GainAbilityAttachedEffect;
import mage.constants.Outcome;
import mage.target.TargetPermanent;
import mage.abilities.keyword.EnchantAbility;
import mage.abilities.keyword.FirstStrikeAbility;
import mage.abilities.keyword.FlyingAbility;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.AttachmentType;
import mage.constants.CardType;
import mage.constants.Duration;
import mage.constants.SuperType;
import mage.constants.Zone;
import mage.filter.common.FilterLandPermanent;
import mage.filter.predicate.mageobject.SupertypePredicate;
import mage.game.Game;
import mage.game.combat.CombatGroup;
import mage.game.permanent.Permanent;
import mage.players.Player;
/**
*
* @author jeffwadsworth
*/
public final class SnowDevil extends CardImpl {
public SnowDevil(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{1}{U}");
this.subtype.add(SubType.AURA);
// Enchant creature
TargetPermanent auraTarget = new TargetCreaturePermanent();
this.getSpellAbility().addTarget(auraTarget);
this.getSpellAbility().addEffect(new AttachEffect(Outcome.BoostCreature));
Ability ability = new EnchantAbility(auraTarget.getTargetName());
this.addAbility(ability);
// Enchanted creature has flying.
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new GainAbilityAttachedEffect(FlyingAbility.getInstance(), AttachmentType.AURA, Duration.WhileOnBattlefield)));
// Enchanted creature has first strike as long as it's blocking and you control a snow land.
this.addAbility(new SimpleStaticAbility(
Zone.BATTLEFIELD,
new ConditionalContinuousEffect(
new GainAbilityAttachedEffect(
FirstStrikeAbility.getInstance(),
AttachmentType.AURA,
Duration.WhileOnBattlefield),
SnowDevilCondition.instance,
"Enchanted creature has first strike as long as it's blocking and you control a snow land"
)));
}
private SnowDevil(final SnowDevil card) {
super(card);
}
@Override
public SnowDevil copy() {
return new SnowDevil(this);
}
}
enum SnowDevilCondition implements Condition {
instance;
@Override
public boolean apply(Game game, Ability source) {
FilterLandPermanent filter = new FilterLandPermanent();
filter.add(new SupertypePredicate(SuperType.SNOW));
Permanent enchantment = game.getPermanent(source.getSourceId());
if (enchantment != null) {
Player controller = game.getPlayer(enchantment.getControllerId());
Permanent creature = game.getPermanent(enchantment.getAttachedTo());
if (creature != null
&& controller != null) {
CombatGroup combatGroup = game.getCombat().findGroupOfBlocker(creature.getId());
if (combatGroup != null
&& !game.getBattlefield().getAllActivePermanents(filter, controller.getId(), game).isEmpty()) {
return true;
}
}
}
return false;
}
}

View file

@ -255,6 +255,7 @@ public final class IceAge extends ExpansionSet {
cards.add(new SetCardInfo("Panic", 212, Rarity.COMMON, mage.cards.p.Panic.class));
cards.add(new SetCardInfo("Pentagram of the Ages", 332, Rarity.RARE, mage.cards.p.PentagramOfTheAges.class));
cards.add(new SetCardInfo("Pestilence Rats", 157, Rarity.COMMON, mage.cards.p.PestilenceRats.class));
cards.add(new SetCardInfo("Phantasmal Mount", 88, Rarity.UNCOMMON, mage.cards.p.PhantasmalMount.class));
cards.add(new SetCardInfo("Pit Trap", 333, Rarity.UNCOMMON, mage.cards.p.PitTrap.class));
cards.add(new SetCardInfo("Plains", 364, Rarity.LAND, mage.cards.basiclands.Plains.class, NON_FULL_USE_VARIOUS));
cards.add(new SetCardInfo("Plains", 365, Rarity.LAND, mage.cards.basiclands.Plains.class, NON_FULL_USE_VARIOUS));
@ -292,6 +293,7 @@ public final class IceAge extends ExpansionSet {
cards.add(new SetCardInfo("Silver Erne", 98, Rarity.UNCOMMON, mage.cards.s.SilverErne.class));
cards.add(new SetCardInfo("Skeleton Ship", 301, Rarity.RARE, mage.cards.s.SkeletonShip.class));
cards.add(new SetCardInfo("Skull Catapult", 336, Rarity.UNCOMMON, mage.cards.s.SkullCatapult.class));
cards.add(new SetCardInfo("Snow Devil", 100, Rarity.COMMON, mage.cards.s.SnowDevil.class));
cards.add(new SetCardInfo("Snow Fortress", 337, Rarity.RARE, mage.cards.s.SnowFortress.class));
cards.add(new SetCardInfo("Snow Hound", 53, Rarity.UNCOMMON, mage.cards.s.SnowHound.class));
cards.add(new SetCardInfo("Snow-Covered Forest", 383, Rarity.LAND, mage.cards.s.SnowCoveredForest.class));

View file

@ -179,6 +179,7 @@ public final class MastersEditionII extends ExpansionSet {
cards.add(new SetCardInfo("Panic", 145, Rarity.COMMON, mage.cards.p.Panic.class));
cards.add(new SetCardInfo("Personal Tutor", 58, Rarity.UNCOMMON, mage.cards.p.PersonalTutor.class));
cards.add(new SetCardInfo("Phantasmal Fiend", 108, Rarity.COMMON, mage.cards.p.PhantasmalFiend.class));
cards.add(new SetCardInfo("Phantasmal Mount", 59, Rarity.COMMON, mage.cards.p.PhantasmalMount.class));
cards.add(new SetCardInfo("Phyrexian Devourer", 216, Rarity.UNCOMMON, mage.cards.p.PhyrexianDevourer.class));
cards.add(new SetCardInfo("Pillage", 146, Rarity.UNCOMMON, mage.cards.p.Pillage.class));
cards.add(new SetCardInfo("Portent", 60, Rarity.COMMON, mage.cards.p.Portent.class));