int32_t Weapons::getMaxWeaponDamage(int32_t level, int32_t attackSkill, int32_t attackValue, float attackFactor)
{
return (int32_t)std::ceil((2 * attackValue * (attackSkill + 5.8) / 25 + (level - 1) / 10.) / attackFactor);
}
int32_t Player::getDefense() const
{
int32_t baseDefense = 5;
int32_t defenseValue = 0;
int32_t defenseSkill = 0;
int32_t extraDefense = 0;
float defenseFactor = getDefenseFactor();
const Item* weapon = NULL;
const Item* shield = NULL;
getShieldAndWeapon(shield, weapon);
if(weapon)
{
defenseValue = baseDefense + weapon->getDefense();
extraDefense = weapon->getExtraDefense();
defenseSkill = getWeaponSkill(weapon);
}
if(shield && shield->getDefense() >= defenseValue)
{
defenseValue = baseDefense + shield->getDefense() + extraDefense;
defenseSkill = getSkill(SKILL_SHIELD, SKILL_LEVEL);
}
if(vocation->defenseMultipler != 1.0)
defenseValue = int32_t(defenseValue * vocation->defenseMultipler);
return ((int32_t)std::ceil(((float)(defenseSkill * (defenseValue * 0.015)) + (defenseValue * 0.1)) * defenseFactor));
}
There's a seperate armor calculation which might be blocking the last 6-7 points
if(checkArmor)
{
int32_t armorValue = getArmor();
int32_t minArmorReduction = 0;
int32_t maxArmorReduction = 0;
if(armorValue > 1)
{
minArmorReduction = (int32_t)std::ceil(armorValue * 0.475);
maxArmorReduction = (int32_t)std::ceil(((armorValue * 0.475) - 1) + minArmorReduction);
}
else if(armorValue == 1)
{
minArmorReduction = 1;
maxArmorReduction = 1;
}
damage -= random_range(minArmorReduction, maxArmorReduction);
if(damage <= 0)
{
damage = 0;
blockType = BLOCK_ARMOR;
}
}