Compare commits

...

10 Commits

Author SHA1 Message Date
MagicBot faa262db99 Revert "Temp fix for 3 modifiers"
This reverts commit 6955f69156.
2024-04-01 14:21:16 -04:00
MagicBot 6955f69156 Temp fix for 3 modifiers 2024-04-01 13:51:20 -04:00
MagicBot 2ae39d2a29 Corrected source type 2024-04-01 13:07:18 -04:00
MagicBot 8e44adf16e No need for toUpper() here. 2024-04-01 12:58:16 -04:00
MagicBot fd73dbc349 Source types updated to match damage type 2024-04-01 12:53:49 -04:00
MagicBot f58aa61859 PIERCING 2024-04-01 12:42:49 -04:00
MagicBot ae7fecbf6d Effectbase updated with new enum 2024-04-01 12:41:33 -04:00
MagicBot 5ed497dd69 All damage type lookups go through method 2024-04-01 12:35:44 -04:00
MagicBot 14ee83e147 DamageType defined as in JSON 2024-04-01 12:13:19 -04:00
MagicBot a29269e335 Initial refactor of damagetype 2024-04-01 09:19:37 -04:00
33 changed files with 456 additions and 399 deletions
+175 -111
View File
@@ -724,118 +724,177 @@ public class Enum {
} }
} }
public enum SourceType { public enum DamageType {
NONE, NONE,
ABJURATION,
ACID,
ANTISIEGE,
ARCHERY,
AXE,
BARDSONG,
BEASTCRAFT,
BENEDICTION,
BLADEWEAVING,
BLEEDING,
BLIND,
BLOCK,
BLOODCRAFT,
BOW,
BUFF,
CHANNELING,
CHARM,
COLD,
CONSTITUTION,
CORRUPTION,
CROSSBOW,
CRUSHING, CRUSHING,
DAGGER,
DAGGERMASTERY,
DEBUFF,
DEXTERITY,
DISEASE,
DODGE,
DRAGON,
DRAIN,
EARTH,
EFFECT,
EXORCISM,
FEAR,
FIRE,
FLY,
GIANT,
GREATAXEMASTERY,
GREATSWORDMASTERY,
HAMMER,
HEALING,
HOLY,
IMMUNETOATTACK,
IMMUNETOPOWERS,
INTELLIGENCE,
INVISIBLE,
LIGHTNING,
LITURGY,
MAGIC,
MENTAL,
NATURELORE,
NECROMANCY,
PARRY,
PIERCING,
POISON,
POLEARM,
POWERBLOCK,
RAT,
RESISTDEBUFF,
RESTORATION,
ROOT,
SHADOWMASTERY,
SIEGE,
SLASHING, SLASHING,
SNARE, SIEGE,
SORCERY, PIERCING,
SPEAR, MAGIC,
SPEARMASTERY, BLEEDING,
SPIRIT, POISON,
STAFF, MENTAL,
STEAL, HOLY,
STORMCALLING,
STRENGTH,
STUN,
SUMMON,
SWORD,
SWORDMASTERY,
THAUMATURGY,
THEURGY,
TRANSFORM,
UNARMEDCOMBAT,
UNARMEDCOMBATMASTERY,
UNHOLY, UNHOLY,
LIGHTNING,
FIRE,
COLD,
HEALING,
ACID,
DISEASE,
UNKNOWN, UNKNOWN,
WARDING, // these added for immunities
WARLOCKRY, ATTACK,
WAYOFTHEGAANA, POWERS,
WEARARMORHEAVY, COMBAT,
WEARARMORLIGHT, SPIRES,
WEARARMORMEDIUM, SNARE,
WEREFORM, STUN,
ATHLETICS, BLIND,
AXEMASTERY, ROOT,
BARGAINING, FEAR,
BLADEMASTERY, CHARM,
FLAMECALLING, POWERBLOCK,
GREATHAMMERMASTERY, DEBUFF,
HAMMERMASTERY, STEAL,
LEADERSHIP, DRAIN;
POLEARMMASTERY,
RUNNING, public static DamageType getDamageType(String modName) {
STAFFMASTERY, DamageType damageType;
THROWING, if (modName.isEmpty())
TOUGHNESS, return DamageType.NONE;
WAYOFTHEWOLF,
WAYOFTHERAT, try {
WAYOFTHEBEAR, damageType = DamageType.valueOf(modName.replace(",", "").toUpperCase());
ORTHANATOS, } catch (Exception e) {
SUNDANCING, Logger.error(e);
//POWER CATEGORIES. return DamageType.NONE;
}
return damageType;
}
}
public enum SourceType {
None,
Abjuration,
Acid,
AntiSiege,
Archery,
Axe,
Bardsong,
Beastcraft,
Benediction,
BladeWeaving,
Bleeding,
Blind,
Block,
Bloodcraft,
Bow,
Buff,
Channeling,
Charm,
Cold,
COLD,
Constitution,
Corruption,
Crossbow,
Crushing,
Dagger,
DaggerMastery,
DeBuff,
Dexterity,
Disease,
Dodge,
Dragon,
Drain,
Earth,
Effect,
Exorcism,
Fear,
Fire,
FIRE,
Fly,
Giant,
GreatAxeMastery,
GreatSwordMastery,
Hammer,
Heal,
Healing,
Holy,
HOLY,
ImmuneToAttack,
ImmuneToPowers,
Intelligence,
Invisible,
Lightning,
LIGHTNING,
Liturgy,
Magic,
MAGIC,
Mental,
MENTAL,
NatureLore,
Necromancy,
Parry,
Piercing,
Poison,
POISON,
PoleArm,
Powerblock,
Rat,
ResistDeBuff,
Restoration,
Root,
Shadowmastery,
Siege,
Slashing,
Snare,
Sorcery,
Spear,
SpearMastery,
Spirit,
Staff,
Stormcalling,
Strength,
Stun,
Summon,
Sword,
SwordMastery,
Thaumaturgy,
Theurgy,
Transform,
UnarmedCombat,
UnarmedCombatMastery,
Unholy,
UNHOLY,
Unknown,
Warding,
Warlockry,
WayoftheGaana,
WearArmorHeavy,
WearArmorLight,
WearArmorMedium,
Wereform,
Athletics,
AxeMastery,
Bargaining,
BladeMastery,
FlameCalling,
GreatHammerMastery,
HammerMastery,
Leadership,
PoleArmMastery,
Running,
StaffMastery,
Throwing,
Toughness,
WayoftheWolf,
WayoftheRat,
WayoftheBear,
Orthanatos,
SunDancing,
//Power categories.
AE, AE,
AEDAMAGE, AEDAMAGE,
BEHAVIOR, BEHAVIOR,
@@ -843,8 +902,10 @@ public class Enum {
BOONCLASS, BOONCLASS,
BOONRACE, BOONRACE,
BREAKFLY, BREAKFLY,
BUFF,
CHANT, CHANT,
DAMAGE, DAMAGE,
DEBUFF,
DISPEL, DISPEL,
FLIGHT, FLIGHT,
GROUPBUFF, GROUPBUFF,
@@ -857,24 +918,27 @@ public class Enum {
SPIREDISABLE, SPIREDISABLE,
SPIREPROOFTELEPORT, SPIREPROOFTELEPORT,
STANCE, STANCE,
STUN,
SUMMON,
TELEPORT, TELEPORT,
THIEF, THIEF,
TRACK, TRACK,
TRANSFORM,
VAMPDRAIN, VAMPDRAIN,
WEAPON, WEAPON,
WIZARDRY; Wizardry;
public static SourceType GetSourceType(String modName) { public static SourceType GetSourceType(String modName) {
SourceType returnMod; SourceType returnMod;
if (modName.isEmpty()) if (modName.isEmpty())
return SourceType.NONE; return SourceType.None;
try { try {
returnMod = SourceType.valueOf(modName.replace(",", "").toUpperCase()); returnMod = SourceType.valueOf(modName.replace(",", ""));
} catch (Exception e) { } catch (Exception e) {
Logger.error(modName); Logger.error(modName);
Logger.error(e); Logger.error(e);
return SourceType.NONE; return SourceType.None;
} }
return returnMod; return returnMod;
} }
+1 -1
View File
@@ -95,7 +95,7 @@ public enum ChatManager {
PlayerBonuses bonus = pc.getBonuses(); PlayerBonuses bonus = pc.getBonuses();
if (bonus != null && bonus.getBool(ModType.Silenced, SourceType.NONE)) { if (bonus != null && bonus.getBool(ModType.Silenced, SourceType.None)) {
ChatManager.chatSayError(pc, SILENCED); ChatManager.chatSayError(pc, SILENCED);
return true; return true;
} }
+10 -10
View File
@@ -38,7 +38,7 @@ public enum CombatManager {
case PlayerCharacter: case PlayerCharacter:
case Mob: case Mob:
PlayerBonuses bonuses = ((AbstractCharacter) target).getBonuses(); PlayerBonuses bonuses = ((AbstractCharacter) target).getBonuses();
if (bonuses != null && bonuses.getBool(Enum.ModType.ImmuneToAttack, Enum.SourceType.NONE)) if (bonuses != null && bonuses.getBool(Enum.ModType.ImmuneToAttack, Enum.SourceType.None))
return; return;
break; break;
case NPC: case NPC:
@@ -90,7 +90,7 @@ public enum CombatManager {
if (weapon != null) { if (weapon != null) {
if (bonus != null) if (bonus != null)
rangeMod += bonus.getFloatPercentAll(Enum.ModType.WeaponRange, Enum.SourceType.NONE); rangeMod += bonus.getFloatPercentAll(Enum.ModType.WeaponRange, Enum.SourceType.None);
attackRange = weapon.template.item_weapon_max_range * rangeMod; attackRange = weapon.template.item_weapon_max_range * rangeMod;
} }
@@ -210,15 +210,15 @@ public enum CombatManager {
//get the damage type //get the damage type
Enum.SourceType damageType; Enum.DamageType damageType;
if (attacker.charItemManager.getEquipped().get(slot) == null) { if (attacker.charItemManager.getEquipped().get(slot) == null) {
damageType = Enum.SourceType.CRUSHING; 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.SourceType.SIEGE; damageType = Enum.DamageType.SIEGE;
} else { } else {
damageType = (Enum.SourceType) 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];
} }
//get resists //get resists
@@ -318,11 +318,11 @@ public enum CombatManager {
int wepSpeed = (int) (weapon.template.item_weapon_wepspeed); int wepSpeed = (int) (weapon.template.item_weapon_wepspeed);
if (weapon.getBonusPercent(Enum.ModType.WeaponSpeed, Enum.SourceType.NONE) != 0f) //add weapon speed bonus if (weapon.getBonusPercent(Enum.ModType.WeaponSpeed, Enum.SourceType.None) != 0f) //add weapon speed bonus
wepSpeed *= (1 + weapon.getBonus(Enum.ModType.WeaponSpeed, Enum.SourceType.NONE)); wepSpeed *= (1 + weapon.getBonus(Enum.ModType.WeaponSpeed, Enum.SourceType.None));
if (attacker.getBonuses() != null && attacker.getBonuses().getFloatPercentAll(Enum.ModType.AttackDelay, Enum.SourceType.NONE) != 0f) //add effects speed bonus if (attacker.getBonuses() != null && attacker.getBonuses().getFloatPercentAll(Enum.ModType.AttackDelay, Enum.SourceType.None) != 0f) //add effects speed bonus
wepSpeed *= (1 + attacker.getBonuses().getFloatPercentAll(Enum.ModType.AttackDelay, Enum.SourceType.NONE)); wepSpeed *= (1 + attacker.getBonuses().getFloatPercentAll(Enum.ModType.AttackDelay, Enum.SourceType.None));
if (wepSpeed < 10) if (wepSpeed < 10)
wepSpeed = 10; //Old was 10, but it can be reached lower with legit buffs,effects. wepSpeed = 10; //Old was 10, but it can be reached lower with legit buffs,effects.
+2 -2
View File
@@ -75,7 +75,7 @@ public enum MovementManager {
toMove.setIsCasting(false); toMove.setIsCasting(false);
toMove.setItemCasting(false); toMove.setItemCasting(false);
if (toMove.getBonuses().getBool(ModType.Stunned, SourceType.NONE) || toMove.getBonuses().getBool(ModType.CannotMove, SourceType.NONE)) { if (toMove.getBonuses().getBool(ModType.Stunned, SourceType.None) || toMove.getBonuses().getBool(ModType.CannotMove, SourceType.None)) {
return; return;
} }
@@ -391,7 +391,7 @@ public enum MovementManager {
//don't move if player is stunned or rooted //don't move if player is stunned or rooted
PlayerBonuses bonus = member.getBonuses(); PlayerBonuses bonus = member.getBonuses();
if (bonus.getBool(ModType.Stunned, SourceType.NONE) || bonus.getBool(ModType.CannotMove, SourceType.NONE)) if (bonus.getBool(ModType.Stunned, SourceType.None) || bonus.getBool(ModType.CannotMove, SourceType.None))
continue; continue;
member.update(); member.update();
+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.SourceType.SLASHING, mob.resists.getResist(Enum.SourceType.SLASHING, 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.SourceType.CRUSHING, mob.resists.getResist(Enum.SourceType.CRUSHING, 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.SourceType.PIERCING, mob.resists.getResist(Enum.SourceType.PIERCING, 0) + equipped.template.combat_attack_resist.get("PIERCING")); mob.resists.setResist(Enum.DamageType.PIERCING, mob.resists.getResist(Enum.DamageType.PIERCING, 0) + equipped.template.combat_attack_resist.get("PIERCING"));
} }
} }
} }
+7 -7
View File
@@ -332,7 +332,7 @@ public enum PowersManager {
// verify player is not stunned or prohibited from casting // verify player is not stunned or prohibited from casting
PlayerBonuses bonus = playerCharacter.getBonuses(); PlayerBonuses bonus = playerCharacter.getBonuses();
SourceType sourceType = SourceType.GetSourceType(pb.getCategory()); SourceType sourceType = SourceType.GetSourceType(pb.getCategory());
if (bonus != null && (bonus.getBool(ModType.Stunned, SourceType.NONE) || bonus.getBool(ModType.CannotCast, SourceType.NONE) || bonus.getBool(ModType.BlockedPowerType, sourceType))) if (bonus != null && (bonus.getBool(ModType.Stunned, SourceType.None) || bonus.getBool(ModType.CannotCast, SourceType.None) || bonus.getBool(ModType.BlockedPowerType, sourceType)))
return true; return true;
// if moving make sure spell valid for movement // if moving make sure spell valid for movement
@@ -468,7 +468,7 @@ public enum PowersManager {
cost = 0; cost = 0;
if (bonus != null) if (bonus != null)
cost *= (1 + bonus.getFloatPercentAll(ModType.PowerCost, SourceType.NONE)); cost *= (1 + bonus.getFloatPercentAll(ModType.PowerCost, SourceType.None));
if (playerCharacter.getAltitude() > 0) if (playerCharacter.getAltitude() > 0)
cost *= 1.5f; cost *= 1.5f;
@@ -615,7 +615,7 @@ public enum PowersManager {
// verify player is not stunned or prohibited from casting // verify player is not stunned or prohibited from casting
PlayerBonuses bonus = caster.getBonuses(); PlayerBonuses bonus = caster.getBonuses();
SourceType sourceType = SourceType.GetSourceType(pb.getCategory()); SourceType sourceType = SourceType.GetSourceType(pb.getCategory());
if (bonus != null && (bonus.getBool(ModType.Stunned, SourceType.NONE) || bonus.getBool(ModType.CannotCast, SourceType.NONE) || bonus.getBool(ModType.BlockedPowerType, sourceType))) if (bonus != null && (bonus.getBool(ModType.Stunned, SourceType.None) || bonus.getBool(ModType.CannotCast, SourceType.None) || bonus.getBool(ModType.BlockedPowerType, sourceType)))
return true; return true;
// if moving make sure spell valid for movement // if moving make sure spell valid for movement
@@ -775,7 +775,7 @@ public enum PowersManager {
PlayerBonuses bonus = playerCharacter.getBonuses(); PlayerBonuses bonus = playerCharacter.getBonuses();
if (bonus != null) { if (bonus != null) {
if (bonus.getBool(ModType.Stunned, SourceType.NONE)) if (bonus.getBool(ModType.Stunned, SourceType.None))
return; return;
SourceType sourceType = SourceType.GetSourceType(pb.getCategory()); SourceType sourceType = SourceType.GetSourceType(pb.getCategory());
@@ -1053,7 +1053,7 @@ public enum PowersManager {
// verify player is not stunned or power type is blocked // verify player is not stunned or power type is blocked
PlayerBonuses bonus = caster.getBonuses(); PlayerBonuses bonus = caster.getBonuses();
if (bonus != null) { if (bonus != null) {
if (bonus.getBool(ModType.Stunned, SourceType.NONE)) if (bonus.getBool(ModType.Stunned, SourceType.None))
return; return;
SourceType sourceType = SourceType.GetSourceType(pb.getCategory()); SourceType sourceType = SourceType.GetSourceType(pb.getCategory());
if (bonus.getBool(ModType.BlockedPowerType, sourceType)) if (bonus.getBool(ModType.BlockedPowerType, sourceType))
@@ -1688,7 +1688,7 @@ public enum PowersManager {
PlayerCharacter pcc = (PlayerCharacter) awo; PlayerCharacter pcc = (PlayerCharacter) awo;
PlayerBonuses bonuses = pcc.getBonuses(); PlayerBonuses bonuses = pcc.getBonuses();
if (bonuses != null && bonuses.getBool(ModType.ImmuneToPowers, SourceType.NONE)) { if (bonuses != null && bonuses.getBool(ModType.ImmuneToPowers, SourceType.None)) {
awolist.remove(); awolist.remove();
continue; continue;
} }
@@ -1838,7 +1838,7 @@ public enum PowersManager {
// Remove players who are in safe mode // Remove players who are in safe mode
PlayerCharacter pcc = (PlayerCharacter) awo; PlayerCharacter pcc = (PlayerCharacter) awo;
PlayerBonuses bonuses = pcc.getBonuses(); PlayerBonuses bonuses = pcc.getBonuses();
if (bonuses != null && bonuses.getBool(ModType.ImmuneToPowers, SourceType.NONE)) { if (bonuses != null && bonuses.getBool(ModType.ImmuneToPowers, SourceType.None)) {
awolist.remove(); awolist.remove();
continue; continue;
} }
+1 -1
View File
@@ -52,7 +52,7 @@ public class ChantJob extends AbstractEffectJob {
PowersManager.finishEffectTime(this.source, this.target, this.action, this.trains); PowersManager.finishEffectTime(this.source, this.target, this.action, this.trains);
if (AbstractWorldObject.IsAbstractCharacter(source)) if (AbstractWorldObject.IsAbstractCharacter(source))
((AbstractCharacter) source).cancelLastChant(); ((AbstractCharacter) source).cancelLastChant();
} else if (bonuses != null && bonuses.getBool(ModType.Silenced, SourceType.NONE)) { } else if (bonuses != null && bonuses.getBool(ModType.Silenced, SourceType.None)) {
PowersManager.finishEffectTime(this.source, this.target, this.action, this.trains); PowersManager.finishEffectTime(this.source, this.target, this.action, this.trains);
if (AbstractWorldObject.IsAbstractCharacter(source)) if (AbstractWorldObject.IsAbstractCharacter(source))
((AbstractCharacter) source).cancelLastChant(); ((AbstractCharacter) source).cancelLastChant();
+1 -1
View File
@@ -947,7 +947,7 @@ public class MobAI {
if (mob.isSit() && mob.getTimeStamp("HEALTHRECOVERED") < System.currentTimeMillis() + 3000) if (mob.isSit() && mob.getTimeStamp("HEALTHRECOVERED") < System.currentTimeMillis() + 3000)
if (mob.getHealth() < mob.getHealthMax()) { if (mob.getHealth() < mob.getHealthMax()) {
float recoveredHealth = mob.getHealthMax() * ((1 + mob.getBonuses().getFloatPercentAll(Enum.ModType.HealthRecoverRate, Enum.SourceType.NONE)) * 0.01f); float recoveredHealth = mob.getHealthMax() * ((1 + mob.getBonuses().getFloatPercentAll(Enum.ModType.HealthRecoverRate, Enum.SourceType.None)) * 0.01f);
mob.setHealth(mob.getHealth() + recoveredHealth); mob.setHealth(mob.getHealth() + recoveredHealth);
mob.getTimestamps().put("HEALTHRECOVERED", System.currentTimeMillis()); mob.getTimestamps().put("HEALTHRECOVERED", System.currentTimeMillis());
@@ -169,7 +169,7 @@ public class MovementUtilities {
if (agent.getMobBase() != null && Enum.MobFlagType.SENTINEL.elementOf(agent.getMobBase().getFlags())) if (agent.getMobBase() != null && Enum.MobFlagType.SENTINEL.elementOf(agent.getMobBase().getFlags()))
return false; return false;
return (agent.isAlive() && !agent.getBonuses().getBool(ModType.Stunned, SourceType.NONE) && !agent.getBonuses().getBool(ModType.CannotMove, SourceType.NONE)); return (agent.isAlive() && !agent.getBonuses().getBool(ModType.Stunned, SourceType.None) && !agent.getBonuses().getBool(ModType.CannotMove, SourceType.None));
} }
public static Vector3fImmutable randomPatrolLocation(Mob agent, Vector3fImmutable center, float radius) { public static Vector3fImmutable randomPatrolLocation(Mob agent, Vector3fImmutable center, float radius) {
@@ -90,7 +90,7 @@ public class RepairMsgHandler extends AbstractClientMsgHandler {
//account for durability modifications //account for durability modifications
float durMod = toRepair.getBonusPercent(Enum.ModType.Durability, Enum.SourceType.NONE); float durMod = toRepair.getBonusPercent(Enum.ModType.Durability, Enum.SourceType.None);
max *= (1 + (durMod * 0.01f)); max *= (1 + (durMod * 0.01f));
if (dur >= max || dur < 1) { if (dur >= max || dur < 1) {
@@ -149,7 +149,7 @@ public class TrackWindowMsgHandler extends AbstractClientMsgHandler {
else if (awo.getObjectType().equals(Enum.GameObjectType.PlayerCharacter)) { else if (awo.getObjectType().equals(Enum.GameObjectType.PlayerCharacter)) {
PlayerBonuses bonus = ((PlayerCharacter) awo).getBonuses(); PlayerBonuses bonus = ((PlayerCharacter) awo).getBonuses();
if (bonus != null && bonus.getBool(Enum.ModType.CannotTrack, Enum.SourceType.NONE)) if (bonus != null && bonus.getBool(Enum.ModType.CannotTrack, Enum.SourceType.None))
it.remove(); it.remove();
} }
} }
+31 -31
View File
@@ -529,7 +529,7 @@ public abstract class AbstractCharacter extends AbstractWorldObject {
boolean canFly = false; boolean canFly = false;
PlayerBonuses bonus = flyer.getBonuses(); PlayerBonuses bonus = flyer.getBonuses();
if (bonus != null && !bonus.getBool(ModType.NoMod, SourceType.FLY) && bonus.getBool(ModType.Fly, SourceType.NONE) && flyer.isAlive()) if (bonus != null && !bonus.getBool(ModType.NoMod, SourceType.Fly) && bonus.getBool(ModType.Fly, SourceType.None) && flyer.isAlive())
canFly = true; canFly = true;
return canFly; return canFly;
@@ -615,10 +615,10 @@ public abstract class AbstractCharacter extends AbstractWorldObject {
if (abstractCharacter.bonuses != null) { if (abstractCharacter.bonuses != null) {
// add any bonuses // add any bonuses
defense += (short) abstractCharacter.bonuses.getFloat(ModType.DCV, SourceType.NONE); defense += (short) abstractCharacter.bonuses.getFloat(ModType.DCV, SourceType.None);
// Finally multiply any percent modifiers. DO THIS LAST! // Finally multiply any percent modifiers. DO THIS LAST!
float pos_Bonus = abstractCharacter.bonuses.getFloatPercentPositive(ModType.DCV, SourceType.NONE); float pos_Bonus = abstractCharacter.bonuses.getFloatPercentPositive(ModType.DCV, SourceType.None);
defense = (short) (defense * (1 + pos_Bonus)); defense = (short) (defense * (1 + pos_Bonus));
//Lucky rune applies next //Lucky rune applies next
@@ -627,7 +627,7 @@ public abstract class AbstractCharacter extends AbstractWorldObject {
//and negative percent modifiers //and negative percent modifiers
//already done... //already done...
float neg_Bonus = abstractCharacter.bonuses.getFloatPercentNegative(ModType.DCV, SourceType.NONE); float neg_Bonus = abstractCharacter.bonuses.getFloatPercentNegative(ModType.DCV, SourceType.None);
defense = (short) (defense * (1 + neg_Bonus)); defense = (short) (defense * (1 + neg_Bonus));
} else } else
@@ -729,7 +729,7 @@ public abstract class AbstractCharacter extends AbstractWorldObject {
abstractCharacter.rangeHandTwo = weapon.template.item_weapon_max_range * (1 + (abstractCharacter.statStrBase / 600)); abstractCharacter.rangeHandTwo = weapon.template.item_weapon_max_range * (1 + (abstractCharacter.statStrBase / 600));
if (abstractCharacter.bonuses != null) { if (abstractCharacter.bonuses != null) {
float range_bonus = 1 + abstractCharacter.bonuses.getFloatPercentAll(ModType.WeaponRange, SourceType.NONE); float range_bonus = 1 + abstractCharacter.bonuses.getFloatPercentAll(ModType.WeaponRange, SourceType.None);
if (mainHand) if (mainHand)
abstractCharacter.rangeHandOne *= range_bonus; abstractCharacter.rangeHandOne *= range_bonus;
@@ -773,10 +773,10 @@ public abstract class AbstractCharacter extends AbstractWorldObject {
// add in any bonuses to atr // add in any bonuses to atr
if (abstractCharacter.bonuses != null) { if (abstractCharacter.bonuses != null) {
// Add any base bonuses // Add any base bonuses
atr += abstractCharacter.bonuses.getFloat(ModType.OCV, SourceType.NONE); atr += abstractCharacter.bonuses.getFloat(ModType.OCV, SourceType.None);
// Finally use any multipliers. DO THIS LAST! // Finally use any multipliers. DO THIS LAST!
float pos_Bonus = (1 + abstractCharacter.bonuses.getFloatPercentPositive(ModType.OCV, SourceType.NONE)); float pos_Bonus = (1 + abstractCharacter.bonuses.getFloatPercentPositive(ModType.OCV, SourceType.None));
atr *= pos_Bonus; atr *= pos_Bonus;
// next precise // next precise
@@ -784,7 +784,7 @@ public abstract class AbstractCharacter extends AbstractWorldObject {
// atr *= (1 + ((float) this.bonuses.getShort("rune.Attack") / 100)); // atr *= (1 + ((float) this.bonuses.getShort("rune.Attack") / 100));
//and negative percent modifiers //and negative percent modifiers
float neg_Bonus = abstractCharacter.bonuses.getFloatPercentNegative(ModType.OCV, SourceType.NONE); float neg_Bonus = abstractCharacter.bonuses.getFloatPercentNegative(ModType.OCV, SourceType.None);
atr *= (1 + neg_Bonus); atr *= (1 + neg_Bonus);
} }
@@ -804,9 +804,9 @@ public abstract class AbstractCharacter extends AbstractWorldObject {
else else
speed = 20f; //unarmed attack speed speed = 20f; //unarmed attack speed
if (weapon != null) if (weapon != null)
speed *= (1 + abstractCharacter.bonuses.getFloatPercentAll(ModType.WeaponSpeed, SourceType.NONE)); speed *= (1 + abstractCharacter.bonuses.getFloatPercentAll(ModType.WeaponSpeed, SourceType.None));
speed *= (1 + abstractCharacter.bonuses.getFloatPercentAll(ModType.AttackDelay, SourceType.NONE)); speed *= (1 + abstractCharacter.bonuses.getFloatPercentAll(ModType.AttackDelay, SourceType.None));
if (speed < 10) if (speed < 10)
speed = 10; speed = 10;
@@ -815,22 +815,22 @@ public abstract class AbstractCharacter extends AbstractWorldObject {
if (weapon != null) { if (weapon != null) {
// Add any base bonuses // Add any base bonuses
min += weapon.getBonus(ModType.MinDamage, SourceType.NONE); min += weapon.getBonus(ModType.MinDamage, SourceType.None);
max += weapon.getBonus(ModType.MaxDamage, SourceType.NONE); max += weapon.getBonus(ModType.MaxDamage, SourceType.None);
min += weapon.getBonus(ModType.MeleeDamageModifier, SourceType.NONE); min += weapon.getBonus(ModType.MeleeDamageModifier, SourceType.None);
max += weapon.getBonus(ModType.MeleeDamageModifier, SourceType.NONE); max += weapon.getBonus(ModType.MeleeDamageModifier, SourceType.None);
// Finally use any multipliers. DO THIS LAST! // Finally use any multipliers. DO THIS LAST!
float percentMinDamage = 1; float percentMinDamage = 1;
float percentMaxDamage = 1; float percentMaxDamage = 1;
percentMinDamage += weapon.getBonusPercent(ModType.MinDamage, SourceType.NONE); percentMinDamage += weapon.getBonusPercent(ModType.MinDamage, SourceType.None);
percentMinDamage += weapon.getBonusPercent(ModType.MeleeDamageModifier, SourceType.NONE); percentMinDamage += weapon.getBonusPercent(ModType.MeleeDamageModifier, SourceType.None);
percentMaxDamage += weapon.getBonusPercent(ModType.MaxDamage, SourceType.NONE); percentMaxDamage += weapon.getBonusPercent(ModType.MaxDamage, SourceType.None);
percentMaxDamage += weapon.getBonusPercent(ModType.MeleeDamageModifier, SourceType.NONE); percentMaxDamage += weapon.getBonusPercent(ModType.MeleeDamageModifier, SourceType.None);
min *= percentMinDamage; min *= percentMinDamage;
@@ -867,21 +867,21 @@ public abstract class AbstractCharacter extends AbstractWorldObject {
// add in any bonuses to damage // add in any bonuses to damage
if (abstractCharacter.bonuses != null) { if (abstractCharacter.bonuses != null) {
// Add any base bonuses // Add any base bonuses
minDamage += abstractCharacter.bonuses.getFloat(ModType.MinDamage, SourceType.NONE); minDamage += abstractCharacter.bonuses.getFloat(ModType.MinDamage, SourceType.None);
maxDamage += abstractCharacter.bonuses.getFloat(ModType.MaxDamage, SourceType.NONE); maxDamage += abstractCharacter.bonuses.getFloat(ModType.MaxDamage, SourceType.None);
minDamage += abstractCharacter.bonuses.getFloat(ModType.MeleeDamageModifier, SourceType.NONE); minDamage += abstractCharacter.bonuses.getFloat(ModType.MeleeDamageModifier, SourceType.None);
maxDamage += abstractCharacter.bonuses.getFloat(ModType.MeleeDamageModifier, SourceType.NONE); maxDamage += abstractCharacter.bonuses.getFloat(ModType.MeleeDamageModifier, SourceType.None);
// Finally use any multipliers. DO THIS LAST! // Finally use any multipliers. DO THIS LAST!
float percentMinDamage = 1; float percentMinDamage = 1;
float percentMaxDamage = 1; float percentMaxDamage = 1;
percentMinDamage += abstractCharacter.bonuses.getFloatPercentAll(ModType.MinDamage, SourceType.NONE); percentMinDamage += abstractCharacter.bonuses.getFloatPercentAll(ModType.MinDamage, SourceType.None);
percentMinDamage += abstractCharacter.bonuses.getFloatPercentAll(ModType.MeleeDamageModifier, SourceType.NONE); percentMinDamage += abstractCharacter.bonuses.getFloatPercentAll(ModType.MeleeDamageModifier, SourceType.None);
percentMaxDamage += abstractCharacter.bonuses.getFloatPercentAll(ModType.MaxDamage, SourceType.NONE); percentMaxDamage += abstractCharacter.bonuses.getFloatPercentAll(ModType.MaxDamage, SourceType.None);
percentMaxDamage += abstractCharacter.bonuses.getFloatPercentAll(ModType.MeleeDamageModifier, SourceType.NONE); percentMaxDamage += abstractCharacter.bonuses.getFloatPercentAll(ModType.MeleeDamageModifier, SourceType.None);
minDamage *= percentMinDamage; minDamage *= percentMinDamage;
maxDamage *= percentMaxDamage; maxDamage *= percentMaxDamage;
@@ -930,8 +930,8 @@ public abstract class AbstractCharacter extends AbstractWorldObject {
//apply item defense bonuses //apply item defense bonuses
if (shield != null) { if (shield != null) {
def += shield.getBonus(ModType.DR, SourceType.NONE); def += shield.getBonus(ModType.DR, SourceType.None);
def *= (1 + shield.getBonusPercent(ModType.DR, SourceType.NONE)); def *= (1 + shield.getBonusPercent(ModType.DR, SourceType.None));
} }
@@ -974,8 +974,8 @@ public abstract class AbstractCharacter extends AbstractWorldObject {
//apply item defense bonuses //apply item defense bonuses
if (armor != null) { if (armor != null) {
def += armor.getBonus(ModType.DR, SourceType.NONE); def += armor.getBonus(ModType.DR, SourceType.None);
def *= (1 + armor.getBonusPercent(ModType.DR, SourceType.NONE)); def *= (1 + armor.getBonusPercent(ModType.DR, SourceType.None));
} }
return (def * (1 + ((int) armorSkill.getModifiedAmount() / 50f))); return (def * (1 + ((int) armorSkill.getModifiedAmount() / 50f)));
@@ -2176,7 +2176,7 @@ public abstract class AbstractCharacter extends AbstractWorldObject {
PowersManager.cancelOnTakeDamage(this); PowersManager.cancelOnTakeDamage(this);
} }
public final void cancelOnTakeDamage(final SourceType type, final float amount) { public final void cancelOnTakeDamage(final DamageType 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);
@@ -141,7 +141,7 @@ public abstract class AbstractIntelligenceAgent extends AbstractCharacter {
float ret = MobAIThread.AI_BASE_AGGRO_RANGE; float ret = MobAIThread.AI_BASE_AGGRO_RANGE;
if (this.bonuses != null) if (this.bonuses != null)
ret *= (1 + this.bonuses.getFloatPercentAll(ModType.ScanRange, SourceType.NONE)); ret *= (1 + this.bonuses.getFloatPercentAll(ModType.ScanRange, SourceType.None));
return ret; return ret;
} }
+3 -3
View File
@@ -306,12 +306,12 @@ public class CharacterSkill extends AbstractGameObject {
PlayerBonuses bonus = ac.getBonuses(); PlayerBonuses bonus = ac.getBonuses();
if (bonus == null) if (bonus == null)
return atr; return atr;
atr += bonus.getFloat(ModType.OCV, SourceType.NONE); atr += bonus.getFloat(ModType.OCV, SourceType.None);
float pos_Bonus = bonus.getFloatPercentPositive(ModType.OCV, SourceType.NONE); float pos_Bonus = bonus.getFloatPercentPositive(ModType.OCV, SourceType.None);
atr *= (1 + pos_Bonus); atr *= (1 + pos_Bonus);
//rUNES will already be applied //rUNES will already be applied
// atr *= (1 + ((float)bonus.getShort("rune.Attack") / 100)); //precise // atr *= (1 + ((float)bonus.getShort("rune.Attack") / 100)); //precise
float neg_Bonus = bonus.getFloatPercentNegative(ModType.OCV, SourceType.NONE); float neg_Bonus = bonus.getFloatPercentNegative(ModType.OCV, SourceType.None);
atr *= (1 + neg_Bonus); atr *= (1 + neg_Bonus);
return atr; return atr;
} }
+1 -1
View File
@@ -592,7 +592,7 @@ public class Effect {
} }
//Used for verifying when damage absorbers fails //Used for verifying when damage absorbers fails
public boolean cancelOnTakeDamage(Enum.SourceType type, float amount) { public boolean cancelOnTakeDamage(Enum.DamageType 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)
+3 -3
View File
@@ -62,7 +62,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 HashMap<Enum.SourceType, int[]> item_weapon_damage = new HashMap<>(); public HashMap<Enum.DamageType, int[]> item_weapon_damage = new HashMap<>();
public ArrayList<int[]> weapon_attack_anim_right = new ArrayList(); public ArrayList<int[]> weapon_attack_anim_right = new ArrayList();
public ArrayList<int[]> weapon_attack_anim_left = new ArrayList(); public ArrayList<int[]> weapon_attack_anim_left = new ArrayList();
public Enum.AttributeType item_primary_attr = Enum.AttributeType.None; public Enum.AttributeType item_primary_attr = Enum.AttributeType.None;
@@ -227,11 +227,11 @@ public class ItemTemplate {
if (weapon_damage.isEmpty() == false) if (weapon_damage.isEmpty() == false)
for (Object o : weapon_damage) { for (Object o : weapon_damage) {
JSONObject damage_entry = (JSONObject) o; JSONObject damage_entry = (JSONObject) o;
Enum.SourceType sourceType = Enum.SourceType.valueOf(((String) damage_entry.get("damage_type")).toUpperCase()); Enum.DamageType damageType = Enum.DamageType.getDamageType(((String) damage_entry.get("damage_type")));
int min = ((Long) damage_entry.get("damage_min")).intValue(); int min = ((Long) damage_entry.get("damage_min")).intValue();
int max = ((Long) damage_entry.get("damage_max")).intValue(); int max = ((Long) damage_entry.get("damage_max")).intValue();
int[] minMax = {min, max}; int[] minMax = {min, max};
item_weapon_damage.put(sourceType, minMax); item_weapon_damage.put(damageType, minMax);
} }
JSONArray attack_anim_right = (JSONArray) item_weapon.get("weapon_attack_anim_right"); JSONArray attack_anim_right = (JSONArray) item_weapon.get("weapon_attack_anim_right");
+18 -18
View File
@@ -710,19 +710,19 @@ public class Mob extends AbstractIntelligenceAgent implements Delayed {
// TODO modify for equipment // TODO modify for equipment
if (this.bonuses != null) { if (this.bonuses != null) {
// modify for effects // modify for effects
strVal += this.bonuses.getFloat(ModType.Attr, SourceType.STRENGTH); strVal += this.bonuses.getFloat(ModType.Attr, SourceType.Strength);
dexVal += this.bonuses.getFloat(ModType.Attr, SourceType.DEXTERITY); dexVal += this.bonuses.getFloat(ModType.Attr, SourceType.Dexterity);
conVal += this.bonuses.getFloat(ModType.Attr, SourceType.CONSTITUTION); conVal += this.bonuses.getFloat(ModType.Attr, SourceType.Constitution);
intVal += this.bonuses.getFloat(ModType.Attr, SourceType.INTELLIGENCE); intVal += this.bonuses.getFloat(ModType.Attr, SourceType.Intelligence);
spiVal += this.bonuses.getFloat(ModType.Attr, SourceType.SPIRIT); spiVal += this.bonuses.getFloat(ModType.Attr, SourceType.Spirit);
// apply dex penalty for armor // apply dex penalty for armor
// modify percent amounts. DO THIS LAST! // modify percent amounts. DO THIS LAST!
strVal *= (1 + this.bonuses.getFloatPercentAll(ModType.Attr, SourceType.STRENGTH)); strVal *= (1 + this.bonuses.getFloatPercentAll(ModType.Attr, SourceType.Strength));
dexVal *= (1 + this.bonuses.getFloatPercentAll(ModType.Attr, SourceType.DEXTERITY)); dexVal *= (1 + this.bonuses.getFloatPercentAll(ModType.Attr, SourceType.Dexterity));
conVal *= (1 + this.bonuses.getFloatPercentAll(ModType.Attr, SourceType.CONSTITUTION)); conVal *= (1 + this.bonuses.getFloatPercentAll(ModType.Attr, SourceType.Constitution));
intVal *= (1 + this.bonuses.getFloatPercentAll(ModType.Attr, SourceType.INTELLIGENCE)); intVal *= (1 + this.bonuses.getFloatPercentAll(ModType.Attr, SourceType.Intelligence));
spiVal *= (1 + this.bonuses.getFloatPercentAll(ModType.Attr, SourceType.SPIRIT)); spiVal *= (1 + this.bonuses.getFloatPercentAll(ModType.Attr, SourceType.Spirit));
} }
// Set current stats // Set current stats
@@ -739,7 +739,7 @@ public class Mob extends AbstractIntelligenceAgent implements Delayed {
float bonus = 1; float bonus = 1;
if (this.bonuses != null) if (this.bonuses != null)
// get rune and effect bonuses // get rune and effect bonuses
bonus *= (1 + this.bonuses.getFloatPercentAll(ModType.Speed, SourceType.NONE)); bonus *= (1 + this.bonuses.getFloatPercentAll(ModType.Speed, SourceType.None));
if (this.isPlayerGuard()) if (this.isPlayerGuard())
switch (this.mobBase.getLoadID()) { switch (this.mobBase.getLoadID()) {
@@ -836,7 +836,7 @@ public class Mob extends AbstractIntelligenceAgent implements Delayed {
if (!this.isMoving()) if (!this.isMoving())
return; return;
if (this.isAlive() == false || this.getBonuses().getBool(ModType.Stunned, SourceType.NONE) || this.getBonuses().getBool(ModType.CannotMove, SourceType.NONE)) { if (this.isAlive() == false || this.getBonuses().getBool(ModType.Stunned, SourceType.None) || this.getBonuses().getBool(ModType.CannotMove, SourceType.None)) {
//Target is stunned or rooted. Don't move //Target is stunned or rooted. Don't move
this.stopMovement(this.getMovementLoc()); this.stopMovement(this.getMovementLoc());
@@ -1072,15 +1072,15 @@ public class Mob extends AbstractIntelligenceAgent implements Delayed {
// Apply any bonuses from runes and effects // Apply any bonuses from runes and effects
if (this.bonuses != null) { if (this.bonuses != null) {
h += this.bonuses.getFloat(ModType.HealthFull, SourceType.NONE); h += this.bonuses.getFloat(ModType.HealthFull, SourceType.None);
m += this.bonuses.getFloat(ModType.ManaFull, SourceType.NONE); m += this.bonuses.getFloat(ModType.ManaFull, SourceType.None);
s += this.bonuses.getFloat(ModType.StaminaFull, SourceType.NONE); s += this.bonuses.getFloat(ModType.StaminaFull, SourceType.None);
//apply effects percent modifiers. DO THIS LAST! //apply effects percent modifiers. DO THIS LAST!
h *= (1 + this.bonuses.getFloatPercentAll(ModType.HealthFull, SourceType.NONE)); h *= (1 + this.bonuses.getFloatPercentAll(ModType.HealthFull, SourceType.None));
m *= (1 + this.bonuses.getFloatPercentAll(ModType.ManaFull, SourceType.NONE)); m *= (1 + this.bonuses.getFloatPercentAll(ModType.ManaFull, SourceType.None));
s *= (1 + this.bonuses.getFloatPercentAll(ModType.StaminaFull, SourceType.NONE)); s *= (1 + this.bonuses.getFloatPercentAll(ModType.StaminaFull, SourceType.None));
} }
// Set max health, mana and stamina // Set max health, mana and stamina
+4 -4
View File
@@ -229,7 +229,7 @@ public class PlayerBonuses {
//Update seeInvis if needed //Update seeInvis if needed
float seeInvis = this.getFloat(ModType.SeeInvisible, SourceType.NONE); float seeInvis = this.getFloat(ModType.SeeInvisible, SourceType.None);
if (pc.getSeeInvis() < seeInvis) if (pc.getSeeInvis() < seeInvis)
pc.setSeeInvis((short) seeInvis); pc.setSeeInvis((short) seeInvis);
@@ -458,13 +458,13 @@ public class PlayerBonuses {
float percentAmountNegative = this.getFloatPercentNegative(modType, sourceType); float percentAmountNegative = this.getFloatPercentNegative(modType, sourceType);
if (amount != 0) if (amount != 0)
ChatManager.chatSystemInfo(pc, modType.name() + "-" + (sourceType.equals(SourceType.NONE) == false ? sourceType.name() : "") + " = " + amount); ChatManager.chatSystemInfo(pc, modType.name() + "-" + (sourceType.equals(SourceType.None) == false ? sourceType.name() : "") + " = " + amount);
if (percentAmount != 0) if (percentAmount != 0)
ChatManager.chatSystemInfo(pc, "Percent : " + modType.name() + "-" + (sourceType.equals(SourceType.NONE) == false ? sourceType.name() : "") + " = " + percentAmount); ChatManager.chatSystemInfo(pc, "Percent : " + modType.name() + "-" + (sourceType.equals(SourceType.None) == false ? sourceType.name() : "") + " = " + percentAmount);
if (percentAmountNegative != 0) if (percentAmountNegative != 0)
ChatManager.chatSystemInfo(pc, "Negative Percent : " + modType.name() + "-" + (sourceType.equals(SourceType.NONE) == false ? sourceType.name() : "") + " = " + percentAmountNegative); ChatManager.chatSystemInfo(pc, "Negative Percent : " + modType.name() + "-" + (sourceType.equals(SourceType.None) == false ? sourceType.name() : "") + " = " + percentAmountNegative);
} }
} }
+29 -29
View File
@@ -3091,7 +3091,7 @@ public class PlayerCharacter extends AbstractCharacter {
if (this.bonuses != null) if (this.bonuses != null)
// get rune and effect bonuses // get rune and effect bonuses
bonus += this.bonuses.getFloatPercentNullZero(ModType.Speed, SourceType.NONE); bonus += this.bonuses.getFloatPercentNullZero(ModType.Speed, SourceType.None);
// TODO get equip bonus // TODO get equip bonus
this.update(); this.update();
@@ -3595,8 +3595,8 @@ public class PlayerCharacter extends AbstractCharacter {
//calculateModifiedStats(); //calculateModifiedStats();
//update hide and seeInvis levels //update hide and seeInvis levels
if (this.bonuses != null) { if (this.bonuses != null) {
this.hidden = (int) bonuses.getFloat(ModType.Invisible, SourceType.NONE); this.hidden = (int) bonuses.getFloat(ModType.Invisible, SourceType.None);
this.seeInvis = (int) bonuses.getFloat(ModType.SeeInvisible, SourceType.NONE); this.seeInvis = (int) bonuses.getFloat(ModType.SeeInvisible, SourceType.None);
} else { } else {
this.hidden = (byte) 0; this.hidden = (byte) 0;
this.seeInvis = (byte) 0; this.seeInvis = (byte) 0;
@@ -3664,21 +3664,21 @@ public class PlayerCharacter extends AbstractCharacter {
// TODO modify for equipment // TODO modify for equipment
if (this.bonuses != null) { if (this.bonuses != null) {
// modify for effects // modify for effects
strVal += Math.round(this.bonuses.getFloat(ModType.Attr, SourceType.STRENGTH)); strVal += Math.round(this.bonuses.getFloat(ModType.Attr, SourceType.Strength));
dexVal += Math.round(this.bonuses.getFloat(ModType.Attr, SourceType.DEXTERITY)); dexVal += Math.round(this.bonuses.getFloat(ModType.Attr, SourceType.Dexterity));
conVal += Math.round(this.bonuses.getFloat(ModType.Attr, SourceType.CONSTITUTION)); conVal += Math.round(this.bonuses.getFloat(ModType.Attr, SourceType.Constitution));
intVal += Math.round(this.bonuses.getFloat(ModType.Attr, SourceType.INTELLIGENCE)); intVal += Math.round(this.bonuses.getFloat(ModType.Attr, SourceType.Intelligence));
spiVal += Math.round(this.bonuses.getFloat(ModType.Attr, SourceType.SPIRIT)); spiVal += Math.round(this.bonuses.getFloat(ModType.Attr, SourceType.Spirit));
// apply dex penalty for armor // apply dex penalty for armor
dexVal *= this.dexPenalty; dexVal *= this.dexPenalty;
// modify percent amounts. DO THIS LAST! // modify percent amounts. DO THIS LAST!
strVal *= (1 + this.bonuses.getFloatPercentAll(ModType.Attr, SourceType.STRENGTH)); strVal *= (1 + this.bonuses.getFloatPercentAll(ModType.Attr, SourceType.Strength));
dexVal *= (1 + this.bonuses.getFloatPercentAll(ModType.Attr, SourceType.DEXTERITY)); dexVal *= (1 + this.bonuses.getFloatPercentAll(ModType.Attr, SourceType.Dexterity));
conVal *= (1 + this.bonuses.getFloatPercentAll(ModType.Attr, SourceType.CONSTITUTION)); conVal *= (1 + this.bonuses.getFloatPercentAll(ModType.Attr, SourceType.Constitution));
intVal *= (1 + this.bonuses.getFloatPercentAll(ModType.Attr, SourceType.INTELLIGENCE)); intVal *= (1 + this.bonuses.getFloatPercentAll(ModType.Attr, SourceType.Intelligence));
spiVal *= (1 + this.bonuses.getFloatPercentAll(ModType.Attr, SourceType.SPIRIT)); spiVal *= (1 + this.bonuses.getFloatPercentAll(ModType.Attr, SourceType.Spirit));
} else } else
// apply dex penalty for armor // apply dex penalty for armor
@@ -3774,24 +3774,24 @@ public class PlayerCharacter extends AbstractCharacter {
wbOff = off.template; wbOff = off.template;
//set block if block found //set block if block found
this.bonuses.setBool(ModType.Block, SourceType.NONE, false); this.bonuses.setBool(ModType.Block, SourceType.None, false);
if (this.baseClass != null && (this.baseClass.getObjectUUID() == 2500 || this.baseClass.getObjectUUID() == 2501)) if (this.baseClass != null && (this.baseClass.getObjectUUID() == 2500 || this.baseClass.getObjectUUID() == 2501))
if (off != null && off.template != null && ItemTemplate.isShield(off)) if (off != null && off.template != null && ItemTemplate.isShield(off))
this.bonuses.setBool(ModType.Block, SourceType.NONE, true); this.bonuses.setBool(ModType.Block, SourceType.None, true);
//set dodge if rogue //set dodge if rogue
if (this.baseClass != null && this.baseClass.getObjectUUID() == 2502) if (this.baseClass != null && this.baseClass.getObjectUUID() == 2502)
this.bonuses.setBool(ModType.Dodge, SourceType.NONE, true); this.bonuses.setBool(ModType.Dodge, SourceType.None, true);
else else
this.bonuses.setBool(ModType.Dodge, SourceType.NONE, false); this.bonuses.setBool(ModType.Dodge, SourceType.None, false);
//set parry if fighter or thief and no invalid weapon found //set parry if fighter or thief and no invalid weapon found
this.bonuses.setBool(ModType.Parry, SourceType.NONE, false); this.bonuses.setBool(ModType.Parry, SourceType.None, false);
if ((this.baseClass != null && this.baseClass.getObjectUUID() == 2500) if ((this.baseClass != null && this.baseClass.getObjectUUID() == 2500)
|| (this.promotionClass != null && this.promotionClass.getObjectUUID() == 2520)) || (this.promotionClass != null && this.promotionClass.getObjectUUID() == 2520))
if (wbMain == null || wbMain.item_weapon_max_range < MBServerStatics.RANGED_WEAPON_RANGE) if (wbMain == null || wbMain.item_weapon_max_range < MBServerStatics.RANGED_WEAPON_RANGE)
if (wbOff == null || wbOff.item_weapon_max_range < MBServerStatics.RANGED_WEAPON_RANGE) if (wbOff == null || wbOff.item_weapon_max_range < MBServerStatics.RANGED_WEAPON_RANGE)
this.bonuses.setBool(ModType.Parry, SourceType.NONE, true); this.bonuses.setBool(ModType.Parry, SourceType.None, true);
} }
@@ -3890,13 +3890,13 @@ public class PlayerCharacter extends AbstractCharacter {
//apply effects //apply effects
h += this.bonuses.getFloat(ModType.HealthFull, SourceType.NONE); h += this.bonuses.getFloat(ModType.HealthFull, SourceType.None);
m += this.bonuses.getFloat(ModType.ManaFull, SourceType.NONE); m += this.bonuses.getFloat(ModType.ManaFull, SourceType.None);
s += this.bonuses.getFloat(ModType.StaminaFull, SourceType.NONE); s += this.bonuses.getFloat(ModType.StaminaFull, SourceType.None);
h *= (1 + this.bonuses.getFloatPercentAll(ModType.HealthFull, SourceType.NONE)); h *= (1 + this.bonuses.getFloatPercentAll(ModType.HealthFull, SourceType.None));
m *= (1 + this.bonuses.getFloatPercentAll(ModType.ManaFull, SourceType.NONE)); m *= (1 + this.bonuses.getFloatPercentAll(ModType.ManaFull, SourceType.None));
s *= (1 + this.bonuses.getFloatPercentAll(ModType.StaminaFull, SourceType.NONE)); s *= (1 + this.bonuses.getFloatPercentAll(ModType.StaminaFull, SourceType.None));
} }
@@ -3931,11 +3931,11 @@ public class PlayerCharacter extends AbstractCharacter {
ModType modType = ModType.GetModType(type); ModType modType = ModType.GetModType(type);
// must be allowed to use this passive // must be allowed to use this passive
if (!this.bonuses.getBool(modType, SourceType.NONE)) if (!this.bonuses.getBool(modType, SourceType.None))
return 0f; return 0f;
// must not be stunned // must not be stunned
if (this.bonuses.getBool(ModType.Stunned, SourceType.NONE)) if (this.bonuses.getBool(ModType.Stunned, SourceType.None))
return 0f; return 0f;
// Get base skill amount // Get base skill amount
@@ -3947,7 +3947,7 @@ public class PlayerCharacter extends AbstractCharacter {
amount = sk.getModifiedAmount(); amount = sk.getModifiedAmount();
// Add bonuses // Add bonuses
amount += this.bonuses.getFloat(modType, SourceType.NONE); amount += this.bonuses.getFloat(modType, SourceType.None);
// Add item bonuses and return // Add item bonuses and return
if (type.equals(ModType.Dodge) && !fromCombat) if (type.equals(ModType.Dodge) && !fromCombat)
@@ -4381,7 +4381,7 @@ public class PlayerCharacter extends AbstractCharacter {
Vector3fImmutable newLoc = this.getMovementLoc(); Vector3fImmutable newLoc = this.getMovementLoc();
if (this.isAlive() == false || this.getBonuses().getBool(ModType.Stunned, SourceType.NONE) || this.getBonuses().getBool(ModType.CannotMove, SourceType.NONE)) { if (this.isAlive() == false || this.getBonuses().getBool(ModType.Stunned, SourceType.None) || this.getBonuses().getBool(ModType.CannotMove, SourceType.None)) {
//Target is stunned or rooted. Don't move //Target is stunned or rooted. Don't move
this.stopMovement(newLoc); this.stopMovement(newLoc);
return; return;
+125 -124
View File
@@ -26,9 +26,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<SourceType, Float> resists = new ConcurrentHashMap<>(MBServerStatics.CHM_INIT_CAP, MBServerStatics.CHM_LOAD, MBServerStatics.CHM_THREAD_LOW); private ConcurrentHashMap<Enum.DamageType, Float> resists = new ConcurrentHashMap<>(MBServerStatics.CHM_INIT_CAP, MBServerStatics.CHM_LOAD, MBServerStatics.CHM_THREAD_LOW);
private ConcurrentHashMap<SourceType, Boolean> immuneTo = new ConcurrentHashMap<>(MBServerStatics.CHM_INIT_CAP, MBServerStatics.CHM_LOAD, MBServerStatics.CHM_THREAD_LOW); private ConcurrentHashMap<Enum.DamageType, Boolean> immuneTo = new ConcurrentHashMap<>(MBServerStatics.CHM_INIT_CAP, MBServerStatics.CHM_LOAD, MBServerStatics.CHM_THREAD_LOW);
private SourceType protection; private Enum.DamageType protection;
private int protectionTrains = 0; private int protectionTrains = 0;
private boolean immuneToAll; private boolean immuneToAll;
@@ -51,9 +51,9 @@ public class Resists {
} }
public Resists(Resists r) { public Resists(Resists r) {
for (SourceType dt : r.resists.keySet()) for (Enum.DamageType dt : r.resists.keySet())
this.resists.put(dt, r.resists.get(dt)); this.resists.put(dt, r.resists.get(dt));
for (SourceType dt : r.immuneTo.keySet()) for (Enum.DamageType 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;
@@ -83,30 +83,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(SourceType.SLASHING, rs.getFloat("slash")); this.resists.put(Enum.DamageType.SLASHING, rs.getFloat("slash"));
this.resists.put(SourceType.CRUSHING, rs.getFloat("crush")); this.resists.put(Enum.DamageType.CRUSHING, rs.getFloat("crush"));
this.resists.put(SourceType.PIERCING, rs.getFloat("pierce")); this.resists.put(Enum.DamageType.PIERCING, rs.getFloat("pierce"));
this.resists.put(SourceType.MAGIC, rs.getFloat("magic")); this.resists.put(Enum.DamageType.MAGIC, rs.getFloat("magic"));
this.resists.put(SourceType.BLEEDING, rs.getFloat("bleed")); this.resists.put(Enum.DamageType.BLEEDING, rs.getFloat("bleed"));
this.resists.put(SourceType.POISON, rs.getFloat("poison")); this.resists.put(Enum.DamageType.POISON, rs.getFloat("poison"));
this.resists.put(SourceType.MENTAL, rs.getFloat("mental")); this.resists.put(Enum.DamageType.MENTAL, rs.getFloat("mental"));
this.resists.put(SourceType.HOLY, rs.getFloat("holy")); this.resists.put(Enum.DamageType.HOLY, rs.getFloat("holy"));
this.resists.put(SourceType.UNHOLY, rs.getFloat("unholy")); this.resists.put(Enum.DamageType.UNHOLY, rs.getFloat("unholy"));
this.resists.put(SourceType.LIGHTNING, rs.getFloat("lightning")); this.resists.put(Enum.DamageType.LIGHTNING, rs.getFloat("lightning"));
this.resists.put(SourceType.FIRE, rs.getFloat("fire")); this.resists.put(Enum.DamageType.FIRE, rs.getFloat("fire"));
this.resists.put(SourceType.COLD, rs.getFloat("cold")); this.resists.put(Enum.DamageType.COLD, rs.getFloat("cold"));
this.resists.put(SourceType.HEALING, 0f); this.resists.put(Enum.DamageType.HEALING, 0f);
} }
//Handle Fortitudes //Handle Fortitudes
private static float handleFortitude(AbstractCharacter target, SourceType type, float damage) { private static float handleFortitude(AbstractCharacter target, Enum.DamageType 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 == SourceType.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?
@@ -126,21 +126,21 @@ public class Resists {
if (forts == null || !isValidDamageCapType(forts, type, exclusive)) if (forts == null || !isValidDamageCapType(forts, type, exclusive))
return damage; 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 //Adjust damage down and return new amount
float aadc = 1 + adjustedDamage; float aadc = 1 + adjustedDamage;
return capFire * aadc; return capFire * aadc;
} }
//Test if Damagetype is valid for foritude //Test if Damagetype is valid for foritude
private static boolean isValidDamageCapType(HashSet<SourceType> forts, SourceType damageType, boolean exclusive) { private static boolean isValidDamageCapType(HashSet<SourceType> forts, Enum.DamageType damageType, boolean exclusive) {
for (SourceType fort : forts) { for (SourceType fort : forts) {
SourceType dt = SourceType.valueOf(fort.name().toUpperCase()); Enum.DamageType dt = Enum.DamageType.getDamageType(fort.name());
if (dt == SourceType.NONE) if (dt.equals(Enum.DamageType.NONE))
continue; continue;
if (dt == damageType) { if (dt.equals(damageType)) {
return exclusive; return exclusive;
} }
} }
@@ -195,19 +195,19 @@ public class Resists {
*/ */
public final void setBuildingResists() { public final void setBuildingResists() {
this.immuneToAll = false; this.immuneToAll = false;
this.resists.put(SourceType.SLASHING, 85f); this.resists.put(Enum.DamageType.SLASHING, 85f);
this.resists.put(SourceType.CRUSHING, 85f); this.resists.put(Enum.DamageType.CRUSHING, 85f);
this.immuneTo.put(SourceType.PIERCING, true); this.resists.put(Enum.DamageType.SIEGE, 0f);
this.immuneTo.put(SourceType.MAGIC, true); this.immuneTo.put(Enum.DamageType.PIERCING, true);
this.immuneTo.put(SourceType.BLEEDING, true); this.immuneTo.put(Enum.DamageType.MAGIC, true);
this.immuneTo.put(SourceType.POISON, true); this.immuneTo.put(Enum.DamageType.BLEEDING, true);
this.immuneTo.put(SourceType.MENTAL, true); this.immuneTo.put(Enum.DamageType.POISON, true);
this.immuneTo.put(SourceType.HOLY, true); this.immuneTo.put(Enum.DamageType.MENTAL, true);
this.immuneTo.put(SourceType.UNHOLY, true); this.immuneTo.put(Enum.DamageType.HOLY, true);
this.immuneTo.put(SourceType.LIGHTNING, true); this.immuneTo.put(Enum.DamageType.UNHOLY, true);
this.immuneTo.put(SourceType.FIRE, true); this.immuneTo.put(Enum.DamageType.LIGHTNING, true);
this.immuneTo.put(SourceType.COLD, true); this.immuneTo.put(Enum.DamageType.FIRE, true);
this.resists.put(SourceType.SIEGE, 0f); 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(SourceType.SLASHING, true); this.immuneTo.put(Enum.DamageType.SLASHING, true);
this.immuneTo.put(SourceType.CRUSHING, true); this.immuneTo.put(Enum.DamageType.CRUSHING, true);
this.immuneTo.put(SourceType.PIERCING, true); this.immuneTo.put(Enum.DamageType.PIERCING, true);
this.immuneTo.put(SourceType.MAGIC, true); this.immuneTo.put(Enum.DamageType.MAGIC, true);
this.immuneTo.put(SourceType.BLEEDING, true); this.immuneTo.put(Enum.DamageType.BLEEDING, true);
this.immuneTo.put(SourceType.POISON, true); this.immuneTo.put(Enum.DamageType.POISON, true);
this.immuneTo.put(SourceType.MENTAL, true); this.immuneTo.put(Enum.DamageType.MENTAL, true);
this.immuneTo.put(SourceType.HOLY, true); this.immuneTo.put(Enum.DamageType.HOLY, true);
this.immuneTo.put(SourceType.UNHOLY, true); this.immuneTo.put(Enum.DamageType.UNHOLY, true);
this.immuneTo.put(SourceType.LIGHTNING, true); this.immuneTo.put(Enum.DamageType.LIGHTNING, true);
this.immuneTo.put(SourceType.FIRE, true); this.immuneTo.put(Enum.DamageType.FIRE, true);
this.immuneTo.put(SourceType.COLD, true); this.immuneTo.put(Enum.DamageType.COLD, true);
this.resists.put(SourceType.SIEGE, 0f); this.resists.put(Enum.DamageType.SIEGE, 0f);
} }
/** /**
@@ -236,27 +236,27 @@ public class Resists {
*/ */
public final void setGenericResists() { public final void setGenericResists() {
this.immuneToAll = false; this.immuneToAll = false;
this.resists.put(SourceType.SLASHING, 0f); this.resists.put(Enum.DamageType.SLASHING, 0f);
this.resists.put(SourceType.CRUSHING, 0f); this.resists.put(Enum.DamageType.CRUSHING, 0f);
this.resists.put(SourceType.PIERCING, 0f); this.resists.put(Enum.DamageType.PIERCING, 0f);
this.resists.put(SourceType.MAGIC, 0f); this.resists.put(Enum.DamageType.MAGIC, 0f);
this.resists.put(SourceType.BLEEDING, 0f); this.resists.put(Enum.DamageType.BLEEDING, 0f);
this.resists.put(SourceType.POISON, 0f); this.resists.put(Enum.DamageType.POISON, 0f);
this.resists.put(SourceType.MENTAL, 0f); this.resists.put(Enum.DamageType.MENTAL, 0f);
this.resists.put(SourceType.HOLY, 0f); this.resists.put(Enum.DamageType.HOLY, 0f);
this.resists.put(SourceType.UNHOLY, 0f); this.resists.put(Enum.DamageType.UNHOLY, 0f);
this.resists.put(SourceType.LIGHTNING, 0f); this.resists.put(Enum.DamageType.LIGHTNING, 0f);
this.resists.put(SourceType.FIRE, 0f); this.resists.put(Enum.DamageType.FIRE, 0f);
this.resists.put(SourceType.COLD, 0f); this.resists.put(Enum.DamageType.COLD, 0f);
this.resists.put(SourceType.HEALING, 0f); this.resists.put(Enum.DamageType.HEALING, 0f);
this.immuneTo.put(SourceType.SIEGE, true); this.immuneTo.put(Enum.DamageType.SIEGE, true);
} }
/** /**
* Get a resist * Get a resist
*/ */
public float getResist(SourceType type, int trains) { public float getResist(Enum.DamageType 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 +278,7 @@ public class Resists {
/** /**
* get immuneTo * get immuneTo
*/ */
public boolean immuneTo(SourceType type) { public boolean immuneTo(Enum.DamageType type) {
if (this.immuneTo.containsKey(type)) if (this.immuneTo.containsKey(type))
return this.immuneTo.get(type); return this.immuneTo.get(type);
else else
@@ -293,13 +293,13 @@ public class Resists {
} }
public boolean immuneToAttacks() { public boolean immuneToAttacks() {
return immuneTo(SourceType.IMMUNETOATTACK); return immuneTo(Enum.DamageType.ATTACK);
} }
/** /**
* Set a resist * Set a resist
*/ */
public void setResist(SourceType type, float value) { public void setResist(Enum.DamageType type, float value) {
this.resists.put(type, value); this.resists.put(type, value);
} }
@@ -322,12 +322,12 @@ 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, SourceType type, float damage, int trains) { public float getResistedDamage(AbstractCharacter source, AbstractCharacter target, Enum.DamageType 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
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); float damageAfterResists = damage * (1 - (this.getResist(type, trains) * 0.01f) + ap);
//check to see if any damage absorbers should cancel //check to see if any damage absorbers should cancel
@@ -346,41 +346,41 @@ 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(SourceType.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(SourceType.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(SourceType.IMMUNETOATTACK, 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(SourceType.IMMUNETOPOWERS, 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(SourceType.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(SourceType.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(SourceType.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(SourceType.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(SourceType.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(SourceType.SNARE, true); this.immuneTo.put(Enum.DamageType.SNARE, true);
// Handle resists // Handle resists
slash += rb.getFloat(ModType.Resistance, SourceType.SLASHING); slash += rb.getFloat(ModType.Resistance, SourceType.Slashing);
crush += rb.getFloat(ModType.Resistance, SourceType.CRUSHING); crush += rb.getFloat(ModType.Resistance, SourceType.Crushing);
pierce += rb.getFloat(ModType.Resistance, SourceType.PIERCING); 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.BLEEDING); 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);
unholy += rb.getFloat(ModType.Resistance, SourceType.UNHOLY); unholy += rb.getFloat(ModType.Resistance, SourceType.Unholy);
lightning += rb.getFloat(ModType.Resistance, SourceType.LIGHTNING); lightning += rb.getFloat(ModType.Resistance, SourceType.Lightning);
fire += rb.getFloat(ModType.Resistance, SourceType.FIRE); fire += rb.getFloat(ModType.Resistance, SourceType.Fire);
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());
} }
@@ -404,29 +404,30 @@ public class Resists {
} }
} }
this.resists.put(SourceType.SLASHING, slash); this.resists.put(Enum.DamageType.SLASHING, slash);
this.resists.put(SourceType.CRUSHING, crush); this.resists.put(Enum.DamageType.CRUSHING, crush);
this.resists.put(SourceType.PIERCING, pierce); this.resists.put(Enum.DamageType.PIERCING, pierce);
this.resists.put(SourceType.MAGIC, magic); this.resists.put(Enum.DamageType.MAGIC, magic);
this.resists.put(SourceType.BLEEDING, bleed); this.resists.put(Enum.DamageType.BLEEDING, bleed);
this.resists.put(SourceType.POISON, poison); this.resists.put(Enum.DamageType.POISON, poison);
this.resists.put(SourceType.MENTAL, mental); this.resists.put(Enum.DamageType.MENTAL, mental);
this.resists.put(SourceType.HOLY, holy); this.resists.put(Enum.DamageType.HOLY, holy);
this.resists.put(SourceType.UNHOLY, unholy); this.resists.put(Enum.DamageType.UNHOLY, unholy);
this.resists.put(SourceType.LIGHTNING, lightning); this.resists.put(Enum.DamageType.LIGHTNING, lightning);
this.resists.put(SourceType.FIRE, fire); this.resists.put(Enum.DamageType.FIRE, fire);
this.resists.put(SourceType.COLD, cold); this.resists.put(Enum.DamageType.COLD, cold);
this.resists.put(SourceType.HEALING, healing); this.resists.put(Enum.DamageType.HEALING, healing);
this.immuneTo.put(SourceType.SIEGE, true);
this.immuneTo.put(Enum.DamageType.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 (SourceType dt : resists.keySet()) for (Enum.DamageType dt : resists.keySet())
ChatManager.chatSystemInfo(pc, " resist." + dt.name() + ": " + resists.get(dt)); ChatManager.chatSystemInfo(pc, " resist." + dt.name() + ": " + resists.get(dt));
for (SourceType dt : immuneTo.keySet()) for (Enum.DamageType 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)
@@ -439,9 +440,9 @@ public class Resists {
String out = pc.getName(); String out = pc.getName();
out += "Resists: "; out += "Resists: ";
Iterator<SourceType> it = this.resists.keySet().iterator(); Iterator<Enum.DamageType> it = this.resists.keySet().iterator();
while (it.hasNext()) { while (it.hasNext()) {
SourceType damType = it.next(); Enum.DamageType damType = it.next();
String dtName = damType.name(); String dtName = damType.name();
out += dtName + '=' + this.resists.get(dtName) + ", "; out += dtName + '=' + this.resists.get(dtName) + ", ";
} }
@@ -449,7 +450,7 @@ public class Resists {
out += "ImmuneTo: "; out += "ImmuneTo: ";
it = this.immuneTo.keySet().iterator(); it = this.immuneTo.keySet().iterator();
while (it.hasNext()) { while (it.hasNext()) {
SourceType damType = it.next(); Enum.DamageType damType = it.next();
String dtName = damType.name(); String dtName = damType.name();
out += dtName + '=' + this.resists.get(dtName) + ", "; out += dtName + '=' + this.resists.get(dtName) + ", ";
+6 -6
View File
@@ -254,19 +254,19 @@ public class ActionsBase {
//TODO make this more efficient then testing strings //TODO make this more efficient then testing strings
if (this.stackType.equals("Stun") && bonus.getBool(ModType.ImmuneTo, SourceType.STUN)) if (this.stackType.equals("Stun") && bonus.getBool(ModType.ImmuneTo, SourceType.STUN))
return true; //Currently stun immune. Skip stun return true; //Currently stun immune. Skip stun
else if (this.stackType.equals("Snare") && bonus.getBool(ModType.ImmuneTo, SourceType.SNARE)) else if (this.stackType.equals("Snare") && bonus.getBool(ModType.ImmuneTo, SourceType.Snare))
return true; //Currently snare immune. Skip snare return true; //Currently snare immune. Skip snare
else if (this.stackType.equals("Blindness") && bonus.getBool(ModType.ImmuneTo, SourceType.BLIND)) else if (this.stackType.equals("Blindness") && bonus.getBool(ModType.ImmuneTo, SourceType.Blind))
return true; //Currently blind immune. Skip blind return true; //Currently blind immune. Skip blind
else if (this.stackType.equals("PowerInhibitor") && bonus.getBool(ModType.ImmuneTo, SourceType.POWERBLOCK)) else if (this.stackType.equals("PowerInhibitor") && bonus.getBool(ModType.ImmuneTo, SourceType.Powerblock))
return true; //Currently power block immune. Skip power block return true; //Currently power block immune. Skip power block
else if (this.stackType.equals("Root") && bonus.getBool(ModType.ImmuneTo, SourceType.ROOT)) else if (this.stackType.equals("Root") && bonus.getBool(ModType.ImmuneTo, SourceType.Root))
return true; return true;
// else if (pb.isHeal() && (bonus.getByte("immuneTo.Heal")) >= trains) // else if (pb.isHeal() && (bonus.getByte("immuneTo.Heal")) >= trains)
// return true; //Currently shadowmantled. Skip heals // return true; //Currently shadowmantled. Skip heals
else if (this.stackType.equals("Flight") && bonus.getBool(ModType.NoMod, SourceType.FLY)) else if (this.stackType.equals("Flight") && bonus.getBool(ModType.NoMod, SourceType.Fly))
return true; return true;
else if (this.stackType.equals("Track") && bonus.getBool(ModType.CannotTrack, SourceType.NONE)) else if (this.stackType.equals("Track") && bonus.getBool(ModType.CannotTrack, SourceType.None))
return true; return true;
else else
return pb.vampDrain() && bonus.getBool(ModType.BlockedPowerType, SourceType.VAMPDRAIN); return pb.vampDrain() && bonus.getBool(ModType.BlockedPowerType, SourceType.VAMPDRAIN);
+3 -3
View File
@@ -13,18 +13,18 @@ import engine.Enum;
public class DamageShield { public class DamageShield {
private final Enum.SourceType damageType; private final Enum.DamageType damageType;
private final float amount; private final float amount;
private final boolean usePercent; private final boolean usePercent;
public DamageShield(Enum.SourceType damageType, float amount, boolean usePercent) { public DamageShield(Enum.DamageType 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 Enum.SourceType getDamageType() { public Enum.DamageType getDamageType() {
return this.damageType; return this.damageType;
} }
+6 -15
View File
@@ -46,7 +46,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<Enum.SourceType>> EffectDamageTypes = new HashMap<>(); public static HashMap<Integer, HashSet<Enum.DamageType>> 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;
@@ -224,14 +224,14 @@ public class EffectsBase {
if (!EffectsBase.EffectDamageTypes.containsKey(eb.getToken())) if (!EffectsBase.EffectDamageTypes.containsKey(eb.getToken()))
EffectsBase.EffectDamageTypes.put(eb.getToken(), new HashSet<>()); EffectsBase.EffectDamageTypes.put(eb.getToken(), new HashSet<>());
Enum.SourceType dt = getDamageType(damageType1); Enum.DamageType dt = Enum.DamageType.getDamageType(damageType1);
if (dt != null) if (dt != null)
EffectsBase.EffectDamageTypes.get(eb.token).add(dt); EffectsBase.EffectDamageTypes.get(eb.token).add(dt);
dt = getDamageType(damageType2); dt = Enum.DamageType.getDamageType(damageType2);
if (dt != null) if (dt != null)
EffectsBase.EffectDamageTypes.get(eb.token).add(dt); EffectsBase.EffectDamageTypes.get(eb.token).add(dt);
dt = getDamageType(damageType3); dt = Enum.DamageType.getDamageType(damageType3);
if (dt != null) if (dt != null)
EffectsBase.EffectDamageTypes.get(eb.token).add(dt); EffectsBase.EffectDamageTypes.get(eb.token).add(dt);
break; break;
@@ -277,15 +277,6 @@ public class EffectsBase {
} }
} }
private static Enum.SourceType getDamageType(String name) {
if (name.isEmpty())
return null;
else
return Enum.SourceType.valueOf(name.toUpperCase());
}
public static String getItemEffectsByName(String string) { public static String getItemEffectsByName(String string) {
if (EffectsBase.itemEffectsByName.containsKey(string)) if (EffectsBase.itemEffectsByName.containsKey(string))
return EffectsBase.itemEffectsByName.get(string); return EffectsBase.itemEffectsByName.get(string);
@@ -313,7 +304,7 @@ public class EffectsBase {
} }
public boolean containsDamageType(Enum.SourceType dt) { public boolean containsDamageType(Enum.DamageType 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);
@@ -704,7 +695,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 (Enum.SourceType type : EffectsBase.EffectDamageTypes.get(this.token)) { for (Enum.DamageType type : EffectsBase.EffectDamageTypes.get(this.token)) {
text += type.name() + ' '; text += type.name() + ' ';
} }
return text; return text;
@@ -32,7 +32,7 @@ public class AmbidexterityEffectModifier extends AbstractEffectModifier {
@Override @Override
public void applyBonus(AbstractCharacter ac, int trains) { public void applyBonus(AbstractCharacter ac, int trains) {
PlayerBonuses bonus = ac.getBonuses(); PlayerBonuses bonus = ac.getBonuses();
bonus.setBool(ModType.Ambidexterity, SourceType.NONE, true); bonus.setBool(ModType.Ambidexterity, SourceType.None, true);
} }
@Override @Override
@@ -33,7 +33,7 @@ public class BlackMantleEffectModifier extends AbstractEffectModifier {
@Override @Override
public void applyBonus(AbstractCharacter ac, int trains) { public void applyBonus(AbstractCharacter ac, int trains) {
PlayerBonuses bonus = ac.getBonuses(); PlayerBonuses bonus = ac.getBonuses();
SourceType sourceType = SourceType.valueOf(this.type.toUpperCase()); SourceType sourceType = SourceType.valueOf(this.type);
if (sourceType == null) { if (sourceType == null) {
Logger.error("Bad Source Type for " + this.type); Logger.error("Bad Source Type for " + this.type);
@@ -40,7 +40,7 @@ public class BlockedPowerTypeEffectModifier extends AbstractEffectModifier {
ModType toBlock = ModType.None; ModType toBlock = ModType.None;
switch (this.sourceType) { switch (this.sourceType) {
case INVISIBLE: case Invisible:
toBlock = ModType.Invisible; toBlock = ModType.Invisible;
break; break;
} }
@@ -49,7 +49,7 @@ public class DamageShieldEffectModifier extends AbstractEffectModifier {
amount *= (1 + mod); amount *= (1 + mod);
} }
Enum.SourceType dt = Enum.SourceType.valueOf(this.type.toUpperCase()); Enum.DamageType dt = Enum.DamageType.getDamageType(this.type);
if (dt != null) { if (dt != null) {
@@ -9,6 +9,7 @@
package engine.powers.effectmodifiers; package engine.powers.effectmodifiers;
import engine.Enum;
import engine.Enum.GameObjectType; import engine.Enum.GameObjectType;
import engine.Enum.ModType; import engine.Enum.ModType;
import engine.Enum.SourceType; import engine.Enum.SourceType;
@@ -27,13 +28,13 @@ import java.util.concurrent.ThreadLocalRandom;
public class HealthEffectModifier extends AbstractEffectModifier { public class HealthEffectModifier extends AbstractEffectModifier {
private SourceType damageType; private Enum.DamageType 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 = SourceType.valueOf(damageTypeDB.toUpperCase()); this.damageType = Enum.DamageType.getDamageType(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.toUpperCase() + '\'', e); + " value received = '" + damageTypeDB.toUpperCase() + '\'', e);
@@ -153,7 +154,7 @@ public class HealthEffectModifier extends AbstractEffectModifier {
// Apply any power effect modifiers (such as stances) // Apply any power effect modifiers (such as stances)
if (bonus != null) if (bonus != null)
modAmount *= (1 + (bonus.getFloatPercentAll(ModType.PowerDamageModifier, SourceType.NONE))); modAmount *= (1 + (bonus.getFloatPercentAll(ModType.PowerDamageModifier, SourceType.None)));
} }
if (modAmount == 0f) if (modAmount == 0f)
return; return;
@@ -192,7 +193,7 @@ public class HealthEffectModifier extends AbstractEffectModifier {
}*/ }*/
PlayerBonuses bonus = ac.getBonuses(); PlayerBonuses bonus = ac.getBonuses();
if (!skipImmune && bonus.getFloat(ModType.BlackMantle, SourceType.HEALING) >= trains) { if (!skipImmune && bonus.getFloat(ModType.BlackMantle, SourceType.Heal) >= 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);
@@ -30,13 +30,13 @@ import java.util.concurrent.ThreadLocalRandom;
public class ManaEffectModifier extends AbstractEffectModifier { public class ManaEffectModifier extends AbstractEffectModifier {
private SourceType damageType; private Enum.DamageType 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 = SourceType.valueOf(damageTypeDB.toUpperCase()); this.damageType = Enum.DamageType.getDamageType(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.toUpperCase() + '\'', e); + " value received = '" + damageTypeDB.toUpperCase() + '\'', e);
@@ -114,7 +114,7 @@ public class ManaEffectModifier extends AbstractEffectModifier {
// Apply any power effect modifiers (such as stances) // Apply any power effect modifiers (such as stances)
if (bonus != null) if (bonus != null)
modAmount *= (1 + bonus.getFloatPercentAll(ModType.PowerDamageModifier, SourceType.NONE)); modAmount *= (1 + bonus.getFloatPercentAll(ModType.PowerDamageModifier, SourceType.None));
} }
if (modAmount == 0f) if (modAmount == 0f)
return; return;
@@ -142,7 +142,7 @@ public class ManaEffectModifier extends AbstractEffectModifier {
} }
} }
PlayerBonuses bonus = ac.getBonuses(); PlayerBonuses bonus = ac.getBonuses();
if (!skipImmune && bonus.getFloat(ModType.BlackMantle, SourceType.HEALING) >= trains) { if (!skipImmune && bonus.getFloat(ModType.BlackMantle, SourceType.Heal) >= 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);
@@ -33,7 +33,7 @@ public class NoModEffectModifier extends AbstractEffectModifier {
bonus.setBool(this.modType, this.sourceType, true); bonus.setBool(this.modType, this.sourceType, true);
switch (this.sourceType) { switch (this.sourceType) {
case FLY: case Fly:
if (!ac.getObjectType().equals(GameObjectType.PlayerCharacter)) if (!ac.getObjectType().equals(GameObjectType.PlayerCharacter))
return; return;
PlayerCharacter flyer = (PlayerCharacter) ac; PlayerCharacter flyer = (PlayerCharacter) ac;
@@ -30,13 +30,13 @@ import java.util.concurrent.ThreadLocalRandom;
public class StaminaEffectModifier extends AbstractEffectModifier { public class StaminaEffectModifier extends AbstractEffectModifier {
private SourceType damageType; private Enum.DamageType 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 = SourceType.valueOf(damageTypeDB.toUpperCase()); this.damageType = Enum.DamageType.getDamageType(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.toUpperCase() + '\'', e); + " value received = '" + damageTypeDB.toUpperCase() + '\'', e);
@@ -112,7 +112,7 @@ public class StaminaEffectModifier extends AbstractEffectModifier {
// Apply any power effect modifiers (such as stances) // Apply any power effect modifiers (such as stances)
if (bonus != null) if (bonus != null)
modAmount *= (1 + (bonus.getFloatPercentAll(ModType.PowerDamageModifier, SourceType.NONE))); modAmount *= (1 + (bonus.getFloatPercentAll(ModType.PowerDamageModifier, SourceType.None)));
} }
if (modAmount == 0f) if (modAmount == 0f)
return; return;
@@ -140,7 +140,7 @@ public class StaminaEffectModifier extends AbstractEffectModifier {
} }
} }
PlayerBonuses bonus = ac.getBonuses(); PlayerBonuses bonus = ac.getBonuses();
if (!skipImmune && bonus.getFloat(ModType.BlackMantle, SourceType.HEALING) >= trains) { if (!skipImmune && bonus.getFloat(ModType.BlackMantle, SourceType.Heal) >= 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);
@@ -188,7 +188,7 @@ public class ApplyEffectPowerAction extends AbstractPowerAction {
if (bonuses == null) if (bonuses == null)
return; return;
boolean noSilence = bonuses.getBool(ModType.Silenced, SourceType.NONE); boolean noSilence = bonuses.getBool(ModType.Silenced, SourceType.None);
if (noSilence) if (noSilence)
return; return;
@@ -44,7 +44,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 SourceType damageType; protected Enum.DamageType 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 {
@@ -78,7 +78,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 = SourceType.valueOf(damageString.toUpperCase()); this.damageType = Enum.DamageType.getDamageType(damageString);
} catch (Exception e) { } catch (Exception e) {
this.damageType = null; this.damageType = null;
} }
@@ -210,7 +210,7 @@ public class TransferStatPowerAction extends AbstractPowerAction {
// Apply any power effect modifiers (such as stances) // Apply any power effect modifiers (such as stances)
PlayerBonuses bonus = source.getBonuses(); PlayerBonuses bonus = source.getBonuses();
if (bonus != null) if (bonus != null)
damage *= (1 + bonus.getFloatPercentAll(ModType.PowerDamageModifier, SourceType.NONE)); damage *= (1 + bonus.getFloatPercentAll(ModType.PowerDamageModifier, SourceType.None));
//get amount to transfer //get amount to transfer
fromAmount = damage; fromAmount = damage;
@@ -236,7 +236,7 @@ public class TransferStatPowerAction extends AbstractPowerAction {
AbstractNetMsg mhmFrom = null; AbstractNetMsg mhmFrom = null;
//stop if target is immune to drains //stop if target is immune to drains
if (from.getBonuses().getBool(ModType.ImmuneTo, SourceType.DRAIN)) { if (from.getBonuses().getBool(ModType.ImmuneTo, SourceType.Drain)) {
ModifyHealthMsg mhm = new ModifyHealthMsg(source, to, 0f, 0f, 0f, powerID, powerName, trains, effectID); ModifyHealthMsg mhm = new ModifyHealthMsg(source, to, 0f, 0f, 0f, powerID, powerName, trains, effectID);
mhm.setUnknown03(5); //set target is immune mhm.setUnknown03(5); //set target is immune
DispatchMessage.sendToAllInRange(from, mhm); DispatchMessage.sendToAllInRange(from, mhm);