mob
monsters
zombie
icon='Quxatrox.dmi'
icon_state = "Qux"
Hp = 50
MaxHp = 50
Strength = 7
Defense = 3
ExpGive = 10
Lvl = 1
attacking = 0
var/mob/Player/P
New()
.=..()
spawn(1)
Wander()
proc/Wander()
Deathcheck()
while(src)
if(attacking==1)
if(P in oview(5))
step_towards(src,P)
Deathcheck()
else
attacking = 0
Wander()
else
step_rand(src)
for(P in view(src))
break
sleep(5)
spawn(40)
Wander()
Bump(mob/Player/C)
if(ismob(C))
var/damage = usr.Strength - usr.ExStr
damage -= C.Defense - C.ExDef
if(damage > 0)
C << "[usr] attacks you and does [damage] damage"
usr << "You attack [P] for [damage] damage"
C.Hp -= damage
else
C << "[usr]'s attack bounces off of you!"
usr << "Your attack bounces off of [src]!"
C.Deathcheck()
mob
proc
Levelup()
if(src.Exp >= src.MaxExp)
src.Lvl += 1
src.MaxHp += 10
src.MaxMp += 10
src.Strength += 2
src.Defense += 1
src.MaxExp *= 2
src << "You gain a level"
src << "Your HP went up 10"
src << "Your MP went up 10"
src << "Your Strength went up 2"
src << "Your Defense went up 1"
src << "You need [MaxExp-Exp] more exp"
else
..()
Deathcheck()
if(src.Hp <= 0)
if(istype(src.client))
src << "You have died, [usr] killed you!"
usr << "You killed [src]"
src.loc = locate(1,1,1)
src.attacking = 0
else
usr.Exp += src.ExpGive
src.attacking = 0
usr << "You have killed [src]!"
del(src)
else
..()
verb
Attack()
if(attacking)
return
attacking = 1
for(var/mob/M in get_step(usr,usr.dir))
var/damage = usr.Strength - usr.ExStr
damage -= M.Defense - M.ExDef
if(damage > 0)
M << "[usr] attacks you and does [damage] damage"
usr << "You attack [M] for [damage] damage"
M.Hp-=damage
else
M << "[usr]'s attack bounces off of you!"
usr << "Your attack bounces off of [src]!"
M.Deathcheck()
usr.Levelup()
Problem description:
It wont attack the monster any one know wy?
~Grand~