Hit Chance

--%

Small differences may be noticed from in-game Combat Analysis results because Combat Analysis considers damage rolls reduced to 0 by melee block to be a "miss", meanwhile this utility simplifies of the calculation to exclude melee damage block.
var diff_def_acc = Math.max(Math.ceil(defense - accuracy), 0);
var max_dmg = Math.ceil(strength / 5);

if (diff_def_acc === 0) {
    hit_chance = 1;
} else {
    if ( (diff_def_acc - 1) / max_dmg > 1) {
        hit_chance = (max_dmg + 2) / (2 * diff_def_acc);
    } else {
        hit_chance = 1 - ( (diff_def_acc * diff_def_acc - 2 * diff_def_acc + 1) / (2 * diff_def_acc * max_dmg) );
    }
}