Browse Source

PlayerCombatStats def calculations

lakebane-dex-penalty
FatBoy-DOTC 1 week ago
parent
commit
3358d9e943
  1. 162
      src/engine/objects/PlayerCombatStats.java

162
src/engine/objects/PlayerCombatStats.java

@ -2,6 +2,7 @@ package engine.objects;
import engine.Enum; import engine.Enum;
import engine.powers.effectmodifiers.AbstractEffectModifier; import engine.powers.effectmodifiers.AbstractEffectModifier;
import engine.server.MBServerStatics;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
@ -159,7 +160,7 @@ public class PlayerCombatStats {
this.atrHandOne = 0.0f; this.atrHandOne = 0.0f;
} }
} }
} } //perfect DO NOT TOUCH
public void calculateMin(boolean mainHand) { public void calculateMin(boolean mainHand) {
Item weapon; Item weapon;
@ -386,104 +387,105 @@ public class PlayerCombatStats {
} }
public void calculateDefense() { public void calculateDefense() {
int armorDefense = 0; //Defense = (1+Armor skill / 50) * Armor defense + (1 + Block skill / 100) * Shield defense + (Primary weapon skill / 2)
int shieldDefense = 0; // + (Weapon mastery skill/ 2) + Dexterity * 2 + Flat bonuses from rings or cloth
int dexterity = this.owner.statDexCurrent; float armorSkill = this.owner.skills.get(this.owner.charItemManager.getEquipped(MBServerStatics.SLOT_CHEST)).getTotalSkillPercet();
double armorSkill = 0; float armorDefense = 0.0f;
double blockSkill = 0; for(Item equipped : this.owner.charItemManager.getEquipped().values()){
double weaponSkill = 0; ItemBase ib = equipped.getItemBase();
double weaponMastery = 0; if(ib.isHeavyArmor() || ib.isMediumArmor() || ib.isLightArmor() || ib.isClothArmor()){
armorDefense += ib.getDefense();
//armor defense value need to loop all equipped items and log armor defense values for(Effect eff : equipped.effects.values()){
ArrayList<String> armorTypes = new ArrayList<>(); for(AbstractEffectModifier mod : eff.getEffectModifiers()){
if (this.owner.charItemManager != null) { if(mod.modType.equals(Enum.ModType.DR)){
for (Item equipped : this.owner.charItemManager.getEquippedList()) { armorDefense += mod.minMod + (mod.getRamp() * eff.getTrains());
if (equipped.getItemBase().isHeavyArmor()) { }
armorDefense += equipped.getItemBase().getDefense(); }
if (!armorTypes.contains(equipped.getItemBase().getSkillRequired()))
armorTypes.add(equipped.getItemBase().getSkillRequired());
} else if (equipped.getItemBase().isLightArmor()) {
armorDefense += equipped.getItemBase().getDefense();
if (!armorTypes.contains(equipped.getItemBase().getSkillRequired()))
armorTypes.add(equipped.getItemBase().getSkillRequired());
} else if (equipped.getItemBase().isMediumArmor()) {
armorDefense += equipped.getItemBase().getDefense();
if (!armorTypes.contains(equipped.getItemBase().getSkillRequired()))
armorTypes.add(equipped.getItemBase().getSkillRequired());
} else if (equipped.getItemBase().isClothArmor()) {
armorDefense += equipped.getItemBase().getDefense();
} else if (equipped.getItemBase().isShield()) {
shieldDefense += equipped.getItemBase().getDefense();
} }
} }
} }
//armor skill needs to calculate all trains in armor types float blockSkill = 0.0f;
for (String armorType : armorTypes) { if(this.owner.skills.containsKey("Block"))
if (this.owner.skills != null) { blockSkill = this.owner.skills.get("Block").getTotalSkillPercet();
if (this.owner.skills.containsKey(armorType)) {
armorSkill += this.owner.skills.get(armorType).getModifiedAmount(); float shieldDefense = 0.0f;
if(this.owner.charItemManager.getEquipped(2) != null && this.owner.charItemManager.getEquipped(2).getItemBase().isShield()){
Item shield = this.owner.charItemManager.getEquipped(2);
shieldDefense += shield.getItemBase().getDefense();
for(Effect eff : shield.effects.values()){
for(AbstractEffectModifier mod : eff.getEffectModifiers()){
if(mod.modType.equals(Enum.ModType.DR)){
shieldDefense += mod.minMod + (mod.getRamp() * eff.getTrains());
}
} }
} }
} }
float weaponSkill = 0.0f;
if (this.owner.skills.containsKey("Block")) { float masterySkill = 0.0f;
blockSkill = this.owner.skills.get("Block").getModifiedAmount();
}
String primarySkillName = "Unarmed Combat";
String primaryMasteryName = "Unarmed Combat Mastery";
Item weapon = this.owner.charItemManager.getEquipped(1); Item weapon = this.owner.charItemManager.getEquipped(1);
if (weapon == null) { if(weapon == null){
weapon = this.owner.charItemManager.getEquipped(2); weapon = this.owner.charItemManager.getEquipped(2);
} }
if (weapon != null) { if(weapon != null && !weapon.getItemBase().isShield())
primarySkillName = weapon.getItemBase().getSkillRequired(); weapon = null;
primaryMasteryName = weapon.getItemBase().getMastery();
String skillName = "Unarmed Combat";
String masteryName = "Unarmed Combat Mastery";
if(weapon != null){
skillName = weapon.getItemBase().getSkillRequired();
masteryName = weapon.getItemBase().getMastery();
} }
if(this.owner.skills.containsKey(skillName))
weaponSkill = this.owner.skills.get(skillName).getTotalSkillPercet();
if (this.owner.skills != null) { if(this.owner.skills.containsKey(masteryName))
if (this.owner.skills.containsKey(primarySkillName)) { masterySkill = this.owner.skills.get(masteryName).getTotalSkillPercet();
weaponSkill = this.owner.skills.get(primarySkillName).getModifiedAmount();
} float dexterity = this.owner.statDexBase;
if (this.owner.skills.containsKey(primaryMasteryName)) { dexterity += this.owner.bonuses.getFloat(Enum.ModType.Attr, Enum.SourceType.Dexterity);
weaponMastery = this.owner.skills.get(primaryMasteryName).getModifiedAmount();
} float luckyRune = 1.0f;
for(CharacterRune rune : this.owner.runes){
if(rune.getRuneBase().getName().equals("Lucky"))
luckyRune += 0.05f;
} }
float stanceValue = 0.0f; float flatBonuses = 0.0f;
float bonusValues = 0; float stanceMod = 1.0f;
float percentBonus = 0; for(String effID : this.owner.effects.keySet()) {
if (this.owner.bonuses != null) { if (effID.contains("Stance")) {
for (String effID : this.owner.effects.keySet()) { for (AbstractEffectModifier mod : this.owner.effects.get(effID).getEffectModifiers()) {
if (effID.contains("Stance")) { if (mod.modType.equals(Enum.ModType.OCV)) {
if (this.owner.effects != null) { float percent = mod.getPercentMod();
for (AbstractEffectModifier mod : this.owner.effects.get(effID).getEffectModifiers()) { int trains = this.owner.effects.get(effID).getTrains();
if (mod.modType.equals(Enum.ModType.DCV)) { float modValue = percent + (trains * mod.getRamp());
float percent = mod.getPercentMod(); stanceMod += modValue * 0.01f;
int trains = this.owner.effects.get(effID).getTrains(); }
float modValue = percent + (trains * mod.getRamp()); }
stanceValue += modValue * 0.01f; } else {
} for (AbstractEffectModifier mod : this.owner.effects.get(effID).getEffectModifiers()) {
} if (mod.modType.equals(Enum.ModType.OCV)) {
float value = mod.getMinMod();
int trains = this.owner.effects.get(effID).getTrains();
float modValue = value + (trains * mod.getRamp());
flatBonuses += modValue;
} }
} }
} }
bonusValues = this.owner.bonuses.getFloat(Enum.ModType.DCV, Enum.SourceType.None);
percentBonus = this.owner.bonuses.getFloatPercentAll(Enum.ModType.DCV, Enum.SourceType.None) - stanceValue;
} }
double defense = (1 + armorSkill / 50.0) * armorDefense + float defense = (1 + armorDefense/ 50) * armorDefense;
(1 + blockSkill / 100.0) * shieldDefense + defense += (1 + blockSkill / 100) * shieldDefense;
(weaponSkill / 2.0) + defense += (weaponSkill / 2);
(weaponMastery / 2.0) + defense += (masterySkill / 2);
dexterity * 2.0 + defense += dexterity * 2;
bonusValues; defense *= luckyRune;
defense *= 1.0f + percentBonus + stanceValue; defense += flatBonuses;
//defense *= 1.0f + stanceValue; defense *= stanceMod;
defense = Math.round(defense);
this.defense = (int) defense; this.defense = Math.round(defense);
} }
} }

Loading…
Cancel
Save