ID:138809
 
Code:
mob/proc/AIAttack()
if(usr.Attacking) return
usr.Attacking=1
flick("Attack",usr)
for(var/mob/Player/M in get_step(usr,usr.dir))
var/Damage=round((usr.Mana/usr.Str)-(M.Mana/M.Def))
var/CritDmgPct=round(Damage*usr.CritDmg)
M<<"[usr] damaged [M] for [Damage]!"
if(prob(usr.CritRate))
Damage*=CritDmgPct
M<<"[usr] critical damaged [M] for [Damage]!"
spawn(usr.AttkSpd) if(usr)
usr.Attacking=0
M.Death()


This code it's outputing both normal damage and critical damage.. Where's my mistake ? Thank you for future replies.

There is no if else or anything that would stop the message from appearing, you can put it as an else to if(prob()) statement so if your not doing critical then it shows for non-critical only then.
In response to Superbike32
Thanks for both replies. I corrected it in my project, but in:
            if(prob(usr.CritRate))
Damage*=CritDmgPct
M<<"[usr] critical damaged [M] for [Damage]!"


It's outputing 1 thanks to:
var/CritDmgPct=max(1,round(Damage*usr.CritDmg))


And if I do Damage*=2, it will output 2... Any tips, please ? Thank you for future replies.