From de5ab1c19c58f234091eee37be2a364ee46589a9 Mon Sep 17 00:00:00 2001 From: Geeves Date: Wed, 1 Mar 2023 18:54:41 +0200 Subject: [PATCH] Gremmy Toxin Tweaks (#15902) * Gremmy Toxin Tweaks * a --- .../living/carbon/human/human_attackhand.dm | 11 ++-- .../mob/living/carbon/human/human_damage.dm | 33 +++++----- .../simple_animal/hostile/giant_spider.dm | 62 +++++++++---------- .../living/simple_animal/hostile/hostile.dm | 5 +- .../changelogs/geeves-gremmy_toxin_tweaks.yml | 6 ++ 5 files changed, 58 insertions(+), 59 deletions(-) create mode 100644 html/changelogs/geeves-gremmy_toxin_tweaks.yml diff --git a/code/modules/mob/living/carbon/human/human_attackhand.dm b/code/modules/mob/living/carbon/human/human_attackhand.dm index 93dc80f23d8..d7e2ddd6c36 100644 --- a/code/modules/mob/living/carbon/human/human_attackhand.dm +++ b/code/modules/mob/living/carbon/human/human_attackhand.dm @@ -555,12 +555,11 @@ visible_message(SPAN_DANGER("[user] has [attack_message] [src]!")) var/dam_zone = user.zone_sel?.selecting - if(!dam_zone) - dam_zone = pick(organs) - var/obj/item/organ/external/affecting = get_organ(dam_zone) - apply_damage(damage, DAMAGE_BRUTE, affecting, armor_pen = armor_penetration, damage_flags = attack_flags) - updatehealth() - return TRUE + var/obj/item/organ/external/affecting = dam_zone ? get_organ(dam_zone) : pick(organs) + if(affecting) + apply_damage(damage, DAMAGE_BRUTE, affecting, armor_pen = armor_penetration, damage_flags = attack_flags) + updatehealth() + return affecting //Used to attack a joint through grabbing /mob/living/carbon/human/proc/grab_joint(var/mob/living/user, var/def_zone) diff --git a/code/modules/mob/living/carbon/human/human_damage.dm b/code/modules/mob/living/carbon/human/human_damage.dm index cc34ff0b8ad..e1e1462ad58 100644 --- a/code/modules/mob/living/carbon/human/human_damage.dm +++ b/code/modules/mob/living/carbon/human/human_damage.dm @@ -397,25 +397,22 @@ This function restores all organs. to_chat(src, "You are now visible.") src.invisibility = 0 - var/obj/item/organ/external/organ = get_organ(def_zone, TRUE) + var/obj/item/organ/external/organ = isorgan(def_zone) ? def_zone : get_organ(def_zone, TRUE) if(!organ) - if(isorgan(def_zone)) - organ = def_zone - else - if(!def_zone) - if(damage_flags & DAMAGE_FLAG_DISPERSED) - var/old_damage = damage - var/tally - silent = TRUE // Will damage a lot of organs, probably, so avoid spam. - for(var/zone in organ_rel_size) - tally += organ_rel_size[zone] - for(var/zone in organ_rel_size) - damage = old_damage * organ_rel_size[zone]/tally - def_zone = zone - . = .() || . - return - def_zone = ran_zone(def_zone) - organ = get_organ(check_zone(def_zone)) + if(!def_zone) + if(damage_flags & DAMAGE_FLAG_DISPERSED) + var/old_damage = damage + var/tally + silent = TRUE // Will damage a lot of organs, probably, so avoid spam. + for(var/zone in organ_rel_size) + tally += organ_rel_size[zone] + for(var/zone in organ_rel_size) + damage = old_damage * organ_rel_size[zone]/tally + def_zone = zone + . = .() || . + return + def_zone = ran_zone(def_zone) + organ = get_organ(check_zone(def_zone)) //Handle other types of damage if(!(damagetype in list(DAMAGE_BRUTE, DAMAGE_BURN, DAMAGE_PAIN, DAMAGE_CLONE))) diff --git a/code/modules/mob/living/simple_animal/hostile/giant_spider.dm b/code/modules/mob/living/simple_animal/hostile/giant_spider.dm index a1be3aa55e1..173c30e7fb7 100644 --- a/code/modules/mob/living/simple_animal/hostile/giant_spider.dm +++ b/code/modules/mob/living/simple_animal/hostile/giant_spider.dm @@ -103,44 +103,42 @@ get_light_and_color(parent) . = ..() -/mob/living/simple_animal/hostile/giant_spider/AttackingTarget() +/mob/living/simple_animal/hostile/giant_spider/on_attack_mob(var/mob/hit_mob, var/obj/item/organ/external/limb) . = ..() - if(isliving(.)) - var/mob/living/L = . - if(L.reagents) - L.reagents.add_reagent(/singleton/reagent/toxin, poison_per_bite) - if(prob(poison_per_bite) && (!issilicon(L) && !isipc(L))) - to_chat(L, "You feel a tiny prick.") - L.reagents.add_reagent(poison_type, 5) + if(isliving(hit_mob) && istype(limb) && !BP_IS_ROBOTIC(limb)) + var/mob/living/target = hit_mob + if(!target.reagents) + return + var/inject_probability = 100 + var/list/armors = target.get_armors_by_zone(limb.limb_name, DAMAGE_BRUTE, DAMAGE_FLAG_SHARP) + for(var/armor in armors) + var/datum/component/armor/armor_datum = armor + inject_probability -= armor_datum.armor_values["melee"] * 1.8 + if(prob(inject_probability)) + to_chat(target, SPAN_WARNING("You feel a tiny prick.")) + target.reagents.add_reagent(poison_type, poison_per_bite) -/mob/living/simple_animal/hostile/giant_spider/nurse/AttackingTarget() +/mob/living/simple_animal/hostile/giant_spider/nurse/on_attack_mob(var/mob/hit_mob, var/obj/item/organ/external/limb) . = ..() - if(ishuman(.)) - var/mob/living/carbon/human/H = . - if(prob(poison_per_bite)) - var/obj/item/organ/external/O = pick(H.organs) - if(!(O.status & (ORGAN_ROBOT|ORGAN_ADV_ROBOT)) && (O.limb_flags & ORGAN_CAN_AMPUTATE)) - var/eggs = new /obj/effect/spider/eggcluster(O, src) - O.implants += eggs - to_chat(H, "The [src] injects something into your [O.name]!") + if(ishuman(hit_mob) && istype(limb) && !BP_IS_ROBOTIC(limb) && prob(poison_per_bite)) + var/eggs = new /obj/effect/spider/eggcluster(limb, src) + limb.implants += eggs + to_chat(hit_mob, SPAN_WARNING("\The [src] injects something into your [limb.name]!")) -/mob/living/simple_animal/hostile/giant_spider/emp/AttackingTarget() +/mob/living/simple_animal/hostile/giant_spider/emp/on_attack_mob(var/mob/hit_mob, var/obj/item/organ/external/limb) . = ..() - if(ishuman(.)) - var/mob/living/carbon/human/H = . + if(ishuman(hit_mob)) + var/mob/living/carbon/human/H = hit_mob if(prob(20)) - if(H.isSynthetic()) - var/obj/item/organ/internal/cell/cell_holder = locate() in H.internal_organs - if(cell_holder) - var/obj/item/cell/C = cell_holder.cell - if(C) - to_chat(H, SPAN_WARNING("\The [src] saps some of your energy!")) - C.use(C.maxcharge / 15) - if(length(H.organs)) - var/obj/item/organ/external/O = pick(H.organs) - if(O.status & (ORGAN_ROBOT|ORGAN_ADV_ROBOT)) - H.visible_message(SPAN_WARNING("\The [src] bites down onto \the [H]'s [O.name]!"), SPAN_WARNING("\The [src] bites down onto your [O.name]!")) - O.emp_act(2) + var/obj/item/organ/internal/cell/cell_holder = locate() in H.internal_organs + if(cell_holder) + var/obj/item/cell/C = cell_holder.cell + if(C) + to_chat(H, SPAN_WARNING("\The [src] saps some of your energy!")) + C.use(C.maxcharge / 15) + if(istype(limb) && HAS_FLAG(limb.status, ORGAN_ROBOT|ORGAN_ADV_ROBOT)) + H.visible_message(SPAN_WARNING("\The [src] bites down onto \the [H]'s [limb.name]!"), SPAN_WARNING("\The [src] bites down onto your [limb.name]!")) + limb.emp_act(2) /mob/living/simple_animal/hostile/giant_spider/think() ..() diff --git a/code/modules/mob/living/simple_animal/hostile/hostile.dm b/code/modules/mob/living/simple_animal/hostile/hostile.dm index 4e82d18b22f..8f2d1286225 100644 --- a/code/modules/mob/living/simple_animal/hostile/hostile.dm +++ b/code/modules/mob/living/simple_animal/hostile/hostile.dm @@ -187,7 +187,7 @@ mob/living/simple_animal/hostile/hitby(atom/movable/AM as mob|obj,var/speed = TH else return 0 -/mob/living/simple_animal/hostile/proc/on_attack_mob(var/mob/hit_mob) +/mob/living/simple_animal/hostile/proc/on_attack_mob(var/mob/hit_mob, var/obj/item/organ/external/limb) return /mob/living/simple_animal/hostile/proc/AttackingTarget() @@ -207,8 +207,7 @@ mob/living/simple_animal/hostile/hitby(atom/movable/AM as mob|obj,var/speed = TH var/atom/target if(isliving(target_mob)) var/mob/living/L = target_mob - L.attack_generic(src, rand(melee_damage_lower, melee_damage_upper), attacktext, armor_penetration, attack_flags) - on_attack_mob(L) + on_attack_mob(L, L.attack_generic(src, rand(melee_damage_lower, melee_damage_upper), attacktext, armor_penetration, attack_flags)) target = L else if(istype(target_mob, /obj/machinery/bot)) var/obj/machinery/bot/B = target_mob diff --git a/html/changelogs/geeves-gremmy_toxin_tweaks.yml b/html/changelogs/geeves-gremmy_toxin_tweaks.yml new file mode 100644 index 00000000000..22193522ccb --- /dev/null +++ b/html/changelogs/geeves-gremmy_toxin_tweaks.yml @@ -0,0 +1,6 @@ +author: Geeves + +delete-after: True + +changes: + - rscadd: "Greimorians now inject toxins into the same limb they hit. If the limb is robotic, no toxin is injected. Wearing armor lowers the probability of toxin being injected." \ No newline at end of file