diff --git a/Mage.Sets/src/mage/cards/c/CrypticTrilobite.java b/Mage.Sets/src/mage/cards/c/CrypticTrilobite.java new file mode 100644 index 0000000000..0a7a8e58d0 --- /dev/null +++ b/Mage.Sets/src/mage/cards/c/CrypticTrilobite.java @@ -0,0 +1,104 @@ +package mage.cards.c; + +import mage.ConditionalMana; +import mage.MageInt; +import mage.Mana; +import mage.abilities.Ability; +import mage.abilities.common.EntersBattlefieldAbility; +import mage.abilities.common.SimpleActivatedAbility; +import mage.abilities.condition.Condition; +import mage.abilities.costs.Cost; +import mage.abilities.costs.common.RemoveCountersSourceCost; +import mage.abilities.costs.common.TapSourceCost; +import mage.abilities.costs.mana.GenericManaCost; +import mage.abilities.effects.common.EntersBattlefieldWithXCountersEffect; +import mage.abilities.effects.common.counter.AddCountersSourceEffect; +import mage.abilities.mana.ConditionalColorlessManaAbility; +import mage.abilities.mana.builder.ConditionalManaBuilder; +import mage.abilities.mana.conditional.ManaCondition; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.constants.AbilityType; +import mage.constants.CardType; +import mage.constants.SubType; +import mage.counters.CounterType; +import mage.game.Game; + +import java.util.UUID; + +/** + * @author TheElk801 + */ +public final class CrypticTrilobite extends CardImpl { + + public CrypticTrilobite(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{X}{X}"); + + this.subtype.add(SubType.TRILOBITE); + this.power = new MageInt(0); + this.toughness = new MageInt(0); + + // Cryptic Trilobite enters the battlefield with X +1/+1 counters on it. + this.addAbility(new EntersBattlefieldAbility( + new EntersBattlefieldWithXCountersEffect(CounterType.P1P1.createInstance()) + )); + + // Remove a +1/+1 counter from Cryptic Trilobite: Add {C}{C}. Spend this mana only to activate abilities. + this.addAbility(new ConditionalColorlessManaAbility( + new RemoveCountersSourceCost( + CounterType.P1P1.createInstance() + ), 2, new CrypticTrilobiteManaBuilder() + )); + + // {1}, {T}: Put a +1/+1 counter on Cryptic Trilobite. + Ability ability = new SimpleActivatedAbility( + new AddCountersSourceEffect(CounterType.P1P1.createInstance()), new GenericManaCost(1) + ); + ability.addCost(new TapSourceCost()); + this.addAbility(ability); + } + + private CrypticTrilobite(final CrypticTrilobite card) { + super(card); + } + + @Override + public CrypticTrilobite copy() { + return new CrypticTrilobite(this); + } +} + +class CrypticTrilobiteManaBuilder extends ConditionalManaBuilder { + + @Override + public ConditionalMana build(Object... options) { + return new CrypticTrilobiteConditionalMana(this.mana); + } + + @Override + public String getRule() { + return "Spend this mana only to activate abilities"; + } +} + +class CrypticTrilobiteConditionalMana extends ConditionalMana { + + CrypticTrilobiteConditionalMana(Mana mana) { + super(mana); + staticText = "Spend this mana only to activate abilities"; + addCondition(new CrypticTrilobiteManaCondition()); + } +} + +class CrypticTrilobiteManaCondition extends ManaCondition implements Condition { + + @Override + public boolean apply(Game game, Ability source) { + return source != null && source.getAbilityType() == AbilityType.ACTIVATED; + } + + @Override + public boolean apply(Game game, Ability source, UUID originalId, Cost costsToPay) { + return apply(game, source); + } +} diff --git a/Mage.Sets/src/mage/sets/Commander2020Edition.java b/Mage.Sets/src/mage/sets/Commander2020Edition.java index bd1b11436d..a328c04b70 100644 --- a/Mage.Sets/src/mage/sets/Commander2020Edition.java +++ b/Mage.Sets/src/mage/sets/Commander2020Edition.java @@ -31,6 +31,7 @@ public final class Commander2020Edition extends ExpansionSet { cards.add(new SetCardInfo("Command Tower", 264, Rarity.COMMON, mage.cards.c.CommandTower.class)); cards.add(new SetCardInfo("Commander's Sphere", 240, Rarity.COMMON, mage.cards.c.CommandersSphere.class)); cards.add(new SetCardInfo("Crop Rotation", 169, Rarity.COMMON, mage.cards.c.CropRotation.class)); + cards.add(new SetCardInfo("Cryptic Trilobite", 21, Rarity.RARE, mage.cards.c.CrypticTrilobite.class)); cards.add(new SetCardInfo("Curious Herd", 59, Rarity.RARE, mage.cards.c.CuriousHerd.class)); cards.add(new SetCardInfo("Daring Fiendbonder", 41, Rarity.RARE, mage.cards.d.DaringFiendbonder.class)); cards.add(new SetCardInfo("Deadly Tempest", 131, Rarity.RARE, mage.cards.d.DeadlyTempest.class));