Merge Damage and Source types.
This commit is contained in:
@@ -10,7 +10,6 @@
|
||||
package engine.powers;
|
||||
|
||||
import engine.Enum;
|
||||
import engine.Enum.DamageType;
|
||||
import engine.Enum.EffectSourceType;
|
||||
import engine.Enum.GameObjectType;
|
||||
import engine.Enum.PowerFailCondition;
|
||||
@@ -45,7 +44,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<DamageType>> EffectDamageTypes = new HashMap<>();
|
||||
public static HashMap<Integer, HashSet<Enum.SourceType>> 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;
|
||||
@@ -245,7 +244,7 @@ public class EffectsBase {
|
||||
damageType3 = "Pierce";
|
||||
if (damageType3.equalsIgnoreCase("Slashing"))
|
||||
damageType3 = "Slash";
|
||||
DamageType dt = getDamageType(damageType1);
|
||||
Enum.SourceType dt = getDamageType(damageType1);
|
||||
if (dt != null)
|
||||
EffectsBase.EffectDamageTypes.get(eb.token).add(dt);
|
||||
|
||||
@@ -301,27 +300,13 @@ public class EffectsBase {
|
||||
|
||||
}
|
||||
|
||||
private static DamageType getDamageType(String name) {
|
||||
try {
|
||||
switch (name) {
|
||||
case "Crushing":
|
||||
name = "Crush";
|
||||
break;
|
||||
case "Slashing":
|
||||
name = "Slash";
|
||||
break;
|
||||
case "Piercing":
|
||||
name = "Pierce";
|
||||
break;
|
||||
}
|
||||
if (name.isEmpty())
|
||||
return null;
|
||||
else
|
||||
return DamageType.valueOf(name);
|
||||
} catch (Exception e) {
|
||||
Logger.error(name);
|
||||
private static Enum.SourceType getDamageType(String name) {
|
||||
|
||||
if (name.isEmpty())
|
||||
return null;
|
||||
}
|
||||
else
|
||||
return Enum.SourceType.valueOf(name);
|
||||
|
||||
}
|
||||
|
||||
public static String getItemEffectsByName(String string) {
|
||||
@@ -351,7 +336,7 @@ public class EffectsBase {
|
||||
|
||||
}
|
||||
|
||||
public boolean containsDamageType(DamageType dt) {
|
||||
public boolean containsDamageType(Enum.SourceType dt) {
|
||||
if (!EffectsBase.EffectDamageTypes.containsKey(this.token))
|
||||
return false;
|
||||
return EffectsBase.EffectDamageTypes.get(this.token).contains(dt);
|
||||
@@ -742,7 +727,7 @@ public class EffectsBase {
|
||||
String text = "";
|
||||
if (!EffectsBase.EffectDamageTypes.containsKey(this.token))
|
||||
return text;
|
||||
for (DamageType type : EffectsBase.EffectDamageTypes.get(this.token)) {
|
||||
for (Enum.SourceType type : EffectsBase.EffectDamageTypes.get(this.token)) {
|
||||
text += type.name() + ' ';
|
||||
}
|
||||
return text;
|
||||
|
||||
Reference in New Issue
Block a user