Browse Source

StatTransfer pojo created.

feature-config-parsing2
MagicBot 4 months ago
parent
commit
8bf5360f6f
  1. 31
      src/engine/wpak/PowerActionParser.java
  2. 2
      src/engine/wpak/data/StatTransfer.java

31
src/engine/wpak/PowerActionParser.java

@ -9,8 +9,10 @@ @@ -9,8 +9,10 @@
package engine.wpak;
import engine.gameManager.ConfigManager;
import engine.mbEnums;
import engine.wpak.data.EffectDescription;
import engine.wpak.data.PowerActionEntry;
import engine.wpak.data.StatTransfer;
import org.pmw.tinylog.Logger;
import java.io.IOException;
@ -56,6 +58,7 @@ public class PowerActionParser { @@ -56,6 +58,7 @@ public class PowerActionParser {
PowerActionEntry powerActionEntry = new PowerActionEntry();
EffectDescription effectDescription;
StatTransfer statTransfer;
try {
// Remove all lines that contain a # and leading/trailing blank lines
@ -110,8 +113,32 @@ public class PowerActionParser { @@ -110,8 +113,32 @@ public class PowerActionParser {
powerActionEntry.effects.add(effectDescription);
}
break;
case "Teleport":
case "TreeChoke":// No arguments
case "TransferStat":
statTransfer = new StatTransfer();
statTransfer.fromStat = mbEnums.CostType.valueOf(headerIterator.next());
statTransfer.toStat = mbEnums.CostType.valueOf(headerIterator.next());
statTransfer.fromStatValue = Integer.parseInt(headerIterator.next());
statTransfer.fromCurve = mbEnums.CompoundCurveType.valueOf(headerIterator.next());
statTransfer.toStatValue = Integer.parseInt(headerIterator.next());
statTransfer.toCurve = mbEnums.CompoundCurveType.valueOf(headerIterator.next());
statTransfer.fromStatBool = Boolean.parseBoolean(headerIterator.next());
statTransfer.toStatBool = Boolean.parseBoolean(headerIterator.next());
break;
case "TransferStatOT":
statTransfer = new StatTransfer();
statTransfer.fromStat = mbEnums.CostType.valueOf(headerIterator.next());
statTransfer.toStat = mbEnums.CostType.valueOf(headerIterator.next());
statTransfer.fromStatValue = Integer.parseInt(headerIterator.next());
statTransfer.fromCurve = mbEnums.CompoundCurveType.valueOf(headerIterator.next());
statTransfer.toStatValue = Integer.parseInt(headerIterator.next());
statTransfer.toCurve = mbEnums.CompoundCurveType.valueOf(headerIterator.next());
statTransfer.fromStatBool = Boolean.parseBoolean(headerIterator.next());
statTransfer.toStatBool = Boolean.parseBoolean(headerIterator.next());
statTransfer.transfer_action = headerIterator.next();
statTransfer.tranfer_ticks = Integer.parseInt(headerIterator.next());
break;
case "Teleport":// No arguments for these tags
case "TreeChoke":
break;
default:
Logger.error("Unhandled type " + powerActionEntry.action_type + " for Pow4erAction: " + powerActionEntry.action_id);

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

@ -20,5 +20,5 @@ public class StatTransfer { @@ -20,5 +20,5 @@ public class StatTransfer {
public boolean fromStatBool;
public boolean toStatBool;
public String transfer_action;
public int effect_duration;
public int tranfer_ticks;
}

Loading…
Cancel
Save