text fixes

This commit is contained in:
Evan Kranzler 2021-04-22 08:41:54 -04:00
parent d37b760167
commit f7340a946e
10 changed files with 42 additions and 64 deletions

View file

@ -47,7 +47,7 @@ class EnduringIdealEffect extends OneShotEffect {
public EnduringIdealEffect() {
super(Outcome.Benefit);
staticText = "Search your library for an enchantment card and put it onto the battlefield. Then shuffle";
staticText = "Search your library for an enchantment card, put it onto the battlefield, then shuffle";
}
public EnduringIdealEffect(final EnduringIdealEffect effect) {

View file

@ -72,7 +72,7 @@ class LinSivviDefiantHeroEffect extends OneShotEffect {
public LinSivviDefiantHeroEffect() {
super(Outcome.DrawCard);
this.staticText = "Search your library for a Rebel permanent card with mana value X or less and put it onto the battlefield. Then shuffle";
this.staticText = "Search your library for a Rebel permanent card with mana value X or less, put it onto the battlefield, then shuffle";
}
public LinSivviDefiantHeroEffect(final LinSivviDefiantHeroEffect effect) {

View file

@ -8,6 +8,7 @@ import mage.game.Game;
import mage.game.events.GameEvent;
import mage.game.permanent.Permanent;
import mage.target.targetpointer.FixedTarget;
import mage.util.CardUtil;
/**
* @author noxx
@ -75,17 +76,6 @@ public class AttacksCreatureYouControlTriggeredAbility extends TriggeredAbilityI
@Override
public String getRule() {
String an;
String who = filter.getMessage();
if (who.startsWith("another") || who.startsWith("a ")) {
an = "";
} else if (who.length() > 0 && "aeiou".contains(who.charAt(0) + "")) {
an = "an ";
} else {
an = "a ";
}
return "When" + (once ? "" : "ever")
+ " " + an + who + " attacks, " + super.getRule();
return "When" + (once ? "" : "ever") + " " + CardUtil.addArticle(filter.getMessage()) + " attacks, " + super.getRule();
}
}

View file

@ -27,15 +27,7 @@ public class SacrificeTargetCost extends CostImpl {
this.addTarget(target);
target.setNotTarget(true); // sacrifice is never targeted
target.setRequired(false); // can be canceled
this.text = "sacrifice "
+ ((target.getNumberOfTargets() != 1
|| (target.getTargetName().startsWith("an")
|| target.getTargetName().startsWith("a ")))
? (target.getMinNumberOfTargets() == target.getMaxNumberOfTargets()
&& target.getMinNumberOfTargets() > 1
? CardUtil.numberToText(target.getNumberOfTargets()) + " " : "")
: (target.getTargetName().startsWith("artifact") ? "an " : "a "))
+ target.getTargetName();
this.text = "sacrifice " + makeText(target);
target.setTargetName(target.getTargetName() + " (to sacrifice)");
}
@ -106,4 +98,14 @@ public class SacrificeTargetCost extends CostImpl {
public List<Permanent> getPermanents() {
return permanents;
}
private static final String makeText(TargetControlledPermanent target) {
if (target.getMinNumberOfTargets() != target.getMaxNumberOfTargets()) {
return target.getTargetName();
}
if (target.getNumberOfTargets() == 1) {
return CardUtil.addArticle(target.getTargetName());
}
return CardUtil.numberToText(target.getNumberOfTargets()) + ' ' + target.getTargetName();
}
}

View file

@ -24,11 +24,9 @@ public class TapTargetCost extends CostImpl {
this.target = target;
this.target.setNotTarget(true); // costs are never targeted
this.target.setRequired(false); // can be cancel by user
this.text
= new StringBuilder("tap ")
.append((target.getTargetName().startsWith("a ") || target.getTargetName().startsWith("an ") || target.getTargetName().startsWith("another"))
? "" : CardUtil.numberToText(target.getMaxNumberOfTargets()) + ' ')
.append(target.getTargetName()).toString();
this.text = "tap " + (target.getNumberOfTargets() > 1
? CardUtil.numberToText(target.getMaxNumberOfTargets()) + ' ' + target.getTargetName()
: CardUtil.addArticle(target.getTargetName()));
}
public TapTargetCost(final TapTargetCost cost) {

View file

@ -82,19 +82,16 @@ public class SacrificeOpponentsEffect extends OneShotEffect {
private void setText() {
StringBuilder sb = new StringBuilder();
sb.append("each opponent sacrifices ");
if (amount.toString().equals("X")) {
sb.append(amount.toString()).append(' ');
} else {
if (amount.toString().equals("1")) {
if (!filter.getMessage().startsWith("a ") && !filter.getMessage().startsWith("an ")) {
sb.append("a ");
}
} else {
sb.append(CardUtil.numberToText(amount.toString())).append(' ');
}
switch (amount.toString()) {
case "X":
sb.append(amount.toString()).append(' ');
break;
case "1":
sb.append(CardUtil.addArticle(filter.getMessage()));
break;
default:
sb.append(CardUtil.numberToText(amount.toString())).append(' ').append(filter.getMessage());
}
sb.append(filter.getMessage());
staticText = sb.toString();
}
}

View file

@ -16,6 +16,7 @@ import mage.game.Game;
import mage.players.Player;
import mage.target.TargetCard;
import mage.util.CardUtil;
import java.util.List;
import java.util.UUID;
@ -72,8 +73,8 @@ public class DiscardCardYouChooseTargetEffect extends OneShotEffect {
this(StaticValue.get(1), filter, targetController);
}
public DiscardCardYouChooseTargetEffect(DynamicValue numberCardsToDiscard,
FilterCard filter, TargetController targetController) {
public DiscardCardYouChooseTargetEffect(DynamicValue numberCardsToDiscard,
FilterCard filter, TargetController targetController) {
super(Outcome.Discard);
this.targetController = targetController;
this.filter = filter;
@ -111,7 +112,7 @@ public class DiscardCardYouChooseTargetEffect extends OneShotEffect {
Cards revealedCards = new CardsImpl();
numberToReveal = Math.min(player.getHand().size(), numberToReveal);
if (player.getHand().size() > numberToReveal) {
TargetCard chosenCards = new TargetCard(numberToReveal, numberToReveal,
TargetCard chosenCards = new TargetCard(numberToReveal, numberToReveal,
Zone.HAND, new FilterCard("card in " + player.getName() + "'s hand"));
chosenCards.setNotTarget(true);
if (chosenCards.canChoose(source.getSourceId(), player.getId(), game)
@ -131,7 +132,7 @@ public class DiscardCardYouChooseTargetEffect extends OneShotEffect {
}
Card sourceCard = game.getCard(source.getSourceId());
player.revealCards(sourceCard != null ? sourceCard.getIdName() + " ("
player.revealCards(sourceCard != null ? sourceCard.getIdName() + " ("
+ sourceCard.getZoneChangeCounter(game) + ')' : "Discard", revealedCards, game);
boolean result = true;
@ -144,7 +145,7 @@ public class DiscardCardYouChooseTargetEffect extends OneShotEffect {
if (!controller.choose(Outcome.Benefit, revealedCards, target, game)) {
return result;
}
result=!player.discard(new CardsImpl(target.getTargets()),false, source,game).isEmpty();
result = !player.discard(new CardsImpl(target.getTargets()), false, source, game).isEmpty();
return result;
}
@ -180,13 +181,10 @@ public class DiscardCardYouChooseTargetEffect extends OneShotEffect {
sb.append(". You choose ");
boolean discardMultipleCards = !numberCardsToDiscard.toString().equals("1");
if (discardMultipleCards) {
sb.append(numberCardsToDiscard).append(' ');
sb.append(numberCardsToDiscard).append(' ').append(filter.getMessage());
} else {
if (!filter.getMessage().startsWith("a ") && !filter.getMessage().startsWith("an ")) {
sb.append("a ");
}
sb.append(CardUtil.addArticle(filter.getMessage()));
}
sb.append(filter.getMessage());
if (revealAllCards) {
sb.append(" from it.");
} else {

View file

@ -88,8 +88,7 @@ public class SearchLibraryPutInPlayEffect extends SearchEffect {
sb.append(forceShuffle ? ", " : " and ");
sb.append("put them onto the battlefield");
} else {
sb.append(target.getTargetName().startsWith("a ") || target.getTargetName().startsWith("an ") ? "" : "a ")
.append(target.getTargetName());
sb.append(CardUtil.addArticle(target.getTargetName()));
sb.append(forceShuffle ? ", " : " and ");
sb.append("put it onto the battlefield");
}

View file

@ -8,9 +8,9 @@ import mage.constants.Outcome;
import mage.constants.Zone;
import mage.game.Game;
import mage.game.events.GameEvent;
import mage.game.events.GameEvent.EventType;
import mage.game.events.TargetEvent;
import mage.players.Player;
import mage.util.CardUtil;
import mage.util.RandomUtil;
import java.util.*;
@ -113,19 +113,10 @@ public abstract class TargetImpl implements Target {
sb.append(suffix);
return sb.toString();
}
if (targetName.startsWith("another")
|| targetName.startsWith("a ")
|| targetName.startsWith("an ")
|| targetName.startsWith("any ")) {
return "Select " + targetName + suffix;
}
if (getMinNumberOfTargets() == 0 && getMaxNumberOfTargets() == 1) {
return "Select up to one " + targetName + suffix;
}
if (targetName.startsWith("a") || targetName.startsWith("e") || targetName.startsWith("i") || targetName.startsWith("o") || targetName.startsWith("u")) {
return "Select an " + targetName + suffix;
}
return "Select a " + targetName + suffix;
return "Select " + CardUtil.addArticle(targetName) + suffix;
}
@Override

View file

@ -912,7 +912,10 @@ public final class CardUtil {
}
public static String addArticle(String text) {
if (text.startsWith("a ") || text.startsWith("an ")) {
if (text.startsWith("a ")
|| text.startsWith("an ")
|| text.startsWith("another ")
|| text.startsWith("any ")) {
return text;
}
return "aeiou".contains("" + text.charAt(0)) ? "an " + text : "a " + text;