From 4722c9a864bab8f9fb06a024be9310895feccaaa Mon Sep 17 00:00:00 2001 From: Zuhayr Date: Mon, 24 Nov 2014 09:59:46 +1030 Subject: [PATCH 1/6] WIP on refactoring the context-based combat PR --- baystation12.dme | 1 + code/modules/clothing/clothing.dm | 5 + code/modules/clothing/shoes/magboots.dm | 30 ++- code/modules/mob/living/carbon/human/human.dm | 16 -- .../living/carbon/human/human_attackhand.dm | 109 +++------- .../mob/living/carbon/human/human_defines.dm | 2 +- .../mob/living/carbon/human/species.dm | 148 -------------- .../mob/living/carbon/human/unarmed_attack.dm | 193 ++++++++++++++++++ 8 files changed, 261 insertions(+), 243 deletions(-) create mode 100644 code/modules/mob/living/carbon/human/unarmed_attack.dm diff --git a/baystation12.dme b/baystation12.dme index 98342a0dea..dc952412e3 100644 --- a/baystation12.dme +++ b/baystation12.dme @@ -1009,6 +1009,7 @@ #include "code\modules\mob\living\carbon\human\logout.dm" #include "code\modules\mob\living\carbon\human\say.dm" #include "code\modules\mob\living\carbon\human\species.dm" +#include "code\modules\mob\living\carbon\human\unarmed_attack.dm" #include "code\modules\mob\living\carbon\human\update_icons.dm" #include "code\modules\mob\living\carbon\human\whisper.dm" #include "code\modules\mob\living\carbon\human\alien\alien.dm" diff --git a/code/modules/clothing/clothing.dm b/code/modules/clothing/clothing.dm index dc242cd23f..c225304684 100644 --- a/code/modules/clothing/clothing.dm +++ b/code/modules/clothing/clothing.dm @@ -547,3 +547,8 @@ BLIND // can't see anything hastie.emp_act(severity) ..() +/obj/item/clothing/shoes/proc/can_stomp() + return 0 + +/obj/item/clothing/shoes/proc/handle_stomp() + return 0 \ No newline at end of file diff --git a/code/modules/clothing/shoes/magboots.dm b/code/modules/clothing/shoes/magboots.dm index 7a1016efa9..b8d2ae9531 100644 --- a/code/modules/clothing/shoes/magboots.dm +++ b/code/modules/clothing/shoes/magboots.dm @@ -22,10 +22,36 @@ icon_state = "magboots1" user << "You enable the mag-pulse traction system." user.update_inv_shoes() //so our mob-overlays update - + examine(mob/user) ..(user) var/state = "disabled" if(src.flags&NOSLIP) state = "enabled" - user << "Its mag-pulse traction system appears to be [state]." \ No newline at end of file + user << "Its mag-pulse traction system appears to be [state]." + +/obj/item/clothing/shoes/magboots/can_stomp() + if(!magpulse) + return 0 + +/obj/item/clothing/shoes/magboots/handle_stomp(var/mob/living/carbon/human/target, var/mob/living/carbon/human/user, var/datum/organ/external/affecting) + + if(!(target.lying) || !(user.canmove)) + return 0 + + visible_message("\red [user] raises one of \his magboots over [target]'s [affecting.display_name]...") + + user.attack_move = 1 + + if(do_after(user, 20)) + if(user.canmove && !user.lying && target.Adjacent(user) && target.lying) + visible_message("\red [user] stomps \his magboot down on [target]'s [affecting.display_name] with full force!") + target.apply_damage(rand(20,30), BRUTE, affecting, target.run_armor_check(affecting, "melee")) + playsound(loc, 'sound/weapons/genhit3.ogg', 25, 1, -1) + user.attack_move = 0 + + user.attack_log += text("\[[time_stamp()]\] Magboot-stomped [target.name] ([target.ckey])") + target.attack_log += text("\[[time_stamp()]\] Has been magboot-stomped by [user.name] ([user.ckey])") + msg_admin_attack("[key_name(user)] magboot-stomped [key_name(target)]") + return 1 + return 0 \ No newline at end of file diff --git a/code/modules/mob/living/carbon/human/human.dm b/code/modules/mob/living/carbon/human/human.dm index eca9bec9ce..2774d4c3d8 100644 --- a/code/modules/mob/living/carbon/human/human.dm +++ b/code/modules/mob/living/carbon/human/human.dm @@ -708,22 +708,6 @@ number += 2 return number -/mob/living/carbon/human/proc/magboot_stomp(mob/living/carbon/human/H as mob, datum/organ/external/affecting) - visible_message("\red [src] raises one of \his magboots over [H]'s [affecting.display_name]...") - attack_move = 1 - if(do_after(usr, 20)) - if(src.canmove && !src.lying && src.Adjacent(H) && H.lying) - visible_message("\red [src] stomps \his magboot down on [H]'s [affecting.display_name] with full force!") - apply_damage(rand(20,30), BRUTE, affecting, run_armor_check(affecting, "melee")) - playsound(loc, 'sound/weapons/genhit3.ogg', 25, 1, -1) - attack_move = 0 - - src.attack_log += text("\[[time_stamp()]\] Magboot-stomped [H.name] ([H.ckey])") - H.attack_log += text("\[[time_stamp()]\] Has been magboot-stomped by [src.name] ([src.ckey])") - msg_admin_attack("[key_name(src)] magboot-stomped [key_name(H)]") - return 1 - return 0 - /mob/living/carbon/human/get_combat_buff(var/damage) if(check_special_role("Ninja") || check_special_role("Changeling")) damage += 3 // We assume Ninjas and Changelings are slightly better in combat than the usual human diff --git a/code/modules/mob/living/carbon/human/human_attackhand.dm b/code/modules/mob/living/carbon/human/human_attackhand.dm index 1679430589..1dedd68252 100644 --- a/code/modules/mob/living/carbon/human/human_attackhand.dm +++ b/code/modules/mob/living/carbon/human/human_attackhand.dm @@ -94,121 +94,78 @@ attack_generic(H,rand(1,3),"punched") return + if(attack_move) return 0 + // See if they can attack, and which attacks to use. var/datum/unarmed_attack/attack = H.species.unarmed if(!attack.is_usable(H)) attack = H.species.secondary_unarmed if(!attack.is_usable(H)) return 0 - if(attack_move) return 0 - var/damage = rand(1, 5) + var/damage = rand(1, attack.damage) var/block = 0 var/accurate = 0 - var/target_zone = check_zone(H.zone_sel.selecting) // The zone that was targeted - var/hit_zone = target_zone // The zone that is actually hit + var/hit_zone = H.zone_sel.selecting var/datum/organ/external/affecting = get_organ(hit_zone) - // Check for magboot attack - if(src.lying && H.canmove && !H.lying && H.shoes && istype(H.shoes, /obj/item/clothing/shoes/magboots)) - var/obj/item/clothing/shoes/magboots/mboots = H.shoes - if(mboots.magpulse) - return H.magboot_stomp(src, affecting) + // Check for stomp attack. + if(H.shoes && H.shoes.can_stomp()) + return shoes.handle_stomp(src, H, affecting) switch(src.a_intent) if("help") // We didn't see this coming, so we get the full blow - damage = 5 + damage = attack.damage accurate = 1 if("hurt", "grab") // We're in a fighting stance, there's a chance we block - if(prob(20) && src.canmove && !(src==H)) + if(src.canmove && src!=H && prob(20)) block = 1 if (M.grabbed_by.len) // Someone got a good grip on them, they won't be able to do much damage - damage = max(0, damage - 2) + damage = max(1, damage - 2) if(src.grabbed_by.len || src.buckled || !src.canmove || src==H) accurate = 1 // certain circumstances make it impossible for us to evade punches // Process evasion and blocking + var/miss_type = 0 + var/attack_message if(!accurate) if(prob(80)) - hit_zone = ran_zone(target_zone) + hit_zone = ran_zone(hit_zone) if(prob(15) && hit_zone != "chest") // Missed! - playsound(loc, attack.miss_sound, 25, 1, -1) - var/atk_verb = pick(attack.attack_verb) - visible_message("\red [H] attempted to [atk_verb] [src]!") - visible_message("\red [pick("The [pick(attack.attack_noun)] barely missed their [affecting.display_name]!", "[src] managed to dodge the [pick(attack.attack_noun)] narrowly!")]") + attack_message = "[H] attempted to [pick(attack.attack_verb)] [src], but the [attack.attack_noun] missed!" + miss_type = 1 - H.attack_log += text("\[[time_stamp()]\] attempted to [atk_verb] [src.name] ([src.ckey]) (dodged)") - src.attack_log += text("\[[time_stamp()]\] Dodged attack by [H.name] ([H.ckey])") - msg_admin_attack("[key_name(H)] attempted to [pick(attack.attack_verb)] [key_name(src)] (dodged)") - return 0 - if(block) - playsound(loc, 'sound/weapons/thudswoosh.ogg', 50, 1, -1) - visible_message("\red [H] went for [src]'s [affecting.display_name] but was blocked!") + if(!miss_type && block) + attack_message = "[H] went for [src]'s [affecting.display_name] but was blocked!" + miss_type = 2 - H.attack_log += text("\[[time_stamp()]\] attempted to [pick(attack.attack_verb)] [src.name] ([src.ckey]) (blocked)") - src.attack_log += text("\[[time_stamp()]\] Blocked attack by [H.name] ([H.ckey])") - msg_admin_attack("[key_name(H)] attempted to [pick(attack.attack_verb)] [key_name(src)] (blocked)") + if(!attack_message) + attack.show_attack(H, src, hit_zone, damage) + else + H.visible_message("[attack_message]") + + playsound(loc, ((miss_type) ? (miss_type == 1 ? attack.miss_sound : 'sound/weapons/thudswoosh.ogg') : attack.attack_sound), 25, 1, -1) + H.attack_log += text("\[[time_stamp()]\] [miss_type ? (miss_type == 1 ? "Missed" : "Blocked") : "[pick(attack.attack_verb)]ed"] [src.name] ([src.ckey])") + src.attack_log += text("\[[time_stamp()]\] [miss_type ? (miss_type == 1 ? "Was missed by" : "Has blocked") : "Has Been [pick(attack.attack_verb)]ed"] by [H.name] ([H.ckey])") + msg_admin_attack("[key_name(H)] [miss_type ? (miss_type == 1 ? "has missed" : "was blocked by") : "has [pick(attack.attack_verb)]ed"] [key_name(src)]") + + if(miss_type) return 0 - // Handle the attack logs - attack.combat_log(H, src, hit_zone, damage) - - H.attack_log += text("\[[time_stamp()]\] [pick(attack.attack_verb)]ed [src.name] ([src.ckey])") - src.attack_log += text("\[[time_stamp()]\] Has been [pick(attack.attack_verb)]ed by [H.name] ([H.ckey])") - msg_admin_attack("[key_name(H)] [pick(attack.attack_verb)]ed [key_name(src)]") - // Apply possible buffs damage = H.get_combat_buff(damage) - var/armor_block = run_armor_check(affecting, "melee") // IMPORTANT: To run armor check after attack log as it produces a log itself - var/numb = rand(0, 100) - if(damage >= 5 && armor_block < 2 && !(src == H) && numb <= damage*5) // 25% standard chance - switch(hit_zone) // strong punches can have effects depending on where they hit - if("head") - // Induce blurriness - visible_message("\red [src] stares blankly for a few moments.", "\red You see stars.") - apply_effect(damage*2, EYE_BLUR, armor_block) - if("l_arm", "l_hand") - if (l_hand) - // Disarm left hand - visible_message("\red [src] [pick("dropped", "let go off")] \the [l_hand][pick("", " with a scream")]!") - drop_l_hand() - if("r_arm", "r_hand") - if (r_hand) - // Disarm right hand - visible_message("\red [src] [pick("dropped", "let go off")] \the [r_hand][pick("", " with a scream")]!") - drop_r_hand() - if("chest") - if(!src.lying) - visible_message("\red [pick("[src] was sent flying backward a few metres!", "[src] staggers back from the impact!")]") - step(src, get_dir(get_turf(M), get_turf(src))) - apply_effect(0.4*damage, WEAKEN, armor_block) - if("groin") - visible_message("\red [src] looks like \he is in pain!", (gender=="female")?"\red Oh god that hurt!":"\red Oh no, not your[pick("testicles", "crown jewels", "clockweights", "family jewels", "marbles", "bean bags", "teabags", "sweetmeats", "goolies")]!") - apply_effects(stutter=damage*2, agony=damage*3, blocked=armor_block) - if("l_leg", "l_foot", "r_leg", "r_foot") - if(!src.lying) - visible_message("\red [src] gives way slightly.") - apply_effect(damage*3, AGONY, armor_block) - else if(damage >= 5 && !(src == H) && numb+damage*5 >= 100 && armor_block < 2) // Chance to get the usual throwdown as well (25% standard chance) - if(!src.lying) - visible_message("\red [src] [pick("slumps", "falls", "drops")] down to the ground!") - else - visible_message("\red [src] has been weakened!") - apply_effect(3, WEAKEN, armor_block) - - // Sum up species damage bonus at the very end so xenos don't get buffed stun chances - damage += attack.damage // 3 for human/skrell, 5 for tajaran/unathi - - playsound(H.loc, attack.attack_sound, 25, 1, -1) + var/armour = run_armor_check(affecting, "melee") + // Apply additional unarmed effects. + attack.apply_effects(H,src,armour,damage,hit_zone) // Finally, apply damage to target - apply_damage(damage, BRUTE, affecting, armor_block, sharp=attack.sharp, edge=attack.edge) + apply_damage(damage, BRUTE, affecting, armour, sharp=attack.sharp, edge=attack.edge) if("disarm") M.attack_log += text("\[[time_stamp()]\] Disarmed [src.name] ([src.ckey])") diff --git a/code/modules/mob/living/carbon/human/human_defines.dm b/code/modules/mob/living/carbon/human/human_defines.dm index 72b7d1f1db..8d85c914de 100644 --- a/code/modules/mob/living/carbon/human/human_defines.dm +++ b/code/modules/mob/living/carbon/human/human_defines.dm @@ -45,7 +45,7 @@ //Equipment slots var/obj/item/wear_suit = null var/obj/item/w_uniform = null - var/obj/item/shoes = null + var/obj/item/clothing/shoes/shoes = null //Why aren't we defining all of these as their most commonly used object type? var/obj/item/belt = null var/obj/item/gloves = null var/obj/item/glasses = null diff --git a/code/modules/mob/living/carbon/human/species.dm b/code/modules/mob/living/carbon/human/species.dm index 50ae104da5..c15ef31be7 100644 --- a/code/modules/mob/living/carbon/human/species.dm +++ b/code/modules/mob/living/carbon/human/species.dm @@ -493,154 +493,6 @@ return 0 -//Species unarmed attacks -/datum/unarmed_attack - var/attack_verb = list("attack") // Empty hand hurt intent verb. - var/attack_noun = list("fist") - var/damage = 0 // Extra empty hand attack damage. - var/attack_sound = "punch" - var/miss_sound = 'sound/weapons/punchmiss.ogg' - var/shredding = 0 // Calls the old attack_alien() behavior on objects/mobs when on harm intent. - var/sharp = 0 - var/edge = 0 - -/datum/unarmed_attack/proc/is_usable(var/mob/living/carbon/human/user) - if(user.restrained()) - return 0 - - // Check if they have a functioning hand. - var/datum/organ/external/E = user.organs_by_name["l_hand"] - if(E && !(E.status & ORGAN_DESTROYED)) - return 1 - - E = user.organs_by_name["r_hand"] - if(E && !(E.status & ORGAN_DESTROYED)) - return 1 - - return 0 - -/datum/unarmed_attack/proc/combat_log(mob/living/carbon/human/M as mob, mob/living/carbon/human/T as mob, zone, damage) - var/datum/organ/external/affecting = T.get_organ(zone) - M.visible_message("[M] [pick(attack_verb)] [T] in the [affecting.display_name]!") - playsound(M.loc, attack_sound, 25, 1, -1) - -/datum/unarmed_attack/bite - attack_verb = list("bite") // 'x has biteed y', needs work. - attack_sound = 'sound/weapons/bite.ogg' - shredding = 0 - damage = 3 - sharp = 0 - edge = 0 - -/datum/unarmed_attack/bite/eye_tooth - attack_verb = list("bite") // 'x has biteed y', needs work. - attack_sound = 'sound/weapons/bite.ogg' - shredding = 0 - damage = 5 - sharp = 1 - edge = 1 - -/datum/unarmed_attack/bite/is_usable(var/mob/living/carbon/human/user) - if (user.wear_mask && istype(user.wear_mask, /obj/item/clothing/mask/muzzle)) - return 0 - return 1 - -/datum/unarmed_attack/punch - attack_verb = list("punch") - attack_noun = list("fist") - damage = 3 - -/datum/unarmed_attack/punch/combat_log(mob/living/carbon/human/M as mob, mob/living/carbon/human/T as mob, zone, damage) - var/skill = M.skills["combat"] - var/datum/organ/external/affecting = T.get_organ(zone) - var/organ = affecting.display_name - - if(!skill) skill = 1 - damage = Clamp(damage, 1, 5) - - if(T == M) - M.visible_message("\red [M] [pick(attack_verb)]ed \himself in the [organ]!") - return 0 - if(!T.lying) - switch(zone) - if("head") - // ----- HEAD ----- // - switch(damage) - if(1 to 2) M.visible_message("\red [M] slapped [T] across \his cheek!") - if(3 to 4) M.visible_message("\red [M] struck [T] in the head[pick("", " with a closed fist")]!") - if(5) M.visible_message("\red [M] gave [T] a resounding slap to the face!") - if("chest", "l_arm", "r_arm", "l_hand", "r_hand") - // -- UPPER BODY -- // - switch(damage) - if(1 to 2) M.visible_message("\red [M] slapped [T]'s [organ]!") - if(3 to 4) M.visible_message("\red [M] [findtext(zone, "hand")?"[pick(attack_verb)]ed":pick("[pick(attack_verb)]ed", "shoulders")] [T] in \his [organ]!") - if(5) M.visible_message("\red [M] rammed \his [pick(attack_noun)] into [T]'s [organ]!") - if("groin", "l_leg", "r_leg") - // -- LOWER BODY -- // - switch(damage) - if(1 to 2) M.visible_message("\red [M] gave [T] a light kick to the [organ]!") - if(3 to 4) M.visible_message("\red [M] [pick("kicked", "kneed")] [T] in \his [organ]!") - if(5) M.visible_message("\red [M] landed a strong kick against [T]'s [organ]!") - if("l_foot", "r_foot") - // ----- FEET ----- // - switch(damage) - if(1 to 4) M.visible_message("\red [M] kicked [T] in \his [organ]!") - if(5) M.visible_message("\red [M] stomped down hard on [T]'s [organ]!") - else if (M.loc != T.loc) - M.visible_message("\red [M] [pick("stomped down hard on", "kicked against", "gave a strong kick against", "rams their foot into")] [T]'s [organ]!") - else - M.visible_message("\red [M] [pick("punches", "throws a punch", "strikes", "slaps", "rams their [pick(attack_noun)] into")] [T]'s [organ]!") - - -/datum/unarmed_attack/diona - attack_verb = list("lash", "bludgeon") - attack_noun = list("tendril") - damage = 5 - -/datum/unarmed_attack/claws - attack_verb = list("scratch", "claw", "goug") - attack_noun = list("claws") - attack_sound = 'sound/weapons/slice.ogg' - miss_sound = 'sound/weapons/slashmiss.ogg' - damage = 5 - sharp = 1 - edge = 1 - -/datum/unarmed_attack/claws/combat_log(mob/living/carbon/human/M as mob, mob/living/carbon/human/T as mob, zone, damage) - var/skill = M.skills["combat"] - var/datum/organ/external/affecting = T.get_organ(zone) - var/organ = affecting.display_name - - if(!skill) skill = 1 - damage = Clamp(damage, 1, 5) - - if(T == M) - M.visible_message("\red [M] [pick(attack_verb)]ed \himself in the [organ]!") - return 0 - - switch(zone) - if("head") - // ----- HEAD ----- // - switch(damage) - if(1 to 2) M.visible_message("\red [M] scratched [T] across \his cheek!") - if(3 to 4) M.visible_message("\red [M] [pick(attack_verb)]ed [pick("", "the side of")][T] [pick("head", "neck")][pick("", " with spread [pick(attack_noun)]")]!") - if(5) M.visible_message("\red [M] [pick(attack_verb)]ed [T] across \his face!") - if("chest", "l_arm", "r_arm", "l_hand", "r_hand", "groin", "l_leg", "r_leg", "l_foot", "r_foot") - // ----- BODY ----- // - switch(damage) - if(1 to 2) M.visible_message("\red [M] scratched [T]'s [organ]!") - if(3 to 4) M.visible_message("\red [M] [pick(attack_verb)]ed [pick("", "the side of")][T]'s [organ]!") - if(5) M.visible_message("\red [M] digs \his [pick(attack_noun)] deep into [T]'s [organ]!") - -/datum/unarmed_attack/claws/strong - attack_verb = list("slash") - damage = 10 - shredding = 1 - -/datum/unarmed_attack/bite/strong - attack_verb = list("maul") - damage = 15 - shredding = 1 /datum/hud_data var/icon // If set, overrides ui_style. diff --git a/code/modules/mob/living/carbon/human/unarmed_attack.dm b/code/modules/mob/living/carbon/human/unarmed_attack.dm new file mode 100644 index 0000000000..fad9efc521 --- /dev/null +++ b/code/modules/mob/living/carbon/human/unarmed_attack.dm @@ -0,0 +1,193 @@ +//Species unarmed attacks +/datum/unarmed_attack + var/attack_verb = list("attack") // Empty hand hurt intent verb. + var/attack_noun = list("fist") + var/damage = 0 // Extra empty hand attack damage. + var/attack_sound = "punch" + var/miss_sound = 'sound/weapons/punchmiss.ogg' + var/shredding = 0 // Calls the old attack_alien() behavior on objects/mobs when on harm intent. + var/sharp = 0 + var/edge = 0 + +/datum/unarmed_attack/proc/is_usable(var/mob/living/carbon/human/user) + if(user.restrained()) + return 0 + + // Check if they have a functioning hand. + var/datum/organ/external/E = user.organs_by_name["l_hand"] + if(E && !(E.status & ORGAN_DESTROYED)) + return 1 + + E = user.organs_by_name["r_hand"] + if(E && !(E.status & ORGAN_DESTROYED)) + return 1 + + return 0 + +/datum/unarmed_attack/proc/apply_effects(var/mob/living/carbon/human/user,var/mob/living/carbon/human/target,var/armour,var/attack_damage,var/zone) + + var/stun_chance = rand(0, 100) + + // Reduce effective damage to normalize stun chance across species. + attack_damage = min(1,attack_damage - damage) + + if(attack_damage >= 5 && armour < 2 && !(target == user) && stun_chance <= attack_damage * 5) // 25% standard chance + switch(zone) // strong punches can have effects depending on where they hit + if("head") + // Induce blurriness + target.visible_message("[target] stares blankly for a few moments.", "You see stars.") + target.apply_effect(attack_damage*2, EYE_BLUR, armour) + if("l_arm", "l_hand") + if (target.l_hand) + // Disarm left hand + target.visible_message("[src] [pick("dropped", "let go off")] \the [target.l_hand][pick("", " with a scream")]!") + target.drop_l_hand() + if("r_arm", "r_hand") + if (target.r_hand) + // Disarm right hand + target.visible_message("[src] [pick("dropped", "let go off")] \the [target.r_hand][pick("", " with a scream")]!") + target.drop_r_hand() + if("chest") + if(!target.lying) + target.visible_message("[pick("[target] was sent flying backward a few metres!", "[target] staggers back from the impact!")]") + var/turf/T = step(src, get_dir(get_turf(user), get_turf(target))) + if(T.density) // This will need to be expanded to check for structures etc. + target.visible_message("[target] slams into [T]!") + else + target.loc = T + target.apply_effect(attack_damage * 0.4, WEAKEN, armour) + if("groin") + target.visible_message("[target] looks like \he is in pain!", "[(target.gender=="female") ? "Oh god that hurt!" : "Oh no, not your[pick("testicles", "crown jewels", "clockweights", "family jewels", "marbles", "bean bags", "teabags", "sweetmeats", "goolies")]!"]") + target.apply_effects(stutter = attack_damage * 2, agony = attack_damage* 3, blocked = armour) + if("l_leg", "l_foot", "r_leg", "r_foot") + if(!target.lying) + target.visible_message("[src] gives way slightly.") + target.apply_effect(attack_damage*3, AGONY, armour) + else if(attack_damage >= 5 && !(target == user) && (stun_chance + attack_damage) * 5 >= 100 && armour < 2) // Chance to get the usual throwdown as well (25% standard chance) + if(!target.lying) + target.visible_message("[pick("slumps", "falls", "drops")] down to the ground!") + else + target.visible_message("[target] has been weakened!") + target.apply_effect(3, WEAKEN, armour) + +/datum/unarmed_attack/proc/show_attack(var/mob/living/carbon/human/user, var/mob/living/carbon/human/target, var/zone, var/attack_damage) + var/datum/organ/external/affecting = target.get_organ(zone) + user.visible_message("[user] [pick(attack_verb)] [target] in the [affecting.display_name]!") + playsound(user.loc, attack_sound, 25, 1, -1) + +/datum/unarmed_attack/bite + attack_verb = list("bite") // 'x has biteed y', needs work. + attack_sound = 'sound/weapons/bite.ogg' + shredding = 0 + damage = 3 + sharp = 0 + edge = 0 + +/datum/unarmed_attack/bite/eye_tooth + attack_verb = list("bite") // 'x has biteed y', needs work. + attack_sound = 'sound/weapons/bite.ogg' + shredding = 0 + damage = 5 + sharp = 1 + edge = 1 + +/datum/unarmed_attack/bite/is_usable(var/mob/living/carbon/human/user) + if (user.wear_mask && istype(user.wear_mask, /obj/item/clothing/mask/muzzle)) + return 0 + return 1 + +/datum/unarmed_attack/punch + attack_verb = list("punch") + attack_noun = list("fist") + damage = 3 + +/datum/unarmed_attack/punch/show_attack(var/mob/living/carbon/human/user, var/mob/living/carbon/human/target, var/zone, var/attack_damage) + var/skill = user.skills["combat"] + var/datum/organ/external/affecting = target.get_organ(zone) + var/organ = affecting.display_name + + if(!skill) skill = 1 + + if(target == user) + user.visible_message("\red [user] [pick(attack_verb)]ed \himself in the [organ]!") + return 0 + + if(!target.lying) + switch(zone) + if("head") + // ----- HEAD ----- // + switch(attack_damage) + if(1 to 2) user.visible_message("\red [user] slapped [target] across \his cheek!") + if(3 to 4) user.visible_message("\red [user] struck [target] in the head[pick("", " with a closed fist")]!") + if(5) user.visible_message("\red [user] gave [target] a resounding slap to the face!") + if("chest", "l_arm", "r_arm", "l_hand", "r_hand") + // -- UPPER BODY -- // + switch(attack_damage) + if(1 to 2) user.visible_message("\red [user] slapped [target]'s [organ]!") + if(3 to 4) user.visible_message("\red [user] [findtext(zone, "hand")?"[pick(attack_verb)]ed":pick("[pick(attack_verb)]ed", "shoulders")] [target] in \his [organ]!") + if(5) user.visible_message("\red [user] rammed \his [pick(attack_noun)] into [target]'s [organ]!") + if("groin", "l_leg", "r_leg") + // -- LOWER BODY -- // + switch(attack_damage) + if(1 to 2) user.visible_message("\red [user] gave [target] a light kick to the [organ]!") + if(3 to 4) user.visible_message("\red [user] [pick("kicked", "kneed")] [target] in \his [organ]!") + if(5) user.visible_message("\red [user] landed a strong kick against [target]'s [organ]!") + if("l_foot", "r_foot") + // ----- FEET ----- // + switch(attack_damage) + if(1 to 4) user.visible_message("\red [user] kicked [target] in \his [organ]!") + if(5) user.visible_message("\red [user] stomped down hard on [target]'s [organ]!") + else if (user.loc != target.loc) + user.visible_message("\red [user] [pick("stomped down hard on", "kicked against", "gave a strong kick against", "rams their foot into")] [target]'s [organ]!") + else + user.visible_message("\red [user] [pick("punched", "threw a punch", "struck", "slapped", "rammed their [pick(attack_noun)] into")] [target]'s [organ]!") + + +/datum/unarmed_attack/diona + attack_verb = list("lash", "bludgeon") + attack_noun = list("tendril") + damage = 5 + +/datum/unarmed_attack/claws + attack_verb = list("scratch", "claw", "goug") + attack_noun = list("claws") + attack_sound = 'sound/weapons/slice.ogg' + miss_sound = 'sound/weapons/slashmiss.ogg' + damage = 5 + sharp = 1 + edge = 1 + +/datum/unarmed_attack/claws/show_attack(var/mob/living/carbon/human/user, var/mob/living/carbon/human/target, var/zone, var/attack_damage) + var/skill = user.skills["combat"] + var/datum/organ/external/affecting = target.get_organ(zone) + + if(!skill) skill = 1 + attack_damage = Clamp(attack_damage, 1, 5) + + if(target == user) + user.visible_message("\red [user] [pick(attack_verb)]ed \himself in the [affecting.display_name]!") + return 0 + + switch(zone) + if("head") + // ----- HEAD ----- // + switch(damage) + if(1 to 2) user.visible_message("\red [user] scratched [target] across \his cheek!") + if(3 to 4) user.visible_message("\red [user] [pick(attack_verb)]ed [pick("", "the side of")][target] [pick("head", "neck")][pick("", " with spread [pick(attack_noun)]")]!") + if(5) user.visible_message("\red [user] [pick(attack_verb)]ed [target] across \his face!") + if("chest", "l_arm", "r_arm", "l_hand", "r_hand", "groin", "l_leg", "r_leg", "l_foot", "r_foot") + // ----- BODY ----- // + switch(damage) + if(1 to 2) user.visible_message("\red [user] scratched [target]'s [affecting.display_name]!") + if(3 to 4) user.visible_message("\red [user] [pick(attack_verb)]ed [pick("", "the side of")][target]'s [affecting.display_name]!") + if(5) user.visible_message("\red [user] digs \his [pick(attack_noun)] deep into [target]'s [affecting.display_name]!") + +/datum/unarmed_attack/claws/strong + attack_verb = list("slash") + damage = 10 + shredding = 1 + +/datum/unarmed_attack/bite/strong + attack_verb = list("maul") + damage = 15 + shredding = 1 \ No newline at end of file From 855f75bd3c1f113047a76475ebe46847f423b25b Mon Sep 17 00:00:00 2001 From: Zuhayr Date: Mon, 1 Dec 2014 20:03:08 +1030 Subject: [PATCH 2/6] Removed magboot stomp. --- code/modules/clothing/clothing.dm | 8 +----- code/modules/clothing/shoes/magboots.dm | 28 +------------------ .../living/carbon/human/human_attackhand.dm | 4 --- 3 files changed, 2 insertions(+), 38 deletions(-) diff --git a/code/modules/clothing/clothing.dm b/code/modules/clothing/clothing.dm index 711ed13711..c6487cc9d2 100644 --- a/code/modules/clothing/clothing.dm +++ b/code/modules/clothing/clothing.dm @@ -545,10 +545,4 @@ BLIND // can't see anything /obj/item/clothing/under/emp_act(severity) if (hastie) hastie.emp_act(severity) - ..() - -/obj/item/clothing/shoes/proc/can_stomp() - return 0 - -/obj/item/clothing/shoes/proc/handle_stomp() - return 0 + ..() \ No newline at end of file diff --git a/code/modules/clothing/shoes/magboots.dm b/code/modules/clothing/shoes/magboots.dm index b8d2ae9531..3908d0cf75 100644 --- a/code/modules/clothing/shoes/magboots.dm +++ b/code/modules/clothing/shoes/magboots.dm @@ -28,30 +28,4 @@ var/state = "disabled" if(src.flags&NOSLIP) state = "enabled" - user << "Its mag-pulse traction system appears to be [state]." - -/obj/item/clothing/shoes/magboots/can_stomp() - if(!magpulse) - return 0 - -/obj/item/clothing/shoes/magboots/handle_stomp(var/mob/living/carbon/human/target, var/mob/living/carbon/human/user, var/datum/organ/external/affecting) - - if(!(target.lying) || !(user.canmove)) - return 0 - - visible_message("\red [user] raises one of \his magboots over [target]'s [affecting.display_name]...") - - user.attack_move = 1 - - if(do_after(user, 20)) - if(user.canmove && !user.lying && target.Adjacent(user) && target.lying) - visible_message("\red [user] stomps \his magboot down on [target]'s [affecting.display_name] with full force!") - target.apply_damage(rand(20,30), BRUTE, affecting, target.run_armor_check(affecting, "melee")) - playsound(loc, 'sound/weapons/genhit3.ogg', 25, 1, -1) - user.attack_move = 0 - - user.attack_log += text("\[[time_stamp()]\] Magboot-stomped [target.name] ([target.ckey])") - target.attack_log += text("\[[time_stamp()]\] Has been magboot-stomped by [user.name] ([user.ckey])") - msg_admin_attack("[key_name(user)] magboot-stomped [key_name(target)]") - return 1 - return 0 \ No newline at end of file + user << "Its mag-pulse traction system appears to be [state]." \ No newline at end of file diff --git a/code/modules/mob/living/carbon/human/human_attackhand.dm b/code/modules/mob/living/carbon/human/human_attackhand.dm index 1dedd68252..ad24dff5bc 100644 --- a/code/modules/mob/living/carbon/human/human_attackhand.dm +++ b/code/modules/mob/living/carbon/human/human_attackhand.dm @@ -109,10 +109,6 @@ var/hit_zone = H.zone_sel.selecting var/datum/organ/external/affecting = get_organ(hit_zone) - // Check for stomp attack. - if(H.shoes && H.shoes.can_stomp()) - return shoes.handle_stomp(src, H, affecting) - switch(src.a_intent) if("help") // We didn't see this coming, so we get the full blow From 0ae473b6ea042c5d615a3f6f4f3605ac9cf67bab Mon Sep 17 00:00:00 2001 From: Zuhayr Date: Mon, 1 Dec 2014 20:06:43 +1030 Subject: [PATCH 3/6] Removed antag role buffs. --- code/modules/mob/living/carbon/human/human.dm | 7 ------- code/modules/mob/living/carbon/human/human_attackhand.dm | 4 ++-- code/modules/mob/mob.dm | 3 --- 3 files changed, 2 insertions(+), 12 deletions(-) diff --git a/code/modules/mob/living/carbon/human/human.dm b/code/modules/mob/living/carbon/human/human.dm index 2774d4c3d8..a3143e6b88 100644 --- a/code/modules/mob/living/carbon/human/human.dm +++ b/code/modules/mob/living/carbon/human/human.dm @@ -708,13 +708,6 @@ number += 2 return number -/mob/living/carbon/human/get_combat_buff(var/damage) - if(check_special_role("Ninja") || check_special_role("Changeling")) - damage += 3 // We assume Ninjas and Changelings are slightly better in combat than the usual human - if(HULK in mutations) - damage *= 2 // Hulks do twice the damage - return damage * damage_multiplier - /mob/living/carbon/human/IsAdvancedToolUser(var/silent) if(species.has_fine_manipulation) return 1 diff --git a/code/modules/mob/living/carbon/human/human_attackhand.dm b/code/modules/mob/living/carbon/human/human_attackhand.dm index ad24dff5bc..6055ef3e86 100644 --- a/code/modules/mob/living/carbon/human/human_attackhand.dm +++ b/code/modules/mob/living/carbon/human/human_attackhand.dm @@ -153,8 +153,8 @@ if(miss_type) return 0 - // Apply possible buffs - damage = H.get_combat_buff(damage) + if(HULK in H.mutations) + damage *= 2 // Hulks do twice the damage) var/armour = run_armor_check(affecting, "melee") // Apply additional unarmed effects. diff --git a/code/modules/mob/mob.dm b/code/modules/mob/mob.dm index 7e0c47fe4a..fa70ccbfc5 100644 --- a/code/modules/mob/mob.dm +++ b/code/modules/mob/mob.dm @@ -652,9 +652,6 @@ var/list/slot_equipment_priority = list( \ var/mob/pulled = AM pulled.inertia_dir = 0 -/mob/proc/get_combat_buff(var/damage) - return damage - /mob/proc/can_use_hands() return From d65ead4f7ed58c3120cd9425ac0373c1e952fa56 Mon Sep 17 00:00:00 2001 From: Zuhayr Date: Mon, 1 Dec 2014 20:10:27 +1030 Subject: [PATCH 4/6] Changed \red to span in unarmed_attack.dm. --- .../mob/living/carbon/human/unarmed_attack.dm | 42 +++++++++---------- 1 file changed, 21 insertions(+), 21 deletions(-) diff --git a/code/modules/mob/living/carbon/human/unarmed_attack.dm b/code/modules/mob/living/carbon/human/unarmed_attack.dm index fad9efc521..99c6eedd43 100644 --- a/code/modules/mob/living/carbon/human/unarmed_attack.dm +++ b/code/modules/mob/living/carbon/human/unarmed_attack.dm @@ -109,7 +109,7 @@ if(!skill) skill = 1 if(target == user) - user.visible_message("\red [user] [pick(attack_verb)]ed \himself in the [organ]!") + user.visible_message("[user] [pick(attack_verb)]ed \himself in the [organ]!") return 0 if(!target.lying) @@ -117,30 +117,30 @@ if("head") // ----- HEAD ----- // switch(attack_damage) - if(1 to 2) user.visible_message("\red [user] slapped [target] across \his cheek!") - if(3 to 4) user.visible_message("\red [user] struck [target] in the head[pick("", " with a closed fist")]!") - if(5) user.visible_message("\red [user] gave [target] a resounding slap to the face!") + if(1 to 2) user.visible_message("[user] slapped [target] across \his cheek!") + if(3 to 4) user.visible_message("[user] struck [target] in the head[pick("", " with a closed fist")]!") + if(5) user.visible_message("[user] gave [target] a resounding slap to the face!") if("chest", "l_arm", "r_arm", "l_hand", "r_hand") // -- UPPER BODY -- // switch(attack_damage) - if(1 to 2) user.visible_message("\red [user] slapped [target]'s [organ]!") - if(3 to 4) user.visible_message("\red [user] [findtext(zone, "hand")?"[pick(attack_verb)]ed":pick("[pick(attack_verb)]ed", "shoulders")] [target] in \his [organ]!") - if(5) user.visible_message("\red [user] rammed \his [pick(attack_noun)] into [target]'s [organ]!") + if(1 to 2) user.visible_message("[user] slapped [target]'s [organ]!") + if(3 to 4) user.visible_message("[user] [findtext(zone, "hand")?"[pick(attack_verb)]ed":pick("[pick(attack_verb)]ed", "shoulders")] [target] in \his [organ]!") + if(5) user.visible_message("[user] rammed \his [pick(attack_noun)] into [target]'s [organ]!") if("groin", "l_leg", "r_leg") // -- LOWER BODY -- // switch(attack_damage) - if(1 to 2) user.visible_message("\red [user] gave [target] a light kick to the [organ]!") - if(3 to 4) user.visible_message("\red [user] [pick("kicked", "kneed")] [target] in \his [organ]!") - if(5) user.visible_message("\red [user] landed a strong kick against [target]'s [organ]!") + if(1 to 2) user.visible_message("[user] gave [target] a light kick to the [organ]!") + if(3 to 4) user.visible_message("[user] [pick("kicked", "kneed")] [target] in \his [organ]!") + if(5) user.visible_message("[user] landed a strong kick against [target]'s [organ]!") if("l_foot", "r_foot") // ----- FEET ----- // switch(attack_damage) - if(1 to 4) user.visible_message("\red [user] kicked [target] in \his [organ]!") - if(5) user.visible_message("\red [user] stomped down hard on [target]'s [organ]!") + if(1 to 4) user.visible_message("[user] kicked [target] in \his [organ]!") + if(5) user.visible_message("[user] stomped down hard on [target]'s [organ]!") else if (user.loc != target.loc) - user.visible_message("\red [user] [pick("stomped down hard on", "kicked against", "gave a strong kick against", "rams their foot into")] [target]'s [organ]!") + user.visible_message("[user] [pick("stomped down hard on", "kicked against", "gave a strong kick against", "rams their foot into")] [target]'s [organ]!") else - user.visible_message("\red [user] [pick("punched", "threw a punch", "struck", "slapped", "rammed their [pick(attack_noun)] into")] [target]'s [organ]!") + user.visible_message("[user] [pick("punched", "threw a punch", "struck", "slapped", "rammed their [pick(attack_noun)] into")] [target]'s [organ]!") /datum/unarmed_attack/diona @@ -165,22 +165,22 @@ attack_damage = Clamp(attack_damage, 1, 5) if(target == user) - user.visible_message("\red [user] [pick(attack_verb)]ed \himself in the [affecting.display_name]!") + user.visible_message("[user] [pick(attack_verb)]ed \himself in the [affecting.display_name]!") return 0 switch(zone) if("head") // ----- HEAD ----- // switch(damage) - if(1 to 2) user.visible_message("\red [user] scratched [target] across \his cheek!") - if(3 to 4) user.visible_message("\red [user] [pick(attack_verb)]ed [pick("", "the side of")][target] [pick("head", "neck")][pick("", " with spread [pick(attack_noun)]")]!") - if(5) user.visible_message("\red [user] [pick(attack_verb)]ed [target] across \his face!") + if(1 to 2) user.visible_message("[user] scratched [target] across \his cheek!") + if(3 to 4) user.visible_message("[user] [pick(attack_verb)]ed [pick("", "the side of")][target] [pick("head", "neck")][pick("", " with spread [pick(attack_noun)]")]!") + if(5) user.visible_message("[user] [pick(attack_verb)]ed [target] across \his face!") if("chest", "l_arm", "r_arm", "l_hand", "r_hand", "groin", "l_leg", "r_leg", "l_foot", "r_foot") // ----- BODY ----- // switch(damage) - if(1 to 2) user.visible_message("\red [user] scratched [target]'s [affecting.display_name]!") - if(3 to 4) user.visible_message("\red [user] [pick(attack_verb)]ed [pick("", "the side of")][target]'s [affecting.display_name]!") - if(5) user.visible_message("\red [user] digs \his [pick(attack_noun)] deep into [target]'s [affecting.display_name]!") + if(1 to 2) user.visible_message("[user] scratched [target]'s [affecting.display_name]!") + if(3 to 4) user.visible_message("[user] [pick(attack_verb)]ed [pick("", "the side of")][target]'s [affecting.display_name]!") + if(5) user.visible_message("[user] digs \his [pick(attack_noun)] deep into [target]'s [affecting.display_name]!") /datum/unarmed_attack/claws/strong attack_verb = list("slash") From bee0b9d23db728390f624fdbc10a300a385138f0 Mon Sep 17 00:00:00 2001 From: Zuhayr Date: Mon, 1 Dec 2014 20:20:30 +1030 Subject: [PATCH 5/6] Tweaks after testing. --- code/modules/mob/living/carbon/human/human_attackhand.dm | 2 -- code/modules/mob/living/carbon/human/human_defines.dm | 4 +--- code/modules/mob/living/carbon/human/unarmed_attack.dm | 6 +++--- 3 files changed, 4 insertions(+), 8 deletions(-) diff --git a/code/modules/mob/living/carbon/human/human_attackhand.dm b/code/modules/mob/living/carbon/human/human_attackhand.dm index 6055ef3e86..90efe34a47 100644 --- a/code/modules/mob/living/carbon/human/human_attackhand.dm +++ b/code/modules/mob/living/carbon/human/human_attackhand.dm @@ -94,8 +94,6 @@ attack_generic(H,rand(1,3),"punched") return - if(attack_move) return 0 - // See if they can attack, and which attacks to use. var/datum/unarmed_attack/attack = H.species.unarmed if(!attack.is_usable(H)) diff --git a/code/modules/mob/living/carbon/human/human_defines.dm b/code/modules/mob/living/carbon/human/human_defines.dm index 8d85c914de..41d222865d 100644 --- a/code/modules/mob/living/carbon/human/human_defines.dm +++ b/code/modules/mob/living/carbon/human/human_defines.dm @@ -81,6 +81,4 @@ var/mob/remoteview_target = null var/hand_blood_color - var/list/flavor_texts = list() - - var/attack_move = 0 //Used in combat to check if user is performing an attack over several ticks \ No newline at end of file + var/list/flavor_texts = list() \ No newline at end of file diff --git a/code/modules/mob/living/carbon/human/unarmed_attack.dm b/code/modules/mob/living/carbon/human/unarmed_attack.dm index 99c6eedd43..7e17ea5ed7 100644 --- a/code/modules/mob/living/carbon/human/unarmed_attack.dm +++ b/code/modules/mob/living/carbon/human/unarmed_attack.dm @@ -33,7 +33,7 @@ if(attack_damage >= 5 && armour < 2 && !(target == user) && stun_chance <= attack_damage * 5) // 25% standard chance switch(zone) // strong punches can have effects depending on where they hit - if("head") + if("head", "mouth", "eyes") // Induce blurriness target.visible_message("[target] stares blankly for a few moments.", "You see stars.") target.apply_effect(attack_damage*2, EYE_BLUR, armour) @@ -114,7 +114,7 @@ if(!target.lying) switch(zone) - if("head") + if("head", "mouth", "eyes") // ----- HEAD ----- // switch(attack_damage) if(1 to 2) user.visible_message("[user] slapped [target] across \his cheek!") @@ -169,7 +169,7 @@ return 0 switch(zone) - if("head") + if("head", "mouth", "eyes") // ----- HEAD ----- // switch(damage) if(1 to 2) user.visible_message("[user] scratched [target] across \his cheek!") From 487117a0ae34f4b9131604c0c78bd44471fb408f Mon Sep 17 00:00:00 2001 From: Zuhayr Date: Mon, 1 Dec 2014 20:42:32 +1030 Subject: [PATCH 6/6] Reverting a now unneeded var change. --- code/modules/mob/living/carbon/human/human_defines.dm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/code/modules/mob/living/carbon/human/human_defines.dm b/code/modules/mob/living/carbon/human/human_defines.dm index 41d222865d..b9cde0c192 100644 --- a/code/modules/mob/living/carbon/human/human_defines.dm +++ b/code/modules/mob/living/carbon/human/human_defines.dm @@ -45,7 +45,7 @@ //Equipment slots var/obj/item/wear_suit = null var/obj/item/w_uniform = null - var/obj/item/clothing/shoes/shoes = null //Why aren't we defining all of these as their most commonly used object type? + var/obj/item/shoes = null var/obj/item/belt = null var/obj/item/gloves = null var/obj/item/glasses = null @@ -81,4 +81,4 @@ var/mob/remoteview_target = null var/hand_blood_color - var/list/flavor_texts = list() \ No newline at end of file + var/list/flavor_texts = list()