fixed various cards not counting noncreature counting elves correctly (fixes #7006)

This commit is contained in:
Evan Kranzler 2020-08-26 11:40:32 -04:00
parent 9f0b483663
commit 46f5531d35
6 changed files with 45 additions and 58 deletions

View file

@ -1,11 +1,11 @@
package mage.cards.e; package mage.cards.e;
import java.util.UUID; import java.util.UUID;
import mage.MageInt; import mage.MageInt;
import mage.Mana; import mage.Mana;
import mage.abilities.common.SimpleStaticAbility; import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.dynamicvalue.DynamicValue;
import mage.abilities.dynamicvalue.common.PermanentsOnBattlefieldCount; import mage.abilities.dynamicvalue.common.PermanentsOnBattlefieldCount;
import mage.abilities.effects.common.continuous.BoostControlledEffect; import mage.abilities.effects.common.continuous.BoostControlledEffect;
import mage.abilities.mana.DynamicManaAbility; import mage.abilities.mana.DynamicManaAbility;
@ -16,24 +16,20 @@ import mage.constants.Duration;
import mage.constants.SubType; import mage.constants.SubType;
import mage.constants.Zone; import mage.constants.Zone;
import mage.filter.common.FilterControlledCreaturePermanent; import mage.filter.common.FilterControlledCreaturePermanent;
import mage.filter.common.FilterControlledPermanent;
import mage.filter.common.FilterCreaturePermanent; import mage.filter.common.FilterCreaturePermanent;
/** /**
*
* @author BetaSteward_at_googlemail.com, North * @author BetaSteward_at_googlemail.com, North
*/ */
public final class ElvishArchdruid extends CardImpl { public final class ElvishArchdruid extends CardImpl {
private static final FilterCreaturePermanent filter = new FilterCreaturePermanent("Elf creatures"); private static final FilterCreaturePermanent filter = new FilterCreaturePermanent(SubType.ELF, "Elf creatures");
private static final FilterControlledCreaturePermanent filterCount = new FilterControlledCreaturePermanent("Elf you control"); private static final FilterControlledPermanent filterCount = new FilterControlledPermanent(SubType.ELF, "Elf you control");
private static final DynamicValue xValue = new PermanentsOnBattlefieldCount(filterCount);
static {
filter.add(SubType.ELF.getPredicate());
filterCount.add(SubType.ELF.getPredicate());
}
public ElvishArchdruid(UUID ownerId, CardSetInfo setInfo) { 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.ELF);
this.subtype.add(SubType.DRUID); this.subtype.add(SubType.DRUID);
@ -41,10 +37,12 @@ public final class ElvishArchdruid extends CardImpl {
this.toughness = new MageInt(2); this.toughness = new MageInt(2);
// Other Elf creatures you control get +1/+1. // 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. // {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) { public ElvishArchdruid(final ElvishArchdruid card) {

View file

@ -1,9 +1,10 @@
package mage.cards.e; package mage.cards.e;
import java.util.UUID; import java.util.UUID;
import mage.Mana; import mage.Mana;
import mage.abilities.Ability; import mage.abilities.Ability;
import mage.abilities.dynamicvalue.DynamicValue;
import mage.abilities.dynamicvalue.common.PermanentsOnBattlefieldCount; import mage.abilities.dynamicvalue.common.PermanentsOnBattlefieldCount;
import mage.abilities.effects.common.AttachEffect; import mage.abilities.effects.common.AttachEffect;
import mage.abilities.effects.mana.DynamicManaEffect; import mage.abilities.effects.mana.DynamicManaEffect;
@ -15,6 +16,7 @@ import mage.constants.CardType;
import mage.constants.Outcome; import mage.constants.Outcome;
import mage.constants.SubType; import mage.constants.SubType;
import mage.constants.Zone; import mage.constants.Zone;
import mage.filter.FilterPermanent;
import mage.filter.common.FilterCreaturePermanent; import mage.filter.common.FilterCreaturePermanent;
import mage.game.Game; import mage.game.Game;
import mage.game.events.GameEvent; import mage.game.events.GameEvent;
@ -23,7 +25,6 @@ import mage.target.TargetPermanent;
import mage.target.common.TargetLandPermanent; import mage.target.common.TargetLandPermanent;
/** /**
*
* @author Eirkei * @author Eirkei
*/ */
public final class ElvishGuidance extends CardImpl { public final class ElvishGuidance extends CardImpl {
@ -55,8 +56,11 @@ public final class ElvishGuidance extends CardImpl {
class ElvishGuidanceTriggeredAbility extends TriggeredManaAbility { class ElvishGuidanceTriggeredAbility extends TriggeredManaAbility {
private static final FilterPermanent filter = new FilterPermanent(SubType.ELF, "");
private static final DynamicValue xValue = new PermanentsOnBattlefieldCount(filter);
public ElvishGuidanceTriggeredAbility() { 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) { public ElvishGuidanceTriggeredAbility(final ElvishGuidanceTriggeredAbility ability) {

View file

@ -1,7 +1,7 @@
package mage.cards.n; package mage.cards.n;
import java.util.UUID; import java.util.UUID;
import mage.abilities.Ability; import mage.abilities.Ability;
import mage.abilities.LoyaltyAbility; import mage.abilities.LoyaltyAbility;
import mage.abilities.common.PlaneswalkerEntersWithLoyaltyCountersAbility; import mage.abilities.common.PlaneswalkerEntersWithLoyaltyCountersAbility;
@ -15,13 +15,13 @@ import mage.constants.SubType;
import mage.constants.SuperType; import mage.constants.SuperType;
import mage.filter.FilterCard; import mage.filter.FilterCard;
import mage.filter.common.FilterControlledCreaturePermanent; import mage.filter.common.FilterControlledCreaturePermanent;
import mage.filter.common.FilterControlledPermanent;
import mage.filter.predicate.mageobject.NamePredicate; import mage.filter.predicate.mageobject.NamePredicate;
import mage.game.Game; import mage.game.Game;
import mage.players.Player; import mage.players.Player;
import mage.target.common.TargetCardInLibrary; import mage.target.common.TargetCardInLibrary;
/** /**
*
* @author maurer.it_at_gmail.com * @author maurer.it_at_gmail.com
*/ */
public final class NissaRevane extends CardImpl { public final class NissaRevane extends CardImpl {
@ -35,7 +35,7 @@ public final class NissaRevane extends CardImpl {
} }
public NissaRevane(UUID ownerId, CardSetInfo setInfo) { 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.addSuperType(SuperType.LEGENDARY);
this.subtype.add(SubType.NISSA); this.subtype.add(SubType.NISSA);
this.addAbility(new PlaneswalkerEntersWithLoyaltyCountersAbility(2)); this.addAbility(new PlaneswalkerEntersWithLoyaltyCountersAbility(2));
@ -62,11 +62,7 @@ public final class NissaRevane extends CardImpl {
class NissaRevaneGainLifeEffect extends OneShotEffect { class NissaRevaneGainLifeEffect extends OneShotEffect {
private static final FilterControlledCreaturePermanent filter = new FilterControlledCreaturePermanent(); private static final FilterControlledPermanent filter = new FilterControlledPermanent(SubType.ELF);
static {
filter.add(SubType.ELF.getPredicate());
}
public NissaRevaneGainLifeEffect() { public NissaRevaneGainLifeEffect() {
super(Outcome.GainLife); super(Outcome.GainLife);

View file

@ -1,32 +1,29 @@
package mage.cards.p; package mage.cards.p;
import java.util.UUID; import java.util.UUID;
import mage.MageInt; import mage.MageInt;
import mage.Mana; import mage.Mana;
import mage.abilities.dynamicvalue.DynamicValue;
import mage.abilities.dynamicvalue.common.PermanentsOnBattlefieldCount; import mage.abilities.dynamicvalue.common.PermanentsOnBattlefieldCount;
import mage.abilities.mana.DynamicManaAbility; import mage.abilities.mana.DynamicManaAbility;
import mage.cards.CardImpl; import mage.cards.CardImpl;
import mage.cards.CardSetInfo; import mage.cards.CardSetInfo;
import mage.constants.CardType; import mage.constants.CardType;
import mage.constants.SubType; import mage.constants.SubType;
import mage.filter.FilterPermanent;
import mage.filter.common.FilterCreaturePermanent; import mage.filter.common.FilterCreaturePermanent;
/** /**
*
* @author BetaSteward_at_googlemail.com, North * @author BetaSteward_at_googlemail.com, North
*/ */
public final class PriestOfTitania extends CardImpl { public final class PriestOfTitania extends CardImpl {
private static final FilterCreaturePermanent filter = new FilterCreaturePermanent("Elf on the battlefield"); private static final FilterPermanent filter = new FilterPermanent(SubType.ELF, "Elf on the battlefield");
private static final DynamicValue xValue = new PermanentsOnBattlefieldCount(filter);
static {
filter.add(SubType.ELF.getPredicate());
}
public PriestOfTitania(UUID ownerId, CardSetInfo setInfo) { 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.ELF);
this.subtype.add(SubType.DRUID); this.subtype.add(SubType.DRUID);
@ -34,7 +31,7 @@ public final class PriestOfTitania extends CardImpl {
this.toughness = new MageInt(1); this.toughness = new MageInt(1);
// {T}: Add {G} for each Elf on the battlefield. // {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) { public PriestOfTitania(final PriestOfTitania card) {

View file

@ -2,6 +2,7 @@
package mage.cards.r; package mage.cards.r;
import java.util.UUID; import java.util.UUID;
import mage.MageInt; import mage.MageInt;
import mage.abilities.Ability; import mage.abilities.Ability;
import mage.abilities.common.AttacksTriggeredAbility; import mage.abilities.common.AttacksTriggeredAbility;
@ -15,23 +16,19 @@ import mage.cards.CardImpl;
import mage.cards.CardSetInfo; import mage.cards.CardSetInfo;
import mage.constants.*; import mage.constants.*;
import mage.filter.common.FilterControlledCreaturePermanent; import mage.filter.common.FilterControlledCreaturePermanent;
import mage.filter.common.FilterControlledPermanent;
import mage.target.common.TargetControlledCreaturePermanent; import mage.target.common.TargetControlledCreaturePermanent;
/** /**
*
* @author Loki * @author Loki
*/ */
public final class RhysTheExiled extends CardImpl { public final class RhysTheExiled extends CardImpl {
private static final FilterControlledCreaturePermanent filter = new FilterControlledCreaturePermanent("Elf"); private static final FilterControlledCreaturePermanent filter = new FilterControlledCreaturePermanent(SubType.ELF, "Elf");
private static final FilterControlledCreaturePermanent filter2 = new FilterControlledCreaturePermanent("Elf you control"); private static final FilterControlledPermanent filter2 = new FilterControlledPermanent(SubType.ELF, "Elf you control");
static {
filter.add(SubType.ELF.getPredicate());
filter2.add(SubType.ELF.getPredicate());
}
public RhysTheExiled(UUID ownerId, CardSetInfo setInfo) { 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); addSuperType(SuperType.LEGENDARY);
this.subtype.add(SubType.ELF); this.subtype.add(SubType.ELF);
this.subtype.add(SubType.WARRIOR); 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. // 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)); this.addAbility(new AttacksTriggeredAbility(new GainLifeEffect(new PermanentsOnBattlefieldCount(filter2, 1)), false));
// {B}, Sacrifice an Elf: Regenerate Rhys the Exiled. // {B}, Sacrifice an Elf: Regenerate Rhys the Exiled.
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new RegenerateSourceEffect(), new ColoredManaCost(ColoredManaSymbol.B)); Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new RegenerateSourceEffect(), new ColoredManaCost(ColoredManaSymbol.B));
ability.addCost(new SacrificeTargetCost(new TargetControlledCreaturePermanent(1, 1, filter, false))); ability.addCost(new SacrificeTargetCost(new TargetControlledCreaturePermanent(1, 1, filter, false)));

View file

@ -1,37 +1,32 @@
package mage.cards.w; package mage.cards.w;
import java.util.UUID; import java.util.UUID;
import mage.abilities.dynamicvalue.DynamicValue;
import mage.abilities.dynamicvalue.common.PermanentsOnBattlefieldCount; import mage.abilities.dynamicvalue.common.PermanentsOnBattlefieldCount;
import mage.abilities.effects.Effect;
import mage.abilities.effects.common.continuous.BoostTargetEffect; import mage.abilities.effects.common.continuous.BoostTargetEffect;
import mage.cards.CardImpl; import mage.cards.CardImpl;
import mage.cards.CardSetInfo; import mage.cards.CardSetInfo;
import mage.constants.CardType; import mage.constants.CardType;
import mage.constants.Duration; import mage.constants.Duration;
import mage.constants.SubType; import mage.constants.SubType;
import mage.filter.common.FilterCreaturePermanent; import mage.filter.FilterPermanent;
import mage.target.common.TargetCreaturePermanent; import mage.target.common.TargetCreaturePermanent;
/** /**
*
* @author djbrez * @author djbrez
*/ */
public final class WirewoodPride extends CardImpl { public final class WirewoodPride extends CardImpl {
private static final FilterCreaturePermanent elfCount = new FilterCreaturePermanent("Elves"); private static final FilterPermanent filter = new FilterPermanent(SubType.ELF, "Elves");
static { private static final DynamicValue xValue = new PermanentsOnBattlefieldCount(filter);
elfCount.add(SubType.ELF.getPredicate());
}
public WirewoodPride(UUID ownerId, CardSetInfo setInfo) { 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. // Target creature gets +X/+X until end of turn, where X is the number of Elves on the battlefield.
PermanentsOnBattlefieldCount amount = new PermanentsOnBattlefieldCount(elfCount); this.getSpellAbility().addEffect(new BoostTargetEffect(xValue, xValue, Duration.EndOfTurn, true)
Effect effect = new BoostTargetEffect(amount, amount, Duration.EndOfTurn, true); .setText("Target creature gets +X/+X until end of turn, where X is the number of Elves on the battlefield"));
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().addTarget(new TargetCreaturePermanent()); this.getSpellAbility().addTarget(new TargetCreaturePermanent());
} }