From 8293f552b1cc316e975f57fef9b1acd5ba303e38 Mon Sep 17 00:00:00 2001 From: MagicBot Date: Sat, 10 Aug 2024 16:29:55 -0400 Subject: [PATCH] EffectModifier parsing --- .../EffectEntry/EffectEntry.java | 3 ++- .../{Mod.java => EffectModifier.java} | 2 +- src/engine/ConfigParsing/EffectsParser.java | 20 +++++++++++++++++++ 3 files changed, 23 insertions(+), 2 deletions(-) rename src/engine/ConfigParsing/EffectEntry/{Mod.java => EffectModifier.java} (88%) diff --git a/src/engine/ConfigParsing/EffectEntry/EffectEntry.java b/src/engine/ConfigParsing/EffectEntry/EffectEntry.java index 7c701cac..1624bf09 100644 --- a/src/engine/ConfigParsing/EffectEntry/EffectEntry.java +++ b/src/engine/ConfigParsing/EffectEntry/EffectEntry.java @@ -1,5 +1,6 @@ package engine.ConfigParsing.EffectEntry; +import java.util.ArrayList; import java.util.HashSet; public class EffectEntry { @@ -7,6 +8,6 @@ public class EffectEntry { public String name; public int icon; public HashSet sources = new HashSet<>(); - public HashSet mods; + public ArrayList mods; public HashSet conditions; } diff --git a/src/engine/ConfigParsing/EffectEntry/Mod.java b/src/engine/ConfigParsing/EffectEntry/EffectModifier.java similarity index 88% rename from src/engine/ConfigParsing/EffectEntry/Mod.java rename to src/engine/ConfigParsing/EffectEntry/EffectModifier.java index eac3ac4f..20fc35b6 100644 --- a/src/engine/ConfigParsing/EffectEntry/Mod.java +++ b/src/engine/ConfigParsing/EffectEntry/EffectModifier.java @@ -2,7 +2,7 @@ package engine.ConfigParsing.EffectEntry; import engine.mbEnums; -public class Mod { +public class EffectModifier { public mbEnums.ModType type; public int min; public int max; diff --git a/src/engine/ConfigParsing/EffectsParser.java b/src/engine/ConfigParsing/EffectsParser.java index 96595ef6..260bdf64 100644 --- a/src/engine/ConfigParsing/EffectsParser.java +++ b/src/engine/ConfigParsing/EffectsParser.java @@ -9,6 +9,7 @@ package engine.ConfigParsing; import engine.ConfigParsing.EffectEntry.EffectEntry; +import engine.ConfigParsing.EffectEntry.EffectModifier; import engine.gameManager.ConfigManager; import java.io.IOException; @@ -92,7 +93,26 @@ public class EffectsParser { // Parse modifier entries + matcher = MODS_REGEX.matcher(effectData); + + // Iterate effect entries from .wpak config data + + while (matcher.find()) { + EffectModifier effectModifier = parseModEntry(matcher.group()); + + if (effectEntry != null) + effectEntry.mods.add(effectModifier); + } + return effectEntry; } + + private static EffectModifier parseModEntry(String modData) { + + EffectModifier effectModifier = new EffectModifier(); + + return effectModifier; + } + }