Attack(mob/M as mob in oview(1))
if(M.CanAttack==1) //otherwise...
usr << "You attack [M]!"
oview() << "[usr] attacks [M]!"
var/damage = src.attack
view() << "[damage] damage!"
M.health -= damage
M.DeathCheck()
src.LevelCheck()
if(M.newbie==1)
usr << "You cannot attack a Newbie."
if(M.Protect==1)
usr << "This player is under somesort of protection."
if(M.inTown==1)
usr << "Violence will not be tolerated in town"
else //if M's HP are at or below 0...
usr << "You are unable to Attack [M]"
just wrote this up real fast, comments?
I really want to be criticized constructively and want to hear improvements if able.
You have to do the denial first THEN check if they can attack.
And you have to check if the HP is <= 0. And do you mean if M.CanAttack or src.CanAttack?
In stead of keep repeating the same snippet for all attacks, I suggest you make a procedure: