diff --git a/src/engine/wpak/PowersParser.java b/src/engine/wpak/PowersParser.java index b935bacc..1a218ae4 100644 --- a/src/engine/wpak/PowersParser.java +++ b/src/engine/wpak/PowersParser.java @@ -55,10 +55,6 @@ public class PowersParser { try { - // Remove all lines that contain a # and leading/trailing blank lines - - powerData = powerData.replaceAll("(?m)^.*#.*\r?\n?", ""); - StringBuilder conditionString = new StringBuilder(); StringBuilder powerString = new StringBuilder(); @@ -74,6 +70,13 @@ public class PowersParser { powerString.append(powerData.substring(endPos)); + // Cleanup dangling tags and lines that contain a # and leading/trailing blank lines + + powerString = new StringBuilder(powerString.toString().replaceAll("CONDITIONBEGINCONDITIONEND", "") + .replaceAll("(?m)^.*#.*\r?\n?", "")); + + conditionString = new StringBuilder(conditionString.toString().replaceAll("(?m)^.*#.*\r?\n?", "")); + String[] lineData = powerString.toString().trim().split("\n"); ArrayList powerHeader = new ArrayList<>();