From 7d210cd03a7d738354c4480b507f7022e7e09a36 Mon Sep 17 00:00:00 2001 From: Evan Kranzler Date: Wed, 9 Jan 2019 15:07:46 -0500 Subject: [PATCH] Implemented Pteramander --- .../src/mage/cards/l/LoreseekersStone.java | 22 ++--- .../src/mage/cards/n/NemesisOfMortals.java | 19 ++-- Mage.Sets/src/mage/cards/p/Pteramander.java | 87 +++++++++++++++++++ .../src/mage/sets/RavnicaAllegiance.java | 1 + 4 files changed, 103 insertions(+), 26 deletions(-) create mode 100644 Mage.Sets/src/mage/cards/p/Pteramander.java diff --git a/Mage.Sets/src/mage/cards/l/LoreseekersStone.java b/Mage.Sets/src/mage/cards/l/LoreseekersStone.java index 091e5a49c3..01f0eeb31a 100644 --- a/Mage.Sets/src/mage/cards/l/LoreseekersStone.java +++ b/Mage.Sets/src/mage/cards/l/LoreseekersStone.java @@ -1,28 +1,23 @@ package mage.cards.l; -import java.util.UUID; 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.Effect; import mage.abilities.effects.common.DrawCardSourceControllerEffect; import mage.abilities.effects.common.cost.CostModificationEffectImpl; import mage.cards.CardImpl; import mage.cards.CardSetInfo; -import mage.constants.CardType; -import mage.constants.CostModificationType; -import mage.constants.Duration; -import mage.constants.Outcome; -import mage.constants.Zone; +import mage.constants.*; import mage.game.Game; import mage.players.Player; import mage.util.CardUtil; +import java.util.UUID; + /** - * * @author LevelX2 */ public final class LoreseekersStone extends CardImpl { @@ -31,17 +26,14 @@ public final class LoreseekersStone extends CardImpl { super(ownerId, setInfo, new CardType[]{CardType.ARTIFACT}, "{6}"); // {3}, {T}: Draw three cards. This ability costs {1} more to activate for each card in your hand. - Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new DrawCardSourceControllerEffect(3), new GenericManaCost(3)); + // TODO: Make ability properly copiable + Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new DrawCardSourceControllerEffect(3).setText("Draw three cards. This ability costs {1} more to activate for each card in your hand"), new GenericManaCost(3)); ability.addCost(new TapSourceCost()); - for (Effect effect : ability.getEffects()) { - effect.setText("Draw three cards. This ability costs {1} more to activate for each card in your hand"); - } this.addAbility(ability); this.addAbility(new SimpleStaticAbility(Zone.ALL, new LoreseekersStoneCostIncreasingEffect(ability.getOriginalId()))); - } - public LoreseekersStone(final LoreseekersStone card) { + private LoreseekersStone(final LoreseekersStone card) { super(card); } @@ -60,7 +52,7 @@ class LoreseekersStoneCostIncreasingEffect extends CostModificationEffectImpl { this.originalId = originalId; } - LoreseekersStoneCostIncreasingEffect(final LoreseekersStoneCostIncreasingEffect effect) { + private LoreseekersStoneCostIncreasingEffect(final LoreseekersStoneCostIncreasingEffect effect) { super(effect); this.originalId = effect.originalId; } diff --git a/Mage.Sets/src/mage/cards/n/NemesisOfMortals.java b/Mage.Sets/src/mage/cards/n/NemesisOfMortals.java index ef22b710b6..0cab56e3fe 100644 --- a/Mage.Sets/src/mage/cards/n/NemesisOfMortals.java +++ b/Mage.Sets/src/mage/cards/n/NemesisOfMortals.java @@ -1,7 +1,6 @@ package mage.cards.n; -import java.util.UUID; import mage.MageInt; import mage.abilities.Ability; import mage.abilities.common.SimpleStaticAbility; @@ -11,19 +10,16 @@ import mage.abilities.effects.common.cost.SourceCostReductionForEachCardInGravey import mage.abilities.keyword.MonstrosityAbility; import mage.cards.CardImpl; import mage.cards.CardSetInfo; -import mage.constants.CardType; -import mage.constants.SubType; -import mage.constants.CostModificationType; -import mage.constants.Duration; -import mage.constants.Outcome; -import mage.constants.Zone; +import mage.constants.*; +import mage.filter.StaticFilters; import mage.filter.common.FilterCreatureCard; import mage.game.Game; import mage.players.Player; import mage.util.CardUtil; +import java.util.UUID; + /** - * * @author LevelX2 */ public final class NemesisOfMortals extends CardImpl { @@ -41,6 +37,7 @@ public final class NemesisOfMortals extends CardImpl { this.addAbility(ability); // {7}{G}{G}: Monstrosity 5. This ability costs {1} less to activate for each creature card in your graveyard. + // TODO: Make ability properly copiable ability = new MonstrosityAbility("{7}{G}{G}", 5); for (Effect effect : ability.getEffects()) { effect.setText("Monstrosity 5. This ability costs {1} less to activate for each creature card in your graveyard"); @@ -49,7 +46,7 @@ public final class NemesisOfMortals extends CardImpl { this.addAbility(new SimpleStaticAbility(Zone.ALL, new NemesisOfMortalsCostReducingEffect(ability.getOriginalId()))); } - public NemesisOfMortals(final NemesisOfMortals card) { + private NemesisOfMortals(final NemesisOfMortals card) { super(card); } @@ -68,7 +65,7 @@ class NemesisOfMortalsCostReducingEffect extends CostModificationEffectImpl { this.originalId = originalId; } - NemesisOfMortalsCostReducingEffect(final NemesisOfMortalsCostReducingEffect effect) { + private NemesisOfMortalsCostReducingEffect(final NemesisOfMortalsCostReducingEffect effect) { super(effect); this.originalId = effect.originalId; } @@ -77,7 +74,7 @@ class NemesisOfMortalsCostReducingEffect extends CostModificationEffectImpl { public boolean apply(Game game, Ability source, Ability abilityToModify) { Player controller = game.getPlayer(source.getControllerId()); if (controller != null) { - CardUtil.reduceCost(abilityToModify, controller.getGraveyard().getCards(new FilterCreatureCard(), game).size()); + CardUtil.reduceCost(abilityToModify, controller.getGraveyard().count(StaticFilters.FILTER_CARD_CREATURE, game)); } return true; } diff --git a/Mage.Sets/src/mage/cards/p/Pteramander.java b/Mage.Sets/src/mage/cards/p/Pteramander.java new file mode 100644 index 0000000000..0c5777a0d4 --- /dev/null +++ b/Mage.Sets/src/mage/cards/p/Pteramander.java @@ -0,0 +1,87 @@ +package mage.cards.p; + +import mage.MageInt; +import mage.abilities.Ability; +import mage.abilities.common.SimpleActivatedAbility; +import mage.abilities.common.SimpleStaticAbility; +import mage.abilities.costs.mana.ManaCostsImpl; +import mage.abilities.effects.common.cost.CostModificationEffectImpl; +import mage.abilities.effects.keyword.AdaptEffect; +import mage.abilities.keyword.FlyingAbility; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.constants.*; +import mage.filter.StaticFilters; +import mage.game.Game; +import mage.players.Player; +import mage.util.CardUtil; + +import java.util.UUID; + +/** + * @author TheElk801 + */ +public final class Pteramander extends CardImpl { + + public Pteramander(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{U}"); + + this.subtype.add(SubType.SALAMANDER); + this.subtype.add(SubType.DRAKE); + this.power = new MageInt(1); + this.toughness = new MageInt(1); + + // Flying + this.addAbility(FlyingAbility.getInstance()); + + // {7}{U}: Adapt 4. This ability costs {1} less to activate for each instant and sorcery card in your graveyard. + // TODO: Make ability properly copiable + Ability ability = new SimpleActivatedAbility(new AdaptEffect(4).setText("Adapt 4. This ability costs {1} less to activate for each instant and sorcery card in your graveyard."), new ManaCostsImpl("{7}{U}")); + this.addAbility(ability); + this.addAbility(new SimpleStaticAbility(Zone.ALL, new PteramanderCostIncreasingEffect(ability.getOriginalId()))); + } + + private Pteramander(final Pteramander card) { + super(card); + } + + @Override + public Pteramander copy() { + return new Pteramander(this); + } +} + +class PteramanderCostIncreasingEffect extends CostModificationEffectImpl { + + private final UUID originalId; + + PteramanderCostIncreasingEffect(UUID originalId) { + super(Duration.EndOfGame, Outcome.Benefit, CostModificationType.REDUCE_COST); + this.originalId = originalId; + } + + private PteramanderCostIncreasingEffect(final PteramanderCostIncreasingEffect effect) { + super(effect); + this.originalId = effect.originalId; + } + + @Override + public boolean apply(Game game, Ability source, Ability abilityToModify) { + Player controller = game.getPlayer(source.getControllerId()); + if (controller != null) { + CardUtil.reduceCost(abilityToModify, controller.getGraveyard().count(StaticFilters.FILTER_CARD_INSTANT_OR_SORCERY, game)); + } + return true; + } + + @Override + public boolean applies(Ability abilityToModify, Ability source, Game game) { + return abilityToModify.getOriginalId().equals(originalId); + } + + @Override + public PteramanderCostIncreasingEffect copy() { + return new PteramanderCostIncreasingEffect(this); + } + +} diff --git a/Mage.Sets/src/mage/sets/RavnicaAllegiance.java b/Mage.Sets/src/mage/sets/RavnicaAllegiance.java index 24e019798c..d1da4c45ab 100644 --- a/Mage.Sets/src/mage/sets/RavnicaAllegiance.java +++ b/Mage.Sets/src/mage/sets/RavnicaAllegiance.java @@ -120,6 +120,7 @@ public final class RavnicaAllegiance extends ExpansionSet { cards.add(new SetCardInfo("Pitiless Pontiff", 194, Rarity.UNCOMMON, mage.cards.p.PitilessPontiff.class)); cards.add(new SetCardInfo("Precognitive Perception", 45, Rarity.RARE, mage.cards.p.PrecognitivePerception.class)); cards.add(new SetCardInfo("Prime Speaker Vannifar", 195, Rarity.MYTHIC, mage.cards.p.PrimeSpeakerVannifar.class)); + cards.add(new SetCardInfo("Pteramander", 47, Rarity.UNCOMMON, mage.cards.p.Pteramander.class)); cards.add(new SetCardInfo("Quench", 48, Rarity.COMMON, mage.cards.q.Quench.class)); cards.add(new SetCardInfo("Rafter Demon", 196, Rarity.COMMON, mage.cards.r.RafterDemon.class)); cards.add(new SetCardInfo("Rakdos Firewheeler", 197, Rarity.UNCOMMON, mage.cards.r.RakdosFirewheeler.class));