From d218279b042152f54a7703f7465877eadf93a7a9 Mon Sep 17 00:00:00 2001 From: Jeff Date: Thu, 22 Jan 2015 18:27:05 -0600 Subject: [PATCH] - Finally got the time to fix Manaforge Cinder. Better late than never. --- .../mage/sets/shadowmoor/ManaforgeCinder.java | 64 ++++++++++++++++++- 1 file changed, 62 insertions(+), 2 deletions(-) diff --git a/Mage.Sets/src/mage/sets/shadowmoor/ManaforgeCinder.java b/Mage.Sets/src/mage/sets/shadowmoor/ManaforgeCinder.java index 52b766ce9b..46d33e9ab6 100644 --- a/Mage.Sets/src/mage/sets/shadowmoor/ManaforgeCinder.java +++ b/Mage.Sets/src/mage/sets/shadowmoor/ManaforgeCinder.java @@ -27,16 +27,24 @@ */ package mage.sets.shadowmoor; +import java.util.LinkedHashSet; +import java.util.Set; import java.util.UUID; import mage.MageInt; import mage.Mana; +import mage.abilities.Ability; import mage.abilities.common.LimitedTimesPerTurnActivatedAbility; import mage.abilities.costs.mana.ManaCostsImpl; -import mage.abilities.effects.common.BasicManaEffect; +import mage.abilities.effects.OneShotEffect; import mage.cards.CardImpl; +import mage.choices.Choice; +import mage.choices.ChoiceImpl; import mage.constants.CardType; +import mage.constants.Outcome; import mage.constants.Rarity; import mage.constants.Zone; +import mage.game.Game; +import mage.players.Player; /** * @@ -53,7 +61,7 @@ public class ManaforgeCinder extends CardImpl { this.toughness = new MageInt(1); // {1}: Add {B} or {R} to your mana pool. Activate this ability no more than three times each turn. - this.addAbility(new LimitedTimesPerTurnActivatedAbility(Zone.BATTLEFIELD, new BasicManaEffect(Mana.BlackMana), new ManaCostsImpl("{1}"), 3)); + this.addAbility(new LimitedTimesPerTurnActivatedAbility(Zone.BATTLEFIELD, new ManaforgeCinderManaEffect(), new ManaCostsImpl("{1}"), 3)); } @@ -66,3 +74,55 @@ public class ManaforgeCinder extends CardImpl { return new ManaforgeCinder(this); } } + + + +class ManaforgeCinderManaEffect extends OneShotEffect { + + public ManaforgeCinderManaEffect() { + super(Outcome.PutManaInPool); + this.staticText = "Add {B} or {R} to your mana pool"; + } + + public ManaforgeCinderManaEffect(final ManaforgeCinderManaEffect effect) { + super(effect); + } + + @Override + public ManaforgeCinderManaEffect copy() { + return new ManaforgeCinderManaEffect(this); + } + + @Override + public boolean apply(Game game, Ability source) { + Player controller = game.getPlayer(source.getControllerId()); + if (controller != null) { + Choice manaChoice = new ChoiceImpl(); + Set choices = new LinkedHashSet<>(); + choices.add("Black"); + choices.add("Red"); + manaChoice.setChoices(choices); + manaChoice.setMessage("Select black or red mana to add to your mana pool"); + Mana mana = new Mana(); + while (!controller.choose(Outcome.Benefit, manaChoice, game)) { + if (!controller.isInGame()) { + return false; + } + } + if (manaChoice.getChoice() == null) { + return false; + } + switch (manaChoice.getChoice()) { + case "Black": + mana.addBlack(); + break; + case "Red": + mana.addRed(); + break; + } + controller.getManaPool().addMana(mana, game, source); + return true; + } + return false; + } +}