Browse Source

Support for multiple pre-reqs

feature-config-parsing2
MagicBot 3 months ago
parent
commit
d3ef0c828d
  1. 17
      src/engine/wpak/PowersParser.java
  2. 2
      src/engine/wpak/data/EquipmentPreReq.java
  3. 2
      src/engine/wpak/data/PowerEntry.java

17
src/engine/wpak/PowersParser.java

@ -61,7 +61,8 @@ public class PowersParser {
StringBuilder powerBuilder = new StringBuilder(); StringBuilder powerBuilder = new StringBuilder();
String conditionString; String conditionString;
String powerString; String powerString;
java.util.Iterator<String> iterator;
java.util.Iterator<String> argumentIterator;
int endPos = 0; int endPos = 0;
// Separate out any conditions from the power data // Separate out any conditions from the power data
@ -95,7 +96,7 @@ public class PowersParser {
while (matcher.find()) while (matcher.find())
powerHeader.add(matcher.group().trim()); powerHeader.add(matcher.group().trim());
java.util.Iterator<String> iterator = powerHeader.iterator(); iterator = powerHeader.iterator();
powerEntry.power_id = iterator.next(); powerEntry.power_id = iterator.next();
powerEntry.power = iterator.next().replaceAll("\"", ""); powerEntry.power = iterator.next().replaceAll("\"", "");
@ -202,10 +203,14 @@ public class PowersParser {
while (matcher1.find()) while (matcher1.find())
arguments.add(matcher1.group().trim()); arguments.add(matcher1.group().trim());
equipmentPreReq.slot = mbEnums.EquipSlotType.valueOf(arguments.get(0)); argumentIterator = arguments.iterator();
equipmentPreReq.skill = arguments.get(1).replaceAll("\"", "");
equipmentPreReq.level = Integer.parseInt(arguments.get(2)); while (argumentIterator.hasNext()) {
powerEntry.equipmentPreReq = equipmentPreReq; equipmentPreReq.slot = mbEnums.EquipSlotType.valueOf(arguments.get(0));
equipmentPreReq.skill = arguments.get(1).replaceAll("\"", "");
equipmentPreReq.required = Integer.parseInt(arguments.get(2));
powerEntry.equipmentPreReq.add(equipmentPreReq);
}
break; break;
case "CANCASTWHILEMOVING": case "CANCASTWHILEMOVING":
powerEntry.canCastWhileMoving = Boolean.parseBoolean(lineValues.get(1).trim()); powerEntry.canCastWhileMoving = Boolean.parseBoolean(lineValues.get(1).trim());

2
src/engine/wpak/data/EquipmentPreReq.java

@ -14,6 +14,6 @@ public class EquipmentPreReq {
public mbEnums.EquipSlotType slot; public mbEnums.EquipSlotType slot;
public String skill; public String skill;
public int level; public int required;
} }

2
src/engine/wpak/data/PowerEntry.java

@ -50,7 +50,7 @@ public class PowerEntry {
public boolean canCastWhileMoving = false; public boolean canCastWhileMoving = false;
public boolean bladeTrails = false; public boolean bladeTrails = false;
public ArrayList<EffectDescription> effectPreReqs = new ArrayList<>(); public ArrayList<EffectDescription> effectPreReqs = new ArrayList<>();
public EquipmentPreReq equipmentPreReq; public ArrayList<EquipmentPreReq> equipmentPreReq = new ArrayList<>();
public EnumSet<mbEnums.MonsterType> monsterRestricts = EnumSet.noneOf(mbEnums.MonsterType.class); public EnumSet<mbEnums.MonsterType> monsterRestricts = EnumSet.noneOf(mbEnums.MonsterType.class);
public EnumSet<mbEnums.MonsterType> monsterPrereqs = EnumSet.noneOf(mbEnums.MonsterType.class); public EnumSet<mbEnums.MonsterType> monsterPrereqs = EnumSet.noneOf(mbEnums.MonsterType.class);
public boolean shouldCheckPath = false; public boolean shouldCheckPath = false;

Loading…
Cancel
Save