diff --git a/Mage.Sets/src/mage/cards/s/ShriekwoodDevourer.java b/Mage.Sets/src/mage/cards/s/ShriekwoodDevourer.java new file mode 100644 index 00000000000..c526bc9696f --- /dev/null +++ b/Mage.Sets/src/mage/cards/s/ShriekwoodDevourer.java @@ -0,0 +1,84 @@ +package mage.cards.s; + +import mage.MageInt; +import mage.MageObject; +import mage.abilities.Ability; +import mage.abilities.common.AttacksWithCreaturesTriggeredAbility; +import mage.abilities.effects.OneShotEffect; +import mage.abilities.effects.common.UntapLandsEffect; +import mage.abilities.keyword.TrampleAbility; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.constants.CardType; +import mage.constants.Outcome; +import mage.constants.SubType; +import mage.constants.Zone; +import mage.filter.StaticFilters; +import mage.game.Game; + +import java.util.Objects; +import java.util.UUID; + +/** + * @author TheElk801 + */ +public final class ShriekwoodDevourer extends CardImpl { + + public ShriekwoodDevourer(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{5}{G}{G}"); + + this.subtype.add(SubType.TREEFOLK); + this.power = new MageInt(7); + this.toughness = new MageInt(5); + + // Trample + this.addAbility(TrampleAbility.getInstance()); + + // Whenever you attack with one or more creatures, untap up to X lands, where X is the greatest power among those creatures. + this.addAbility(new AttacksWithCreaturesTriggeredAbility( + Zone.BATTLEFIELD, new ShriekwoodDevourerEffect(), + 1, StaticFilters.FILTER_PERMANENT_CREATURES + ).setTriggerPhrase("Whenever you attack with one or more creatures, ")); + } + + private ShriekwoodDevourer(final ShriekwoodDevourer card) { + super(card); + } + + @Override + public ShriekwoodDevourer copy() { + return new ShriekwoodDevourer(this); + } +} + +class ShriekwoodDevourerEffect extends OneShotEffect { + + ShriekwoodDevourerEffect() { + super(Outcome.Benefit); + staticText = "untap up to X lands, where X is the greatest power among those creatures"; + } + + private ShriekwoodDevourerEffect(final ShriekwoodDevourerEffect effect) { + super(effect); + } + + @Override + public ShriekwoodDevourerEffect copy() { + return new ShriekwoodDevourerEffect(this); + } + + @Override + public boolean apply(Game game, Ability source) { + int xValue = this + .getTargetPointer() + .getTargets(game, source) + .stream() + .map(game::getPermanent) + .filter(Objects::nonNull) + .map(MageObject::getPower) + .mapToInt(MageInt::getValue) + .max() + .orElse(0); + return xValue > 0 && new UntapLandsEffect(xValue).apply(game, source); + } +} diff --git a/Mage.Sets/src/mage/sets/DuskmournHouseOfHorrorCommander.java b/Mage.Sets/src/mage/sets/DuskmournHouseOfHorrorCommander.java index 7656b2d21bd..0e6f3043460 100644 --- a/Mage.Sets/src/mage/sets/DuskmournHouseOfHorrorCommander.java +++ b/Mage.Sets/src/mage/sets/DuskmournHouseOfHorrorCommander.java @@ -222,6 +222,7 @@ public final class DuskmournHouseOfHorrorCommander extends ExpansionSet { cards.add(new SetCardInfo("Shark Typhoon", 127, Rarity.RARE, mage.cards.s.SharkTyphoon.class)); cards.add(new SetCardInfo("Shigeki, Jukai Visionary", 198, Rarity.RARE, mage.cards.s.ShigekiJukaiVisionary.class)); cards.add(new SetCardInfo("Shivan Gorge", 297, Rarity.RARE, mage.cards.s.ShivanGorge.class)); + cards.add(new SetCardInfo("Shriekwood Devourer", 35, Rarity.RARE, mage.cards.s.ShriekwoodDevourer.class)); cards.add(new SetCardInfo("Sigil of the Empty Throne", 103, Rarity.RARE, mage.cards.s.SigilOfTheEmptyThrone.class)); cards.add(new SetCardInfo("Sign in Blood", 156, Rarity.COMMON, mage.cards.s.SignInBlood.class)); cards.add(new SetCardInfo("Simic Growth Chamber", 298, Rarity.UNCOMMON, mage.cards.s.SimicGrowthChamber.class));