From 2947753c3cb0661ae79827c2f4bb11d2d4f0cd7f Mon Sep 17 00:00:00 2001 From: MagicBot Date: Sat, 7 Sep 2024 15:47:33 -0400 Subject: [PATCH] StartTransfer poweraction work --- .../poweractions/TransferStatPowerAction.java | 26 +++++++++---------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/src/engine/powers/poweractions/TransferStatPowerAction.java b/src/engine/powers/poweractions/TransferStatPowerAction.java index 4abe41bf..68fe2ef7 100644 --- a/src/engine/powers/poweractions/TransferStatPowerAction.java +++ b/src/engine/powers/poweractions/TransferStatPowerAction.java @@ -22,9 +22,8 @@ import engine.powers.ActionsBase; import engine.powers.EffectsBase; import engine.powers.PowersBase; 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.concurrent.ThreadLocalRandom; @@ -47,34 +46,35 @@ public class TransferStatPowerAction extends AbstractPowerAction { protected mbEnums.DamageType damageType; protected EffectsBase effect; - public TransferStatPowerAction(ResultSet rs, HashMap effects) throws SQLException { - super(rs); - this.effectID = rs.getString("effectID"); - String st = rs.getString("transferFromType"); + public TransferStatPowerAction(PowerAction powerAction, HashMap effects) { + super(powerAction); + this.effectID = powerAction.effects.get(0).effect_id; + + String st = powerAction.statTransfer.fromStat; if (st.equals("HEALTH")) this.transferFromHealth = true; else if (st.equals("MANA")) this.transferFromMana = true; else this.transferFromStamina = true; - st = rs.getString("transferToType"); + st = powerAction.getString("transferToType"); if (st.equals("HEALTH")) this.transferToHealth = true; else if (st.equals("MANA")) this.transferToMana = true; else this.transferToStamina = true; - this.transferAmount = rs.getFloat("transferAmount"); - this.transferRamp = rs.getFloat("transferRamp"); - this.transferEfficiency = rs.getFloat("transferEfficiency"); - this.transferEfficiencyRamp = rs.getFloat("transferEfficiencyRamp"); - int flags = rs.getInt("flags"); + this.transferAmount = powerAction.getFloat("transferAmount"); + this.transferRamp = powerAction.getFloat("transferRamp"); + this.transferEfficiency = powerAction.getFloat("transferEfficiency"); + this.transferEfficiencyRamp = powerAction.getFloat("transferEfficiencyRamp"); + int flags = powerAction.getInt("flags"); this.transferRampAdd = ((flags & 4096) != 0) ? true : false; this.transferEfficiencyRampAdd = ((flags & 8192) != 0) ? true : false; this.targetToCaster = ((flags & 16384) != 0) ? true : false; this.effect = effects.get(this.effectID); try { - String damageString = rs.getString("damageType"); + String damageString = powerAction.getString("damageType"); // Damage type can sometimes be null in the DB. if (damageString.isEmpty() == false)