Browse Source

Refactored poweractions

feature-config-usage
MagicBot 3 months ago
parent
commit
fa45e9556f
  1. 73
      src/engine/gameManager/PowersManager.java
  2. 2
      src/engine/powers/poweractions/SimpleDamagePowerAction.java

73
src/engine/gameManager/PowersManager.java

@ -32,12 +32,10 @@ import engine.server.MBServerStatics;
import engine.wpak.EffectsParser; import engine.wpak.EffectsParser;
import engine.wpak.PowerActionParser; import engine.wpak.PowerActionParser;
import engine.wpak.PowersParser; import engine.wpak.PowersParser;
import engine.wpak.data.ActionEntry;
import engine.wpak.data.Effect; import engine.wpak.data.Effect;
import engine.wpak.data.PowerAction; import engine.wpak.data.PowerAction;
import org.pmw.tinylog.Logger; import org.pmw.tinylog.Logger;
import java.sql.SQLException;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
import java.util.HashSet; import java.util.HashSet;
@ -134,10 +132,11 @@ public enum PowersManager {
//AbstractPowerAction.getAllPowerActions(PowersManager.powerActionsByIDString, PowersManager.powerActionsByID, PowersManager.effectsBaseByIDString); //AbstractPowerAction.getAllPowerActions(PowersManager.powerActionsByIDString, PowersManager.powerActionsByID, PowersManager.effectsBaseByIDString);
HashMap<String, EffectsBase> effects = PowersManager.effectsBaseByIDString; HashMap<String, EffectsBase> effects = PowersManager.effectsBaseByIDString;
for (PowerAction rs : PowerActionParser.power_actions) {
for (PowerAction powerAction : PowerActionParser.power_actions) {
AbstractPowerAction apa; AbstractPowerAction apa;
String type = rs.action_type; String type = powerAction.action_type;
String IDString = rs.action_id; String IDString = powerAction.action_id;
int token = DbManager.hasher.SBStringHash(IDString); int token = DbManager.hasher.SBStringHash(IDString);
//cache token, used for applying effects. //cache token, used for applying effects.
PowersManager.ActionTokenByIDString.put(IDString, token); PowersManager.ActionTokenByIDString.put(IDString, token);
@ -147,100 +146,100 @@ public enum PowersManager {
Logger.error("valid type not found for poweraction of ID" + IDString); Logger.error("valid type not found for poweraction of ID" + IDString);
break; break;
case "ApplyEffect": case "ApplyEffect":
apa = new ApplyEffectPowerAction(rs, effects); apa = new ApplyEffectPowerAction(powerAction, effects);
break; break;
case "ApplyEffects": case "ApplyEffects":
apa = new ApplyEffectsPowerAction(rs, effects); apa = new ApplyEffectsPowerAction(powerAction, effects);
break; break;
case "DeferredPower": case "DeferredPower":
apa = new DeferredPowerPowerAction(rs, effects); apa = new DeferredPowerPowerAction(powerAction, effects);
break; break;
case "DamageOverTime": case "DamageOverTime":
apa = new DamageOverTimePowerAction(rs, effects); apa = new DamageOverTimePowerAction(powerAction, effects);
break; break;
case "Peek": case "Peek":
apa = new PeekPowerAction(rs); apa = new PeekPowerAction(powerAction);
break; break;
case "Charm": case "Charm":
apa = new CharmPowerAction(rs); apa = new CharmPowerAction(powerAction);
break; break;
case "Fear": case "Fear":
apa = new FearPowerAction(rs); apa = new FearPowerAction(powerAction);
break; break;
case "Confusion": case "Confusion":
apa = new ConfusionPowerAction(rs); apa = new ConfusionPowerAction(powerAction);
break; break;
case "RemoveEffect": case "RemoveEffect":
apa = new RemoveEffectPowerAction(rs); apa = new RemoveEffectPowerAction(powerAction);
break; break;
case "Track": case "Track":
apa = new TrackPowerAction(rs, effects); apa = new TrackPowerAction(powerAction, effects);
break; break;
case "DirectDamage": case "DirectDamage":
apa = new DirectDamagePowerAction(rs, effects); apa = new DirectDamagePowerAction(powerAction, effects);
break; break;
case "Transform": case "Transform":
apa = new TransformPowerAction(rs, effects); apa = new TransformPowerAction(powerAction, effects);
break; break;
case "CreateMob": case "CreateMob":
apa = new CreateMobPowerAction(rs); apa = new CreateMobPowerAction(powerAction);
break; break;
case "Invis": case "Invis":
apa = new InvisPowerAction(rs, effects); apa = new InvisPowerAction(powerAction, effects);
break; break;
case "ClearNearbyAggro": case "ClearNearbyAggro":
apa = new ClearNearbyAggroPowerAction(rs); apa = new ClearNearbyAggroPowerAction(powerAction);
break; break;
case "MobRecall": case "MobRecall":
apa = new MobRecallPowerAction(rs); apa = new MobRecallPowerAction(powerAction);
break; break;
case "SetItemFlag": case "SetItemFlag":
apa = new SetItemFlagPowerAction(rs); apa = new SetItemFlagPowerAction(powerAction);
break; break;
case "SimpleDamage": case "SimpleDamage":
apa = new SimpleDamagePowerAction(rs); apa = new SimpleDamagePowerAction(powerAction);
break; break;
case "TransferStatOT": case "TransferStatOT":
apa = new TransferStatOTPowerAction(rs, effects); apa = new TransferStatOTPowerAction(powerAction, effects);
break; break;
case "TransferStat": case "TransferStat":
apa = new TransferStatPowerAction(rs, effects); apa = new TransferStatPowerAction(powerAction, effects);
break; break;
case "Teleport": case "Teleport":
apa = new TeleportPowerAction(rs); apa = new TeleportPowerAction(powerAction);
break; break;
case "TreeChoke": case "TreeChoke":
apa = new TreeChokePowerAction(rs); apa = new TreeChokePowerAction(powerAction);
break; break;
case "Block": case "Block":
apa = new BlockPowerAction(rs); apa = new BlockPowerAction(powerAction);
break; break;
case "Resurrect": case "Resurrect":
apa = new ResurrectPowerAction(rs); apa = new ResurrectPowerAction(powerAction);
break; break;
case "ClearAggro": case "ClearAggro":
apa = new ClearAggroPowerAction(rs); apa = new ClearAggroPowerAction(powerAction);
break; break;
case "ClaimMine": case "ClaimMine":
apa = new ClaimMinePowerAction(rs); apa = new ClaimMinePowerAction(powerAction);
break; break;
case "Recall": case "Recall":
apa = new RecallPowerAction(rs); apa = new RecallPowerAction(powerAction);
break; break;
case "SpireDisable": case "SpireDisable":
apa = new SpireDisablePowerAction(rs); apa = new SpireDisablePowerAction(powerAction);
break; break;
case "Steal": case "Steal":
apa = new StealPowerAction(rs); apa = new StealPowerAction(powerAction);
break; break;
case "Summon": case "Summon":
apa = new SummonPowerAction(rs); apa = new SummonPowerAction(powerAction);
break; break;
case "RunegateTeleport": case "RunegateTeleport":
apa = new RunegateTeleportPowerAction(rs); apa = new RunegateTeleportPowerAction(powerAction);
break; break;
case "OpenGate": case "OpenGate":
apa = new OpenGatePowerAction(rs); apa = new OpenGatePowerAction(powerAction);
break; break;
} }
PowersManager.powerActionsByIDString.put(IDString, apa); PowersManager.powerActionsByIDString.put(IDString, apa);

2
src/engine/powers/poweractions/SimpleDamagePowerAction.java

@ -24,7 +24,7 @@ public class SimpleDamagePowerAction extends AbstractPowerAction {
public SimpleDamagePowerAction(PowerAction rs) { public SimpleDamagePowerAction(PowerAction rs) {
super(rs); super(rs);
this.simpleDamage = rs.getInt("simpleDamage"); this.simpleDamage = 1;
} }
public int getSimpleDamage() { public int getSimpleDamage() {

Loading…
Cancel
Save