[BLB] Implement Otterball Antics

This commit is contained in:
theelk801 2024-07-23 15:41:15 -04:00
parent a44154669f
commit 716d03e155
2 changed files with 85 additions and 0 deletions

View file

@ -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;
}
}

View file

@ -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));