Some changes to rule text generation.

This commit is contained in:
LevelX2 2013-01-03 11:14:00 +01:00
parent fb3a9e3166
commit 6e25defa26
5 changed files with 17 additions and 11 deletions

View file

@ -29,10 +29,9 @@
package mage.sets.innistrad;
import java.util.UUID;
import mage.Constants;
import mage.Constants.CardType;
import mage.Constants.Rarity;
import mage.Constants.Zone;
import mage.MageInt;
import mage.abilities.TriggeredAbilityImpl;
import mage.abilities.costs.mana.ManaCostsImpl;
@ -77,7 +76,7 @@ public class MentorOfTheMeek extends CardImpl<MentorOfTheMeek> {
class MentorOfTheMeekAbility extends TriggeredAbilityImpl<MentorOfTheMeekAbility> {
public MentorOfTheMeekAbility() {
super(Constants.Zone.BATTLEFIELD, new DoIfCostPaid(new DrawCardControllerEffect(1), new ManaCostsImpl("{1}")), true);
super(Zone.BATTLEFIELD, new DoIfCostPaid(new DrawCardControllerEffect(1), new ManaCostsImpl("{1}")), true);
}
public MentorOfTheMeekAbility(final MentorOfTheMeekAbility ability) {
@ -93,9 +92,11 @@ class MentorOfTheMeekAbility extends TriggeredAbilityImpl<MentorOfTheMeekAbility
public boolean checkTrigger(GameEvent event, Game game) {
if (event.getType() == GameEvent.EventType.ZONE_CHANGE && !event.getTargetId().equals(this.getSourceId())) {
ZoneChangeEvent zEvent = (ZoneChangeEvent)event;
if (zEvent.getToZone() == Constants.Zone.BATTLEFIELD) {
if (zEvent.getToZone() == Zone.BATTLEFIELD) {
Permanent permanent = game.getPermanent(event.getTargetId());
if (permanent != null && permanent.getCardType().contains(CardType.CREATURE) && permanent.getControllerId().equals(this.getControllerId()) && permanent.getPower().getValue() <= 2) {
if (permanent != null && permanent.getCardType().contains(CardType.CREATURE)
&& permanent.getControllerId().equals(this.getControllerId())
&& permanent.getPower().getValue() <= 2) {
return true;
}
}
@ -105,7 +106,7 @@ class MentorOfTheMeekAbility extends TriggeredAbilityImpl<MentorOfTheMeekAbility
@Override
public String getRule() {
return "Whenever another creature with power 2 or less enters the battlefield under your control, you may pay {1}. If you do, draw a card.";
return new StringBuilder("Whenever another creature with power 2 or less enters the battlefield under your control, ").append(super.getRule()).toString();
}
}

View file

@ -37,11 +37,11 @@ import mage.target.common.TargetCardInHand;
public class DiscardCardCost extends DiscardTargetCost {
public DiscardCardCost() {
super(new TargetCardInHand(new FilterCard()), false);
this(false);
}
public DiscardCardCost(boolean randomDiscard) {
super(new TargetCardInHand(new FilterCard("a Card at random")), randomDiscard);
super(new TargetCardInHand(new FilterCard(randomDiscard ?"a card at random":"a card")), randomDiscard);
}
public DiscardCardCost(DiscardCardCost cost) {

View file

@ -42,7 +42,12 @@ public class DoIfCostPaid extends OneShotEffect<DoIfCostPaid> {
@Override
public String getText(Mode mode) {
return "you may pay " + cost.getText() + ". If you do, " + executingEffect.getText(mode);
StringBuilder sb = new StringBuilder("you may ");
String costText = cost.getText();
if (costText.length() <7 || !costText.substring(0, 7).toLowerCase().equals("discard")) {
sb.append("pay ");
}
return sb.append(costText).append(". If you do, ").append(executingEffect.getText(mode)).toString();
}
@Override

View file

@ -22,7 +22,7 @@ public class ReturnToHandSpellEffect extends PostResolveEffect<ReturnToHandSpell
}
private ReturnToHandSpellEffect() {
staticText = "Return {this} into its owner's hand";
staticText = "Return {this} to its owner's hand";
}
public static ReturnToHandSpellEffect getInstance() {

View file

@ -44,7 +44,7 @@ public class SwitchPowerToughnessSourceEffect extends ContinuousEffectImpl<Switc
public SwitchPowerToughnessSourceEffect(Duration duration) {
super(duration, Layer.PTChangingEffects_7, SubLayer.SwitchPT_e, Outcome.BoostCreature);
staticText = "switch its power and toughness " + duration.toString();
staticText = "switch {this}'s power and toughness " + duration.toString();
}
public SwitchPowerToughnessSourceEffect(final SwitchPowerToughnessSourceEffect effect) {