From fd25ac8ccbced3101324818faa23a5f7d1571c8f Mon Sep 17 00:00:00 2001 From: Evan Kranzler Date: Wed, 19 Dec 2018 18:19:49 -0500 Subject: [PATCH] Implemented Aeromunculus --- Mage.Sets/src/mage/cards/a/Aeromunculus.java | 45 +++++++++++++++++ .../src/mage/sets/RavnicaAllegiance.java | 1 + .../effects/keyword/AdaptEffect.java | 48 +++++++++++++++++++ 3 files changed, 94 insertions(+) create mode 100644 Mage.Sets/src/mage/cards/a/Aeromunculus.java create mode 100644 Mage/src/main/java/mage/abilities/effects/keyword/AdaptEffect.java diff --git a/Mage.Sets/src/mage/cards/a/Aeromunculus.java b/Mage.Sets/src/mage/cards/a/Aeromunculus.java new file mode 100644 index 0000000000..0dca6864e6 --- /dev/null +++ b/Mage.Sets/src/mage/cards/a/Aeromunculus.java @@ -0,0 +1,45 @@ +package mage.cards.a; + +import mage.MageInt; +import mage.abilities.common.SimpleActivatedAbility; +import mage.abilities.costs.mana.ManaCostsImpl; +import mage.abilities.effects.keyword.AdaptEffect; +import mage.abilities.keyword.FlyingAbility; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.constants.CardType; +import mage.constants.SubType; + +import java.util.UUID; + +/** + * @author TheElk801 + */ +public final class Aeromunculus extends CardImpl { + + public Aeromunculus(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{1}{G}{U}"); + + this.subtype.add(SubType.HOMUNCULUS); + this.subtype.add(SubType.MUTANT); + this.power = new MageInt(2); + this.toughness = new MageInt(3); + + // Flying + this.addAbility(FlyingAbility.getInstance()); + + // {2}{G}{U}: Adapt 1. + this.addAbility(new SimpleActivatedAbility( + new AdaptEffect(1), new ManaCostsImpl("{2}{G}{U}") + )); + } + + public Aeromunculus(final Aeromunculus card) { + super(card); + } + + @Override + public Aeromunculus copy() { + return new Aeromunculus(this); + } +} diff --git a/Mage.Sets/src/mage/sets/RavnicaAllegiance.java b/Mage.Sets/src/mage/sets/RavnicaAllegiance.java index 242c82fa44..1eb775a000 100644 --- a/Mage.Sets/src/mage/sets/RavnicaAllegiance.java +++ b/Mage.Sets/src/mage/sets/RavnicaAllegiance.java @@ -32,6 +32,7 @@ public final class RavnicaAllegiance extends ExpansionSet { this.ratioBoosterMythic = 8; this.maxCardNumberInBooster = 259; + cards.add(new SetCardInfo("Aeromunculus", 152, Rarity.COMMON, mage.cards.a.Aeromunculus.class)); cards.add(new SetCardInfo("Gate Colossus", 232, Rarity.UNCOMMON, mage.cards.g.GateColossus.class)); cards.add(new SetCardInfo("Growth Spiral", 178, Rarity.COMMON, mage.cards.g.GrowthSpiral.class)); cards.add(new SetCardInfo("Imperious Oligarch", 184, Rarity.COMMON, mage.cards.i.ImperiousOligarch.class)); diff --git a/Mage/src/main/java/mage/abilities/effects/keyword/AdaptEffect.java b/Mage/src/main/java/mage/abilities/effects/keyword/AdaptEffect.java new file mode 100644 index 0000000000..0bbc9ebbb5 --- /dev/null +++ b/Mage/src/main/java/mage/abilities/effects/keyword/AdaptEffect.java @@ -0,0 +1,48 @@ +package mage.abilities.effects.keyword; + +import mage.abilities.Ability; +import mage.abilities.effects.OneShotEffect; +import mage.constants.Outcome; +import mage.counters.CounterType; +import mage.game.Game; +import mage.game.permanent.Permanent; +import mage.util.CardUtil; + +/** + * @author TheElk801 + */ +public class AdaptEffect extends OneShotEffect { + + private final int adaptNumber; + + public AdaptEffect(int adaptNumber) { + super(Outcome.BoostCreature); + this.adaptNumber = adaptNumber; + staticText = "Adapt " + adaptNumber + + " (If this creature has no +1/+1 counters on it, put " + + CardUtil.numberToText(adaptNumber) + " +1/+1 counter" + + (adaptNumber > 1 ? "s" : "") + " on it.)"; + } + + private AdaptEffect(final AdaptEffect effect) { + super(effect); + this.adaptNumber = effect.adaptNumber; + } + + @Override + public AdaptEffect copy() { + return new AdaptEffect(this); + } + + @Override + public boolean apply(Game game, Ability source) { + Permanent permanent = game.getPermanent(source.getSourceId()); + if (permanent == null) { + return false; + } + if (permanent.getCounters(game).getCount(CounterType.P1P1) == 0) { + permanent.addCounters(CounterType.P1P1.createInstance(adaptNumber), source, game); + } + return true; + } +}