From e18e3c79d4c63cb85e0b02a55e26930af1b376c1 Mon Sep 17 00:00:00 2001 From: Evan Kranzler Date: Wed, 13 Jan 2021 18:02:25 -0500 Subject: [PATCH] [KHM] Implemented Glittering Frost --- .../src/mage/cards/d/DawnsReflection.java | 53 ++------------- .../src/mage/cards/e/ElvishGuidance.java | 59 +++------------- Mage.Sets/src/mage/cards/f/FertileGround.java | 60 ++-------------- .../src/mage/cards/g/GlitteringFrost.java | 53 +++++++++++++++ .../src/mage/cards/m/MarketFestival.java | 49 ++----------- Mage.Sets/src/mage/cards/o/Overgrowth.java | 68 +++---------------- .../src/mage/cards/t/TraceOfAbundance.java | 54 ++------------- Mage.Sets/src/mage/cards/u/UtopiaSprawl.java | 42 ++---------- Mage.Sets/src/mage/cards/v/VerdantHaven.java | 58 +++------------- Mage.Sets/src/mage/cards/w/WildGrowth.java | 57 +++------------- .../src/mage/cards/w/WolfwillowHaven.java | 50 ++------------ Mage.Sets/src/mage/sets/Kaldheim.java | 1 + .../abilities/effects/mana/ManaEffect.java | 10 ++- .../EnchantedTappedTriggeredManaAbility.java | 55 +++++++++++++++ 14 files changed, 189 insertions(+), 480 deletions(-) create mode 100644 Mage.Sets/src/mage/cards/g/GlitteringFrost.java create mode 100644 Mage/src/main/java/mage/abilities/mana/EnchantedTappedTriggeredManaAbility.java diff --git a/Mage.Sets/src/mage/cards/d/DawnsReflection.java b/Mage.Sets/src/mage/cards/d/DawnsReflection.java index a9edf8fc51..74dc0e7f4d 100644 --- a/Mage.Sets/src/mage/cards/d/DawnsReflection.java +++ b/Mage.Sets/src/mage/cards/d/DawnsReflection.java @@ -5,22 +5,18 @@ import mage.abilities.Ability; import mage.abilities.effects.common.AttachEffect; import mage.abilities.effects.mana.ManaEffect; import mage.abilities.keyword.EnchantAbility; -import mage.abilities.mana.TriggeredManaAbility; +import mage.abilities.mana.EnchantedTappedTriggeredManaAbility; import mage.cards.CardImpl; import mage.cards.CardSetInfo; import mage.choices.ManaChoice; import mage.constants.CardType; import mage.constants.Outcome; import mage.constants.SubType; -import mage.constants.Zone; import mage.game.Game; -import mage.game.events.GameEvent; -import mage.game.events.GameEvent.EventType; import mage.game.permanent.Permanent; import mage.players.Player; import mage.target.TargetPermanent; import mage.target.common.TargetLandPermanent; -import mage.target.targetpointer.FixedTarget; import java.util.ArrayList; import java.util.List; @@ -43,10 +39,10 @@ public final class DawnsReflection extends CardImpl { this.addAbility(ability); // Whenever enchanted land is tapped for mana, its controller adds two mana in any combination of colors. - this.addAbility(new DawnsReflectionTriggeredAbility()); + this.addAbility(new EnchantedTappedTriggeredManaAbility(new DawnsReflectionManaEffect())); } - public DawnsReflection(final DawnsReflection card) { + private DawnsReflection(final DawnsReflection card) { super(card); } @@ -56,50 +52,15 @@ public final class DawnsReflection extends CardImpl { } } -class DawnsReflectionTriggeredAbility extends TriggeredManaAbility { - - public DawnsReflectionTriggeredAbility() { - super(Zone.BATTLEFIELD, new DawnsReflectionManaEffect()); - } - - public DawnsReflectionTriggeredAbility(final DawnsReflectionTriggeredAbility ability) { - super(ability); - } - - @Override - public DawnsReflectionTriggeredAbility copy() { - return new DawnsReflectionTriggeredAbility(this); - } - - @Override - public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == GameEvent.EventType.TAPPED_FOR_MANA; - } - - @Override - public boolean checkTrigger(GameEvent event, Game game) { - Permanent enchantment = game.getPermanent(this.getSourceId()); - if (enchantment != null && event.getSourceId().equals(enchantment.getAttachedTo())) { - Permanent enchantedLand = game.getPermanentOrLKIBattlefield(enchantment.getAttachedTo()); - return enchantedLand != null && enchantedLand.isLand(); - } - return false; - } - - @Override - public String getRule() { - return "Whenever enchanted land is tapped for mana, its controller adds two mana in any combination of colors (in addition to the mana the land produces)."; - } -} - class DawnsReflectionManaEffect extends ManaEffect { - public DawnsReflectionManaEffect() { + DawnsReflectionManaEffect() { super(); - this.staticText = "its controller adds two mana in any combination of colors"; + this.staticText = "its controller adds two mana in any combination of colors " + + "(in addition to the mana the land produces)"; } - public DawnsReflectionManaEffect(final DawnsReflectionManaEffect effect) { + private DawnsReflectionManaEffect(final DawnsReflectionManaEffect effect) { super(effect); } diff --git a/Mage.Sets/src/mage/cards/e/ElvishGuidance.java b/Mage.Sets/src/mage/cards/e/ElvishGuidance.java index b12318fb61..7d0cee4f36 100644 --- a/Mage.Sets/src/mage/cards/e/ElvishGuidance.java +++ b/Mage.Sets/src/mage/cards/e/ElvishGuidance.java @@ -1,7 +1,5 @@ package mage.cards.e; -import java.util.UUID; - import mage.Mana; import mage.abilities.Ability; import mage.abilities.dynamicvalue.DynamicValue; @@ -9,26 +7,26 @@ import mage.abilities.dynamicvalue.common.PermanentsOnBattlefieldCount; import mage.abilities.effects.common.AttachEffect; import mage.abilities.effects.mana.DynamicManaEffect; import mage.abilities.keyword.EnchantAbility; -import mage.abilities.mana.TriggeredManaAbility; +import mage.abilities.mana.EnchantedTappedTriggeredManaAbility; import mage.cards.CardImpl; import mage.cards.CardSetInfo; 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; -import mage.game.permanent.Permanent; import mage.target.TargetPermanent; import mage.target.common.TargetLandPermanent; +import java.util.UUID; + /** * @author Eirkei */ public final class ElvishGuidance extends CardImpl { + private static final FilterPermanent filter = new FilterPermanent(SubType.ELF, ""); + private static final DynamicValue xValue = new PermanentsOnBattlefieldCount(filter); + public ElvishGuidance(UUID ownerId, CardSetInfo setInfo) { super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{2}{G}"); this.subtype.add(SubType.AURA); @@ -41,10 +39,12 @@ public final class ElvishGuidance extends CardImpl { this.addAbility(ability); // Whenever enchanted land is tapped for mana, its controller adds {G} for each Elf on the battlefield. - this.addAbility(new ElvishGuidanceTriggeredAbility()); + this.addAbility(new EnchantedTappedTriggeredManaAbility(new DynamicManaEffect( + Mana.GreenMana(1), xValue + ).setText("its controller adds {G} for each Elf on the battlefield"))); } - public ElvishGuidance(final ElvishGuidance card) { + private ElvishGuidance(final ElvishGuidance card) { super(card); } @@ -53,42 +53,3 @@ public final class ElvishGuidance extends CardImpl { return new ElvishGuidance(this); } } - -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), xValue)); - } - - public ElvishGuidanceTriggeredAbility(final ElvishGuidanceTriggeredAbility ability) { - super(ability); - } - - @Override - public ElvishGuidanceTriggeredAbility copy() { - return new ElvishGuidanceTriggeredAbility(this); - } - - @Override - public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == GameEvent.EventType.TAPPED_FOR_MANA; - } - - @Override - public boolean checkTrigger(GameEvent event, Game game) { - Permanent enchantment = game.getPermanent(this.getSourceId()); - if (enchantment != null && event.getSourceId().equals(enchantment.getAttachedTo())) { - Permanent enchantedLand = game.getPermanentOrLKIBattlefield(enchantment.getAttachedTo()); - return enchantedLand != null && enchantedLand.isLand(); - } - return false; - } - - @Override - public String getRule() { - return "Whenever enchanted land is tapped for mana, its controller adds {G} for each Elf on the battlefield."; - } -} diff --git a/Mage.Sets/src/mage/cards/f/FertileGround.java b/Mage.Sets/src/mage/cards/f/FertileGround.java index fade3453ea..26cdef298a 100644 --- a/Mage.Sets/src/mage/cards/f/FertileGround.java +++ b/Mage.Sets/src/mage/cards/f/FertileGround.java @@ -1,28 +1,21 @@ - package mage.cards.f; -import java.util.UUID; import mage.abilities.Ability; -import mage.abilities.effects.mana.AddManaAnyColorAttachedControllerEffect; import mage.abilities.effects.common.AttachEffect; +import mage.abilities.effects.mana.AddManaAnyColorAttachedControllerEffect; import mage.abilities.keyword.EnchantAbility; -import mage.abilities.mana.TriggeredManaAbility; +import mage.abilities.mana.EnchantedTappedTriggeredManaAbility; import mage.cards.CardImpl; import mage.cards.CardSetInfo; import mage.constants.CardType; -import mage.constants.SubType; import mage.constants.Outcome; -import mage.constants.Zone; -import mage.game.Game; -import mage.game.events.GameEvent; -import mage.game.events.GameEvent.EventType; -import mage.game.permanent.Permanent; +import mage.constants.SubType; import mage.target.TargetPermanent; import mage.target.common.TargetLandPermanent; -import mage.target.targetpointer.FixedTarget; + +import java.util.UUID; /** - * * @author Plopman */ public final class FertileGround extends CardImpl { @@ -39,10 +32,10 @@ public final class FertileGround extends CardImpl { this.addAbility(ability); // Whenever enchanted land is tapped for mana, its controller adds one mana of any color. - this.addAbility(new FertileGroundTriggeredAbility()); + this.addAbility(new EnchantedTappedTriggeredManaAbility(new AddManaAnyColorAttachedControllerEffect())); } - public FertileGround(final FertileGround card) { + private FertileGround(final FertileGround card) { super(card); } @@ -51,42 +44,3 @@ public final class FertileGround extends CardImpl { return new FertileGround(this); } } - -class FertileGroundTriggeredAbility extends TriggeredManaAbility { - - public FertileGroundTriggeredAbility() { - super(Zone.BATTLEFIELD, new AddManaAnyColorAttachedControllerEffect()); - } - - public FertileGroundTriggeredAbility(FertileGroundTriggeredAbility ability) { - super(ability); - } - - @Override - public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == GameEvent.EventType.TAPPED_FOR_MANA; - } - - @Override - public boolean checkTrigger(GameEvent event, Game game) { - Permanent enchantment = game.getPermanent(this.getSourceId()); - if (enchantment != null && event.getSourceId().equals(enchantment.getAttachedTo())) { - Permanent enchantedLand = game.getPermanentOrLKIBattlefield(enchantment.getAttachedTo()); - if (enchantedLand != null && enchantedLand.isLand()) { - getEffects().get(0).setTargetPointer(new FixedTarget(enchantedLand.getControllerId())); - return true; - } - } - return false; - } - - @Override - public FertileGroundTriggeredAbility copy() { - return new FertileGroundTriggeredAbility(this); - } - - @Override - public String getRule() { - return "Whenever enchanted land is tapped for mana, its controller adds an additional one mana of any color."; - } -} diff --git a/Mage.Sets/src/mage/cards/g/GlitteringFrost.java b/Mage.Sets/src/mage/cards/g/GlitteringFrost.java new file mode 100644 index 0000000000..f414b428ef --- /dev/null +++ b/Mage.Sets/src/mage/cards/g/GlitteringFrost.java @@ -0,0 +1,53 @@ +package mage.cards.g; + +import mage.abilities.Ability; +import mage.abilities.common.SimpleStaticAbility; +import mage.abilities.effects.common.AttachEffect; +import mage.abilities.effects.common.continuous.AddCardSuperTypeAttachedEffect; +import mage.abilities.effects.mana.AddManaAnyColorAttachedControllerEffect; +import mage.abilities.keyword.EnchantAbility; +import mage.abilities.mana.EnchantedTappedTriggeredManaAbility; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.constants.*; +import mage.target.TargetPermanent; +import mage.target.common.TargetLandPermanent; + +import java.util.UUID; + +/** + * @author TheElk801 + */ +public final class GlitteringFrost extends CardImpl { + + public GlitteringFrost(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{2}{G}"); + + this.addSuperType(SuperType.SNOW); + this.subtype.add(SubType.AURA); + + // Enchant land + TargetPermanent auraTarget = new TargetLandPermanent(); + this.getSpellAbility().addTarget(auraTarget); + this.getSpellAbility().addEffect(new AttachEffect(Outcome.BoostCreature)); + Ability ability = new EnchantAbility(auraTarget.getTargetName()); + this.addAbility(ability); + + // Enchanted land is snow. + this.addAbility(new SimpleStaticAbility(new AddCardSuperTypeAttachedEffect( + SuperType.SNOW, Duration.WhileOnBattlefield, AttachmentType.AURA + ).setText("enchanted land is snow"))); + + // Whenever enchanted land is tapped for mana, its controller adds an additional one mana of any color. + this.addAbility(new EnchantedTappedTriggeredManaAbility(new AddManaAnyColorAttachedControllerEffect())); + } + + private GlitteringFrost(final GlitteringFrost card) { + super(card); + } + + @Override + public GlitteringFrost copy() { + return new GlitteringFrost(this); + } +} diff --git a/Mage.Sets/src/mage/cards/m/MarketFestival.java b/Mage.Sets/src/mage/cards/m/MarketFestival.java index 9324e6d6c3..cfeb8de355 100644 --- a/Mage.Sets/src/mage/cards/m/MarketFestival.java +++ b/Mage.Sets/src/mage/cards/m/MarketFestival.java @@ -5,17 +5,14 @@ import mage.abilities.Ability; import mage.abilities.effects.common.AttachEffect; import mage.abilities.effects.mana.ManaEffect; import mage.abilities.keyword.EnchantAbility; -import mage.abilities.mana.TriggeredManaAbility; +import mage.abilities.mana.EnchantedTappedTriggeredManaAbility; import mage.cards.CardImpl; import mage.cards.CardSetInfo; import mage.choices.ManaChoice; import mage.constants.CardType; import mage.constants.Outcome; import mage.constants.SubType; -import mage.constants.Zone; import mage.game.Game; -import mage.game.events.GameEvent; -import mage.game.events.GameEvent.EventType; import mage.game.permanent.Permanent; import mage.players.Player; import mage.target.TargetPermanent; @@ -42,10 +39,10 @@ public final class MarketFestival extends CardImpl { this.addAbility(ability); // Whenever enchanted land is tapped for mana, its controller adds two mana in any combination of colors (in addition to the mana the land produces). - this.addAbility(new MarketFestivalTriggeredAbility()); + this.addAbility(new EnchantedTappedTriggeredManaAbility(new MarketFestivalManaEffect())); } - public MarketFestival(final MarketFestival card) { + private MarketFestival(final MarketFestival card) { super(card); } @@ -55,50 +52,14 @@ public final class MarketFestival extends CardImpl { } } -class MarketFestivalTriggeredAbility extends TriggeredManaAbility { - - public MarketFestivalTriggeredAbility() { - super(Zone.BATTLEFIELD, new MarketFestivalManaEffect()); - } - - public MarketFestivalTriggeredAbility(final MarketFestivalTriggeredAbility ability) { - super(ability); - } - - @Override - public MarketFestivalTriggeredAbility copy() { - return new MarketFestivalTriggeredAbility(this); - } - - @Override - public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == GameEvent.EventType.TAPPED_FOR_MANA; - } - - @Override - public boolean checkTrigger(GameEvent event, Game game) { - Permanent enchantment = game.getPermanent(this.getSourceId()); - if (enchantment != null && event.getSourceId().equals(enchantment.getAttachedTo())) { - Permanent enchantedLand = game.getPermanentOrLKIBattlefield(enchantment.getAttachedTo()); - return enchantedLand != null && enchantedLand.isLand(); - } - return false; - } - - @Override - public String getRule() { - return "Whenever enchanted land is tapped for mana, its controller adds two mana in any combination of colors (in addition to the mana the land produces)."; - } -} - class MarketFestivalManaEffect extends ManaEffect { - public MarketFestivalManaEffect() { + MarketFestivalManaEffect() { super(); this.staticText = "its controller adds two mana in any combination of colors"; } - public MarketFestivalManaEffect(final MarketFestivalManaEffect effect) { + private MarketFestivalManaEffect(final MarketFestivalManaEffect effect) { super(effect); } diff --git a/Mage.Sets/src/mage/cards/o/Overgrowth.java b/Mage.Sets/src/mage/cards/o/Overgrowth.java index da03d53755..34d608737b 100644 --- a/Mage.Sets/src/mage/cards/o/Overgrowth.java +++ b/Mage.Sets/src/mage/cards/o/Overgrowth.java @@ -1,49 +1,44 @@ - package mage.cards.o; -import java.util.UUID; import mage.Mana; import mage.abilities.Ability; -import mage.abilities.effects.mana.AddManaToManaPoolTargetControllerEffect; import mage.abilities.effects.common.AttachEffect; +import mage.abilities.effects.mana.AddManaToManaPoolTargetControllerEffect; import mage.abilities.keyword.EnchantAbility; -import mage.abilities.mana.TriggeredManaAbility; +import mage.abilities.mana.EnchantedTappedTriggeredManaAbility; import mage.cards.CardImpl; import mage.cards.CardSetInfo; import mage.constants.CardType; -import mage.constants.SubType; import mage.constants.Outcome; -import mage.constants.Zone; -import mage.game.Game; -import mage.game.events.GameEvent; -import mage.game.events.GameEvent.EventType; -import mage.game.permanent.Permanent; +import mage.constants.SubType; import mage.target.TargetPermanent; import mage.target.common.TargetLandPermanent; -import mage.target.targetpointer.FixedTarget; + +import java.util.UUID; /** - * * @author Plopman */ public final class Overgrowth extends CardImpl { public Overgrowth(UUID ownerId, CardSetInfo setInfo) { - super(ownerId,setInfo,new CardType[]{CardType.ENCHANTMENT},"{2}{G}"); + super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{2}{G}"); this.subtype.add(SubType.AURA); - // Enchant land TargetPermanent auraTarget = new TargetLandPermanent(); this.getSpellAbility().addTarget(auraTarget); this.getSpellAbility().addEffect(new AttachEffect(Outcome.AddAbility)); Ability ability = new EnchantAbility(auraTarget.getTargetName()); this.addAbility(ability); + // Whenever enchanted land is tapped for mana, its controller adds {G}{G}. - this.addAbility(new OvergrowthTriggeredAbility()); + this.addAbility(new EnchantedTappedTriggeredManaAbility(new AddManaToManaPoolTargetControllerEffect( + Mana.GreenMana(2), "their" + ))); } - public Overgrowth(final Overgrowth card) { + private Overgrowth(final Overgrowth card) { super(card); } @@ -52,44 +47,3 @@ public final class Overgrowth extends CardImpl { return new Overgrowth(this); } } - -class OvergrowthTriggeredAbility extends TriggeredManaAbility { - - - public OvergrowthTriggeredAbility() { - super(Zone.BATTLEFIELD, new AddManaToManaPoolTargetControllerEffect(Mana.GreenMana(2), "their")); - } - - public OvergrowthTriggeredAbility(final OvergrowthTriggeredAbility ability) { - super(ability); - } - - @Override - public OvergrowthTriggeredAbility copy() { - return new OvergrowthTriggeredAbility(this); - } - - @Override - public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == GameEvent.EventType.TAPPED_FOR_MANA; - } - - @Override - public boolean checkTrigger(GameEvent event, Game game) { - Permanent enchantment = game.getPermanent(this.getSourceId()); - if (enchantment != null && event.getSourceId().equals(enchantment.getAttachedTo())) { - Permanent enchantedLand = game.getPermanentOrLKIBattlefield(enchantment.getAttachedTo()); - if (enchantedLand != null && enchantedLand.isLand()) { - getEffects().get(0).setTargetPointer(new FixedTarget(enchantedLand.getControllerId())); - return true; - } - } - return false; - } - - - @Override - public String getRule() { - return "Whenever enchanted land is tapped for mana, its controller adds {G}{G}"; - } -} diff --git a/Mage.Sets/src/mage/cards/t/TraceOfAbundance.java b/Mage.Sets/src/mage/cards/t/TraceOfAbundance.java index cbf82496d2..2fac89bfa6 100644 --- a/Mage.Sets/src/mage/cards/t/TraceOfAbundance.java +++ b/Mage.Sets/src/mage/cards/t/TraceOfAbundance.java @@ -1,4 +1,3 @@ - package mage.cards.t; import mage.abilities.Ability; @@ -8,14 +7,10 @@ import mage.abilities.effects.common.continuous.GainAbilityAttachedEffect; import mage.abilities.effects.mana.AddManaAnyColorAttachedControllerEffect; import mage.abilities.keyword.EnchantAbility; import mage.abilities.keyword.ShroudAbility; -import mage.abilities.mana.TriggeredManaAbility; +import mage.abilities.mana.EnchantedTappedTriggeredManaAbility; import mage.cards.CardImpl; import mage.cards.CardSetInfo; import mage.constants.*; -import mage.game.Game; -import mage.game.events.GameEvent; -import mage.game.events.GameEvent.EventType; -import mage.game.permanent.Permanent; import mage.target.TargetPermanent; import mage.target.common.TargetLandPermanent; @@ -26,8 +21,6 @@ import java.util.UUID; */ public final class TraceOfAbundance extends CardImpl { - private static final String rule = "Enchanted land has shroud"; - public TraceOfAbundance(UUID ownerId, CardSetInfo setInfo) { super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{R/W}{G}"); this.subtype.add(SubType.AURA); @@ -40,13 +33,16 @@ public final class TraceOfAbundance extends CardImpl { this.addAbility(ability); // Enchanted land has shroud. - this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new GainAbilityAttachedEffect(ShroudAbility.getInstance(), AttachmentType.AURA, Duration.WhileOnBattlefield, rule))); + this.addAbility(new SimpleStaticAbility(new GainAbilityAttachedEffect( + ShroudAbility.getInstance(), AttachmentType.AURA, + Duration.WhileOnBattlefield, "enchanted land has shroud" + ))); // Whenever enchanted land is tapped for mana, its controller adds one mana of any color. - this.addAbility(new TraceOfAbundanceTriggeredAbility()); + this.addAbility(new EnchantedTappedTriggeredManaAbility(new AddManaAnyColorAttachedControllerEffect())); } - public TraceOfAbundance(final TraceOfAbundance card) { + private TraceOfAbundance(final TraceOfAbundance card) { super(card); } @@ -55,39 +51,3 @@ public final class TraceOfAbundance extends CardImpl { return new TraceOfAbundance(this); } } - -class TraceOfAbundanceTriggeredAbility extends TriggeredManaAbility { - - public TraceOfAbundanceTriggeredAbility() { - super(Zone.BATTLEFIELD, new AddManaAnyColorAttachedControllerEffect()); - } - - public TraceOfAbundanceTriggeredAbility(final TraceOfAbundanceTriggeredAbility ability) { - super(ability); - } - - @Override - public TraceOfAbundanceTriggeredAbility copy() { - return new TraceOfAbundanceTriggeredAbility(this); - } - - @Override - public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == GameEvent.EventType.TAPPED_FOR_MANA; - } - - @Override - public boolean checkTrigger(GameEvent event, Game game) { - Permanent enchantment = game.getPermanent(this.getSourceId()); - if (enchantment != null && event.getSourceId().equals(enchantment.getAttachedTo())) { - Permanent enchantedLand = game.getPermanentOrLKIBattlefield(enchantment.getAttachedTo()); - return enchantedLand != null && enchantedLand.isLand(); - } - return false; - } - - @Override - public String getRule() { - return "Whenever enchanted land is tapped for mana, its controller adds one mana of any color."; - } -} diff --git a/Mage.Sets/src/mage/cards/u/UtopiaSprawl.java b/Mage.Sets/src/mage/cards/u/UtopiaSprawl.java index 4fd0e6aae3..102bb9f43d 100644 --- a/Mage.Sets/src/mage/cards/u/UtopiaSprawl.java +++ b/Mage.Sets/src/mage/cards/u/UtopiaSprawl.java @@ -8,6 +8,7 @@ import mage.abilities.effects.common.AttachEffect; import mage.abilities.effects.common.ChooseColorEffect; import mage.abilities.effects.mana.ManaEffect; import mage.abilities.keyword.EnchantAbility; +import mage.abilities.mana.EnchantedTappedTriggeredManaAbility; import mage.abilities.mana.TriggeredManaAbility; import mage.cards.CardImpl; import mage.cards.CardSetInfo; @@ -45,10 +46,10 @@ public final class UtopiaSprawl extends CardImpl { this.addAbility(new AsEntersBattlefieldAbility(new ChooseColorEffect(Outcome.Detriment))); // Whenever enchanted Forest is tapped for mana, its controller adds one mana of the chosen color. - this.addAbility(new UtopiaSprawlTriggeredAbility()); + this.addAbility(new EnchantedTappedTriggeredManaAbility(new UtopiaSprawlEffect(),"Forest")); } - public UtopiaSprawl(final UtopiaSprawl card) { + private UtopiaSprawl(final UtopiaSprawl card) { super(card); } @@ -57,47 +58,14 @@ public final class UtopiaSprawl extends CardImpl { return new UtopiaSprawl(this); } } - -class UtopiaSprawlTriggeredAbility extends TriggeredManaAbility { - - public UtopiaSprawlTriggeredAbility() { - super(Zone.BATTLEFIELD, new UtopiaSprawlEffect()); - } - - public UtopiaSprawlTriggeredAbility(UtopiaSprawlTriggeredAbility ability) { - super(ability); - } - - @Override - public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == GameEvent.EventType.TAPPED_FOR_MANA; - } - - @Override - public boolean checkTrigger(GameEvent event, Game game) { - Permanent enchantment = game.getPermanent(this.getSourceId()); - return enchantment != null && event.getSourceId().equals(enchantment.getAttachedTo()); - } - - @Override - public UtopiaSprawlTriggeredAbility copy() { - return new UtopiaSprawlTriggeredAbility(this); - } - - @Override - public String getRule() { - return "Whenever enchanted Forest is tapped for mana, its controller adds one mana of the chosen color."; - } -} - class UtopiaSprawlEffect extends ManaEffect { - public UtopiaSprawlEffect() { + UtopiaSprawlEffect() { super(); staticText = "its controller adds one mana of the chosen color"; } - public UtopiaSprawlEffect(final UtopiaSprawlEffect effect) { + private UtopiaSprawlEffect(final UtopiaSprawlEffect effect) { super(effect); } diff --git a/Mage.Sets/src/mage/cards/v/VerdantHaven.java b/Mage.Sets/src/mage/cards/v/VerdantHaven.java index e424840a9a..644dab718d 100644 --- a/Mage.Sets/src/mage/cards/v/VerdantHaven.java +++ b/Mage.Sets/src/mage/cards/v/VerdantHaven.java @@ -1,38 +1,32 @@ package mage.cards.v; -import java.util.UUID; import mage.abilities.Ability; import mage.abilities.common.EntersBattlefieldTriggeredAbility; -import mage.abilities.effects.mana.AddManaAnyColorAttachedControllerEffect; import mage.abilities.effects.common.AttachEffect; import mage.abilities.effects.common.GainLifeEffect; +import mage.abilities.effects.mana.AddManaAnyColorAttachedControllerEffect; import mage.abilities.keyword.EnchantAbility; -import mage.abilities.mana.TriggeredManaAbility; +import mage.abilities.mana.EnchantedTappedTriggeredManaAbility; import mage.cards.CardImpl; import mage.cards.CardSetInfo; import mage.constants.CardType; -import mage.constants.SubType; import mage.constants.Outcome; -import mage.constants.Zone; -import mage.game.Game; -import mage.game.events.GameEvent; -import mage.game.events.GameEvent.EventType; -import mage.game.permanent.Permanent; +import mage.constants.SubType; import mage.target.TargetPermanent; import mage.target.common.TargetLandPermanent; +import java.util.UUID; + /** - * * @author LevelX2 */ public final class VerdantHaven extends CardImpl { public VerdantHaven(UUID ownerId, CardSetInfo setInfo) { - super(ownerId,setInfo,new CardType[]{CardType.ENCHANTMENT},"{2}{G}"); + super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{2}{G}"); this.subtype.add(SubType.AURA); - // Enchant land TargetPermanent auraTarget = new TargetLandPermanent(); this.getSpellAbility().addTarget(auraTarget); @@ -44,10 +38,10 @@ public final class VerdantHaven extends CardImpl { this.addAbility(new EntersBattlefieldTriggeredAbility(new GainLifeEffect(2))); // Whenever enchanted land is tapped for mana, its controller adds one mana of any color. - this.addAbility(new VerdantHavenTriggeredAbility()); + this.addAbility(new EnchantedTappedTriggeredManaAbility(new AddManaAnyColorAttachedControllerEffect())); } - public VerdantHaven(final VerdantHaven card) { + private VerdantHaven(final VerdantHaven card) { super(card); } @@ -56,39 +50,3 @@ public final class VerdantHaven extends CardImpl { return new VerdantHaven(this); } } - -class VerdantHavenTriggeredAbility extends TriggeredManaAbility { - - public VerdantHavenTriggeredAbility() { - super(Zone.BATTLEFIELD, new AddManaAnyColorAttachedControllerEffect()); - } - - public VerdantHavenTriggeredAbility(final VerdantHavenTriggeredAbility ability) { - super(ability); - } - - @Override - public VerdantHavenTriggeredAbility copy() { - return new VerdantHavenTriggeredAbility(this); - } - - @Override - public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == GameEvent.EventType.TAPPED_FOR_MANA; - } - - @Override - public boolean checkTrigger(GameEvent event, Game game) { - Permanent enchantment = game.getPermanent(this.getSourceId()); - if (enchantment != null && event.getSourceId().equals(enchantment.getAttachedTo())) { - Permanent enchantedLand = game.getPermanentOrLKIBattlefield(enchantment.getAttachedTo()); - return enchantedLand != null && enchantedLand.isLand(); - } - return false; - } - - @Override - public String getRule() { - return "Whenever enchanted land is tapped for mana, its controller adds one mana of any color."; - } -} diff --git a/Mage.Sets/src/mage/cards/w/WildGrowth.java b/Mage.Sets/src/mage/cards/w/WildGrowth.java index 0f3638bcfd..d911066726 100644 --- a/Mage.Sets/src/mage/cards/w/WildGrowth.java +++ b/Mage.Sets/src/mage/cards/w/WildGrowth.java @@ -5,17 +5,15 @@ import mage.abilities.Ability; import mage.abilities.effects.common.AttachEffect; import mage.abilities.effects.mana.AddManaToManaPoolTargetControllerEffect; import mage.abilities.keyword.EnchantAbility; -import mage.abilities.mana.TriggeredManaAbility; +import mage.abilities.mana.EnchantedTappedTriggeredManaAbility; import mage.cards.CardImpl; import mage.cards.CardSetInfo; -import mage.constants.*; -import mage.game.Game; -import mage.game.events.GameEvent; -import mage.game.events.GameEvent.EventType; -import mage.game.permanent.Permanent; +import mage.constants.CardType; +import mage.constants.ColoredManaSymbol; +import mage.constants.Outcome; +import mage.constants.SubType; import mage.target.TargetPermanent; import mage.target.common.TargetLandPermanent; -import mage.target.targetpointer.FixedTarget; import java.util.UUID; @@ -36,7 +34,9 @@ public final class WildGrowth extends CardImpl { this.addAbility(ability); // Whenever enchanted land is tapped for mana, its controller adds {G}. - this.addAbility(new WildGrowthTriggeredAbility()); + this.addAbility(new EnchantedTappedTriggeredManaAbility( + new AddManaToManaPoolTargetControllerEffect(new Mana(ColoredManaSymbol.G), "their") + )); } private WildGrowth(final WildGrowth card) { @@ -48,44 +48,3 @@ public final class WildGrowth extends CardImpl { return new WildGrowth(this); } } - -class WildGrowthTriggeredAbility extends TriggeredManaAbility { - - - WildGrowthTriggeredAbility() { - super(Zone.BATTLEFIELD, new AddManaToManaPoolTargetControllerEffect(new Mana(ColoredManaSymbol.G), "their")); - } - - private WildGrowthTriggeredAbility(final WildGrowthTriggeredAbility ability) { - super(ability); - } - - @Override - public WildGrowthTriggeredAbility copy() { - return new WildGrowthTriggeredAbility(this); - } - - @Override - public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == GameEvent.EventType.TAPPED_FOR_MANA; - } - - @Override - public boolean checkTrigger(GameEvent event, Game game) { - Permanent enchantment = game.getPermanent(this.getSourceId()); - if (enchantment != null && event.getSourceId().equals(enchantment.getAttachedTo())) { - Permanent enchantedLand = game.getPermanentOrLKIBattlefield(enchantment.getAttachedTo()); - if (enchantedLand != null && enchantedLand.isLand()) { - this.getEffects().setTargetPointer(new FixedTarget(enchantedLand.getControllerId())); - return true; - } - } - return false; - } - - - @Override - public String getRule() { - return "Whenever enchanted land is tapped for mana, its controller adds an additional {G}"; - } -} diff --git a/Mage.Sets/src/mage/cards/w/WolfwillowHaven.java b/Mage.Sets/src/mage/cards/w/WolfwillowHaven.java index da2bba18f2..29d02cd511 100644 --- a/Mage.Sets/src/mage/cards/w/WolfwillowHaven.java +++ b/Mage.Sets/src/mage/cards/w/WolfwillowHaven.java @@ -11,17 +11,13 @@ import mage.abilities.effects.common.CreateTokenEffect; import mage.abilities.effects.mana.AddManaToManaPoolTargetControllerEffect; import mage.abilities.hint.common.MyTurnHint; import mage.abilities.keyword.EnchantAbility; -import mage.abilities.mana.TriggeredManaAbility; +import mage.abilities.mana.EnchantedTappedTriggeredManaAbility; import mage.cards.CardImpl; import mage.cards.CardSetInfo; import mage.constants.*; -import mage.game.Game; -import mage.game.events.GameEvent; -import mage.game.permanent.Permanent; import mage.game.permanent.token.WolfToken; import mage.target.TargetPermanent; import mage.target.common.TargetLandPermanent; -import mage.target.targetpointer.FixedTarget; import java.util.UUID; @@ -43,7 +39,9 @@ public final class WolfwillowHaven extends CardImpl { this.addAbility(ability); // Whenever enchanted land is tapped for mana, its controller adds an additional {G}. - this.addAbility(new WolfwillowHavenTriggeredAbility()); + this.addAbility(new EnchantedTappedTriggeredManaAbility(new AddManaToManaPoolTargetControllerEffect( + new Mana(ColoredManaSymbol.G), "their" + ))); // {4}{G}, Sacrifice Wolfwillow Haven: Create a 2/2 green Wolf creature token. Activate this ability only during your turn. ability = new ActivateIfConditionActivatedAbility( @@ -64,43 +62,3 @@ public final class WolfwillowHaven extends CardImpl { return new WolfwillowHaven(this); } } - -class WolfwillowHavenTriggeredAbility extends TriggeredManaAbility { - - WolfwillowHavenTriggeredAbility() { - super(Zone.BATTLEFIELD, new AddManaToManaPoolTargetControllerEffect(new Mana(ColoredManaSymbol.G), "their")); - } - - private WolfwillowHavenTriggeredAbility(final WolfwillowHavenTriggeredAbility ability) { - super(ability); - } - - @Override - public WolfwillowHavenTriggeredAbility copy() { - return new WolfwillowHavenTriggeredAbility(this); - } - - @Override - public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == GameEvent.EventType.TAPPED_FOR_MANA; - } - - @Override - public boolean checkTrigger(GameEvent event, Game game) { - Permanent enchantment = game.getPermanent(this.getSourceId()); - if (enchantment != null && event.getSourceId().equals(enchantment.getAttachedTo())) { - Permanent enchantedLand = game.getPermanentOrLKIBattlefield(enchantment.getAttachedTo()); - if (enchantedLand != null && enchantedLand.isLand()) { - getEffects().setTargetPointer(new FixedTarget(enchantedLand.getControllerId())); - return true; - } - } - return false; - } - - - @Override - public String getRule() { - return "Whenever enchanted land is tapped for mana, its controller adds an additional {G}."; - } -} diff --git a/Mage.Sets/src/mage/sets/Kaldheim.java b/Mage.Sets/src/mage/sets/Kaldheim.java index 14faa06c4e..07c1ee4cd9 100644 --- a/Mage.Sets/src/mage/sets/Kaldheim.java +++ b/Mage.Sets/src/mage/sets/Kaldheim.java @@ -100,6 +100,7 @@ public final class Kaldheim extends ExpansionSet { cards.add(new SetCardInfo("Gilded Assault Cart", 390, Rarity.UNCOMMON, mage.cards.g.GildedAssaultCart.class)); cards.add(new SetCardInfo("Glacial Floodplain", 257, Rarity.COMMON, mage.cards.g.GlacialFloodplain.class)); cards.add(new SetCardInfo("Gladewalker Ritualist", 392, Rarity.UNCOMMON, mage.cards.g.GladewalkerRitualist.class)); + cards.add(new SetCardInfo("Glittering Frost", 171, Rarity.COMMON, mage.cards.g.GlitteringFrost.class)); cards.add(new SetCardInfo("Gods' Hall Guardian", 13, Rarity.COMMON, mage.cards.g.GodsHallGuardian.class)); cards.add(new SetCardInfo("Goldspan Dragon", 139, Rarity.MYTHIC, mage.cards.g.GoldspanDragon.class)); cards.add(new SetCardInfo("Grim Draugr", 96, Rarity.COMMON, mage.cards.g.GrimDraugr.class)); diff --git a/Mage/src/main/java/mage/abilities/effects/mana/ManaEffect.java b/Mage/src/main/java/mage/abilities/effects/mana/ManaEffect.java index 54403eb293..2d0b493b30 100644 --- a/Mage/src/main/java/mage/abilities/effects/mana/ManaEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/mana/ManaEffect.java @@ -2,8 +2,10 @@ package mage.abilities.effects.mana; import mage.Mana; import mage.abilities.Ability; +import mage.abilities.TriggeredAbility; import mage.abilities.effects.OneShotEffect; import mage.constants.AbilityType; +import mage.constants.ManaType; import mage.constants.Outcome; import mage.game.Game; import mage.game.events.GameEvent; @@ -13,8 +15,6 @@ import mage.players.Player; import java.util.ArrayList; import java.util.List; import java.util.Set; -import mage.abilities.TriggeredAbility; -import mage.constants.ManaType; /** * @author BetaSteward_at_googlemail.com @@ -139,4 +139,10 @@ public abstract class ManaEffect extends OneShotEffect { } } } + + @Override + public ManaEffect setText(String staticText) { + super.setText(staticText); + return this; + } } diff --git a/Mage/src/main/java/mage/abilities/mana/EnchantedTappedTriggeredManaAbility.java b/Mage/src/main/java/mage/abilities/mana/EnchantedTappedTriggeredManaAbility.java new file mode 100644 index 0000000000..c76921cbd9 --- /dev/null +++ b/Mage/src/main/java/mage/abilities/mana/EnchantedTappedTriggeredManaAbility.java @@ -0,0 +1,55 @@ +package mage.abilities.mana; + +import mage.abilities.effects.mana.ManaEffect; +import mage.constants.Zone; +import mage.game.Game; +import mage.game.events.GameEvent; +import mage.game.permanent.Permanent; +import mage.target.targetpointer.FixedTarget; + +/** + * @author TheElk801 + */ +public class EnchantedTappedTriggeredManaAbility extends TriggeredManaAbility { + + private final String permName; + + public EnchantedTappedTriggeredManaAbility(ManaEffect manaEffect) { + this(manaEffect, "land"); + } + + public EnchantedTappedTriggeredManaAbility(ManaEffect manaEffect, String permName) { + super(Zone.BATTLEFIELD, manaEffect); + this.permName = permName; + } + + private EnchantedTappedTriggeredManaAbility(final EnchantedTappedTriggeredManaAbility ability) { + super(ability); + this.permName = ability.permName; + } + + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == GameEvent.EventType.TAPPED_FOR_MANA; + } + + @Override + public boolean checkTrigger(GameEvent event, Game game) { + Permanent enchantment = game.getPermanent(this.getSourceId()); + if (enchantment == null || !event.getSourceId().equals(enchantment.getAttachedTo())) { + return false; + } + this.getEffects().setTargetPointer(new FixedTarget(game.getControllerId(enchantment.getAttachedTo()))); + return true; + } + + @Override + public EnchantedTappedTriggeredManaAbility copy() { + return new EnchantedTappedTriggeredManaAbility(this); + } + + @Override + public String getRule() { + return "Whenever enchanted " + permName + " is tapped for mana, " + super.getRule(); + } +}