diff --git a/Mage.Sets/src/mage/cards/t/TheBlackstaffOfWaterdeep.java b/Mage.Sets/src/mage/cards/t/TheBlackstaffOfWaterdeep.java new file mode 100644 index 0000000000..02c89bb437 --- /dev/null +++ b/Mage.Sets/src/mage/cards/t/TheBlackstaffOfWaterdeep.java @@ -0,0 +1,112 @@ +package mage.cards.t; + +import mage.abilities.Ability; +import mage.abilities.common.ActivateAsSorceryActivatedAbility; +import mage.abilities.common.SkipUntapOptionalAbility; +import mage.abilities.costs.common.TapSourceCost; +import mage.abilities.costs.mana.ManaCostsImpl; +import mage.abilities.effects.ContinuousEffectImpl; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.constants.*; +import mage.filter.FilterPermanent; +import mage.filter.common.FilterControlledArtifactPermanent; +import mage.filter.predicate.Predicates; +import mage.filter.predicate.mageobject.AnotherPredicate; +import mage.filter.predicate.permanent.TokenPredicate; +import mage.game.Game; +import mage.game.permanent.Permanent; +import mage.target.TargetPermanent; + +import java.util.UUID; + +/** + * @author TheElk801 + */ +public final class TheBlackstaffOfWaterdeep extends CardImpl { + + private static final FilterPermanent filter + = new FilterControlledArtifactPermanent("another nontoken artifact you control"); + + static { + filter.add(AnotherPredicate.instance); + filter.add(Predicates.not(TokenPredicate.instance)); + } + + public TheBlackstaffOfWaterdeep(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.ARTIFACT}, "{U}"); + + this.addSuperType(SuperType.LEGENDARY); + + // You many choose not to untap The Blackstaff of Waterdeep during your untap step. + this.addAbility(new SkipUntapOptionalAbility()); + + // Animate Walking Statue — {1}{U}, {T}: Another target nontoken artifact you control becomes a 4/4 artifact creature for as long as The Blackstaff of Waterdeep remains tapped. Activate only as a sorcery. + Ability ability = new ActivateAsSorceryActivatedAbility( + new TheBlackstaffOfWaterdeepEffect(), new ManaCostsImpl<>("{1}{U}") + ); + ability.addCost(new TapSourceCost()); + ability.addTarget(new TargetPermanent(filter)); + this.addAbility(ability.withFlavorWord("Animate Walking Statue")); + } + + private TheBlackstaffOfWaterdeep(final TheBlackstaffOfWaterdeep card) { + super(card); + } + + @Override + public TheBlackstaffOfWaterdeep copy() { + return new TheBlackstaffOfWaterdeep(this); + } +} + +class TheBlackstaffOfWaterdeepEffect extends ContinuousEffectImpl { + + TheBlackstaffOfWaterdeepEffect() { + super(Duration.Custom, Outcome.Benefit); + staticText = "another target nontoken artifact you control becomes " + + "a 4/4 artifact creature for as long as {this} remains tapped"; + } + + private TheBlackstaffOfWaterdeepEffect(final TheBlackstaffOfWaterdeepEffect effect) { + super(effect); + } + + @Override + public TheBlackstaffOfWaterdeepEffect copy() { + return new TheBlackstaffOfWaterdeepEffect(this); + } + + @Override + public boolean apply(Layer layer, SubLayer sublayer, Ability source, Game game) { + Permanent permanent = source.getSourcePermanentIfItStillExists(game); + Permanent artifact = game.getPermanent(getTargetPointer().getFirst(game, source)); + if (permanent == null || !permanent.isTapped() || artifact == null) { + discard(); + return false; + } + switch (layer) { + case TypeChangingEffects_4: + artifact.addCardType(game, CardType.ARTIFACT); + artifact.addCardType(game, CardType.CREATURE); + return true; + case PTChangingEffects_7: + if (sublayer == SubLayer.SetPT_7b) { + artifact.getPower().setValue(4); + artifact.getToughness().setValue(4); + return true; + } + } + return false; + } + + @Override + public boolean apply(Game game, Ability source) { + return false; + } + + @Override + public boolean hasLayer(Layer layer) { + return layer == Layer.TypeChangingEffects_4 || layer == Layer.PTChangingEffects_7; + } +} diff --git a/Mage.Sets/src/mage/sets/AdventuresInTheForgottenRealms.java b/Mage.Sets/src/mage/sets/AdventuresInTheForgottenRealms.java index cd44c4e5e8..72a0ca347a 100644 --- a/Mage.Sets/src/mage/sets/AdventuresInTheForgottenRealms.java +++ b/Mage.Sets/src/mage/sets/AdventuresInTheForgottenRealms.java @@ -204,6 +204,7 @@ public final class AdventuresInTheForgottenRealms extends ExpansionSet { cards.add(new SetCardInfo("Sylvan Shepherd", 206, Rarity.COMMON, mage.cards.s.SylvanShepherd.class)); cards.add(new SetCardInfo("Targ Nar, Demon-Fang Gnoll", 234, Rarity.UNCOMMON, mage.cards.t.TargNarDemonFangGnoll.class)); cards.add(new SetCardInfo("Tasha's Hideous Laughter", 78, Rarity.RARE, mage.cards.t.TashasHideousLaughter.class)); + cards.add(new SetCardInfo("The Blackstaff of Waterdeep", 48, Rarity.RARE, mage.cards.t.TheBlackstaffOfWaterdeep.class)); cards.add(new SetCardInfo("The Book of Exalted Deeds", 4, Rarity.MYTHIC, mage.cards.t.TheBookOfExaltedDeeds.class)); cards.add(new SetCardInfo("The Book of Vile Darkness", 91, Rarity.MYTHIC, mage.cards.t.TheBookOfVileDarkness.class)); cards.add(new SetCardInfo("The Deck of Many Things", 241, Rarity.MYTHIC, mage.cards.t.TheDeckOfManyThings.class));