mirror of
https://github.com/magefree/mage.git
synced 2025-12-20 02:30:08 -08:00
[MSH] Implement Namor the Sub-Mariner
This commit is contained in:
parent
0a2fea6684
commit
6fe5a80c60
2 changed files with 118 additions and 0 deletions
116
Mage.Sets/src/mage/cards/n/NamorTheSubMariner.java
Normal file
116
Mage.Sets/src/mage/cards/n/NamorTheSubMariner.java
Normal file
|
|
@ -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<StackObject> {
|
||||
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";
|
||||
}
|
||||
}
|
||||
|
|
@ -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));
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue