From a29269e335938fc679a9e6dfe86a1acbb2b47362 Mon Sep 17 00:00:00 2001 From: MagicBot Date: Mon, 1 Apr 2024 09:19:37 -0400 Subject: [PATCH] Initial refactor of damagetype --- src/engine/Enum.java | 279 +++++++++++------- src/engine/gameManager/ChatManager.java | 2 +- src/engine/gameManager/CombatManager.java | 20 +- src/engine/gameManager/MovementManager.java | 4 +- src/engine/gameManager/NPCManager.java | 6 +- src/engine/gameManager/PowersManager.java | 14 +- src/engine/jobs/ChantJob.java | 2 +- src/engine/mobileAI/MobAI.java | 2 +- .../mobileAI/utilities/MovementUtilities.java | 2 +- .../net/client/handlers/RepairMsgHandler.java | 2 +- .../handlers/TrackWindowMsgHandler.java | 2 +- src/engine/objects/AbstractCharacter.java | 62 ++-- .../objects/AbstractIntelligenceAgent.java | 2 +- src/engine/objects/CharacterSkill.java | 6 +- src/engine/objects/Effect.java | 2 +- src/engine/objects/ItemTemplate.java | 6 +- src/engine/objects/Mob.java | 36 +-- src/engine/objects/PlayerBonuses.java | 8 +- src/engine/objects/PlayerCharacter.java | 58 ++-- src/engine/objects/Resists.java | 249 ++++++++-------- src/engine/powers/ActionsBase.java | 12 +- src/engine/powers/DamageShield.java | 6 +- src/engine/powers/EffectsBase.java | 2 +- .../AmbidexterityEffectModifier.java | 2 +- .../BlockedPowerTypeEffectModifier.java | 2 +- .../DamageShieldEffectModifier.java | 2 +- .../effectmodifiers/HealthEffectModifier.java | 9 +- .../effectmodifiers/ManaEffectModifier.java | 8 +- .../effectmodifiers/NoModEffectModifier.java | 2 +- .../StaminaEffectModifier.java | 8 +- .../poweractions/ApplyEffectPowerAction.java | 2 +- .../poweractions/TransferStatPowerAction.java | 8 +- 32 files changed, 447 insertions(+), 380 deletions(-) diff --git a/src/engine/Enum.java b/src/engine/Enum.java index 981ae784..42a16894 100644 --- a/src/engine/Enum.java +++ b/src/engine/Enum.java @@ -724,118 +724,178 @@ 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 { - NONE, - ABJURATION, - ACID, - ANTISIEGE, - ARCHERY, - AXE, - BARDSONG, - BEASTCRAFT, - BENEDICTION, - BLADEWEAVING, - BLEEDING, - BLIND, - BLOCK, - BLOODCRAFT, - BOW, - BUFF, - CHANNELING, - CHARM, + None, + Abjuration, + Acid, + AntiSiege, + Archery, + Axe, + Bardsong, + Beastcraft, + Benediction, + BladeWeaving, + Bleed, + 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, + Constitution, + Corruption, + Crossbow, + Crush, + Dagger, + DaggerMastery, + DeBuff, + Dexterity, + Disease, + Dodge, + Dragon, + Drain, + Earth, + Effect, + Exorcism, + Fear, + Fire, FIRE, - FLY, - GIANT, - GREATAXEMASTERY, - GREATSWORDMASTERY, - HAMMER, - HEALING, + Fly, + Giant, + GreatAxeMastery, + GreatSwordMastery, + Hammer, + Heal, + Healing, + Holy, HOLY, - IMMUNETOATTACK, - IMMUNETOPOWERS, - INTELLIGENCE, - INVISIBLE, + ImmuneToAttack, + ImmuneToPowers, + Intelligence, + Invisible, + Lightning, LIGHTNING, - LITURGY, + Liturgy, + Magic, MAGIC, + Mental, MENTAL, - NATURELORE, - NECROMANCY, - PARRY, - PIERCING, + NatureLore, + Necromancy, + Parry, + Pierce, + Poison, POISON, - POLEARM, - POWERBLOCK, - RAT, - RESISTDEBUFF, - RESTORATION, - ROOT, - SHADOWMASTERY, - SIEGE, - SLASHING, - SNARE, - SORCERY, - SPEAR, - SPEARMASTERY, - SPIRIT, - STAFF, - STEAL, - STORMCALLING, - STRENGTH, - STUN, - SUMMON, - SWORD, - SWORDMASTERY, - THAUMATURGY, - THEURGY, - TRANSFORM, - UNARMEDCOMBAT, - UNARMEDCOMBATMASTERY, + PoleArm, + Powerblock, + Rat, + ResistDeBuff, + Restoration, + Root, + Shadowmastery, + Siege, + Slash, + 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. + 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, AEDAMAGE, BEHAVIOR, @@ -843,8 +903,10 @@ public class Enum { BOONCLASS, BOONRACE, BREAKFLY, + BUFF, CHANT, DAMAGE, + DEBUFF, DISPEL, FLIGHT, GROUPBUFF, @@ -857,24 +919,27 @@ public class Enum { SPIREDISABLE, SPIREPROOFTELEPORT, STANCE, + STUN, + SUMMON, TELEPORT, THIEF, TRACK, + TRANSFORM, VAMPDRAIN, WEAPON, - WIZARDRY; + Wizardry; public static SourceType GetSourceType(String modName) { SourceType returnMod; if (modName.isEmpty()) - return SourceType.NONE; + return SourceType.None; try { - returnMod = SourceType.valueOf(modName.replace(",", "").toUpperCase()); + returnMod = SourceType.valueOf(modName.replace(",", "")); } catch (Exception e) { Logger.error(modName); Logger.error(e); - return SourceType.NONE; + return SourceType.None; } return returnMod; } diff --git a/src/engine/gameManager/ChatManager.java b/src/engine/gameManager/ChatManager.java index a94ae0f7..c19bc3fa 100644 --- a/src/engine/gameManager/ChatManager.java +++ b/src/engine/gameManager/ChatManager.java @@ -95,7 +95,7 @@ public enum ChatManager { 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); return true; } diff --git a/src/engine/gameManager/CombatManager.java b/src/engine/gameManager/CombatManager.java index c8875872..8c938497 100644 --- a/src/engine/gameManager/CombatManager.java +++ b/src/engine/gameManager/CombatManager.java @@ -38,7 +38,7 @@ public enum CombatManager { case PlayerCharacter: case Mob: 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; break; case NPC: @@ -90,7 +90,7 @@ public enum CombatManager { if (weapon != 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; } @@ -210,15 +210,15 @@ public enum CombatManager { //get the damage type - Enum.SourceType damageType; + Enum.DamageType damageType; if (attacker.charItemManager.getEquipped().get(slot) == null) { - damageType = Enum.SourceType.CRUSHING; + damageType = Enum.DamageType.Crush; if (attacker.getObjectType().equals(Enum.GameObjectType.Mob)) if (((Mob) attacker).isSiege()) - damageType = Enum.SourceType.SIEGE; + damageType = Enum.DamageType.Siege; } 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 @@ -318,11 +318,11 @@ public enum CombatManager { int wepSpeed = (int) (weapon.template.item_weapon_wepspeed); - if (weapon.getBonusPercent(Enum.ModType.WeaponSpeed, Enum.SourceType.NONE) != 0f) //add weapon speed bonus - wepSpeed *= (1 + weapon.getBonus(Enum.ModType.WeaponSpeed, Enum.SourceType.NONE)); + if (weapon.getBonusPercent(Enum.ModType.WeaponSpeed, Enum.SourceType.None) != 0f) //add weapon speed bonus + 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 - wepSpeed *= (1 + attacker.getBonuses().getFloatPercentAll(Enum.ModType.AttackDelay, Enum.SourceType.NONE)); + 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)); if (wepSpeed < 10) wepSpeed = 10; //Old was 10, but it can be reached lower with legit buffs,effects. diff --git a/src/engine/gameManager/MovementManager.java b/src/engine/gameManager/MovementManager.java index a5743a77..9d8da63a 100644 --- a/src/engine/gameManager/MovementManager.java +++ b/src/engine/gameManager/MovementManager.java @@ -75,7 +75,7 @@ public enum MovementManager { toMove.setIsCasting(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; } @@ -391,7 +391,7 @@ public enum MovementManager { //don't move if player is stunned or rooted 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; member.update(); diff --git a/src/engine/gameManager/NPCManager.java b/src/engine/gameManager/NPCManager.java index 0a06200e..2475c6d1 100644 --- a/src/engine/gameManager/NPCManager.java +++ b/src/engine/gameManager/NPCManager.java @@ -433,9 +433,9 @@ public enum NPCManager { for (Item equipped : mob.charItemManager.equipped.values()) { 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.SourceType.CRUSHING, mob.resists.getResist(Enum.SourceType.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.Slash, mob.resists.getResist(Enum.DamageType.Slash, 0) + equipped.template.combat_attack_resist.get("SLASHING")); + mob.resists.setResist(Enum.DamageType.Crush, mob.resists.getResist(Enum.DamageType.Crush, 0) + equipped.template.combat_attack_resist.get("CRUSHING")); + mob.resists.setResist(Enum.DamageType.Pierce, mob.resists.getResist(Enum.DamageType.Pierce, 0) + equipped.template.combat_attack_resist.get("PIERCING")); } } } diff --git a/src/engine/gameManager/PowersManager.java b/src/engine/gameManager/PowersManager.java index da4d8167..85b7fd53 100644 --- a/src/engine/gameManager/PowersManager.java +++ b/src/engine/gameManager/PowersManager.java @@ -332,7 +332,7 @@ public enum PowersManager { // verify player is not stunned or prohibited from casting PlayerBonuses bonus = playerCharacter.getBonuses(); 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; // if moving make sure spell valid for movement @@ -468,7 +468,7 @@ public enum PowersManager { cost = 0; if (bonus != null) - cost *= (1 + bonus.getFloatPercentAll(ModType.PowerCost, SourceType.NONE)); + cost *= (1 + bonus.getFloatPercentAll(ModType.PowerCost, SourceType.None)); if (playerCharacter.getAltitude() > 0) cost *= 1.5f; @@ -615,7 +615,7 @@ public enum PowersManager { // verify player is not stunned or prohibited from casting PlayerBonuses bonus = caster.getBonuses(); 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; // if moving make sure spell valid for movement @@ -775,7 +775,7 @@ public enum PowersManager { PlayerBonuses bonus = playerCharacter.getBonuses(); if (bonus != null) { - if (bonus.getBool(ModType.Stunned, SourceType.NONE)) + if (bonus.getBool(ModType.Stunned, SourceType.None)) return; SourceType sourceType = SourceType.GetSourceType(pb.getCategory()); @@ -1053,7 +1053,7 @@ public enum PowersManager { // verify player is not stunned or power type is blocked PlayerBonuses bonus = caster.getBonuses(); if (bonus != null) { - if (bonus.getBool(ModType.Stunned, SourceType.NONE)) + if (bonus.getBool(ModType.Stunned, SourceType.None)) return; SourceType sourceType = SourceType.GetSourceType(pb.getCategory()); if (bonus.getBool(ModType.BlockedPowerType, sourceType)) @@ -1688,7 +1688,7 @@ public enum PowersManager { PlayerCharacter pcc = (PlayerCharacter) awo; PlayerBonuses bonuses = pcc.getBonuses(); - if (bonuses != null && bonuses.getBool(ModType.ImmuneToPowers, SourceType.NONE)) { + if (bonuses != null && bonuses.getBool(ModType.ImmuneToPowers, SourceType.None)) { awolist.remove(); continue; } @@ -1838,7 +1838,7 @@ public enum PowersManager { // Remove players who are in safe mode PlayerCharacter pcc = (PlayerCharacter) awo; PlayerBonuses bonuses = pcc.getBonuses(); - if (bonuses != null && bonuses.getBool(ModType.ImmuneToPowers, SourceType.NONE)) { + if (bonuses != null && bonuses.getBool(ModType.ImmuneToPowers, SourceType.None)) { awolist.remove(); continue; } diff --git a/src/engine/jobs/ChantJob.java b/src/engine/jobs/ChantJob.java index fb3ae831..cfb2bfb7 100644 --- a/src/engine/jobs/ChantJob.java +++ b/src/engine/jobs/ChantJob.java @@ -52,7 +52,7 @@ public class ChantJob extends AbstractEffectJob { PowersManager.finishEffectTime(this.source, this.target, this.action, this.trains); if (AbstractWorldObject.IsAbstractCharacter(source)) ((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); if (AbstractWorldObject.IsAbstractCharacter(source)) ((AbstractCharacter) source).cancelLastChant(); diff --git a/src/engine/mobileAI/MobAI.java b/src/engine/mobileAI/MobAI.java index 9bd693f1..c150ccdc 100644 --- a/src/engine/mobileAI/MobAI.java +++ b/src/engine/mobileAI/MobAI.java @@ -947,7 +947,7 @@ public class MobAI { if (mob.isSit() && mob.getTimeStamp("HEALTHRECOVERED") < System.currentTimeMillis() + 3000) 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.getTimestamps().put("HEALTHRECOVERED", System.currentTimeMillis()); diff --git a/src/engine/mobileAI/utilities/MovementUtilities.java b/src/engine/mobileAI/utilities/MovementUtilities.java index 7d6a41c4..c00bfffa 100644 --- a/src/engine/mobileAI/utilities/MovementUtilities.java +++ b/src/engine/mobileAI/utilities/MovementUtilities.java @@ -169,7 +169,7 @@ public class MovementUtilities { if (agent.getMobBase() != null && Enum.MobFlagType.SENTINEL.elementOf(agent.getMobBase().getFlags())) 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) { diff --git a/src/engine/net/client/handlers/RepairMsgHandler.java b/src/engine/net/client/handlers/RepairMsgHandler.java index 66bd860f..709dc335 100644 --- a/src/engine/net/client/handlers/RepairMsgHandler.java +++ b/src/engine/net/client/handlers/RepairMsgHandler.java @@ -90,7 +90,7 @@ public class RepairMsgHandler extends AbstractClientMsgHandler { //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)); if (dur >= max || dur < 1) { diff --git a/src/engine/net/client/handlers/TrackWindowMsgHandler.java b/src/engine/net/client/handlers/TrackWindowMsgHandler.java index 9abc6210..a5e0a288 100644 --- a/src/engine/net/client/handlers/TrackWindowMsgHandler.java +++ b/src/engine/net/client/handlers/TrackWindowMsgHandler.java @@ -149,7 +149,7 @@ public class TrackWindowMsgHandler extends AbstractClientMsgHandler { else if (awo.getObjectType().equals(Enum.GameObjectType.PlayerCharacter)) { 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(); } } diff --git a/src/engine/objects/AbstractCharacter.java b/src/engine/objects/AbstractCharacter.java index 88727eb0..c7a8a8f6 100644 --- a/src/engine/objects/AbstractCharacter.java +++ b/src/engine/objects/AbstractCharacter.java @@ -529,7 +529,7 @@ public abstract class AbstractCharacter extends AbstractWorldObject { boolean canFly = false; 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; return canFly; @@ -615,10 +615,10 @@ public abstract class AbstractCharacter extends AbstractWorldObject { if (abstractCharacter.bonuses != null) { // 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! - 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)); //Lucky rune applies next @@ -627,7 +627,7 @@ public abstract class AbstractCharacter extends AbstractWorldObject { //and negative percent modifiers //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)); } else @@ -729,7 +729,7 @@ public abstract class AbstractCharacter extends AbstractWorldObject { abstractCharacter.rangeHandTwo = weapon.template.item_weapon_max_range * (1 + (abstractCharacter.statStrBase / 600)); 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) abstractCharacter.rangeHandOne *= range_bonus; @@ -773,10 +773,10 @@ public abstract class AbstractCharacter extends AbstractWorldObject { // add in any bonuses to atr if (abstractCharacter.bonuses != null) { // 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! - 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; // next precise @@ -784,7 +784,7 @@ public abstract class AbstractCharacter extends AbstractWorldObject { // atr *= (1 + ((float) this.bonuses.getShort("rune.Attack") / 100)); //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); } @@ -804,9 +804,9 @@ public abstract class AbstractCharacter extends AbstractWorldObject { else speed = 20f; //unarmed attack speed 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) speed = 10; @@ -815,22 +815,22 @@ public abstract class AbstractCharacter extends AbstractWorldObject { if (weapon != null) { // Add any base bonuses - min += weapon.getBonus(ModType.MinDamage, SourceType.NONE); - max += weapon.getBonus(ModType.MaxDamage, SourceType.NONE); + min += weapon.getBonus(ModType.MinDamage, SourceType.None); + max += weapon.getBonus(ModType.MaxDamage, SourceType.None); - min += weapon.getBonus(ModType.MeleeDamageModifier, SourceType.NONE); - max += weapon.getBonus(ModType.MeleeDamageModifier, SourceType.NONE); + min += weapon.getBonus(ModType.MeleeDamageModifier, SourceType.None); + max += weapon.getBonus(ModType.MeleeDamageModifier, SourceType.None); // Finally use any multipliers. DO THIS LAST! float percentMinDamage = 1; float percentMaxDamage = 1; - percentMinDamage += weapon.getBonusPercent(ModType.MinDamage, SourceType.NONE); - percentMinDamage += weapon.getBonusPercent(ModType.MeleeDamageModifier, SourceType.NONE); + percentMinDamage += weapon.getBonusPercent(ModType.MinDamage, SourceType.None); + percentMinDamage += weapon.getBonusPercent(ModType.MeleeDamageModifier, SourceType.None); - percentMaxDamage += weapon.getBonusPercent(ModType.MaxDamage, SourceType.NONE); - percentMaxDamage += weapon.getBonusPercent(ModType.MeleeDamageModifier, SourceType.NONE); + percentMaxDamage += weapon.getBonusPercent(ModType.MaxDamage, SourceType.None); + percentMaxDamage += weapon.getBonusPercent(ModType.MeleeDamageModifier, SourceType.None); min *= percentMinDamage; @@ -867,21 +867,21 @@ public abstract class AbstractCharacter extends AbstractWorldObject { // add in any bonuses to damage if (abstractCharacter.bonuses != null) { // Add any base bonuses - minDamage += abstractCharacter.bonuses.getFloat(ModType.MinDamage, SourceType.NONE); - maxDamage += abstractCharacter.bonuses.getFloat(ModType.MaxDamage, SourceType.NONE); + minDamage += abstractCharacter.bonuses.getFloat(ModType.MinDamage, SourceType.None); + maxDamage += abstractCharacter.bonuses.getFloat(ModType.MaxDamage, SourceType.None); - minDamage += abstractCharacter.bonuses.getFloat(ModType.MeleeDamageModifier, SourceType.NONE); - maxDamage += abstractCharacter.bonuses.getFloat(ModType.MeleeDamageModifier, SourceType.NONE); + minDamage += abstractCharacter.bonuses.getFloat(ModType.MeleeDamageModifier, SourceType.None); + maxDamage += abstractCharacter.bonuses.getFloat(ModType.MeleeDamageModifier, SourceType.None); // Finally use any multipliers. DO THIS LAST! float percentMinDamage = 1; float percentMaxDamage = 1; - percentMinDamage += abstractCharacter.bonuses.getFloatPercentAll(ModType.MinDamage, SourceType.NONE); - percentMinDamage += abstractCharacter.bonuses.getFloatPercentAll(ModType.MeleeDamageModifier, SourceType.NONE); + percentMinDamage += abstractCharacter.bonuses.getFloatPercentAll(ModType.MinDamage, SourceType.None); + percentMinDamage += abstractCharacter.bonuses.getFloatPercentAll(ModType.MeleeDamageModifier, SourceType.None); - percentMaxDamage += abstractCharacter.bonuses.getFloatPercentAll(ModType.MaxDamage, SourceType.NONE); - percentMaxDamage += abstractCharacter.bonuses.getFloatPercentAll(ModType.MeleeDamageModifier, SourceType.NONE); + percentMaxDamage += abstractCharacter.bonuses.getFloatPercentAll(ModType.MaxDamage, SourceType.None); + percentMaxDamage += abstractCharacter.bonuses.getFloatPercentAll(ModType.MeleeDamageModifier, SourceType.None); minDamage *= percentMinDamage; maxDamage *= percentMaxDamage; @@ -930,8 +930,8 @@ public abstract class AbstractCharacter extends AbstractWorldObject { //apply item defense bonuses if (shield != null) { - def += shield.getBonus(ModType.DR, SourceType.NONE); - def *= (1 + shield.getBonusPercent(ModType.DR, SourceType.NONE)); + def += shield.getBonus(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 if (armor != null) { - def += armor.getBonus(ModType.DR, SourceType.NONE); - def *= (1 + armor.getBonusPercent(ModType.DR, SourceType.NONE)); + def += armor.getBonus(ModType.DR, SourceType.None); + def *= (1 + armor.getBonusPercent(ModType.DR, SourceType.None)); } return (def * (1 + ((int) armorSkill.getModifiedAmount() / 50f))); @@ -2176,7 +2176,7 @@ public abstract class AbstractCharacter extends AbstractWorldObject { 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; for (String s : this.effects.keySet()) { Effect eff = this.effects.get(s); diff --git a/src/engine/objects/AbstractIntelligenceAgent.java b/src/engine/objects/AbstractIntelligenceAgent.java index 5b1a8879..783029cc 100644 --- a/src/engine/objects/AbstractIntelligenceAgent.java +++ b/src/engine/objects/AbstractIntelligenceAgent.java @@ -141,7 +141,7 @@ public abstract class AbstractIntelligenceAgent extends AbstractCharacter { float ret = MobAIThread.AI_BASE_AGGRO_RANGE; if (this.bonuses != null) - ret *= (1 + this.bonuses.getFloatPercentAll(ModType.ScanRange, SourceType.NONE)); + ret *= (1 + this.bonuses.getFloatPercentAll(ModType.ScanRange, SourceType.None)); return ret; } diff --git a/src/engine/objects/CharacterSkill.java b/src/engine/objects/CharacterSkill.java index 5785bfaf..13934134 100644 --- a/src/engine/objects/CharacterSkill.java +++ b/src/engine/objects/CharacterSkill.java @@ -306,12 +306,12 @@ public class CharacterSkill extends AbstractGameObject { PlayerBonuses bonus = ac.getBonuses(); if (bonus == null) return atr; - atr += bonus.getFloat(ModType.OCV, SourceType.NONE); - float pos_Bonus = bonus.getFloatPercentPositive(ModType.OCV, SourceType.NONE); + atr += bonus.getFloat(ModType.OCV, SourceType.None); + float pos_Bonus = bonus.getFloatPercentPositive(ModType.OCV, SourceType.None); atr *= (1 + pos_Bonus); //rUNES will already be applied // 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); return atr; } diff --git a/src/engine/objects/Effect.java b/src/engine/objects/Effect.java index e667cdea..50355d2a 100644 --- a/src/engine/objects/Effect.java +++ b/src/engine/objects/Effect.java @@ -592,7 +592,7 @@ public class Effect { } //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()) return false; if (this.eb == null || amount < 0f) diff --git a/src/engine/objects/ItemTemplate.java b/src/engine/objects/ItemTemplate.java index 1cac25eb..16ef53d8 100644 --- a/src/engine/objects/ItemTemplate.java +++ b/src/engine/objects/ItemTemplate.java @@ -62,7 +62,7 @@ public class ItemTemplate { public int item_weapon_projectile_id; public float item_weapon_projectile_speed; public int item_weapon_combat_idle_anim; - public HashMap item_weapon_damage = new HashMap<>(); + public HashMap item_weapon_damage = new HashMap<>(); public ArrayList weapon_attack_anim_right = new ArrayList(); public ArrayList weapon_attack_anim_left = new ArrayList(); public Enum.AttributeType item_primary_attr = Enum.AttributeType.None; @@ -227,11 +227,11 @@ public class ItemTemplate { if (weapon_damage.isEmpty() == false) for (Object o : weapon_damage) { JSONObject damage_entry = (JSONObject) o; - Enum.SourceType sourceType = Enum.SourceType.valueOf(((String) damage_entry.get("damage_type")).toUpperCase()); + Enum.DamageType damageType = Enum.DamageType.valueOf(((String) damage_entry.get("damage_type"))); int min = ((Long) damage_entry.get("damage_min")).intValue(); int max = ((Long) damage_entry.get("damage_max")).intValue(); 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"); diff --git a/src/engine/objects/Mob.java b/src/engine/objects/Mob.java index b9a08925..2e36b35d 100644 --- a/src/engine/objects/Mob.java +++ b/src/engine/objects/Mob.java @@ -710,19 +710,19 @@ public class Mob extends AbstractIntelligenceAgent implements Delayed { // TODO modify for equipment if (this.bonuses != null) { // modify for effects - strVal += this.bonuses.getFloat(ModType.Attr, SourceType.STRENGTH); - dexVal += this.bonuses.getFloat(ModType.Attr, SourceType.DEXTERITY); - conVal += this.bonuses.getFloat(ModType.Attr, SourceType.CONSTITUTION); - intVal += this.bonuses.getFloat(ModType.Attr, SourceType.INTELLIGENCE); - spiVal += this.bonuses.getFloat(ModType.Attr, SourceType.SPIRIT); + strVal += this.bonuses.getFloat(ModType.Attr, SourceType.Strength); + dexVal += this.bonuses.getFloat(ModType.Attr, SourceType.Dexterity); + conVal += this.bonuses.getFloat(ModType.Attr, SourceType.Constitution); + intVal += this.bonuses.getFloat(ModType.Attr, SourceType.Intelligence); + spiVal += this.bonuses.getFloat(ModType.Attr, SourceType.Spirit); // apply dex penalty for armor // modify percent amounts. DO THIS LAST! - strVal *= (1 + this.bonuses.getFloatPercentAll(ModType.Attr, SourceType.STRENGTH)); - dexVal *= (1 + this.bonuses.getFloatPercentAll(ModType.Attr, SourceType.DEXTERITY)); - conVal *= (1 + this.bonuses.getFloatPercentAll(ModType.Attr, SourceType.CONSTITUTION)); - intVal *= (1 + this.bonuses.getFloatPercentAll(ModType.Attr, SourceType.INTELLIGENCE)); - spiVal *= (1 + this.bonuses.getFloatPercentAll(ModType.Attr, SourceType.SPIRIT)); + strVal *= (1 + this.bonuses.getFloatPercentAll(ModType.Attr, SourceType.Strength)); + dexVal *= (1 + this.bonuses.getFloatPercentAll(ModType.Attr, SourceType.Dexterity)); + conVal *= (1 + this.bonuses.getFloatPercentAll(ModType.Attr, SourceType.Constitution)); + intVal *= (1 + this.bonuses.getFloatPercentAll(ModType.Attr, SourceType.Intelligence)); + spiVal *= (1 + this.bonuses.getFloatPercentAll(ModType.Attr, SourceType.Spirit)); } // Set current stats @@ -739,7 +739,7 @@ public class Mob extends AbstractIntelligenceAgent implements Delayed { float bonus = 1; if (this.bonuses != null) // 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()) switch (this.mobBase.getLoadID()) { @@ -836,7 +836,7 @@ public class Mob extends AbstractIntelligenceAgent implements Delayed { if (!this.isMoving()) 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 this.stopMovement(this.getMovementLoc()); @@ -1072,15 +1072,15 @@ public class Mob extends AbstractIntelligenceAgent implements Delayed { // Apply any bonuses from runes and effects if (this.bonuses != null) { - h += this.bonuses.getFloat(ModType.HealthFull, SourceType.NONE); - m += this.bonuses.getFloat(ModType.ManaFull, SourceType.NONE); - s += this.bonuses.getFloat(ModType.StaminaFull, SourceType.NONE); + h += this.bonuses.getFloat(ModType.HealthFull, SourceType.None); + m += this.bonuses.getFloat(ModType.ManaFull, SourceType.None); + s += this.bonuses.getFloat(ModType.StaminaFull, SourceType.None); //apply effects percent modifiers. DO THIS LAST! - h *= (1 + this.bonuses.getFloatPercentAll(ModType.HealthFull, SourceType.NONE)); - m *= (1 + this.bonuses.getFloatPercentAll(ModType.ManaFull, SourceType.NONE)); - s *= (1 + this.bonuses.getFloatPercentAll(ModType.StaminaFull, SourceType.NONE)); + h *= (1 + this.bonuses.getFloatPercentAll(ModType.HealthFull, SourceType.None)); + m *= (1 + this.bonuses.getFloatPercentAll(ModType.ManaFull, SourceType.None)); + s *= (1 + this.bonuses.getFloatPercentAll(ModType.StaminaFull, SourceType.None)); } // Set max health, mana and stamina diff --git a/src/engine/objects/PlayerBonuses.java b/src/engine/objects/PlayerBonuses.java index 6ca9a59e..965217dc 100644 --- a/src/engine/objects/PlayerBonuses.java +++ b/src/engine/objects/PlayerBonuses.java @@ -229,7 +229,7 @@ public class PlayerBonuses { //Update seeInvis if needed - float seeInvis = this.getFloat(ModType.SeeInvisible, SourceType.NONE); + float seeInvis = this.getFloat(ModType.SeeInvisible, SourceType.None); if (pc.getSeeInvis() < seeInvis) pc.setSeeInvis((short) seeInvis); @@ -458,13 +458,13 @@ public class PlayerBonuses { float percentAmountNegative = this.getFloatPercentNegative(modType, sourceType); 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) - 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) - 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); } } diff --git a/src/engine/objects/PlayerCharacter.java b/src/engine/objects/PlayerCharacter.java index dde0689d..dce5e8d4 100644 --- a/src/engine/objects/PlayerCharacter.java +++ b/src/engine/objects/PlayerCharacter.java @@ -3091,7 +3091,7 @@ public class PlayerCharacter extends AbstractCharacter { if (this.bonuses != null) // 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 this.update(); @@ -3595,8 +3595,8 @@ public class PlayerCharacter extends AbstractCharacter { //calculateModifiedStats(); //update hide and seeInvis levels if (this.bonuses != null) { - this.hidden = (int) bonuses.getFloat(ModType.Invisible, SourceType.NONE); - this.seeInvis = (int) bonuses.getFloat(ModType.SeeInvisible, SourceType.NONE); + this.hidden = (int) bonuses.getFloat(ModType.Invisible, SourceType.None); + this.seeInvis = (int) bonuses.getFloat(ModType.SeeInvisible, SourceType.None); } else { this.hidden = (byte) 0; this.seeInvis = (byte) 0; @@ -3664,21 +3664,21 @@ public class PlayerCharacter extends AbstractCharacter { // TODO modify for equipment if (this.bonuses != null) { // modify for effects - strVal += Math.round(this.bonuses.getFloat(ModType.Attr, SourceType.STRENGTH)); - dexVal += Math.round(this.bonuses.getFloat(ModType.Attr, SourceType.DEXTERITY)); - conVal += Math.round(this.bonuses.getFloat(ModType.Attr, SourceType.CONSTITUTION)); - intVal += Math.round(this.bonuses.getFloat(ModType.Attr, SourceType.INTELLIGENCE)); - spiVal += Math.round(this.bonuses.getFloat(ModType.Attr, SourceType.SPIRIT)); + strVal += Math.round(this.bonuses.getFloat(ModType.Attr, SourceType.Strength)); + dexVal += Math.round(this.bonuses.getFloat(ModType.Attr, SourceType.Dexterity)); + conVal += Math.round(this.bonuses.getFloat(ModType.Attr, SourceType.Constitution)); + intVal += Math.round(this.bonuses.getFloat(ModType.Attr, SourceType.Intelligence)); + spiVal += Math.round(this.bonuses.getFloat(ModType.Attr, SourceType.Spirit)); // apply dex penalty for armor dexVal *= this.dexPenalty; // modify percent amounts. DO THIS LAST! - strVal *= (1 + this.bonuses.getFloatPercentAll(ModType.Attr, SourceType.STRENGTH)); - dexVal *= (1 + this.bonuses.getFloatPercentAll(ModType.Attr, SourceType.DEXTERITY)); - conVal *= (1 + this.bonuses.getFloatPercentAll(ModType.Attr, SourceType.CONSTITUTION)); - intVal *= (1 + this.bonuses.getFloatPercentAll(ModType.Attr, SourceType.INTELLIGENCE)); - spiVal *= (1 + this.bonuses.getFloatPercentAll(ModType.Attr, SourceType.SPIRIT)); + strVal *= (1 + this.bonuses.getFloatPercentAll(ModType.Attr, SourceType.Strength)); + dexVal *= (1 + this.bonuses.getFloatPercentAll(ModType.Attr, SourceType.Dexterity)); + conVal *= (1 + this.bonuses.getFloatPercentAll(ModType.Attr, SourceType.Constitution)); + intVal *= (1 + this.bonuses.getFloatPercentAll(ModType.Attr, SourceType.Intelligence)); + spiVal *= (1 + this.bonuses.getFloatPercentAll(ModType.Attr, SourceType.Spirit)); } else // apply dex penalty for armor @@ -3774,24 +3774,24 @@ public class PlayerCharacter extends AbstractCharacter { wbOff = off.template; //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 (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 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 - 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 - this.bonuses.setBool(ModType.Parry, SourceType.NONE, false); + this.bonuses.setBool(ModType.Parry, SourceType.None, false); if ((this.baseClass != null && this.baseClass.getObjectUUID() == 2500) || (this.promotionClass != null && this.promotionClass.getObjectUUID() == 2520)) if (wbMain == null || wbMain.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 - h += this.bonuses.getFloat(ModType.HealthFull, SourceType.NONE); - m += this.bonuses.getFloat(ModType.ManaFull, SourceType.NONE); - s += this.bonuses.getFloat(ModType.StaminaFull, SourceType.NONE); + h += this.bonuses.getFloat(ModType.HealthFull, SourceType.None); + m += this.bonuses.getFloat(ModType.ManaFull, SourceType.None); + s += this.bonuses.getFloat(ModType.StaminaFull, SourceType.None); - h *= (1 + this.bonuses.getFloatPercentAll(ModType.HealthFull, SourceType.NONE)); - m *= (1 + this.bonuses.getFloatPercentAll(ModType.ManaFull, SourceType.NONE)); - s *= (1 + this.bonuses.getFloatPercentAll(ModType.StaminaFull, SourceType.NONE)); + h *= (1 + this.bonuses.getFloatPercentAll(ModType.HealthFull, SourceType.None)); + m *= (1 + this.bonuses.getFloatPercentAll(ModType.ManaFull, 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); // must be allowed to use this passive - if (!this.bonuses.getBool(modType, SourceType.NONE)) + if (!this.bonuses.getBool(modType, SourceType.None)) return 0f; // must not be stunned - if (this.bonuses.getBool(ModType.Stunned, SourceType.NONE)) + if (this.bonuses.getBool(ModType.Stunned, SourceType.None)) return 0f; // Get base skill amount @@ -3947,7 +3947,7 @@ public class PlayerCharacter extends AbstractCharacter { amount = sk.getModifiedAmount(); // Add bonuses - amount += this.bonuses.getFloat(modType, SourceType.NONE); + amount += this.bonuses.getFloat(modType, SourceType.None); // Add item bonuses and return if (type.equals(ModType.Dodge) && !fromCombat) @@ -4381,7 +4381,7 @@ public class PlayerCharacter extends AbstractCharacter { 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 this.stopMovement(newLoc); return; diff --git a/src/engine/objects/Resists.java b/src/engine/objects/Resists.java index ce1428e4..d2c41869 100644 --- a/src/engine/objects/Resists.java +++ b/src/engine/objects/Resists.java @@ -26,9 +26,9 @@ import java.util.concurrent.ConcurrentHashMap; public class Resists { private static ConcurrentHashMap mobResists = new ConcurrentHashMap<>(MBServerStatics.CHM_INIT_CAP, MBServerStatics.CHM_LOAD, MBServerStatics.CHM_THREAD_LOW); - private ConcurrentHashMap resists = new ConcurrentHashMap<>(MBServerStatics.CHM_INIT_CAP, MBServerStatics.CHM_LOAD, MBServerStatics.CHM_THREAD_LOW); - private ConcurrentHashMap immuneTo = new ConcurrentHashMap<>(MBServerStatics.CHM_INIT_CAP, MBServerStatics.CHM_LOAD, MBServerStatics.CHM_THREAD_LOW); - private SourceType protection; + private ConcurrentHashMap resists = new ConcurrentHashMap<>(MBServerStatics.CHM_INIT_CAP, MBServerStatics.CHM_LOAD, MBServerStatics.CHM_THREAD_LOW); + private ConcurrentHashMap immuneTo = new ConcurrentHashMap<>(MBServerStatics.CHM_INIT_CAP, MBServerStatics.CHM_LOAD, MBServerStatics.CHM_THREAD_LOW); + private Enum.DamageType protection; private int protectionTrains = 0; private boolean immuneToAll; @@ -51,9 +51,9 @@ public class Resists { } 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)); - for (SourceType dt : r.immuneTo.keySet()) + for (Enum.DamageType dt : r.immuneTo.keySet()) this.immuneTo.put(dt, r.immuneTo.get(dt)); this.protection = r.protection; this.protectionTrains = r.protectionTrains; @@ -83,30 +83,30 @@ public class Resists { */ public Resists(ResultSet rs) throws SQLException { this.immuneToAll = false; - this.resists.put(SourceType.SLASHING, rs.getFloat("slash")); - this.resists.put(SourceType.CRUSHING, rs.getFloat("crush")); - this.resists.put(SourceType.PIERCING, rs.getFloat("pierce")); - this.resists.put(SourceType.MAGIC, rs.getFloat("magic")); - this.resists.put(SourceType.BLEEDING, rs.getFloat("bleed")); - this.resists.put(SourceType.POISON, rs.getFloat("poison")); - this.resists.put(SourceType.MENTAL, rs.getFloat("mental")); - this.resists.put(SourceType.HOLY, rs.getFloat("holy")); - this.resists.put(SourceType.UNHOLY, rs.getFloat("unholy")); - this.resists.put(SourceType.LIGHTNING, rs.getFloat("lightning")); - this.resists.put(SourceType.FIRE, rs.getFloat("fire")); - this.resists.put(SourceType.COLD, rs.getFloat("cold")); - this.resists.put(SourceType.HEALING, 0f); + this.resists.put(Enum.DamageType.Slash, rs.getFloat("slash")); + this.resists.put(Enum.DamageType.Crush, rs.getFloat("crush")); + this.resists.put(Enum.DamageType.Pierce, rs.getFloat("pierce")); + this.resists.put(Enum.DamageType.Magic, rs.getFloat("magic")); + this.resists.put(Enum.DamageType.Bleed, rs.getFloat("bleed")); + this.resists.put(Enum.DamageType.Poison, rs.getFloat("poison")); + this.resists.put(Enum.DamageType.Mental, rs.getFloat("mental")); + this.resists.put(Enum.DamageType.Holy, rs.getFloat("holy")); + this.resists.put(Enum.DamageType.Unholy, rs.getFloat("unholy")); + this.resists.put(Enum.DamageType.Lightning, rs.getFloat("lightning")); + this.resists.put(Enum.DamageType.Fire, rs.getFloat("fire")); + this.resists.put(Enum.DamageType.Cold, rs.getFloat("cold")); + this.resists.put(Enum.DamageType.Healing, 0f); } //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))) return damage; PlayerBonuses bonus = target.getBonuses(); //see if there is a fortitude - float damageCap = bonus.getFloatPercentAll(ModType.DamageCap, SourceType.NONE); - if (damageCap == 0f || type == SourceType.HEALING) + float damageCap = bonus.getFloatPercentAll(ModType.DamageCap, SourceType.None); + if (damageCap == 0f || type == Enum.DamageType.Healing) return damage; //is fortitude, Are we under the cap? @@ -126,21 +126,21 @@ public class Resists { if (forts == null || !isValidDamageCapType(forts, type, exclusive)) return damage; - float adjustedDamage = bonus.getFloatPercentAll(ModType.AdjustAboveDmgCap, SourceType.NONE); + float adjustedDamage = bonus.getFloatPercentAll(ModType.AdjustAboveDmgCap, SourceType.None); //Adjust damage down and return new amount float aadc = 1 + adjustedDamage; return capFire * aadc; } //Test if Damagetype is valid for foritude - private static boolean isValidDamageCapType(HashSet forts, SourceType damageType, boolean exclusive) { + private static boolean isValidDamageCapType(HashSet forts, Enum.DamageType damageType, boolean exclusive) { for (SourceType fort : forts) { - SourceType dt = SourceType.valueOf(fort.name().toUpperCase()); + Enum.DamageType dt = Enum.DamageType.valueOf(fort.name()); - if (dt == SourceType.NONE) + if (dt.equals(Enum.DamageType.None)) continue; - if (dt == damageType) { + if (dt.equals(damageType)) { return exclusive; } } @@ -195,19 +195,19 @@ public class Resists { */ public final void setBuildingResists() { this.immuneToAll = false; - this.resists.put(SourceType.SLASHING, 85f); - this.resists.put(SourceType.CRUSHING, 85f); - this.immuneTo.put(SourceType.PIERCING, true); - this.immuneTo.put(SourceType.MAGIC, true); - this.immuneTo.put(SourceType.BLEEDING, true); - this.immuneTo.put(SourceType.POISON, true); - this.immuneTo.put(SourceType.MENTAL, true); - this.immuneTo.put(SourceType.HOLY, true); - this.immuneTo.put(SourceType.UNHOLY, true); - this.immuneTo.put(SourceType.LIGHTNING, true); - this.immuneTo.put(SourceType.FIRE, true); - this.immuneTo.put(SourceType.COLD, true); - this.resists.put(SourceType.SIEGE, 0f); + this.resists.put(Enum.DamageType.Slash, 85f); + this.resists.put(Enum.DamageType.Crush, 85f); + this.resists.put(Enum.DamageType.Siege, 0f); + this.immuneTo.put(Enum.DamageType.Pierce, true); + this.immuneTo.put(Enum.DamageType.Magic, true); + this.immuneTo.put(Enum.DamageType.Bleed, true); + this.immuneTo.put(Enum.DamageType.Poison, true); + this.immuneTo.put(Enum.DamageType.Mental, true); + this.immuneTo.put(Enum.DamageType.Holy, true); + this.immuneTo.put(Enum.DamageType.Unholy, true); + this.immuneTo.put(Enum.DamageType.Lightning, true); + this.immuneTo.put(Enum.DamageType.Fire, true); + this.immuneTo.put(Enum.DamageType.Cold, true); } @@ -216,19 +216,19 @@ public class Resists { */ public final void setMineResists() { this.immuneToAll = false; - this.immuneTo.put(SourceType.SLASHING, true); - this.immuneTo.put(SourceType.CRUSHING, true); - this.immuneTo.put(SourceType.PIERCING, true); - this.immuneTo.put(SourceType.MAGIC, true); - this.immuneTo.put(SourceType.BLEEDING, true); - this.immuneTo.put(SourceType.POISON, true); - this.immuneTo.put(SourceType.MENTAL, true); - this.immuneTo.put(SourceType.HOLY, true); - this.immuneTo.put(SourceType.UNHOLY, true); - this.immuneTo.put(SourceType.LIGHTNING, true); - this.immuneTo.put(SourceType.FIRE, true); - this.immuneTo.put(SourceType.COLD, true); - this.resists.put(SourceType.SIEGE, 0f); + this.immuneTo.put(Enum.DamageType.Slash, true); + this.immuneTo.put(Enum.DamageType.Crush, true); + this.immuneTo.put(Enum.DamageType.Pierce, true); + this.immuneTo.put(Enum.DamageType.Magic, true); + this.immuneTo.put(Enum.DamageType.Bleed, true); + this.immuneTo.put(Enum.DamageType.Poison, true); + this.immuneTo.put(Enum.DamageType.Mental, true); + this.immuneTo.put(Enum.DamageType.Holy, true); + this.immuneTo.put(Enum.DamageType.Unholy, true); + this.immuneTo.put(Enum.DamageType.Lightning, true); + this.immuneTo.put(Enum.DamageType.Fire, true); + this.immuneTo.put(Enum.DamageType.Cold, true); + this.resists.put(Enum.DamageType.Siege, 0f); } /** @@ -236,27 +236,27 @@ public class Resists { */ public final void setGenericResists() { this.immuneToAll = false; - this.resists.put(SourceType.SLASHING, 0f); - this.resists.put(SourceType.CRUSHING, 0f); - this.resists.put(SourceType.PIERCING, 0f); - this.resists.put(SourceType.MAGIC, 0f); - this.resists.put(SourceType.BLEEDING, 0f); - this.resists.put(SourceType.POISON, 0f); - this.resists.put(SourceType.MENTAL, 0f); - this.resists.put(SourceType.HOLY, 0f); - this.resists.put(SourceType.UNHOLY, 0f); - this.resists.put(SourceType.LIGHTNING, 0f); - this.resists.put(SourceType.FIRE, 0f); - this.resists.put(SourceType.COLD, 0f); - this.resists.put(SourceType.HEALING, 0f); - this.immuneTo.put(SourceType.SIEGE, true); + this.resists.put(Enum.DamageType.Slash, 0f); + this.resists.put(Enum.DamageType.Crush, 0f); + this.resists.put(Enum.DamageType.Pierce, 0f); + this.resists.put(Enum.DamageType.Magic, 0f); + this.resists.put(Enum.DamageType.Bleed, 0f); + this.resists.put(Enum.DamageType.Poison, 0f); + this.resists.put(Enum.DamageType.Mental, 0f); + this.resists.put(Enum.DamageType.Holy, 0f); + this.resists.put(Enum.DamageType.Unholy, 0f); + this.resists.put(Enum.DamageType.Lightning, 0f); + this.resists.put(Enum.DamageType.Fire, 0f); + this.resists.put(Enum.DamageType.Cold, 0f); + this.resists.put(Enum.DamageType.Healing, 0f); + this.immuneTo.put(Enum.DamageType.Siege, true); } /** * Get a resist */ - public float getResist(SourceType type, int trains) { + public float getResist(Enum.DamageType type, int trains) { //get resisted amount Float amount = 0f; if (this.resists.containsKey(type)) @@ -278,7 +278,7 @@ public class Resists { /** * get immuneTo */ - public boolean immuneTo(SourceType type) { + public boolean immuneTo(Enum.DamageType type) { if (this.immuneTo.containsKey(type)) return this.immuneTo.get(type); else @@ -293,13 +293,13 @@ public class Resists { } public boolean immuneToAttacks() { - return immuneTo(SourceType.IMMUNETOATTACK); + return immuneTo(Enum.DamageType.Attack); } /** * Set a resist */ - public void setResist(SourceType type, float value) { + public void setResist(Enum.DamageType type, float value) { this.resists.put(type, value); } @@ -322,12 +322,12 @@ public class Resists { * get Damage after resist * 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 damage = handleFortitude(target, type, damage); //calculate armor piercing - float ap = source.getBonuses().getFloatPercentAll(ModType.ArmorPiercing, SourceType.NONE); + float ap = source.getBonuses().getFloatPercentAll(ModType.ArmorPiercing, SourceType.None); float damageAfterResists = damage * (1 - (this.getResist(type, trains) * 0.01f) + ap); //check to see if any damage absorbers should cancel @@ -346,41 +346,41 @@ public class Resists { if (rb != null) { // Handle immunities - if (rb.getBool(ModType.ImmuneTo, SourceType.STUN)) - this.immuneTo.put(SourceType.STUN, true); - if (rb.getBool(ModType.ImmuneTo, SourceType.BLIND)) - this.immuneTo.put(SourceType.BLIND, true); - if (rb.getBool(ModType.ImmuneToAttack, SourceType.NONE)) - this.immuneTo.put(SourceType.IMMUNETOATTACK, true); - if (rb.getBool(ModType.ImmuneToPowers, SourceType.NONE)) - this.immuneTo.put(SourceType.IMMUNETOPOWERS, true); - if (rb.getBool(ModType.ImmuneTo, SourceType.POWERBLOCK)) - this.immuneTo.put(SourceType.POWERBLOCK, true); - if (rb.getBool(ModType.ImmuneTo, SourceType.DEBUFF)) - this.immuneTo.put(SourceType.DEBUFF, true); - if (rb.getBool(ModType.ImmuneTo, SourceType.FEAR)) - this.immuneTo.put(SourceType.FEAR, true); - if (rb.getBool(ModType.ImmuneTo, SourceType.CHARM)) - this.immuneTo.put(SourceType.CHARM, true); - if (rb.getBool(ModType.ImmuneTo, SourceType.ROOT)) - this.immuneTo.put(SourceType.ROOT, true); - if (rb.getBool(ModType.ImmuneTo, SourceType.SNARE)) - this.immuneTo.put(SourceType.SNARE, true); + if (rb.getBool(ModType.ImmuneTo, SourceType.Stun)) + this.immuneTo.put(Enum.DamageType.Stun, true); + if (rb.getBool(ModType.ImmuneTo, SourceType.Blind)) + this.immuneTo.put(Enum.DamageType.Blind, true); + if (rb.getBool(ModType.ImmuneToAttack, SourceType.None)) + this.immuneTo.put(Enum.DamageType.Attack, true); + if (rb.getBool(ModType.ImmuneToPowers, SourceType.None)) + this.immuneTo.put(Enum.DamageType.Powers, true); + if (rb.getBool(ModType.ImmuneTo, SourceType.Powerblock)) + this.immuneTo.put(Enum.DamageType.Powerblock, true); + if (rb.getBool(ModType.ImmuneTo, SourceType.DeBuff)) + this.immuneTo.put(Enum.DamageType.DeBuff, true); + if (rb.getBool(ModType.ImmuneTo, SourceType.Fear)) + this.immuneTo.put(Enum.DamageType.Fear, true); + if (rb.getBool(ModType.ImmuneTo, SourceType.Charm)) + this.immuneTo.put(Enum.DamageType.Charm, true); + if (rb.getBool(ModType.ImmuneTo, SourceType.Root)) + this.immuneTo.put(Enum.DamageType.Root, true); + if (rb.getBool(ModType.ImmuneTo, SourceType.Snare)) + this.immuneTo.put(Enum.DamageType.Snare, true); // Handle resists - slash += rb.getFloat(ModType.Resistance, SourceType.SLASHING); - crush += rb.getFloat(ModType.Resistance, SourceType.CRUSHING); - pierce += rb.getFloat(ModType.Resistance, SourceType.PIERCING); - magic += rb.getFloat(ModType.Resistance, SourceType.MAGIC); - bleed += rb.getFloat(ModType.Resistance, SourceType.BLEEDING); - poison += rb.getFloat(ModType.Resistance, SourceType.POISON); - mental += rb.getFloat(ModType.Resistance, SourceType.MENTAL); - holy += rb.getFloat(ModType.Resistance, SourceType.HOLY); - unholy += rb.getFloat(ModType.Resistance, SourceType.UNHOLY); - lightning += rb.getFloat(ModType.Resistance, SourceType.LIGHTNING); - fire += rb.getFloat(ModType.Resistance, SourceType.FIRE); - cold += rb.getFloat(ModType.Resistance, SourceType.COLD); - healing += rb.getFloat(ModType.Resistance, SourceType.HEALING); // DamageType.Healing.name()); + slash += rb.getFloat(ModType.Resistance, SourceType.Slash); + crush += rb.getFloat(ModType.Resistance, SourceType.Crush); + pierce += rb.getFloat(ModType.Resistance, SourceType.Pierce); + magic += rb.getFloat(ModType.Resistance, SourceType.Magic); + bleed += rb.getFloat(ModType.Resistance, SourceType.Bleed); + poison += rb.getFloat(ModType.Resistance, SourceType.Poison); + mental += rb.getFloat(ModType.Resistance, SourceType.Mental); + holy += rb.getFloat(ModType.Resistance, SourceType.Holy); + unholy += rb.getFloat(ModType.Resistance, SourceType.Unholy); + lightning += rb.getFloat(ModType.Resistance, SourceType.Lightning); + fire += rb.getFloat(ModType.Resistance, SourceType.Fire); + cold += rb.getFloat(ModType.Resistance, SourceType.Cold); + healing += rb.getFloat(ModType.Resistance, SourceType.Healing); // DamageType.Healing.name()); } @@ -404,29 +404,30 @@ public class Resists { } } - this.resists.put(SourceType.SLASHING, slash); - this.resists.put(SourceType.CRUSHING, crush); - this.resists.put(SourceType.PIERCING, pierce); - this.resists.put(SourceType.MAGIC, magic); - this.resists.put(SourceType.BLEEDING, bleed); - this.resists.put(SourceType.POISON, poison); - this.resists.put(SourceType.MENTAL, mental); - this.resists.put(SourceType.HOLY, holy); - this.resists.put(SourceType.UNHOLY, unholy); - this.resists.put(SourceType.LIGHTNING, lightning); - this.resists.put(SourceType.FIRE, fire); - this.resists.put(SourceType.COLD, cold); - this.resists.put(SourceType.HEALING, healing); - this.immuneTo.put(SourceType.SIEGE, true); + this.resists.put(Enum.DamageType.Slash, slash); + this.resists.put(Enum.DamageType.Crush, crush); + this.resists.put(Enum.DamageType.Pierce, pierce); + this.resists.put(Enum.DamageType.Magic, magic); + this.resists.put(Enum.DamageType.Bleed, bleed); + this.resists.put(Enum.DamageType.Poison, poison); + this.resists.put(Enum.DamageType.Mental, mental); + this.resists.put(Enum.DamageType.Holy, holy); + this.resists.put(Enum.DamageType.Unholy, unholy); + this.resists.put(Enum.DamageType.Lightning, lightning); + this.resists.put(Enum.DamageType.Fire, fire); + this.resists.put(Enum.DamageType.Cold, cold); + this.resists.put(Enum.DamageType.Healing, healing); + + this.immuneTo.put(Enum.DamageType.Siege, true); // debug printing of resists // printResists(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)); - for (SourceType dt : immuneTo.keySet()) + for (Enum.DamageType dt : immuneTo.keySet()) ChatManager.chatSystemInfo(pc, " immuneTo." + dt.name() + ": " + immuneTo.get(dt)); ChatManager.chatSystemInfo(pc, " immuneToAll: " + this.immuneToAll); if (protection != null) @@ -439,9 +440,9 @@ public class Resists { String out = pc.getName(); out += "Resists: "; - Iterator it = this.resists.keySet().iterator(); + Iterator it = this.resists.keySet().iterator(); while (it.hasNext()) { - SourceType damType = it.next(); + Enum.DamageType damType = it.next(); String dtName = damType.name(); out += dtName + '=' + this.resists.get(dtName) + ", "; } @@ -449,7 +450,7 @@ public class Resists { out += "ImmuneTo: "; it = this.immuneTo.keySet().iterator(); while (it.hasNext()) { - SourceType damType = it.next(); + Enum.DamageType damType = it.next(); String dtName = damType.name(); out += dtName + '=' + this.resists.get(dtName) + ", "; diff --git a/src/engine/powers/ActionsBase.java b/src/engine/powers/ActionsBase.java index 6e36031f..308d1c6a 100644 --- a/src/engine/powers/ActionsBase.java +++ b/src/engine/powers/ActionsBase.java @@ -254,19 +254,19 @@ public class ActionsBase { //TODO make this more efficient then testing strings if (this.stackType.equals("Stun") && bonus.getBool(ModType.ImmuneTo, SourceType.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 - 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 - 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 - 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; // else if (pb.isHeal() && (bonus.getByte("immuneTo.Heal")) >= trains) // 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; - 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; else return pb.vampDrain() && bonus.getBool(ModType.BlockedPowerType, SourceType.VAMPDRAIN); diff --git a/src/engine/powers/DamageShield.java b/src/engine/powers/DamageShield.java index 8ffd1289..72949da4 100644 --- a/src/engine/powers/DamageShield.java +++ b/src/engine/powers/DamageShield.java @@ -13,18 +13,18 @@ import engine.Enum; public class DamageShield { - private final Enum.SourceType damageType; + private final Enum.DamageType damageType; private final float amount; private final boolean usePercent; - public DamageShield(Enum.SourceType damageType, float amount, boolean usePercent) { + public DamageShield(Enum.DamageType damageType, float amount, boolean usePercent) { super(); this.damageType = damageType; this.amount = amount; this.usePercent = usePercent; } - public Enum.SourceType getDamageType() { + public Enum.DamageType getDamageType() { return this.damageType; } diff --git a/src/engine/powers/EffectsBase.java b/src/engine/powers/EffectsBase.java index 57045b5c..c507131f 100644 --- a/src/engine/powers/EffectsBase.java +++ b/src/engine/powers/EffectsBase.java @@ -313,7 +313,7 @@ public class EffectsBase { } - public boolean containsDamageType(Enum.SourceType dt) { + public boolean containsDamageType(Enum.DamageType dt) { if (!EffectsBase.EffectDamageTypes.containsKey(this.token)) return false; return EffectsBase.EffectDamageTypes.get(this.token).contains(dt); diff --git a/src/engine/powers/effectmodifiers/AmbidexterityEffectModifier.java b/src/engine/powers/effectmodifiers/AmbidexterityEffectModifier.java index 9d07d813..fab03894 100644 --- a/src/engine/powers/effectmodifiers/AmbidexterityEffectModifier.java +++ b/src/engine/powers/effectmodifiers/AmbidexterityEffectModifier.java @@ -32,7 +32,7 @@ public class AmbidexterityEffectModifier extends AbstractEffectModifier { @Override public void applyBonus(AbstractCharacter ac, int trains) { PlayerBonuses bonus = ac.getBonuses(); - bonus.setBool(ModType.Ambidexterity, SourceType.NONE, true); + bonus.setBool(ModType.Ambidexterity, SourceType.None, true); } @Override diff --git a/src/engine/powers/effectmodifiers/BlockedPowerTypeEffectModifier.java b/src/engine/powers/effectmodifiers/BlockedPowerTypeEffectModifier.java index 5781ed4d..f55e903d 100644 --- a/src/engine/powers/effectmodifiers/BlockedPowerTypeEffectModifier.java +++ b/src/engine/powers/effectmodifiers/BlockedPowerTypeEffectModifier.java @@ -40,7 +40,7 @@ public class BlockedPowerTypeEffectModifier extends AbstractEffectModifier { ModType toBlock = ModType.None; switch (this.sourceType) { - case INVISIBLE: + case Invisible: toBlock = ModType.Invisible; break; } diff --git a/src/engine/powers/effectmodifiers/DamageShieldEffectModifier.java b/src/engine/powers/effectmodifiers/DamageShieldEffectModifier.java index 09b6bd50..3de83656 100644 --- a/src/engine/powers/effectmodifiers/DamageShieldEffectModifier.java +++ b/src/engine/powers/effectmodifiers/DamageShieldEffectModifier.java @@ -49,7 +49,7 @@ public class DamageShieldEffectModifier extends AbstractEffectModifier { amount *= (1 + mod); } - Enum.SourceType dt = Enum.SourceType.valueOf(this.type.toUpperCase()); + Enum.DamageType dt = Enum.DamageType.valueOf(this.type); if (dt != null) { diff --git a/src/engine/powers/effectmodifiers/HealthEffectModifier.java b/src/engine/powers/effectmodifiers/HealthEffectModifier.java index 7542ce68..0c82a834 100644 --- a/src/engine/powers/effectmodifiers/HealthEffectModifier.java +++ b/src/engine/powers/effectmodifiers/HealthEffectModifier.java @@ -9,6 +9,7 @@ package engine.powers.effectmodifiers; +import engine.Enum; import engine.Enum.GameObjectType; import engine.Enum.ModType; import engine.Enum.SourceType; @@ -27,13 +28,13 @@ import java.util.concurrent.ThreadLocalRandom; public class HealthEffectModifier extends AbstractEffectModifier { - private SourceType damageType; + private Enum.DamageType damageType; public HealthEffectModifier(ResultSet rs) throws SQLException { super(rs); String damageTypeDB = rs.getString("type"); try { - this.damageType = SourceType.valueOf(damageTypeDB.toUpperCase()); + this.damageType = Enum.DamageType.valueOf(damageTypeDB); } catch (IllegalArgumentException e) { Logger.error("DamageType could not be loaded from database. " + "UUID = " + this.UUID + " value received = '" + damageTypeDB.toUpperCase() + '\'', e); @@ -153,7 +154,7 @@ public class HealthEffectModifier extends AbstractEffectModifier { // Apply any power effect modifiers (such as stances) if (bonus != null) - modAmount *= (1 + (bonus.getFloatPercentAll(ModType.PowerDamageModifier, SourceType.NONE))); + modAmount *= (1 + (bonus.getFloatPercentAll(ModType.PowerDamageModifier, SourceType.None))); } if (modAmount == 0f) return; @@ -192,7 +193,7 @@ public class HealthEffectModifier extends AbstractEffectModifier { }*/ PlayerBonuses bonus = ac.getBonuses(); - if (!skipImmune && bonus.getFloat(ModType.BlackMantle, SourceType.HEALING) >= trains) { + if (!skipImmune && bonus.getFloat(ModType.BlackMantle, SourceType.Healing) >= trains) { ModifyHealthMsg mhm = new ModifyHealthMsg(source, ac, 0f, 0f, 0f, powerID, powerName, trains, effectID); mhm.setUnknown03(5); //set target is immune DispatchMessage.sendToAllInRange(ac, mhm); diff --git a/src/engine/powers/effectmodifiers/ManaEffectModifier.java b/src/engine/powers/effectmodifiers/ManaEffectModifier.java index 35fbe03b..7f70c63d 100644 --- a/src/engine/powers/effectmodifiers/ManaEffectModifier.java +++ b/src/engine/powers/effectmodifiers/ManaEffectModifier.java @@ -30,13 +30,13 @@ import java.util.concurrent.ThreadLocalRandom; public class ManaEffectModifier extends AbstractEffectModifier { - private SourceType damageType; + private Enum.DamageType damageType; public ManaEffectModifier(ResultSet rs) throws SQLException { super(rs); String damageTypeDB = rs.getString("type"); try { - this.damageType = SourceType.valueOf(damageTypeDB.toUpperCase()); + this.damageType = Enum.DamageType.valueOf(damageTypeDB); } catch (IllegalArgumentException e) { Logger.error("DamageType could not be loaded from database. " + "UUID = " + this.UUID + " value received = '" + damageTypeDB.toUpperCase() + '\'', e); @@ -114,7 +114,7 @@ public class ManaEffectModifier extends AbstractEffectModifier { // Apply any power effect modifiers (such as stances) if (bonus != null) - modAmount *= (1 + bonus.getFloatPercentAll(ModType.PowerDamageModifier, SourceType.NONE)); + modAmount *= (1 + bonus.getFloatPercentAll(ModType.PowerDamageModifier, SourceType.None)); } if (modAmount == 0f) return; @@ -142,7 +142,7 @@ public class ManaEffectModifier extends AbstractEffectModifier { } } PlayerBonuses bonus = ac.getBonuses(); - if (!skipImmune && bonus.getFloat(ModType.BlackMantle, SourceType.HEALING) >= trains) { + if (!skipImmune && bonus.getFloat(ModType.BlackMantle, SourceType.Healing) >= trains) { ModifyHealthMsg mhm = new ModifyHealthMsg(source, ac, 0f, 0f, 0f, powerID, powerName, trains, effectID); mhm.setUnknown03(5); //set target is immune DispatchMessage.sendToAllInRange(ac, mhm); diff --git a/src/engine/powers/effectmodifiers/NoModEffectModifier.java b/src/engine/powers/effectmodifiers/NoModEffectModifier.java index 481abb09..a09c5600 100644 --- a/src/engine/powers/effectmodifiers/NoModEffectModifier.java +++ b/src/engine/powers/effectmodifiers/NoModEffectModifier.java @@ -33,7 +33,7 @@ public class NoModEffectModifier extends AbstractEffectModifier { bonus.setBool(this.modType, this.sourceType, true); switch (this.sourceType) { - case FLY: + case Fly: if (!ac.getObjectType().equals(GameObjectType.PlayerCharacter)) return; PlayerCharacter flyer = (PlayerCharacter) ac; diff --git a/src/engine/powers/effectmodifiers/StaminaEffectModifier.java b/src/engine/powers/effectmodifiers/StaminaEffectModifier.java index be134489..bc73622e 100644 --- a/src/engine/powers/effectmodifiers/StaminaEffectModifier.java +++ b/src/engine/powers/effectmodifiers/StaminaEffectModifier.java @@ -30,13 +30,13 @@ import java.util.concurrent.ThreadLocalRandom; public class StaminaEffectModifier extends AbstractEffectModifier { - private SourceType damageType; + private Enum.DamageType damageType; public StaminaEffectModifier(ResultSet rs) throws SQLException { super(rs); String damageTypeDB = rs.getString("type"); try { - this.damageType = SourceType.valueOf(damageTypeDB.toUpperCase()); + this.damageType = Enum.DamageType.valueOf(damageTypeDB); } catch (IllegalArgumentException e) { Logger.error("DamageType could not be loaded from database. " + "UUID = " + this.UUID + " value received = '" + damageTypeDB.toUpperCase() + '\'', e); @@ -112,7 +112,7 @@ public class StaminaEffectModifier extends AbstractEffectModifier { // Apply any power effect modifiers (such as stances) if (bonus != null) - modAmount *= (1 + (bonus.getFloatPercentAll(ModType.PowerDamageModifier, SourceType.NONE))); + modAmount *= (1 + (bonus.getFloatPercentAll(ModType.PowerDamageModifier, SourceType.None))); } if (modAmount == 0f) return; @@ -140,7 +140,7 @@ public class StaminaEffectModifier extends AbstractEffectModifier { } } PlayerBonuses bonus = ac.getBonuses(); - if (!skipImmune && bonus.getFloat(ModType.BlackMantle, SourceType.HEALING) >= trains) { + if (!skipImmune && bonus.getFloat(ModType.BlackMantle, SourceType.Healing) >= trains) { ModifyHealthMsg mhm = new ModifyHealthMsg(source, ac, 0f, 0f, 0f, powerID, powerName, trains, effectID); mhm.setUnknown03(5); //set target is immune DispatchMessage.sendToAllInRange(ac, mhm); diff --git a/src/engine/powers/poweractions/ApplyEffectPowerAction.java b/src/engine/powers/poweractions/ApplyEffectPowerAction.java index b9aa0e94..5ba50b7b 100644 --- a/src/engine/powers/poweractions/ApplyEffectPowerAction.java +++ b/src/engine/powers/poweractions/ApplyEffectPowerAction.java @@ -188,7 +188,7 @@ public class ApplyEffectPowerAction extends AbstractPowerAction { if (bonuses == null) return; - boolean noSilence = bonuses.getBool(ModType.Silenced, SourceType.NONE); + boolean noSilence = bonuses.getBool(ModType.Silenced, SourceType.None); if (noSilence) return; diff --git a/src/engine/powers/poweractions/TransferStatPowerAction.java b/src/engine/powers/poweractions/TransferStatPowerAction.java index ab718ae4..3f78d408 100644 --- a/src/engine/powers/poweractions/TransferStatPowerAction.java +++ b/src/engine/powers/poweractions/TransferStatPowerAction.java @@ -44,7 +44,7 @@ public class TransferStatPowerAction extends AbstractPowerAction { protected float transferEfficiencyRamp; protected boolean transferEfficiencyRampAdd; protected boolean targetToCaster; - protected SourceType damageType; + protected Enum.DamageType damageType; protected EffectsBase effect; public TransferStatPowerAction(ResultSet rs, HashMap effects) throws SQLException { @@ -78,7 +78,7 @@ public class TransferStatPowerAction extends AbstractPowerAction { // Damage type can sometimes be null in the DB. if (damageString.isEmpty() == false) - this.damageType = SourceType.valueOf(damageString.toUpperCase()); + this.damageType = Enum.DamageType.valueOf(damageString); } catch (Exception e) { this.damageType = null; } @@ -210,7 +210,7 @@ public class TransferStatPowerAction extends AbstractPowerAction { // Apply any power effect modifiers (such as stances) PlayerBonuses bonus = source.getBonuses(); if (bonus != null) - damage *= (1 + bonus.getFloatPercentAll(ModType.PowerDamageModifier, SourceType.NONE)); + damage *= (1 + bonus.getFloatPercentAll(ModType.PowerDamageModifier, SourceType.None)); //get amount to transfer fromAmount = damage; @@ -236,7 +236,7 @@ public class TransferStatPowerAction extends AbstractPowerAction { AbstractNetMsg mhmFrom = null; //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); mhm.setUnknown03(5); //set target is immune DispatchMessage.sendToAllInRange(from, mhm);