From 176326697216ff93834d13e299c0d8e5709bcf5c Mon Sep 17 00:00:00 2001 From: MagicBot Date: Mon, 26 Feb 2024 15:18:03 -0500 Subject: [PATCH] toUppercase() --- src/engine/Enum.java | 2 +- src/engine/objects/ItemBase.java | 2 +- src/engine/objects/ItemTemplate.java | 2 +- src/engine/objects/Resists.java | 2 +- src/engine/powers/EffectsBase.java | 2 +- .../powers/effectmodifiers/BlackMantleEffectModifier.java | 2 +- .../powers/effectmodifiers/DamageShieldEffectModifier.java | 5 ++++- src/engine/powers/effectmodifiers/HealthEffectModifier.java | 4 ++-- src/engine/powers/effectmodifiers/ManaEffectModifier.java | 4 ++-- src/engine/powers/effectmodifiers/StaminaEffectModifier.java | 4 ++-- src/engine/powers/poweractions/TransferStatPowerAction.java | 2 +- 11 files changed, 17 insertions(+), 14 deletions(-) diff --git a/src/engine/Enum.java b/src/engine/Enum.java index acacd654..5769e733 100644 --- a/src/engine/Enum.java +++ b/src/engine/Enum.java @@ -920,7 +920,7 @@ public class Enum { return SourceType.NONE; try { - returnMod = SourceType.valueOf(modName.replace(",", "")); + returnMod = SourceType.valueOf(modName.replace(",", "").toUpperCase()); } catch (Exception e) { Logger.error(modName); Logger.error(e); diff --git a/src/engine/objects/ItemBase.java b/src/engine/objects/ItemBase.java index 8302ea70..220416b3 100644 --- a/src/engine/objects/ItemBase.java +++ b/src/engine/objects/ItemBase.java @@ -132,7 +132,7 @@ public class ItemBase { this.requiredDiscs = DbManager.parseEnumSet(rs.getString("disc_required"), Enum.DisciplineType.class); this.mastery = rs.getString("mastery"); - damageType = Enum.SourceType.valueOf(rs.getString("damageType")); + damageType = Enum.SourceType.valueOf(rs.getString("damageType").toUpperCase()); this.twoHanded = (rs.getInt("twoHanded") == 1); diff --git a/src/engine/objects/ItemTemplate.java b/src/engine/objects/ItemTemplate.java index 73206307..bc99cece 100644 --- a/src/engine/objects/ItemTemplate.java +++ b/src/engine/objects/ItemTemplate.java @@ -169,7 +169,7 @@ public class ItemTemplate { for (Object o : weapon_damage) { JSONObject damage_entry = (JSONObject) o; - item_weapon_damage_type = Enum.SourceType.valueOf((String) damage_entry.get("damage_type")); + item_weapon_damage_type = Enum.SourceType.valueOf(((String) damage_entry.get("damage_type")).toUpperCase()); item_weapon_damage_min = ((Long) damage_entry.get("damage_min")).intValue(); item_weapon_damage_max = ((Long) damage_entry.get("damage_max")).intValue(); } diff --git a/src/engine/objects/Resists.java b/src/engine/objects/Resists.java index 1d090a6e..0db1cdd1 100644 --- a/src/engine/objects/Resists.java +++ b/src/engine/objects/Resists.java @@ -136,7 +136,7 @@ public class Resists { //Test if Damagetype is valid for foritude private static boolean isValidDamageCapType(HashSet forts, SourceType damageType, boolean exclusive) { for (SourceType fort : forts) { - SourceType dt = SourceType.valueOf(fort.name()); + SourceType dt = SourceType.valueOf(fort.name().toUpperCase()); if (dt == SourceType.NONE) continue; diff --git a/src/engine/powers/EffectsBase.java b/src/engine/powers/EffectsBase.java index 025a2d13..20150e90 100644 --- a/src/engine/powers/EffectsBase.java +++ b/src/engine/powers/EffectsBase.java @@ -285,7 +285,7 @@ public class EffectsBase { if (name.isEmpty()) return null; else - return Enum.SourceType.valueOf(name); + return Enum.SourceType.valueOf(name.toUpperCase()); } diff --git a/src/engine/powers/effectmodifiers/BlackMantleEffectModifier.java b/src/engine/powers/effectmodifiers/BlackMantleEffectModifier.java index 5619e98f..69c199d9 100644 --- a/src/engine/powers/effectmodifiers/BlackMantleEffectModifier.java +++ b/src/engine/powers/effectmodifiers/BlackMantleEffectModifier.java @@ -33,7 +33,7 @@ public class BlackMantleEffectModifier extends AbstractEffectModifier { @Override public void applyBonus(AbstractCharacter ac, int trains) { PlayerBonuses bonus = ac.getBonuses(); - SourceType sourceType = SourceType.valueOf(this.type); + SourceType sourceType = SourceType.valueOf(this.type.toUpperCase()); if (sourceType == null) { Logger.error("Bad Source Type for " + this.type); diff --git a/src/engine/powers/effectmodifiers/DamageShieldEffectModifier.java b/src/engine/powers/effectmodifiers/DamageShieldEffectModifier.java index 48bda5db..6d3f8f38 100644 --- a/src/engine/powers/effectmodifiers/DamageShieldEffectModifier.java +++ b/src/engine/powers/effectmodifiers/DamageShieldEffectModifier.java @@ -48,11 +48,14 @@ public class DamageShieldEffectModifier extends AbstractEffectModifier { amount *= (1 + mod); } - Enum.SourceType dt = Enum.SourceType.valueOf(this.type); + Enum.SourceType dt = Enum.SourceType.valueOf(this.type.toUpperCase()); if (dt != null) { + DamageShield ds = new DamageShield(dt, amount, usePercent); + PlayerBonuses bonus = ac.getBonuses(); + if (bonus != null) bonus.addDamageShield(this, ds); } diff --git a/src/engine/powers/effectmodifiers/HealthEffectModifier.java b/src/engine/powers/effectmodifiers/HealthEffectModifier.java index 443fd67d..89e0c366 100644 --- a/src/engine/powers/effectmodifiers/HealthEffectModifier.java +++ b/src/engine/powers/effectmodifiers/HealthEffectModifier.java @@ -33,10 +33,10 @@ public class HealthEffectModifier extends AbstractEffectModifier { super(rs); String damageTypeDB = rs.getString("type"); try { - this.damageType = SourceType.valueOf(damageTypeDB); + this.damageType = SourceType.valueOf(damageTypeDB.toUpperCase()); } catch (IllegalArgumentException e) { Logger.error("DamageType could not be loaded from database. " + "UUID = " + this.UUID - + " value received = '" + damageTypeDB + '\'', e); + + " value received = '" + damageTypeDB.toUpperCase() + '\'', e); } } diff --git a/src/engine/powers/effectmodifiers/ManaEffectModifier.java b/src/engine/powers/effectmodifiers/ManaEffectModifier.java index d6f9aa3b..aa2ab6d3 100644 --- a/src/engine/powers/effectmodifiers/ManaEffectModifier.java +++ b/src/engine/powers/effectmodifiers/ManaEffectModifier.java @@ -37,10 +37,10 @@ public class ManaEffectModifier extends AbstractEffectModifier { super(rs); String damageTypeDB = rs.getString("type"); try { - this.damageType = SourceType.valueOf(damageTypeDB); + this.damageType = SourceType.valueOf(damageTypeDB.toUpperCase()); } catch (IllegalArgumentException e) { Logger.error("DamageType could not be loaded from database. " + "UUID = " + this.UUID - + " value received = '" + damageTypeDB + '\'', e); + + " value received = '" + damageTypeDB.toUpperCase() + '\'', e); } } diff --git a/src/engine/powers/effectmodifiers/StaminaEffectModifier.java b/src/engine/powers/effectmodifiers/StaminaEffectModifier.java index 08a5d556..551f3ea1 100644 --- a/src/engine/powers/effectmodifiers/StaminaEffectModifier.java +++ b/src/engine/powers/effectmodifiers/StaminaEffectModifier.java @@ -37,10 +37,10 @@ public class StaminaEffectModifier extends AbstractEffectModifier { super(rs); String damageTypeDB = rs.getString("type"); try { - this.damageType = SourceType.valueOf(damageTypeDB); + this.damageType = SourceType.valueOf(damageTypeDB.toUpperCase()); } catch (IllegalArgumentException e) { Logger.error("DamageType could not be loaded from database. " + "UUID = " + this.UUID - + " value received = '" + damageTypeDB + '\'', e); + + " value received = '" + damageTypeDB.toUpperCase() + '\'', e); } } diff --git a/src/engine/powers/poweractions/TransferStatPowerAction.java b/src/engine/powers/poweractions/TransferStatPowerAction.java index 60f4df7b..bd8015d1 100644 --- a/src/engine/powers/poweractions/TransferStatPowerAction.java +++ b/src/engine/powers/poweractions/TransferStatPowerAction.java @@ -79,7 +79,7 @@ public class TransferStatPowerAction extends AbstractPowerAction { // Damage type can sometimes be null in the DB. if (damageString.isEmpty() == false) - this.damageType = SourceType.valueOf(damageString); + this.damageType = SourceType.valueOf(damageString.toUpperCase()); } catch (Exception e) { this.damageType = null; }