From 716d03e155c3c69ecede630c6e6401c662d9da3a Mon Sep 17 00:00:00 2001 From: theelk801 Date: Tue, 23 Jul 2024 15:41:15 -0400 Subject: [PATCH] [BLB] Implement Otterball Antics --- .../src/mage/cards/o/OtterballAntics.java | 84 +++++++++++++++++++ Mage.Sets/src/mage/sets/Bloomburrow.java | 1 + 2 files changed, 85 insertions(+) create mode 100644 Mage.Sets/src/mage/cards/o/OtterballAntics.java diff --git a/Mage.Sets/src/mage/cards/o/OtterballAntics.java b/Mage.Sets/src/mage/cards/o/OtterballAntics.java new file mode 100644 index 00000000000..587f4aa896a --- /dev/null +++ b/Mage.Sets/src/mage/cards/o/OtterballAntics.java @@ -0,0 +1,84 @@ +package mage.cards.o; + +import mage.abilities.Ability; +import mage.abilities.costs.mana.ManaCostsImpl; +import mage.abilities.effects.OneShotEffect; +import mage.abilities.keyword.FlashbackAbility; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.constants.CardType; +import mage.constants.Outcome; +import mage.constants.Zone; +import mage.counters.CounterType; +import mage.game.Game; +import mage.game.permanent.Permanent; +import mage.game.permanent.token.OtterProwessToken; +import mage.game.permanent.token.Token; +import mage.game.stack.Spell; + +import java.util.Optional; +import java.util.UUID; + +/** + * @author TheElk801 + */ +public final class OtterballAntics extends CardImpl { + + public OtterballAntics(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.SORCERY}, "{1}{U}"); + + // Create a 1/1 blue and red Otter creature token with prowess. If this spell was cast from anywhere other than your hand, put a +1/+1 counter on that creature. + this.getSpellAbility().addEffect(new OtterballAnticsEffect()); + + // Flashback {3}{U} + this.addAbility(new FlashbackAbility(this, new ManaCostsImpl<>("{3}{U}"))); + } + + private OtterballAntics(final OtterballAntics card) { + super(card); + } + + @Override + public OtterballAntics copy() { + return new OtterballAntics(this); + } +} + +class OtterballAnticsEffect extends OneShotEffect { + + OtterballAnticsEffect() { + super(Outcome.Benefit); + staticText = "create a 1/1 blue and red Otter creature token with prowess. " + + "If this spell was cast from anywhere other than your hand, put a +1/+1 counter on that creature"; + } + + private OtterballAnticsEffect(final OtterballAnticsEffect effect) { + super(effect); + } + + @Override + public OtterballAnticsEffect copy() { + return new OtterballAnticsEffect(this); + } + + @Override + public boolean apply(Game game, Ability source) { + Token token = new OtterProwessToken(); + token.putOntoBattlefield(1, game, source); + Spell spell = Optional + .ofNullable(source.getSourceObjectIfItStillExists(game)) + .filter(Spell.class::isInstance) + .map(Spell.class::cast) + .orElse(null); + if (spell == null || Zone.HAND.match(spell.getFromZone())) { + return true; + } + for (UUID tokenId : token.getLastAddedTokenIds()) { + Permanent permanent = game.getPermanent(tokenId); + if (permanent != null) { + permanent.addCounters(CounterType.P1P1.createInstance(), source, game); + } + } + return true; + } +} diff --git a/Mage.Sets/src/mage/sets/Bloomburrow.java b/Mage.Sets/src/mage/sets/Bloomburrow.java index 9961c73b8ae..fd47bc2c3f0 100644 --- a/Mage.Sets/src/mage/sets/Bloomburrow.java +++ b/Mage.Sets/src/mage/sets/Bloomburrow.java @@ -148,6 +148,7 @@ public final class Bloomburrow extends ExpansionSet { cards.add(new SetCardInfo("Nightwhorl Hermit", 62, Rarity.COMMON, mage.cards.n.NightwhorlHermit.class)); cards.add(new SetCardInfo("Nocturnal Hunger", 102, Rarity.COMMON, mage.cards.n.NocturnalHunger.class)); cards.add(new SetCardInfo("Oakhollow Village", 258, Rarity.UNCOMMON, mage.cards.o.OakhollowVillage.class)); + cards.add(new SetCardInfo("Otterball Antics", 63, Rarity.UNCOMMON, mage.cards.o.OtterballAntics.class)); cards.add(new SetCardInfo("Overprotect", 185, Rarity.UNCOMMON, mage.cards.o.Overprotect.class)); cards.add(new SetCardInfo("Patchwork Banner", 247, Rarity.UNCOMMON, mage.cards.p.PatchworkBanner.class)); cards.add(new SetCardInfo("Pawpatch Formation", 186, Rarity.UNCOMMON, mage.cards.p.PawpatchFormation.class));