From 47f6946794c7923be12255f6e283be05f1ef75cc Mon Sep 17 00:00:00 2001 From: Anewbe Date: Mon, 2 Jan 2017 20:26:37 -0600 Subject: [PATCH] Hands should now be affected by the flash accuracy penalties --- code/game/objects/items.dm | 8 +++++ .../living/carbon/human/human_attackhand.dm | 12 +++++++ .../mob/living/carbon/human/human_defense.dm | 21 ++++++----- html/changelogs/Anewbe - Fisticuffs.yml | 36 +++++++++++++++++++ 4 files changed, 69 insertions(+), 8 deletions(-) create mode 100644 html/changelogs/Anewbe - Fisticuffs.yml diff --git a/code/game/objects/items.dm b/code/game/objects/items.dm index 4565dbc25f..40e05b695c 100644 --- a/code/game/objects/items.dm +++ b/code/game/objects/items.dm @@ -449,6 +449,7 @@ var/list/global/slot_flags_enumeration = list( /obj/item/proc/eyestab(mob/living/carbon/M as mob, mob/living/carbon/user as mob) var/mob/living/carbon/human/H = M + var/mob/living/carbon/human/U = user if(istype(H)) for(var/obj/item/protection in list(H.head, H.wear_mask, H.glasses)) if(protection && (protection.body_parts_covered & EYES)) @@ -460,6 +461,13 @@ var/list/global/slot_flags_enumeration = list( user << "You cannot locate any eyes on [M]!" return + var/hit_zone = get_zone_with_miss_chance(U.zone_sel.selecting, M, U.get_accuracy_penalty(U)) + if(!hit_zone) + U.do_attack_animation(M) + playsound(loc, 'sound/weapons/punchmiss.ogg', 25, 1, -1) + visible_message("\red [U] attempts to stab [M] in the eyes, but misses!") + return + user.attack_log += "\[[time_stamp()]\] Attacked [M.name] ([M.ckey]) with [src.name] (INTENT: [uppertext(user.a_intent)])" M.attack_log += "\[[time_stamp()]\] Attacked by [user.name] ([user.ckey]) with [src.name] (INTENT: [uppertext(user.a_intent)])" msg_admin_attack("[user.name] ([user.ckey]) attacked [M.name] ([M.ckey]) with [src.name] (INTENT: [uppertext(user.a_intent)]) (JMP)") //BS12 EDIT ALG diff --git a/code/modules/mob/living/carbon/human/human_attackhand.dm b/code/modules/mob/living/carbon/human/human_attackhand.dm index 104fdecd11..1c50cf498b 100644 --- a/code/modules/mob/living/carbon/human/human_attackhand.dm +++ b/code/modules/mob/living/carbon/human/human_attackhand.dm @@ -22,6 +22,13 @@ // Should this all be in Touch()? if(istype(H)) + var/hit_zone = get_zone_with_miss_chance(H.zone_sel.selecting, src, get_accuracy_penalty(H)) + if(!hit_zone) + H.do_attack_animation(src) + playsound(loc, 'sound/weapons/punchmiss.ogg', 25, 1, -1) + visible_message("\red [H] attempts to punch [src], but misses!") + return 0 + if(H != src && check_shields(0, null, H, H.zone_sel.selecting, H.name)) H.do_attack_animation(src) return 0 @@ -189,6 +196,11 @@ were made for projectiles. TODO: proc for melee combat miss chances depending on organ? */ + + if(!hit_zone) + attack_message = "[H] attempted to strike [src], but missed!" + miss_type = 1 + if(prob(80)) hit_zone = ran_zone(hit_zone) if(prob(15) && hit_zone != BP_TORSO) // Missed! diff --git a/code/modules/mob/living/carbon/human/human_defense.dm b/code/modules/mob/living/carbon/human/human_defense.dm index c529f0cfc5..a6471c4aeb 100644 --- a/code/modules/mob/living/carbon/human/human_defense.dm +++ b/code/modules/mob/living/carbon/human/human_defense.dm @@ -151,13 +151,7 @@ emp_act O.emp_act(severity) ..() -/mob/living/carbon/human/resolve_item_attack(obj/item/I, mob/living/user, var/target_zone) - if(check_neckgrab_attack(I, user, target_zone)) - return null - - if(user == src) // Attacking yourself can't miss - return target_zone - +/mob/living/carbon/human/proc/get_accuracy_penalty(mob/living/user) // Certain statuses make it harder to score a hit. These are the same as gun accuracy, however melee doesn't use multiples of 15. var/accuracy_penalty = 0 if(user.eye_blind) @@ -167,9 +161,20 @@ emp_act if(user.confused) accuracy_penalty += 45 - var/hit_zone = get_zone_with_miss_chance(target_zone, src, accuracy_penalty) + return accuracy_penalty + +/mob/living/carbon/human/resolve_item_attack(obj/item/I, mob/living/user, var/target_zone) + if(check_neckgrab_attack(I, user, target_zone)) + return null + + if(user == src) // Attacking yourself can't miss + return target_zone + + var/hit_zone = get_zone_with_miss_chance(target_zone, src, get_accuracy_penalty(user)) if(!hit_zone) + user.do_attack_animation(src) + playsound(loc, 'sound/weapons/punchmiss.ogg', 25, 1, -1) visible_message("\The [user] misses [src] with \the [I]!") return null diff --git a/html/changelogs/Anewbe - Fisticuffs.yml b/html/changelogs/Anewbe - Fisticuffs.yml new file mode 100644 index 0000000000..07716e3694 --- /dev/null +++ b/html/changelogs/Anewbe - Fisticuffs.yml @@ -0,0 +1,36 @@ +################################ +# Example Changelog File +# +# Note: This file, and files beginning with ".", and files that don't end in ".yml" will not be read. If you change this file, you will look really dumb. +# +# Your changelog will be merged with a master changelog. (New stuff added only, and only on the date entry for the day it was merged.) +# When it is, any changes listed below will disappear. +# +# Valid Prefixes: +# bugfix +# wip (For works in progress) +# tweak +# soundadd +# sounddel +# rscadd (general adding of nice things) +# rscdel (general deleting of nice things) +# imageadd +# imagedel +# maptweak +# spellcheck (typo fixes) +# experiment +################################# + +# Your name. +author: Anewbe + +# Optional: Remove this file after generating master changelog. Useful for PR changelogs that won't get used again. +delete-after: True + +# Any changes you've made. See valid prefix list above. +# INDENT WITH TWO SPACES. NOT TABS. SPACES. +# SCREW THIS UP AND IT WON'T WORK. +# Also, all entries are changed into a single [] after a master changelog generation. Just remove the brackets when you add new entries. +# Please surround your changes in double quotes ("), as certain characters otherwise screws up compiling. The quotes will not show up in the changelog. +changes: + - bugfix: "Flashes should now properly affect accuracy in hand-to-hand." \ No newline at end of file