diff --git a/Mage.Sets/src/mage/cards/o/OldManWillow.java b/Mage.Sets/src/mage/cards/o/OldManWillow.java new file mode 100644 index 0000000000..9c8463d993 --- /dev/null +++ b/Mage.Sets/src/mage/cards/o/OldManWillow.java @@ -0,0 +1,85 @@ +package mage.cards.o; + +import mage.MageInt; +import mage.MageObject; +import mage.abilities.common.AttacksTriggeredAbility; +import mage.abilities.common.SimpleStaticAbility; +import mage.abilities.common.delayed.ReflexiveTriggeredAbility; +import mage.abilities.costs.common.SacrificeTargetCost; +import mage.abilities.dynamicvalue.common.LandsYouControlCount; +import mage.abilities.effects.common.DoWhenCostPaid; +import mage.abilities.effects.common.continuous.BoostTargetEffect; +import mage.abilities.effects.common.continuous.SetBasePowerToughnessSourceEffect; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.constants.CardType; +import mage.constants.SubType; +import mage.constants.SuperType; +import mage.constants.Zone; +import mage.filter.common.FilterControlledPermanent; +import mage.filter.predicate.ObjectSourcePlayer; +import mage.filter.predicate.ObjectSourcePlayerPredicate; +import mage.filter.predicate.mageobject.AnotherPredicate; +import mage.game.Game; +import mage.game.permanent.PermanentToken; +import mage.target.common.TargetOpponentsCreaturePermanent; + +import java.util.UUID; + +/** + * @author TheElk801 + */ +public final class OldManWillow extends CardImpl { + + private static final FilterControlledPermanent filter + = new FilterControlledPermanent("another creature or a token"); + + static { + filter.add(OldManWillowPredicate.instance); + } + + public OldManWillow(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{2}{B}{G}"); + + this.supertype.add(SuperType.LEGENDARY); + this.subtype.add(SubType.TREEFOLK); + this.power = new MageInt(0); + this.toughness = new MageInt(0); + + // Old Man Willow's power and toughness are each equal to the number of lands you control. + this.addAbility(new SimpleStaticAbility( + Zone.ALL, new SetBasePowerToughnessSourceEffect(LandsYouControlCount.instance) + )); + + // Whenever Old Man Willow attacks, you may sacrifice another creature or a token. When you do, target creature an opponent controls gets -2/-2 until end of turn. + ReflexiveTriggeredAbility ability = new ReflexiveTriggeredAbility( + new BoostTargetEffect(-2, -2), false + ); + ability.addTarget(new TargetOpponentsCreaturePermanent()); + this.addAbility(new AttacksTriggeredAbility(new DoWhenCostPaid( + ability, new SacrificeTargetCost(filter), + "Sacrifice another creature or a token?" + ))); + } + + private OldManWillow(final OldManWillow card) { + super(card); + } + + @Override + public OldManWillow copy() { + return new OldManWillow(this); + } +} + +enum OldManWillowPredicate implements ObjectSourcePlayerPredicate { + instance; + + @Override + public boolean apply(ObjectSourcePlayer input, Game game) { + if (input.getObject() instanceof PermanentToken) { + return true; + } + return AnotherPredicate.instance.apply(input, game) && input.getObject().isCreature(game); + } +} diff --git a/Mage.Sets/src/mage/sets/TheLordOfTheRingsTalesOfMiddleEarth.java b/Mage.Sets/src/mage/sets/TheLordOfTheRingsTalesOfMiddleEarth.java index cf668e0e0a..e5389dc0bc 100644 --- a/Mage.Sets/src/mage/sets/TheLordOfTheRingsTalesOfMiddleEarth.java +++ b/Mage.Sets/src/mage/sets/TheLordOfTheRingsTalesOfMiddleEarth.java @@ -170,6 +170,7 @@ public final class TheLordOfTheRingsTalesOfMiddleEarth extends ExpansionSet { cards.add(new SetCardInfo("Nimrodel Watcher", 63, Rarity.COMMON, mage.cards.n.NimrodelWatcher.class)); cards.add(new SetCardInfo("Now for Wrath, Now for Ruin!", 24, Rarity.COMMON, mage.cards.n.NowForWrathNowForRuin.class)); cards.add(new SetCardInfo("Oath of the Grey Host", 101, Rarity.UNCOMMON, mage.cards.o.OathOfTheGreyHost.class)); + cards.add(new SetCardInfo("Old Man Willow", 217, Rarity.UNCOMMON, mage.cards.o.OldManWillow.class)); cards.add(new SetCardInfo("Oliphaunt", 139, Rarity.COMMON, mage.cards.o.Oliphaunt.class)); cards.add(new SetCardInfo("Olog-hai Crusher", 140, Rarity.COMMON, mage.cards.o.OlogHaiCrusher.class)); cards.add(new SetCardInfo("One Ring to Rule Them All", 102, Rarity.RARE, mage.cards.o.OneRingToRuleThemAll.class));