diff --git a/Mage.Sets/src/mage/cards/e/EtheriumPteramander.java b/Mage.Sets/src/mage/cards/e/EtheriumPteramander.java new file mode 100644 index 00000000000..2b29f88b3bd --- /dev/null +++ b/Mage.Sets/src/mage/cards/e/EtheriumPteramander.java @@ -0,0 +1,87 @@ +package mage.cards.e; + +import mage.MageInt; +import mage.abilities.Ability; +import mage.abilities.common.CanBlockOnlyFlyingAbility; +import mage.abilities.common.SimpleActivatedAbility; +import mage.abilities.costs.CostAdjuster; +import mage.abilities.costs.mana.ManaCostsImpl; +import mage.abilities.dynamicvalue.DynamicValue; +import mage.abilities.dynamicvalue.common.PermanentsOnBattlefieldCount; +import mage.abilities.effects.keyword.AdaptEffect; +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.CardType; +import mage.constants.SubType; +import mage.filter.FilterPermanent; +import mage.filter.common.FilterControlledArtifactPermanent; +import mage.filter.predicate.mageobject.AnotherPredicate; +import mage.game.Game; +import mage.util.CardUtil; + +import java.util.UUID; + +/** + * @author Susucr + */ +public final class EtheriumPteramander extends CardImpl { + + public EtheriumPteramander(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.ARTIFACT, CardType.CREATURE}, "{B}"); + + 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()); + + // Etherium Pteramander can block only creatures with flying. + this.addAbility(new CanBlockOnlyFlyingAbility()); + + // {6}{B}: Adapt 4. This ability costs {1} less to activate for each other artifact you control. + Ability ability = new SimpleActivatedAbility( + new AdaptEffect(4) + .setText("Adapt 4. This ability costs {1} less to activate for each other artifact you control."), + new ManaCostsImpl<>("{6}{B}") + ); + ability.setCostAdjuster(EtheriumPteramanderAdjuster.instance); + this.addAbility(ability.addHint(EtheriumPteramanderAdjuster.getHint())); + } + + private EtheriumPteramander(final EtheriumPteramander card) { + super(card); + } + + @Override + public EtheriumPteramander copy() { + return new EtheriumPteramander(this); + } +} + +enum EtheriumPteramanderAdjuster implements CostAdjuster { + instance; + + private static final FilterPermanent filter = new FilterControlledArtifactPermanent(); + + static { + filter.add(AnotherPredicate.instance); + } + + private static final DynamicValue artifactCount = new PermanentsOnBattlefieldCount(filter); + private static final Hint hint = new ValueHint("Other Artifacts you control", artifactCount); + + static Hint getHint() { + return hint; + } + + @Override + public void adjustCosts(Ability ability, Game game) { + int count = artifactCount.calculate(game, ability, null); + CardUtil.reduceCost(ability, count); + } +} diff --git a/Mage.Sets/src/mage/cards/p/Pteramander.java b/Mage.Sets/src/mage/cards/p/Pteramander.java index cbe6c0ff688..c4fb5b9fe71 100644 --- a/Mage.Sets/src/mage/cards/p/Pteramander.java +++ b/Mage.Sets/src/mage/cards/p/Pteramander.java @@ -17,7 +17,6 @@ import mage.constants.CardType; import mage.constants.SubType; import mage.filter.StaticFilters; import mage.game.Game; -import mage.players.Player; import mage.util.CardUtil; import java.util.UUID; @@ -39,7 +38,11 @@ public final class Pteramander extends CardImpl { this.addAbility(FlyingAbility.getInstance()); // {7}{U}: Adapt 4. This ability costs {1} less to activate for each instant and sorcery card in your graveyard. - 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}")); + 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}") + ); ability.setCostAdjuster(PteramanderAdjuster.instance); this.addAbility(ability.addHint(PteramanderAdjuster.getHint())); } @@ -68,10 +71,7 @@ enum PteramanderAdjuster implements CostAdjuster { @Override public void adjustCosts(Ability ability, Game game) { - Player controller = game.getPlayer(ability.getControllerId()); - if (controller != null) { - int count = cardsCount.calculate(game, ability, null); - CardUtil.reduceCost(ability, count); - } + int count = cardsCount.calculate(game, ability, null); + CardUtil.reduceCost(ability, count); } } diff --git a/Mage.Sets/src/mage/sets/ModernHorizons3.java b/Mage.Sets/src/mage/sets/ModernHorizons3.java index 316a9ba9ee2..0d8a42f08c6 100644 --- a/Mage.Sets/src/mage/sets/ModernHorizons3.java +++ b/Mage.Sets/src/mage/sets/ModernHorizons3.java @@ -81,6 +81,7 @@ public final class ModernHorizons3 extends ExpansionSet { cards.add(new SetCardInfo("Emrakul, the World Anew", 6, Rarity.MYTHIC, mage.cards.e.EmrakulTheWorldAnew.class)); cards.add(new SetCardInfo("Envoy of the Ancestors", 23, Rarity.UNCOMMON, mage.cards.e.EnvoyOfTheAncestors.class)); cards.add(new SetCardInfo("Estrid's Invocation", 269, Rarity.RARE, mage.cards.e.EstridsInvocation.class)); + cards.add(new SetCardInfo("Etherium Pteramander", 92, Rarity.UNCOMMON, mage.cards.e.EtheriumPteramander.class)); cards.add(new SetCardInfo("Eviscerator's Insight", 93, Rarity.COMMON, mage.cards.e.EvisceratorsInsight.class)); cards.add(new SetCardInfo("Evolution Witness", 151, Rarity.COMMON, mage.cards.e.EvolutionWitness.class)); cards.add(new SetCardInfo("Expanding Ooze", 184, Rarity.COMMON, mage.cards.e.ExpandingOoze.class));