[ROE] updated level up text

This commit is contained in:
Evan Kranzler 2022-03-09 18:30:54 -05:00
parent 1a53011e55
commit 08411b122c
3 changed files with 21 additions and 13 deletions

View file

@ -1676,9 +1676,11 @@ public class VerifyCardDataTest {
String[] cardRules = card String[] cardRules = card
.getRules() .getRules()
.stream() .stream()
.reduce("", (a, b) -> a + '\n' + b) .collect(Collectors.joining("\n"))
.replace("<br>", "\n") .replace("<br>", "\n")
.replace("<br/>", "\n") .replace("<br/>", "\n")
.replace("<b>", "")
.replace("</b>", "")
.split("[\\$\\\n]"); .split("[\\$\\\n]");
for (int i = 0; i < cardRules.length; i++) { for (int i = 0; i < cardRules.length; i++) {
cardRules[i] = prepareRule(card.getName(), cardRules[i]); cardRules[i] = prepareRule(card.getName(), cardRules[i]);

View file

@ -107,7 +107,7 @@ public class Effects extends ArrayList<Effect> {
&& !lastRule.endsWith(".") && !lastRule.endsWith(".")
&& !lastRule.endsWith("\"") && !lastRule.endsWith("\"")
&& !lastRule.endsWith(".]") && !lastRule.endsWith(".]")
&& !lastRule.startsWith("<b>Level ") && !lastRule.startsWith("<b>LEVEL ")
&& !lastRule.endsWith(".)") && !lastRule.endsWith(".)")
&& !lastRule.endsWith("<br>") && !lastRule.endsWith("<br>")
&& !lastRule.endsWith("</i>")) { && !lastRule.endsWith("</i>")) {

View file

@ -1,8 +1,5 @@
package mage.abilities.keyword; package mage.abilities.keyword;
import java.util.ArrayList;
import java.util.List;
import mage.abilities.Abilities; import mage.abilities.Abilities;
import mage.abilities.AbilitiesImpl; import mage.abilities.AbilitiesImpl;
import mage.abilities.Ability; import mage.abilities.Ability;
@ -18,10 +15,14 @@ import mage.constants.SubLayer;
import mage.constants.Zone; import mage.constants.Zone;
import mage.counters.CounterType; import mage.counters.CounterType;
import java.util.ArrayList;
import java.util.List;
import java.util.stream.Collectors;
/** /**
* The implementation by BetaSteward was discarded as requires special handling * The implementation by BetaSteward was discarded as requires special handling
* in Mage.Core. * in Mage.Core.
* * <p>
* Instead it was replaced by conditional continuous effects and builder * Instead it was replaced by conditional continuous effects and builder
* pattern. * pattern.
* *
@ -181,19 +182,24 @@ public class LevelerCardBuilder {
} }
public String getRule() { public String getRule() {
StringBuilder sb = new StringBuilder(); StringBuilder sb = new StringBuilder("<b>LEVEL ");
sb.append("<b>Level ").append(level1); sb.append(level1);
if (level2 == -1) { if (level2 == -1) {
sb.append('+'); sb.append('+');
} else { } else {
sb.append('-').append(level2); sb.append('-');
sb.append(level2);
} }
sb.append(":</b> ").append(power).append('/').append(toughness).append(' '); sb.append("</b><br>");
for (String rule : abilities.getRules("{this}")) { sb.append(power);
sb.append(rule).append(' '); sb.append('/');
sb.append(toughness);
List<String> abilityText = abilities.getRules("{this}");
if (!abilityText.isEmpty()) {
sb.append("<br>");
sb.append(abilityText.stream().collect(Collectors.joining("<br>")));
} }
return sb.toString(); return sb.toString();
} }
} }
} }