Implemented Nightmare Shepherd

This commit is contained in:
Evan Kranzler 2020-01-11 18:08:01 -05:00
parent 35100c2532
commit 0533854d1d
3 changed files with 102 additions and 1 deletions

View file

@ -0,0 +1,100 @@
package mage.cards.n;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.DiesCreatureTriggeredAbility;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.common.CreateTokenCopyTargetEffect;
import mage.abilities.keyword.FlyingAbility;
import mage.cards.Card;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.Outcome;
import mage.constants.SubType;
import mage.constants.Zone;
import mage.filter.FilterPermanent;
import mage.filter.common.FilterControlledCreaturePermanent;
import mage.filter.predicate.Predicates;
import mage.filter.predicate.permanent.AnotherPredicate;
import mage.filter.predicate.permanent.TokenPredicate;
import mage.game.Game;
import mage.players.Player;
import mage.target.targetpointer.FixedTarget;
import java.util.UUID;
/**
* @author TheElk801
*/
public final class NightmareShepherd extends CardImpl {
private static final FilterPermanent filter
= new FilterControlledCreaturePermanent("another nontoken creature you control");
static {
filter.add(Predicates.not(TokenPredicate.instance));
filter.add(AnotherPredicate.instance);
}
public NightmareShepherd(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT, CardType.CREATURE}, "{2}{B}{B}");
this.subtype.add(SubType.DEMON);
this.power = new MageInt(4);
this.toughness = new MageInt(4);
// Flying
this.addAbility(FlyingAbility.getInstance());
// Whenever another nontoken creature you control dies, you may exile it. If you do, create a token that's a copy of that creature, except it's 1/1 and it's a Nightmare in addition to its other types.
this.addAbility(new DiesCreatureTriggeredAbility(
new NightmareShepherdEffect(), true, filter, true
));
}
private NightmareShepherd(final NightmareShepherd card) {
super(card);
}
@Override
public NightmareShepherd copy() {
return new NightmareShepherd(this);
}
}
class NightmareShepherdEffect extends OneShotEffect {
NightmareShepherdEffect() {
super(Outcome.Benefit);
staticText = "exile it. If you do, create a token that's a copy of that creature, " +
"except it's 1/1 and it's a Nightmare in addition to its other types.";
}
private NightmareShepherdEffect(final NightmareShepherdEffect effect) {
super(effect);
}
@Override
public NightmareShepherdEffect copy() {
return new NightmareShepherdEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
Player player = game.getPlayer(source.getControllerId());
Card card = game.getCard(getTargetPointer().getFirst(game, source));
if (player == null || card == null) {
return false;
}
CreateTokenCopyTargetEffect effect = new CreateTokenCopyTargetEffect(
source.getControllerId(), null, false, 1, false,
false, null, 1, 1, false
);
effect.setTargetPointer(new FixedTarget(card.getId(), card.getZoneChangeCounter(game) + 1));
effect.setAdditionalSubType(SubType.NIGHTMARE);
player.moveCards(card, Zone.EXILED, source, game);
effect.apply(game, source);
return true;
}
}

View file

@ -164,6 +164,7 @@ public final class TherosBeyondDeath extends ExpansionSet {
cards.add(new SetCardInfo("Nessian Hornbeetle", 182, Rarity.UNCOMMON, mage.cards.n.NessianHornbeetle.class)); cards.add(new SetCardInfo("Nessian Hornbeetle", 182, Rarity.UNCOMMON, mage.cards.n.NessianHornbeetle.class));
cards.add(new SetCardInfo("Nessian Wanderer", 183, Rarity.UNCOMMON, mage.cards.n.NessianWanderer.class)); cards.add(new SetCardInfo("Nessian Wanderer", 183, Rarity.UNCOMMON, mage.cards.n.NessianWanderer.class));
cards.add(new SetCardInfo("Nexus Wardens", 184, Rarity.COMMON, mage.cards.n.NexusWardens.class)); cards.add(new SetCardInfo("Nexus Wardens", 184, Rarity.COMMON, mage.cards.n.NexusWardens.class));
cards.add(new SetCardInfo("Nightmare Shepherd", 108, Rarity.RARE, mage.cards.n.NightmareShepherd.class));
cards.add(new SetCardInfo("Nylea's Forerunner", 186, Rarity.COMMON, mage.cards.n.NyleasForerunner.class)); cards.add(new SetCardInfo("Nylea's Forerunner", 186, Rarity.COMMON, mage.cards.n.NyleasForerunner.class));
cards.add(new SetCardInfo("Nylea's Huntmaster", 187, Rarity.COMMON, mage.cards.n.NyleasHuntmaster.class)); cards.add(new SetCardInfo("Nylea's Huntmaster", 187, Rarity.COMMON, mage.cards.n.NyleasHuntmaster.class));
cards.add(new SetCardInfo("Nylea's Intervention", 188, Rarity.RARE, mage.cards.n.NyleasIntervention.class)); cards.add(new SetCardInfo("Nylea's Intervention", 188, Rarity.RARE, mage.cards.n.NyleasIntervention.class));

View file

@ -72,7 +72,7 @@ public class DiesCreatureTriggeredAbility extends TriggeredAbilityImpl {
if (filter.match(zEvent.getTarget(), sourceId, controllerId, game) && zEvent.getTarget().isCreature()) { if (filter.match(zEvent.getTarget(), sourceId, controllerId, game) && zEvent.getTarget().isCreature()) {
if (setTargetPointer) { if (setTargetPointer) {
for (Effect effect : this.getEffects()) { for (Effect effect : this.getEffects()) {
effect.setTargetPointer(new FixedTarget(event.getTargetId())); effect.setTargetPointer(new FixedTarget(event.getTargetId(), game));
} }
} }
return true; return true;