From 08148c058c33ab1943bf3d31ccf315ef5032e048 Mon Sep 17 00:00:00 2001 From: FatBoy-DOTC Date: Sat, 25 Jan 2025 07:53:54 -0600 Subject: [PATCH] PlayerCombatStats defense formula --- src/engine/objects/PlayerCombatStats.java | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/src/engine/objects/PlayerCombatStats.java b/src/engine/objects/PlayerCombatStats.java index 52e85287..c9ead995 100644 --- a/src/engine/objects/PlayerCombatStats.java +++ b/src/engine/objects/PlayerCombatStats.java @@ -496,8 +496,7 @@ public class PlayerCombatStats { } for(String armorUsed : armorsUsed){ if(this.owner.skills.containsKey(armorUsed)) { - armorSkill += this.owner.skills.get(armorUsed).getSkillPercentFromAttributes(); - armorSkill += this.owner.skills.get(armorUsed).getSkillPercentFromTrains(); + armorSkill += calculateModifiedSkill(armorUsed,this.owner); } } if(armorsUsed.size() > 0) @@ -505,7 +504,7 @@ public class PlayerCombatStats { float blockSkill = 0.0f; if(this.owner.skills.containsKey("Block")) - blockSkill = this.owner.skills.get("Block").getModifiedAmount(); + blockSkill = calculateModifiedSkill("Block",this.owner); float shieldDefense = 0.0f; if(this.owner.charItemManager.getEquipped(2) != null && this.owner.charItemManager.getEquipped(2).getItemBase().isShield()){ @@ -574,6 +573,10 @@ public class PlayerCombatStats { } } } + if(this.owner.charItemManager.getEquipped(2) == null) + blockSkill = 0; + else if(this.owner.charItemManager != null && this.owner.charItemManager.getEquipped(2) != null && !this.owner.charItemManager.getEquipped(2).getItemBase().isShield()) + blockSkill = 0; float defense = (1 + armorSkill/ 50) * armorDefense; defense += (1 + blockSkill / 100) * shieldDefense; @@ -583,8 +586,8 @@ public class PlayerCombatStats { defense *= luckyRune; defense += flatBonuses; defense *= stanceMod; - - this.defense = Math.round(defense); + defense = (int)defense; + this.defense = (int)defense; } public static float calculateModifiedSkill(String skillName, PlayerCharacter pc) { @@ -661,7 +664,7 @@ public class PlayerCombatStats { modAmount *= (1 + pc.getBonuses().getFloatPercentAll(Enum.ModType.Skill, sourceType)); } - float modifiedAmount = (int) (modAmount); + float modifiedAmount = Math.round(modAmount); return modifiedAmount; }