forked from MagicBane/Server
Uppercase enum.
This commit is contained in:
+106
-139
@@ -84,19 +84,19 @@ public class Resists {
|
||||
*/
|
||||
public Resists(ResultSet rs) throws SQLException {
|
||||
this.immuneToAll = false;
|
||||
this.resists.put(SourceType.Slashing, rs.getFloat("slash"));
|
||||
this.resists.put(SourceType.Crushing, rs.getFloat("crush"));
|
||||
this.resists.put(SourceType.Piercing, rs.getFloat("pierce"));
|
||||
this.resists.put(SourceType.Magic, rs.getFloat("magic"));
|
||||
this.resists.put(SourceType.Bleeding, rs.getFloat("bleed"));
|
||||
this.resists.put(SourceType.Poison, rs.getFloat("poison"));
|
||||
this.resists.put(SourceType.Mental, rs.getFloat("mental"));
|
||||
this.resists.put(SourceType.Holy, rs.getFloat("holy"));
|
||||
this.resists.put(SourceType.Unholy, rs.getFloat("unholy"));
|
||||
this.resists.put(SourceType.Lightning, rs.getFloat("lightning"));
|
||||
this.resists.put(SourceType.Fire, rs.getFloat("fire"));
|
||||
this.resists.put(SourceType.Cold, rs.getFloat("cold"));
|
||||
this.resists.put(SourceType.Healing, 0f);
|
||||
this.resists.put(SourceType.SLASHING, rs.getFloat("slash"));
|
||||
this.resists.put(SourceType.CRUSHING, rs.getFloat("crush"));
|
||||
this.resists.put(SourceType.PIERCING, rs.getFloat("pierce"));
|
||||
this.resists.put(SourceType.MAGIC, rs.getFloat("magic"));
|
||||
this.resists.put(SourceType.BLEEDING, rs.getFloat("bleed"));
|
||||
this.resists.put(SourceType.POISON, rs.getFloat("poison"));
|
||||
this.resists.put(SourceType.MENTAL, rs.getFloat("mental"));
|
||||
this.resists.put(SourceType.HOLY, rs.getFloat("holy"));
|
||||
this.resists.put(SourceType.UNHOLY, rs.getFloat("unholy"));
|
||||
this.resists.put(SourceType.LIGHTNING, rs.getFloat("lightning"));
|
||||
this.resists.put(SourceType.FIRE, rs.getFloat("fire"));
|
||||
this.resists.put(SourceType.COLD, rs.getFloat("cold"));
|
||||
this.resists.put(SourceType.HEALING, 0f);
|
||||
}
|
||||
|
||||
//Handle Fortitudes
|
||||
@@ -106,8 +106,8 @@ public class Resists {
|
||||
PlayerBonuses bonus = target.getBonuses();
|
||||
|
||||
//see if there is a fortitude
|
||||
float damageCap = bonus.getFloatPercentAll(ModType.DamageCap, SourceType.None);
|
||||
if (damageCap == 0f || type == SourceType.Healing)
|
||||
float damageCap = bonus.getFloatPercentAll(ModType.DamageCap, SourceType.NONE);
|
||||
if (damageCap == 0f || type == SourceType.HEALING)
|
||||
return damage;
|
||||
|
||||
//is fortitude, Are we under the cap?
|
||||
@@ -127,7 +127,7 @@ public class Resists {
|
||||
if (forts == null || !isValidDamageCapType(forts, type, exclusive))
|
||||
return damage;
|
||||
|
||||
float adjustedDamage = bonus.getFloatPercentAll(ModType.AdjustAboveDmgCap, SourceType.None);
|
||||
float adjustedDamage = bonus.getFloatPercentAll(ModType.AdjustAboveDmgCap, SourceType.NONE);
|
||||
//Adjust damage down and return new amount
|
||||
float aadc = 1 + adjustedDamage;
|
||||
return capFire * aadc;
|
||||
@@ -138,7 +138,7 @@ public class Resists {
|
||||
for (SourceType fort : forts) {
|
||||
SourceType dt = SourceType.valueOf(fort.name());
|
||||
|
||||
if (dt == SourceType.None)
|
||||
if (dt == SourceType.NONE)
|
||||
continue;
|
||||
|
||||
if (dt == damageType) {
|
||||
@@ -194,19 +194,19 @@ public class Resists {
|
||||
*/
|
||||
public final void setBuildingResists() {
|
||||
this.immuneToAll = false;
|
||||
this.resists.put(SourceType.Slashing, 85f);
|
||||
this.resists.put(SourceType.Crushing, 85f);
|
||||
this.resists.put(SourceType.Siege, 0f);
|
||||
this.immuneTo.put(SourceType.Piercing, true);
|
||||
this.immuneTo.put(SourceType.Magic, true);
|
||||
this.immuneTo.put(SourceType.Bleeding, true);
|
||||
this.immuneTo.put(SourceType.Poison, true);
|
||||
this.immuneTo.put(SourceType.Mental, true);
|
||||
this.immuneTo.put(SourceType.Holy, true);
|
||||
this.immuneTo.put(SourceType.Unholy, true);
|
||||
this.immuneTo.put(SourceType.Lightning, true);
|
||||
this.immuneTo.put(SourceType.Fire, true);
|
||||
this.immuneTo.put(SourceType.Cold, true);
|
||||
this.resists.put(SourceType.SLASHING, 85f);
|
||||
this.resists.put(SourceType.CRUSHING, 85f);
|
||||
this.immuneTo.put(SourceType.PIERCING, true);
|
||||
this.immuneTo.put(SourceType.MAGIC, true);
|
||||
this.immuneTo.put(SourceType.BLEEDING, true);
|
||||
this.immuneTo.put(SourceType.POISON, true);
|
||||
this.immuneTo.put(SourceType.MENTAL, true);
|
||||
this.immuneTo.put(SourceType.HOLY, true);
|
||||
this.immuneTo.put(SourceType.UNHOLY, true);
|
||||
this.immuneTo.put(SourceType.LIGHTNING, true);
|
||||
this.immuneTo.put(SourceType.FIRE, true);
|
||||
this.immuneTo.put(SourceType.COLD, true);
|
||||
this.resists.put(SourceType.SIEGE, 0f);
|
||||
|
||||
}
|
||||
|
||||
@@ -215,19 +215,19 @@ public class Resists {
|
||||
*/
|
||||
public final void setMineResists() {
|
||||
this.immuneToAll = false;
|
||||
this.immuneTo.put(SourceType.Slashing, true);
|
||||
this.immuneTo.put(SourceType.Crushing, true);
|
||||
this.immuneTo.put(SourceType.Piercing, true);
|
||||
this.immuneTo.put(SourceType.Magic, true);
|
||||
this.immuneTo.put(SourceType.Bleeding, true);
|
||||
this.immuneTo.put(SourceType.Poison, true);
|
||||
this.immuneTo.put(SourceType.Mental, true);
|
||||
this.immuneTo.put(SourceType.Holy, true);
|
||||
this.immuneTo.put(SourceType.Unholy, true);
|
||||
this.immuneTo.put(SourceType.Lightning, true);
|
||||
this.immuneTo.put(SourceType.Fire, true);
|
||||
this.immuneTo.put(SourceType.Cold, true);
|
||||
this.resists.put(SourceType.Siege, 0f);
|
||||
this.immuneTo.put(SourceType.SLASHING, true);
|
||||
this.immuneTo.put(SourceType.CRUSHING, true);
|
||||
this.immuneTo.put(SourceType.PIERCING, true);
|
||||
this.immuneTo.put(SourceType.MAGIC, true);
|
||||
this.immuneTo.put(SourceType.BLEEDING, true);
|
||||
this.immuneTo.put(SourceType.POISON, true);
|
||||
this.immuneTo.put(SourceType.MENTAL, true);
|
||||
this.immuneTo.put(SourceType.HOLY, true);
|
||||
this.immuneTo.put(SourceType.UNHOLY, true);
|
||||
this.immuneTo.put(SourceType.LIGHTNING, true);
|
||||
this.immuneTo.put(SourceType.FIRE, true);
|
||||
this.immuneTo.put(SourceType.COLD, true);
|
||||
this.resists.put(SourceType.SIEGE, 0f);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -235,20 +235,20 @@ public class Resists {
|
||||
*/
|
||||
public final void setGenericResists() {
|
||||
this.immuneToAll = false;
|
||||
this.resists.put(SourceType.Slashing, 0f);
|
||||
this.resists.put(SourceType.Crushing, 0f);
|
||||
this.resists.put(SourceType.Piercing, 0f);
|
||||
this.resists.put(SourceType.Magic, 0f);
|
||||
this.resists.put(SourceType.Bleeding, 0f);
|
||||
this.resists.put(SourceType.Poison, 0f);
|
||||
this.resists.put(SourceType.Mental, 0f);
|
||||
this.resists.put(SourceType.Holy, 0f);
|
||||
this.resists.put(SourceType.Unholy, 0f);
|
||||
this.resists.put(SourceType.Lightning, 0f);
|
||||
this.resists.put(SourceType.Fire, 0f);
|
||||
this.resists.put(SourceType.Cold, 0f);
|
||||
this.resists.put(SourceType.Healing, 0f);
|
||||
this.immuneTo.put(SourceType.Siege, true);
|
||||
this.resists.put(SourceType.SLASHING, 0f);
|
||||
this.resists.put(SourceType.CRUSHING, 0f);
|
||||
this.resists.put(SourceType.PIERCING, 0f);
|
||||
this.resists.put(SourceType.MAGIC, 0f);
|
||||
this.resists.put(SourceType.BLEEDING, 0f);
|
||||
this.resists.put(SourceType.POISON, 0f);
|
||||
this.resists.put(SourceType.MENTAL, 0f);
|
||||
this.resists.put(SourceType.HOLY, 0f);
|
||||
this.resists.put(SourceType.UNHOLY, 0f);
|
||||
this.resists.put(SourceType.LIGHTNING, 0f);
|
||||
this.resists.put(SourceType.FIRE, 0f);
|
||||
this.resists.put(SourceType.COLD, 0f);
|
||||
this.resists.put(SourceType.HEALING, 0f);
|
||||
this.immuneTo.put(SourceType.SIEGE, true);
|
||||
|
||||
}
|
||||
|
||||
@@ -292,10 +292,9 @@ public class Resists {
|
||||
}
|
||||
|
||||
public boolean immuneToAttacks() {
|
||||
return immuneTo(SourceType.ImmuneToAttack);
|
||||
return immuneTo(SourceType.IMMUNETOATTACK);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Set a resist
|
||||
*/
|
||||
@@ -303,37 +302,6 @@ public class Resists {
|
||||
this.resists.put(type, value);
|
||||
}
|
||||
|
||||
/**
|
||||
* set immunities from mobbase
|
||||
*/
|
||||
public void setImmuneTo(int immune) {
|
||||
setImmuneTo(SourceType.Stun, ((immune & 1) != 0));
|
||||
setImmuneTo(SourceType.Powerblock, ((immune & 2) != 0));
|
||||
setImmuneTo(SourceType.Drain, ((immune & 4) != 0));
|
||||
setImmuneTo(SourceType.Snare, ((immune & 8) != 0));
|
||||
setImmuneTo(SourceType.Siege, ((immune & 16) != 0));
|
||||
setImmuneTo(SourceType.Slashing, ((immune & 32) != 0));
|
||||
setImmuneTo(SourceType.Crushing, ((immune & 64) != 0));
|
||||
setImmuneTo(SourceType.Piercing, ((immune & 128) != 0));
|
||||
setImmuneTo(SourceType.Magic, ((immune & 256) != 0));
|
||||
setImmuneTo(SourceType.Bleeding, ((immune & 512) != 0));
|
||||
setImmuneTo(SourceType.Poison, ((immune & 1024) != 0));
|
||||
setImmuneTo(SourceType.Mental, ((immune & 2048) != 0));
|
||||
setImmuneTo(SourceType.Holy, ((immune & 4096) != 0));
|
||||
setImmuneTo(SourceType.Unholy, ((immune & 8192) != 0));
|
||||
setImmuneTo(SourceType.Lightning, ((immune & 16384) != 0));
|
||||
setImmuneTo(SourceType.Fire, ((immune & 32768) != 0));
|
||||
setImmuneTo(SourceType.Cold, ((immune & 65536) != 0));
|
||||
setImmuneTo(SourceType.Steal, ((immune & 131072) != 0));
|
||||
}
|
||||
|
||||
/**
|
||||
* set/unset immuneTo
|
||||
*/
|
||||
public void setImmuneTo(SourceType type, boolean value) {
|
||||
this.immuneTo.put(type, value);
|
||||
}
|
||||
|
||||
/**
|
||||
* set immuneToAll
|
||||
*/
|
||||
@@ -357,7 +325,7 @@ public class Resists {
|
||||
//handle fortitudes
|
||||
damage = handleFortitude(target, type, damage);
|
||||
//calculate armor piercing
|
||||
float ap = source.getBonuses().getFloatPercentAll(ModType.ArmorPiercing, SourceType.None);
|
||||
float ap = source.getBonuses().getFloatPercentAll(ModType.ArmorPiercing, SourceType.NONE);
|
||||
float damageAfterResists = damage * (1 - (this.getResist(type, trains) * 0.01f) + ap);
|
||||
//check to see if any damage absorbers should cancel
|
||||
if (target != null) {
|
||||
@@ -390,41 +358,41 @@ public class Resists {
|
||||
|
||||
if (rb != null) {
|
||||
// Handle immunities
|
||||
if (rb.getBool(ModType.ImmuneTo, SourceType.Stun))
|
||||
this.immuneTo.put(SourceType.Stun, true);
|
||||
if (rb.getBool(ModType.ImmuneTo, SourceType.Blind))
|
||||
this.immuneTo.put(SourceType.Blind, true);
|
||||
if (rb.getBool(ModType.ImmuneToAttack, SourceType.None))
|
||||
this.immuneTo.put(SourceType.ImmuneToAttack, true);
|
||||
if (rb.getBool(ModType.ImmuneToPowers, SourceType.None))
|
||||
this.immuneTo.put(SourceType.ImmuneToPowers, true);
|
||||
if (rb.getBool(ModType.ImmuneTo, SourceType.Powerblock))
|
||||
this.immuneTo.put(SourceType.Powerblock, true);
|
||||
if (rb.getBool(ModType.ImmuneTo, SourceType.DeBuff))
|
||||
this.immuneTo.put(SourceType.DeBuff, true);
|
||||
if (rb.getBool(ModType.ImmuneTo, SourceType.Fear))
|
||||
this.immuneTo.put(SourceType.Fear, true);
|
||||
if (rb.getBool(ModType.ImmuneTo, SourceType.Charm))
|
||||
this.immuneTo.put(SourceType.Charm, true);
|
||||
if (rb.getBool(ModType.ImmuneTo, SourceType.Root))
|
||||
this.immuneTo.put(SourceType.Root, true);
|
||||
if (rb.getBool(ModType.ImmuneTo, SourceType.Snare))
|
||||
this.immuneTo.put(SourceType.Snare, true);
|
||||
if (rb.getBool(ModType.ImmuneTo, SourceType.STUN))
|
||||
this.immuneTo.put(SourceType.STUN, true);
|
||||
if (rb.getBool(ModType.ImmuneTo, SourceType.BLIND))
|
||||
this.immuneTo.put(SourceType.BLIND, true);
|
||||
if (rb.getBool(ModType.ImmuneToAttack, SourceType.NONE))
|
||||
this.immuneTo.put(SourceType.IMMUNETOATTACK, true);
|
||||
if (rb.getBool(ModType.ImmuneToPowers, SourceType.NONE))
|
||||
this.immuneTo.put(SourceType.IMMUNETOPOWERS, true);
|
||||
if (rb.getBool(ModType.ImmuneTo, SourceType.POWERBLOCK))
|
||||
this.immuneTo.put(SourceType.POWERBLOCK, true);
|
||||
if (rb.getBool(ModType.ImmuneTo, SourceType.DEBUFF))
|
||||
this.immuneTo.put(SourceType.DEBUFF, true);
|
||||
if (rb.getBool(ModType.ImmuneTo, SourceType.FEAR))
|
||||
this.immuneTo.put(SourceType.FEAR, true);
|
||||
if (rb.getBool(ModType.ImmuneTo, SourceType.CHARM))
|
||||
this.immuneTo.put(SourceType.CHARM, true);
|
||||
if (rb.getBool(ModType.ImmuneTo, SourceType.ROOT))
|
||||
this.immuneTo.put(SourceType.ROOT, true);
|
||||
if (rb.getBool(ModType.ImmuneTo, SourceType.SNARE))
|
||||
this.immuneTo.put(SourceType.SNARE, true);
|
||||
|
||||
// Handle resists
|
||||
slash += rb.getFloat(ModType.Resistance, SourceType.Slashing);
|
||||
crush += rb.getFloat(ModType.Resistance, SourceType.Crushing);
|
||||
pierce += rb.getFloat(ModType.Resistance, SourceType.Piercing);
|
||||
magic += rb.getFloat(ModType.Resistance, SourceType.Magic);
|
||||
bleed += rb.getFloat(ModType.Resistance, SourceType.Bleeding);
|
||||
poison += rb.getFloat(ModType.Resistance, SourceType.Poison);
|
||||
mental += rb.getFloat(ModType.Resistance, SourceType.Mental);
|
||||
holy += rb.getFloat(ModType.Resistance, SourceType.Holy);
|
||||
unholy += rb.getFloat(ModType.Resistance, SourceType.Unholy);
|
||||
lightning += rb.getFloat(ModType.Resistance, SourceType.Lightning);
|
||||
fire += rb.getFloat(ModType.Resistance, SourceType.Fire);
|
||||
cold += rb.getFloat(ModType.Resistance, SourceType.Cold);
|
||||
healing += rb.getFloat(ModType.Resistance, SourceType.Healing); // DamageType.Healing.name());
|
||||
slash += rb.getFloat(ModType.Resistance, SourceType.SLASHING);
|
||||
crush += rb.getFloat(ModType.Resistance, SourceType.CRUSHING);
|
||||
pierce += rb.getFloat(ModType.Resistance, SourceType.PIERCING);
|
||||
magic += rb.getFloat(ModType.Resistance, SourceType.MAGIC);
|
||||
bleed += rb.getFloat(ModType.Resistance, SourceType.BLEEDING);
|
||||
poison += rb.getFloat(ModType.Resistance, SourceType.POISON);
|
||||
mental += rb.getFloat(ModType.Resistance, SourceType.MENTAL);
|
||||
holy += rb.getFloat(ModType.Resistance, SourceType.HOLY);
|
||||
unholy += rb.getFloat(ModType.Resistance, SourceType.UNHOLY);
|
||||
lightning += rb.getFloat(ModType.Resistance, SourceType.LIGHTNING);
|
||||
fire += rb.getFloat(ModType.Resistance, SourceType.FIRE);
|
||||
cold += rb.getFloat(ModType.Resistance, SourceType.COLD);
|
||||
healing += rb.getFloat(ModType.Resistance, SourceType.HEALING); // DamageType.Healing.name());
|
||||
|
||||
}
|
||||
|
||||
@@ -448,21 +416,20 @@ public class Resists {
|
||||
}
|
||||
}
|
||||
|
||||
this.resists.put(SourceType.Slashing, slash);
|
||||
this.resists.put(SourceType.Crushing, crush);
|
||||
this.resists.put(SourceType.Piercing, pierce);
|
||||
this.resists.put(SourceType.Magic, magic);
|
||||
this.resists.put(SourceType.Bleeding, bleed);
|
||||
this.resists.put(SourceType.Poison, poison);
|
||||
this.resists.put(SourceType.Mental, mental);
|
||||
this.resists.put(SourceType.Holy, holy);
|
||||
this.resists.put(SourceType.Unholy, unholy);
|
||||
this.resists.put(SourceType.Lightning, lightning);
|
||||
this.resists.put(SourceType.Fire, fire);
|
||||
this.resists.put(SourceType.Cold, cold);
|
||||
this.resists.put(SourceType.Healing, healing);
|
||||
|
||||
this.immuneTo.put(SourceType.Siege, true);
|
||||
this.resists.put(SourceType.SLASHING, slash);
|
||||
this.resists.put(SourceType.CRUSHING, crush);
|
||||
this.resists.put(SourceType.PIERCING, pierce);
|
||||
this.resists.put(SourceType.MAGIC, magic);
|
||||
this.resists.put(SourceType.BLEEDING, bleed);
|
||||
this.resists.put(SourceType.POISON, poison);
|
||||
this.resists.put(SourceType.MENTAL, mental);
|
||||
this.resists.put(SourceType.HOLY, holy);
|
||||
this.resists.put(SourceType.UNHOLY, unholy);
|
||||
this.resists.put(SourceType.LIGHTNING, lightning);
|
||||
this.resists.put(SourceType.FIRE, fire);
|
||||
this.resists.put(SourceType.COLD, cold);
|
||||
this.resists.put(SourceType.HEALING, healing);
|
||||
this.immuneTo.put(SourceType.SIEGE, true);
|
||||
|
||||
// debug printing of resists
|
||||
// printResists(pc);
|
||||
|
||||
Reference in New Issue
Block a user