Browse Source

EffectModifier parsing

feature-config-parsing2
MagicBot 5 months ago
parent
commit
f7c8c44ebb
  1. 20
      src/engine/ConfigParsing/EffectsParser.java

20
src/engine/ConfigParsing/EffectsParser.java

@ -11,6 +11,8 @@ package engine.ConfigParsing; @@ -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 { @@ -111,7 +113,25 @@ public class EffectsParser {
private static EffectModifier parseModEntry(String modData) {
EffectModifier effectModifier = new EffectModifier();
ArrayList<String> 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;
}

Loading…
Cancel
Save