I have read thru eventExecuteAttack to eventMeleeRound to eventMeleeAttack to CanMelee. CanMelee (a misnomer if ever there was one) determines how tohit is resolved for the player and the npc.
CanMelee is broken into 2 pieces by an if-else statement.
if(!this_object()->GetMelee()) { ...
then tohit is calculated one way.
else {} tohit is calculated a different way.
Surprisingly this function is pretty simple to read. My difficulty is that GetMelee is simply defined as
int GetMelee() return melee;
in /lib/body.c L1759.
There is also a SetMelee which is defined as
int SetMelee(int i) { melee = i; return melee; }
The weird part is that nowhere can I find where SetMelee is set for the player. So if melee is not ever set, what does GetMelee resolve to? null? 0? It is not clear to me.
Then one logic step further, what on earth does !this_object()->GetMelee mean if melee is not set/initialized?
Detah@Arcania