Browse Source

Merge Damage and Source types.

combat-2
MagicBot 9 months ago
parent
commit
e8e84e00af
  1. 69
      src/engine/Enum.java
  2. 8
      src/engine/gameManager/CombatManager.java
  3. 9
      src/engine/gameManager/NPCManager.java
  4. 16
      src/engine/mobileAI/utilities/CombatUtilities.java
  5. 2
      src/engine/objects/AbstractCharacter.java
  6. 4
      src/engine/objects/Effect.java
  7. 7
      src/engine/objects/ItemBase.java
  8. 4
      src/engine/objects/ItemTemplate.java
  9. 294
      src/engine/objects/Resists.java
  10. 9
      src/engine/powers/DamageShield.java
  11. 35
      src/engine/powers/EffectsBase.java
  12. 6
      src/engine/powers/effectmodifiers/DamageShieldEffectModifier.java
  13. 8
      src/engine/powers/effectmodifiers/HealthEffectModifier.java
  14. 7
      src/engine/powers/effectmodifiers/ManaEffectModifier.java
  15. 7
      src/engine/powers/effectmodifiers/StaminaEffectModifier.java
  16. 5
      src/engine/powers/poweractions/TransferStatPowerAction.java

69
src/engine/Enum.java

@ -774,58 +774,6 @@ public class Enum {
} }
} }
public enum DamageType {
None,
Crush,
Slash,
Siege,
Pierce,
Magic,
Bleed,
Poison,
Mental,
Holy,
Unholy,
Lightning,
Fire,
Cold,
Healing,
Acid,
Disease,
Unknown,
// these added for immunities
Attack,
Powers,
Combat,
Spires,
Snare,
Stun,
Blind,
Root,
Fear,
Charm,
PowerBlock,
DeBuff,
Powerblock,
Steel,
Drain;
public static DamageType GetDamageType(String modName) {
DamageType damageType;
if (modName.isEmpty())
return DamageType.None;
try {
damageType = DamageType.valueOf(modName.replace(",", ""));
} catch (Exception e) {
Logger.error(e);
return DamageType.None;
}
return damageType;
}
}
public enum SourceType { public enum SourceType {
None, None,
Abjuration, Abjuration,
@ -837,7 +785,7 @@ public class Enum {
Beastcraft, Beastcraft,
Benediction, Benediction,
BladeWeaving, BladeWeaving,
Bleed, Bleeding,
Blind, Blind,
Block, Block,
Bloodcraft, Bloodcraft,
@ -846,11 +794,10 @@ public class Enum {
Channeling, Channeling,
Charm, Charm,
Cold, Cold,
COLD,
Constitution, Constitution,
Corruption, Corruption,
Crossbow, Crossbow,
Crush, Crushing,
Dagger, Dagger,
DaggerMastery, DaggerMastery,
DeBuff, DeBuff,
@ -864,16 +811,13 @@ public class Enum {
Exorcism, Exorcism,
Fear, Fear,
Fire, Fire,
FIRE,
Fly, Fly,
Giant, Giant,
GreatAxeMastery, GreatAxeMastery,
GreatSwordMastery, GreatSwordMastery,
Hammer, Hammer,
Heal,
Healing, Healing,
Holy, Holy,
HOLY,
ImmuneToAttack, ImmuneToAttack,
ImmuneToPowers, ImmuneToPowers,
Intelligence, Intelligence,
@ -882,15 +826,12 @@ public class Enum {
LIGHTNING, LIGHTNING,
Liturgy, Liturgy,
Magic, Magic,
MAGIC,
Mental, Mental,
MENTAL,
NatureLore, NatureLore,
Necromancy, Necromancy,
Parry, Parry,
Pierce, Piercing,
Poison, Poison,
POISON,
PoleArm, PoleArm,
Powerblock, Powerblock,
Rat, Rat,
@ -899,13 +840,14 @@ public class Enum {
Root, Root,
Shadowmastery, Shadowmastery,
Siege, Siege,
Slash, Slashing,
Snare, Snare,
Sorcery, Sorcery,
Spear, Spear,
SpearMastery, SpearMastery,
Spirit, Spirit,
Staff, Staff,
Steal,
Stormcalling, Stormcalling,
Strength, Strength,
Stun, Stun,
@ -918,7 +860,6 @@ public class Enum {
UnarmedCombat, UnarmedCombat,
UnarmedCombatMastery, UnarmedCombatMastery,
Unholy, Unholy,
UNHOLY,
Unknown, Unknown,
Warding, Warding,
Warlockry, Warlockry,

8
src/engine/gameManager/CombatManager.java

@ -686,14 +686,14 @@ public enum CombatManager {
//Get damage Type //Get damage Type
DamageType damageType; SourceType damageType;
if (wb != null) if (wb != null)
damageType = wb.getDamageType(); damageType = wb.getDamageType();
else if (attacker.getObjectType().equals(GameObjectType.Mob) && ((Mob) attacker).isSiege()) else if (attacker.getObjectType().equals(GameObjectType.Mob) && ((Mob) attacker).isSiege())
damageType = DamageType.Siege; damageType = SourceType.Siege;
else else
damageType = DamageType.Crush; damageType = SourceType.Crushing;
errorTrack = 10; errorTrack = 10;
@ -910,7 +910,7 @@ public enum CombatManager {
} }
private static float calculateDamage(AbstractCharacter source, AbstractCharacter target, float minDamage, float maxDamage, DamageType damageType, Resists resists) { private static float calculateDamage(AbstractCharacter source, AbstractCharacter target, float minDamage, float maxDamage, SourceType damageType, Resists resists) {
//get range between min and max //get range between min and max

9
src/engine/gameManager/NPCManager.java

@ -5,17 +5,14 @@ import engine.InterestManagement.WorldGrid;
import engine.math.Quaternion; import engine.math.Quaternion;
import engine.math.Vector3f; import engine.math.Vector3f;
import engine.math.Vector3fImmutable; import engine.math.Vector3fImmutable;
import engine.mobileAI.MobAI;
import engine.net.Dispatch; import engine.net.Dispatch;
import engine.net.DispatchMessage; import engine.net.DispatchMessage;
import engine.net.client.msg.PetMsg; import engine.net.client.msg.PetMsg;
import engine.objects.*; import engine.objects.*;
import engine.powers.EffectsBase; import engine.powers.EffectsBase;
import engine.powers.PowersBase;
import engine.powers.RuneSkillAdjustEntry; import engine.powers.RuneSkillAdjustEntry;
import org.pmw.tinylog.Logger; import org.pmw.tinylog.Logger;
import javax.smartcardio.ATR;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
import java.util.concurrent.ThreadLocalRandom; import java.util.concurrent.ThreadLocalRandom;
@ -428,9 +425,9 @@ public enum NPCManager {
for(MobEquipment equipped : mob.equip.values()){ for(MobEquipment equipped : mob.equip.values()){
ItemBase itemBase = equipped.getItemBase(); ItemBase itemBase = equipped.getItemBase();
if(itemBase.isHeavyArmor() || itemBase.isLightArmor() || itemBase.isMediumArmor()){ if(itemBase.isHeavyArmor() || itemBase.isLightArmor() || itemBase.isMediumArmor()){
mob.resists.setResist(Enum.DamageType.Crush, mob.resists.getResist(Enum.DamageType.Crush,0) + itemBase.getCrushResist()); mob.resists.setResist(Enum.SourceType.Crushing, mob.resists.getResist(Enum.SourceType.Crushing, 0) + itemBase.getCrushResist());
mob.resists.setResist(Enum.DamageType.Slash, mob.resists.getResist(Enum.DamageType.Slash,0) + itemBase.getCrushResist()); mob.resists.setResist(Enum.SourceType.Slashing, mob.resists.getResist(Enum.SourceType.Slashing, 0) + itemBase.getCrushResist());
mob.resists.setResist(Enum.DamageType.Pierce, mob.resists.getResist(Enum.DamageType.Pierce,0) + itemBase.getCrushResist()); mob.resists.setResist(Enum.SourceType.Piercing, mob.resists.getResist(Enum.SourceType.Piercing, 0) + itemBase.getCrushResist());
} }
} }
} }

16
src/engine/mobileAI/utilities/CombatUtilities.java

@ -9,7 +9,10 @@
package engine.mobileAI.utilities; package engine.mobileAI.utilities;
import engine.Enum.*; import engine.Enum.DispatchChannel;
import engine.Enum.GameObjectType;
import engine.Enum.ModType;
import engine.Enum.SourceType;
import engine.gameManager.ChatManager; import engine.gameManager.ChatManager;
import engine.gameManager.CombatManager; import engine.gameManager.CombatManager;
import engine.math.Vector3fImmutable; import engine.math.Vector3fImmutable;
@ -22,7 +25,6 @@ import org.pmw.tinylog.Logger;
import java.util.concurrent.ThreadLocalRandom; import java.util.concurrent.ThreadLocalRandom;
import static engine.math.FastMath.sqr; import static engine.math.FastMath.sqr;
import static java.lang.Math.pow;
public class CombatUtilities { public class CombatUtilities {
@ -214,10 +216,10 @@ public class CombatUtilities {
else else
speed = agent.getSpeedHandTwo(); speed = agent.getSpeedHandTwo();
DamageType dt = DamageType.Crush; SourceType dt = SourceType.Crushing;
if (agent.isSiege()) if (agent.isSiege())
dt = DamageType.Siege; dt = SourceType.Siege;
if (wb != null) { if (wb != null) {
anim = CombatManager.getSwingAnimation(wb, null, mainHand); anim = CombatManager.getSwingAnimation(wb, null, mainHand);
dt = wb.getDamageType(); dt = wb.getDamageType();
@ -311,7 +313,7 @@ public class CombatUtilities {
int damage = 0; int damage = 0;
DamageType dt = getDamageType(agent); SourceType dt = getDamageType(agent);
damage = ThreadLocalRandom.current().nextInt((int)getMinDmg(agent), (int)getMaxDmg(agent) + 1); damage = ThreadLocalRandom.current().nextInt((int)getMinDmg(agent), (int)getMaxDmg(agent) + 1);
if (AbstractWorldObject.IsAbstractCharacter(target)) { if (AbstractWorldObject.IsAbstractCharacter(target)) {
if (((AbstractCharacter) target).isSit()) { if (((AbstractCharacter) target).isSit()) {
@ -327,8 +329,8 @@ public class CombatUtilities {
return damage; return damage;
} }
public static DamageType getDamageType(Mob agent) { public static SourceType getDamageType(Mob agent) {
DamageType dt = DamageType.Crush; SourceType dt = SourceType.Crushing;
if (agent.getEquip().get(1) != null) { if (agent.getEquip().get(1) != null) {
return agent.getEquip().get(1).getItemBase().getDamageType(); return agent.getEquip().get(1).getItemBase().getDamageType();
} }

2
src/engine/objects/AbstractCharacter.java

@ -1651,7 +1651,7 @@ public abstract class AbstractCharacter extends AbstractWorldObject {
PowersManager.cancelOnTakeDamage(this); PowersManager.cancelOnTakeDamage(this);
} }
public final void cancelOnTakeDamage(final DamageType type, final float amount) { public final void cancelOnTakeDamage(final SourceType type, final float amount) {
boolean changed = false; boolean changed = false;
for (String s : this.effects.keySet()) { for (String s : this.effects.keySet()) {
Effect eff = this.effects.get(s); Effect eff = this.effects.get(s);

4
src/engine/objects/Effect.java

@ -9,7 +9,7 @@
package engine.objects; package engine.objects;
import engine.Enum.DamageType; import engine.Enum;
import engine.Enum.EffectSourceType; import engine.Enum.EffectSourceType;
import engine.gameManager.PowersManager; import engine.gameManager.PowersManager;
import engine.job.AbstractJob; import engine.job.AbstractJob;
@ -592,7 +592,7 @@ public class Effect {
} }
//Used for verifying when damage absorbers fails //Used for verifying when damage absorbers fails
public boolean cancelOnTakeDamage(DamageType type, float amount) { public boolean cancelOnTakeDamage(Enum.SourceType type, float amount) {
if (!this.eb.cancelOnTakeDamage()) if (!this.eb.cancelOnTakeDamage())
return false; return false;
if (this.eb == null || amount < 0f) if (this.eb == null || amount < 0f)

7
src/engine/objects/ItemBase.java

@ -10,7 +10,6 @@
package engine.objects; package engine.objects;
import engine.Enum; import engine.Enum;
import engine.Enum.DamageType;
import engine.Enum.GameObjectType; import engine.Enum.GameObjectType;
import engine.Enum.ItemType; import engine.Enum.ItemType;
import engine.gameManager.DbManager; import engine.gameManager.DbManager;
@ -72,7 +71,7 @@ public class ItemBase {
private final short minDamage; private final short minDamage;
private final short maxDamage; private final short maxDamage;
private final String mastery; private final String mastery;
private final engine.Enum.DamageType damageType; private final engine.Enum.SourceType damageType;
private final boolean twoHanded; private final boolean twoHanded;
private boolean isConsumable; private boolean isConsumable;
private boolean isStackable; private boolean isStackable;
@ -133,7 +132,7 @@ public class ItemBase {
this.requiredDiscs = DbManager.parseEnumSet(rs.getString("disc_required"), Enum.DisciplineType.class); this.requiredDiscs = DbManager.parseEnumSet(rs.getString("disc_required"), Enum.DisciplineType.class);
this.mastery = rs.getString("mastery"); this.mastery = rs.getString("mastery");
damageType = DamageType.valueOf(rs.getString("damageType")); damageType = Enum.SourceType.valueOf(rs.getString("damageType"));
this.twoHanded = (rs.getInt("twoHanded") == 1); this.twoHanded = (rs.getInt("twoHanded") == 1);
@ -900,7 +899,7 @@ public class ItemBase {
/** /**
* @return the damageType * @return the damageType
*/ */
public engine.Enum.DamageType getDamageType() { public Enum.SourceType getDamageType() {
return damageType; return damageType;
} }

4
src/engine/objects/ItemTemplate.java

@ -54,7 +54,7 @@ public class ItemTemplate {
public int item_weapon_projectile_id; public int item_weapon_projectile_id;
public float item_weapon_projectile_speed; public float item_weapon_projectile_speed;
public int item_weapon_combat_idle_anim; public int item_weapon_combat_idle_anim;
public Enum.DamageType item_weapon_damage_type; public Enum.SourceType item_weapon_damage_type;
public int item_weapon_damage_min; public int item_weapon_damage_min;
public int item_weapon_damage_max; public int item_weapon_damage_max;
public EnumSet<Enum.ItemFlags> item_flags = EnumSet.noneOf(Enum.ItemFlags.class); public EnumSet<Enum.ItemFlags> item_flags = EnumSet.noneOf(Enum.ItemFlags.class);
@ -169,7 +169,7 @@ public class ItemTemplate {
for (Object o : weapon_damage) { for (Object o : weapon_damage) {
JSONObject damage_entry = (JSONObject) o; JSONObject damage_entry = (JSONObject) o;
item_weapon_damage_type = Enum.DamageType.valueOf((String) damage_entry.get("damage_type")); item_weapon_damage_type = Enum.SourceType.valueOf((String) damage_entry.get("damage_type"));
item_weapon_damage_min = ((Long) damage_entry.get("damage_min")).intValue(); item_weapon_damage_min = ((Long) damage_entry.get("damage_min")).intValue();
item_weapon_damage_max = ((Long) damage_entry.get("damage_max")).intValue(); item_weapon_damage_max = ((Long) damage_entry.get("damage_max")).intValue();
} }

294
src/engine/objects/Resists.java

@ -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) + ", ";

9
src/engine/powers/DamageShield.java

@ -8,23 +8,22 @@
package engine.powers; package engine.powers;
import engine.Enum;
import engine.Enum.DamageType;
public class DamageShield { public class DamageShield {
private final DamageType damageType; private final Enum.SourceType damageType;
private final float amount; private final float amount;
private final boolean usePercent; private final boolean usePercent;
public DamageShield(DamageType damageType, float amount, boolean usePercent) { public DamageShield(Enum.SourceType damageType, float amount, boolean usePercent) {
super(); super();
this.damageType = damageType; this.damageType = damageType;
this.amount = amount; this.amount = amount;
this.usePercent = usePercent; this.usePercent = usePercent;
} }
public DamageType getDamageType() { public Enum.SourceType getDamageType() {
return this.damageType; return this.damageType;
} }

35
src/engine/powers/EffectsBase.java

@ -10,7 +10,6 @@
package engine.powers; package engine.powers;
import engine.Enum; import engine.Enum;
import engine.Enum.DamageType;
import engine.Enum.EffectSourceType; import engine.Enum.EffectSourceType;
import engine.Enum.GameObjectType; import engine.Enum.GameObjectType;
import engine.Enum.PowerFailCondition; 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>>> NewEffectsMap = new HashMap<>();
public static HashMap<String, HashMap<String, ArrayList<String>>> ChangedEffectsMap = 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<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<>(); 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 ConcurrentHashMap<String, String> itemEffectsByName = new ConcurrentHashMap<>(MBServerStatics.CHM_INIT_CAP, MBServerStatics.CHM_LOAD, MBServerStatics.CHM_THREAD_LOW);
private static int NewID = 3000; private static int NewID = 3000;
@ -245,7 +244,7 @@ public class EffectsBase {
damageType3 = "Pierce"; damageType3 = "Pierce";
if (damageType3.equalsIgnoreCase("Slashing")) if (damageType3.equalsIgnoreCase("Slashing"))
damageType3 = "Slash"; damageType3 = "Slash";
DamageType dt = getDamageType(damageType1); Enum.SourceType dt = getDamageType(damageType1);
if (dt != null) if (dt != null)
EffectsBase.EffectDamageTypes.get(eb.token).add(dt); EffectsBase.EffectDamageTypes.get(eb.token).add(dt);
@ -301,27 +300,13 @@ public class EffectsBase {
} }
private static DamageType getDamageType(String name) { private static Enum.SourceType getDamageType(String name) {
try {
switch (name) { if (name.isEmpty())
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);
return null; return null;
} else
return Enum.SourceType.valueOf(name);
} }
public static String getItemEffectsByName(String string) { 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)) if (!EffectsBase.EffectDamageTypes.containsKey(this.token))
return false; return false;
return EffectsBase.EffectDamageTypes.get(this.token).contains(dt); return EffectsBase.EffectDamageTypes.get(this.token).contains(dt);
@ -742,7 +727,7 @@ public class EffectsBase {
String text = ""; String text = "";
if (!EffectsBase.EffectDamageTypes.containsKey(this.token)) if (!EffectsBase.EffectDamageTypes.containsKey(this.token))
return text; return text;
for (DamageType type : EffectsBase.EffectDamageTypes.get(this.token)) { for (Enum.SourceType type : EffectsBase.EffectDamageTypes.get(this.token)) {
text += type.name() + ' '; text += type.name() + ' ';
} }
return text; return text;

6
src/engine/powers/effectmodifiers/DamageShieldEffectModifier.java

@ -8,8 +8,7 @@
package engine.powers.effectmodifiers; package engine.powers.effectmodifiers;
import engine.Enum;
import engine.Enum.DamageType;
import engine.jobs.AbstractEffectJob; import engine.jobs.AbstractEffectJob;
import engine.objects.*; import engine.objects.*;
import engine.powers.DamageShield; import engine.powers.DamageShield;
@ -49,7 +48,8 @@ public class DamageShieldEffectModifier extends AbstractEffectModifier {
amount *= (1 + mod); amount *= (1 + mod);
} }
DamageType dt = DamageType.valueOf(this.type); Enum.SourceType dt = Enum.SourceType.valueOf(this.type);
if (dt != null) { if (dt != null) {
DamageShield ds = new DamageShield(dt, amount, usePercent); DamageShield ds = new DamageShield(dt, amount, usePercent);
PlayerBonuses bonus = ac.getBonuses(); PlayerBonuses bonus = ac.getBonuses();

8
src/engine/powers/effectmodifiers/HealthEffectModifier.java

@ -8,8 +8,6 @@
package engine.powers.effectmodifiers; package engine.powers.effectmodifiers;
import engine.Enum.DamageType;
import engine.Enum.GameObjectType; import engine.Enum.GameObjectType;
import engine.Enum.ModType; import engine.Enum.ModType;
import engine.Enum.SourceType; import engine.Enum.SourceType;
@ -29,13 +27,13 @@ import java.util.concurrent.ThreadLocalRandom;
public class HealthEffectModifier extends AbstractEffectModifier { public class HealthEffectModifier extends AbstractEffectModifier {
private DamageType damageType; private SourceType damageType;
public HealthEffectModifier(ResultSet rs) throws SQLException { public HealthEffectModifier(ResultSet rs) throws SQLException {
super(rs); super(rs);
String damageTypeDB = rs.getString("type"); String damageTypeDB = rs.getString("type");
try { try {
this.damageType = DamageType.valueOf(damageTypeDB); this.damageType = SourceType.valueOf(damageTypeDB);
} catch (IllegalArgumentException e) { } catch (IllegalArgumentException e) {
Logger.error("DamageType could not be loaded from database. " + "UUID = " + this.UUID Logger.error("DamageType could not be loaded from database. " + "UUID = " + this.UUID
+ " value received = '" + damageTypeDB + '\'', e); + " value received = '" + damageTypeDB + '\'', e);
@ -205,7 +203,7 @@ public class HealthEffectModifier extends AbstractEffectModifier {
}*/ }*/
PlayerBonuses bonus = ac.getBonuses(); PlayerBonuses bonus = ac.getBonuses();
if (!skipImmune && bonus.getFloat(ModType.BlackMantle, SourceType.Heal) >= trains) { if (!skipImmune && bonus.getFloat(ModType.BlackMantle, SourceType.Healing) >= trains) {
ModifyHealthMsg mhm = new ModifyHealthMsg(source, ac, 0f, 0f, 0f, powerID, powerName, trains, effectID); ModifyHealthMsg mhm = new ModifyHealthMsg(source, ac, 0f, 0f, 0f, powerID, powerName, trains, effectID);
mhm.setUnknown03(5); //set target is immune mhm.setUnknown03(5); //set target is immune
DispatchMessage.sendToAllInRange(ac, mhm); DispatchMessage.sendToAllInRange(ac, mhm);

7
src/engine/powers/effectmodifiers/ManaEffectModifier.java

@ -10,7 +10,6 @@
package engine.powers.effectmodifiers; package engine.powers.effectmodifiers;
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;
@ -32,13 +31,13 @@ import java.util.concurrent.ThreadLocalRandom;
public class ManaEffectModifier extends AbstractEffectModifier { public class ManaEffectModifier extends AbstractEffectModifier {
private DamageType damageType; private SourceType damageType;
public ManaEffectModifier(ResultSet rs) throws SQLException { public ManaEffectModifier(ResultSet rs) throws SQLException {
super(rs); super(rs);
String damageTypeDB = rs.getString("type"); String damageTypeDB = rs.getString("type");
try { try {
this.damageType = DamageType.valueOf(damageTypeDB); this.damageType = SourceType.valueOf(damageTypeDB);
} catch (IllegalArgumentException e) { } catch (IllegalArgumentException e) {
Logger.error("DamageType could not be loaded from database. " + "UUID = " + this.UUID Logger.error("DamageType could not be loaded from database. " + "UUID = " + this.UUID
+ " value received = '" + damageTypeDB + '\'', e); + " value received = '" + damageTypeDB + '\'', e);
@ -158,7 +157,7 @@ public class ManaEffectModifier extends AbstractEffectModifier {
} }
} }
PlayerBonuses bonus = ac.getBonuses(); PlayerBonuses bonus = ac.getBonuses();
if (!skipImmune && bonus.getFloat(ModType.BlackMantle, SourceType.Heal) >= trains) { if (!skipImmune && bonus.getFloat(ModType.BlackMantle, SourceType.Healing) >= trains) {
ModifyHealthMsg mhm = new ModifyHealthMsg(source, ac, 0f, 0f, 0f, powerID, powerName, trains, effectID); ModifyHealthMsg mhm = new ModifyHealthMsg(source, ac, 0f, 0f, 0f, powerID, powerName, trains, effectID);
mhm.setUnknown03(5); //set target is immune mhm.setUnknown03(5); //set target is immune
DispatchMessage.sendToAllInRange(ac, mhm); DispatchMessage.sendToAllInRange(ac, mhm);

7
src/engine/powers/effectmodifiers/StaminaEffectModifier.java

@ -10,7 +10,6 @@
package engine.powers.effectmodifiers; package engine.powers.effectmodifiers;
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;
@ -32,13 +31,13 @@ import java.util.concurrent.ThreadLocalRandom;
public class StaminaEffectModifier extends AbstractEffectModifier { public class StaminaEffectModifier extends AbstractEffectModifier {
private DamageType damageType; private SourceType damageType;
public StaminaEffectModifier(ResultSet rs) throws SQLException { public StaminaEffectModifier(ResultSet rs) throws SQLException {
super(rs); super(rs);
String damageTypeDB = rs.getString("type"); String damageTypeDB = rs.getString("type");
try { try {
this.damageType = DamageType.valueOf(damageTypeDB); this.damageType = SourceType.valueOf(damageTypeDB);
} catch (IllegalArgumentException e) { } catch (IllegalArgumentException e) {
Logger.error("DamageType could not be loaded from database. " + "UUID = " + this.UUID Logger.error("DamageType could not be loaded from database. " + "UUID = " + this.UUID
+ " value received = '" + damageTypeDB + '\'', e); + " value received = '" + damageTypeDB + '\'', e);
@ -154,7 +153,7 @@ public class StaminaEffectModifier extends AbstractEffectModifier {
} }
} }
PlayerBonuses bonus = ac.getBonuses(); PlayerBonuses bonus = ac.getBonuses();
if (!skipImmune && bonus.getFloat(ModType.BlackMantle, SourceType.Heal) >= trains) { if (!skipImmune && bonus.getFloat(ModType.BlackMantle, SourceType.Healing) >= trains) {
ModifyHealthMsg mhm = new ModifyHealthMsg(source, ac, 0f, 0f, 0f, powerID, powerName, trains, effectID); ModifyHealthMsg mhm = new ModifyHealthMsg(source, ac, 0f, 0f, 0f, powerID, powerName, trains, effectID);
mhm.setUnknown03(5); //set target is immune mhm.setUnknown03(5); //set target is immune
DispatchMessage.sendToAllInRange(ac, mhm); DispatchMessage.sendToAllInRange(ac, mhm);

5
src/engine/powers/poweractions/TransferStatPowerAction.java

@ -10,7 +10,6 @@
package engine.powers.poweractions; package engine.powers.poweractions;
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;
@ -46,7 +45,7 @@ public class TransferStatPowerAction extends AbstractPowerAction {
protected float transferEfficiencyRamp; protected float transferEfficiencyRamp;
protected boolean transferEfficiencyRampAdd; protected boolean transferEfficiencyRampAdd;
protected boolean targetToCaster; protected boolean targetToCaster;
protected DamageType damageType; protected SourceType damageType;
protected EffectsBase effect; protected EffectsBase effect;
public TransferStatPowerAction(ResultSet rs, HashMap<String, EffectsBase> effects) throws SQLException { public TransferStatPowerAction(ResultSet rs, HashMap<String, EffectsBase> effects) throws SQLException {
@ -80,7 +79,7 @@ public class TransferStatPowerAction extends AbstractPowerAction {
// Damage type can sometimes be null in the DB. // Damage type can sometimes be null in the DB.
if (damageString.isEmpty() == false) if (damageString.isEmpty() == false)
this.damageType = DamageType.valueOf(damageString); this.damageType = SourceType.valueOf(damageString);
} catch (Exception e) { } catch (Exception e) {
this.damageType = null; this.damageType = null;
} }

Loading…
Cancel
Save