Browse Source

StatTransfer pojo created.

feature-config-parsing2
MagicBot 3 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 @@
package engine.wpak; package engine.wpak;
import engine.gameManager.ConfigManager; import engine.gameManager.ConfigManager;
import engine.mbEnums;
import engine.wpak.data.EffectDescription; import engine.wpak.data.EffectDescription;
import engine.wpak.data.PowerActionEntry; import engine.wpak.data.PowerActionEntry;
import engine.wpak.data.StatTransfer;
import org.pmw.tinylog.Logger; import org.pmw.tinylog.Logger;
import java.io.IOException; import java.io.IOException;
@ -56,6 +58,7 @@ public class PowerActionParser {
PowerActionEntry powerActionEntry = new PowerActionEntry(); PowerActionEntry powerActionEntry = new PowerActionEntry();
EffectDescription effectDescription; EffectDescription effectDescription;
StatTransfer statTransfer;
try { try {
// Remove all lines that contain a # and leading/trailing blank lines // Remove all lines that contain a # and leading/trailing blank lines
@ -110,8 +113,32 @@ public class PowerActionParser {
powerActionEntry.effects.add(effectDescription); powerActionEntry.effects.add(effectDescription);
} }
break; break;
case "Teleport": case "TransferStat":
case "TreeChoke":// No arguments 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; break;
default: default:
Logger.error("Unhandled type " + powerActionEntry.action_type + " for Pow4erAction: " + powerActionEntry.action_id); 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 {
public boolean fromStatBool; public boolean fromStatBool;
public boolean toStatBool; public boolean toStatBool;
public String transfer_action; public String transfer_action;
public int effect_duration; public int tranfer_ticks;
} }

Loading…
Cancel
Save