From f7c8c44ebb4e0015440f0ca85c3301e195b4d5a8 Mon Sep 17 00:00:00 2001 From: MagicBot Date: Sat, 10 Aug 2024 17:54:29 -0400 Subject: [PATCH] EffectModifier parsing --- src/engine/ConfigParsing/EffectsParser.java | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/src/engine/ConfigParsing/EffectsParser.java b/src/engine/ConfigParsing/EffectsParser.java index 383d9ec3..8ed857f1 100644 --- a/src/engine/ConfigParsing/EffectsParser.java +++ b/src/engine/ConfigParsing/EffectsParser.java @@ -11,6 +11,8 @@ package engine.ConfigParsing; import engine.ConfigParsing.EffectEntry.EffectEntry; import engine.ConfigParsing.EffectEntry.EffectModifier; import engine.gameManager.ConfigManager; +import engine.mbEnums; +import org.pmw.tinylog.Logger; import java.io.IOException; import java.nio.file.Files; @@ -111,7 +113,25 @@ public class EffectsParser { private static EffectModifier parseModEntry(String modData) { EffectModifier effectModifier = new EffectModifier(); + ArrayList modValues = new ArrayList<>(); + Matcher matcher = STRSPLIT_REGEX.matcher(modData); + + while (matcher.find()) + modValues.add(matcher.group(1).trim()); + + effectModifier.type = mbEnums.ModType.valueOf(modValues.get(0)); + + switch (effectModifier.type) { + case AnimOverride: + effectModifier.min = Integer.parseInt(modValues.get(1)); + effectModifier.max = Integer.parseInt(modValues.get(2)); + break; + default: + Logger.error("Unhandled type: " + effectModifier.type); + break; + + } return effectModifier; }