From a6e95c4f4b37ae8d83f4de59f02b99999cab59b6 Mon Sep 17 00:00:00 2001 From: Cameron Merkel <44722506+cguy7777@users.noreply.github.com> Date: Wed, 27 Nov 2024 01:01:21 -0600 Subject: [PATCH 1/4] [DSK] Implement Omnivorous Flytrap --- .../src/mage/cards/o/OmnivorousFlytrap.java | 114 ++++++++++++++++++ .../src/mage/sets/DuskmournHouseOfHorror.java | 2 + 2 files changed, 116 insertions(+) create mode 100644 Mage.Sets/src/mage/cards/o/OmnivorousFlytrap.java diff --git a/Mage.Sets/src/mage/cards/o/OmnivorousFlytrap.java b/Mage.Sets/src/mage/cards/o/OmnivorousFlytrap.java new file mode 100644 index 000000000000..ffb70fe22e99 --- /dev/null +++ b/Mage.Sets/src/mage/cards/o/OmnivorousFlytrap.java @@ -0,0 +1,114 @@ +package mage.cards.o; + +import mage.MageInt; +import mage.abilities.Ability; +import mage.abilities.common.EntersBattlefieldOrAttacksSourceTriggeredAbility; +import mage.abilities.condition.IntCompareCondition; +import mage.abilities.condition.common.DeliriumCondition; +import mage.abilities.decorator.ConditionalOneShotEffect; +import mage.abilities.dynamicvalue.common.CardTypesInGraveyardCount; +import mage.abilities.effects.OneShotEffect; +import mage.abilities.effects.common.counter.DistributeCountersEffect; +import mage.abilities.hint.common.CardTypesInGraveyardHint; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.constants.*; +import mage.counters.CounterType; +import mage.game.Game; +import mage.game.permanent.Permanent; +import mage.players.Player; +import mage.target.common.TargetCreaturePermanentAmount; + +import java.util.UUID; + +/** + * @author Cguy7777 + */ +public final class OmnivorousFlytrap extends CardImpl { + + public OmnivorousFlytrap(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{2}{G}"); + + this.subtype.add(SubType.PLANT); + this.power = new MageInt(2); + this.toughness = new MageInt(4); + + // Delirium -- Whenever Omnivorous Flytrap enters or attacks, + // if there are four or more card types among cards in your graveyard, + // distribute two +1/+1 counters among one or two target creatures. + // Then if there are six or more card types among cards in your graveyard, + // double the number of +1/+1 counters on those creatures. + Ability ability = new EntersBattlefieldOrAttacksSourceTriggeredAbility( + new DistributeCountersEffect(CounterType.P1P1, 2, "one or two target creatures")) + .withInterveningIf(DeliriumCondition.instance); + ability.addEffect(new ConditionalOneShotEffect( + new OmnivorousFlytrapEffect(), + new OmnivorousFlytrapCondition()) + .concatBy("Then")); + ability.addTarget(new TargetCreaturePermanentAmount(2)); + ability.addHint(CardTypesInGraveyardHint.YOU); + this.addAbility(ability.setAbilityWord(AbilityWord.DELIRIUM)); + } + + private OmnivorousFlytrap(final OmnivorousFlytrap card) { + super(card); + } + + @Override + public OmnivorousFlytrap copy() { + return new OmnivorousFlytrap(this); + } +} + +class OmnivorousFlytrapEffect extends OneShotEffect { + + OmnivorousFlytrapEffect() { + super(Outcome.Benefit); + staticText = "double the number of +1/+1 counters on those creatures"; + } + + private OmnivorousFlytrapEffect(final OmnivorousFlytrapEffect effect) { + super(effect); + } + + @Override + public OmnivorousFlytrapEffect copy() { + return new OmnivorousFlytrapEffect(this); + } + + @Override + public boolean apply(Game game, Ability source) { + Player controller = game.getPlayer(source.getControllerId()); + if (controller == null) { + return false; + } + + for (UUID targetId : getTargetPointer().getTargets(game, source)) { + Permanent permanent = game.getPermanent(targetId); + if (permanent != null) { + int existingCounters = permanent.getCounters(game).getCount(CounterType.P1P1); + if (existingCounters > 0) { + permanent.addCounters(CounterType.P1P1.createInstance(existingCounters), source, game); + } + } + } + return true; + } +} + +class OmnivorousFlytrapCondition extends IntCompareCondition { + + OmnivorousFlytrapCondition() { + super(ComparisonType.OR_GREATER, 6); + } + + @Override + protected int getInputValue(Game game, Ability source) { + return CardTypesInGraveyardCount.YOU.calculate(game, source, null); + } + + @Override + public String toString() { + return "if there are six or more card types among cards in your graveyard"; + } +} diff --git a/Mage.Sets/src/mage/sets/DuskmournHouseOfHorror.java b/Mage.Sets/src/mage/sets/DuskmournHouseOfHorror.java index 81fe839e1385..2d6252b2062b 100644 --- a/Mage.Sets/src/mage/sets/DuskmournHouseOfHorror.java +++ b/Mage.Sets/src/mage/sets/DuskmournHouseOfHorror.java @@ -156,6 +156,8 @@ private DuskmournHouseOfHorror() { cards.add(new SetCardInfo("Niko, Light of Hope", 224, Rarity.MYTHIC, mage.cards.n.NikoLightOfHope.class)); cards.add(new SetCardInfo("Norin, Swift Survivalist", 145, Rarity.UNCOMMON, mage.cards.n.NorinSwiftSurvivalist.class)); cards.add(new SetCardInfo("Oblivious Bookworm", 225, Rarity.UNCOMMON, mage.cards.o.ObliviousBookworm.class)); + cards.add(new SetCardInfo("Omnivorous Flytrap", 192, Rarity.RARE, mage.cards.o.OmnivorousFlytrap.class, NON_FULL_USE_VARIOUS)); + cards.add(new SetCardInfo("Omnivorous Flytrap", 322, Rarity.RARE, mage.cards.o.OmnivorousFlytrap.class, NON_FULL_USE_VARIOUS)); cards.add(new SetCardInfo("Optimistic Scavenger", 21, Rarity.UNCOMMON, mage.cards.o.OptimisticScavenger.class)); cards.add(new SetCardInfo("Orphans of the Wheat", 22, Rarity.UNCOMMON, mage.cards.o.OrphansOfTheWheat.class)); cards.add(new SetCardInfo("Overlord of the Balemurk", 113, Rarity.MYTHIC, mage.cards.o.OverlordOfTheBalemurk.class)); From 22c3f5c61bbd5e4f719c439d5e505c1c6b1a07e9 Mon Sep 17 00:00:00 2001 From: Cameron Merkel <44722506+cguy7777@users.noreply.github.com> Date: Wed, 27 Nov 2024 01:10:08 -0600 Subject: [PATCH 2/4] Require at least one target --- Mage.Sets/src/mage/cards/o/OmnivorousFlytrap.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Mage.Sets/src/mage/cards/o/OmnivorousFlytrap.java b/Mage.Sets/src/mage/cards/o/OmnivorousFlytrap.java index ffb70fe22e99..31db43fd2afa 100644 --- a/Mage.Sets/src/mage/cards/o/OmnivorousFlytrap.java +++ b/Mage.Sets/src/mage/cards/o/OmnivorousFlytrap.java @@ -45,7 +45,9 @@ public OmnivorousFlytrap(UUID ownerId, CardSetInfo setInfo) { new OmnivorousFlytrapEffect(), new OmnivorousFlytrapCondition()) .concatBy("Then")); - ability.addTarget(new TargetCreaturePermanentAmount(2)); + TargetCreaturePermanentAmount target = new TargetCreaturePermanentAmount(2); + target.setMinNumberOfTargets(1); + ability.addTarget(target); ability.addHint(CardTypesInGraveyardHint.YOU); this.addAbility(ability.setAbilityWord(AbilityWord.DELIRIUM)); } From f7b0fa1bc0dd1f9c21a51e8df394cf455edc3d61 Mon Sep 17 00:00:00 2001 From: Cameron Merkel <44722506+cguy7777@users.noreply.github.com> Date: Thu, 28 Nov 2024 19:45:48 -0600 Subject: [PATCH 3/4] Use single line for rules text --- Mage.Sets/src/mage/cards/o/OmnivorousFlytrap.java | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/Mage.Sets/src/mage/cards/o/OmnivorousFlytrap.java b/Mage.Sets/src/mage/cards/o/OmnivorousFlytrap.java index 31db43fd2afa..46e5d84eee41 100644 --- a/Mage.Sets/src/mage/cards/o/OmnivorousFlytrap.java +++ b/Mage.Sets/src/mage/cards/o/OmnivorousFlytrap.java @@ -33,11 +33,7 @@ public OmnivorousFlytrap(UUID ownerId, CardSetInfo setInfo) { this.power = new MageInt(2); this.toughness = new MageInt(4); - // Delirium -- Whenever Omnivorous Flytrap enters or attacks, - // if there are four or more card types among cards in your graveyard, - // distribute two +1/+1 counters among one or two target creatures. - // Then if there are six or more card types among cards in your graveyard, - // double the number of +1/+1 counters on those creatures. + // Delirium -- Whenever Omnivorous Flytrap enters or attacks, if there are four or more card types among cards in your graveyard, distribute two +1/+1 counters among one or two target creatures. Then if there are six or more card types among cards in your graveyard, double the number of +1/+1 counters on those creatures. Ability ability = new EntersBattlefieldOrAttacksSourceTriggeredAbility( new DistributeCountersEffect(CounterType.P1P1, 2, "one or two target creatures")) .withInterveningIf(DeliriumCondition.instance); From c2713add78938b63967e2c196e285dd49cb06178 Mon Sep 17 00:00:00 2001 From: Cameron Merkel <44722506+cguy7777@users.noreply.github.com> Date: Fri, 29 Nov 2024 21:47:10 -0600 Subject: [PATCH 4/4] Don't set minimum targets here --- Mage.Sets/src/mage/cards/o/OmnivorousFlytrap.java | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/Mage.Sets/src/mage/cards/o/OmnivorousFlytrap.java b/Mage.Sets/src/mage/cards/o/OmnivorousFlytrap.java index 46e5d84eee41..7a5c2f998f8b 100644 --- a/Mage.Sets/src/mage/cards/o/OmnivorousFlytrap.java +++ b/Mage.Sets/src/mage/cards/o/OmnivorousFlytrap.java @@ -41,9 +41,7 @@ public OmnivorousFlytrap(UUID ownerId, CardSetInfo setInfo) { new OmnivorousFlytrapEffect(), new OmnivorousFlytrapCondition()) .concatBy("Then")); - TargetCreaturePermanentAmount target = new TargetCreaturePermanentAmount(2); - target.setMinNumberOfTargets(1); - ability.addTarget(target); + ability.addTarget(new TargetCreaturePermanentAmount(2)); ability.addHint(CardTypesInGraveyardHint.YOU); this.addAbility(ability.setAbilityWord(AbilityWord.DELIRIUM)); }