From 5ed497dd69660fea3af266b512d72c49382a7cdb Mon Sep 17 00:00:00 2001 From: MagicBot Date: Mon, 1 Apr 2024 12:35:44 -0400 Subject: [PATCH] All damage type lookups go through method --- src/engine/objects/ItemTemplate.java | 2 +- src/engine/objects/Resists.java | 2 +- .../powers/effectmodifiers/DamageShieldEffectModifier.java | 2 +- src/engine/powers/effectmodifiers/HealthEffectModifier.java | 2 +- src/engine/powers/effectmodifiers/ManaEffectModifier.java | 2 +- src/engine/powers/effectmodifiers/StaminaEffectModifier.java | 2 +- src/engine/powers/poweractions/TransferStatPowerAction.java | 2 +- 7 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/engine/objects/ItemTemplate.java b/src/engine/objects/ItemTemplate.java index 16ef53d8..dd1d861a 100644 --- a/src/engine/objects/ItemTemplate.java +++ b/src/engine/objects/ItemTemplate.java @@ -227,7 +227,7 @@ public class ItemTemplate { if (weapon_damage.isEmpty() == false) for (Object o : weapon_damage) { JSONObject damage_entry = (JSONObject) o; - Enum.DamageType damageType = Enum.DamageType.valueOf(((String) damage_entry.get("damage_type"))); + Enum.DamageType damageType = Enum.DamageType.GetDamageType(((String) damage_entry.get("damage_type"))); int min = ((Long) damage_entry.get("damage_min")).intValue(); int max = ((Long) damage_entry.get("damage_max")).intValue(); int[] minMax = {min, max}; diff --git a/src/engine/objects/Resists.java b/src/engine/objects/Resists.java index a6148e71..15cb5b9e 100644 --- a/src/engine/objects/Resists.java +++ b/src/engine/objects/Resists.java @@ -135,7 +135,7 @@ public class Resists { //Test if Damagetype is valid for foritude private static boolean isValidDamageCapType(HashSet forts, Enum.DamageType damageType, boolean exclusive) { for (SourceType fort : forts) { - Enum.DamageType dt = Enum.DamageType.valueOf(fort.name()); + Enum.DamageType dt = Enum.DamageType.GetDamageType(fort.name()); if (dt.equals(Enum.DamageType.NONE)) continue; diff --git a/src/engine/powers/effectmodifiers/DamageShieldEffectModifier.java b/src/engine/powers/effectmodifiers/DamageShieldEffectModifier.java index 3de83656..2059e90d 100644 --- a/src/engine/powers/effectmodifiers/DamageShieldEffectModifier.java +++ b/src/engine/powers/effectmodifiers/DamageShieldEffectModifier.java @@ -49,7 +49,7 @@ public class DamageShieldEffectModifier extends AbstractEffectModifier { amount *= (1 + mod); } - Enum.DamageType dt = Enum.DamageType.valueOf(this.type); + Enum.DamageType dt = Enum.DamageType.GetDamageType(this.type); if (dt != null) { diff --git a/src/engine/powers/effectmodifiers/HealthEffectModifier.java b/src/engine/powers/effectmodifiers/HealthEffectModifier.java index 0c82a834..89a010d6 100644 --- a/src/engine/powers/effectmodifiers/HealthEffectModifier.java +++ b/src/engine/powers/effectmodifiers/HealthEffectModifier.java @@ -34,7 +34,7 @@ public class HealthEffectModifier extends AbstractEffectModifier { super(rs); String damageTypeDB = rs.getString("type"); try { - this.damageType = Enum.DamageType.valueOf(damageTypeDB); + this.damageType = Enum.DamageType.GetDamageType(damageTypeDB); } catch (IllegalArgumentException e) { Logger.error("DamageType could not be loaded from database. " + "UUID = " + this.UUID + " value received = '" + damageTypeDB.toUpperCase() + '\'', e); diff --git a/src/engine/powers/effectmodifiers/ManaEffectModifier.java b/src/engine/powers/effectmodifiers/ManaEffectModifier.java index 7f70c63d..28544b86 100644 --- a/src/engine/powers/effectmodifiers/ManaEffectModifier.java +++ b/src/engine/powers/effectmodifiers/ManaEffectModifier.java @@ -36,7 +36,7 @@ public class ManaEffectModifier extends AbstractEffectModifier { super(rs); String damageTypeDB = rs.getString("type"); try { - this.damageType = Enum.DamageType.valueOf(damageTypeDB); + this.damageType = Enum.DamageType.GetDamageType(damageTypeDB); } catch (IllegalArgumentException e) { Logger.error("DamageType could not be loaded from database. " + "UUID = " + this.UUID + " value received = '" + damageTypeDB.toUpperCase() + '\'', e); diff --git a/src/engine/powers/effectmodifiers/StaminaEffectModifier.java b/src/engine/powers/effectmodifiers/StaminaEffectModifier.java index bc73622e..0ee02aa2 100644 --- a/src/engine/powers/effectmodifiers/StaminaEffectModifier.java +++ b/src/engine/powers/effectmodifiers/StaminaEffectModifier.java @@ -36,7 +36,7 @@ public class StaminaEffectModifier extends AbstractEffectModifier { super(rs); String damageTypeDB = rs.getString("type"); try { - this.damageType = Enum.DamageType.valueOf(damageTypeDB); + this.damageType = Enum.DamageType.GetDamageType(damageTypeDB); } catch (IllegalArgumentException e) { Logger.error("DamageType could not be loaded from database. " + "UUID = " + this.UUID + " value received = '" + damageTypeDB.toUpperCase() + '\'', e); diff --git a/src/engine/powers/poweractions/TransferStatPowerAction.java b/src/engine/powers/poweractions/TransferStatPowerAction.java index 3f78d408..986064ac 100644 --- a/src/engine/powers/poweractions/TransferStatPowerAction.java +++ b/src/engine/powers/poweractions/TransferStatPowerAction.java @@ -78,7 +78,7 @@ public class TransferStatPowerAction extends AbstractPowerAction { // Damage type can sometimes be null in the DB. if (damageString.isEmpty() == false) - this.damageType = Enum.DamageType.valueOf(damageString); + this.damageType = Enum.DamageType.GetDamageType(damageString); } catch (Exception e) { this.damageType = null; }