JW-CardUpdates: Updated Rhystic Cave to announce color choice first before the decision to pay occurs. Made suggested modifications for Talon of Pain

This commit is contained in:
Jerek Wilson 2017-10-23 22:44:40 -04:00
parent 8f49988bbf
commit 250f6ee1c1
2 changed files with 33 additions and 50 deletions

View file

@ -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;
}

View file

@ -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();
}
}
}