From ce3f6d8e4196f2de8aafe732165243c724617a75 Mon Sep 17 00:00:00 2001 From: Oleg Agafonov Date: Tue, 14 Jan 2020 20:34:52 +0400 Subject: [PATCH] Fixed wrong ends symbols in combined effects rules like IfDoCost; --- .../main/java/mage/abilities/effects/Effects.java | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/Mage/src/main/java/mage/abilities/effects/Effects.java b/Mage/src/main/java/mage/abilities/effects/Effects.java index 97f2675244..3eaf378be5 100644 --- a/Mage/src/main/java/mage/abilities/effects/Effects.java +++ b/Mage/src/main/java/mage/abilities/effects/Effects.java @@ -71,7 +71,18 @@ public class Effects extends ArrayList { 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; }