Browse Source

StartTransfer poweraction work

feature-config-usage
MagicBot 4 months ago
parent
commit
2947753c3c
  1. 26
      src/engine/powers/poweractions/TransferStatPowerAction.java

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

@ -22,9 +22,8 @@ import engine.powers.ActionsBase;
import engine.powers.EffectsBase; import engine.powers.EffectsBase;
import engine.powers.PowersBase; import engine.powers.PowersBase;
import engine.powers.effectmodifiers.HealthEffectModifier; import engine.powers.effectmodifiers.HealthEffectModifier;
import engine.wpak.data.PowerAction;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.HashMap; import java.util.HashMap;
import java.util.concurrent.ThreadLocalRandom; import java.util.concurrent.ThreadLocalRandom;
@ -47,34 +46,35 @@ public class TransferStatPowerAction extends AbstractPowerAction {
protected mbEnums.DamageType damageType; protected mbEnums.DamageType damageType;
protected EffectsBase effect; protected EffectsBase effect;
public TransferStatPowerAction(ResultSet rs, HashMap<String, EffectsBase> effects) throws SQLException { public TransferStatPowerAction(PowerAction powerAction, HashMap<String, EffectsBase> effects) {
super(rs); super(powerAction);
this.effectID = rs.getString("effectID"); this.effectID = powerAction.effects.get(0).effect_id;
String st = rs.getString("transferFromType");
String st = powerAction.statTransfer.fromStat;
if (st.equals("HEALTH")) if (st.equals("HEALTH"))
this.transferFromHealth = true; this.transferFromHealth = true;
else if (st.equals("MANA")) else if (st.equals("MANA"))
this.transferFromMana = true; this.transferFromMana = true;
else else
this.transferFromStamina = true; this.transferFromStamina = true;
st = rs.getString("transferToType"); st = powerAction.getString("transferToType");
if (st.equals("HEALTH")) if (st.equals("HEALTH"))
this.transferToHealth = true; this.transferToHealth = true;
else if (st.equals("MANA")) else if (st.equals("MANA"))
this.transferToMana = true; this.transferToMana = true;
else else
this.transferToStamina = true; this.transferToStamina = true;
this.transferAmount = rs.getFloat("transferAmount"); this.transferAmount = powerAction.getFloat("transferAmount");
this.transferRamp = rs.getFloat("transferRamp"); this.transferRamp = powerAction.getFloat("transferRamp");
this.transferEfficiency = rs.getFloat("transferEfficiency"); this.transferEfficiency = powerAction.getFloat("transferEfficiency");
this.transferEfficiencyRamp = rs.getFloat("transferEfficiencyRamp"); this.transferEfficiencyRamp = powerAction.getFloat("transferEfficiencyRamp");
int flags = rs.getInt("flags"); int flags = powerAction.getInt("flags");
this.transferRampAdd = ((flags & 4096) != 0) ? true : false; this.transferRampAdd = ((flags & 4096) != 0) ? true : false;
this.transferEfficiencyRampAdd = ((flags & 8192) != 0) ? true : false; this.transferEfficiencyRampAdd = ((flags & 8192) != 0) ? true : false;
this.targetToCaster = ((flags & 16384) != 0) ? true : false; this.targetToCaster = ((flags & 16384) != 0) ? true : false;
this.effect = effects.get(this.effectID); this.effect = effects.get(this.effectID);
try { try {
String damageString = rs.getString("damageType"); String damageString = powerAction.getString("damageType");
// Damage type can sometimes be null in the DB. // Damage type can sometimes be null in the DB.
if (damageString.isEmpty() == false) if (damageString.isEmpty() == false)

Loading…
Cancel
Save