From c9cb3ea5072b2e384f0cf5d99173c17a13cc08b2 Mon Sep 17 00:00:00 2001 From: Susucre <34709007+Susucre@users.noreply.github.com> Date: Mon, 1 Apr 2024 22:47:37 +0200 Subject: [PATCH] [OTJ] Implement Prairie Dog --- Mage.Sets/src/mage/cards/p/PrairieDog.java | 97 +++++++++++++++++++ .../mage/sets/OutlawsOfThunderJunction.java | 1 + 2 files changed, 98 insertions(+) create mode 100644 Mage.Sets/src/mage/cards/p/PrairieDog.java diff --git a/Mage.Sets/src/mage/cards/p/PrairieDog.java b/Mage.Sets/src/mage/cards/p/PrairieDog.java new file mode 100644 index 00000000000..4cfb8830df2 --- /dev/null +++ b/Mage.Sets/src/mage/cards/p/PrairieDog.java @@ -0,0 +1,97 @@ +package mage.cards.p; + +import mage.MageInt; +import mage.abilities.Ability; +import mage.abilities.common.BeginningOfEndStepTriggeredAbility; +import mage.abilities.common.SimpleActivatedAbility; +import mage.abilities.condition.common.HaventCastSpellFromHandThisTurnCondition; +import mage.abilities.costs.mana.ManaCostsImpl; +import mage.abilities.effects.ReplacementEffectImpl; +import mage.abilities.effects.common.counter.AddCountersSourceEffect; +import mage.abilities.keyword.LifelinkAbility; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.constants.*; +import mage.counters.CounterType; +import mage.game.Game; +import mage.game.events.GameEvent; +import mage.game.permanent.Permanent; +import mage.util.CardUtil; + +import java.util.UUID; + +/** + * @author Susucr + */ +public final class PrairieDog extends CardImpl { + + public PrairieDog(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{1}{W}"); + + this.subtype.add(SubType.SQUIRREL); + this.power = new MageInt(2); + this.toughness = new MageInt(2); + + // Lifelink + this.addAbility(LifelinkAbility.getInstance()); + + // At the beginning of your end step, if you haven't cast a spell from your hand this turn, put a +1/+1 counter on Prairie Dog. + this.addAbility(new BeginningOfEndStepTriggeredAbility( + Zone.BATTLEFIELD, new AddCountersSourceEffect(CounterType.P1P1.createInstance()), + TargetController.YOU, HaventCastSpellFromHandThisTurnCondition.instance, false + ).addHint(HaventCastSpellFromHandThisTurnCondition.hint)); + + // {4}{W}: Until end of turn, if you would put one or more +1/+1 counters on a creature you control, put that many plus one +1/+1 counters on it instead. + this.addAbility(new SimpleActivatedAbility(new PrairieDogReplacementEffect(), new ManaCostsImpl<>("{4}{W}"))); + } + + private PrairieDog(final PrairieDog card) { + super(card); + } + + @Override + public PrairieDog copy() { + return new PrairieDog(this); + } +} + +class PrairieDogReplacementEffect extends ReplacementEffectImpl { + + PrairieDogReplacementEffect() { + super(Duration.EndOfTurn, Outcome.BoostCreature, false); + staticText = "Until end of turn, " + + "if you would put one or more +1/+1 counters on a creature you control, " + + "put that many plus one +1/+1 counters on it instead"; + } + + private PrairieDogReplacementEffect(final PrairieDogReplacementEffect effect) { + super(effect); + } + + @Override + public PrairieDogReplacementEffect copy() { + return new PrairieDogReplacementEffect(this); + } + + @Override + public boolean replaceEvent(GameEvent event, Ability source, Game game) { + event.setAmountForCounters(CardUtil.overflowInc(event.getAmount(), 1), true); + return false; + } + + @Override + public boolean checksEventType(GameEvent event, Game game) { + return event.getType() == GameEvent.EventType.ADD_COUNTERS; + } + + @Override + public boolean applies(GameEvent event, Ability source, Game game) { + Permanent permanent = game.getPermanent(event.getTargetId()); + return event.getAmount() > 0 + && source.isControlledBy(event.getPlayerId()) + && permanent != null + && permanent.isCreature(game) + && permanent.isControlledBy(source.getControllerId()) + && event.getData().equals(CounterType.P1P1.getName()); + } +} diff --git a/Mage.Sets/src/mage/sets/OutlawsOfThunderJunction.java b/Mage.Sets/src/mage/sets/OutlawsOfThunderJunction.java index dbca3b65efa..f727f3c97be 100644 --- a/Mage.Sets/src/mage/sets/OutlawsOfThunderJunction.java +++ b/Mage.Sets/src/mage/sets/OutlawsOfThunderJunction.java @@ -164,6 +164,7 @@ public final class OutlawsOfThunderJunction extends ExpansionSet { cards.add(new SetCardInfo("Pillage the Bog", 224, Rarity.RARE, mage.cards.p.PillageTheBog.class)); cards.add(new SetCardInfo("Plains", 272, Rarity.LAND, mage.cards.basiclands.Plains.class, FULL_ART_BFZ_VARIOUS)); cards.add(new SetCardInfo("Plan the Heist", 62, Rarity.UNCOMMON, mage.cards.p.PlanTheHeist.class)); + cards.add(new SetCardInfo("Prairie Dog", 24, Rarity.UNCOMMON, mage.cards.p.PrairieDog.class)); cards.add(new SetCardInfo("Prosperity Tycoon", 25, Rarity.UNCOMMON, mage.cards.p.ProsperityTycoon.class)); cards.add(new SetCardInfo("Quilled Charger", 139, Rarity.COMMON, mage.cards.q.QuilledCharger.class)); cards.add(new SetCardInfo("Railway Brawler", 175, Rarity.MYTHIC, mage.cards.r.RailwayBrawler.class));