Renamed class to not conflict with the java.lang version.

This commit is contained in:
2024-04-05 07:59:44 -04:00
parent dd84615ca1
commit c1ee6f5b52
388 changed files with 1807 additions and 1779 deletions
+110 -110
View File
@@ -9,9 +9,9 @@
package engine.objects;
import engine.Enum;
import engine.Enum.ModType;
import engine.Enum.SourceType;
import engine.mbEnums;
import engine.mbEnums.ModType;
import engine.mbEnums.SourceType;
import engine.gameManager.ChatManager;
import engine.gameManager.DbManager;
import engine.server.MBServerStatics;
@@ -26,9 +26,9 @@ import java.util.concurrent.ConcurrentHashMap;
public class Resists {
private static ConcurrentHashMap<Integer, Resists> mobResists = new ConcurrentHashMap<>(MBServerStatics.CHM_INIT_CAP, MBServerStatics.CHM_LOAD, MBServerStatics.CHM_THREAD_LOW);
private ConcurrentHashMap<Enum.DamageType, Float> resists = new ConcurrentHashMap<>(MBServerStatics.CHM_INIT_CAP, MBServerStatics.CHM_LOAD, MBServerStatics.CHM_THREAD_LOW);
private ConcurrentHashMap<Enum.DamageType, Boolean> immuneTo = new ConcurrentHashMap<>(MBServerStatics.CHM_INIT_CAP, MBServerStatics.CHM_LOAD, MBServerStatics.CHM_THREAD_LOW);
private Enum.DamageType protection;
private ConcurrentHashMap<mbEnums.DamageType, Float> resists = new ConcurrentHashMap<>(MBServerStatics.CHM_INIT_CAP, MBServerStatics.CHM_LOAD, MBServerStatics.CHM_THREAD_LOW);
private ConcurrentHashMap<mbEnums.DamageType, Boolean> immuneTo = new ConcurrentHashMap<>(MBServerStatics.CHM_INIT_CAP, MBServerStatics.CHM_LOAD, MBServerStatics.CHM_THREAD_LOW);
private mbEnums.DamageType protection;
private int protectionTrains = 0;
private boolean immuneToAll;
@@ -51,9 +51,9 @@ public class Resists {
}
public Resists(Resists r) {
for (Enum.DamageType dt : r.resists.keySet())
for (mbEnums.DamageType dt : r.resists.keySet())
this.resists.put(dt, r.resists.get(dt));
for (Enum.DamageType dt : r.immuneTo.keySet())
for (mbEnums.DamageType dt : r.immuneTo.keySet())
this.immuneTo.put(dt, r.immuneTo.get(dt));
this.protection = r.protection;
this.protectionTrains = r.protectionTrains;
@@ -83,30 +83,30 @@ public class Resists {
*/
public Resists(ResultSet rs) throws SQLException {
this.immuneToAll = false;
this.resists.put(Enum.DamageType.SLASHING, rs.getFloat("slash"));
this.resists.put(Enum.DamageType.CRUSHING, rs.getFloat("crush"));
this.resists.put(Enum.DamageType.PIERCING, rs.getFloat("pierce"));
this.resists.put(Enum.DamageType.MAGIC, rs.getFloat("magic"));
this.resists.put(Enum.DamageType.BLEEDING, rs.getFloat("bleed"));
this.resists.put(Enum.DamageType.POISON, rs.getFloat("poison"));
this.resists.put(Enum.DamageType.MENTAL, rs.getFloat("mental"));
this.resists.put(Enum.DamageType.HOLY, rs.getFloat("holy"));
this.resists.put(Enum.DamageType.UNHOLY, rs.getFloat("unholy"));
this.resists.put(Enum.DamageType.LIGHTNING, rs.getFloat("lightning"));
this.resists.put(Enum.DamageType.FIRE, rs.getFloat("fire"));
this.resists.put(Enum.DamageType.COLD, rs.getFloat("cold"));
this.resists.put(Enum.DamageType.HEALING, 0f);
this.resists.put(mbEnums.DamageType.SLASHING, rs.getFloat("slash"));
this.resists.put(mbEnums.DamageType.CRUSHING, rs.getFloat("crush"));
this.resists.put(mbEnums.DamageType.PIERCING, rs.getFloat("pierce"));
this.resists.put(mbEnums.DamageType.MAGIC, rs.getFloat("magic"));
this.resists.put(mbEnums.DamageType.BLEEDING, rs.getFloat("bleed"));
this.resists.put(mbEnums.DamageType.POISON, rs.getFloat("poison"));
this.resists.put(mbEnums.DamageType.MENTAL, rs.getFloat("mental"));
this.resists.put(mbEnums.DamageType.HOLY, rs.getFloat("holy"));
this.resists.put(mbEnums.DamageType.UNHOLY, rs.getFloat("unholy"));
this.resists.put(mbEnums.DamageType.LIGHTNING, rs.getFloat("lightning"));
this.resists.put(mbEnums.DamageType.FIRE, rs.getFloat("fire"));
this.resists.put(mbEnums.DamageType.COLD, rs.getFloat("cold"));
this.resists.put(mbEnums.DamageType.HEALING, 0f);
}
//Handle Fortitudes
private static float handleFortitude(AbstractCharacter target, Enum.DamageType type, float damage) {
if (target == null || !(target.getObjectType().equals(Enum.GameObjectType.PlayerCharacter)))
private static float handleFortitude(AbstractCharacter target, mbEnums.DamageType type, float damage) {
if (target == null || !(target.getObjectType().equals(mbEnums.GameObjectType.PlayerCharacter)))
return damage;
PlayerBonuses bonus = target.getBonuses();
//see if there is a fortitude
float damageCap = bonus.getFloatPercentAll(ModType.DamageCap, SourceType.None);
if (damageCap == 0f || type == Enum.DamageType.HEALING)
if (damageCap == 0f || type == mbEnums.DamageType.HEALING)
return damage;
//is fortitude, Are we under the cap?
@@ -133,11 +133,11 @@ public class Resists {
}
//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, mbEnums.DamageType damageType, boolean exclusive) {
for (SourceType fort : forts) {
Enum.DamageType dt = Enum.DamageType.getDamageType(fort.name());
mbEnums.DamageType dt = mbEnums.DamageType.getDamageType(fort.name());
if (dt.equals(Enum.DamageType.NONE))
if (dt.equals(mbEnums.DamageType.NONE))
continue;
if (dt.equals(damageType)) {
@@ -162,7 +162,7 @@ public class Resists {
if (armor == null)
return phys;
if (armor.template.item_type.equals(Enum.ItemType.ARMOR)) {
if (armor.template.item_type.equals(mbEnums.ItemType.ARMOR)) {
phys[0] += armor.template.combat_attack_resist.get("SLASHING");
phys[1] += armor.template.combat_attack_resist.get("CRUSHING");
phys[2] += armor.template.combat_attack_resist.get("PIERCING");
@@ -195,19 +195,19 @@ public class Resists {
*/
public final void setBuildingResists() {
this.immuneToAll = false;
this.resists.put(Enum.DamageType.SLASHING, 85f);
this.resists.put(Enum.DamageType.CRUSHING, 85f);
this.resists.put(Enum.DamageType.SIEGE, 0f);
this.immuneTo.put(Enum.DamageType.PIERCING, true);
this.immuneTo.put(Enum.DamageType.MAGIC, true);
this.immuneTo.put(Enum.DamageType.BLEEDING, true);
this.immuneTo.put(Enum.DamageType.POISON, true);
this.immuneTo.put(Enum.DamageType.MENTAL, true);
this.immuneTo.put(Enum.DamageType.HOLY, true);
this.immuneTo.put(Enum.DamageType.UNHOLY, true);
this.immuneTo.put(Enum.DamageType.LIGHTNING, true);
this.immuneTo.put(Enum.DamageType.FIRE, true);
this.immuneTo.put(Enum.DamageType.COLD, true);
this.resists.put(mbEnums.DamageType.SLASHING, 85f);
this.resists.put(mbEnums.DamageType.CRUSHING, 85f);
this.resists.put(mbEnums.DamageType.SIEGE, 0f);
this.immuneTo.put(mbEnums.DamageType.PIERCING, true);
this.immuneTo.put(mbEnums.DamageType.MAGIC, true);
this.immuneTo.put(mbEnums.DamageType.BLEEDING, true);
this.immuneTo.put(mbEnums.DamageType.POISON, true);
this.immuneTo.put(mbEnums.DamageType.MENTAL, true);
this.immuneTo.put(mbEnums.DamageType.HOLY, true);
this.immuneTo.put(mbEnums.DamageType.UNHOLY, true);
this.immuneTo.put(mbEnums.DamageType.LIGHTNING, true);
this.immuneTo.put(mbEnums.DamageType.FIRE, true);
this.immuneTo.put(mbEnums.DamageType.COLD, true);
}
@@ -216,19 +216,19 @@ public class Resists {
*/
public final void setMineResists() {
this.immuneToAll = false;
this.immuneTo.put(Enum.DamageType.SLASHING, true);
this.immuneTo.put(Enum.DamageType.CRUSHING, true);
this.immuneTo.put(Enum.DamageType.PIERCING, true);
this.immuneTo.put(Enum.DamageType.MAGIC, true);
this.immuneTo.put(Enum.DamageType.BLEEDING, true);
this.immuneTo.put(Enum.DamageType.POISON, true);
this.immuneTo.put(Enum.DamageType.MENTAL, true);
this.immuneTo.put(Enum.DamageType.HOLY, true);
this.immuneTo.put(Enum.DamageType.UNHOLY, true);
this.immuneTo.put(Enum.DamageType.LIGHTNING, true);
this.immuneTo.put(Enum.DamageType.FIRE, true);
this.immuneTo.put(Enum.DamageType.COLD, true);
this.resists.put(Enum.DamageType.SIEGE, 0f);
this.immuneTo.put(mbEnums.DamageType.SLASHING, true);
this.immuneTo.put(mbEnums.DamageType.CRUSHING, true);
this.immuneTo.put(mbEnums.DamageType.PIERCING, true);
this.immuneTo.put(mbEnums.DamageType.MAGIC, true);
this.immuneTo.put(mbEnums.DamageType.BLEEDING, true);
this.immuneTo.put(mbEnums.DamageType.POISON, true);
this.immuneTo.put(mbEnums.DamageType.MENTAL, true);
this.immuneTo.put(mbEnums.DamageType.HOLY, true);
this.immuneTo.put(mbEnums.DamageType.UNHOLY, true);
this.immuneTo.put(mbEnums.DamageType.LIGHTNING, true);
this.immuneTo.put(mbEnums.DamageType.FIRE, true);
this.immuneTo.put(mbEnums.DamageType.COLD, true);
this.resists.put(mbEnums.DamageType.SIEGE, 0f);
}
/**
@@ -236,27 +236,27 @@ public class Resists {
*/
public final void setGenericResists() {
this.immuneToAll = false;
this.resists.put(Enum.DamageType.SLASHING, 0f);
this.resists.put(Enum.DamageType.CRUSHING, 0f);
this.resists.put(Enum.DamageType.PIERCING, 0f);
this.resists.put(Enum.DamageType.MAGIC, 0f);
this.resists.put(Enum.DamageType.BLEEDING, 0f);
this.resists.put(Enum.DamageType.POISON, 0f);
this.resists.put(Enum.DamageType.MENTAL, 0f);
this.resists.put(Enum.DamageType.HOLY, 0f);
this.resists.put(Enum.DamageType.UNHOLY, 0f);
this.resists.put(Enum.DamageType.LIGHTNING, 0f);
this.resists.put(Enum.DamageType.FIRE, 0f);
this.resists.put(Enum.DamageType.COLD, 0f);
this.resists.put(Enum.DamageType.HEALING, 0f);
this.immuneTo.put(Enum.DamageType.SIEGE, true);
this.resists.put(mbEnums.DamageType.SLASHING, 0f);
this.resists.put(mbEnums.DamageType.CRUSHING, 0f);
this.resists.put(mbEnums.DamageType.PIERCING, 0f);
this.resists.put(mbEnums.DamageType.MAGIC, 0f);
this.resists.put(mbEnums.DamageType.BLEEDING, 0f);
this.resists.put(mbEnums.DamageType.POISON, 0f);
this.resists.put(mbEnums.DamageType.MENTAL, 0f);
this.resists.put(mbEnums.DamageType.HOLY, 0f);
this.resists.put(mbEnums.DamageType.UNHOLY, 0f);
this.resists.put(mbEnums.DamageType.LIGHTNING, 0f);
this.resists.put(mbEnums.DamageType.FIRE, 0f);
this.resists.put(mbEnums.DamageType.COLD, 0f);
this.resists.put(mbEnums.DamageType.HEALING, 0f);
this.immuneTo.put(mbEnums.DamageType.SIEGE, true);
}
/**
* Get a resist
*/
public float getResist(Enum.DamageType type, int trains) {
public float getResist(mbEnums.DamageType type, int trains) {
//get resisted amount
Float amount = 0f;
if (this.resists.containsKey(type))
@@ -278,7 +278,7 @@ public class Resists {
/**
* get immuneTo
*/
public boolean immuneTo(Enum.DamageType type) {
public boolean immuneTo(mbEnums.DamageType type) {
if (this.immuneTo.containsKey(type))
return this.immuneTo.get(type);
else
@@ -293,13 +293,13 @@ public class Resists {
}
public boolean immuneToAttacks() {
return immuneTo(Enum.DamageType.ATTACK);
return immuneTo(mbEnums.DamageType.ATTACK);
}
/**
* Set a resist
*/
public void setResist(Enum.DamageType type, float value) {
public void setResist(mbEnums.DamageType type, float value) {
this.resists.put(type, value);
}
@@ -322,7 +322,7 @@ public class Resists {
* get Damage after resist
* Expects heals as negative damage and damage as positive damage for fortitudes.
*/
public float getResistedDamage(AbstractCharacter source, AbstractCharacter target, Enum.DamageType type, float damage, int trains) {
public float getResistedDamage(AbstractCharacter source, AbstractCharacter target, mbEnums.DamageType type, float damage, int trains) {
//handle fortitudes
damage = handleFortitude(target, type, damage);
@@ -347,25 +347,25 @@ public class Resists {
if (rb != null) {
// Handle immunities
if (rb.getBool(ModType.ImmuneTo, SourceType.Stun))
this.immuneTo.put(Enum.DamageType.STUN, true);
this.immuneTo.put(mbEnums.DamageType.STUN, true);
if (rb.getBool(ModType.ImmuneTo, SourceType.Blind))
this.immuneTo.put(Enum.DamageType.BLIND, true);
this.immuneTo.put(mbEnums.DamageType.BLIND, true);
if (rb.getBool(ModType.ImmuneToAttack, SourceType.None))
this.immuneTo.put(Enum.DamageType.ATTACK, true);
this.immuneTo.put(mbEnums.DamageType.ATTACK, true);
if (rb.getBool(ModType.ImmuneToPowers, SourceType.None))
this.immuneTo.put(Enum.DamageType.POWERS, true);
this.immuneTo.put(mbEnums.DamageType.POWERS, true);
if (rb.getBool(ModType.ImmuneTo, SourceType.Powerblock))
this.immuneTo.put(Enum.DamageType.POWERBLOCK, true);
this.immuneTo.put(mbEnums.DamageType.POWERBLOCK, true);
if (rb.getBool(ModType.ImmuneTo, SourceType.DeBuff))
this.immuneTo.put(Enum.DamageType.DEBUFF, true);
this.immuneTo.put(mbEnums.DamageType.DEBUFF, true);
if (rb.getBool(ModType.ImmuneTo, SourceType.Fear))
this.immuneTo.put(Enum.DamageType.FEAR, true);
this.immuneTo.put(mbEnums.DamageType.FEAR, true);
if (rb.getBool(ModType.ImmuneTo, SourceType.Charm))
this.immuneTo.put(Enum.DamageType.CHARM, true);
this.immuneTo.put(mbEnums.DamageType.CHARM, true);
if (rb.getBool(ModType.ImmuneTo, SourceType.Root))
this.immuneTo.put(Enum.DamageType.ROOT, true);
this.immuneTo.put(mbEnums.DamageType.ROOT, true);
if (rb.getBool(ModType.ImmuneTo, SourceType.Snare))
this.immuneTo.put(Enum.DamageType.SNARE, true);
this.immuneTo.put(mbEnums.DamageType.SNARE, true);
// Handle resists
slash += rb.getFloat(ModType.Resistance, SourceType.Slashing);
@@ -385,18 +385,18 @@ public class Resists {
}
// get resists from equipment
if (ac.getObjectType().equals(Enum.GameObjectType.PlayerCharacter)) {
if (ac.getObjectType().equals(mbEnums.GameObjectType.PlayerCharacter)) {
if (ac.charItemManager != null && ac.charItemManager.getEquipped() != null) {
float[] phys = {0f, 0f, 0f};
ConcurrentHashMap<Enum.EquipSlotType, Item> equip = ac.charItemManager.getEquipped();
ConcurrentHashMap<mbEnums.EquipSlotType, Item> equip = ac.charItemManager.getEquipped();
// get base physical resists
phys = Resists.getArmorResists(equip.get(Enum.EquipSlotType.HELM), phys);
phys = Resists.getArmorResists(equip.get(Enum.EquipSlotType.CHEST), phys);
phys = Resists.getArmorResists(equip.get(Enum.EquipSlotType.UPARM), phys);
phys = Resists.getArmorResists(equip.get(Enum.EquipSlotType.HANDS), phys);
phys = Resists.getArmorResists(equip.get(Enum.EquipSlotType.LEGS), phys);
phys = Resists.getArmorResists(equip.get(Enum.EquipSlotType.FEET), phys);
phys = Resists.getArmorResists(equip.get(mbEnums.EquipSlotType.HELM), phys);
phys = Resists.getArmorResists(equip.get(mbEnums.EquipSlotType.CHEST), phys);
phys = Resists.getArmorResists(equip.get(mbEnums.EquipSlotType.UPARM), phys);
phys = Resists.getArmorResists(equip.get(mbEnums.EquipSlotType.HANDS), phys);
phys = Resists.getArmorResists(equip.get(mbEnums.EquipSlotType.LEGS), phys);
phys = Resists.getArmorResists(equip.get(mbEnums.EquipSlotType.FEET), phys);
slash += phys[0];
crush += phys[1];
pierce += phys[2];
@@ -404,30 +404,30 @@ public class Resists {
}
}
this.resists.put(Enum.DamageType.SLASHING, slash);
this.resists.put(Enum.DamageType.CRUSHING, crush);
this.resists.put(Enum.DamageType.PIERCING, pierce);
this.resists.put(Enum.DamageType.MAGIC, magic);
this.resists.put(Enum.DamageType.BLEEDING, bleed);
this.resists.put(Enum.DamageType.POISON, poison);
this.resists.put(Enum.DamageType.MENTAL, mental);
this.resists.put(Enum.DamageType.HOLY, holy);
this.resists.put(Enum.DamageType.UNHOLY, unholy);
this.resists.put(Enum.DamageType.LIGHTNING, lightning);
this.resists.put(Enum.DamageType.FIRE, fire);
this.resists.put(Enum.DamageType.COLD, cold);
this.resists.put(Enum.DamageType.HEALING, healing);
this.resists.put(mbEnums.DamageType.SLASHING, slash);
this.resists.put(mbEnums.DamageType.CRUSHING, crush);
this.resists.put(mbEnums.DamageType.PIERCING, pierce);
this.resists.put(mbEnums.DamageType.MAGIC, magic);
this.resists.put(mbEnums.DamageType.BLEEDING, bleed);
this.resists.put(mbEnums.DamageType.POISON, poison);
this.resists.put(mbEnums.DamageType.MENTAL, mental);
this.resists.put(mbEnums.DamageType.HOLY, holy);
this.resists.put(mbEnums.DamageType.UNHOLY, unholy);
this.resists.put(mbEnums.DamageType.LIGHTNING, lightning);
this.resists.put(mbEnums.DamageType.FIRE, fire);
this.resists.put(mbEnums.DamageType.COLD, cold);
this.resists.put(mbEnums.DamageType.HEALING, healing);
this.immuneTo.put(Enum.DamageType.SIEGE, true);
this.immuneTo.put(mbEnums.DamageType.SIEGE, true);
// debug printing of resists
// printResists(pc);
}
public void printResistsToClient(PlayerCharacter pc) {
for (Enum.DamageType dt : resists.keySet())
for (mbEnums.DamageType dt : resists.keySet())
ChatManager.chatSystemInfo(pc, " resist." + dt.name() + ": " + resists.get(dt));
for (Enum.DamageType dt : immuneTo.keySet())
for (mbEnums.DamageType dt : immuneTo.keySet())
ChatManager.chatSystemInfo(pc, " immuneTo." + dt.name() + ": " + immuneTo.get(dt));
ChatManager.chatSystemInfo(pc, " immuneToAll: " + this.immuneToAll);
if (protection != null)
@@ -440,9 +440,9 @@ public class Resists {
String out = pc.getName();
out += "Resists: ";
Iterator<Enum.DamageType> it = this.resists.keySet().iterator();
Iterator<mbEnums.DamageType> it = this.resists.keySet().iterator();
while (it.hasNext()) {
Enum.DamageType damType = it.next();
mbEnums.DamageType damType = it.next();
String dtName = damType.name();
out += dtName + '=' + this.resists.get(dtName) + ", ";
}
@@ -450,7 +450,7 @@ public class Resists {
out += "ImmuneTo: ";
it = this.immuneTo.keySet().iterator();
while (it.hasNext()) {
Enum.DamageType damType = it.next();
mbEnums.DamageType damType = it.next();
String dtName = damType.name();
out += dtName + '=' + this.resists.get(dtName) + ", ";