From 5f8767a8f3c00799aba9c47cd890bdd8f813b132 Mon Sep 17 00:00:00 2001 From: Cameron Merkel <44722506+Cguy7777@users.noreply.github.com> Date: Sun, 31 Mar 2024 10:14:18 -0500 Subject: [PATCH] [PIP] Implement Lily Bowen, Raging Grandma (#12035) --- .../mage/cards/l/LilyBowenRagingGrandma.java | 111 ++++++++++++++++++ Mage.Sets/src/mage/sets/Fallout.java | 4 + 2 files changed, 115 insertions(+) create mode 100644 Mage.Sets/src/mage/cards/l/LilyBowenRagingGrandma.java diff --git a/Mage.Sets/src/mage/cards/l/LilyBowenRagingGrandma.java b/Mage.Sets/src/mage/cards/l/LilyBowenRagingGrandma.java new file mode 100644 index 00000000000..0441dfde7e9 --- /dev/null +++ b/Mage.Sets/src/mage/cards/l/LilyBowenRagingGrandma.java @@ -0,0 +1,111 @@ +package mage.cards.l; + +import java.util.UUID; + +import mage.MageInt; +import mage.abilities.Ability; +import mage.abilities.common.BeginningOfUpkeepTriggeredAbility; +import mage.abilities.common.EntersBattlefieldAbility; +import mage.abilities.condition.common.SourceMatchesFilterCondition; +import mage.abilities.decorator.ConditionalOneShotEffect; +import mage.abilities.effects.OneShotEffect; +import mage.abilities.effects.common.DoubleCountersSourceEffect; +import mage.abilities.effects.common.GainLifeEffect; +import mage.abilities.effects.common.counter.AddCountersSourceEffect; +import mage.constants.*; +import mage.abilities.keyword.VigilanceAbility; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.counters.CounterType; +import mage.filter.common.FilterCreaturePermanent; +import mage.filter.predicate.mageobject.PowerPredicate; +import mage.game.Game; +import mage.game.permanent.Permanent; + +/** + * @author Cguy7777 + */ +public final class LilyBowenRagingGrandma extends CardImpl { + + private static final FilterCreaturePermanent filter = new FilterCreaturePermanent(); + + static { + filter.add(new PowerPredicate(ComparisonType.OR_LESS, 16)); + } + + public LilyBowenRagingGrandma(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{3}{G}"); + + this.supertype.add(SuperType.LEGENDARY); + this.subtype.add(SubType.MUTANT); + this.subtype.add(SubType.WARRIOR); + this.power = new MageInt(0); + this.toughness = new MageInt(0); + + // Vigilance + this.addAbility(VigilanceAbility.getInstance()); + + // Lily Bowen, Raging Grandma enters the battlefield with two +1/+1 counters on it. + this.addAbility(new EntersBattlefieldAbility( + new AddCountersSourceEffect( + CounterType.P1P1.createInstance(2)), + "with two +1/+1 counters on it")); + + // At the beginning of your upkeep, double the number of +1/+1 counters on Lily Bowen if its power is 16 or less. + // Otherwise, remove all but one +1/+1 counter from it, then you gain 1 life for each +1/+1 counter removed this way. + this.addAbility(new BeginningOfUpkeepTriggeredAbility( + new ConditionalOneShotEffect( + new DoubleCountersSourceEffect(CounterType.P1P1), + new LilyBowenRagingGrandmaEffect(), + new SourceMatchesFilterCondition(filter), + "double the number of +1/+1 counters on {this} if its power is 16 or less. " + + "Otherwise, remove all but one +1/+1 counter from it, " + + "then you gain 1 life for each +1/+1 counter removed this way"), + TargetController.YOU, + false)); + } + + private LilyBowenRagingGrandma(final LilyBowenRagingGrandma card) { + super(card); + } + + @Override + public LilyBowenRagingGrandma copy() { + return new LilyBowenRagingGrandma(this); + } +} + +class LilyBowenRagingGrandmaEffect extends OneShotEffect { + + LilyBowenRagingGrandmaEffect() { + super(Outcome.Benefit); + } + + private LilyBowenRagingGrandmaEffect(final LilyBowenRagingGrandmaEffect effect) { + super(effect); + } + + @Override + public boolean apply(Game game, Ability source) { + Permanent permanent = source.getSourcePermanentIfItStillExists(game); + if (permanent == null) { + return false; + } + + // Remove all but one +1/+1 counter from it, then you gain 1 life for each +1/+1 counter removed this way. + int count = permanent.getCounters(game).getCount(CounterType.P1P1); + if (count <= 1) { + return true; + } + + int countToRemove = count - 1; + permanent.removeCounters(CounterType.P1P1.createInstance(countToRemove), source, game); + new GainLifeEffect(countToRemove).apply(game, source); + return true; + } + + @Override + public LilyBowenRagingGrandmaEffect copy() { + return new LilyBowenRagingGrandmaEffect(this); + } +} diff --git a/Mage.Sets/src/mage/sets/Fallout.java b/Mage.Sets/src/mage/sets/Fallout.java index 58a0479f774..cb6f4405281 100644 --- a/Mage.Sets/src/mage/sets/Fallout.java +++ b/Mage.Sets/src/mage/sets/Fallout.java @@ -150,6 +150,10 @@ public final class Fallout extends ExpansionSet { cards.add(new SetCardInfo("Lethal Scheme", 185, Rarity.RARE, mage.cards.l.LethalScheme.class)); cards.add(new SetCardInfo("Liberty Prime, Recharged", 5, Rarity.MYTHIC, mage.cards.l.LibertyPrimeRecharged.class)); cards.add(new SetCardInfo("Lightning Greaves", 233, Rarity.UNCOMMON, mage.cards.l.LightningGreaves.class)); + cards.add(new SetCardInfo("Lily Bowen, Raging Grandma", 79, Rarity.RARE, mage.cards.l.LilyBowenRagingGrandma.class, NON_FULL_USE_VARIOUS)); + cards.add(new SetCardInfo("Lily Bowen, Raging Grandma", 399, Rarity.RARE, mage.cards.l.LilyBowenRagingGrandma.class, NON_FULL_USE_VARIOUS)); + cards.add(new SetCardInfo("Lily Bowen, Raging Grandma", 607, Rarity.RARE, mage.cards.l.LilyBowenRagingGrandma.class, NON_FULL_USE_VARIOUS)); + cards.add(new SetCardInfo("Lily Bowen, Raging Grandma", 927, Rarity.RARE, mage.cards.l.LilyBowenRagingGrandma.class, NON_FULL_USE_VARIOUS)); cards.add(new SetCardInfo("Lord of the Undead", 345, Rarity.RARE, mage.cards.l.LordOfTheUndead.class)); cards.add(new SetCardInfo("Loyal Apprentice", 190, Rarity.UNCOMMON, mage.cards.l.LoyalApprentice.class)); cards.add(new SetCardInfo("MacCready, Lamplight Mayor", 108, Rarity.RARE, mage.cards.m.MacCreadyLamplightMayor.class, NON_FULL_USE_VARIOUS));