ID:155368
 
Ok my issue is this the players in my game will have to rely on robes armor and garments for their defense I have that much in what i am having a issue with is this with my garment equiped I am being delt more damage then i get when its off can someone tell me where I I am going wrong

the first is my AI Attack

proc
Attack(mob/monster/T)
for(var/mob/M in get_step(T,T.dir))//Checks for mobs infront of T
var/damage=round(M.def/2) // calculates the damage
if(M.def <= 0)
damage = 1
M.health-=damage


view(6)<<"[T] attacks [M] for [damage] damage!"//Shows everyone how much the enemy attacked M for
M:LevelUp()
M:DeathCheck()

The second is my garment
obj
var
eq=0
obj
robe
name = "Shinobi Robe"
icon = 'Clothing.dmi'
verb
Equip()
if(src.worn)
eq=0
src.worn = 0
usr.overlays -= src.icon
usr.overlays += usr.hair
usr.def = 0
else
eq=1
src.worn = 1
usr.overlays += src.icon
usr.overlays -= usr.hair
usr.def += 100
Drop()
if(src:worn == 1)
usr << "Not while its being worn."
if(src:worn == 0)
src.loc=locate(usr.x,usr.y-1,usr.z)
Get()
set src in oview(1)
src.loc = usr
usr<<"You picked up a [src]"

Any help with this would be great
The reason why you get more damage when you have equipment on is because when they have it on they have 100 and so the damage is calculated as 100 / 2 = 50 where as if u dont have anything on then u have a defence of 0 which means u get attacked by 1
var/damage=round(M.def/2) // calculates the damage
if(M.def <= 0)
damage = 1
M.health-=damage

its that section thats causing u ur problem
In response to AbdulH
ahh ok ill fix that this afternoon