Fixed wrong ends symbols in combined effects rules like IfDoCost;

This commit is contained in:
Oleg Agafonov 2020-01-14 20:34:52 +04:00
parent 26bdd8c0e8
commit ce3f6d8e41

View file

@ -71,7 +71,18 @@ public class Effects extends ArrayList<Effect> {
nextRule = Character.toUpperCase(nextRule.charAt(0)) + nextRule.substring(1);
}
}
sbText.append(endString).append(nextRule);
String currentRule = endString + nextRule;
// fix dot in the combined effect like IfDoCost
if (sbText.length() > 0 && currentRule.length() > 0) {
boolean prevTextEndsWithDot = sbText.charAt(sbText.length() - 1) == '.';
boolean currentTextStartsWithDot = currentRule.startsWith(",") || currentRule.startsWith(".");
if (prevTextEndsWithDot && currentTextStartsWithDot) {
sbText.delete(sbText.length() - 1, sbText.length());
}
}
sbText.append(currentRule);
}
lastRule = nextRule;
}