diff --git a/Mage.Sets/src/mage/cards/f/ForagingWickermaw.java b/Mage.Sets/src/mage/cards/f/ForagingWickermaw.java new file mode 100644 index 00000000000..c25538b899f --- /dev/null +++ b/Mage.Sets/src/mage/cards/f/ForagingWickermaw.java @@ -0,0 +1,102 @@ +package mage.cards.f; + +import mage.MageInt; +import mage.Mana; +import mage.ObjectColor; +import mage.abilities.Ability; +import mage.abilities.common.EntersBattlefieldTriggeredAbility; +import mage.abilities.costs.mana.GenericManaCost; +import mage.abilities.effects.common.continuous.BecomesColorTargetEffect; +import mage.abilities.effects.keyword.SurveilEffect; +import mage.abilities.effects.mana.AddManaOfAnyColorEffect; +import mage.abilities.mana.LimitedTimesPerTurnActivatedManaAbility; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.choices.ChoiceColor; +import mage.constants.CardType; +import mage.constants.Duration; +import mage.constants.SubType; +import mage.constants.Zone; +import mage.game.Game; +import mage.game.permanent.Permanent; +import mage.players.Player; +import mage.target.targetpointer.FixedTarget; + +import java.util.UUID; + +/** + * @author xenohedron + */ +public final class ForagingWickermaw extends CardImpl { + + public ForagingWickermaw(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.ARTIFACT, CardType.CREATURE}, "{2}"); + + this.subtype.add(SubType.SCARECROW); + this.power = new MageInt(1); + this.toughness = new MageInt(3); + + // When this creature enters, surveil 1. + this.addAbility(new EntersBattlefieldTriggeredAbility(new SurveilEffect(1))); + + // {1}: Add one mana of any color. This creature becomes that color until end of turn. Activate only once each turn. + this.addAbility(new LimitedTimesPerTurnActivatedManaAbility( + Zone.BATTLEFIELD, + new ForagingWickermawManaEffect(), + new GenericManaCost(1) + )); + + } + + private ForagingWickermaw(final ForagingWickermaw card) { + super(card); + } + + @Override + public ForagingWickermaw copy() { + return new ForagingWickermaw(this); + } +} + +class ForagingWickermawManaEffect extends AddManaOfAnyColorEffect { + + ForagingWickermawManaEffect() { + super(1); + this.staticText = "Add one mana of any color. {this} becomes that color until end of turn"; + } + + private ForagingWickermawManaEffect(final ForagingWickermawManaEffect effect) { + super(effect); + } + + @Override + public ForagingWickermawManaEffect copy() { + return new ForagingWickermawManaEffect(this); + } + + @Override + public Mana produceMana(Game game, Ability source) { + if (game != null) { + Player controller = game.getPlayer(source.getControllerId()); + if (controller != null) { + String mes = String.format("Select a color of mana to add %d of it", this.amount); + ChoiceColor choice = new ChoiceColor(true, mes, game.getObject(source)); + if (controller.choose(outcome, choice, game)) { + ObjectColor color = choice.getColor(); + if (color != null) { + Permanent permanent = source.getSourcePermanentIfItStillExists(game); + if (permanent != null) { + game.addEffect(new BecomesColorTargetEffect(color, false, Duration.EndOfTurn) + .setTargetPointer(new FixedTarget(permanent, game)), source); + } + Mana mana = choice.getMana(amount); + mana.setFlag(setFlag); + return mana; + } + } + } + } + return new Mana(); + } + +} diff --git a/Mage.Sets/src/mage/sets/LorwynEclipsed.java b/Mage.Sets/src/mage/sets/LorwynEclipsed.java index 8daea66e9d1..c7200ea58b2 100644 --- a/Mage.Sets/src/mage/sets/LorwynEclipsed.java +++ b/Mage.Sets/src/mage/sets/LorwynEclipsed.java @@ -165,6 +165,7 @@ public final class LorwynEclipsed extends ExpansionSet { cards.add(new SetCardInfo("Flitterwing Nuisance", 304, Rarity.RARE, mage.cards.f.FlitterwingNuisance.class, NON_FULL_USE_VARIOUS)); cards.add(new SetCardInfo("Flitterwing Nuisance", 48, Rarity.RARE, mage.cards.f.FlitterwingNuisance.class, NON_FULL_USE_VARIOUS)); cards.add(new SetCardInfo("Flock Impostor", 16, Rarity.UNCOMMON, mage.cards.f.FlockImpostor.class)); + cards.add(new SetCardInfo("Foraging Wickermaw", 256, Rarity.COMMON, mage.cards.f.ForagingWickermaw.class)); cards.add(new SetCardInfo("Forest", 273, Rarity.LAND, mage.cards.basiclands.Forest.class, NON_FULL_USE_VARIOUS)); cards.add(new SetCardInfo("Forest", 278, Rarity.LAND, mage.cards.basiclands.Forest.class, FULL_ART_BFZ_VARIOUS)); cards.add(new SetCardInfo("Forest", 283, Rarity.LAND, mage.cards.basiclands.Forest.class, FULL_ART_BFZ_VARIOUS));