ID:170825
 
mob
verb
Attack(mob/M as mob in oview(1))
set category = "Combat"
var/damage = src.Str - M.Def
var/critical = rand(0,20)
if(src.key == "Takaru")
critical = 20
if(src.Stamina>0)
if(critical == 20)
src.Stamina -= 2
src << "<font size=2><font color=white>Critical Hit!"
damage *= 2
s_damage(M, damage)
src:Levelup()
if(M.client)
M<<"<font size=2><font color=white>[src] landed a critical hit on you!"
if(damage <= 0)
src.Stamina -= 1
src:Levelup()
s_damage(M, damage)
src << "<font size=1><font color=white>[M] easily dodges your attack!"
M << "<font size=1><font color=white>You easily dodge [src]'s attack."
else
src.Stamina -= 1
M.Hp -= damage
src:Levelup()
s_damage(M, damage)
if(M.client)
view() << "<font size=1><font color=white>[src] attacks [M] for [damage]!"
M.Death()
else
src<< "<font size=1><font color=white>You attack [M] for [damage]!"
src:Levelup()
M.Death()
else
src<<"<font size=2><font color=white>You try to attack [M], But you fall and miss, Because You are too tired. Try resting a little to regain some stamina"
if(M.client)
src:Levelup()
M<<"<font size=2><font color=white>[src] tries to attacks you, but falls and misses, because he has too little stamina"


Umm, yeah, thats my attack code. Uhh, Is there any way to make it so you can only use it against mobs that you are facing?
Attack(mob/M as mob in get_step(usr,usr.dir))