DamageType defined as in JSON

This commit is contained in:
2024-04-01 12:01:59 -04:00
parent a29269e335
commit 14ee83e147
4 changed files with 120 additions and 121 deletions
+35 -36
View File
@@ -725,51 +725,50 @@ public class Enum {
} }
public enum DamageType { public enum DamageType {
None, NONE,
Crush, CRUSHING,
Slash, SLASHING,
Siege, SIEGE,
Pierce, PIERCE,
Magic, MAGIC,
Bleed, BLEEDING,
Poison, POISON,
Mental, MENTAL,
Holy, HOLY,
Unholy, UNHOLY,
Lightning, LIGHTNING,
Fire, FIRE,
Cold, COLD,
Healing, HEALING,
Acid, ACID,
Disease, DISEASE,
Unknown, UNKNOWN,
// these added for immunities // these added for immunities
Attack, ATTACK,
Powers, POWERS,
Combat, COMBAT,
Spires, SPIRES,
Snare, SNARE,
Stun, STUN,
Blind, BLIND,
Root, ROOT,
Fear, FEAR,
Charm, CHARM,
PowerBlock, POWERBLOCK,
DeBuff, DEBUFF,
Powerblock, STEAL,
Steel, DRAIN;
Drain;
public static DamageType GetDamageType(String modName) { public static DamageType GetDamageType(String modName) {
DamageType damageType; DamageType damageType;
if (modName.isEmpty()) if (modName.isEmpty())
return DamageType.None; return DamageType.NONE;
try { try {
damageType = DamageType.valueOf(modName.replace(",", "")); damageType = DamageType.valueOf(modName.replace(",", "").toUpperCase());
} catch (Exception e) { } catch (Exception e) {
Logger.error(e); Logger.error(e);
return DamageType.None; return DamageType.NONE;
} }
return damageType; return damageType;
} }
+2 -2
View File
@@ -213,10 +213,10 @@ public enum CombatManager {
Enum.DamageType damageType; Enum.DamageType damageType;
if (attacker.charItemManager.getEquipped().get(slot) == null) { if (attacker.charItemManager.getEquipped().get(slot) == null) {
damageType = Enum.DamageType.Crush; damageType = Enum.DamageType.CRUSHING;
if (attacker.getObjectType().equals(Enum.GameObjectType.Mob)) if (attacker.getObjectType().equals(Enum.GameObjectType.Mob))
if (((Mob) attacker).isSiege()) if (((Mob) attacker).isSiege())
damageType = Enum.DamageType.Siege; damageType = Enum.DamageType.SIEGE;
} else { } else {
damageType = (Enum.DamageType) attacker.charItemManager.getEquipped().get(slot).template.item_weapon_damage.keySet().toArray()[0]; damageType = (Enum.DamageType) attacker.charItemManager.getEquipped().get(slot).template.item_weapon_damage.keySet().toArray()[0];
} }
+3 -3
View File
@@ -433,9 +433,9 @@ public enum NPCManager {
for (Item equipped : mob.charItemManager.equipped.values()) { for (Item equipped : mob.charItemManager.equipped.values()) {
if (equipped.template.item_type.equals(Enum.ItemType.ARMOR)) { if (equipped.template.item_type.equals(Enum.ItemType.ARMOR)) {
mob.resists.setResist(Enum.DamageType.Slash, mob.resists.getResist(Enum.DamageType.Slash, 0) + equipped.template.combat_attack_resist.get("SLASHING")); mob.resists.setResist(Enum.DamageType.SLASHING, mob.resists.getResist(Enum.DamageType.SLASHING, 0) + equipped.template.combat_attack_resist.get("SLASHING"));
mob.resists.setResist(Enum.DamageType.Crush, mob.resists.getResist(Enum.DamageType.Crush, 0) + equipped.template.combat_attack_resist.get("CRUSHING")); mob.resists.setResist(Enum.DamageType.CRUSHING, mob.resists.getResist(Enum.DamageType.CRUSHING, 0) + equipped.template.combat_attack_resist.get("CRUSHING"));
mob.resists.setResist(Enum.DamageType.Pierce, mob.resists.getResist(Enum.DamageType.Pierce, 0) + equipped.template.combat_attack_resist.get("PIERCING")); mob.resists.setResist(Enum.DamageType.PIERCE, mob.resists.getResist(Enum.DamageType.PIERCE, 0) + equipped.template.combat_attack_resist.get("PIERCING"));
} }
} }
} }
+80 -80
View File
@@ -83,19 +83,19 @@ public class Resists {
*/ */
public Resists(ResultSet rs) throws SQLException { public Resists(ResultSet rs) throws SQLException {
this.immuneToAll = false; this.immuneToAll = false;
this.resists.put(Enum.DamageType.Slash, rs.getFloat("slash")); this.resists.put(Enum.DamageType.SLASHING, rs.getFloat("slash"));
this.resists.put(Enum.DamageType.Crush, rs.getFloat("crush")); this.resists.put(Enum.DamageType.CRUSHING, rs.getFloat("crush"));
this.resists.put(Enum.DamageType.Pierce, rs.getFloat("pierce")); this.resists.put(Enum.DamageType.PIERCE, rs.getFloat("pierce"));
this.resists.put(Enum.DamageType.Magic, rs.getFloat("magic")); this.resists.put(Enum.DamageType.MAGIC, rs.getFloat("magic"));
this.resists.put(Enum.DamageType.Bleed, rs.getFloat("bleed")); this.resists.put(Enum.DamageType.BLEEDING, rs.getFloat("bleed"));
this.resists.put(Enum.DamageType.Poison, rs.getFloat("poison")); this.resists.put(Enum.DamageType.POISON, rs.getFloat("poison"));
this.resists.put(Enum.DamageType.Mental, rs.getFloat("mental")); this.resists.put(Enum.DamageType.MENTAL, rs.getFloat("mental"));
this.resists.put(Enum.DamageType.Holy, rs.getFloat("holy")); this.resists.put(Enum.DamageType.HOLY, rs.getFloat("holy"));
this.resists.put(Enum.DamageType.Unholy, rs.getFloat("unholy")); this.resists.put(Enum.DamageType.UNHOLY, rs.getFloat("unholy"));
this.resists.put(Enum.DamageType.Lightning, rs.getFloat("lightning")); this.resists.put(Enum.DamageType.LIGHTNING, rs.getFloat("lightning"));
this.resists.put(Enum.DamageType.Fire, rs.getFloat("fire")); this.resists.put(Enum.DamageType.FIRE, rs.getFloat("fire"));
this.resists.put(Enum.DamageType.Cold, rs.getFloat("cold")); this.resists.put(Enum.DamageType.COLD, rs.getFloat("cold"));
this.resists.put(Enum.DamageType.Healing, 0f); this.resists.put(Enum.DamageType.HEALING, 0f);
} }
//Handle Fortitudes //Handle Fortitudes
@@ -106,7 +106,7 @@ public class Resists {
//see if there is a fortitude //see if there is a fortitude
float damageCap = bonus.getFloatPercentAll(ModType.DamageCap, SourceType.None); float damageCap = bonus.getFloatPercentAll(ModType.DamageCap, SourceType.None);
if (damageCap == 0f || type == Enum.DamageType.Healing) if (damageCap == 0f || type == Enum.DamageType.HEALING)
return damage; return damage;
//is fortitude, Are we under the cap? //is fortitude, Are we under the cap?
@@ -137,7 +137,7 @@ public class Resists {
for (SourceType fort : forts) { for (SourceType fort : forts) {
Enum.DamageType dt = Enum.DamageType.valueOf(fort.name()); Enum.DamageType dt = Enum.DamageType.valueOf(fort.name());
if (dt.equals(Enum.DamageType.None)) if (dt.equals(Enum.DamageType.NONE))
continue; continue;
if (dt.equals(damageType)) { if (dt.equals(damageType)) {
@@ -195,19 +195,19 @@ public class Resists {
*/ */
public final void setBuildingResists() { public final void setBuildingResists() {
this.immuneToAll = false; this.immuneToAll = false;
this.resists.put(Enum.DamageType.Slash, 85f); this.resists.put(Enum.DamageType.SLASHING, 85f);
this.resists.put(Enum.DamageType.Crush, 85f); this.resists.put(Enum.DamageType.CRUSHING, 85f);
this.resists.put(Enum.DamageType.Siege, 0f); this.resists.put(Enum.DamageType.SIEGE, 0f);
this.immuneTo.put(Enum.DamageType.Pierce, true); this.immuneTo.put(Enum.DamageType.PIERCE, true);
this.immuneTo.put(Enum.DamageType.Magic, true); this.immuneTo.put(Enum.DamageType.MAGIC, true);
this.immuneTo.put(Enum.DamageType.Bleed, true); this.immuneTo.put(Enum.DamageType.BLEEDING, true);
this.immuneTo.put(Enum.DamageType.Poison, true); this.immuneTo.put(Enum.DamageType.POISON, true);
this.immuneTo.put(Enum.DamageType.Mental, true); this.immuneTo.put(Enum.DamageType.MENTAL, true);
this.immuneTo.put(Enum.DamageType.Holy, true); this.immuneTo.put(Enum.DamageType.HOLY, true);
this.immuneTo.put(Enum.DamageType.Unholy, true); this.immuneTo.put(Enum.DamageType.UNHOLY, true);
this.immuneTo.put(Enum.DamageType.Lightning, true); this.immuneTo.put(Enum.DamageType.LIGHTNING, true);
this.immuneTo.put(Enum.DamageType.Fire, true); this.immuneTo.put(Enum.DamageType.FIRE, true);
this.immuneTo.put(Enum.DamageType.Cold, true); this.immuneTo.put(Enum.DamageType.COLD, true);
} }
@@ -216,19 +216,19 @@ public class Resists {
*/ */
public final void setMineResists() { public final void setMineResists() {
this.immuneToAll = false; this.immuneToAll = false;
this.immuneTo.put(Enum.DamageType.Slash, true); this.immuneTo.put(Enum.DamageType.SLASHING, true);
this.immuneTo.put(Enum.DamageType.Crush, true); this.immuneTo.put(Enum.DamageType.CRUSHING, true);
this.immuneTo.put(Enum.DamageType.Pierce, true); this.immuneTo.put(Enum.DamageType.PIERCE, true);
this.immuneTo.put(Enum.DamageType.Magic, true); this.immuneTo.put(Enum.DamageType.MAGIC, true);
this.immuneTo.put(Enum.DamageType.Bleed, true); this.immuneTo.put(Enum.DamageType.BLEEDING, true);
this.immuneTo.put(Enum.DamageType.Poison, true); this.immuneTo.put(Enum.DamageType.POISON, true);
this.immuneTo.put(Enum.DamageType.Mental, true); this.immuneTo.put(Enum.DamageType.MENTAL, true);
this.immuneTo.put(Enum.DamageType.Holy, true); this.immuneTo.put(Enum.DamageType.HOLY, true);
this.immuneTo.put(Enum.DamageType.Unholy, true); this.immuneTo.put(Enum.DamageType.UNHOLY, true);
this.immuneTo.put(Enum.DamageType.Lightning, true); this.immuneTo.put(Enum.DamageType.LIGHTNING, true);
this.immuneTo.put(Enum.DamageType.Fire, true); this.immuneTo.put(Enum.DamageType.FIRE, true);
this.immuneTo.put(Enum.DamageType.Cold, true); this.immuneTo.put(Enum.DamageType.COLD, true);
this.resists.put(Enum.DamageType.Siege, 0f); this.resists.put(Enum.DamageType.SIEGE, 0f);
} }
/** /**
@@ -236,20 +236,20 @@ public class Resists {
*/ */
public final void setGenericResists() { public final void setGenericResists() {
this.immuneToAll = false; this.immuneToAll = false;
this.resists.put(Enum.DamageType.Slash, 0f); this.resists.put(Enum.DamageType.SLASHING, 0f);
this.resists.put(Enum.DamageType.Crush, 0f); this.resists.put(Enum.DamageType.CRUSHING, 0f);
this.resists.put(Enum.DamageType.Pierce, 0f); this.resists.put(Enum.DamageType.PIERCE, 0f);
this.resists.put(Enum.DamageType.Magic, 0f); this.resists.put(Enum.DamageType.MAGIC, 0f);
this.resists.put(Enum.DamageType.Bleed, 0f); this.resists.put(Enum.DamageType.BLEEDING, 0f);
this.resists.put(Enum.DamageType.Poison, 0f); this.resists.put(Enum.DamageType.POISON, 0f);
this.resists.put(Enum.DamageType.Mental, 0f); this.resists.put(Enum.DamageType.MENTAL, 0f);
this.resists.put(Enum.DamageType.Holy, 0f); this.resists.put(Enum.DamageType.HOLY, 0f);
this.resists.put(Enum.DamageType.Unholy, 0f); this.resists.put(Enum.DamageType.UNHOLY, 0f);
this.resists.put(Enum.DamageType.Lightning, 0f); this.resists.put(Enum.DamageType.LIGHTNING, 0f);
this.resists.put(Enum.DamageType.Fire, 0f); this.resists.put(Enum.DamageType.FIRE, 0f);
this.resists.put(Enum.DamageType.Cold, 0f); this.resists.put(Enum.DamageType.COLD, 0f);
this.resists.put(Enum.DamageType.Healing, 0f); this.resists.put(Enum.DamageType.HEALING, 0f);
this.immuneTo.put(Enum.DamageType.Siege, true); this.immuneTo.put(Enum.DamageType.SIEGE, true);
} }
@@ -293,7 +293,7 @@ public class Resists {
} }
public boolean immuneToAttacks() { public boolean immuneToAttacks() {
return immuneTo(Enum.DamageType.Attack); return immuneTo(Enum.DamageType.ATTACK);
} }
/** /**
@@ -347,25 +347,25 @@ public class Resists {
if (rb != null) { if (rb != null) {
// Handle immunities // Handle immunities
if (rb.getBool(ModType.ImmuneTo, SourceType.Stun)) if (rb.getBool(ModType.ImmuneTo, SourceType.Stun))
this.immuneTo.put(Enum.DamageType.Stun, true); this.immuneTo.put(Enum.DamageType.STUN, true);
if (rb.getBool(ModType.ImmuneTo, SourceType.Blind)) if (rb.getBool(ModType.ImmuneTo, SourceType.Blind))
this.immuneTo.put(Enum.DamageType.Blind, true); this.immuneTo.put(Enum.DamageType.BLIND, true);
if (rb.getBool(ModType.ImmuneToAttack, SourceType.None)) if (rb.getBool(ModType.ImmuneToAttack, SourceType.None))
this.immuneTo.put(Enum.DamageType.Attack, true); this.immuneTo.put(Enum.DamageType.ATTACK, true);
if (rb.getBool(ModType.ImmuneToPowers, SourceType.None)) if (rb.getBool(ModType.ImmuneToPowers, SourceType.None))
this.immuneTo.put(Enum.DamageType.Powers, true); this.immuneTo.put(Enum.DamageType.POWERS, true);
if (rb.getBool(ModType.ImmuneTo, SourceType.Powerblock)) if (rb.getBool(ModType.ImmuneTo, SourceType.Powerblock))
this.immuneTo.put(Enum.DamageType.Powerblock, true); this.immuneTo.put(Enum.DamageType.POWERBLOCK, true);
if (rb.getBool(ModType.ImmuneTo, SourceType.DeBuff)) if (rb.getBool(ModType.ImmuneTo, SourceType.DeBuff))
this.immuneTo.put(Enum.DamageType.DeBuff, true); this.immuneTo.put(Enum.DamageType.DEBUFF, true);
if (rb.getBool(ModType.ImmuneTo, SourceType.Fear)) if (rb.getBool(ModType.ImmuneTo, SourceType.Fear))
this.immuneTo.put(Enum.DamageType.Fear, true); this.immuneTo.put(Enum.DamageType.FEAR, true);
if (rb.getBool(ModType.ImmuneTo, SourceType.Charm)) if (rb.getBool(ModType.ImmuneTo, SourceType.Charm))
this.immuneTo.put(Enum.DamageType.Charm, true); this.immuneTo.put(Enum.DamageType.CHARM, true);
if (rb.getBool(ModType.ImmuneTo, SourceType.Root)) if (rb.getBool(ModType.ImmuneTo, SourceType.Root))
this.immuneTo.put(Enum.DamageType.Root, true); this.immuneTo.put(Enum.DamageType.ROOT, true);
if (rb.getBool(ModType.ImmuneTo, SourceType.Snare)) if (rb.getBool(ModType.ImmuneTo, SourceType.Snare))
this.immuneTo.put(Enum.DamageType.Snare, true); this.immuneTo.put(Enum.DamageType.SNARE, true);
// Handle resists // Handle resists
slash += rb.getFloat(ModType.Resistance, SourceType.Slash); slash += rb.getFloat(ModType.Resistance, SourceType.Slash);
@@ -404,21 +404,21 @@ public class Resists {
} }
} }
this.resists.put(Enum.DamageType.Slash, slash); this.resists.put(Enum.DamageType.SLASHING, slash);
this.resists.put(Enum.DamageType.Crush, crush); this.resists.put(Enum.DamageType.CRUSHING, crush);
this.resists.put(Enum.DamageType.Pierce, pierce); this.resists.put(Enum.DamageType.PIERCE, pierce);
this.resists.put(Enum.DamageType.Magic, magic); this.resists.put(Enum.DamageType.MAGIC, magic);
this.resists.put(Enum.DamageType.Bleed, bleed); this.resists.put(Enum.DamageType.BLEEDING, bleed);
this.resists.put(Enum.DamageType.Poison, poison); this.resists.put(Enum.DamageType.POISON, poison);
this.resists.put(Enum.DamageType.Mental, mental); this.resists.put(Enum.DamageType.MENTAL, mental);
this.resists.put(Enum.DamageType.Holy, holy); this.resists.put(Enum.DamageType.HOLY, holy);
this.resists.put(Enum.DamageType.Unholy, unholy); this.resists.put(Enum.DamageType.UNHOLY, unholy);
this.resists.put(Enum.DamageType.Lightning, lightning); this.resists.put(Enum.DamageType.LIGHTNING, lightning);
this.resists.put(Enum.DamageType.Fire, fire); this.resists.put(Enum.DamageType.FIRE, fire);
this.resists.put(Enum.DamageType.Cold, cold); this.resists.put(Enum.DamageType.COLD, cold);
this.resists.put(Enum.DamageType.Healing, healing); this.resists.put(Enum.DamageType.HEALING, healing);
this.immuneTo.put(Enum.DamageType.Siege, true); this.immuneTo.put(Enum.DamageType.SIEGE, true);
// debug printing of resists // debug printing of resists
// printResists(pc); // printResists(pc);