From 9ea58e1e336ec7368e903a0e80c7f33776ea4d21 Mon Sep 17 00:00:00 2001 From: HMBGERDO <61080616+HMBGERDO@users.noreply.github.com> Date: Sat, 29 Jun 2024 20:28:26 +0200 Subject: [PATCH] Cult magic attacks and attacks on stun mark can now be blocked by shields (#25771) * cult attacks and hands blocked by shields * logic fix attempt 1 * old shit * Update code/game/gamemodes/cult/blood_magic.dm Co-authored-by: Ryan <80364400+Sirryan2002@users.noreply.github.com> Signed-off-by: HMBGERDO <61080616+HMBGERDO@users.noreply.github.com> * Update code/game/gamemodes/cult/cult_items.dm Co-authored-by: Ryan <80364400+Sirryan2002@users.noreply.github.com> Signed-off-by: HMBGERDO <61080616+HMBGERDO@users.noreply.github.com> --------- Signed-off-by: HMBGERDO <61080616+HMBGERDO@users.noreply.github.com> Co-authored-by: Ryan <80364400+Sirryan2002@users.noreply.github.com> --- code/_onclick/item_attack.dm | 2 +- code/game/gamemodes/cult/blood_magic.dm | 5 ++ code/game/gamemodes/cult/cult_items.dm | 86 +++++++++++-------- code/game/gamemodes/cult/ritual.dm | 4 - .../mob/living/carbon/human/human_defense.dm | 1 + 5 files changed, 58 insertions(+), 40 deletions(-) diff --git a/code/_onclick/item_attack.dm b/code/_onclick/item_attack.dm index d06b59689ab..894e0d63f5b 100644 --- a/code/_onclick/item_attack.dm +++ b/code/_onclick/item_attack.dm @@ -81,7 +81,7 @@ M.lastattackerckey = user.ckey user.do_attack_animation(M) - . = M.attacked_by(src, user, def_zone) + . = !M.attacked_by(src, user, def_zone) add_fingerprint(user) diff --git a/code/game/gamemodes/cult/blood_magic.dm b/code/game/gamemodes/cult/blood_magic.dm index aada8ca02f5..86624155772 100644 --- a/code/game/gamemodes/cult/blood_magic.dm +++ b/code/game/gamemodes/cult/blood_magic.dm @@ -438,6 +438,11 @@ uses = 0 qdel(src) return + if(ishuman(M)) + var/mob/living/carbon/human/H = M + if(H.check_shields(src, 0, "[user]'s [name]", MELEE_ATTACK)) + playsound(M, 'sound/weapons/genhit.ogg', 50, TRUE) + return TRUE add_attack_logs(user, M, "used a cult spell ([src]) on") M.lastattacker = user.real_name diff --git a/code/game/gamemodes/cult/cult_items.dm b/code/game/gamemodes/cult/cult_items.dm index 7c78039342c..1695c212abc 100644 --- a/code/game/gamemodes/cult/cult_items.dm +++ b/code/game/gamemodes/cult/cult_items.dm @@ -45,11 +45,17 @@ else user.adjustBruteLoss(rand(force/2, force)) return - if(!IS_CULTIST(target)) - var/datum/status_effect/cult_stun_mark/S = target.has_status_effect(STATUS_EFFECT_CULT_STUN) - if(S) - S.trigger() - ..() + . = ..() + +/obj/item/melee/cultblade/afterattack(atom/target, mob/user, proximity_flag, click_parameters) + . = ..() + if(!proximity_flag) + return + if(!isliving(target)) + return + var/mob/living/living_target = target + var/datum/status_effect/cult_stun_mark/S = living_target.has_status_effect(STATUS_EFFECT_CULT_STUN) + S?.trigger() /obj/item/melee/cultblade/pickup(mob/living/user) . = ..() @@ -580,35 +586,40 @@ /obj/item/cult_spear/throw_impact(atom/hit_atom, datum/thrownthing/throwingdatum) var/turf/T = get_turf(hit_atom) - if(isliving(hit_atom)) - var/mob/living/L = hit_atom - if(IS_CULTIST(L)) - playsound(src, 'sound/weapons/throwtap.ogg', 50) - if(!L.restrained() && L.put_in_active_hand(src)) - L.visible_message("[L] catches [src] out of the air!") - else - L.visible_message("[src] bounces off of [L], as if repelled by an unseen force!") - else if(!..()) - if(L.null_rod_check()) - return - var/datum/status_effect/cult_stun_mark/S = L.has_status_effect(STATUS_EFFECT_CULT_STUN) - if(S) - S.trigger() - else - L.KnockDown(10 SECONDS) - L.apply_damage(60, STAMINA) - L.apply_status_effect(STATUS_EFFECT_CULT_STUN) - L.flash_eyes(1, TRUE) - if(issilicon(L)) - L.emp_act(EMP_HEAVY) - else if(iscarbon(L)) - L.Silence(6 SECONDS) - L.Stuttering(16 SECONDS) - L.CultSlur(20 SECONDS) - L.Jitter(16 SECONDS) - break_spear(T) - else + if(!isliving(hit_atom)) ..() + return + + var/mob/living/L = hit_atom + if(IS_CULTIST(L)) + playsound(src, 'sound/weapons/throwtap.ogg', 50) + if(!L.restrained() && L.put_in_active_hand(src)) + L.visible_message("[L] catches [src] out of the air!") + else + L.visible_message("[src] bounces off of [L], as if repelled by an unseen force!") + return + + if(..()) + return + + if(L.null_rod_check()) + return + var/datum/status_effect/cult_stun_mark/S = L.has_status_effect(STATUS_EFFECT_CULT_STUN) + if(S) + S.trigger() + else + L.KnockDown(10 SECONDS) + L.apply_damage(60, STAMINA) + L.apply_status_effect(STATUS_EFFECT_CULT_STUN) + L.flash_eyes(1, TRUE) + if(issilicon(L)) + L.emp_act(EMP_HEAVY) + else if(iscarbon(L)) + L.Silence(6 SECONDS) + L.Stuttering(16 SECONDS) + L.CultSlur(20 SECONDS) + L.Jitter(16 SECONDS) + break_spear(T) /obj/item/cult_spear/proc/break_spear(turf/T) if(!T) @@ -620,9 +631,14 @@ playsound(T, 'sound/effects/glassbr3.ogg', 100) qdel(src) -/obj/item/cult_spear/attack(mob/living/M, mob/living/user, def_zone) +/obj/item/cult_spear/afterattack(atom/target, mob/user, proximity_flag, click_parameters) . = ..() - var/datum/status_effect/cult_stun_mark/S = M.has_status_effect(STATUS_EFFECT_CULT_STUN) + if(!proximity_flag) + return + if(!isliving(target)) + return + var/mob/living/living_target = target + var/datum/status_effect/cult_stun_mark/S = living_target.has_status_effect(STATUS_EFFECT_CULT_STUN) if(S && HAS_TRAIT(src, TRAIT_WIELDED)) S.trigger() diff --git a/code/game/gamemodes/cult/ritual.dm b/code/game/gamemodes/cult/ritual.dm index 03647190c90..6523c846ea0 100644 --- a/code/game/gamemodes/cult/ritual.dm +++ b/code/game/gamemodes/cult/ritual.dm @@ -43,10 +43,6 @@ M.reagents.del_reagent("holywater") add_attack_logs(user, M, "Hit with [src], removing the holy water from them") return FALSE - else - var/datum/status_effect/cult_stun_mark/S = M.has_status_effect(STATUS_EFFECT_CULT_STUN) - if(S) - S.trigger() . = ..() /obj/item/melee/cultblade/dagger/attack_self(mob/user) diff --git a/code/modules/mob/living/carbon/human/human_defense.dm b/code/modules/mob/living/carbon/human/human_defense.dm index ee1b197b72c..9c8cfd9577a 100644 --- a/code/modules/mob/living/carbon/human/human_defense.dm +++ b/code/modules/mob/living/carbon/human/human_defense.dm @@ -570,6 +570,7 @@ emp_act update_inv_w_uniform() dna.species.spec_attacked_by(I, user, affecting, user.a_intent, src) + return TRUE //this proc handles being hit by a thrown atom /mob/living/carbon/human/hitby(atom/movable/AM, skipcatch = FALSE, hitpush = TRUE, blocked = FALSE, datum/thrownthing/throwingdatum)