From f18cf5c8a67a99a4bde10d96370756cfd0902e76 Mon Sep 17 00:00:00 2001 From: FatBoy-DOTC Date: Thu, 23 Jan 2025 21:36:50 -0600 Subject: [PATCH] PlayerCombatStats modified skills --- src/engine/objects/CharacterSkill.java | 2 +- src/engine/objects/PlayerCombatStats.java | 39 +++++++++++++++++------ 2 files changed, 31 insertions(+), 10 deletions(-) diff --git a/src/engine/objects/CharacterSkill.java b/src/engine/objects/CharacterSkill.java index e4c4362a..7d90ee77 100644 --- a/src/engine/objects/CharacterSkill.java +++ b/src/engine/objects/CharacterSkill.java @@ -68,7 +68,7 @@ public class CharacterSkill extends AbstractGameObject { 165, 166, 166, 167, 167, //185 to 189 168}; //190 - private static final float[] baseSkillValues = { + static final float[] baseSkillValues = { 0.0f, 0.0f, 0.2f, 0.4f, 0.6f, //0 to 4 0.8f, 1.0f, 1.1666666f, 1.3333334f, 1.5f, //5 to 9 1.6666667f, 1.8333334f, 2.0f, 2.2f, 2.4f, //10 to 14 diff --git a/src/engine/objects/PlayerCombatStats.java b/src/engine/objects/PlayerCombatStats.java index b611baeb..e753bdc7 100644 --- a/src/engine/objects/PlayerCombatStats.java +++ b/src/engine/objects/PlayerCombatStats.java @@ -121,9 +121,13 @@ public class PlayerCombatStats { float skillLevel = 0; float masteryLevel = 0; - if(this.owner.skills.containsKey(skill)) + if(this.owner.skills.containsKey(skill)) { skillLevel = this.owner.skills.get(skill).getModifiedAmount(); - + float newCalc = calculateModifiedSkill(skill, this.owner); + if(newCalc != skillLevel){ + int i = 0; + } + } if(this.owner.skills.containsKey(mastery)) masteryLevel = this.owner.skills.get(mastery).getModifiedAmount(); @@ -595,13 +599,30 @@ public class PlayerCombatStats { float spiModPercentage = (spiMod / totalMod); //calculate stat weight float weight = 0; - weight += pc.statStrCurrent * strModPercentage; - weight += pc.statDexCurrent * dexModPercentage; - weight += pc.statConCurrent * conModPercentage; - weight += pc.statIntCurrent * intModPercentage; - weight += pc.statSpiCurrent * spiModPercentage; - - float modifiedSkill = (75 + 3*pc.statIntCurrent + 2 * weight) / 20; + weight += pc.statStrBase * strModPercentage; + weight += pc.statDexBase * dexModPercentage; + weight += pc.statConBase * conModPercentage; + weight += pc.statIntBase * intModPercentage; + weight += pc.statSpiBase * spiModPercentage; + + Enum.SourceType sourceType = Enum.SourceType.GetSourceType(skillBase.getNameNoSpace()); + float base = 7f; + base += CharacterSkill.baseSkillValues[(int) weight]; + float bonus = 0f; + if (CharacterSkill.GetOwner(skill).getBonuses() != null) { + //Get bonuses from runes + bonus = CharacterSkill.GetOwner(skill).getBonuses().getSkillBonus(skillBase.sourceType); + } + if (CharacterSkill.GetOwner(skill).getBonuses() != null) { + //add bonuses from effects/items and runes + base += bonus + CharacterSkill.GetOwner(skill).getBonuses().getFloat(Enum.ModType.Skill, sourceType); + } + float modAmount = skill.getBaseAmount(); + if (CharacterSkill.GetOwner(skill).getBonuses() != null) { + //Multiply any percent bonuses + modAmount *= (1 + CharacterSkill.GetOwner(skill).getBonuses().getFloatPercentAll(Enum.ModType.Skill, sourceType)); + } + float modifiedSkill = modAmount; return modifiedSkill; }