[LTC] Implement Prize Pig

This commit is contained in:
theelk801 2023-06-19 16:37:33 -04:00
parent 1be43ef6ff
commit fd37be92fe
3 changed files with 82 additions and 0 deletions

View file

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

View file

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

View file

@ -164,6 +164,7 @@ public enum CounterType {
REJECTION("rejection"),
REPAIR("repair"),
REPRIEVE("reprieve"),
RIBBON("ribbon"),
RITUAL("ritual"),
ROPE("rope"),
RUST("rust"),