From 10076c6d8dbe6b61ca1b15881b48a7b78c5b47b5 Mon Sep 17 00:00:00 2001 From: Evan Kranzler Date: Sat, 22 Oct 2022 17:35:42 -0400 Subject: [PATCH] [40K] Implemented Nexos --- .../mage/cards/e/ElementalistsPalette.java | 39 ++------- Mage.Sets/src/mage/cards/n/Nexos.java | 80 +++++++++++++++++++ .../src/mage/cards/r/RosheenMeanderer.java | 35 +------- Mage.Sets/src/mage/sets/Warhammer40000.java | 1 + .../mana/conditional/XCostManaCondition.java | 36 +++++++++ 5 files changed, 124 insertions(+), 67 deletions(-) create mode 100644 Mage.Sets/src/mage/cards/n/Nexos.java create mode 100644 Mage/src/main/java/mage/abilities/mana/conditional/XCostManaCondition.java diff --git a/Mage.Sets/src/mage/cards/e/ElementalistsPalette.java b/Mage.Sets/src/mage/cards/e/ElementalistsPalette.java index 435f11e532..66f3416d33 100644 --- a/Mage.Sets/src/mage/cards/e/ElementalistsPalette.java +++ b/Mage.Sets/src/mage/cards/e/ElementalistsPalette.java @@ -4,16 +4,13 @@ import mage.ConditionalMana; import mage.Mana; import mage.abilities.Ability; import mage.abilities.common.SpellCastControllerTriggeredAbility; -import mage.abilities.costs.Cost; import mage.abilities.costs.common.TapSourceCost; -import mage.abilities.costs.mana.ManaCosts; -import mage.abilities.costs.mana.VariableManaCost; import mage.abilities.effects.common.counter.AddCountersSourceEffect; import mage.abilities.effects.mana.ManaEffect; import mage.abilities.mana.AnyColorManaAbility; import mage.abilities.mana.SimpleManaAbility; import mage.abilities.mana.builder.ConditionalManaBuilder; -import mage.abilities.mana.conditional.ManaCondition; +import mage.abilities.mana.conditional.XCostManaCondition; import mage.cards.CardImpl; import mage.cards.CardSetInfo; import mage.constants.CardType; @@ -114,14 +111,6 @@ class ElementalistsPaletteManaEffect extends ManaEffect { } } -class ElementalistsPaletteConditionalMana extends ConditionalMana { - - ElementalistsPaletteConditionalMana(Mana mana) { - super(mana); - addCondition(new ElementalistsPaletteManaCondition()); - } -} - class ElementalistsPaletteManaBuilder extends ConditionalManaBuilder { @Override public ConditionalMana build(Object... options) { @@ -134,28 +123,10 @@ class ElementalistsPaletteManaBuilder extends ConditionalManaBuilder { } } -class ElementalistsPaletteManaCondition extends ManaCondition { +class ElementalistsPaletteConditionalMana extends ConditionalMana { - /* - A “cost that contains {X}” may be a spell’s total cost, an activated ability’s cost, a suspend cost, or a cost you’re - asked to pay as part of the resolution of a spell or ability (such as Condescend). A spell’s total cost includes either - its mana cost (printed in the upper right corner) or its alternative cost (such as flashback), as well as any additional - costs (such as kicker). If it’s something you can spend mana on, it’s a cost. If that cost includes the {X} symbol in it, - you can spend mana generated by Rosheen on that cost. (2017-11-17) - */ - @Override - public boolean apply(Game game, Ability source, UUID originalId, Cost costToPay) { - boolean result; - if (costToPay instanceof ManaCosts) { - result = !((ManaCosts) costToPay).getVariableCosts().isEmpty(); - } else { - result = costToPay instanceof VariableManaCost; - } - if (!result) { - if (game != null && game.inCheckPlayableState()) { - return true; // TODO: Check the card if there are related abilities with {X} costs. - } - } - return result; + ElementalistsPaletteConditionalMana(Mana mana) { + super(mana); + addCondition(new XCostManaCondition()); } } diff --git a/Mage.Sets/src/mage/cards/n/Nexos.java b/Mage.Sets/src/mage/cards/n/Nexos.java new file mode 100644 index 0000000000..e1581af47e --- /dev/null +++ b/Mage.Sets/src/mage/cards/n/Nexos.java @@ -0,0 +1,80 @@ +package mage.cards.n; + +import mage.ConditionalMana; +import mage.MageInt; +import mage.Mana; +import mage.abilities.common.SimpleStaticAbility; +import mage.abilities.costs.common.TapSourceCost; +import mage.abilities.effects.common.continuous.GainAbilityControlledEffect; +import mage.abilities.effects.mana.BasicManaEffect; +import mage.abilities.mana.ActivatedManaAbilityImpl; +import mage.abilities.mana.conditional.XCostManaCondition; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.constants.*; +import mage.filter.FilterPermanent; +import mage.filter.common.FilterLandPermanent; + +import java.util.UUID; + +/** + * @author TheElk801 + */ +public final class Nexos extends CardImpl { + + private static final FilterPermanent filter = new FilterLandPermanent("basic lands"); + + static { + filter.add(SuperType.BASIC.getPredicate()); + } + + public Nexos(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{1}{G}"); + + this.subtype.add(SubType.HUMAN); + this.subtype.add(SubType.TYRANID); + this.subtype.add(SubType.ADVISOR); + this.power = new MageInt(2); + this.toughness = new MageInt(2); + + // Strategic Coordinator -- Basic lands you control have "{T}: Add {C}{C}. Spend this mana only on costs that contain {X}." + this.addAbility(new SimpleStaticAbility(new GainAbilityControlledEffect( + new NexosManaAbility(), Duration.WhileOnBattlefield, filter + ))); + } + + private Nexos(final Nexos card) { + super(card); + } + + @Override + public Nexos copy() { + return new Nexos(this); + } +} + +class NexosManaAbility extends ActivatedManaAbilityImpl { + + NexosManaAbility() { + super(Zone.BATTLEFIELD, new BasicManaEffect(new NexosConditionalMana()), new TapSourceCost()); + this.netMana.add(Mana.ColorlessMana(2)); + } + + private NexosManaAbility(NexosManaAbility ability) { + super(ability); + } + + @Override + public NexosManaAbility copy() { + return new NexosManaAbility(this); + } +} + +class NexosConditionalMana extends ConditionalMana { + + NexosConditionalMana() { + super(Mana.ColorlessMana(2)); + staticText = "Spend this mana only on costs that contain {X}"; + addCondition(new XCostManaCondition()); + } +} diff --git a/Mage.Sets/src/mage/cards/r/RosheenMeanderer.java b/Mage.Sets/src/mage/cards/r/RosheenMeanderer.java index 6dc88d3ed7..2cdb469cb4 100644 --- a/Mage.Sets/src/mage/cards/r/RosheenMeanderer.java +++ b/Mage.Sets/src/mage/cards/r/RosheenMeanderer.java @@ -3,21 +3,16 @@ package mage.cards.r; import mage.ConditionalMana; import mage.MageInt; import mage.Mana; -import mage.abilities.Ability; -import mage.abilities.costs.Cost; import mage.abilities.costs.common.TapSourceCost; -import mage.abilities.costs.mana.ManaCosts; -import mage.abilities.costs.mana.VariableManaCost; import mage.abilities.effects.mana.BasicManaEffect; import mage.abilities.mana.ActivatedManaAbilityImpl; -import mage.abilities.mana.conditional.ManaCondition; +import mage.abilities.mana.conditional.XCostManaCondition; import mage.cards.CardImpl; import mage.cards.CardSetInfo; import mage.constants.CardType; import mage.constants.SubType; import mage.constants.SuperType; import mage.constants.Zone; -import mage.game.Game; import java.util.UUID; @@ -70,32 +65,6 @@ class RosheenMeandererConditionalMana extends ConditionalMana { RosheenMeandererConditionalMana() { super(Mana.ColorlessMana(4)); staticText = "Spend this mana only on costs that contain {X}"; - addCondition(new RosheenMeandererManaCondition()); - } -} - -class RosheenMeandererManaCondition extends ManaCondition { - - /* - A “cost that contains {X}” may be a spell’s total cost, an activated ability’s cost, a suspend cost, or a cost you’re - asked to pay as part of the resolution of a spell or ability (such as Condescend). A spell’s total cost includes either - its mana cost (printed in the upper right corner) or its alternative cost (such as flashback), as well as any additional - costs (such as kicker). If it’s something you can spend mana on, it’s a cost. If that cost includes the {X} symbol in it, - you can spend mana generated by Rosheen on that cost. (2017-11-17) - */ - @Override - public boolean apply(Game game, Ability source, UUID originalId, Cost costToPay) { - boolean result; - if (costToPay instanceof ManaCosts) { - result = !((ManaCosts) costToPay).getVariableCosts().isEmpty(); - } else { - result = costToPay instanceof VariableManaCost; - } - if (!result) { - if (game != null && game.inCheckPlayableState()) { - return true; // TODO: Check the card if there are related abilities with {X} costs. - } - } - return result; + addCondition(new XCostManaCondition()); } } diff --git a/Mage.Sets/src/mage/sets/Warhammer40000.java b/Mage.Sets/src/mage/sets/Warhammer40000.java index 69aa7d7446..eb18938834 100644 --- a/Mage.Sets/src/mage/sets/Warhammer40000.java +++ b/Mage.Sets/src/mage/sets/Warhammer40000.java @@ -177,6 +177,7 @@ public final class Warhammer40000 extends ExpansionSet { cards.add(new SetCardInfo("Necron Deathmark", 42, Rarity.RARE, mage.cards.n.NecronDeathmark.class)); cards.add(new SetCardInfo("Necron Monolith", 161, Rarity.RARE, mage.cards.n.NecronMonolith.class)); cards.add(new SetCardInfo("New Horizons", 218, Rarity.COMMON, mage.cards.n.NewHorizons.class)); + cards.add(new SetCardInfo("Nexos", 95, Rarity.RARE, mage.cards.n.Nexos.class)); cards.add(new SetCardInfo("Night Scythe", 162, Rarity.UNCOMMON, mage.cards.n.NightScythe.class)); cards.add(new SetCardInfo("Noise Marine", 82, Rarity.UNCOMMON, mage.cards.n.NoiseMarine.class)); cards.add(new SetCardInfo("Nurgle's Conscription", 44, Rarity.RARE, mage.cards.n.NurglesConscription.class)); diff --git a/Mage/src/main/java/mage/abilities/mana/conditional/XCostManaCondition.java b/Mage/src/main/java/mage/abilities/mana/conditional/XCostManaCondition.java new file mode 100644 index 0000000000..0d0bd50c8c --- /dev/null +++ b/Mage/src/main/java/mage/abilities/mana/conditional/XCostManaCondition.java @@ -0,0 +1,36 @@ +package mage.abilities.mana.conditional; + +import mage.abilities.Ability; +import mage.abilities.costs.Cost; +import mage.abilities.costs.mana.ManaCosts; +import mage.abilities.costs.mana.VariableManaCost; +import mage.game.Game; + +import java.util.UUID; + +/** + * @author TheElk801 + */ +public class XCostManaCondition extends ManaCondition { + + /* + A “cost that contains {X}” may be a spell’s total cost, an activated ability’s cost, a suspend cost, or a cost you’re + asked to pay as part of the resolution of a spell or ability (such as Condescend). A spell’s total cost includes either + its mana cost (printed in the upper right corner) or its alternative cost (such as flashback), as well as any additional + costs (such as kicker). If it’s something you can spend mana on, it’s a cost. If that cost includes the {X} symbol in it, + you can spend mana generated by Rosheen on that cost. (2017-11-17) + */ + @Override + public boolean apply(Game game, Ability source, UUID originalId, Cost costToPay) { + boolean result; + if (costToPay instanceof ManaCosts) { + result = !((ManaCosts) costToPay).getVariableCosts().isEmpty(); + } else { + result = costToPay instanceof VariableManaCost; + } + if (!result && game != null && game.inCheckPlayableState()) { + return true; // TODO: Check the card if there are related abilities with {X} costs. + } + return result; + } +}