(please exuse the shear size, the way i coded it was to put the entire battle system into just the attack verb.)
mob/var/wait[500]
obj/hud
Attack
layer = MOB_LAYER+21
name = "Attack"
icon = 'Tiles.dmi'
icon_state = "attack"
screen_loc = "11,13"
Click()
if(mob/M in oview(1))
var/usrdamg = usr.Str-M.Def
var/usrdamag = usrdamg/M.Agl
var/usrdamage = usrdamag+usr.Spd
var/usrdamageww = usrdamage+usr.weapon
var/usrdonedamage = usrdamageww-M.armor
var/waitime = usr.wait/usr.Spd
if(waitime<=10)
waitime = 10
var/Strloss = usr.Str/15
var/Defloss = M.Def/15
var/Aglloss = M.Agl/15
var/Spdloss = usr.Spd/15
var/Stradd = usr.MaxStr/200
var/Defadd = M.MaxDef/200
var/Agladd = M.MaxAgl/200
var/Spdadd = usr.MaxSpd/200
var/HPadd = M.MaxHP/200
if(M.safe == 1)
alert("They do not have their PVP switched on")
else if(usr.safe == 1)
alert("You cannot attack with your PVP switched off")
else if(usr.attacking == 1)
return
else if(usrdonedamage <= 1)
usr<<"<font color=white>You hit [html_encode(M.char_name)] for <font color=red>1<font color=white> damage"
M<<"<font color=white>[html_encode(usr.char_name)] hits you for <font color=red>1<font color=white> damage"
M.HP -= 1
else
M.HP -= usrdonedamage
usr.Str -= Strloss
if(usr.Str<=1)
usr.Str = 1
usr.MaxStr += Stradd
M.Def -= Defloss
if(M.Def<=1)
M.Def = 1
M.MaxDef += Defadd
M.Agl -= Aglloss
if(M.Agl<=1)
M.Agl = 1
M.MaxAgl += Agladd
usr.Spd -= Spdloss
if(usr.Spd<=1)
usr.Spd = 1
usr.MaxSpd += Spdadd
M.MaxHP += HPadd
M.attacklist += src.name
usr.attacking = 1
usr<<"<font color=maroon>You hit [html_encode(M.char_name)] for <font color=red>[usrdonedamage]<font color=maroon> damage"
M<<"<font color=red>[html_encode(usr.char_name)] hits you for <font color=maroon>[usrdonedamage]<font color=red> damage"
if(M.HP <= 1)
M.sight = 1
if(M.npc!=0)
M.safe=1
switch(input("You have defeated [html_encode(M.char_name)], what would you like to do now?","He Is Defeated", text) in list ("Take his money","Kill him","Show him mercy"))
if("Kill him")
Death(M)
world<<"<font color=maroon>Player Info: <font color=red>[M.char_name] has been slaughtered by [usr.char_name]."
if("Take his money")
usr.yen+=M.yen
M.yen = 0
world<<"<font color=maroon>Player Info: <font color=red>[M.char_name] has been mugged by [usr.char_name]."
sleep(30)
M.HP=5
M.sight = 0
else
world<<"<font color=maroon>Player Info: <font color=red>[usr.char_name] has shown mercy to [M.char_name]."
sleep(30)
M.HP=5
M.sight = 0
sleep("[waitime]")
usr.attacking = 0
I have realy been messing up and writing some sloppy code lately......Whats going on?......Must be the lack of sleep.