Attack(mob/M in get_step(usr,dir))
set category = "Combat"
var/num = usr.str
num -= M.def
if(usr.dead == 1)
usr << "<b><font color = green>You cannot attack because you are dead.</b></font>"
else
if(M == usr)
usr << "<font color = green>You cannot attack yourself!</font>"
else
var/random = rand(1,3)
if(random == 1)
flick("Punch Left",usr)
view()<<sound('sfxpunch1.wav')
M.powerlevel -= num
s_damage(M, num)
M.Updatehp()
deathcheck()
if(random == 2)
flick("Punch Right",usr)
view()<<sound('sfxpunch2.wav')
M.powerlevel -= num
s_damage(M, num)
M.Updatehp()
deathcheck()
if(random == 3)
flick("Kick",usr)
view()<<sound('sfxkick1.wav')
M.powerlevel -= num
s_damage(M, num)
M.Updatehp()
deathcheck()
Problem description:
Heres a simple melee code I made that uses strength and defense var's.
It works perfect and everything but the only problem is that if the persons defense is higher then the others strength,you'll end up doing negative damage.
So my question is,how would I make it so if your doing negative damage,it'll round off to 1?
I'd much rather be doing 1 dmg at least then -573 lol :P
[Edit]
...err, for this is should be max(), but you already have that sorted out.