Browse Source

Changed if/else tunnel to switch

pull/13/head
FatBoy-DOTC 3 years ago
parent
commit
c795238231
  1. 107
      src/engine/powers/poweractions/AbstractPowerAction.java

107
src/engine/powers/poweractions/AbstractPowerAction.java

@ -76,75 +76,108 @@ public abstract class AbstractPowerAction {
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);
if (type.equals("ApplyEffect")) apa = null;
switch (type)
{
default:
Logger.error("valid type not found for poweraction of ID" + rs.getInt("ID"));
break;
case "ApplyEffect":
apa = new ApplyEffectPowerAction(rs, effects); apa = new ApplyEffectPowerAction(rs, effects);
else if (type.equals("ApplyEffects")) break;
case "ApplyEffects":
apa = new ApplyEffectsPowerAction(rs, effects); apa = new ApplyEffectsPowerAction(rs, effects);
else if (type.equals("DeferredPower")) break;
case "DeferredPower":
apa = new DeferredPowerPowerAction(rs, effects); apa = new DeferredPowerPowerAction(rs, effects);
else if (type.equals("DamageOverTime")) break;
case "DamageOverTime":
apa = new DamageOverTimePowerAction(rs, effects); apa = new DamageOverTimePowerAction(rs, effects);
else if (type.equals("Peek")) break;
case "Peek":
apa = new PeekPowerAction(rs); apa = new PeekPowerAction(rs);
else if (type.equals("Charm")) break;
case "Charm":
apa = new CharmPowerAction(rs); apa = new CharmPowerAction(rs);
else if (type.equals("Fear")) break;
case "Fear":
apa = new FearPowerAction(rs); apa = new FearPowerAction(rs);
else if (type.equals("Confusion")) break;
case "Confusion":
apa = new ConfusionPowerAction(rs); apa = new ConfusionPowerAction(rs);
else if (type.equals("RemoveEffect")) break;
case "RemoveEffect":
apa = new RemoveEffectPowerAction(rs); apa = new RemoveEffectPowerAction(rs);
else if (type.equals("Track")) break;
case "Track":
apa = new TrackPowerAction(rs, effects); apa = new TrackPowerAction(rs, effects);
else if (type.equals("DirectDamage")) break;
case "DirectDamage":
apa = new DirectDamagePowerAction(rs, effects); apa = new DirectDamagePowerAction(rs, effects);
else if (type.equals("Transform")) break;
case "Transform":
apa = new TransformPowerAction(rs, effects); apa = new TransformPowerAction(rs, effects);
else if (type.equals("CreateMob")) break;
case "CreateMob":
apa = new CreateMobPowerAction(rs); apa = new CreateMobPowerAction(rs);
else if (type.equals("Invis")) break;
case "Invis":
apa = new InvisPowerAction(rs, effects); apa = new InvisPowerAction(rs, effects);
else if (type.equals("ClearNearbyAggro")) break;
case "ClearNearbyAggro":
apa = new ClearNearbyAggroPowerAction(rs); apa = new ClearNearbyAggroPowerAction(rs);
else if (type.equals("MobRecall")) break;
case "MobRecall":
apa = new MobRecallPowerAction(rs); apa = new MobRecallPowerAction(rs);
else if (type.equals("SetItemFlag")) break;
case "SetItemFlag":
apa = new SetItemFlagPowerAction(rs); apa = new SetItemFlagPowerAction(rs);
else if (type.equals("SimpleDamage")) break;
case "SimpleDamage":
apa = new SimpleDamagePowerAction(rs); apa = new SimpleDamagePowerAction(rs);
else if (type.equals("TransferStatOT")) break;
case "TransferStatOT":
apa = new TransferStatOTPowerAction(rs, effects); apa = new TransferStatOTPowerAction(rs, effects);
else if (type.equals("TransferStat")) break;
case "TransferStat":
apa = new TransferStatPowerAction(rs, effects); apa = new TransferStatPowerAction(rs, effects);
else if (type.equals("Teleport")) break;
case "Teleport":
apa = new TeleportPowerAction(rs); apa = new TeleportPowerAction(rs);
else if (type.equals("TreeChoke")) break;
case "TreeChoke":
apa = new TreeChokePowerAction(rs); apa = new TreeChokePowerAction(rs);
else if (type.equals("Block")) break;
case "Block":
apa = new BlockPowerAction(rs); apa = new BlockPowerAction(rs);
else if (type.equals("Resurrect")) break;
case "Resurrect":
apa = new ResurrectPowerAction(rs); apa = new ResurrectPowerAction(rs);
else if (type.equals("ClearAggro")) break;
case "ClearAggro":
apa = new ClearAggroPowerAction(rs); apa = new ClearAggroPowerAction(rs);
else if (type.equals("ClaimMine")) break;
case "ClaimMine":
apa = new ClaimMinePowerAction(rs); apa = new ClaimMinePowerAction(rs);
else if (type.equals("Recall")) break;
case "Recall":
apa = new RecallPowerAction(rs); apa = new RecallPowerAction(rs);
else if (type.equals("SpireDisable")) break;
case "SpireDisable":
apa = new SpireDisablePowerAction(rs); apa = new SpireDisablePowerAction(rs);
else if (type.equals("Steal")) break;
case "Steal":
apa = new StealPowerAction(rs); apa = new StealPowerAction(rs);
else if (type.equals("Summon")) break;
case "Summon":
apa = new SummonPowerAction(rs); apa = new SummonPowerAction(rs);
else if (type.equals("RunegateTeleport")) break;
apa = new RunegateTeleportPowerAction(rs); case "RunegateTeleport":
else if (type.equals("RunegateTeleport"))
apa = new RunegateTeleportPowerAction(rs); apa = new RunegateTeleportPowerAction(rs);
else if (type.equals("OpenGate")) break;
case "OpenGate":
apa = new OpenGatePowerAction(rs); apa = new OpenGatePowerAction(rs);
else { break;
Logger.error("valid type not found for poweraction of ID" + rs.getInt("ID"));
continue;
} }
powerActions.put(IDString, apa); powerActions.put(IDString, apa);
powerActionsByID.put(apa.UUID, apa); powerActionsByID.put(apa.UUID, apa);

Loading…
Cancel
Save