From 337d582c74371f02dfd92eb095954ffcccd3fc47 Mon Sep 17 00:00:00 2001 From: Evan Kranzler Date: Fri, 21 Jun 2019 22:39:33 -0400 Subject: [PATCH] Implemented Nightpack Ambusher --- .../src/mage/cards/n/NightpackAmbusher.java | 84 +++++++++++++++++++ Mage.Sets/src/mage/sets/CoreSet2020.java | 1 + 2 files changed, 85 insertions(+) create mode 100644 Mage.Sets/src/mage/cards/n/NightpackAmbusher.java diff --git a/Mage.Sets/src/mage/cards/n/NightpackAmbusher.java b/Mage.Sets/src/mage/cards/n/NightpackAmbusher.java new file mode 100644 index 0000000000..7d11677780 --- /dev/null +++ b/Mage.Sets/src/mage/cards/n/NightpackAmbusher.java @@ -0,0 +1,84 @@ +package mage.cards.n; + +import mage.MageInt; +import mage.abilities.Ability; +import mage.abilities.common.BeginningOfEndStepTriggeredAbility; +import mage.abilities.common.SimpleStaticAbility; +import mage.abilities.condition.Condition; +import mage.abilities.decorator.ConditionalInterveningIfTriggeredAbility; +import mage.abilities.effects.common.CreateTokenEffect; +import mage.abilities.effects.common.continuous.BoostControlledEffect; +import mage.abilities.keyword.FlashAbility; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.constants.CardType; +import mage.constants.Duration; +import mage.constants.SubType; +import mage.constants.TargetController; +import mage.filter.common.FilterCreaturePermanent; +import mage.filter.predicate.Predicates; +import mage.filter.predicate.mageobject.SubtypePredicate; +import mage.game.Game; +import mage.game.permanent.token.WolfToken; +import mage.watchers.common.CastSpellLastTurnWatcher; + +import java.util.UUID; + +/** + * @author TheElk801 + */ +public final class NightpackAmbusher extends CardImpl { + + private static final FilterCreaturePermanent filter + = new FilterCreaturePermanent("Wolves and Werewolves"); + + static { + filter.add(Predicates.or( + new SubtypePredicate(SubType.WEREWOLF), + new SubtypePredicate(SubType.WOLF) + )); + } + + public NightpackAmbusher(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{2}{G}{G}"); + + this.subtype.add(SubType.WOLF); + this.power = new MageInt(4); + this.toughness = new MageInt(4); + + // Flash + this.addAbility(FlashAbility.getInstance()); + + // Other Wolves and Werewolves you control get +1/+1. + this.addAbility(new SimpleStaticAbility(new BoostControlledEffect( + 1, 1, Duration.WhileOnBattlefield, filter, true + ))); + + // At the beginning of your end step, if you didn't cast a spell this turn, create a 2/2 green Wolf creature token. + this.addAbility(new ConditionalInterveningIfTriggeredAbility( + new BeginningOfEndStepTriggeredAbility( + new CreateTokenEffect(new WolfToken()), TargetController.YOU, false + ), NightpackAmbusherCondition.instance, "At the beginning of your end step, " + + "if you didn't cast a spell this turn, create a 2/2 green Wolf creature token." + )); + } + + private NightpackAmbusher(final NightpackAmbusher card) { + super(card); + } + + @Override + public NightpackAmbusher copy() { + return new NightpackAmbusher(this); + } +} + +enum NightpackAmbusherCondition implements Condition { + instance; + + @Override + public boolean apply(Game game, Ability source) { + CastSpellLastTurnWatcher watcher = game.getState().getWatcher(CastSpellLastTurnWatcher.class); + return watcher != null && watcher.getAmountOfSpellsPlayerCastOnCurrentTurn(source.getControllerId()) == 0; + } +} \ No newline at end of file diff --git a/Mage.Sets/src/mage/sets/CoreSet2020.java b/Mage.Sets/src/mage/sets/CoreSet2020.java index cc90cebd7b..e32f672c50 100644 --- a/Mage.Sets/src/mage/sets/CoreSet2020.java +++ b/Mage.Sets/src/mage/sets/CoreSet2020.java @@ -107,6 +107,7 @@ public final class CoreSet2020 extends ExpansionSet { cards.add(new SetCardInfo("Mu Yanling, Sky Dancer", 68, Rarity.MYTHIC, mage.cards.m.MuYanlingSkyDancer.class)); cards.add(new SetCardInfo("Murder", 109, Rarity.COMMON, mage.cards.m.Murder.class)); cards.add(new SetCardInfo("Negate", 69, Rarity.COMMON, mage.cards.n.Negate.class)); + cards.add(new SetCardInfo("Nightpack Ambusher", 185, Rarity.RARE, mage.cards.n.NightpackAmbusher.class)); cards.add(new SetCardInfo("Octoprophet", 70, Rarity.COMMON, mage.cards.o.Octoprophet.class)); cards.add(new SetCardInfo("Ogre Siegebreaker", 215, Rarity.UNCOMMON, mage.cards.o.OgreSiegebreaker.class)); cards.add(new SetCardInfo("Pacifism", 32, Rarity.COMMON, mage.cards.p.Pacifism.class));