This returns your to_hit value:
- Code:
int melee_attack::calc_your_to_hit_unarmed(int uattack)
{
int your_to_hit;
your_to_hit = 1300
+ you.dex() * 75
+ you.skill(SK_FIGHTING, 30);
your_to_hit /= 100;
your_to_hit -= 5 * you.inaccuracy();
if (you.get_mutation_level(MUT_EYEBALLS))
your_to_hit += 2 * you.get_mutation_level(MUT_EYEBALLS) + 1;
if (you.species != SP_VAMPIRE && you.hunger_state <= HS_STARVING)
your_to_hit -= 3;
your_to_hit += slaying_bonus();
return your_to_hit;
}
So for your_to_hit, there's a base value of 13 and each point of dex gives +0.75 and fighting skill gives +fighting*0.3. This is modifed by inaccuracy, eyeball mutation and being a starving non-vampire. Slaying bonus is added.
This value is given to random2 function and if the result if greater than or equal to monster evasion value, or you pass a one_chance_in_30 test, you score a hit.
Being under Elyvilon penance can block your attack.
I hope someone will correct all mistakes I may have done in interpreting this :) At least I hope I looked at the right piece of code...