From 04e1792d0d0ba60833be5357d0280410568ac0ed Mon Sep 17 00:00:00 2001 From: Qwertytoforty <52090703+Qwertytoforty@users.noreply.github.com> Date: Sat, 1 Jul 2023 04:42:44 -0400 Subject: [PATCH] Dswords now return melee attack on parry. Eswords reflect lasers on parry. Throwing bodies at a dsword user may not work well (#21463) --- .../weapons/melee/energy_melee_weapons.dm | 18 +++++++++++++++++ code/game/objects/items/weapons/twohanded.dm | 20 ++++++++++++++++--- code/modules/mob/living/carbon/carbon.dm | 9 +++++++++ 3 files changed, 44 insertions(+), 3 deletions(-) diff --git a/code/game/objects/items/weapons/melee/energy_melee_weapons.dm b/code/game/objects/items/weapons/melee/energy_melee_weapons.dm index 4896ad6fbad..a4d6eea631a 100644 --- a/code/game/objects/items/weapons/melee/energy_melee_weapons.dm +++ b/code/game/objects/items/weapons/melee/energy_melee_weapons.dm @@ -228,6 +228,24 @@ else to_chat(user, "It's already fabulous!") + +/obj/item/melee/energy/sword/saber/hit_reaction(mob/living/carbon/human/owner, atom/movable/hitby, attack_text = "the attack", final_block_chance = 0, damage = 0, attack_type = MELEE_ATTACK) + if(!active) + return FALSE + . = ..() + if(!.) // they did not block the attack + return + if(istype(hitby, /obj/item/projectile)) + var/obj/item/projectile/P = hitby + if(P.reflectability == REFLECTABILITY_NEVER) //only 1 magic spell does this, but hey, needed + owner.visible_message("[owner] blocks [attack_text] with [src]!") + playsound(src, 'sound/weapons/effects/ric3.ogg', 100, TRUE) + return TRUE + owner.visible_message("[owner] parries [attack_text] with [src]!") + add_attack_logs(P.firer, src, "hit by [P.type] but got parried by [src]") + return -1 + return TRUE + /obj/item/melee/energy/sword/pirate name = "energy cutlass" desc = "Arrrr matey." diff --git a/code/game/objects/items/weapons/twohanded.dm b/code/game/objects/items/weapons/twohanded.dm index 0ed33e9da2e..cc999dde371 100644 --- a/code/game/objects/items/weapons/twohanded.dm +++ b/code/game/objects/items/weapons/twohanded.dm @@ -334,9 +334,23 @@ sleep(1) /obj/item/twohanded/dualsaber/hit_reaction(mob/living/carbon/human/owner, atom/movable/hitby, attack_text = "the attack", final_block_chance = 0, damage = 0, attack_type = MELEE_ATTACK) - if(wielded) - return ..() - return FALSE + if(!wielded) + return FALSE + . = ..() + if(!.) // they did not block the attack + return + + if(attack_type == THROWN_PROJECTILE_ATTACK) + if(!isitem(hitby)) + return TRUE + var/obj/item/TT = hitby + addtimer(CALLBACK(TT, TYPE_PROC_REF(/atom/movable, throw_at), locateUID(TT.thrownby), 10, 4, owner), 0.2 SECONDS) //Timer set to 0.2 seconds to ensure item finshes the throwing to prevent double embeds + return TRUE + if(isitem(hitby)) + melee_attack_chain(owner, hitby.loc) + else + melee_attack_chain(owner, hitby) + return TRUE /obj/item/twohanded/dualsaber/attack_hulk(mob/living/carbon/human/user, does_attack_animation = FALSE) //In case thats just so happens that it is still activated on the groud, prevents hulk from picking it up if(wielded) diff --git a/code/modules/mob/living/carbon/carbon.dm b/code/modules/mob/living/carbon/carbon.dm index 38f6bd5330c..ada4f547865 100644 --- a/code/modules/mob/living/carbon/carbon.dm +++ b/code/modules/mob/living/carbon/carbon.dm @@ -625,6 +625,15 @@ GLOBAL_LIST_INIT(ventcrawl_machinery, list(/obj/machinery/atmospherics/unary/ven hit_atom.hit_by_thrown_carbon(src, throwingdatum, damage, FALSE, FALSE) /mob/living/carbon/hit_by_thrown_carbon(mob/living/carbon/human/C, datum/thrownthing/throwingdatum, damage, mob_hurt, self_hurt) + for(var/obj/item/twohanded/dualsaber/D in contents) + if(D.wielded) + visible_message("[src] impales [C] with [D], before dropping them on the ground!") + C.apply_damage(100, BRUTE, "chest", sharp = TRUE, used_weapon = "Impaled on [D].") + C.Stun(2 SECONDS) //Punishment. This could also be used by a traitor to throw someone into a dsword to kill them, but hey, teamwork! + C.KnockDown(6 SECONDS) + D.melee_attack_chain(src, C) //attack animation / jedi spin + C.emote("scream") + return . = ..() KnockDown(3 SECONDS)