|
|
@ -10,7 +10,6 @@ |
|
|
|
package engine.objects; |
|
|
|
package engine.objects; |
|
|
|
|
|
|
|
|
|
|
|
import engine.Enum; |
|
|
|
import engine.Enum; |
|
|
|
import engine.Enum.DamageType; |
|
|
|
|
|
|
|
import engine.Enum.ModType; |
|
|
|
import engine.Enum.ModType; |
|
|
|
import engine.Enum.SourceType; |
|
|
|
import engine.Enum.SourceType; |
|
|
|
import engine.gameManager.ChatManager; |
|
|
|
import engine.gameManager.ChatManager; |
|
|
@ -28,9 +27,9 @@ import java.util.concurrent.ConcurrentHashMap; |
|
|
|
public class Resists { |
|
|
|
public class Resists { |
|
|
|
|
|
|
|
|
|
|
|
private static ConcurrentHashMap<Integer, Resists> mobResists = new ConcurrentHashMap<>(MBServerStatics.CHM_INIT_CAP, MBServerStatics.CHM_LOAD, MBServerStatics.CHM_THREAD_LOW); |
|
|
|
private static ConcurrentHashMap<Integer, Resists> mobResists = new ConcurrentHashMap<>(MBServerStatics.CHM_INIT_CAP, MBServerStatics.CHM_LOAD, MBServerStatics.CHM_THREAD_LOW); |
|
|
|
private ConcurrentHashMap<DamageType, Float> resists = new ConcurrentHashMap<>(MBServerStatics.CHM_INIT_CAP, MBServerStatics.CHM_LOAD, MBServerStatics.CHM_THREAD_LOW); |
|
|
|
private ConcurrentHashMap<SourceType, Float> resists = new ConcurrentHashMap<>(MBServerStatics.CHM_INIT_CAP, MBServerStatics.CHM_LOAD, MBServerStatics.CHM_THREAD_LOW); |
|
|
|
private ConcurrentHashMap<DamageType, Boolean> immuneTo = new ConcurrentHashMap<>(MBServerStatics.CHM_INIT_CAP, MBServerStatics.CHM_LOAD, MBServerStatics.CHM_THREAD_LOW); |
|
|
|
private ConcurrentHashMap<SourceType, Boolean> immuneTo = new ConcurrentHashMap<>(MBServerStatics.CHM_INIT_CAP, MBServerStatics.CHM_LOAD, MBServerStatics.CHM_THREAD_LOW); |
|
|
|
private DamageType protection; |
|
|
|
private SourceType protection; |
|
|
|
private int protectionTrains = 0; |
|
|
|
private int protectionTrains = 0; |
|
|
|
private boolean immuneToAll; |
|
|
|
private boolean immuneToAll; |
|
|
|
|
|
|
|
|
|
|
@ -53,9 +52,9 @@ public class Resists { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public Resists(Resists r) { |
|
|
|
public Resists(Resists r) { |
|
|
|
for (DamageType dt : r.resists.keySet()) |
|
|
|
for (SourceType dt : r.resists.keySet()) |
|
|
|
this.resists.put(dt, r.resists.get(dt)); |
|
|
|
this.resists.put(dt, r.resists.get(dt)); |
|
|
|
for (DamageType dt : r.immuneTo.keySet()) |
|
|
|
for (SourceType dt : r.immuneTo.keySet()) |
|
|
|
this.immuneTo.put(dt, r.immuneTo.get(dt)); |
|
|
|
this.immuneTo.put(dt, r.immuneTo.get(dt)); |
|
|
|
this.protection = r.protection; |
|
|
|
this.protection = r.protection; |
|
|
|
this.protectionTrains = r.protectionTrains; |
|
|
|
this.protectionTrains = r.protectionTrains; |
|
|
@ -85,30 +84,30 @@ public class Resists { |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
public Resists(ResultSet rs) throws SQLException { |
|
|
|
public Resists(ResultSet rs) throws SQLException { |
|
|
|
this.immuneToAll = false; |
|
|
|
this.immuneToAll = false; |
|
|
|
this.resists.put(DamageType.Slash, rs.getFloat("slash")); |
|
|
|
this.resists.put(SourceType.Slashing, rs.getFloat("slash")); |
|
|
|
this.resists.put(DamageType.Crush, rs.getFloat("crush")); |
|
|
|
this.resists.put(SourceType.Crushing, rs.getFloat("crush")); |
|
|
|
this.resists.put(DamageType.Pierce, rs.getFloat("pierce")); |
|
|
|
this.resists.put(SourceType.Piercing, rs.getFloat("pierce")); |
|
|
|
this.resists.put(DamageType.Magic, rs.getFloat("magic")); |
|
|
|
this.resists.put(SourceType.Magic, rs.getFloat("magic")); |
|
|
|
this.resists.put(DamageType.Bleed, rs.getFloat("bleed")); |
|
|
|
this.resists.put(SourceType.Bleeding, rs.getFloat("bleed")); |
|
|
|
this.resists.put(DamageType.Poison, rs.getFloat("poison")); |
|
|
|
this.resists.put(SourceType.Poison, rs.getFloat("poison")); |
|
|
|
this.resists.put(DamageType.Mental, rs.getFloat("mental")); |
|
|
|
this.resists.put(SourceType.Mental, rs.getFloat("mental")); |
|
|
|
this.resists.put(DamageType.Holy, rs.getFloat("holy")); |
|
|
|
this.resists.put(SourceType.Holy, rs.getFloat("holy")); |
|
|
|
this.resists.put(DamageType.Unholy, rs.getFloat("unholy")); |
|
|
|
this.resists.put(SourceType.Unholy, rs.getFloat("unholy")); |
|
|
|
this.resists.put(DamageType.Lightning, rs.getFloat("lightning")); |
|
|
|
this.resists.put(SourceType.Lightning, rs.getFloat("lightning")); |
|
|
|
this.resists.put(DamageType.Fire, rs.getFloat("fire")); |
|
|
|
this.resists.put(SourceType.Fire, rs.getFloat("fire")); |
|
|
|
this.resists.put(DamageType.Cold, rs.getFloat("cold")); |
|
|
|
this.resists.put(SourceType.Cold, rs.getFloat("cold")); |
|
|
|
this.resists.put(DamageType.Healing, 0f); |
|
|
|
this.resists.put(SourceType.Healing, 0f); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
//Handle Fortitudes
|
|
|
|
//Handle Fortitudes
|
|
|
|
private static float handleFortitude(AbstractCharacter target, DamageType type, float damage) { |
|
|
|
private static float handleFortitude(AbstractCharacter target, SourceType type, float damage) { |
|
|
|
if (target == null || !(target.getObjectType().equals(Enum.GameObjectType.PlayerCharacter))) |
|
|
|
if (target == null || !(target.getObjectType().equals(Enum.GameObjectType.PlayerCharacter))) |
|
|
|
return damage; |
|
|
|
return damage; |
|
|
|
PlayerBonuses bonus = target.getBonuses(); |
|
|
|
PlayerBonuses bonus = target.getBonuses(); |
|
|
|
|
|
|
|
|
|
|
|
//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 == DamageType.Healing) |
|
|
|
if (damageCap == 0f || type == SourceType.Healing) |
|
|
|
return damage; |
|
|
|
return damage; |
|
|
|
|
|
|
|
|
|
|
|
//is fortitude, Are we under the cap?
|
|
|
|
//is fortitude, Are we under the cap?
|
|
|
@ -135,11 +134,11 @@ public class Resists { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
//Test if Damagetype is valid for foritude
|
|
|
|
//Test if Damagetype is valid for foritude
|
|
|
|
private static boolean isValidDamageCapType(HashSet<SourceType> forts, DamageType damageType, boolean exclusive) { |
|
|
|
private static boolean isValidDamageCapType(HashSet<SourceType> forts, SourceType damageType, boolean exclusive) { |
|
|
|
for (SourceType fort : forts) { |
|
|
|
for (SourceType fort : forts) { |
|
|
|
DamageType dt = DamageType.valueOf(fort.name()); |
|
|
|
SourceType dt = SourceType.valueOf(fort.name()); |
|
|
|
|
|
|
|
|
|
|
|
if (dt == DamageType.None) |
|
|
|
if (dt == SourceType.None) |
|
|
|
continue; |
|
|
|
continue; |
|
|
|
|
|
|
|
|
|
|
|
if (dt == damageType) { |
|
|
|
if (dt == damageType) { |
|
|
@ -195,19 +194,19 @@ public class Resists { |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
public final void setBuildingResists() { |
|
|
|
public final void setBuildingResists() { |
|
|
|
this.immuneToAll = false; |
|
|
|
this.immuneToAll = false; |
|
|
|
this.resists.put(DamageType.Slash, 85f); |
|
|
|
this.resists.put(SourceType.Slashing, 85f); |
|
|
|
this.resists.put(DamageType.Crush, 85f); |
|
|
|
this.resists.put(SourceType.Crushing, 85f); |
|
|
|
this.resists.put(DamageType.Siege, 0f); |
|
|
|
this.resists.put(SourceType.Siege, 0f); |
|
|
|
this.immuneTo.put(DamageType.Pierce, true); |
|
|
|
this.immuneTo.put(SourceType.Piercing, true); |
|
|
|
this.immuneTo.put(DamageType.Magic, true); |
|
|
|
this.immuneTo.put(SourceType.Magic, true); |
|
|
|
this.immuneTo.put(DamageType.Bleed, true); |
|
|
|
this.immuneTo.put(SourceType.Bleeding, true); |
|
|
|
this.immuneTo.put(DamageType.Poison, true); |
|
|
|
this.immuneTo.put(SourceType.Poison, true); |
|
|
|
this.immuneTo.put(DamageType.Mental, true); |
|
|
|
this.immuneTo.put(SourceType.Mental, true); |
|
|
|
this.immuneTo.put(DamageType.Holy, true); |
|
|
|
this.immuneTo.put(SourceType.Holy, true); |
|
|
|
this.immuneTo.put(DamageType.Unholy, true); |
|
|
|
this.immuneTo.put(SourceType.Unholy, true); |
|
|
|
this.immuneTo.put(DamageType.Lightning, true); |
|
|
|
this.immuneTo.put(SourceType.Lightning, true); |
|
|
|
this.immuneTo.put(DamageType.Fire, true); |
|
|
|
this.immuneTo.put(SourceType.Fire, true); |
|
|
|
this.immuneTo.put(DamageType.Cold, true); |
|
|
|
this.immuneTo.put(SourceType.Cold, true); |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -216,19 +215,19 @@ public class Resists { |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
public final void setMineResists() { |
|
|
|
public final void setMineResists() { |
|
|
|
this.immuneToAll = false; |
|
|
|
this.immuneToAll = false; |
|
|
|
this.immuneTo.put(DamageType.Slash, true); |
|
|
|
this.immuneTo.put(SourceType.Slashing, true); |
|
|
|
this.immuneTo.put(DamageType.Crush, true); |
|
|
|
this.immuneTo.put(SourceType.Crushing, true); |
|
|
|
this.immuneTo.put(DamageType.Pierce, true); |
|
|
|
this.immuneTo.put(SourceType.Piercing, true); |
|
|
|
this.immuneTo.put(DamageType.Magic, true); |
|
|
|
this.immuneTo.put(SourceType.Magic, true); |
|
|
|
this.immuneTo.put(DamageType.Bleed, true); |
|
|
|
this.immuneTo.put(SourceType.Bleeding, true); |
|
|
|
this.immuneTo.put(DamageType.Poison, true); |
|
|
|
this.immuneTo.put(SourceType.Poison, true); |
|
|
|
this.immuneTo.put(DamageType.Mental, true); |
|
|
|
this.immuneTo.put(SourceType.Mental, true); |
|
|
|
this.immuneTo.put(DamageType.Holy, true); |
|
|
|
this.immuneTo.put(SourceType.Holy, true); |
|
|
|
this.immuneTo.put(DamageType.Unholy, true); |
|
|
|
this.immuneTo.put(SourceType.Unholy, true); |
|
|
|
this.immuneTo.put(DamageType.Lightning, true); |
|
|
|
this.immuneTo.put(SourceType.Lightning, true); |
|
|
|
this.immuneTo.put(DamageType.Fire, true); |
|
|
|
this.immuneTo.put(SourceType.Fire, true); |
|
|
|
this.immuneTo.put(DamageType.Cold, true); |
|
|
|
this.immuneTo.put(SourceType.Cold, true); |
|
|
|
this.resists.put(DamageType.Siege, 0f); |
|
|
|
this.resists.put(SourceType.Siege, 0f); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
@ -236,27 +235,27 @@ public class Resists { |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
public final void setGenericResists() { |
|
|
|
public final void setGenericResists() { |
|
|
|
this.immuneToAll = false; |
|
|
|
this.immuneToAll = false; |
|
|
|
this.resists.put(DamageType.Slash, 0f); |
|
|
|
this.resists.put(SourceType.Slashing, 0f); |
|
|
|
this.resists.put(DamageType.Crush, 0f); |
|
|
|
this.resists.put(SourceType.Crushing, 0f); |
|
|
|
this.resists.put(DamageType.Pierce, 0f); |
|
|
|
this.resists.put(SourceType.Piercing, 0f); |
|
|
|
this.resists.put(DamageType.Magic, 0f); |
|
|
|
this.resists.put(SourceType.Magic, 0f); |
|
|
|
this.resists.put(DamageType.Bleed, 0f); |
|
|
|
this.resists.put(SourceType.Bleeding, 0f); |
|
|
|
this.resists.put(DamageType.Poison, 0f); |
|
|
|
this.resists.put(SourceType.Poison, 0f); |
|
|
|
this.resists.put(DamageType.Mental, 0f); |
|
|
|
this.resists.put(SourceType.Mental, 0f); |
|
|
|
this.resists.put(DamageType.Holy, 0f); |
|
|
|
this.resists.put(SourceType.Holy, 0f); |
|
|
|
this.resists.put(DamageType.Unholy, 0f); |
|
|
|
this.resists.put(SourceType.Unholy, 0f); |
|
|
|
this.resists.put(DamageType.Lightning, 0f); |
|
|
|
this.resists.put(SourceType.Lightning, 0f); |
|
|
|
this.resists.put(DamageType.Fire, 0f); |
|
|
|
this.resists.put(SourceType.Fire, 0f); |
|
|
|
this.resists.put(DamageType.Cold, 0f); |
|
|
|
this.resists.put(SourceType.Cold, 0f); |
|
|
|
this.resists.put(DamageType.Healing, 0f); |
|
|
|
this.resists.put(SourceType.Healing, 0f); |
|
|
|
this.immuneTo.put(DamageType.Siege, true); |
|
|
|
this.immuneTo.put(SourceType.Siege, true); |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* Get a resist |
|
|
|
* Get a resist |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
public float getResist(DamageType type, int trains) { |
|
|
|
public float getResist(SourceType type, int trains) { |
|
|
|
//get resisted amount
|
|
|
|
//get resisted amount
|
|
|
|
Float amount = 0f; |
|
|
|
Float amount = 0f; |
|
|
|
if (this.resists.containsKey(type)) |
|
|
|
if (this.resists.containsKey(type)) |
|
|
@ -278,7 +277,7 @@ public class Resists { |
|
|
|
/** |
|
|
|
/** |
|
|
|
* get immuneTo |
|
|
|
* get immuneTo |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
public boolean immuneTo(DamageType type) { |
|
|
|
public boolean immuneTo(SourceType type) { |
|
|
|
if (this.immuneTo.containsKey(type)) |
|
|
|
if (this.immuneTo.containsKey(type)) |
|
|
|
return this.immuneTo.get(type); |
|
|
|
return this.immuneTo.get(type); |
|
|
|
else |
|
|
|
else |
|
|
@ -292,84 +291,46 @@ public class Resists { |
|
|
|
return this.immuneToAll; |
|
|
|
return this.immuneToAll; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public boolean immuneToPowers() { |
|
|
|
|
|
|
|
return immuneTo(DamageType.Powers); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public boolean immuneToAttacks() { |
|
|
|
public boolean immuneToAttacks() { |
|
|
|
return immuneTo(DamageType.Attack); |
|
|
|
return immuneTo(SourceType.ImmuneToAttack); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public boolean immuneToSpires() { |
|
|
|
|
|
|
|
return immuneTo(DamageType.Spires); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
|
|
* gets immuneTo(type) and immuneToAll |
|
|
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
public boolean isImmune(DamageType type) { |
|
|
|
|
|
|
|
if (this.immuneToAll) |
|
|
|
|
|
|
|
return true; |
|
|
|
|
|
|
|
return this.immuneTo(type); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* Set a resist |
|
|
|
* Set a resist |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
public void setResist(DamageType type, float value) { |
|
|
|
public void setResist(SourceType type, float value) { |
|
|
|
this.resists.put(type, value); |
|
|
|
this.resists.put(type, value); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
|
|
* add to a resist |
|
|
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
public void incResist(DamageType type, float value) { |
|
|
|
|
|
|
|
Float amount = this.resists.get(type); |
|
|
|
|
|
|
|
if (amount == null) |
|
|
|
|
|
|
|
this.resists.put(type, value); |
|
|
|
|
|
|
|
else |
|
|
|
|
|
|
|
this.resists.put(type, amount + value); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
|
|
* subtract from a resist |
|
|
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
public void decResist(DamageType type, float value) { |
|
|
|
|
|
|
|
Float amount = this.resists.get(type); |
|
|
|
|
|
|
|
if (amount == null) |
|
|
|
|
|
|
|
this.resists.put(type, (0 - value)); |
|
|
|
|
|
|
|
else |
|
|
|
|
|
|
|
this.resists.put(type, amount - value); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* set immunities from mobbase |
|
|
|
* set immunities from mobbase |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
public void setImmuneTo(int immune) { |
|
|
|
public void setImmuneTo(int immune) { |
|
|
|
setImmuneTo(DamageType.Stun, ((immune & 1) != 0)); |
|
|
|
setImmuneTo(SourceType.Stun, ((immune & 1) != 0)); |
|
|
|
setImmuneTo(DamageType.PowerBlock, ((immune & 2) != 0)); |
|
|
|
setImmuneTo(SourceType.Powerblock, ((immune & 2) != 0)); |
|
|
|
setImmuneTo(DamageType.Drain, ((immune & 4) != 0)); |
|
|
|
setImmuneTo(SourceType.Drain, ((immune & 4) != 0)); |
|
|
|
setImmuneTo(DamageType.Snare, ((immune & 8) != 0)); |
|
|
|
setImmuneTo(SourceType.Snare, ((immune & 8) != 0)); |
|
|
|
setImmuneTo(DamageType.Siege, ((immune & 16) != 0)); |
|
|
|
setImmuneTo(SourceType.Siege, ((immune & 16) != 0)); |
|
|
|
setImmuneTo(DamageType.Slash, ((immune & 32) != 0)); |
|
|
|
setImmuneTo(SourceType.Slashing, ((immune & 32) != 0)); |
|
|
|
setImmuneTo(DamageType.Crush, ((immune & 64) != 0)); |
|
|
|
setImmuneTo(SourceType.Crushing, ((immune & 64) != 0)); |
|
|
|
setImmuneTo(DamageType.Pierce, ((immune & 128) != 0)); |
|
|
|
setImmuneTo(SourceType.Piercing, ((immune & 128) != 0)); |
|
|
|
setImmuneTo(DamageType.Magic, ((immune & 256) != 0)); |
|
|
|
setImmuneTo(SourceType.Magic, ((immune & 256) != 0)); |
|
|
|
setImmuneTo(DamageType.Bleed, ((immune & 512) != 0)); |
|
|
|
setImmuneTo(SourceType.Bleeding, ((immune & 512) != 0)); |
|
|
|
setImmuneTo(DamageType.Poison, ((immune & 1024) != 0)); |
|
|
|
setImmuneTo(SourceType.Poison, ((immune & 1024) != 0)); |
|
|
|
setImmuneTo(DamageType.Mental, ((immune & 2048) != 0)); |
|
|
|
setImmuneTo(SourceType.Mental, ((immune & 2048) != 0)); |
|
|
|
setImmuneTo(DamageType.Holy, ((immune & 4096) != 0)); |
|
|
|
setImmuneTo(SourceType.Holy, ((immune & 4096) != 0)); |
|
|
|
setImmuneTo(DamageType.Unholy, ((immune & 8192) != 0)); |
|
|
|
setImmuneTo(SourceType.Unholy, ((immune & 8192) != 0)); |
|
|
|
setImmuneTo(DamageType.Lightning, ((immune & 16384) != 0)); |
|
|
|
setImmuneTo(SourceType.Lightning, ((immune & 16384) != 0)); |
|
|
|
setImmuneTo(DamageType.Fire, ((immune & 32768) != 0)); |
|
|
|
setImmuneTo(SourceType.Fire, ((immune & 32768) != 0)); |
|
|
|
setImmuneTo(DamageType.Cold, ((immune & 65536) != 0)); |
|
|
|
setImmuneTo(SourceType.Cold, ((immune & 65536) != 0)); |
|
|
|
setImmuneTo(DamageType.Steel, ((immune & 131072) != 0)); |
|
|
|
setImmuneTo(SourceType.Steal, ((immune & 131072) != 0)); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* set/unset immuneTo |
|
|
|
* set/unset immuneTo |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
public void setImmuneTo(DamageType type, boolean value) { |
|
|
|
public void setImmuneTo(SourceType type, boolean value) { |
|
|
|
this.immuneTo.put(type, value); |
|
|
|
this.immuneTo.put(type, value); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -392,7 +353,7 @@ public class Resists { |
|
|
|
* get Damage after resist |
|
|
|
* get Damage after resist |
|
|
|
* Expects heals as negative damage and damage as positive damage for fortitudes. |
|
|
|
* Expects heals as negative damage and damage as positive damage for fortitudes. |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
public float getResistedDamage(AbstractCharacter source, AbstractCharacter target, DamageType type, float damage, int trains) { |
|
|
|
public float getResistedDamage(AbstractCharacter source, AbstractCharacter target, SourceType type, float damage, int trains) { |
|
|
|
//handle fortitudes
|
|
|
|
//handle fortitudes
|
|
|
|
damage = handleFortitude(target, type, damage); |
|
|
|
damage = handleFortitude(target, type, damage); |
|
|
|
//calculate armor piercing
|
|
|
|
//calculate armor piercing
|
|
|
@ -430,32 +391,32 @@ 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(DamageType.Stun, true); |
|
|
|
this.immuneTo.put(SourceType.Stun, true); |
|
|
|
if (rb.getBool(ModType.ImmuneTo, SourceType.Blind)) |
|
|
|
if (rb.getBool(ModType.ImmuneTo, SourceType.Blind)) |
|
|
|
this.immuneTo.put(DamageType.Blind, true); |
|
|
|
this.immuneTo.put(SourceType.Blind, true); |
|
|
|
if (rb.getBool(ModType.ImmuneToAttack, SourceType.None)) |
|
|
|
if (rb.getBool(ModType.ImmuneToAttack, SourceType.None)) |
|
|
|
this.immuneTo.put(DamageType.Attack, true); |
|
|
|
this.immuneTo.put(SourceType.ImmuneToAttack, true); |
|
|
|
if (rb.getBool(ModType.ImmuneToPowers, SourceType.None)) |
|
|
|
if (rb.getBool(ModType.ImmuneToPowers, SourceType.None)) |
|
|
|
this.immuneTo.put(DamageType.Powers, true); |
|
|
|
this.immuneTo.put(SourceType.ImmuneToPowers, true); |
|
|
|
if (rb.getBool(ModType.ImmuneTo, SourceType.Powerblock)) |
|
|
|
if (rb.getBool(ModType.ImmuneTo, SourceType.Powerblock)) |
|
|
|
this.immuneTo.put(DamageType.Powerblock, true); |
|
|
|
this.immuneTo.put(SourceType.Powerblock, true); |
|
|
|
if (rb.getBool(ModType.ImmuneTo, SourceType.DeBuff)) |
|
|
|
if (rb.getBool(ModType.ImmuneTo, SourceType.DeBuff)) |
|
|
|
this.immuneTo.put(DamageType.DeBuff, true); |
|
|
|
this.immuneTo.put(SourceType.DeBuff, true); |
|
|
|
if (rb.getBool(ModType.ImmuneTo, SourceType.Fear)) |
|
|
|
if (rb.getBool(ModType.ImmuneTo, SourceType.Fear)) |
|
|
|
this.immuneTo.put(DamageType.Fear, true); |
|
|
|
this.immuneTo.put(SourceType.Fear, true); |
|
|
|
if (rb.getBool(ModType.ImmuneTo, SourceType.Charm)) |
|
|
|
if (rb.getBool(ModType.ImmuneTo, SourceType.Charm)) |
|
|
|
this.immuneTo.put(DamageType.Charm, true); |
|
|
|
this.immuneTo.put(SourceType.Charm, true); |
|
|
|
if (rb.getBool(ModType.ImmuneTo, SourceType.Root)) |
|
|
|
if (rb.getBool(ModType.ImmuneTo, SourceType.Root)) |
|
|
|
this.immuneTo.put(DamageType.Root, true); |
|
|
|
this.immuneTo.put(SourceType.Root, true); |
|
|
|
if (rb.getBool(ModType.ImmuneTo, SourceType.Snare)) |
|
|
|
if (rb.getBool(ModType.ImmuneTo, SourceType.Snare)) |
|
|
|
this.immuneTo.put(DamageType.Snare, true); |
|
|
|
this.immuneTo.put(SourceType.Snare, true); |
|
|
|
|
|
|
|
|
|
|
|
// Handle resists
|
|
|
|
// Handle resists
|
|
|
|
slash += rb.getFloat(ModType.Resistance, SourceType.Slash); |
|
|
|
slash += rb.getFloat(ModType.Resistance, SourceType.Slashing); |
|
|
|
crush += rb.getFloat(ModType.Resistance, SourceType.Crush); |
|
|
|
crush += rb.getFloat(ModType.Resistance, SourceType.Crushing); |
|
|
|
pierce += rb.getFloat(ModType.Resistance, SourceType.Pierce); |
|
|
|
pierce += rb.getFloat(ModType.Resistance, SourceType.Piercing); |
|
|
|
magic += rb.getFloat(ModType.Resistance, SourceType.Magic); |
|
|
|
magic += rb.getFloat(ModType.Resistance, SourceType.Magic); |
|
|
|
bleed += rb.getFloat(ModType.Resistance, SourceType.Bleed); |
|
|
|
bleed += rb.getFloat(ModType.Resistance, SourceType.Bleeding); |
|
|
|
poison += rb.getFloat(ModType.Resistance, SourceType.Poison); |
|
|
|
poison += rb.getFloat(ModType.Resistance, SourceType.Poison); |
|
|
|
mental += rb.getFloat(ModType.Resistance, SourceType.Mental); |
|
|
|
mental += rb.getFloat(ModType.Resistance, SourceType.Mental); |
|
|
|
holy += rb.getFloat(ModType.Resistance, SourceType.Holy); |
|
|
|
holy += rb.getFloat(ModType.Resistance, SourceType.Holy); |
|
|
@ -465,19 +426,6 @@ public class Resists { |
|
|
|
cold += rb.getFloat(ModType.Resistance, SourceType.Cold); |
|
|
|
cold += rb.getFloat(ModType.Resistance, SourceType.Cold); |
|
|
|
healing += rb.getFloat(ModType.Resistance, SourceType.Healing); // DamageType.Healing.name());
|
|
|
|
healing += rb.getFloat(ModType.Resistance, SourceType.Healing); // DamageType.Healing.name());
|
|
|
|
|
|
|
|
|
|
|
|
//HHO
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// String protectionString = rb.getString("protection");
|
|
|
|
|
|
|
|
//
|
|
|
|
|
|
|
|
// if (protectionString.isEmpty())
|
|
|
|
|
|
|
|
// this.protection = null;
|
|
|
|
|
|
|
|
// else try {
|
|
|
|
|
|
|
|
// this.protection = DamageType.valueOf(rb.getString("protection"));
|
|
|
|
|
|
|
|
// } catch (IllegalArgumentException e) {
|
|
|
|
|
|
|
|
// Logger.error( "No enum for: " + protectionString);
|
|
|
|
|
|
|
|
// this.protection = null;
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
// this.protectionTrains = rb.getFloat("protection");
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// get resists from equipment
|
|
|
|
// get resists from equipment
|
|
|
@ -500,30 +448,30 @@ public class Resists { |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
this.resists.put(DamageType.Slash, slash); |
|
|
|
this.resists.put(SourceType.Slashing, slash); |
|
|
|
this.resists.put(DamageType.Crush, crush); |
|
|
|
this.resists.put(SourceType.Crushing, crush); |
|
|
|
this.resists.put(DamageType.Pierce, pierce); |
|
|
|
this.resists.put(SourceType.Piercing, pierce); |
|
|
|
this.resists.put(DamageType.Magic, magic); |
|
|
|
this.resists.put(SourceType.Magic, magic); |
|
|
|
this.resists.put(DamageType.Bleed, bleed); |
|
|
|
this.resists.put(SourceType.Bleeding, bleed); |
|
|
|
this.resists.put(DamageType.Poison, poison); |
|
|
|
this.resists.put(SourceType.Poison, poison); |
|
|
|
this.resists.put(DamageType.Mental, mental); |
|
|
|
this.resists.put(SourceType.Mental, mental); |
|
|
|
this.resists.put(DamageType.Holy, holy); |
|
|
|
this.resists.put(SourceType.Holy, holy); |
|
|
|
this.resists.put(DamageType.Unholy, unholy); |
|
|
|
this.resists.put(SourceType.Unholy, unholy); |
|
|
|
this.resists.put(DamageType.Lightning, lightning); |
|
|
|
this.resists.put(SourceType.Lightning, lightning); |
|
|
|
this.resists.put(DamageType.Fire, fire); |
|
|
|
this.resists.put(SourceType.Fire, fire); |
|
|
|
this.resists.put(DamageType.Cold, cold); |
|
|
|
this.resists.put(SourceType.Cold, cold); |
|
|
|
this.resists.put(DamageType.Healing, healing); |
|
|
|
this.resists.put(SourceType.Healing, healing); |
|
|
|
|
|
|
|
|
|
|
|
this.immuneTo.put(DamageType.Siege, true); |
|
|
|
this.immuneTo.put(SourceType.Siege, true); |
|
|
|
|
|
|
|
|
|
|
|
// debug printing of resists
|
|
|
|
// debug printing of resists
|
|
|
|
// printResists(pc);
|
|
|
|
// printResists(pc);
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public void printResistsToClient(PlayerCharacter pc) { |
|
|
|
public void printResistsToClient(PlayerCharacter pc) { |
|
|
|
for (DamageType dt : resists.keySet()) |
|
|
|
for (SourceType dt : resists.keySet()) |
|
|
|
ChatManager.chatSystemInfo(pc, " resist." + dt.name() + ": " + resists.get(dt)); |
|
|
|
ChatManager.chatSystemInfo(pc, " resist." + dt.name() + ": " + resists.get(dt)); |
|
|
|
for (DamageType dt : immuneTo.keySet()) |
|
|
|
for (SourceType dt : immuneTo.keySet()) |
|
|
|
ChatManager.chatSystemInfo(pc, " immuneTo." + dt.name() + ": " + immuneTo.get(dt)); |
|
|
|
ChatManager.chatSystemInfo(pc, " immuneTo." + dt.name() + ": " + immuneTo.get(dt)); |
|
|
|
ChatManager.chatSystemInfo(pc, " immuneToAll: " + this.immuneToAll); |
|
|
|
ChatManager.chatSystemInfo(pc, " immuneToAll: " + this.immuneToAll); |
|
|
|
if (protection != null) |
|
|
|
if (protection != null) |
|
|
@ -536,9 +484,9 @@ public class Resists { |
|
|
|
String out = pc.getName(); |
|
|
|
String out = pc.getName(); |
|
|
|
|
|
|
|
|
|
|
|
out += "Resists: "; |
|
|
|
out += "Resists: "; |
|
|
|
Iterator<DamageType> it = this.resists.keySet().iterator(); |
|
|
|
Iterator<SourceType> it = this.resists.keySet().iterator(); |
|
|
|
while (it.hasNext()) { |
|
|
|
while (it.hasNext()) { |
|
|
|
DamageType damType = it.next(); |
|
|
|
SourceType damType = it.next(); |
|
|
|
String dtName = damType.name(); |
|
|
|
String dtName = damType.name(); |
|
|
|
out += dtName + '=' + this.resists.get(dtName) + ", "; |
|
|
|
out += dtName + '=' + this.resists.get(dtName) + ", "; |
|
|
|
} |
|
|
|
} |
|
|
@ -546,7 +494,7 @@ public class Resists { |
|
|
|
out += "ImmuneTo: "; |
|
|
|
out += "ImmuneTo: "; |
|
|
|
it = this.immuneTo.keySet().iterator(); |
|
|
|
it = this.immuneTo.keySet().iterator(); |
|
|
|
while (it.hasNext()) { |
|
|
|
while (it.hasNext()) { |
|
|
|
DamageType damType = it.next(); |
|
|
|
SourceType damType = it.next(); |
|
|
|
|
|
|
|
|
|
|
|
String dtName = damType.name(); |
|
|
|
String dtName = damType.name(); |
|
|
|
out += dtName + '=' + this.resists.get(dtName) + ", "; |
|
|
|
out += dtName + '=' + this.resists.get(dtName) + ", "; |
|
|
|