mob
Click()
for(var/mob/M in oview(1))
if(M==usr)
return
if(M.fighting==1)
usr << "Someone else is fighting them!"
return
if(usr.fighting==1)
usr << "You are fighting someone else!"
return
if(M.fighting==0)
M.fighting = 1
if(usr.weapon == null)
usr.punchfight(M)
if(usr.weapon == "sword")
usr.swordfight(M)
mob
proc
punchfight(mob/M)
fightstart
flick("punch",usr)
sleep(1)
var/damage = usr.attack-M.defense+usr.accuracy/2
if(damage <= 0)
damage = 0
usr << "You hit [M] for [damage] damage!"
M << "[usr] hit you for [damage] damage!"
M.health -= damage
if(M.health <= 0)
M.death(usr)
return
sleep(5)
if(M.weapon == null)
flick("punch",M)
sleep(1)
var/damage2 = M.attack-usr.defense+M.accuracy/2
if(damage2 <= 0)
damage2 = 0
M << "You hit [M] for [damage2] damage!"
usr << "[M] hit you for [damage2] damage!"
usr.health -= damage2
if(usr.health <= 0)
usr.death(M)
return
sleep(5)
goto fightstart
if(M.weapon == "sword")
flick("punch",M)
sleep(1)
var/damage3 = M.attack+1-usr.defense+M.accuracy
if(damage3 <= 0)
damage3 = 0
M << "You hit [M] for [damage3] damage!"
usr << "[M] hit you for [damage3] damage!"
usr.health -= damage3
if(usr.health <= 0)
usr.death(M)
return
sleep(5)
goto fightstart
swordfight(mob/M)
fightstart
flick("slash",usr)
sleep(1)
var/damage = usr.attack+1-M.defense+usr.accuracy
if(damage <= 0)
damage = 0
usr << "You hit [M] for [damage] damage!"
M << "[usr] hit you for [damage] damage!"
M.health -= damage
if(M.health <= 0)
M.death(usr)
return
sleep(5)
if(M.weapon == null)
flick("punch",M)
sleep(1)
var/damage2 = M.attack-usr.defense+M.accuracy/2
if(damage2 <= 0)
damage2 = 0
M << "You hit [M] for [damage2] damage!"
usr << "[usr] hit you for [damage2] damage!"
usr.health -= damage2
if(usr.health <= 0)
usr.death(M)
return
sleep(5)
goto fightstart
if(M.weapon == "sword")
flick("punch",M)
sleep(1)
var/damage3 = M.attack+1-usr.defense+M.accuracy
if(damage3 <= 0)
damage3 = 0
M << "You hit [M] for [damage3] damage!"
usr << "[usr] hit you for [damage3] damage!"
usr.health -= damage3
if(usr.health <= 0)
usr.death(M)
return
sleep(5)
goto fightstart
death(mob/M)
world << "[usr] was killed by [M]!"
usr << "You died"
M << "You killed [usr]"
usr.health = usr.maxhealth
M.exp += usr.expgain
if(M.exp >= M.maxexp)
M << "You gained a combat level!"
M.level += 1
M.maxexp += 10
M.exp = 0
M.magicexp += usr.maggain
if(M.magicexp >= M.magicmaxexp)
M << "You gained a magic level!"
M.maxmagic += 10
M.magiclvl += 1
M.magicmaxexp += 10
M.magicexp = 0
M.healthexp += usr.hpgain
if(M.healthexp >= M.healthmaxexp)
M << "You gained a health level!"
M.maxhealth += 10
M.healthlvl += 10
M.healthmaxexp += 10
M.healthexp = 0
M.accuracyexp+=usr.accgain
if(M.accuracyexp >= M.accuracymaxexp)
M << "You gained an accuracy level!"
M.accuracy += 1
M.accuracymaxexp += 10
M.accuracyexp = 0
M.defenseexp+=usr.defgain
if(M.defenseexp >= M.defensemaxexp)
M << "You gained a defense level!"
M.defense += 1
M.defensemaxexp += 10
M.defenseexp = 0
M.attackexp+=usr.attgain
if(M.attackexp >= M.attackmaxexp)
M << "You gained an attack level!"
M.attack += 1
M.attackmaxexp += 10
M.attackexp = 0
usr.fighting = 0
M.fighting = 0
return
If anyone could please tell me where I'm wrong on this string of code, I would really appreciate it!