Improved and fixed cards texts:

* fixed wrong texts for draw card abilities;
 * added multi-effects text generation instead copy-paste (concatBy).
This commit is contained in:
Oleg Agafonov 2019-01-04 23:51:42 +04:00
parent 83cf370cc6
commit f6585ef734
23 changed files with 144 additions and 140 deletions

View file

@ -42,6 +42,7 @@ public class Effects extends ArrayList<Effect> {
public String getText(Mode mode) {
StringBuilder sbText = new StringBuilder();
String lastRule = null;
int effectNum = 0;
for (Effect effect : this) {
String endString = "";
String nextRule = effect.getText(mode);
@ -50,9 +51,16 @@ public class Effects extends ArrayList<Effect> {
if (nextRule == null || nextRule.isEmpty()) {
continue;
}
effectNum++;
// concat effects (default: each effect with a new sentence)
String concatPrefix = effect.getConcatPrefix();
if (effectNum > 1 && !concatPrefix.isEmpty() && !concatPrefix.equals(".")) {
nextRule = concatPrefix + " " + nextRule;
}
if (nextRule != null) {
if (nextRule.startsWith("and ") || nextRule.startsWith("with ")) {
if (nextRule.startsWith("and ") || nextRule.startsWith("with ") || nextRule.startsWith("then ")) {
endString = " ";
} else if (nextRule.startsWith(",") || nextRule.startsWith(" ")) {
endString = "";