Browse Source

Refactored poweractions

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

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

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

Loading…
Cancel
Save