From 7ca7ed52d4c1003effe601ba7488351490578107 Mon Sep 17 00:00:00 2001 From: theelk801 Date: Sat, 14 Jan 2023 13:16:29 -0500 Subject: [PATCH] [ONE] Implement Mirrex --- Mage.Sets/src/mage/cards/m/Mirrex.java | 78 +++++++++++++++++++ .../src/mage/sets/PhyrexiaAllWillBeOne.java | 3 +- .../src/main/java/mage/constants/SubType.java | 1 + .../permanent/token/PhyrexianMiteToken.java | 41 ++++++++++ 4 files changed, 121 insertions(+), 2 deletions(-) create mode 100644 Mage.Sets/src/mage/cards/m/Mirrex.java create mode 100644 Mage/src/main/java/mage/game/permanent/token/PhyrexianMiteToken.java diff --git a/Mage.Sets/src/mage/cards/m/Mirrex.java b/Mage.Sets/src/mage/cards/m/Mirrex.java new file mode 100644 index 0000000000..5df314478d --- /dev/null +++ b/Mage.Sets/src/mage/cards/m/Mirrex.java @@ -0,0 +1,78 @@ +package mage.cards.m; + +import java.util.Objects; +import java.util.Optional; +import java.util.UUID; + +import mage.abilities.Ability; +import mage.abilities.common.SimpleActivatedAbility; +import mage.abilities.condition.Condition; +import mage.abilities.costs.common.TapSourceCost; +import mage.abilities.costs.mana.GenericManaCost; +import mage.abilities.effects.common.CreateTokenEffect; +import mage.abilities.effects.mana.AddManaOfAnyColorEffect; +import mage.abilities.mana.ActivateIfConditionManaAbility; +import mage.abilities.mana.ColorlessManaAbility; +import mage.constants.SubType; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.constants.CardType; +import mage.constants.Zone; +import mage.game.Game; +import mage.game.permanent.Permanent; +import mage.game.permanent.token.PhyrexianMiteToken; + +/** + * @author TheElk801 + */ +public final class Mirrex extends CardImpl { + + public Mirrex(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.LAND}, ""); + + this.subtype.add(SubType.SPHERE); + + // {T}: Add {C}. + this.addAbility(new ColorlessManaAbility()); + + // {T}: Add one mana of any color. Activate only if Mirrex entered the battlefield this turn. + this.addAbility(new ActivateIfConditionManaAbility( + Zone.BATTLEFIELD, new AddManaOfAnyColorEffect(), + new TapSourceCost(), MirrexCondition.instance + )); + + // {3}, {T}: Create a 1/1 colorless Phyrexian Mite artifact creature token with toxic 1 and "This creature can't block." + Ability ability = new SimpleActivatedAbility( + new CreateTokenEffect(new PhyrexianMiteToken()), new GenericManaCost(3) + ); + ability.addCost(new TapSourceCost()); + this.addAbility(ability); + } + + private Mirrex(final Mirrex card) { + super(card); + } + + @Override + public Mirrex copy() { + return new Mirrex(this); + } +} + +enum MirrexCondition implements Condition { + instance; + + @Override + public boolean apply(Game game, Ability source) { + return Optional + .ofNullable(source.getSourcePermanentIfItStillExists(game)) + .filter(Objects::nonNull) + .map(Permanent::getTurnsOnBattlefield) + .equals(0); + } + + @Override + public String toString() { + return "if {this} entered the battlefield this turn"; + } +} \ No newline at end of file diff --git a/Mage.Sets/src/mage/sets/PhyrexiaAllWillBeOne.java b/Mage.Sets/src/mage/sets/PhyrexiaAllWillBeOne.java index 1222050570..c8d3a7953c 100644 --- a/Mage.Sets/src/mage/sets/PhyrexiaAllWillBeOne.java +++ b/Mage.Sets/src/mage/sets/PhyrexiaAllWillBeOne.java @@ -27,8 +27,7 @@ public final class PhyrexiaAllWillBeOne extends ExpansionSet { cards.add(new SetCardInfo("Dragonwing Glider", 126, Rarity.RARE, mage.cards.d.DragonwingGlider.class)); cards.add(new SetCardInfo("Forest", 276, Rarity.LAND, mage.cards.basiclands.Forest.class, NON_FULL_USE_VARIOUS)); cards.add(new SetCardInfo("Island", 273, Rarity.LAND, mage.cards.basiclands.Island.class, NON_FULL_USE_VARIOUS)); - cards.add(new SetCardInfo("Koth, Fire of Resistance", 138, Rarity.RARE, mage.cards.k.KothFireOfResistance.class, NON_FULL_USE_VARIOUS)); - cards.add(new SetCardInfo("Koth, Fire of Resistance", 446, Rarity.RARE, mage.cards.k.KothFireOfResistance.class, NON_FULL_USE_VARIOUS)); + cards.add(new SetCardInfo("Mirrex", 254, Rarity.RARE, mage.cards.m.Mirrex.class)); cards.add(new SetCardInfo("Mountain", 275, Rarity.LAND, mage.cards.basiclands.Mountain.class, NON_FULL_USE_VARIOUS)); cards.add(new SetCardInfo("Phyrexian Arena", 104, Rarity.RARE, mage.cards.p.PhyrexianArena.class)); cards.add(new SetCardInfo("Phyrexian Obliterator", 105, Rarity.MYTHIC, mage.cards.p.PhyrexianObliterator.class)); diff --git a/Mage/src/main/java/mage/constants/SubType.java b/Mage/src/main/java/mage/constants/SubType.java index eb38459f2d..d7a33bd3fd 100644 --- a/Mage/src/main/java/mage/constants/SubType.java +++ b/Mage/src/main/java/mage/constants/SubType.java @@ -247,6 +247,7 @@ public enum SubType { MINION("Minion", SubTypeSet.CreatureType), MINOTAUR("Minotaur", SubTypeSet.CreatureType), MIRIALAN("Mirialan", SubTypeSet.CreatureType, true), // Star Wars + MITE("Mite", SubTypeSet.CreatureType), MOLE("Mole", SubTypeSet.CreatureType), MONGER("Monger", SubTypeSet.CreatureType), MONGOOSE("Mongoose", SubTypeSet.CreatureType), diff --git a/Mage/src/main/java/mage/game/permanent/token/PhyrexianMiteToken.java b/Mage/src/main/java/mage/game/permanent/token/PhyrexianMiteToken.java new file mode 100644 index 0000000000..b1e203bb35 --- /dev/null +++ b/Mage/src/main/java/mage/game/permanent/token/PhyrexianMiteToken.java @@ -0,0 +1,41 @@ +package mage.game.permanent.token; + +import mage.MageInt; +import mage.abilities.common.SimpleStaticAbility; +import mage.abilities.effects.common.combat.CantBlockSourceEffect; +import mage.abilities.keyword.ToxicAbility; +import mage.constants.CardType; +import mage.constants.Duration; +import mage.constants.SubType; + +import java.util.Arrays; + +/** + * @author TheElk801 + */ +public final class PhyrexianMiteToken extends TokenImpl { + + public PhyrexianMiteToken() { + super("Phyrexian Mite Token", "1/1 colorless Phyrexian Mite artifact creature token with toxic 1 and \"This creature can't block.\""); + cardType.add(CardType.ARTIFACT); + cardType.add(CardType.CREATURE); + subtype.add(SubType.PHYREXIAN); + subtype.add(SubType.MITE); + power = new MageInt(1); + toughness = new MageInt(1); + + this.addAbility(new ToxicAbility(1)); + this.addAbility(new SimpleStaticAbility(new CantBlockSourceEffect(Duration.WhileOnBattlefield).setText("this creature can't block"))); + + availableImageSetCodes = Arrays.asList("ONE"); + } + + public PhyrexianMiteToken(final PhyrexianMiteToken token) { + super(token); + } + + @Override + public PhyrexianMiteToken copy() { + return new PhyrexianMiteToken(this); + } +}