Parrying Refactor, Adding Parrying to Select Two-handed Weapons: Parry This You Filthy Casual! (#26043)

* Refactors parrying and how parrying is handled. Also gives most of the melee wizard weapons parrying as well as most two handed weapons.

* Forgor the blood spear :)

* Renames `special_parry_condition` to `requires_two_hands`

* Apply suggestions from code review

Co-authored-by: DGamerL <108773801+DGamerL@users.noreply.github.com>
Signed-off-by: Spaghetti-bit <yumyumkillkill@gmail.com>

* Update code/datums/components/parry.dm

Co-authored-by: Luc <89928798+lewcc@users.noreply.github.com>
Signed-off-by: Spaghetti-bit <yumyumkillkill@gmail.com>

* Apply suggestions from code review

Co-authored-by: Luc <89928798+lewcc@users.noreply.github.com>
Signed-off-by: Spaghetti-bit <yumyumkillkill@gmail.com>

* applies suggestion from @lewcc

* Removes the two handed requirement from cult spear as per @Qwerty's request

* Apply suggestions from code review (1/2) from hal

Co-authored-by: Charlie <69320440+hal9000PR@users.noreply.github.com>
Signed-off-by: Spaghetti-bit <yumyumkillkill@gmail.com>

* Apply suggestions from code review (2/2)

* ...accidentally removed an icon in `energy_melee_weapons.dm` when I deconflicted stuff. 💀 ready for review.

* Again, variable added back during deconflict. issues resolved.

* Update code/game/objects/items/weapons/shields.dm

Signed-off-by: DGamerL <108773801+DGamerL@users.noreply.github.com>

---------

Signed-off-by: Spaghetti-bit <yumyumkillkill@gmail.com>
Signed-off-by: DGamerL <108773801+DGamerL@users.noreply.github.com>
Co-authored-by: DGamerL <108773801+DGamerL@users.noreply.github.com>
Co-authored-by: Luc <89928798+lewcc@users.noreply.github.com>
Co-authored-by: Charlie <69320440+hal9000PR@users.noreply.github.com>
This commit is contained in:
Spaghetti-bit
2024-07-30 05:33:02 -07:00
committed by GitHub
parent 6f00060c77
commit cbeedfca9f
12 changed files with 99 additions and 78 deletions
+11 -1
View File
@@ -16,6 +16,10 @@
var/no_parry_sound
/// Text to be shown to users who examine the parent. Will list which type of attacks it can parry.
var/examine_text
/// Does this item have a require a condition to meet before being able to parry? This is for two handed weapons that can parry. (Default: FALSE)
var/requires_two_hands = FALSE
/// Does this item require activation? This is for activation based items or energy weapons.
var/requires_activation = FALSE
/datum/component/parry/RegisterWithParent()
RegisterSignal(parent, COMSIG_ITEM_EQUIPPED, PROC_REF(equipped))
@@ -32,7 +36,7 @@
if(ismob(I.loc))
UnregisterSignal(I.loc, COMSIG_HUMAN_PARRY)
/datum/component/parry/Initialize(_stamina_constant = 0, _stamina_coefficient = 0, _parry_time_out_time = PARRY_DEFAULT_TIMEOUT, _parryable_attack_types = ALL_ATTACK_TYPES, _parry_cooldown = 2 SECONDS, _no_parry_sound = FALSE)
/datum/component/parry/Initialize(_stamina_constant = 0, _stamina_coefficient = 0, _parry_time_out_time = PARRY_DEFAULT_TIMEOUT, _parryable_attack_types = ALL_ATTACK_TYPES, _parry_cooldown = 2 SECONDS, _no_parry_sound = FALSE, _requires_two_hands = FALSE, _requires_activation = FALSE)
if(!isitem(parent))
return COMPONENT_INCOMPATIBLE
@@ -41,6 +45,8 @@
stamina_coefficient = _stamina_coefficient
parry_cooldown = _parry_cooldown
no_parry_sound = _no_parry_sound
requires_two_hands = _requires_two_hands
requires_activation = _requires_activation
if(islist(_parryable_attack_types))
parryable_attack_types = _parryable_attack_types
else
@@ -73,6 +79,10 @@
/datum/component/parry/proc/start_parry(mob/living/L)
SIGNAL_HANDLER
var/time_since_parry = world.time - time_parried
if(requires_two_hands && !HAS_TRAIT(parent, TRAIT_WIELDED)) // If our item has special conditions before being able to parry.
return
if(requires_activation && !HAS_TRAIT(parent, TRAIT_ITEM_ACTIVE)) // If our item requires an activation to be able to parry. [E-sword / Teleshield, etc.]
return
if(time_since_parry < parry_cooldown) // stops spam
return