From 46f5531d35bc68187c55e0deae852a910e604194 Mon Sep 17 00:00:00 2001 From: Evan Kranzler Date: Wed, 26 Aug 2020 11:40:32 -0400 Subject: [PATCH] fixed various cards not counting noncreature counting elves correctly (fixes #7006) --- .../src/mage/cards/e/ElvishArchdruid.java | 26 +++++++++---------- .../src/mage/cards/e/ElvishGuidance.java | 10 ++++--- Mage.Sets/src/mage/cards/n/NissaRevane.java | 12 +++------ .../src/mage/cards/p/PriestOfTitania.java | 17 +++++------- Mage.Sets/src/mage/cards/r/RhysTheExiled.java | 15 +++++------ Mage.Sets/src/mage/cards/w/WirewoodPride.java | 23 +++++++--------- 6 files changed, 45 insertions(+), 58 deletions(-) diff --git a/Mage.Sets/src/mage/cards/e/ElvishArchdruid.java b/Mage.Sets/src/mage/cards/e/ElvishArchdruid.java index 837c6b2991..bca7100dd6 100644 --- a/Mage.Sets/src/mage/cards/e/ElvishArchdruid.java +++ b/Mage.Sets/src/mage/cards/e/ElvishArchdruid.java @@ -1,11 +1,11 @@ - - package mage.cards.e; import java.util.UUID; + import mage.MageInt; import mage.Mana; import mage.abilities.common.SimpleStaticAbility; +import mage.abilities.dynamicvalue.DynamicValue; import mage.abilities.dynamicvalue.common.PermanentsOnBattlefieldCount; import mage.abilities.effects.common.continuous.BoostControlledEffect; import mage.abilities.mana.DynamicManaAbility; @@ -16,24 +16,20 @@ import mage.constants.Duration; import mage.constants.SubType; import mage.constants.Zone; import mage.filter.common.FilterControlledCreaturePermanent; +import mage.filter.common.FilterControlledPermanent; import mage.filter.common.FilterCreaturePermanent; /** - * * @author BetaSteward_at_googlemail.com, North */ public final class ElvishArchdruid extends CardImpl { - private static final FilterCreaturePermanent filter = new FilterCreaturePermanent("Elf creatures"); - private static final FilterControlledCreaturePermanent filterCount = new FilterControlledCreaturePermanent("Elf you control"); - - static { - filter.add(SubType.ELF.getPredicate()); - filterCount.add(SubType.ELF.getPredicate()); - } + private static final FilterCreaturePermanent filter = new FilterCreaturePermanent(SubType.ELF, "Elf creatures"); + private static final FilterControlledPermanent filterCount = new FilterControlledPermanent(SubType.ELF, "Elf you control"); + private static final DynamicValue xValue = new PermanentsOnBattlefieldCount(filterCount); public ElvishArchdruid(UUID ownerId, CardSetInfo setInfo) { - super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{1}{G}{G}"); + super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{1}{G}{G}"); this.subtype.add(SubType.ELF); this.subtype.add(SubType.DRUID); @@ -41,10 +37,12 @@ public final class ElvishArchdruid extends CardImpl { this.toughness = new MageInt(2); // Other Elf creatures you control get +1/+1. - this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new BoostControlledEffect(1, 1, Duration.WhileOnBattlefield, filter, true))); - + this.addAbility(new SimpleStaticAbility(new BoostControlledEffect( + 1, 1, Duration.WhileOnBattlefield, filter, true + ))); + // {T}: Add {G} for each Elf you control. - this.addAbility(new DynamicManaAbility(Mana.GreenMana(1), new PermanentsOnBattlefieldCount(filterCount))); + this.addAbility(new DynamicManaAbility(Mana.GreenMana(1), xValue)); } public ElvishArchdruid(final ElvishArchdruid card) { diff --git a/Mage.Sets/src/mage/cards/e/ElvishGuidance.java b/Mage.Sets/src/mage/cards/e/ElvishGuidance.java index 9e423dbb04..6f8fabb5b3 100644 --- a/Mage.Sets/src/mage/cards/e/ElvishGuidance.java +++ b/Mage.Sets/src/mage/cards/e/ElvishGuidance.java @@ -1,9 +1,10 @@ - package mage.cards.e; import java.util.UUID; + import mage.Mana; import mage.abilities.Ability; +import mage.abilities.dynamicvalue.DynamicValue; import mage.abilities.dynamicvalue.common.PermanentsOnBattlefieldCount; import mage.abilities.effects.common.AttachEffect; import mage.abilities.effects.mana.DynamicManaEffect; @@ -15,6 +16,7 @@ import mage.constants.CardType; import mage.constants.Outcome; import mage.constants.SubType; import mage.constants.Zone; +import mage.filter.FilterPermanent; import mage.filter.common.FilterCreaturePermanent; import mage.game.Game; import mage.game.events.GameEvent; @@ -23,7 +25,6 @@ import mage.target.TargetPermanent; import mage.target.common.TargetLandPermanent; /** - * * @author Eirkei */ public final class ElvishGuidance extends CardImpl { @@ -55,8 +56,11 @@ public final class ElvishGuidance extends CardImpl { class ElvishGuidanceTriggeredAbility extends TriggeredManaAbility { + private static final FilterPermanent filter = new FilterPermanent(SubType.ELF, ""); + private static final DynamicValue xValue = new PermanentsOnBattlefieldCount(filter); + public ElvishGuidanceTriggeredAbility() { - super(Zone.BATTLEFIELD, new DynamicManaEffect(Mana.GreenMana(1), new PermanentsOnBattlefieldCount(new FilterCreaturePermanent(SubType.ELF, "Elf")))); + super(Zone.BATTLEFIELD, new DynamicManaEffect(Mana.GreenMana(1), xValue)); } public ElvishGuidanceTriggeredAbility(final ElvishGuidanceTriggeredAbility ability) { diff --git a/Mage.Sets/src/mage/cards/n/NissaRevane.java b/Mage.Sets/src/mage/cards/n/NissaRevane.java index ab912d5b14..cee14c6ce5 100644 --- a/Mage.Sets/src/mage/cards/n/NissaRevane.java +++ b/Mage.Sets/src/mage/cards/n/NissaRevane.java @@ -1,7 +1,7 @@ - package mage.cards.n; import java.util.UUID; + import mage.abilities.Ability; import mage.abilities.LoyaltyAbility; import mage.abilities.common.PlaneswalkerEntersWithLoyaltyCountersAbility; @@ -15,13 +15,13 @@ import mage.constants.SubType; import mage.constants.SuperType; import mage.filter.FilterCard; import mage.filter.common.FilterControlledCreaturePermanent; +import mage.filter.common.FilterControlledPermanent; import mage.filter.predicate.mageobject.NamePredicate; import mage.game.Game; import mage.players.Player; import mage.target.common.TargetCardInLibrary; /** - * * @author maurer.it_at_gmail.com */ public final class NissaRevane extends CardImpl { @@ -35,7 +35,7 @@ public final class NissaRevane extends CardImpl { } public NissaRevane(UUID ownerId, CardSetInfo setInfo) { - super(ownerId,setInfo,new CardType[]{CardType.PLANESWALKER},"{2}{G}{G}"); + super(ownerId, setInfo, new CardType[]{CardType.PLANESWALKER}, "{2}{G}{G}"); this.addSuperType(SuperType.LEGENDARY); this.subtype.add(SubType.NISSA); this.addAbility(new PlaneswalkerEntersWithLoyaltyCountersAbility(2)); @@ -62,11 +62,7 @@ public final class NissaRevane extends CardImpl { class NissaRevaneGainLifeEffect extends OneShotEffect { - private static final FilterControlledCreaturePermanent filter = new FilterControlledCreaturePermanent(); - - static { - filter.add(SubType.ELF.getPredicate()); - } + private static final FilterControlledPermanent filter = new FilterControlledPermanent(SubType.ELF); public NissaRevaneGainLifeEffect() { super(Outcome.GainLife); diff --git a/Mage.Sets/src/mage/cards/p/PriestOfTitania.java b/Mage.Sets/src/mage/cards/p/PriestOfTitania.java index 445d855e57..3ef5571b08 100644 --- a/Mage.Sets/src/mage/cards/p/PriestOfTitania.java +++ b/Mage.Sets/src/mage/cards/p/PriestOfTitania.java @@ -1,32 +1,29 @@ - - package mage.cards.p; import java.util.UUID; + import mage.MageInt; import mage.Mana; +import mage.abilities.dynamicvalue.DynamicValue; import mage.abilities.dynamicvalue.common.PermanentsOnBattlefieldCount; import mage.abilities.mana.DynamicManaAbility; import mage.cards.CardImpl; import mage.cards.CardSetInfo; import mage.constants.CardType; import mage.constants.SubType; +import mage.filter.FilterPermanent; import mage.filter.common.FilterCreaturePermanent; /** - * * @author BetaSteward_at_googlemail.com, North */ public final class PriestOfTitania extends CardImpl { - private static final FilterCreaturePermanent filter = new FilterCreaturePermanent("Elf on the battlefield"); - - static { - filter.add(SubType.ELF.getPredicate()); - } + private static final FilterPermanent filter = new FilterPermanent(SubType.ELF, "Elf on the battlefield"); + private static final DynamicValue xValue = new PermanentsOnBattlefieldCount(filter); public PriestOfTitania(UUID ownerId, CardSetInfo setInfo) { - super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{1}{G}"); + super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{1}{G}"); this.subtype.add(SubType.ELF); this.subtype.add(SubType.DRUID); @@ -34,7 +31,7 @@ public final class PriestOfTitania extends CardImpl { this.toughness = new MageInt(1); // {T}: Add {G} for each Elf on the battlefield. - this.addAbility(new DynamicManaAbility(Mana.GreenMana(1), new PermanentsOnBattlefieldCount(filter))); + this.addAbility(new DynamicManaAbility(Mana.GreenMana(1), xValue)); } public PriestOfTitania(final PriestOfTitania card) { diff --git a/Mage.Sets/src/mage/cards/r/RhysTheExiled.java b/Mage.Sets/src/mage/cards/r/RhysTheExiled.java index 083858601f..96327cdacb 100644 --- a/Mage.Sets/src/mage/cards/r/RhysTheExiled.java +++ b/Mage.Sets/src/mage/cards/r/RhysTheExiled.java @@ -2,6 +2,7 @@ package mage.cards.r; import java.util.UUID; + import mage.MageInt; import mage.abilities.Ability; import mage.abilities.common.AttacksTriggeredAbility; @@ -15,23 +16,19 @@ import mage.cards.CardImpl; import mage.cards.CardSetInfo; import mage.constants.*; import mage.filter.common.FilterControlledCreaturePermanent; +import mage.filter.common.FilterControlledPermanent; import mage.target.common.TargetControlledCreaturePermanent; /** - * * @author Loki */ public final class RhysTheExiled extends CardImpl { - private static final FilterControlledCreaturePermanent filter = new FilterControlledCreaturePermanent("Elf"); - private static final FilterControlledCreaturePermanent filter2 = new FilterControlledCreaturePermanent("Elf you control"); - static { - filter.add(SubType.ELF.getPredicate()); - filter2.add(SubType.ELF.getPredicate()); - } + private static final FilterControlledCreaturePermanent filter = new FilterControlledCreaturePermanent(SubType.ELF, "Elf"); + private static final FilterControlledPermanent filter2 = new FilterControlledPermanent(SubType.ELF, "Elf you control"); public RhysTheExiled(UUID ownerId, CardSetInfo setInfo) { - super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{2}{G}"); + super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{2}{G}"); addSuperType(SuperType.LEGENDARY); this.subtype.add(SubType.ELF); this.subtype.add(SubType.WARRIOR); @@ -41,7 +38,7 @@ public final class RhysTheExiled extends CardImpl { // Whenever Rhys the Exiled attacks, you gain 1 life for each Elf you control. this.addAbility(new AttacksTriggeredAbility(new GainLifeEffect(new PermanentsOnBattlefieldCount(filter2, 1)), false)); - + // {B}, Sacrifice an Elf: Regenerate Rhys the Exiled. Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new RegenerateSourceEffect(), new ColoredManaCost(ColoredManaSymbol.B)); ability.addCost(new SacrificeTargetCost(new TargetControlledCreaturePermanent(1, 1, filter, false))); diff --git a/Mage.Sets/src/mage/cards/w/WirewoodPride.java b/Mage.Sets/src/mage/cards/w/WirewoodPride.java index 2cb35c7bfa..2ef975ff1b 100644 --- a/Mage.Sets/src/mage/cards/w/WirewoodPride.java +++ b/Mage.Sets/src/mage/cards/w/WirewoodPride.java @@ -1,37 +1,32 @@ - package mage.cards.w; import java.util.UUID; + +import mage.abilities.dynamicvalue.DynamicValue; import mage.abilities.dynamicvalue.common.PermanentsOnBattlefieldCount; -import mage.abilities.effects.Effect; import mage.abilities.effects.common.continuous.BoostTargetEffect; import mage.cards.CardImpl; import mage.cards.CardSetInfo; import mage.constants.CardType; import mage.constants.Duration; import mage.constants.SubType; -import mage.filter.common.FilterCreaturePermanent; +import mage.filter.FilterPermanent; import mage.target.common.TargetCreaturePermanent; /** - * * @author djbrez */ public final class WirewoodPride extends CardImpl { - private static final FilterCreaturePermanent elfCount = new FilterCreaturePermanent("Elves"); - static { - elfCount.add(SubType.ELF.getPredicate()); - } - + private static final FilterPermanent filter = new FilterPermanent(SubType.ELF, "Elves"); + private static final DynamicValue xValue = new PermanentsOnBattlefieldCount(filter); + public WirewoodPride(UUID ownerId, CardSetInfo setInfo) { - super(ownerId,setInfo,new CardType[]{CardType.INSTANT},"{G}"); + super(ownerId, setInfo, new CardType[]{CardType.INSTANT}, "{G}"); // Target creature gets +X/+X until end of turn, where X is the number of Elves on the battlefield. - PermanentsOnBattlefieldCount amount = new PermanentsOnBattlefieldCount(elfCount); - Effect effect = new BoostTargetEffect(amount, amount, Duration.EndOfTurn, true); - effect.setText("Target creature gets +X/+X until end of turn, where X is the number of Elves on the battlefield"); - this.getSpellAbility().addEffect(effect); + this.getSpellAbility().addEffect(new BoostTargetEffect(xValue, xValue, Duration.EndOfTurn, true) + .setText("Target creature gets +X/+X until end of turn, where X is the number of Elves on the battlefield")); this.getSpellAbility().addTarget(new TargetCreaturePermanent()); }