Browse Source

All damage type lookups go through method

combat-2
MagicBot 8 months ago
parent
commit
5ed497dd69
  1. 2
      src/engine/objects/ItemTemplate.java
  2. 2
      src/engine/objects/Resists.java
  3. 2
      src/engine/powers/effectmodifiers/DamageShieldEffectModifier.java
  4. 2
      src/engine/powers/effectmodifiers/HealthEffectModifier.java
  5. 2
      src/engine/powers/effectmodifiers/ManaEffectModifier.java
  6. 2
      src/engine/powers/effectmodifiers/StaminaEffectModifier.java
  7. 2
      src/engine/powers/poweractions/TransferStatPowerAction.java

2
src/engine/objects/ItemTemplate.java

@ -227,7 +227,7 @@ public class ItemTemplate {
if (weapon_damage.isEmpty() == false) if (weapon_damage.isEmpty() == false)
for (Object o : weapon_damage) { for (Object o : weapon_damage) {
JSONObject damage_entry = (JSONObject) o; 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 min = ((Long) damage_entry.get("damage_min")).intValue();
int max = ((Long) damage_entry.get("damage_max")).intValue(); int max = ((Long) damage_entry.get("damage_max")).intValue();
int[] minMax = {min, max}; int[] minMax = {min, max};

2
src/engine/objects/Resists.java

@ -135,7 +135,7 @@ public class Resists {
//Test if Damagetype is valid for foritude //Test if Damagetype is valid for foritude
private static boolean isValidDamageCapType(HashSet<SourceType> forts, Enum.DamageType damageType, boolean exclusive) { private static boolean isValidDamageCapType(HashSet<SourceType> forts, Enum.DamageType damageType, boolean exclusive) {
for (SourceType fort : forts) { 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)) if (dt.equals(Enum.DamageType.NONE))
continue; continue;

2
src/engine/powers/effectmodifiers/DamageShieldEffectModifier.java

@ -49,7 +49,7 @@ public class DamageShieldEffectModifier extends AbstractEffectModifier {
amount *= (1 + mod); amount *= (1 + mod);
} }
Enum.DamageType dt = Enum.DamageType.valueOf(this.type); Enum.DamageType dt = Enum.DamageType.GetDamageType(this.type);
if (dt != null) { if (dt != null) {

2
src/engine/powers/effectmodifiers/HealthEffectModifier.java

@ -34,7 +34,7 @@ public class HealthEffectModifier extends AbstractEffectModifier {
super(rs); super(rs);
String damageTypeDB = rs.getString("type"); String damageTypeDB = rs.getString("type");
try { try {
this.damageType = Enum.DamageType.valueOf(damageTypeDB); this.damageType = Enum.DamageType.GetDamageType(damageTypeDB);
} catch (IllegalArgumentException e) { } catch (IllegalArgumentException e) {
Logger.error("DamageType could not be loaded from database. " + "UUID = " + this.UUID Logger.error("DamageType could not be loaded from database. " + "UUID = " + this.UUID
+ " value received = '" + damageTypeDB.toUpperCase() + '\'', e); + " value received = '" + damageTypeDB.toUpperCase() + '\'', e);

2
src/engine/powers/effectmodifiers/ManaEffectModifier.java

@ -36,7 +36,7 @@ public class ManaEffectModifier extends AbstractEffectModifier {
super(rs); super(rs);
String damageTypeDB = rs.getString("type"); String damageTypeDB = rs.getString("type");
try { try {
this.damageType = Enum.DamageType.valueOf(damageTypeDB); this.damageType = Enum.DamageType.GetDamageType(damageTypeDB);
} catch (IllegalArgumentException e) { } catch (IllegalArgumentException e) {
Logger.error("DamageType could not be loaded from database. " + "UUID = " + this.UUID Logger.error("DamageType could not be loaded from database. " + "UUID = " + this.UUID
+ " value received = '" + damageTypeDB.toUpperCase() + '\'', e); + " value received = '" + damageTypeDB.toUpperCase() + '\'', e);

2
src/engine/powers/effectmodifiers/StaminaEffectModifier.java

@ -36,7 +36,7 @@ public class StaminaEffectModifier extends AbstractEffectModifier {
super(rs); super(rs);
String damageTypeDB = rs.getString("type"); String damageTypeDB = rs.getString("type");
try { try {
this.damageType = Enum.DamageType.valueOf(damageTypeDB); this.damageType = Enum.DamageType.GetDamageType(damageTypeDB);
} catch (IllegalArgumentException e) { } catch (IllegalArgumentException e) {
Logger.error("DamageType could not be loaded from database. " + "UUID = " + this.UUID Logger.error("DamageType could not be loaded from database. " + "UUID = " + this.UUID
+ " value received = '" + damageTypeDB.toUpperCase() + '\'', e); + " value received = '" + damageTypeDB.toUpperCase() + '\'', e);

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

@ -78,7 +78,7 @@ public class TransferStatPowerAction extends AbstractPowerAction {
// Damage type can sometimes be null in the DB. // Damage type can sometimes be null in the DB.
if (damageString.isEmpty() == false) if (damageString.isEmpty() == false)
this.damageType = Enum.DamageType.valueOf(damageString); this.damageType = Enum.DamageType.GetDamageType(damageString);
} catch (Exception e) { } catch (Exception e) {
this.damageType = null; this.damageType = null;
} }

Loading…
Cancel
Save