Serious question: how do you write these? You obviously didn't consult the code because the article you've written is both incomplete, and wrong even where it is complete, but I also don't see how you could have gotten this from consulting the
learndb entry.
Currently, to calculate player accuracy for both 0.19 and 0.20:
Start with 15
Add floor(dexterity/2)
Add random2(fighting*100+100)/100
If in wisp, fungus, pig, or non-vampire bat form, add random2(XL*100+100)/100
If
not in one of the above forms, add random2(weaponskill*100+100)/100 (unarmed is a weapon skill)
If unarmed and not in one of the above forms, add 2. Add an additional 2 if you also have claws.
Add the weapon's enchantment.
Add the weapon's base accuracy.
Add all slaying.
Subtract 3 if starving, bloodless, or fainting. Yes, even as a ghoul.
Subtract armour to-hit penalty and shield to-hit penalty. I will trust you to figure these out yourselves as they are pretty simple.
Subtract 5 if under vertigo.
If you have the eyeballs mutation, add 2*[eyeballs level]+1.
Now set the result to random2(result).Now subtract 5 if wearing inaccuracy.
Subtract 5 if missing an eye.
Subtract 5 if confused.
Subtract 6 if you cannot see the target.
Add 2+random2(8) (or 1+1d8) if you can see the target and it is backlit (corona, sticky flame, halo without umbra). Note that a haloed and umbraed monster is not considered backlit, but an umbraed and coronaed/sticky flamed monster is.
Subtract 2+random2(4) (or 1+1d4) if you can see the target and it is in an umbra and you do not have night vision.
If it is a melee attack and you are unarmed with confusing touch active, add random2(dexterity).
If it is a melee attack and you are unarmed and transformed, add random2(unarmed_hit_bonus) (you have these enumerated on the page already).
If it is a ranged attack made with portal projectile, add random2([Portal Projectile spell power when you last cast it]).
If it is a ranged attack and the defender has RMsl or DMsl, set the result to random2(result/[2 if deflect missiles, 1 if repel missiles]).
The result is your "to-hit". If this exceeds the monster's EV, that
does not mean you will hit. See test_hit.
edit: i accidentally confusing touch