Browse Source

PowerActionEntry parsing work.

feature-config-parsing2
MagicBot 3 months ago
parent
commit
9ae3cb796d
  1. 16
      src/engine/wpak/PowerActionParser.java

16
src/engine/wpak/PowerActionParser.java

@ -14,6 +14,9 @@ import engine.wpak.data.PowerActionEntry;
import java.io.IOException; import java.io.IOException;
import java.nio.file.Files; import java.nio.file.Files;
import java.nio.file.Paths; 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.Matcher;
import java.util.regex.Pattern; import java.util.regex.Pattern;
@ -51,6 +54,19 @@ public class PowerActionParser {
private static PowerActionEntry parsePowerActionEntry(String powerActionData) { private static PowerActionEntry parsePowerActionEntry(String powerActionData) {
PowerActionEntry powerActionEntry = new PowerActionEntry(); 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<String> effectHeader = new ArrayList<>();
return powerActionEntry; return powerActionEntry;
} }

Loading…
Cancel
Save