diff --git a/Mage.Sets/src/mage/cards/r/ReturnOfTheWildspeaker.java b/Mage.Sets/src/mage/cards/r/ReturnOfTheWildspeaker.java new file mode 100644 index 00000000000..93e95bd7eba --- /dev/null +++ b/Mage.Sets/src/mage/cards/r/ReturnOfTheWildspeaker.java @@ -0,0 +1,84 @@ +package mage.cards.r; + +import mage.MageInt; +import mage.MageObject; +import mage.abilities.Ability; +import mage.abilities.Mode; +import mage.abilities.dynamicvalue.DynamicValue; +import mage.abilities.effects.Effect; +import mage.abilities.effects.common.DrawCardSourceControllerEffect; +import mage.abilities.effects.common.continuous.BoostControlledEffect; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.constants.CardType; +import mage.constants.Duration; +import mage.constants.SubType; +import mage.filter.common.FilterCreaturePermanent; +import mage.filter.predicate.Predicates; +import mage.filter.predicate.mageobject.SubtypePredicate; +import mage.game.Game; +import mage.game.permanent.Permanent; + +import java.util.UUID; + +/** + * @author TheElk801 + */ +public final class ReturnOfTheWildspeaker extends CardImpl { + + private static final FilterCreaturePermanent filter = new FilterCreaturePermanent("non-Human creatures"); + + static { + filter.add(Predicates.not(new SubtypePredicate(SubType.HUMAN))); + } + + public ReturnOfTheWildspeaker(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.INSTANT}, "{4}{G}"); + + // Choose one — + // • Draw cards equal to the greatest power among non-Human creatures you control. + this.getSpellAbility().addEffect(new DrawCardSourceControllerEffect(ReturnOfTheWildspeakerValue.instance) + .setText("draw cards equal to the greatest power among non-Human creatures you control")); + + // • Non-Human creatures you control get +3/+3 until end of turn. + this.getSpellAbility().addMode(new Mode( + new BoostControlledEffect(3, 3, Duration.EndOfTurn, filter) + )); + } + + private ReturnOfTheWildspeaker(final ReturnOfTheWildspeaker card) { + super(card); + } + + @Override + public ReturnOfTheWildspeaker copy() { + return new ReturnOfTheWildspeaker(this); + } +} + +enum ReturnOfTheWildspeakerValue implements DynamicValue { + instance; + + @Override + public int calculate(Game game, Ability sourceAbility, Effect effect) { + return game.getBattlefield() + .getAllActivePermanents(sourceAbility.getControllerId()) + .stream() + .filter(Permanent::isCreature) + .filter(permanent -> !permanent.hasSubtype(SubType.HUMAN, game)) + .map(MageObject::getPower) + .mapToInt(MageInt::getValue) + .max() + .getAsInt(); + } + + @Override + public DynamicValue copy() { + return instance; + } + + @Override + public String getMessage() { + return ""; + } +} \ No newline at end of file diff --git a/Mage.Sets/src/mage/sets/ThroneOfEldraine.java b/Mage.Sets/src/mage/sets/ThroneOfEldraine.java index cb1df86b436..e04af00de40 100644 --- a/Mage.Sets/src/mage/sets/ThroneOfEldraine.java +++ b/Mage.Sets/src/mage/sets/ThroneOfEldraine.java @@ -184,6 +184,7 @@ public final class ThroneOfEldraine extends ExpansionSet { cards.add(new SetCardInfo("Redcap Melee", 135, Rarity.UNCOMMON, mage.cards.r.RedcapMelee.class)); cards.add(new SetCardInfo("Redcap Raiders", 136, Rarity.COMMON, mage.cards.r.RedcapRaiders.class)); cards.add(new SetCardInfo("Resolute Rider", 214, Rarity.UNCOMMON, mage.cards.r.ResoluteRider.class)); + cards.add(new SetCardInfo("Return of the Wildspeaker", 172, Rarity.RARE, mage.cards.r.ReturnOfTheWildspeaker.class)); cards.add(new SetCardInfo("Return to Nature", 173, Rarity.COMMON, mage.cards.r.ReturnToNature.class)); cards.add(new SetCardInfo("Revenge of Ravens", 104, Rarity.UNCOMMON, mage.cards.r.RevengeOfRavens.class)); cards.add(new SetCardInfo("Righteousness", 27, Rarity.UNCOMMON, mage.cards.r.Righteousness.class));