PlayerCombatStats dex penalty applied correctly
This commit is contained in:
@@ -45,6 +45,21 @@ public class dbItemBaseHandler extends dbHandlerBase {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void LOAD_DEX_REDUCTION(ItemBase itemBase) {
|
||||||
|
|
||||||
|
try (Connection connection = DbManager.getConnection();
|
||||||
|
PreparedStatement preparedStatement = connection.prepareStatement("SELECT * FROM `static_item_dexpenalty` WHERE `ID` = ?")) {
|
||||||
|
|
||||||
|
preparedStatement.setInt(1, itemBase.getUUID());
|
||||||
|
ResultSet rs = preparedStatement.executeQuery();
|
||||||
|
|
||||||
|
itemBase.dexReduction = rs.getFloat("item_bulk_factor");
|
||||||
|
|
||||||
|
} catch (SQLException e) {
|
||||||
|
Logger.error(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public void LOAD_ANIMATIONS(ItemBase itemBase) {
|
public void LOAD_ANIMATIONS(ItemBase itemBase) {
|
||||||
|
|
||||||
ArrayList<Integer> tempList = new ArrayList<>();
|
ArrayList<Integer> tempList = new ArrayList<>();
|
||||||
|
|||||||
@@ -76,6 +76,8 @@ public class ItemBase {
|
|||||||
private ArrayList<Integer> animations = new ArrayList<>();
|
private ArrayList<Integer> animations = new ArrayList<>();
|
||||||
private ArrayList<Integer> offHandAnimations = new ArrayList<>();
|
private ArrayList<Integer> offHandAnimations = new ArrayList<>();
|
||||||
|
|
||||||
|
public float dexReduction = 0.0f;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ResultSet Constructor
|
* ResultSet Constructor
|
||||||
*/
|
*/
|
||||||
@@ -151,7 +153,7 @@ public class ItemBase {
|
|||||||
}
|
}
|
||||||
initBakedInStats();
|
initBakedInStats();
|
||||||
initializeHashes();
|
initializeHashes();
|
||||||
|
initDexReduction();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void addToCache(ItemBase itemBase) {
|
public static void addToCache(ItemBase itemBase) {
|
||||||
@@ -319,6 +321,10 @@ public class ItemBase {
|
|||||||
DbManager.ItemBaseQueries.LOAD_BAKEDINSTATS(this);
|
DbManager.ItemBaseQueries.LOAD_BAKEDINSTATS(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void initDexReduction(){
|
||||||
|
DbManager.ItemBaseQueries.LOAD_DEX_REDUCTION(this);
|
||||||
|
}
|
||||||
|
|
||||||
//TODO fix this later. Shouldn't be gotten from item base
|
//TODO fix this later. Shouldn't be gotten from item base
|
||||||
public int getMagicValue() {
|
public int getMagicValue() {
|
||||||
return this.value;
|
return this.value;
|
||||||
|
|||||||
@@ -110,7 +110,7 @@ public class PlayerCombatStats {
|
|||||||
|
|
||||||
String skill = "Unarmed Combat";
|
String skill = "Unarmed Combat";
|
||||||
String mastery = "Unarmed Combat Mastery";
|
String mastery = "Unarmed Combat Mastery";
|
||||||
int primaryStat = this.owner.statDexCurrent;
|
int primaryStat = getDexAfterPenalty(this.owner);
|
||||||
if(weapon != null) {
|
if(weapon != null) {
|
||||||
skill= weapon.getItemBase().getSkillRequired();
|
skill= weapon.getItemBase().getSkillRequired();
|
||||||
mastery = weapon.getItemBase().getMastery();
|
mastery = weapon.getItemBase().getMastery();
|
||||||
@@ -185,8 +185,7 @@ public class PlayerCombatStats {
|
|||||||
atr += 1;
|
atr += 1;
|
||||||
atr = (float) Math.ceil(atr);
|
atr = (float) Math.ceil(atr);
|
||||||
}else {
|
}else {
|
||||||
float dexterity = this.owner.statDexBase;
|
float dexterity = getDexAfterPenalty(this.owner);
|
||||||
dexterity += this.owner.bonuses.getFloat(Enum.ModType.Attr, Enum.SourceType.Dexterity);
|
|
||||||
atr = dexterity / 2;
|
atr = dexterity / 2;
|
||||||
atr += skillLevel * 4;
|
atr += skillLevel * 4;
|
||||||
atr += masteryLevel * 3;
|
atr += masteryLevel * 3;
|
||||||
@@ -215,7 +214,7 @@ public class PlayerCombatStats {
|
|||||||
public void calculateMin(boolean mainHand) {
|
public void calculateMin(boolean mainHand) {
|
||||||
Item weapon;
|
Item weapon;
|
||||||
float baseDMG = 1;
|
float baseDMG = 1;
|
||||||
int primaryStat = this.owner.statDexCurrent;
|
int primaryStat = getDexAfterPenalty(this.owner);
|
||||||
int secondaryStat = this.owner.statStrCurrent;
|
int secondaryStat = this.owner.statStrCurrent;
|
||||||
double weaponSkill = 5;
|
double weaponSkill = 5;
|
||||||
double weaponMastery = 5;
|
double weaponMastery = 5;
|
||||||
@@ -235,7 +234,7 @@ public class PlayerCombatStats {
|
|||||||
mastery = weapon.getItemBase().getMastery();
|
mastery = weapon.getItemBase().getMastery();
|
||||||
if (weapon.getItemBase().isStrBased()) {
|
if (weapon.getItemBase().isStrBased()) {
|
||||||
primaryStat = this.owner.statStrCurrent;
|
primaryStat = this.owner.statStrCurrent;
|
||||||
secondaryStat = this.owner.statDexCurrent;
|
secondaryStat = getDexAfterPenalty(this.owner);
|
||||||
}
|
}
|
||||||
for(Effect eff : weapon.effects.values()){
|
for(Effect eff : weapon.effects.values()){
|
||||||
for(AbstractEffectModifier mod : eff.getEffectModifiers()){
|
for(AbstractEffectModifier mod : eff.getEffectModifiers()){
|
||||||
@@ -292,7 +291,7 @@ public class PlayerCombatStats {
|
|||||||
// + 0.0022*Secondary Stat + 0.028*(Secondary Stat-0.75)^0.5 + 0.0075*(Weapon Skill + Weapon Mastery))
|
// + 0.0022*Secondary Stat + 0.028*(Secondary Stat-0.75)^0.5 + 0.0075*(Weapon Skill + Weapon Mastery))
|
||||||
Item weapon;
|
Item weapon;
|
||||||
double baseDMG = 5;
|
double baseDMG = 5;
|
||||||
int primaryStat = this.owner.statDexCurrent;
|
int primaryStat = getDexAfterPenalty(this.owner);
|
||||||
int secondaryStat = this.owner.statStrCurrent;
|
int secondaryStat = this.owner.statStrCurrent;
|
||||||
double weaponSkill = 5;
|
double weaponSkill = 5;
|
||||||
double weaponMastery = 5;
|
double weaponMastery = 5;
|
||||||
@@ -311,7 +310,7 @@ public class PlayerCombatStats {
|
|||||||
mastery = weapon.getItemBase().getMastery();
|
mastery = weapon.getItemBase().getMastery();
|
||||||
if (weapon.getItemBase().isStrBased()) {
|
if (weapon.getItemBase().isStrBased()) {
|
||||||
primaryStat = this.owner.statStrCurrent;
|
primaryStat = this.owner.statStrCurrent;
|
||||||
secondaryStat = this.owner.statDexCurrent;
|
secondaryStat = getDexAfterPenalty(this.owner);
|
||||||
}
|
}
|
||||||
for(Effect eff : weapon.effects.values()){
|
for(Effect eff : weapon.effects.values()){
|
||||||
for(AbstractEffectModifier mod : eff.getEffectModifiers()){
|
for(AbstractEffectModifier mod : eff.getEffectModifiers()){
|
||||||
@@ -541,7 +540,7 @@ public class PlayerCombatStats {
|
|||||||
if(this.owner.skills.containsKey(masteryName))
|
if(this.owner.skills.containsKey(masteryName))
|
||||||
masterySkill = this.owner.skills.get(masteryName).getModifiedAmount();
|
masterySkill = this.owner.skills.get(masteryName).getModifiedAmount();
|
||||||
|
|
||||||
float dexterity = this.owner.statDexCurrent;//this.owner.statDexBase;
|
float dexterity = getDexAfterPenalty(this.owner);
|
||||||
//dexterity += this.owner.bonuses.getFloat(Enum.ModType.Attr, Enum.SourceType.Dexterity);
|
//dexterity += this.owner.bonuses.getFloat(Enum.ModType.Attr, Enum.SourceType.Dexterity);
|
||||||
|
|
||||||
float luckyRune = 1.0f;
|
float luckyRune = 1.0f;
|
||||||
@@ -616,7 +615,7 @@ public class PlayerCombatStats {
|
|||||||
if (skillBase.getStrMod() > 0)
|
if (skillBase.getStrMod() > 0)
|
||||||
statMod += (float) skillBase.getStrMod() * (float) pc.getStatStrCurrent() / 100f;
|
statMod += (float) skillBase.getStrMod() * (float) pc.getStatStrCurrent() / 100f;
|
||||||
if (skillBase.getDexMod() > 0)
|
if (skillBase.getDexMod() > 0)
|
||||||
statMod += (float) skillBase.getDexMod() * (float) pc.getStatDexCurrent() / 100f;
|
statMod += (float) skillBase.getDexMod() * (float) getDexAfterPenalty(pc) / 100f;
|
||||||
if (skillBase.getConMod() > 0)
|
if (skillBase.getConMod() > 0)
|
||||||
statMod += (float) skillBase.getConMod() * (float) pc.getStatConCurrent() / 100f;
|
statMod += (float) skillBase.getConMod() * (float) pc.getStatConCurrent() / 100f;
|
||||||
if (skillBase.getIntMod() > 0)
|
if (skillBase.getIntMod() > 0)
|
||||||
@@ -668,4 +667,28 @@ public class PlayerCombatStats {
|
|||||||
|
|
||||||
return modifiedAmount;
|
return modifiedAmount;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static int getDexAfterPenalty(PlayerCharacter pc){
|
||||||
|
if(pc.charItemManager == null)
|
||||||
|
return pc.statDexCurrent;
|
||||||
|
|
||||||
|
float dex = pc.statDexBase;
|
||||||
|
if(pc.bonuses != null)
|
||||||
|
dex += pc.bonuses.getFloat(Enum.ModType.Attr, Enum.SourceType.Dexterity);
|
||||||
|
|
||||||
|
float penaltyFactor = 0.0f;
|
||||||
|
for(Item equipped : pc.charItemManager.getEquipped().values()){
|
||||||
|
ItemBase ib = equipped.getItemBase();
|
||||||
|
if(ib.isHeavyArmor() || ib.isLightArmor() || ib.isMediumArmor()){
|
||||||
|
penaltyFactor += (ib.dexReduction);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if(penaltyFactor > 0)
|
||||||
|
penaltyFactor *= 0.01f;
|
||||||
|
|
||||||
|
float totalPenalty = dex * (1 + penaltyFactor);
|
||||||
|
|
||||||
|
return Math.round(dex - totalPenalty);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user