diff --git a/Mage.Sets/src/mage/cards/g/GurglingAnointer.java b/Mage.Sets/src/mage/cards/g/GurglingAnointer.java new file mode 100644 index 00000000000..03f99beefbb --- /dev/null +++ b/Mage.Sets/src/mage/cards/g/GurglingAnointer.java @@ -0,0 +1,86 @@ +package mage.cards.g; + +import mage.MageInt; +import mage.MageObject; +import mage.abilities.Ability; +import mage.abilities.common.DiesSourceTriggeredAbility; +import mage.abilities.common.DrawSecondCardTriggeredAbility; +import mage.abilities.effects.common.ReturnFromGraveyardToBattlefieldTargetEffect; +import mage.abilities.effects.common.counter.AddCountersSourceEffect; +import mage.abilities.keyword.FlyingAbility; +import mage.cards.Card; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.constants.CardType; +import mage.constants.SubType; +import mage.counters.CounterType; +import mage.filter.FilterCard; +import mage.filter.common.FilterCreatureCard; +import mage.filter.predicate.ObjectSourcePlayer; +import mage.filter.predicate.ObjectSourcePlayerPredicate; +import mage.filter.predicate.mageobject.AnotherPredicate; +import mage.game.Game; +import mage.target.common.TargetCardInYourGraveyard; + +import java.util.Objects; +import java.util.Optional; +import java.util.UUID; + +/** + * @author TheElk801 + */ +public final class GurglingAnointer extends CardImpl { + + private static final FilterCard filter = new FilterCreatureCard( + "another target creature card with mana value less than or equal to {this}'s power from your graveyard" + ); + + static { + filter.add(AnotherPredicate.instance); + filter.add(GurglingAnointerPredicate.instance); + } + + public GurglingAnointer(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{2}{B}"); + + this.subtype.add(SubType.PHYREXIAN); + this.subtype.add(SubType.HORROR); + this.power = new MageInt(1); + this.toughness = new MageInt(3); + + // Flying + this.addAbility(FlyingAbility.getInstance()); + + // Whenever you draw your second card each turn, put a +1/+1 counter on Gurgling Anointer. + this.addAbility(new DrawSecondCardTriggeredAbility(new AddCountersSourceEffect(CounterType.P1P1.createInstance()), false)); + + // When Gurgling Anointer dies, return another target creature card with mana value less than or equal to Gurgling Anointer's power from your graveyard to the battlefield. + Ability ability = new DiesSourceTriggeredAbility(new ReturnFromGraveyardToBattlefieldTargetEffect()); + ability.addTarget(new TargetCardInYourGraveyard(filter)); + this.addAbility(ability); + } + + private GurglingAnointer(final GurglingAnointer card) { + super(card); + } + + @Override + public GurglingAnointer copy() { + return new GurglingAnointer(this); + } +} + +enum GurglingAnointerPredicate implements ObjectSourcePlayerPredicate { + instance; + + @Override + public boolean apply(ObjectSourcePlayer input, Game game) { + return Optional + .ofNullable(input.getSource().getSourcePermanentOrLKI(game)) + .filter(Objects::nonNull) + .map(MageObject::getPower) + .map(MageInt::getValue) + .map(p -> input.getObject().getManaValue() <= p) + .orElse(false); + } +} \ No newline at end of file diff --git a/Mage.Sets/src/mage/sets/TheBrothersWar.java b/Mage.Sets/src/mage/sets/TheBrothersWar.java index 4f8b981ca4d..8270fe69c97 100644 --- a/Mage.Sets/src/mage/sets/TheBrothersWar.java +++ b/Mage.Sets/src/mage/sets/TheBrothersWar.java @@ -126,6 +126,7 @@ public final class TheBrothersWar extends ExpansionSet { cards.add(new SetCardInfo("Goring Warplow", 120, Rarity.COMMON, mage.cards.g.GoringWarplow.class)); cards.add(new SetCardInfo("Great Desert Prospector", 7, Rarity.UNCOMMON, mage.cards.g.GreatDesertProspector.class)); cards.add(new SetCardInfo("Gruesome Realization", 103, Rarity.UNCOMMON, mage.cards.g.GruesomeRealization.class)); + cards.add(new SetCardInfo("Gurgling Anointer", 104, Rarity.UNCOMMON, mage.cards.g.GurglingAnointer.class)); cards.add(new SetCardInfo("Hajar, Loyal Bodyguard", 211, Rarity.RARE, mage.cards.h.HajarLoyalBodyguard.class)); cards.add(new SetCardInfo("Hall of Tagsin", 263, Rarity.RARE, mage.cards.h.HallOfTagsin.class)); cards.add(new SetCardInfo("Harbin, Vanguard Aviator", 212, Rarity.RARE, mage.cards.h.HarbinVanguardAviator.class));