From 6fe5a80c6015acbb04dc57807593dde928aa89cf Mon Sep 17 00:00:00 2001 From: theelk801 Date: Wed, 10 Dec 2025 11:36:47 -0500 Subject: [PATCH] [MSH] Implement Namor the Sub-Mariner --- .../src/mage/cards/n/NamorTheSubMariner.java | 116 ++++++++++++++++++ .../src/mage/sets/MarvelSuperHeroes.java | 2 + 2 files changed, 118 insertions(+) create mode 100644 Mage.Sets/src/mage/cards/n/NamorTheSubMariner.java diff --git a/Mage.Sets/src/mage/cards/n/NamorTheSubMariner.java b/Mage.Sets/src/mage/cards/n/NamorTheSubMariner.java new file mode 100644 index 00000000000..f1dfef46e5a --- /dev/null +++ b/Mage.Sets/src/mage/cards/n/NamorTheSubMariner.java @@ -0,0 +1,116 @@ +package mage.cards.n; + +import mage.MageInt; +import mage.abilities.Ability; +import mage.abilities.common.SimpleStaticAbility; +import mage.abilities.common.SpellCastControllerTriggeredAbility; +import mage.abilities.dynamicvalue.DynamicValue; +import mage.abilities.dynamicvalue.common.PermanentsOnBattlefieldCount; +import mage.abilities.effects.Effect; +import mage.abilities.effects.common.CreateTokenEffect; +import mage.abilities.effects.common.continuous.SetBasePowerSourceEffect; +import mage.abilities.hint.Hint; +import mage.abilities.hint.ValueHint; +import mage.abilities.keyword.FlyingAbility; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.constants.*; +import mage.filter.FilterSpell; +import mage.filter.common.FilterControlledPermanent; +import mage.filter.predicate.Predicate; +import mage.filter.predicate.Predicates; +import mage.game.Game; +import mage.game.permanent.token.MerfolkToken; +import mage.game.stack.Spell; +import mage.game.stack.StackObject; + +import java.util.UUID; + +/** + * @author TheElk801 + */ +public final class NamorTheSubMariner extends CardImpl { + + private static final DynamicValue xValue = new PermanentsOnBattlefieldCount(new FilterControlledPermanent(SubType.MERFOLK)); + private static final Hint hint = new ValueHint("Merfolk you control", xValue); + private static final FilterSpell filter = new FilterSpell("a noncreature spell with one or more blue mana symbols in its mana cost"); + + static { + filter.add(Predicates.not(CardType.CREATURE.getPredicate())); + filter.add(NamorTheSubMarinerPredicate.instance); + } + + public NamorTheSubMariner(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{1}{U}{U}"); + + this.supertype.add(SuperType.LEGENDARY); + this.subtype.add(SubType.MUTANT); + this.subtype.add(SubType.MERFOLK); + this.subtype.add(SubType.VILLAIN); + this.power = new MageInt(0); + this.toughness = new MageInt(4); + + // Flying + this.addAbility(FlyingAbility.getInstance()); + + // Namor's power is equal to the number of Merfolk you control. + this.addAbility(new SimpleStaticAbility(Zone.ALL, new SetBasePowerSourceEffect(xValue))); + + // Whenever you cast a noncreature spell with one or more blue mana symbols in its mana cost, create that many 1/1 blue Merfolk creature tokens. + this.addAbility(new SpellCastControllerTriggeredAbility( + new CreateTokenEffect(new MerfolkToken(), NamorTheSubMarinerValue.instance), filter, false + )); + } + + private NamorTheSubMariner(final NamorTheSubMariner card) { + super(card); + } + + @Override + public NamorTheSubMariner copy() { + return new NamorTheSubMariner(this); + } +} + +enum NamorTheSubMarinerPredicate implements Predicate { + instance; + + @Override + public boolean apply(StackObject input, Game game) { + return input + .getManaCost() + .stream() + .anyMatch(manaCost -> manaCost.containsColor(ColoredManaSymbol.U)); + } +} + +enum NamorTheSubMarinerValue implements DynamicValue { + instance; + + @Override + public int calculate(Game game, Ability sourceAbility, Effect effect) { + Spell spell = (Spell) effect.getValue("spellCast"); + return spell != null + ? spell + .getManaCost() + .stream() + .mapToInt(manaCost -> manaCost.containsColor(ColoredManaSymbol.U) ? 1 : 0) + .sum() + : 0; + } + + @Override + public NamorTheSubMarinerValue copy() { + return this; + } + + @Override + public String getMessage() { + return "that many"; + } + + @Override + public String toString() { + return "1"; + } +} diff --git a/Mage.Sets/src/mage/sets/MarvelSuperHeroes.java b/Mage.Sets/src/mage/sets/MarvelSuperHeroes.java index f9622f96e7c..dd95b3dd38f 100644 --- a/Mage.Sets/src/mage/sets/MarvelSuperHeroes.java +++ b/Mage.Sets/src/mage/sets/MarvelSuperHeroes.java @@ -28,6 +28,8 @@ public final class MarvelSuperHeroes extends ExpansionSet { cards.add(new SetCardInfo("Doctor Doom", 394, Rarity.MYTHIC, mage.cards.d.DoctorDoom.class, NON_FULL_USE_VARIOUS)); cards.add(new SetCardInfo("Doctor Doom", 95, Rarity.MYTHIC, mage.cards.d.DoctorDoom.class, NON_FULL_USE_VARIOUS)); cards.add(new SetCardInfo("Moon Girl and Devil Dinosaur", 223, Rarity.RARE, mage.cards.m.MoonGirlAndDevilDinosaur.class)); + cards.add(new SetCardInfo("Namor the Sub-Mariner", 391, Rarity.MYTHIC, mage.cards.n.NamorTheSubMariner.class, NON_FULL_USE_VARIOUS)); + cards.add(new SetCardInfo("Namor the Sub-Mariner", 69, Rarity.MYTHIC, mage.cards.n.NamorTheSubMariner.class, NON_FULL_USE_VARIOUS)); cards.add(new SetCardInfo("Quicksilver, Brash Blur", 148, Rarity.RARE, mage.cards.q.QuicksilverBrashBlur.class)); cards.add(new SetCardInfo("Super-Skrull", 115, Rarity.RARE, mage.cards.s.SuperSkrull.class)); cards.add(new SetCardInfo("The Coming of Galactus", 212, Rarity.MYTHIC, mage.cards.t.TheComingOfGalactus.class, NON_FULL_USE_VARIOUS));