From 2ed9a964ee430da66c876b815c238afbf2b69654 Mon Sep 17 00:00:00 2001 From: theelk801 Date: Tue, 10 Sep 2024 10:05:07 -0400 Subject: [PATCH] [DSK] Implement Orphans of the Wheat --- .../src/mage/cards/o/OrphansOfTheWheat.java | 94 +++++++++++++++++++ .../src/mage/sets/DuskmournHouseOfHorror.java | 1 + 2 files changed, 95 insertions(+) create mode 100644 Mage.Sets/src/mage/cards/o/OrphansOfTheWheat.java diff --git a/Mage.Sets/src/mage/cards/o/OrphansOfTheWheat.java b/Mage.Sets/src/mage/cards/o/OrphansOfTheWheat.java new file mode 100644 index 00000000000..126c7ed8bee --- /dev/null +++ b/Mage.Sets/src/mage/cards/o/OrphansOfTheWheat.java @@ -0,0 +1,94 @@ +package mage.cards.o; + +import mage.MageInt; +import mage.abilities.Ability; +import mage.abilities.common.AttacksTriggeredAbility; +import mage.abilities.effects.OneShotEffect; +import mage.abilities.effects.common.continuous.BoostSourceEffect; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.constants.CardType; +import mage.constants.Duration; +import mage.constants.Outcome; +import mage.constants.SubType; +import mage.filter.StaticFilters; +import mage.game.Game; +import mage.game.permanent.Permanent; +import mage.players.Player; +import mage.target.TargetPermanent; + +import java.util.List; +import java.util.Objects; +import java.util.UUID; +import java.util.stream.Collectors; + +/** + * @author TheElk801 + */ +public final class OrphansOfTheWheat extends CardImpl { + + public OrphansOfTheWheat(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{1}{W}"); + + this.subtype.add(SubType.HUMAN); + this.power = new MageInt(2); + this.toughness = new MageInt(1); + + // Whenever Orphans of the Wheat attacks, tap any number of untapped creatures you control. Orphans of the Wheat gets +1/+1 until end of turn for each creature tapped this way. + this.addAbility(new AttacksTriggeredAbility(new OrphansOfTheWheatEffect())); + } + + private OrphansOfTheWheat(final OrphansOfTheWheat card) { + super(card); + } + + @Override + public OrphansOfTheWheat copy() { + return new OrphansOfTheWheat(this); + } +} + +class OrphansOfTheWheatEffect extends OneShotEffect { + + OrphansOfTheWheatEffect() { + super(Outcome.Benefit); + staticText = "tap any number of untapped creatures you control. " + + "{this} gets +1/+1 until end of turn for each creature tapped this way"; + } + + private OrphansOfTheWheatEffect(final OrphansOfTheWheatEffect effect) { + super(effect); + } + + @Override + public OrphansOfTheWheatEffect copy() { + return new OrphansOfTheWheatEffect(this); + } + + @Override + public boolean apply(Game game, Ability source) { + Player player = game.getPlayer(source.getControllerId()); + if (player == null) { + return false; + } + TargetPermanent target = new TargetPermanent( + 0, Integer.MAX_VALUE, StaticFilters.FILTER_CONTROLLED_UNTAPPED_CREATURES, true + ); + player.choose(Outcome.Tap, target, source, game); + List permanents = target + .getTargets() + .stream() + .map(game::getPermanent) + .filter(Objects::nonNull) + .collect(Collectors.toList()); + for (Permanent permanent : permanents) { + permanent.tap(source, game); + } + if (permanents.isEmpty()) { + return false; + } + int amount = permanents.size(); + game.addEffect(new BoostSourceEffect(amount, amount, Duration.EndOfTurn), source); + return true; + } +} diff --git a/Mage.Sets/src/mage/sets/DuskmournHouseOfHorror.java b/Mage.Sets/src/mage/sets/DuskmournHouseOfHorror.java index e63ce4a79ad..3275ea20cbd 100644 --- a/Mage.Sets/src/mage/sets/DuskmournHouseOfHorror.java +++ b/Mage.Sets/src/mage/sets/DuskmournHouseOfHorror.java @@ -111,6 +111,7 @@ public final class DuskmournHouseOfHorror extends ExpansionSet { cards.add(new SetCardInfo("Nashi, Searcher in the Dark", 223, Rarity.RARE, mage.cards.n.NashiSearcherInTheDark.class)); cards.add(new SetCardInfo("Neglected Manor", 264, Rarity.COMMON, mage.cards.n.NeglectedManor.class)); cards.add(new SetCardInfo("Oblivious Bookworm", 225, Rarity.UNCOMMON, mage.cards.o.ObliviousBookworm.class)); + cards.add(new SetCardInfo("Orphans of the Wheat", 22, Rarity.UNCOMMON, mage.cards.o.OrphansOfTheWheat.class)); cards.add(new SetCardInfo("Overlord of the Boilerbilges", 146, Rarity.MYTHIC, mage.cards.o.OverlordOfTheBoilerbilges.class)); cards.add(new SetCardInfo("Overlord of the Floodpits", 68, Rarity.MYTHIC, mage.cards.o.OverlordOfTheFloodpits.class)); cards.add(new SetCardInfo("Overlord of the Hauntwoods", 194, Rarity.MYTHIC, mage.cards.o.OverlordOfTheHauntwoods.class));