forked from External/mage
* UI: split cards - fixed wrong card names in rules text and hints (#6549);
This commit is contained in:
parent
0c2e08f54e
commit
0be7d6579b
3 changed files with 41 additions and 11 deletions
|
|
@ -140,13 +140,30 @@ public abstract class CardRenderer {
|
|||
break;
|
||||
}
|
||||
|
||||
// workaround to use real split card names
|
||||
String realCardName = cardView.getDisplayName();
|
||||
if (cardView.isSplitCard()) {
|
||||
for (String partRule : cardView.getLeftSplitRules()) {
|
||||
if (partRule.equals(rule)) {
|
||||
realCardName = cardView.getLeftSplitName();
|
||||
break;
|
||||
}
|
||||
}
|
||||
for (String partRule : cardView.getRightSplitRules()) {
|
||||
if (partRule.equals(rule)) {
|
||||
realCardName = cardView.getRightSplitName();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Kill reminder text
|
||||
if (PreferencesDialog.getCachedValue(PreferencesDialog.KEY_CARD_RENDERING_REMINDER_TEXT, "false").equals("false")) {
|
||||
rule = CardRendererUtils.killReminderText(rule).trim();
|
||||
}
|
||||
|
||||
if (!rule.isEmpty()) {
|
||||
TextboxRule tbRule = TextboxRuleParser.parse(cardView, rule);
|
||||
TextboxRule tbRule = TextboxRuleParser.parse(cardView, rule, realCardName);
|
||||
if (tbRule.type == TextboxRuleType.SIMPLE_KEYWORD) {
|
||||
keywords.add(tbRule);
|
||||
} else if (tbRule.text.isEmpty()) {
|
||||
|
|
|
|||
|
|
@ -30,7 +30,7 @@ public final class TextboxRuleParser {
|
|||
// if the ability is a loyalty ability, and returning an TextboxRule
|
||||
// representing that information, which can be used to render the rule in
|
||||
// the textbox of a card.
|
||||
public static TextboxRule parse(CardView source, String rule) {
|
||||
public static TextboxRule parse(CardView source, String rule, String cardNameToUse) {
|
||||
// List of regions to apply
|
||||
List<TextboxRule.AttributeRegion> regions = new ArrayList<>();
|
||||
|
||||
|
|
@ -104,10 +104,9 @@ public final class TextboxRuleParser {
|
|||
String contents = rule.substring(index + 1, closeIndex);
|
||||
if (contents.equals("this") || contents.equals("source")) {
|
||||
// Replace {this} with the card's name
|
||||
String cardName = source.getName();
|
||||
build.append(cardName);
|
||||
build.append(cardNameToUse);
|
||||
index += contents.length() + 2;
|
||||
outputIndex += cardName.length();
|
||||
outputIndex += cardNameToUse.length();
|
||||
} else {
|
||||
Image symbol = ManaSymbols.getSizedManaSymbol(contents.replace("/", ""), 10);
|
||||
if (symbol != null) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue