From 9ae3cb796d3ddde9886badba667b4e1bac3407ea Mon Sep 17 00:00:00 2001 From: MagicBot Date: Mon, 19 Aug 2024 21:02:13 -0400 Subject: [PATCH] PowerActionEntry parsing work. --- src/engine/wpak/PowerActionParser.java | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/engine/wpak/PowerActionParser.java b/src/engine/wpak/PowerActionParser.java index c16cc274..89127993 100644 --- a/src/engine/wpak/PowerActionParser.java +++ b/src/engine/wpak/PowerActionParser.java @@ -14,6 +14,9 @@ import engine.wpak.data.PowerActionEntry; import java.io.IOException; import java.nio.file.Files; import java.nio.file.Paths; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Iterator; import java.util.regex.Matcher; import java.util.regex.Pattern; @@ -51,6 +54,19 @@ public class PowerActionParser { private static PowerActionEntry parsePowerActionEntry(String powerActionData) { PowerActionEntry powerActionEntry = new PowerActionEntry(); + // Remove all lines that contain a # and leading/trailing blank lines + + powerActionData = powerActionData.replaceAll("(?m)^(\\s*#.*|\\s*)\r?\n?", "").trim(); + + String[] lineData = powerActionData.trim().split("\n"); + + // Parse effect entry header + + Iterator iterator = Arrays.stream(lineData).iterator(); + + String headerLine = iterator.next().toString(); + + ArrayList effectHeader = new ArrayList<>(); return powerActionEntry; }