mirror of
https://github.com/ParadiseSS13/Paradise.git
synced 2026-07-14 16:44:33 +01:00
Adds the vortex feedback inversion arm. (#19821)
* start of mess * reflect/parries works * more pog-ress * temp icons, .33 to 0.4 * more work, sound, rnd, fixes me breaking shields * removes this since open pr fixes * better codee * attack log * Final changes / sprites by ramon * fixes issue * shoot ramon for the white pixel :^) * But what if it was a purple glass shard * Fixes the throw parry * sorry for so many commits, lower callback * Apply suggestions from code review Co-authored-by: Sirryan2002 <80364400+Sirryan2002@users.noreply.github.com> * Early return, no need to typecast Co-authored-by: Sirryan2002 <80364400+Sirryan2002@users.noreply.github.com>
This commit is contained in:
@@ -12,6 +12,8 @@
|
||||
var/parryable_attack_types
|
||||
/// the time between parry attempts
|
||||
var/parry_cooldown
|
||||
///Do we wish to mute the parry sound?
|
||||
var/no_parry_sound
|
||||
|
||||
/datum/component/parry/RegisterWithParent()
|
||||
RegisterSignal(parent, COMSIG_ITEM_EQUIPPED, PROC_REF(equipped))
|
||||
@@ -26,7 +28,7 @@
|
||||
if(ismob(I.loc))
|
||||
UnregisterSignal(I.loc, COMSIG_LIVING_RESIST)
|
||||
|
||||
/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)
|
||||
/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)
|
||||
if(!isitem(parent))
|
||||
return COMPONENT_INCOMPATIBLE
|
||||
|
||||
@@ -34,6 +36,7 @@
|
||||
stamina_constant = _stamina_constant
|
||||
stamina_coefficient = _stamina_coefficient
|
||||
parry_cooldown = _parry_cooldown
|
||||
no_parry_sound = _no_parry_sound
|
||||
if(islist(_parryable_attack_types))
|
||||
parryable_attack_types = _parryable_attack_types
|
||||
else
|
||||
@@ -61,6 +64,7 @@
|
||||
|
||||
/datum/component/parry/proc/attempt_parry(datum/source, mob/living/carbon/human/owner, atom/movable/hitby, damage = 0, attack_type = MELEE_ATTACK)
|
||||
SIGNAL_HANDLER
|
||||
var/was_perfect = FALSE
|
||||
if(!(attack_type in parryable_attack_types))
|
||||
return
|
||||
var/time_since_parry = world.time - time_parried
|
||||
@@ -80,17 +84,22 @@
|
||||
|
||||
var/stamina_damage = stamina_coefficient * (((time_since_parry / parry_time_out_time) + armour_penetration_percentage / 100) * (damage + armour_penetration_flat)) + stamina_constant
|
||||
|
||||
var/sound_to_play
|
||||
if(attack_type == PROJECTILE_ATTACK)
|
||||
sound_to_play = pick('sound/weapons/effects/ric1.ogg', 'sound/weapons/effects/ric2.ogg', 'sound/weapons/effects/ric3.ogg', 'sound/weapons/effects/ric4.ogg', 'sound/weapons/effects/ric5.ogg')
|
||||
else
|
||||
sound_to_play = 'sound/weapons/parry.ogg'
|
||||
if(!no_parry_sound)
|
||||
var/sound_to_play
|
||||
if(attack_type == PROJECTILE_ATTACK)
|
||||
sound_to_play = pick('sound/weapons/effects/ric1.ogg', 'sound/weapons/effects/ric2.ogg', 'sound/weapons/effects/ric3.ogg', 'sound/weapons/effects/ric4.ogg', 'sound/weapons/effects/ric5.ogg')
|
||||
else
|
||||
sound_to_play = 'sound/weapons/parry.ogg'
|
||||
|
||||
playsound(owner, sound_to_play, clamp(stamina_damage, 40, 120))
|
||||
playsound(owner, sound_to_play, clamp(stamina_damage, 40, 120))
|
||||
if(time_since_parry <= parry_time_out_time * 0.5) // a perfect parry
|
||||
was_perfect = TRUE
|
||||
|
||||
owner.adjustStaminaLoss(stamina_damage)
|
||||
if(owner.getStaminaLoss() < 100)
|
||||
return COMPONENT_BLOCK_SUCCESSFUL
|
||||
if(!was_perfect)
|
||||
return COMPONENT_BLOCK_SUCCESSFUL
|
||||
return (COMPONENT_BLOCK_SUCCESSFUL | COMPONENT_BLOCK_PERFECT)
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user