fix some text gen issues in common classes

This commit is contained in:
xenohedron 2024-09-02 19:52:18 -04:00
parent c40a6787b4
commit 48cb43351b
5 changed files with 21 additions and 21 deletions

View file

@ -671,7 +671,7 @@ public class Mana implements Comparable<Mana>, Serializable, Copyable<Mana> {
}
// normal mana
if (colorless < 20) {
if (colorless < 6) {
for (int i = 0; i < colorless; i++) {
sbMana.append("{C}");
}

View file

@ -71,13 +71,13 @@ public class EntersBattlefieldOneOrMoreTriggeredAbility extends TriggeredAbility
}
private String generateTriggerPhrase() {
StringBuilder sb = new StringBuilder("Whenever one or more " + this.filterPermanent.getMessage() + " enter the battlefield under ");
StringBuilder sb = new StringBuilder("Whenever one or more " + this.filterPermanent.getMessage());
switch (targetController) {
case YOU:
sb.append("your control, ");
sb.append(" you control enter, ");
break;
case OPPONENT:
sb.append("an opponent's control, ");
sb.append(" enter under an opponent's control, ");
break;
default:
throw new UnsupportedOperationException();

View file

@ -13,7 +13,7 @@ import mage.game.permanent.Permanent;
*/
public class SourceMatchesFilterCondition implements Condition {
private final FilterPermanent FILTER;
private final FilterPermanent filter;
private final String text;
public SourceMatchesFilterCondition(FilterPermanent filter) {
@ -24,14 +24,14 @@ public class SourceMatchesFilterCondition implements Condition {
if (filter == null) {
throw new IllegalArgumentException("Wrong code usage: filter param can't be empty");
}
this.FILTER = filter;
this.filter = filter;
this.text = text;
}
@Override
public boolean apply(Game game, Ability source) {
Permanent permanent = source.getSourcePermanentOrLKI(game);
return FILTER.match(permanent, permanent.getControllerId(), source, game);
return filter.match(permanent, permanent.getControllerId(), source, game);
}
@Override
@ -39,6 +39,6 @@ public class SourceMatchesFilterCondition implements Condition {
if (text != null) {
return text;
}
return super.toString();
return filter.toString();
}
}

View file

@ -1,4 +1,3 @@
package mage.abilities.effects.common;
import mage.abilities.Ability;
@ -49,7 +48,7 @@ public class GainsChoiceOfAbilitiesEffect extends OneShotEffect {
this.includeEnd = includeEnd;
this.abilityMap = new LinkedHashMap<>();
for (Ability ability : abilities) {
this.abilityMap.put(ability.getRule(), ability);
this.abilityMap.put(CardUtil.stripReminderText(ability.getRule()), ability);
}
}
@ -138,4 +137,4 @@ public class GainsChoiceOfAbilitiesEffect extends OneShotEffect {
}
return sb.toString();
}
}
}

View file

@ -49,17 +49,18 @@ public class ReturnFromGraveyardToBattlefieldWithCounterTargetEffect extends Ret
private String makeText(Counter counter, boolean additional) {
StringBuilder sb = new StringBuilder(" with ");
if (additional) {
sb.append(CardUtil.numberToText(counter.getCount(), "an"));
sb.append(" additional");
if (counter.getCount() == 1) {
if (additional) {
sb.append("an additional ").append(counter.getName());
} else {
sb.append(CardUtil.addArticle(counter.getName()));
}
sb.append(" counter");
} else {
sb.append(CardUtil.numberToText(counter.getCount(), "a"));
}
sb.append(' ');
sb.append(counter.getName());
sb.append(" counter");
if (counter.getCount() != 1) {
sb.append('s');
sb.append(CardUtil.numberToText(counter.getCount()));
sb.append(additional ? " additional" : " ");
sb.append(counter.getName());
sb.append(" counters");
}
return sb.toString();
}