Skip to content

Commit

Permalink
Stagger and stun improvement and refactor (#13604)
Browse files Browse the repository at this point in the history
* stagger status effect

* normalised amounts to SECONDS

* SECONDS define

* autodoc and new Stagger proc

* apply_effect(s) cleanup

* made status procs consistant

* fuck it, just load on the main pr

* railgun tweaks

* made stagger scatter just use the mob modifier

* funny id bug

* fixed setstatus procs and null amounts

* fix funny slow and eyeblur bug
  • Loading branch information
Lumipharon authored Jul 31, 2023
1 parent 3294fcb commit 65f1f81
Show file tree
Hide file tree
Showing 78 changed files with 680 additions and 625 deletions.
2 changes: 0 additions & 2 deletions code/__DEFINES/dcs/signals.dm
Original file line number Diff line number Diff line change
Expand Up @@ -488,8 +488,6 @@
#define COMSIG_LIVING_STATUS_SLOWDOWN "living_slowdown" //from base of mob/living/set_slowdown() (amount, update)
#define COMPONENT_NO_STUN (1<<0) //For all of them

#define COMSIG_LIVING_STAGGER_CHANGED "living_stagger_changed"

///from end of fully_heal(): (admin_revive)
#define COMSIG_LIVING_POST_FULLY_HEAL "living_post_fully_heal"

Expand Down
6 changes: 4 additions & 2 deletions code/__DEFINES/mobs.dm
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@
#define STUN "stun"
#define WEAKEN "weaken"
#define PARALYZE "paralize"
#define STAGGER "stagger"
#define AGONY "agony" // Added in PAIN!
#define STUTTER "stutter"
#define EYE_BLUR "eye_blur"
Expand Down Expand Up @@ -446,7 +447,8 @@ GLOBAL_LIST_INIT(xenoupgradetiers, list(XENO_UPGRADE_BASETYPE, XENO_UPGRADE_INVA
///Stamina exhaustion

#define LIVING_STAMINA_EXHAUSTION_COOLDOWN 10 SECONDS //Amount of time between 0 stamina exhaustion events
#define STAMINA_EXHAUSTION_DEBUFF_STACKS 6 //Amount of slow and stagger stacks applied on stamina exhaustion events
#define STAMINA_EXHAUSTION_STAGGER_DURATION 10 SECONDS //Amount of stagger applied on stamina exhaustion events
#define STAMINA_EXHAUSTION_DEBUFF_STACKS 6 //Amount of slow and eyeblur stacks applied on stamina exhaustion events


//Shock defines
Expand Down Expand Up @@ -713,7 +715,7 @@ GLOBAL_LIST_INIT(xenoupgradetiers, list(XENO_UPGRADE_BASETYPE, XENO_UPGRADE_INVA
#define WRAITH_BANISH_NONFRIENDLY_LIVING_MULTIPLIER 0.5
#define WRAITH_BANISH_VERY_SHORT_MULTIPLIER 0.3

#define WRAITH_TELEPORT_DEBUFF_STAGGER_STACKS 2 //Stagger and slow stacks applied to adjacent living hostiles before/after a teleport
#define WRAITH_TELEPORT_DEBUFF_STAGGER_STACKS 2 SECONDS //Stagger and slow stacks applied to adjacent living hostiles before/after a teleport
#define WRAITH_TELEPORT_DEBUFF_SLOWDOWN_STACKS 3 //Stagger and slow stacks applied to adjacent living hostiles before/after a teleport

//Warrior defines
Expand Down
2 changes: 2 additions & 0 deletions code/__DEFINES/status_effects.dm
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@
// DEBUFFS //
/////////////

#define STATUS_EFFECT_STAGGER /datum/status_effect/incapacitating/stagger //reduces human gun damage or impairs xeno ability use

#define STATUS_EFFECT_STUN /datum/status_effect/incapacitating/stun //the affected is unable to move or use items

#define STATUS_EFFECT_KNOCKDOWN /datum/status_effect/incapacitating/knockdown //the affected is unable to stand up
Expand Down
1 change: 1 addition & 0 deletions code/__DEFINES/traits.dm
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,7 @@
#define TRAIT_POSSESSING "possessing" // Prevents mob from being taken by ghosts
#define TRAIT_BURROWED "burrowed" // Burrows the xeno
#define TRAIT_KNOCKEDOUT "knockedout" //Forces the user to stay unconscious.
#define TRAIT_STAGGERED "staggered" //damage or ability debuffs
#define TRAIT_INCAPACITATED "incapacitated"
#define TRAIT_FLOORED "floored" //User is forced to the ground on a prone position.
#define TRAIT_IMMOBILE "immobile" //User is unable to move by its own volition.
Expand Down
2 changes: 1 addition & 1 deletion code/datums/actions/xeno_action.dm
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@
X.balloon_alert(X, "Cannot while buckled")
return FALSE

if(!(flags_to_check & XACT_USE_STAGGERED) && X.stagger)
if(!(flags_to_check & XACT_USE_STAGGERED) && X.IsStaggered())
if(!silent)
X.balloon_alert(X, "Cannot while staggered")
return FALSE
Expand Down
2 changes: 1 addition & 1 deletion code/datums/components/shield.dm
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@

if(iscarbon(affected))
var/mob/living/carbon/C = affected
if(C.stagger) //Lesser penalty to shield cover for being staggered.
if(C.IsStaggered()) //Lesser penalty to shield cover for being staggered.
status_cover_modifier *= 0.75

switch(attack_type)
Expand Down
2 changes: 1 addition & 1 deletion code/datums/components/stun_mitigation.dm
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@

if(iscarbon(affected))
var/mob/living/carbon/C = affected
if(C.stagger)
if(C.IsStaggered())
mitigation_prob *= 0.4

if(!prob(mitigation_prob))
Expand Down
15 changes: 15 additions & 0 deletions code/datums/status_effects/debuffs.dm
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,21 @@
duration = set_duration
return ..()

//STAGGERED
/datum/status_effect/incapacitating/stagger
id = "stagger"

/datum/status_effect/incapacitating/stagger/on_apply()
. = ..()
if(!.)
return
ADD_TRAIT(owner, TRAIT_STAGGERED, TRAIT_STATUS_EFFECT(id))
owner.adjust_mob_scatter(5)

/datum/status_effect/incapacitating/stagger/on_remove()
REMOVE_TRAIT(owner, TRAIT_STAGGERED, TRAIT_STATUS_EFFECT(id))
owner.adjust_mob_scatter(-5)

//STUN
/datum/status_effect/incapacitating/stun
id = "stun"
Expand Down
2 changes: 1 addition & 1 deletion code/game/data_huds.dm
Original file line number Diff line number Diff line change
Expand Up @@ -343,7 +343,7 @@
simple_status_hud.icon_state = "hud_con_stun"
status_hud.icon_state = "hud_con_stun"
return TRUE
if(stagger)
if(IsStaggered())
simple_status_hud.icon_state = "hud_con_stagger"
status_hud.icon_state = "hud_con_stagger"
return TRUE
Expand Down
2 changes: 1 addition & 1 deletion code/game/objects/items/defibrillator.dm
Original file line number Diff line number Diff line change
Expand Up @@ -297,7 +297,7 @@
H.reload_fullscreens()
H.flash_act()
H.apply_effect(10, EYE_BLUR)
H.apply_effect(10, PARALYZE)
H.apply_effect(20 SECONDS, PARALYZE)
H.handle_regular_hud_updates()
H.updatehealth() //One more time, so it doesn't show the target as dead on HUDs
H.dead_ticks = 0 //We reset the DNR time
Expand Down
22 changes: 9 additions & 13 deletions code/game/objects/items/explosives/grenades/flashbang.dm
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,7 @@
///The effects applied to all mobs in range
/obj/item/explosive/grenade/flashbang/proc/base_effect(turf/T , mob/living/carbon/M, ear_safety)
if(M.flash_act())
M.Stun(40)
M.Paralyze(20 SECONDS)

M.apply_effects(stun = 4 SECONDS, paralyze = 2 SECONDS)
if(M.ear_damage >= 15)
to_chat(M, span_warning("Your ears start to ring badly!"))
if(!banglet)
Expand All @@ -75,11 +73,9 @@
///The effects applied to mobs in the inner_range
/obj/item/explosive/grenade/flashbang/proc/inner_effect(turf/T , mob/living/carbon/M, ear_safety)
if(ear_safety > 0)
M.Stun(40)
M.Paralyze(20)
M.apply_effects(stun = 4 SECONDS, paralyze = 2 SECONDS)
else
M.Stun(20 SECONDS)
M.Paralyze(60)
M.apply_effects(stun = 20 SECONDS, paralyze = 6 SECONDS)
if((prob(14) || (M == src.loc && prob(70))))
M.adjust_ear_damage(rand(1, 10),15)
else
Expand All @@ -88,13 +84,13 @@
///The effects applied to mobs in the outer_range
/obj/item/explosive/grenade/flashbang/proc/outer_effect(turf/T , mob/living/carbon/M, ear_safety)
if(!ear_safety)
M.Stun(16 SECONDS)
M.apply_effect(16 SECONDS, STUN)
M.adjust_ear_damage(rand(0, 3),8)

///The effects applied to mobs outside of outer_range
/obj/item/explosive/grenade/flashbang/proc/max_range_effect(turf/T , mob/living/carbon/M, ear_safety)
if(!ear_safety)
M.Stun(80)
M.apply_effect(8 SECONDS, STUN)
M.adjust_ear_damage(rand(0, 1),6)


Expand Down Expand Up @@ -185,10 +181,10 @@
M.blur_eyes(7)

if(ear_safety > 0)
M.adjust_stagger(3)
M.adjust_stagger(3 SECONDS)
M.add_slowdown(3)
else
M.adjust_stagger(6)
M.adjust_stagger(6 SECONDS)
M.add_slowdown(6)
if((prob(14) || (M == src.loc && prob(70))))
M.adjust_ear_damage(rand(1, 10),15)
Expand All @@ -200,7 +196,7 @@
M.blur_eyes(6)

if(!ear_safety)
M.adjust_stagger(4)
M.adjust_stagger(4 SECONDS)
M.add_slowdown(4)
M.adjust_ear_damage(rand(0, 3),8)

Expand All @@ -209,6 +205,6 @@
M.blur_eyes(4)

if(!ear_safety)
M.adjust_stagger(2)
M.adjust_stagger(2 SECONDS)
M.add_slowdown(2)
M.adjust_ear_damage(rand(0, 1),6)
4 changes: 2 additions & 2 deletions code/game/objects/items/explosives/grenades/grenade.dm
Original file line number Diff line number Diff line change
Expand Up @@ -145,8 +145,8 @@
var/effective_strength = max(victim.modify_by_armor(strength, BIO), strength * 0.25)
victim.adjustCloneLoss(effective_strength)
victim.adjustStaminaLoss(effective_strength * 7)
victim.adjust_stagger(effective_strength / 2)
victim.add_slowdown(effective_strength / 2)
victim.adjust_stagger(effective_strength SECONDS * 0.5)
victim.add_slowdown(effective_strength * 0.5)
victim.blur_eyes(effective_strength) //adds a visual indicator that you've just been irradiated
victim.adjust_radiation(effective_strength * 20) //Radiation status effect, duration is in deciseconds
balloon_alert(victim, "weakened by radiation")
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
else
user.visible_message(span_danger("[user] has hit [user.p_them()]self with the bottle of [name] on the head!"))
if(weaken_duration >= force) //if they have armor, no stun
target.apply_effect(2, WEAKEN)
target.apply_effect(4 SECONDS, WEAKEN)

else
if(target != user)
Expand Down
2 changes: 1 addition & 1 deletion code/game/objects/items/reagent_containers/hypospray.dm
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@
if(!M.can_inject(user, TRUE, user.zone_selected, TRUE))
return
if(M != user && M.stat != DEAD && M.a_intent != INTENT_HELP && !M.incapacitated() && M.skills.getRating(SKILL_CQC) >= SKILL_CQC_MP)
user.Paralyze(60)
user.Paralyze(6 SECONDS)
log_combat(M, user, "blocked", addition="using their cqc skill (hypospray injection)")
M.visible_message(span_danger("[M]'s reflexes kick in and knock [user] to the ground before they could use \the [src]'!"), \
span_warning("You knock [user] to the ground before they could inject you!"), null, 5)
Expand Down
2 changes: 1 addition & 1 deletion code/game/objects/items/reagent_containers/syringes.dm
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@
var/mob/M = target
var/mob/living/L = user
if(M != L && M.stat != DEAD && M.a_intent != INTENT_HELP && !M.incapacitated() && M.skills.getRating(SKILL_CQC) >= SKILL_CQC_MP)
L.Paralyze(60)
L.Paralyze(6 SECONDS)
log_combat(M, L, "blocked", addition="using their cqc skill (syringe injection)")
M.visible_message(span_danger("[M]'s reflexes kick in and knock [L] to the ground before they could use \the [src]'!"), \
span_warning("You knock [L] to the ground before they could inject you!"), null, 5)
Expand Down
2 changes: 1 addition & 1 deletion code/game/objects/items/shards.dm
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@
var/datum/limb/affecting = target.get_limb(pick("l_foot", "r_foot"))
if(affecting.limb_status & LIMB_ROBOT)
return
target.Paralyze(60)
target.Paralyze(6 SECONDS)

if(affecting.take_damage_limb(5))
UPDATEHEALTH(target)
Expand Down
8 changes: 4 additions & 4 deletions code/game/objects/items/tools/kitchen_tools.dm
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,7 @@
log_combat(user, M, "attacked", src)

if(prob(15))
M.Paralyze(60)
M.Paralyze(6 SECONDS)
M.take_limb_damage(3)
else
M.take_limb_damage(5)
Expand Down Expand Up @@ -281,7 +281,7 @@
playsound(M, 'sound/items/trayhit2.ogg', 25, 1) //sound playin'
visible_message(span_danger("[user] slams [M] with the tray!"))
if(prob(10))
M.Stun(rand(20,60))
M.Stun(rand(2 SECONDS, 6 SECONDS))
M.take_limb_damage(3)
return
else
Expand All @@ -303,13 +303,13 @@
playsound(M, 'sound/items/trayhit2.ogg', 25, 1) //sound playin' again
visible_message(span_danger("[user] slams [M] in the face with the tray!"))
if(prob(30))
M.Stun(rand(40,80))
M.Stun(rand(4 SECONDS, 8 SECONDS))
M.take_limb_damage(4)
return
else
M.take_limb_damage(8)
if(prob(30))
M.Paralyze(40)
M.Paralyze(4 SECONDS)
return
return

Expand Down
12 changes: 6 additions & 6 deletions code/game/objects/items/weapons/stunbaton.dm
Original file line number Diff line number Diff line change
Expand Up @@ -134,16 +134,16 @@
to_chat(user, span_warning("You don't seem to know how to use [src]..."))
return

var/agony = agonyforce
var/stun = stunforce
var/agony_applied = agonyforce
var/stun_applied = stunforce
var/mob/living/L = M

var/target_zone = check_zone(user.zone_selected)
if(user.a_intent == INTENT_HARM)
if (!..()) //item/attack() does it's own messaging and logs
return 0 // item/attack() will return 1 if they hit, 0 if they missed.
agony *= 0.5 //whacking someone causes a much poorer contact than prodding them.
stun *= 0.5
agony_applied *= 0.5 //whacking someone causes a much poorer contact than prodding them.
stun_applied *= 0.5
//we can't really extract the actual hit zone from ..(), unfortunately. Just act like they attacked the area they intended to.
else
//copied from human_defense.dm - human defence code should really be refactored some time.
Expand Down Expand Up @@ -173,8 +173,8 @@

//stun effects
if(!HAS_TRAIT(L, TRAIT_BATONIMMUNE))
L.stun_effect_act(stun, agony, target_zone)
L.ParalyzeNoChain(80)
L.apply_effects(stun = stun_applied, stutter = agony_applied * 0.1, eyeblur = agony_applied * 0.1, agony = agony_applied)
L.ParalyzeNoChain(8 SECONDS)

playsound(loc, 'sound/weapons/egloves.ogg', 25, 1, 6)
log_combat(user, L, "stunned", src)
Expand Down
10 changes: 5 additions & 5 deletions code/game/objects/items/weapons/twohanded.dm
Original file line number Diff line number Diff line change
Expand Up @@ -512,15 +512,15 @@
/obj/item/weapon/twohanded/rocketsledge/unique_action(mob/user)
. = ..()
if (knockback)
stun = 1
weaken = 2
stun = 2 SECONDS
weaken = 4 SECONDS
knockback = 0
balloon_alert(user, "Selected mode: CRUSH.")
playsound(loc, 'sound/machines/switch.ogg', 25)
return

stun = 1
weaken = 1
stun = 2 SECONDS
weaken = 2 SECONDS
knockback = 1
balloon_alert(user, "Selected mode: KNOCKBACK.")
playsound(loc, 'sound/machines/switch.ogg', 25)
Expand Down Expand Up @@ -562,7 +562,7 @@
if(xeno_victim.crest_defense) //Crest defense protects us from the stun.
stun = 0
else
stun = 1
stun = 2 SECONDS

if(!M.IsStun() && !M.IsParalyzed() && !isxenoqueen(M)) //Prevent chain stunning. Queen is protected.
M.apply_effects(stun,weaken)
Expand Down
2 changes: 1 addition & 1 deletion code/game/objects/structures/fence.dm
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@
if(GRAB_AGGRESSIVE)
M.visible_message(span_danger("[user] bashes [M] against \the [src]!"))
if(prob(50))
M.Paralyze(20)
M.Paralyze(2 SECONDS)
M.apply_damage(10, blocked = MELEE)
UPDATEHEALTH(M)
take_damage(25)
Expand Down
12 changes: 6 additions & 6 deletions code/game/objects/structures/stool_bed_chair_nest/chairs.dm
Original file line number Diff line number Diff line change
Expand Up @@ -235,19 +235,19 @@
var/def_zone = ran_zone()
var/armor_modifier = occupant.modify_by_armor(1, MELEE, 0, def_zone)
occupant.throw_at(A, 3, propelled)
occupant.apply_effect(6 * armor_modifier, STUN)
occupant.apply_effect(6 * armor_modifier, WEAKEN)
occupant.apply_effect(6 * armor_modifier, STUTTER)
occupant.apply_effect(12 SECONDS * armor_modifier, STUN)
occupant.apply_effect(12 SECONDS * armor_modifier, WEAKEN)
occupant.apply_effect(12 SECONDS * armor_modifier, STUTTER)
occupant.apply_damage(10 * armor_modifier, BRUTE, def_zone)
UPDATEHEALTH(occupant)
playsound(src.loc, 'sound/weapons/punch1.ogg', 25, 1)
if(isliving(A))
var/mob/living/victim = A
def_zone = ran_zone()
armor_modifier = victim.modify_by_armor(1, MELEE, 0, def_zone)
victim.apply_effect(6 * armor_modifier, STUN)
victim.apply_effect(6 * armor_modifier, WEAKEN)
victim.apply_effect(6 * armor_modifier, STUTTER)
victim.apply_effect(12 SECONDS * armor_modifier, STUN)
victim.apply_effect(12 SECONDS * armor_modifier, WEAKEN)
victim.apply_effect(12 SECONDS * armor_modifier, STUTTER)
victim.apply_damage(10 * armor_modifier, BRUTE, def_zone)
UPDATEHEALTH(victim)
occupant.visible_message(span_danger("[occupant] crashed into \the [A]!"))
Expand Down
12 changes: 6 additions & 6 deletions code/game/objects/structures/stool_bed_chair_nest/wheelchair.dm
Original file line number Diff line number Diff line change
Expand Up @@ -107,19 +107,19 @@
var/def_zone = ran_zone()
var/armor_modifier = occupant.modify_by_armor(1, MELEE, 0, def_zone)
occupant.throw_at(A, 3, propelled)
occupant.apply_effect(6 * armor_modifier, STUN)
occupant.apply_effect(6 * armor_modifier, WEAKEN)
occupant.apply_effect(6 * armor_modifier, STUTTER)
occupant.apply_effect(12 SECONDS * armor_modifier, STUN)
occupant.apply_effect(12 SECONDS * armor_modifier, WEAKEN)
occupant.apply_effect(12 SECONDS * armor_modifier, STUTTER)
occupant.apply_damage(10 * armor_modifier, BRUTE, def_zone)
UPDATEHEALTH(occupant)
playsound(src.loc, 'sound/weapons/punch1.ogg', 25, 1)
if(isliving(A))
var/mob/living/victim = A
def_zone = ran_zone()
armor_modifier = victim.modify_by_armor(1, MELEE, 0, def_zone)
victim.apply_effect(6 * armor_modifier, STUN)
victim.apply_effect(6 * armor_modifier, WEAKEN)
victim.apply_effect(6 * armor_modifier, STUTTER)
victim.apply_effect(12 SECONDS * armor_modifier, STUN)
victim.apply_effect(12 SECONDS * armor_modifier, WEAKEN)
victim.apply_effect(12 SECONDS * armor_modifier, STUTTER)
victim.apply_damage(10 * armor_modifier, BRUTE, def_zone)
UPDATEHEALTH(victim)
occupant.visible_message(span_danger("[occupant] crashed into \the [A]!"))
Expand Down
Loading

0 comments on commit 65f1f81

Please sign in to comment.