From 250f6ee1c10721b252cd88b0aa560ed96150b2ae Mon Sep 17 00:00:00 2001 From: Jerek Wilson Date: Mon, 23 Oct 2017 22:44:40 -0400 Subject: [PATCH] JW-CardUpdates: Updated Rhystic Cave to announce color choice first before the decision to pay occurs. Made suggested modifications for Talon of Pain --- Mage.Sets/src/mage/cards/r/RhysticCave.java | 46 ++++++++++++--------- Mage.Sets/src/mage/cards/t/TalonOfPain.java | 37 ++++------------- 2 files changed, 33 insertions(+), 50 deletions(-) diff --git a/Mage.Sets/src/mage/cards/r/RhysticCave.java b/Mage.Sets/src/mage/cards/r/RhysticCave.java index d03d504477..88362d5905 100644 --- a/Mage.Sets/src/mage/cards/r/RhysticCave.java +++ b/Mage.Sets/src/mage/cards/r/RhysticCave.java @@ -28,13 +28,16 @@ package mage.cards.r; import java.util.UUID; +import mage.MageObject; import mage.Mana; +import mage.ObjectColor; import mage.abilities.Ability; import mage.abilities.common.SimpleActivatedAbility; import mage.abilities.costs.common.TapSourceCost; import mage.abilities.costs.mana.GenericManaCost; import mage.abilities.costs.mana.ManaCostsImpl; import mage.abilities.effects.Effect; +import mage.abilities.effects.common.ChooseColorEffect; import mage.abilities.effects.common.DoUnlessAnyPlayerPaysEffect; import mage.abilities.effects.common.ManaEffect; import mage.abilities.effects.common.continuous.BoostSourceEffect; @@ -43,6 +46,7 @@ import mage.cards.CardSetInfo; import mage.choices.ChoiceColor; import mage.constants.CardType; import mage.constants.Duration; +import mage.constants.Outcome; import mage.constants.Zone; import mage.game.Game; import mage.game.permanent.Permanent; @@ -57,11 +61,15 @@ public class RhysticCave extends CardImpl { public RhysticCave(UUID ownerId, CardSetInfo setInfo) { super(ownerId, setInfo, new CardType[]{CardType.LAND}, ""); - // {tap}: Choose a color. Add one mana of that color to your mana pool unless any player pays {1}. - // Activate this ability only any time you could cast an instant. - this.addAbility(new SimpleActivatedAbility(Zone.BATTLEFIELD, - new DoUnlessAnyPlayerPaysEffect(new RhysticCaveManaEffect(),new GenericManaCost(1)), - new TapSourceCost())); + // {tap}: Choose a color. + Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, + new ChooseColorEffect(Outcome.PutManaInPool), + new TapSourceCost()); + + // Add one mana of that color to your mana pool unless any player pays {1}. Activate this ability only any time you could cast an instant. + ability.addEffect(new DoUnlessAnyPlayerPaysEffect(new RhysticCaveManaEffect(),new GenericManaCost(1))); + + this.addAbility(ability); } @@ -82,7 +90,7 @@ public class RhysticCave extends CardImpl { public RhysticCaveManaEffect() { super(); chosenMana = new Mana(); - this.staticText = "Choose a color. Add one mana of that color to your mana pool "; + this.staticText = "Add one mana of that color to your mana pool "; } public RhysticCaveManaEffect(final RhysticCaveManaEffect effect) { @@ -97,29 +105,27 @@ public class RhysticCave extends CardImpl { @Override public boolean apply(Game game, Ability source) { - Player controller = game.getPlayer(source.getControllerId()); - - if (controller != null) { - ChoiceColor choice = new ChoiceColor(); - choice.setMessage("Choose a color to add mana of that color"); - - if (controller.choose(outcome, choice, game)) { - if (choice.getChoice() != null) { - String color = choice.getChoice(); + Player controller = game.getPlayer(source.getControllerId()); + MageObject mageObject = game.getPermanentOrLKIBattlefield(source.getSourceId()); //get obj reference to Rhystic Cave + if (controller != null) { + if (mageObject != null) { + ObjectColor choice = (ObjectColor) game.getState().getValue(mageObject.getId()+"_color"); + if (choice!= null) { + String color = choice.toString(); switch (color) { - case "Red": + case "R": chosenMana.setRed(1); break; - case "Blue": + case "U": chosenMana.setBlue(1); break; - case "White": + case "W": chosenMana.setWhite(1); break; - case "Black": + case "B": chosenMana.setBlack(1); break; - case "Green": + case "G": chosenMana.setGreen(1); break; } diff --git a/Mage.Sets/src/mage/cards/t/TalonOfPain.java b/Mage.Sets/src/mage/cards/t/TalonOfPain.java index b00e019e05..6cdcfb3dc6 100644 --- a/Mage.Sets/src/mage/cards/t/TalonOfPain.java +++ b/Mage.Sets/src/mage/cards/t/TalonOfPain.java @@ -38,6 +38,7 @@ import mage.abilities.costs.mana.ManaCostsImpl; import mage.abilities.dynamicvalue.common.ManacostVariableValue; import mage.abilities.effects.OneShotEffect; import mage.abilities.effects.common.DamageTargetEffect; +import mage.abilities.effects.common.counter.AddCountersSourceEffect; import mage.cards.CardImpl; import mage.cards.CardSetInfo; import mage.constants.CardType; @@ -47,6 +48,7 @@ import mage.counters.CounterType; import mage.game.Game; import mage.game.events.GameEvent; import mage.game.permanent.Permanent; +import mage.players.Player; import mage.target.common.TargetCreatureOrPlayer; /** @@ -88,7 +90,7 @@ public class TalonOfPain extends CardImpl { private class TalonOfPainTriggeredAbility extends TriggeredAbilityImpl { public TalonOfPainTriggeredAbility() { - super(Zone.BATTLEFIELD, new TalonOfPainEffect()); + super(Zone.BATTLEFIELD, new AddCountersSourceEffect(CounterType.CHARGE.createInstance())); } public TalonOfPainTriggeredAbility(final TalonOfPainTriggeredAbility ability) { @@ -108,7 +110,9 @@ public class TalonOfPain extends CardImpl { @Override public boolean checkTrigger(GameEvent event, Game game) { // to another player - if (!Objects.equals(this.getControllerId(), event.getTargetId())) { + Player controller = game.getPlayer(this.getControllerId()); + if(controller==null){return false;} + if(controller.hasOpponent(event.getTargetId(),game)){ // a source you control other than Talon of Pain UUID sourceControllerId = game.getControllerId(event.getSourceId()); if (sourceControllerId != null @@ -123,34 +127,7 @@ public class TalonOfPain extends CardImpl { @Override public String getRule() { - return "Whenever a source you control other than {this} deals damage to another player, " + super.getRule(); - } - } - - private static class TalonOfPainEffect extends OneShotEffect { - - public TalonOfPainEffect() { - super(Outcome.Damage); - this.staticText = "put a charge counter on {this}."; - } - - public TalonOfPainEffect(final TalonOfPainEffect effect) { - super(effect); - } - - @Override - public TalonOfPainEffect copy() { - return new TalonOfPainEffect(this); - } - - @Override - public boolean apply(Game game, Ability source) { - Permanent permanent = game.getPermanent(source.getSourceId()); - if (permanent != null) { - permanent.addCounters(CounterType.CHARGE.createInstance(), source, game); - return true; - } - return false; + return "Whenever a source you control other than {this} deals damage to an opponent, " + super.getRule(); } } }