mob
verb
Punch() //the verb name
if(usr.attacking == 0)
for(var/mob/M in get_step(usr,usr.dir))
flick("Attack",usr)
M.killlist += src.name
switch(rand(1,10))
if(1)
var/damage = usr.ad
M.hp -= damage
usr<<output("You attack [M] for [damage] damage!","Game")
F_damage(M, damage, "#ff0000")
DeathCheck(M)
if(2)
var/damage = round(usr.ad+rand(5,10))
M.hp -= damage
usr<<output("You attack [M] for [damage] damage!","Game")
F_damage(M, damage, "#ff0000")
DeathCheck(M)
if(3)
var/damage = round(usr.ad+rand(5,10))
M.hp -= damage
usr<<output("You attack [M] for [damage] damage!","Game")
F_damage(M, damage, "#ff0000")
DeathCheck(M)
if(4)
var/damage = 1000
M.hp -= damage
usr<<output("<font color=red>You attack [M] for [damage] damage!","Game")
F_damage(M, damage, "#ff0000")
DeathCheck(M)
if(5)
var/damage = round(usr.ad+rand(5,10))
M.hp -= damage
usr<<output("You attack [M] for [damage] damage!","Game")
F_damage(M, damage, "#ff0000")
DeathCheck(M)
if(6)
usr<<output("You attempt to attack [M] but he dodged","Game")
if(7)
var/damage = round(usr.ad+rand(5,10))
M.hp -= damage
usr<<output("You attack [M] for [damage] damage!","Game")
F_damage(M, damage, "#ff0000")
DeathCheck(M)
if(8)
var/damage = round(usr.ad+rand(5,10))
M.hp -= damage
usr<<output("You attack [M] for [damage] damage!","Game")
F_damage(M, damage, "#ff0000")
DeathCheck(M)
if(9)
var/damage = round(usr.ad+rand(5,10))
M.hp -= damage
usr<<output("You attack [M] for [damage] damage!","Game")
F_damage(M, damage, "#ff0000")
DeathCheck(M)
if(10)
var/damage = round(usr.ad+rand(5,10))
M.hp -= damage
usr<<output("You attack [M] for [damage] damage!","Game")
F_damage(M, damage, "#ff0000")
DeathCheck(M)
usr.attacking = 1
sleep(5)
usr.attacking = 0
Problem description:
How to avoid switch(rand)? I want to make that there will be 90% for normal attack 5 % for crit and 5 % for dodge. Ty for help
Have a look at prob() proc in reference for further information.