diff --git a/Mage.Sets/src/mage/cards/p/PrizePig.java b/Mage.Sets/src/mage/cards/p/PrizePig.java new file mode 100644 index 00000000000..596ae5d4e0f --- /dev/null +++ b/Mage.Sets/src/mage/cards/p/PrizePig.java @@ -0,0 +1,80 @@ +package mage.cards.p; + +import mage.MageInt; +import mage.abilities.Ability; +import mage.abilities.common.GainLifeControllerTriggeredAbility; +import mage.abilities.effects.OneShotEffect; +import mage.abilities.mana.AnyColorManaAbility; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.constants.CardType; +import mage.constants.Outcome; +import mage.constants.SubType; +import mage.counters.CounterType; +import mage.game.Game; +import mage.game.permanent.Permanent; + +import java.util.UUID; + +/** + * @author TheElk801 + */ +public final class PrizePig extends CardImpl { + + public PrizePig(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{1}{G}"); + + this.subtype.add(SubType.BOAR); + this.power = new MageInt(0); + this.toughness = new MageInt(3); + + // Whenever you gain life, put that many ribbon counters on Prize Pig. Then if there are three or more ribbon counters on Prize Pig, remove those counters and untap it. + this.addAbility(new GainLifeControllerTriggeredAbility(new PrizePigEffect())); + + // {T}: Add one mana of any color. + this.addAbility(new AnyColorManaAbility()); + } + + private PrizePig(final PrizePig card) { + super(card); + } + + @Override + public PrizePig copy() { + return new PrizePig(this); + } +} + +class PrizePigEffect extends OneShotEffect { + + PrizePigEffect() { + super(Outcome.Benefit); + staticText = "put that many ribbon counters on {this}. Then if there are three " + + "or more ribbon counters on {this}, remove those counters and untap it"; + } + + private PrizePigEffect(final PrizePigEffect effect) { + super(effect); + } + + @Override + public PrizePigEffect copy() { + return new PrizePigEffect(this); + } + + @Override + public boolean apply(Game game, Ability source) { + Permanent permanent = source.getSourcePermanentIfItStillExists(game); + int amount = (Integer) getValue("gainedLife"); + if (permanent == null || amount < 1) { + return false; + } + permanent.addCounters(CounterType.RIBBON.createInstance(amount), source, game); + int count = permanent.getCounters(game).getCount(CounterType.RIBBON); + if (count >= 3) { + permanent.removeCounters(CounterType.RIBBON.createInstance(count), source, game); + permanent.untap(game); + } + return true; + } +} diff --git a/Mage.Sets/src/mage/sets/TalesOfMiddleEarthCommander.java b/Mage.Sets/src/mage/sets/TalesOfMiddleEarthCommander.java index ce6c3a5f8be..aec732f848c 100644 --- a/Mage.Sets/src/mage/sets/TalesOfMiddleEarthCommander.java +++ b/Mage.Sets/src/mage/sets/TalesOfMiddleEarthCommander.java @@ -178,6 +178,7 @@ public final class TalesOfMiddleEarthCommander extends ExpansionSet { cards.add(new SetCardInfo("Prairie Stream", 324, Rarity.RARE, mage.cards.p.PrairieStream.class)); cards.add(new SetCardInfo("Preordain", 196, Rarity.COMMON, mage.cards.p.Preordain.class)); cards.add(new SetCardInfo("Pristine Talisman", 283, Rarity.COMMON, mage.cards.p.PristineTalisman.class)); + cards.add(new SetCardInfo("Prize Pig", 43, Rarity.RARE, mage.cards.p.PrizePig.class)); cards.add(new SetCardInfo("Prosperous Innkeeper", 256, Rarity.UNCOMMON, mage.cards.p.ProsperousInnkeeper.class)); cards.add(new SetCardInfo("Radagast, Wizard of Wilds", 66, Rarity.RARE, mage.cards.r.RadagastWizardOfWilds.class)); cards.add(new SetCardInfo("Rampant Growth", 257, Rarity.COMMON, mage.cards.r.RampantGrowth.class)); diff --git a/Mage/src/main/java/mage/counters/CounterType.java b/Mage/src/main/java/mage/counters/CounterType.java index 50e6ef9344f..6593bf2f27d 100644 --- a/Mage/src/main/java/mage/counters/CounterType.java +++ b/Mage/src/main/java/mage/counters/CounterType.java @@ -164,6 +164,7 @@ public enum CounterType { REJECTION("rejection"), REPAIR("repair"), REPRIEVE("reprieve"), + RIBBON("ribbon"), RITUAL("ritual"), ROPE("rope"), RUST("rust"),