From d12d040defd50fcfe684f3abfc50519a3fcd4eed Mon Sep 17 00:00:00 2001 From: MagicBot Date: Tue, 6 Aug 2024 17:17:57 -0400 Subject: [PATCH] Parsing of effect description --- src/engine/ConfigParsing/EffectsParser.java | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/src/engine/ConfigParsing/EffectsParser.java b/src/engine/ConfigParsing/EffectsParser.java index 88cb1f50..1aa09114 100644 --- a/src/engine/ConfigParsing/EffectsParser.java +++ b/src/engine/ConfigParsing/EffectsParser.java @@ -49,6 +49,23 @@ public class EffectsParser { effectData.replaceAll("(?m)^.*#.*$", ""); + // Parse effect entry description + + String firstLine = effectData.substring(0, effectData.indexOf('\n')); + String[] effectDescription = firstLine.split(" "); + + effectEntry.id = effectDescription[0]; + effectEntry.name = effectDescription[1]; + effectEntry.icon = Integer.parseInt(effectDescription[2]); + + // Parse source entries + + Matcher matcher = SOURCE_REGEX.matcher(effectData); + + while (matcher.find()) + effectEntry.sources.add(matcher.group(1).trim()); + + return effectEntry; }