text fixes and test fixes to fix how tests test text, then more text next

This commit is contained in:
Evan Kranzler 2017-10-07 16:08:06 -04:00
parent 14107b3d55
commit 54b8f10c3c
76 changed files with 247 additions and 227 deletions

View file

@ -61,6 +61,8 @@ public interface Abilities<T extends Ability> extends List<T>, Serializable {
*/
List<String> getRules(String source);
List<String> getRules(String source, boolean capitalize);
/**
* Retrieves all activated abilities for the given {@link Zone}.
*

View file

@ -69,6 +69,11 @@ public class AbilitiesImpl<T extends Ability> extends ArrayList<T> implements Ab
@Override
public List<String> getRules(String source) {
return getRules(source, true);
}
@Override
public List<String> getRules(String source, boolean capitalize) {
List<String> rules = new ArrayList<>();
for (T ability : this) {
@ -78,7 +83,9 @@ public class AbilitiesImpl<T extends Ability> extends ArrayList<T> implements Ab
if (!(ability instanceof SpellAbility || ability instanceof PlayLandAbility)) {
String rule = ability.getRule();
if (rule != null && rule.length() > 3) {
rule = Character.toUpperCase(rule.charAt(0)) + rule.substring(1);
if (capitalize) {
rule = Character.toUpperCase(rule.charAt(0)) + rule.substring(1);
}
if (ability.getRuleAtTheTop()) {
rules.add(0, rule);
} else {

View file

@ -31,7 +31,7 @@ public class CompoundAbility extends AbilitiesImpl<Ability> {
}
StringBuilder sb = new StringBuilder();
List<String> rules = super.getRules(null);
List<String> rules = super.getRules(null,false);
for (int index = 0; index < rules.size(); index++) {
if (index > 0) {
if (index < rules.size() - 1) {

View file

@ -25,7 +25,6 @@
* authors and should not be interpreted as representing official policies, either expressed
* or implied, of BetaSteward_at_googlemail.com.
*/
package mage.abilities.costs.common;
import mage.constants.Outcome;
@ -38,6 +37,7 @@ import mage.target.common.TargetControlledPermanent;
import java.util.List;
import java.util.UUID;
import mage.abilities.costs.Cost;
import mage.util.CardUtil;
/**
*
@ -49,7 +49,7 @@ public class UntapTargetCost extends CostImpl {
public UntapTargetCost(TargetControlledPermanent target) {
this.target = target;
this.text = "Untap " + target.getMaxNumberOfTargets() + ' ' + target.getTargetName();
this.text = "Untap " + CardUtil.numberToText(target.getMaxNumberOfTargets(), "") + ' ' + target.getTargetName();
}
public UntapTargetCost(final UntapTargetCost cost) {
@ -60,10 +60,11 @@ public class UntapTargetCost extends CostImpl {
@Override
public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana, Cost costToPay) {
if (target.choose(Outcome.Untap, controllerId, sourceId, game)) {
for (UUID targetId: (List<UUID>)target.getTargets()) {
for (UUID targetId : (List<UUID>) target.getTargets()) {
Permanent permanent = game.getPermanent(targetId);
if (permanent == null)
if (permanent == null) {
return false;
}
paid |= permanent.untap(game);
}
}
@ -80,5 +81,4 @@ public class UntapTargetCost extends CostImpl {
return new UntapTargetCost(this);
}
}

View file

@ -46,7 +46,7 @@ public class GetEmblemEffect extends OneShotEffect {
public GetEmblemEffect(Emblem emblem) {
super(Outcome.Benefit);
this.emblem = emblem;
this.staticText = "You get an emblem with \"" + +'"';
this.staticText = getText();
}
public GetEmblemEffect(final GetEmblemEffect effect) {
@ -74,7 +74,9 @@ public class GetEmblemEffect extends OneShotEffect {
sb.append("You get an emblem with \"");
List<String> rules = emblem.getAbilities().getRules(null);
if (rules.size() == 1) {
sb.append(rules.get(0));
for (String s : rules) {
sb.append(s);
}
sb.append('"');
} else if (rules.size() == 2) {
for (String s : rules) {
@ -83,7 +85,6 @@ public class GetEmblemEffect extends OneShotEffect {
}
sb.append('"');
}
sb.append('.');
return sb.toString();
}
}

View file

@ -264,9 +264,11 @@ public class LookLibraryAndPickControllerEffect extends LookLibraryControllerEff
sb.append(". You may reveal ");
sb.append(filter.getMessage()).append(" from among them and put it into your ");
} else if (targetPickedCards == Zone.BATTLEFIELD) {
sb.append(". You ");
sb.append(". ");
if (optional) {
sb.append("may ");
sb.append("You may p");
} else {
sb.append('P');
}
sb.append("put ").append(filter.getMessage()).append(" from among them onto the ");
} else {

View file

@ -63,7 +63,7 @@ public class CantBlockAttachedEffect extends RestrictionEffect {
sb.append(' ').append(filter.getMessage());
}
if (duration == EndOfTurn) {
sb.append("this turn");
sb.append(" this turn");
} else if (!duration.toString().isEmpty()) {
sb.append(' ').append(duration.toString());
}

View file

@ -25,7 +25,6 @@
* authors and should not be interpreted as representing official policies, either expressed
* or implied, of BetaSteward_at_googlemail.com.
*/
package mage.abilities.effects.common.continuous;
import mage.constants.Duration;
@ -116,21 +115,24 @@ public class BoostEquippedEffect extends ContinuousEffectImpl {
private void setText() {
StringBuilder sb = new StringBuilder();
sb.append("Equipped creature gets ");
sb.append("equipped creature gets ");
String p = power.toString();
if (!p.startsWith("-"))
if (!p.startsWith("-")) {
sb.append('+');
}
sb.append(p).append('/');
String t = toughness.toString();
if (!t.startsWith("-")) {
if (p.startsWith("-"))
if (p.startsWith("-")) {
sb.append('-');
else
} else {
sb.append('+');
}
}
sb.append(t);
if (duration != Duration.WhileOnBattlefield)
if (duration != Duration.WhileOnBattlefield) {
sb.append(' ').append(duration.toString());
}
String message = power.getMessage();
if (!message.isEmpty()) {
sb.append(" for each ");

View file

@ -89,7 +89,7 @@ public class ProtectionAbility extends StaticAbility {
@Override
public String getRule() {
return "protection from " + filter.getMessage() + (removeAuras ? "" : ". This effect doesn't remove auras.");
return "Protection from " + filter.getMessage() + (removeAuras ? "" : ". This effect doesn't remove auras.");
}
public boolean canTarget(MageObject source, Game game) {

View file

@ -24,8 +24,7 @@
* The views and conclusions contained in the software and documentation are those of the
* authors and should not be interpreted as representing official policies, either expressed
* or implied, of BetaSteward_at_googlemail.com.
*/
*/
package mage.abilities.keyword;
import mage.constants.Zone;
@ -37,19 +36,24 @@ import java.io.ObjectStreamException;
/**
* 702.77. Wither
*
* 702.77a. Wither is a static ability. Damage dealt to a creature by a source with wither isn't marked on that creature. Rather, it causes that many -1/-1 counters to be put on that creature. See rule 119.3.
* 702.77a. Wither is a static ability. Damage dealt to a creature by a source
* with wither isn't marked on that creature. Rather, it causes that many -1/-1
* counters to be put on that creature. See rule 119.3.
*
* 702.77b. If a permanent leaves the battlefield before an effect causes it to deal damage, its last known information is used to determine whether it had wither.
* 702.77b. If a permanent leaves the battlefield before an effect causes it to
* deal damage, its last known information is used to determine whether it had
* wither.
*
* 702.77c. The wither rules function no matter what zone an object with wither deals damage from.
* 702.77c. The wither rules function no matter what zone an object with wither
* deals damage from.
*
* 702.77d. Multiple instances of wither on the same object are redundant.
* 702.77d. Multiple instances of wither on the same object are redundant.
*
* @author nantuko
* @author nantuko
*/
public class WitherAbility extends StaticAbility implements MageSingleton {
private static final WitherAbility instance = new WitherAbility();
private static final WitherAbility instance = new WitherAbility();
private Object readResolve() throws ObjectStreamException {
return instance;
@ -65,7 +69,7 @@ public class WitherAbility extends StaticAbility implements MageSingleton {
@Override
public String getRule() {
return "Wither <i>(This deals damage to creatures in the form of -1/-1 counters.)</i>";
return "wither <i>(This deals damage to creatures in the form of -1/-1 counters.)</i>";
}
@Override