This code seems to be doing the calculations in attack.cpp but for some reason a lvl 1 npc hitting a lvl 1 player only hits about 30% or less, of his swings. I must be missing something?
Code:
else{
//some class combos have odd caps, base our attack skill based off of a warriors 1hslash since
//it scales rather evenly across all levels for warriors, based on the defenders level so things like
//light blues can still hit their target.
uint16 atkSkill = (database.GetSkillCap(WARRIOR, (SkillType)_1H_SLASHING, defender->GetLevel()) + 5);
int skilldiff = defender->GetSkill(DEFENSE) - atkSkill;
bonus = 0;
if(skilldiff > 10){
bonus = -(10 + ((defender->GetSkill(DEFENSE) - atkSkill - 10) * 2 / 5));
}
else if(skilldiff <= 10 && skilldiff > 0){
bonus = -(2 + ((defender->GetSkill(DEFENSE) - atkSkill) / 10));
}
else{
bonus = 1 + ((atkSkill - defender->GetSkill(DEFENSE)) / 25);
}
chancetohit += bonus;
}