From e48d79c5e3127f08a607d0cb4de0bf4c78b98be8 Mon Sep 17 00:00:00 2001 From: LorenLuke Date: Sun, 9 Jul 2017 11:51:43 -0700 Subject: [PATCH] Adds small delay to simple_animal attack logic, and gives their attacks a miss probability. --- .../mob/living/simple_animal/simple_animal.dm | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/code/modules/mob/living/simple_animal/simple_animal.dm b/code/modules/mob/living/simple_animal/simple_animal.dm index 0e121e1481d..20d1a907a51 100644 --- a/code/modules/mob/living/simple_animal/simple_animal.dm +++ b/code/modules/mob/living/simple_animal/simple_animal.dm @@ -105,6 +105,7 @@ var/friendly = "nuzzles" // What mobs do to people when they aren't really hostile var/attack_sound = null // Sound to play when I attack var/environment_smash = 0 // How much environment damage do I do when I hit stuff? + var/melee_miss_chance = 40 // percent chance to miss a melee attack. //Special attacks var/spattack_prob = 0 // Chance of the mob doing a special attack (0 for never) @@ -1117,9 +1118,18 @@ /mob/living/simple_animal/proc/PunchTarget() if(!Adjacent(target_mob)) return + sleep(rand(8) + 8) if(isliving(target_mob)) var/mob/living/L = target_mob - L.attack_generic(src,rand(melee_damage_lower,melee_damage_upper),attacktext) + + if(prob(melee_miss_chance)) + src.attack_log += text("\[[time_stamp()]\] attacked [L.name] ([L.ckey])") + L.attack_log += text("\[[time_stamp()]\] was attacked by [src.name] ([src.ckey])") + src.visible_message("[src] misses [L]!") + src.do_attack_animation(src) + return L + else + L.attack_generic(src,rand(melee_damage_lower,melee_damage_upper),attacktext) return L if(istype(target_mob,/obj/mecha)) var/obj/mecha/M = target_mob