From 065dc3da0e87570e3471ffb11bedfb2f86296f4a Mon Sep 17 00:00:00 2001 From: Evan Kranzler Date: Sun, 10 Jan 2021 21:33:14 -0500 Subject: [PATCH] [KHM] Implemented Maskwood Nexus --- Mage.Sets/src/mage/cards/m/MaskwoodNexus.java | 147 ++++++++++++++++++ Mage.Sets/src/mage/sets/Kaldheim.java | 1 + .../token/ShapeshifterBlueToken.java | 31 ++++ 3 files changed, 179 insertions(+) create mode 100644 Mage.Sets/src/mage/cards/m/MaskwoodNexus.java create mode 100644 Mage/src/main/java/mage/game/permanent/token/ShapeshifterBlueToken.java diff --git a/Mage.Sets/src/mage/cards/m/MaskwoodNexus.java b/Mage.Sets/src/mage/cards/m/MaskwoodNexus.java new file mode 100644 index 00000000000..e65c52e16a4 --- /dev/null +++ b/Mage.Sets/src/mage/cards/m/MaskwoodNexus.java @@ -0,0 +1,147 @@ +package mage.cards.m; + +import mage.abilities.Ability; +import mage.abilities.common.SimpleActivatedAbility; +import mage.abilities.common.SimpleStaticAbility; +import mage.abilities.costs.common.TapSourceCost; +import mage.abilities.costs.mana.GenericManaCost; +import mage.abilities.effects.ContinuousEffectImpl; +import mage.abilities.effects.common.CreateTokenEffect; +import mage.cards.Card; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.constants.*; +import mage.filter.common.FilterControlledCreaturePermanent; +import mage.game.Game; +import mage.game.command.CommandObject; +import mage.game.command.Commander; +import mage.game.permanent.Permanent; +import mage.game.permanent.token.ShapeshifterBlueToken; +import mage.game.stack.Spell; +import mage.game.stack.StackObject; +import mage.players.Player; + +import java.util.Iterator; +import java.util.List; +import java.util.UUID; + +/** + * @author TheElk801 + */ +public final class MaskwoodNexus extends CardImpl { + + public MaskwoodNexus(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.ARTIFACT}, "{4}"); + + // Creatures you control are every creature type. The same is true for creature spells you control and creature cards you own that aren't on the battlefield. + this.addAbility(new SimpleStaticAbility(new MaskwoodNexusEffect())); + + // {3}, {T}: Create a 2/2 blue Shapeshifter creature token with changeling. + Ability ability = new SimpleActivatedAbility( + new CreateTokenEffect(new ShapeshifterBlueToken()), new GenericManaCost(3) + ); + ability.addCost(new TapSourceCost()); + this.addAbility(ability); + } + + private MaskwoodNexus(final MaskwoodNexus card) { + super(card); + } + + @Override + public MaskwoodNexus copy() { + return new MaskwoodNexus(this); + } +} + +class MaskwoodNexusEffect extends ContinuousEffectImpl { + + MaskwoodNexusEffect() { + super(Duration.WhileOnBattlefield, Outcome.Benefit); + staticText = "Creatures you control are every creature type. " + + "The same is true for creature spells you control " + + "and creature cards you own that aren't on the battlefield."; + } + + private MaskwoodNexusEffect(final MaskwoodNexusEffect effect) { + super(effect); + } + + @Override + public MaskwoodNexusEffect copy() { + return new MaskwoodNexusEffect(this); + } + + @Override + public boolean apply(Layer layer, SubLayer sublayer, Ability source, Game game) { + Player controller = game.getPlayer(source.getControllerId()); + if (controller == null) { + return false; + } + // Creature cards you own that aren't on the battlefield + // in graveyard + for (UUID cardId : controller.getGraveyard()) { + Card card = game.getCard(cardId); + if (card != null && card.isCreature()) { + card.setIsAllCreatureTypes(true); + } + } + // on Hand + for (UUID cardId : controller.getHand()) { + Card card = game.getCard(cardId); + if (card != null && card.isCreature()) { + card.setIsAllCreatureTypes(true); + } + } + // in Exile + for (Card card : game.getState().getExile().getAllCards(game)) { + if (card.isCreature() && card.isOwnedBy(controller.getId())) { + card.setIsAllCreatureTypes(true); + } + } + // in Library (e.g. for Mystical Teachings) + for (Card card : controller.getLibrary().getCards(game)) { + if (card.isOwnedBy(controller.getId()) && card.isCreature()) { + card.setIsAllCreatureTypes(true); + } + } + // commander in command zone + for (CommandObject commandObject : game.getState().getCommand()) { + if (!(commandObject instanceof Commander)) { + continue; + } + Card card = game.getCard(((Commander) commandObject).getId()); + if (card != null + && card.isOwnedBy(controller.getId()) + && card.isCreature()) { + card.setIsAllCreatureTypes(true); + } + } + // creature spells you control + for (Iterator iterator = game.getStack().iterator(); iterator.hasNext(); ) { + StackObject stackObject = iterator.next(); + if (stackObject instanceof Spell + && stackObject.isControlledBy(source.getControllerId()) + && stackObject.isCreature()) { + Card card = ((Spell) stackObject).getCard(); + card.setIsAllCreatureTypes(true); + } + } + // creatures you control + List creatures = game.getBattlefield().getAllActivePermanents( + new FilterControlledCreaturePermanent(), source.getControllerId(), game); + for (Permanent creature : creatures) { + if (creature != null) { + creature.setIsAllCreatureTypes(true); + } + } + return true; + + } + + @Override + public boolean apply(Game game, Ability source) { + return false; + } + +} diff --git a/Mage.Sets/src/mage/sets/Kaldheim.java b/Mage.Sets/src/mage/sets/Kaldheim.java index a44b52d43b3..4f2b23ec025 100644 --- a/Mage.Sets/src/mage/sets/Kaldheim.java +++ b/Mage.Sets/src/mage/sets/Kaldheim.java @@ -96,6 +96,7 @@ public final class Kaldheim extends ExpansionSet { cards.add(new SetCardInfo("Koma's Faithful", 102, Rarity.COMMON, mage.cards.k.KomasFaithful.class)); cards.add(new SetCardInfo("Magda, Brazen Outlaw", 142, Rarity.RARE, mage.cards.m.MagdaBrazenOutlaw.class)); cards.add(new SetCardInfo("Masked Vandal", 184, Rarity.COMMON, mage.cards.m.MaskedVandal.class)); + cards.add(new SetCardInfo("Maskwood Nexus", 240, Rarity.RARE, mage.cards.m.MaskwoodNexus.class)); cards.add(new SetCardInfo("Niko Aris", 225, Rarity.MYTHIC, mage.cards.n.NikoAris.class)); cards.add(new SetCardInfo("Pyre of Heroes", 241, Rarity.RARE, mage.cards.p.PyreOfHeroes.class)); cards.add(new SetCardInfo("Rampage of the Valkyries", 393, Rarity.UNCOMMON, mage.cards.r.RampageOfTheValkyries.class)); diff --git a/Mage/src/main/java/mage/game/permanent/token/ShapeshifterBlueToken.java b/Mage/src/main/java/mage/game/permanent/token/ShapeshifterBlueToken.java new file mode 100644 index 00000000000..67bddeb14ef --- /dev/null +++ b/Mage/src/main/java/mage/game/permanent/token/ShapeshifterBlueToken.java @@ -0,0 +1,31 @@ +package mage.game.permanent.token; + +import mage.MageInt; +import mage.abilities.keyword.ChangelingAbility; +import mage.constants.CardType; +import mage.constants.SubType; + +/** + * @author TheElk801 + */ +public final class ShapeshifterBlueToken extends TokenImpl { + + public ShapeshifterBlueToken() { + super("Shapeshifter", "2/2 blue Shapeshifter creature token with changeling"); + cardType.add(CardType.CREATURE); + subtype.add(SubType.SHAPESHIFTER); + color.setBlue(true); + power = new MageInt(2); + toughness = new MageInt(2); + setIsAllCreatureTypes(true); + addAbility(ChangelingAbility.getInstance()); + } + + private ShapeshifterBlueToken(final ShapeshifterBlueToken token) { + super(token); + } + + public ShapeshifterBlueToken copy() { + return new ShapeshifterBlueToken(this); + } +}