Browse Source

Effectbase updated with new enum

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

2
src/engine/Enum.java

@ -759,7 +759,7 @@ public class Enum { @@ -759,7 +759,7 @@ public class Enum {
STEAL,
DRAIN;
public static DamageType GetDamageType(String modName) {
public static DamageType getDamageType(String modName) {
DamageType damageType;
if (modName.isEmpty())
return DamageType.NONE;

2
src/engine/objects/ItemTemplate.java

@ -227,7 +227,7 @@ public class ItemTemplate { @@ -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.GetDamageType(((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};

2
src/engine/objects/Resists.java

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

19
src/engine/powers/EffectsBase.java

@ -46,7 +46,7 @@ public class EffectsBase { @@ -46,7 +46,7 @@ public class EffectsBase {
public static HashMap<String, HashMap<String, ArrayList<String>>> NewEffectsMap = new HashMap<>();
public static HashMap<String, HashMap<String, ArrayList<String>>> ChangedEffectsMap = new HashMap<>();
public static HashMap<String, HashSet<PowerFailCondition>> EffectFailConditions = new HashMap<>();
public static HashMap<Integer, HashSet<Enum.SourceType>> EffectDamageTypes = new HashMap<>();
public static HashMap<Integer, HashSet<Enum.DamageType>> EffectDamageTypes = new HashMap<>();
public static HashSet<AbstractEffectModifier> DefaultModifiers = new HashSet<>();
private static ConcurrentHashMap<String, String> itemEffectsByName = new ConcurrentHashMap<>(MBServerStatics.CHM_INIT_CAP, MBServerStatics.CHM_LOAD, MBServerStatics.CHM_THREAD_LOW);
private static int NewID = 3000;
@ -224,14 +224,14 @@ public class EffectsBase { @@ -224,14 +224,14 @@ public class EffectsBase {
if (!EffectsBase.EffectDamageTypes.containsKey(eb.getToken()))
EffectsBase.EffectDamageTypes.put(eb.getToken(), new HashSet<>());
Enum.SourceType dt = getDamageType(damageType1);
Enum.DamageType dt = Enum.DamageType.getDamageType(damageType1);
if (dt != null)
EffectsBase.EffectDamageTypes.get(eb.token).add(dt);
dt = getDamageType(damageType2);
dt = Enum.DamageType.getDamageType(damageType2);
if (dt != null)
EffectsBase.EffectDamageTypes.get(eb.token).add(dt);
dt = getDamageType(damageType3);
dt = Enum.DamageType.getDamageType(damageType3);
if (dt != null)
EffectsBase.EffectDamageTypes.get(eb.token).add(dt);
break;
@ -277,15 +277,6 @@ public class EffectsBase { @@ -277,15 +277,6 @@ public class EffectsBase {
}
}
private static Enum.SourceType getDamageType(String name) {
if (name.isEmpty())
return null;
else
return Enum.SourceType.valueOf(name.toUpperCase());
}
public static String getItemEffectsByName(String string) {
if (EffectsBase.itemEffectsByName.containsKey(string))
return EffectsBase.itemEffectsByName.get(string);
@ -704,7 +695,7 @@ public class EffectsBase { @@ -704,7 +695,7 @@ public class EffectsBase {
String text = "";
if (!EffectsBase.EffectDamageTypes.containsKey(this.token))
return text;
for (Enum.SourceType type : EffectsBase.EffectDamageTypes.get(this.token)) {
for (Enum.DamageType type : EffectsBase.EffectDamageTypes.get(this.token)) {
text += type.name() + ' ';
}
return text;

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

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

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

@ -34,7 +34,7 @@ public class HealthEffectModifier extends AbstractEffectModifier { @@ -34,7 +34,7 @@ public class HealthEffectModifier extends AbstractEffectModifier {
super(rs);
String damageTypeDB = rs.getString("type");
try {
this.damageType = Enum.DamageType.GetDamageType(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);

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

@ -36,7 +36,7 @@ public class ManaEffectModifier extends AbstractEffectModifier { @@ -36,7 +36,7 @@ public class ManaEffectModifier extends AbstractEffectModifier {
super(rs);
String damageTypeDB = rs.getString("type");
try {
this.damageType = Enum.DamageType.GetDamageType(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);

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

@ -36,7 +36,7 @@ public class StaminaEffectModifier extends AbstractEffectModifier { @@ -36,7 +36,7 @@ public class StaminaEffectModifier extends AbstractEffectModifier {
super(rs);
String damageTypeDB = rs.getString("type");
try {
this.damageType = Enum.DamageType.GetDamageType(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);

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

@ -78,7 +78,7 @@ public class TransferStatPowerAction extends AbstractPowerAction { @@ -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.GetDamageType(damageString);
this.damageType = Enum.DamageType.getDamageType(damageString);
} catch (Exception e) {
this.damageType = null;
}

Loading…
Cancel
Save