Browse Source

TransferStatPowerAction java

feature-config-usage
FatBoy-DOTC 2 weeks ago
parent
commit
45b4ae9e3e
  1. 18
      src/engine/powers/poweractions/TransferStatPowerAction.java
  2. 4
      src/engine/wpak/PowerActionParser.java
  3. 2
      src/engine/wpak/data/StatTransfer.java

18
src/engine/powers/poweractions/TransferStatPowerAction.java

@ -44,17 +44,13 @@ public class TransferStatPowerAction extends AbstractPowerAction {
this.powerAction = powerAction; this.powerAction = powerAction;
this.effectID = powerAction.effects.get(0).effect_id; this.effectID = powerAction.effects.get(0).effect_id;
int flags = powerAction.getInt("flags"); //int flags = powerAction.getInt("flags");
this.transferRampAdd = ((flags & 4096) != 0) ? true : false; this.transferRampAdd = powerAction.statTransfer.rampCurve != null;
this.transferEfficiencyRampAdd = ((flags & 8192) != 0) ? true : false; this.transferEfficiencyRampAdd = powerAction.statTransfer.rampCurve != null;
this.targetToCaster = ((flags & 16384) != 0) ? true : false; this.targetToCaster = powerAction.statTransfer.isDrain;
this.effect = effects.get(this.effectID); this.effect = effects.get(this.effectID);
try { try {
String damageString = powerAction.getString("damageType"); this.damageType = powerAction.damageType;
// Damage type can sometimes be null in the DB.
if (damageString.isEmpty() == false)
this.damageType = mbEnums.DamageType.getDamageType(damageString);
} catch (Exception e) { } catch (Exception e) {
this.damageType = null; this.damageType = null;
} }
@ -71,13 +67,13 @@ public class TransferStatPowerAction extends AbstractPowerAction {
public float getTransferAmount(float trains) { public float getTransferAmount(float trains) {
// if (this.transferRampAdd) // if (this.transferRampAdd)
return this.powerAction.statTransfer.ramp + (this.transferRamp * trains); return (float) (this.powerAction.statTransfer.ramp + (this.powerAction.statTransfer.rampCurve.getValue() * trains));
// else // else
// return this.transferAmount * (1 + (this.transferRamp * trains)); // return this.transferAmount * (1 + (this.transferRamp * trains));
} }
public float getTransferEfficiency(float trains) { public float getTransferEfficiency(float trains) {
return this.transferEfficiency + (this.transferEfficiencyRamp * trains); return (float) (this.powerAction.statTransfer.efficiency + (this.powerAction.statTransfer.efficiencyCurve.getValue() * trains));
} }
public boolean targetToCaster() { public boolean targetToCaster() {

4
src/engine/wpak/PowerActionParser.java

@ -139,7 +139,7 @@ public class PowerActionParser {
statTransfer.efficiency = Float.parseFloat(headerIterator.next()); statTransfer.efficiency = Float.parseFloat(headerIterator.next());
statTransfer.efficiencyCurve = mbEnums.CompoundCurveType.valueOf(headerIterator.next()); statTransfer.efficiencyCurve = mbEnums.CompoundCurveType.valueOf(headerIterator.next());
statTransfer.fromStatBool = Boolean.parseBoolean(headerIterator.next()); statTransfer.fromStatBool = Boolean.parseBoolean(headerIterator.next());
statTransfer.toStatBool = Boolean.parseBoolean(headerIterator.next()); statTransfer.isDrain = Boolean.parseBoolean(headerIterator.next());
powerAction.statTransfer = statTransfer; powerAction.statTransfer = statTransfer;
break; break;
case "TransferStatOT": case "TransferStatOT":
@ -151,7 +151,7 @@ public class PowerActionParser {
statTransfer.efficiency = Float.parseFloat(headerIterator.next()); statTransfer.efficiency = Float.parseFloat(headerIterator.next());
statTransfer.efficiencyCurve = mbEnums.CompoundCurveType.valueOf(headerIterator.next()); statTransfer.efficiencyCurve = mbEnums.CompoundCurveType.valueOf(headerIterator.next());
statTransfer.fromStatBool = Boolean.parseBoolean(headerIterator.next()); statTransfer.fromStatBool = Boolean.parseBoolean(headerIterator.next());
statTransfer.toStatBool = Boolean.parseBoolean(headerIterator.next()); statTransfer.isDrain = Boolean.parseBoolean(headerIterator.next());
statTransfer.transfer_action = headerIterator.next(); statTransfer.transfer_action = headerIterator.next();
statTransfer.transfer_ticks = Integer.parseInt(headerIterator.next()); statTransfer.transfer_ticks = Integer.parseInt(headerIterator.next());
powerAction.statTransfer = statTransfer; powerAction.statTransfer = statTransfer;

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

@ -18,7 +18,7 @@ public class StatTransfer {
public float efficiency; public float efficiency;
public mbEnums.CompoundCurveType efficiencyCurve; public mbEnums.CompoundCurveType efficiencyCurve;
public boolean fromStatBool; public boolean fromStatBool;
public boolean toStatBool; public boolean isDrain;
public String transfer_action; public String transfer_action;
public int transfer_ticks; public int transfer_ticks;
} }

Loading…
Cancel
Save