there's easy formular, think easy :D
accurate = A.dex * 0.1;
evasion = B.dex * 0.05 - totalWeight(items)*0.5;
chance = ((accurate - evasion)/accurate)*100;
if(chance < 0)
return miss;
else if(random(100) > chance)
return miss;
else
return hit;