Browse Source

EffectModifier parsing

feature-config-parsing2
MagicBot 5 months ago
parent
commit
8293f552b1
  1. 3
      src/engine/ConfigParsing/EffectEntry/EffectEntry.java
  2. 2
      src/engine/ConfigParsing/EffectEntry/EffectModifier.java
  3. 20
      src/engine/ConfigParsing/EffectsParser.java

3
src/engine/ConfigParsing/EffectEntry/EffectEntry.java

@ -1,5 +1,6 @@
package engine.ConfigParsing.EffectEntry; package engine.ConfigParsing.EffectEntry;
import java.util.ArrayList;
import java.util.HashSet; import java.util.HashSet;
public class EffectEntry { public class EffectEntry {
@ -7,6 +8,6 @@ public class EffectEntry {
public String name; public String name;
public int icon; public int icon;
public HashSet<String> sources = new HashSet<>(); public HashSet<String> sources = new HashSet<>();
public HashSet<String> mods; public ArrayList<EffectModifier> mods;
public HashSet<String> conditions; public HashSet<String> conditions;
} }

2
src/engine/ConfigParsing/EffectEntry/Mod.java → src/engine/ConfigParsing/EffectEntry/EffectModifier.java

@ -2,7 +2,7 @@ package engine.ConfigParsing.EffectEntry;
import engine.mbEnums; import engine.mbEnums;
public class Mod { public class EffectModifier {
public mbEnums.ModType type; public mbEnums.ModType type;
public int min; public int min;
public int max; public int max;

20
src/engine/ConfigParsing/EffectsParser.java

@ -9,6 +9,7 @@
package engine.ConfigParsing; package engine.ConfigParsing;
import engine.ConfigParsing.EffectEntry.EffectEntry; import engine.ConfigParsing.EffectEntry.EffectEntry;
import engine.ConfigParsing.EffectEntry.EffectModifier;
import engine.gameManager.ConfigManager; import engine.gameManager.ConfigManager;
import java.io.IOException; import java.io.IOException;
@ -92,7 +93,26 @@ public class EffectsParser {
// Parse modifier entries // 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; return effectEntry;
} }
private static EffectModifier parseModEntry(String modData) {
EffectModifier effectModifier = new EffectModifier();
return effectModifier;
}
} }

Loading…
Cancel
Save