diff --git a/Mage.Sets/src/mage/cards/m/MmmenonTheRightHand.java b/Mage.Sets/src/mage/cards/m/MmmenonTheRightHand.java new file mode 100644 index 00000000000..c2f6e2bf00b --- /dev/null +++ b/Mage.Sets/src/mage/cards/m/MmmenonTheRightHand.java @@ -0,0 +1,110 @@ +package mage.cards.m; + +import mage.ConditionalMana; +import mage.MageInt; +import mage.MageObject; +import mage.Mana; +import mage.abilities.Ability; +import mage.abilities.SpellAbility; +import mage.abilities.common.SimpleStaticAbility; +import mage.abilities.condition.Condition; +import mage.abilities.effects.common.continuous.GainAbilityControlledEffect; +import mage.abilities.effects.common.continuous.LookAtTopCardOfLibraryAnyTimeEffect; +import mage.abilities.effects.common.continuous.PlayFromTopOfLibraryEffect; +import mage.abilities.keyword.FlyingAbility; +import mage.abilities.mana.ConditionalColoredManaAbility; +import mage.abilities.mana.builder.ConditionalManaBuilder; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.constants.*; +import mage.filter.FilterCard; +import mage.filter.StaticFilters; +import mage.filter.common.FilterArtifactCard; +import mage.game.Game; +import mage.game.stack.Spell; + +import java.util.UUID; + +/** + * @author TheElk801 + */ +public final class MmmenonTheRightHand extends CardImpl { + + private static final FilterCard filter = new FilterArtifactCard("cast artifact spells"); + + public MmmenonTheRightHand(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{3}{U}{U}"); + + this.supertype.add(SuperType.LEGENDARY); + this.subtype.add(SubType.JELLYFISH); + this.subtype.add(SubType.ADVISOR); + this.power = new MageInt(3); + this.toughness = new MageInt(4); + + // Flying + this.addAbility(FlyingAbility.getInstance()); + + // You may look at the top card of your library any time. + this.addAbility(new SimpleStaticAbility(new LookAtTopCardOfLibraryAnyTimeEffect())); + + // You may cast artifact spells from the top of your library. + this.addAbility(new SimpleStaticAbility(new PlayFromTopOfLibraryEffect(filter))); + + // Artifacts you control have "{T}: Add {U}. Spend this mana only to cast a spell from anywhere other than your hand." + this.addAbility(new SimpleStaticAbility(new GainAbilityControlledEffect( + new ConditionalColoredManaAbility(Mana.BlueMana(1), new MmmenonTheRightHandManaBuilder()), + Duration.WhileOnBattlefield, StaticFilters.FILTER_PERMANENT_ARTIFACTS + ))); + } + + private MmmenonTheRightHand(final MmmenonTheRightHand card) { + super(card); + } + + @Override + public MmmenonTheRightHand copy() { + return new MmmenonTheRightHand(this); + } +} + +class MmmenonTheRightHandManaBuilder extends ConditionalManaBuilder { + + @Override + public ConditionalMana build(Object... options) { + return new MmmenonTheRightHandConditionalMana(this.mana); + } + + @Override + public String getRule() { + return "Spend this mana only to cast a spell from anywhere other than your hand"; + } +} + +class MmmenonTheRightHandConditionalMana extends ConditionalMana { + + public MmmenonTheRightHandConditionalMana(Mana mana) { + super(mana); + this.staticText = "Spend this mana only to cast a spell from anywhere other than your hand"; + addCondition(MmmenonTheRightHandManaCondition.instance); + } +} + +enum MmmenonTheRightHandManaCondition implements Condition { + instance; + + @Override + public boolean apply(Game game, Ability source) { + if (!(source instanceof SpellAbility)) { + return false; + } + MageObject object = game.getObject(source); + if (!source.isControlledBy(game.getOwnerId(object))) { + return false; + } + if (object instanceof Spell) { + return !Zone.HAND.match(((Spell) object).getFromZone()); + } + // checking mana without real cast + return game.inCheckPlayableState() && !Zone.HAND.match(game.getState().getZone(source.getSourceId())); + } +} diff --git a/Mage.Sets/src/mage/sets/EdgeOfEternities.java b/Mage.Sets/src/mage/sets/EdgeOfEternities.java index 96133a498cf..267c9d44218 100644 --- a/Mage.Sets/src/mage/sets/EdgeOfEternities.java +++ b/Mage.Sets/src/mage/sets/EdgeOfEternities.java @@ -122,6 +122,8 @@ public final class EdgeOfEternities extends ExpansionSet { cards.add(new SetCardInfo("Mechanozoa", 66, Rarity.COMMON, mage.cards.m.Mechanozoa.class)); cards.add(new SetCardInfo("Memorial Team Leader", 144, Rarity.UNCOMMON, mage.cards.m.MemorialTeamLeader.class)); cards.add(new SetCardInfo("Mightform Harmonizer", 200, Rarity.RARE, mage.cards.m.MightformHarmonizer.class)); + cards.add(new SetCardInfo("Mm'menon, the Right Hand", 290, Rarity.RARE, mage.cards.m.MmmenonTheRightHand.class, NON_FULL_USE_VARIOUS)); + cards.add(new SetCardInfo("Mm'menon, the Right Hand", 68, Rarity.RARE, mage.cards.m.MmmenonTheRightHand.class, NON_FULL_USE_VARIOUS)); cards.add(new SetCardInfo("Monoist Circuit-Feeder", 110, Rarity.UNCOMMON, mage.cards.m.MonoistCircuitFeeder.class)); cards.add(new SetCardInfo("Mountain", 265, Rarity.LAND, mage.cards.basiclands.Mountain.class, FULL_ART_BFZ_VARIOUS)); cards.add(new SetCardInfo("Mountain", 273, Rarity.LAND, mage.cards.basiclands.Mountain.class, NON_FULL_USE_VARIOUS));