Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
fira committed Nov 5, 2023
1 parent 1540058 commit d525d91
Show file tree
Hide file tree
Showing 6 changed files with 72 additions and 30 deletions.
4 changes: 4 additions & 0 deletions code/__DEFINES/traits.dm
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,9 @@
/// Prevents voluntary standing or staying up on its own.
#define TRAIT_FLOORED "floored"
#define TRAIT_INCAPACITATED "incapacitated"
/// Disoriented. Unable to talk, and unable to use skills as Xeno
#define TRAIT_DAZED "dazed"


// HIVE TRAITS
/// If the Hive is a Xenonid Hive
Expand Down Expand Up @@ -291,6 +294,7 @@ GLOBAL_LIST_INIT(traits_by_type, list(
"TRAIT_KNOCKEDOUT" = TRAIT_KNOCKEDOUT,
"TRAIT_IMMOBILIZED" = TRAIT_IMMOBILIZED,
"TRAIT_FLOORED" = TRAIT_FLOORED,
"TRAIT_DAZED" = TRAIT_DAZED,
"TRAIT_UNDENSE" = TRAIT_UNDENSE,
"TRAIT_YAUTJA_TECH" = TRAIT_YAUTJA_TECH,
"TRAIT_SUPER_STRONG" = TRAIT_SUPER_STRONG,
Expand Down
2 changes: 1 addition & 1 deletion code/__HELPERS/unsorted.dm
Original file line number Diff line number Diff line change
Expand Up @@ -1131,7 +1131,7 @@ var/global/image/action_purple_power_up
)
. = FALSE
break
if(user_flags & INTERRUPT_DAZED && busy_user.dazed)
if(user_flags & INTERRUPT_DAZED && HAS_TRAIT(busy_user, TRAIT_DAZED))
. = FALSE
break
if(user_flags & INTERRUPT_EMOTE && !busy_user.flags_emote)
Expand Down
16 changes: 16 additions & 0 deletions code/datums/status_effects/debuffs/debuffs.dm
Original file line number Diff line number Diff line change
Expand Up @@ -106,3 +106,19 @@
name = "Unconscious"
desc = "You've been knocked out."
icon_state = ALERT_KNOCKEDOUT

/// DAZED:
/// This prevents talking as human or using abilities as Xenos, mainly
/datum/status_effect/incapacitating/dazed
id = "dazed"
needs_update_stat = TRUE

/datum/status_effect/incapacitating/dazed/on_apply()
. = ..()
if(!.)
return
ADD_TRAIT(owner, TRAIT_DAZED, TRAIT_STATUS_EFFECT(id))

/datum/status_effect/incapacitating/dazed/on_remove()
REMOVE_TRAIT(owner, TRAIT_DAZED, TRAIT_STATUS_EFFECT(id))
return ..()
17 changes: 7 additions & 10 deletions code/modules/mob/living/carbon/human/life/life_helpers.dm
Original file line number Diff line number Diff line change
Expand Up @@ -197,16 +197,6 @@
speech_problem_flag = TRUE
return slurring

/mob/living/carbon/human/handle_dazed()
if(dazed)
var/skill_resistance = skills ? (skills.get_skill_level(SKILL_ENDURANCE)-1)*0.1 : 0

var/final_reduction = skill_resistance + 1
adjust_effect(-final_reduction, DAZE, EFFECT_FLAG_LIFE)
if(dazed)
speech_problem_flag = TRUE
return dazed

/mob/living/carbon/human/handle_stuttering()
if(..())
speech_problem_flag = TRUE
Expand All @@ -232,6 +222,13 @@
var/final_reduction = (1 - skill_resistance * 0.02) / species.knock_out_reduction
return . * final_reduction

/mob/living/carbon/human/GetDazeDuration(amount)
. = ..()
var/skill_resistance = skills ? (skills.get_skill_level(SKILL_ENDURANCE)-1)*0.08 : 0
var/final_reduction = (1 - skill_resistance)
return . * final_reduction


/mob/living/carbon/human/proc/handle_revive()
SEND_SIGNAL(src, COMSIG_HUMAN_REVIVED)
track_revive(job)
Expand Down
57 changes: 44 additions & 13 deletions code/modules/mob/living/living_health_procs.dm
Original file line number Diff line number Diff line change
Expand Up @@ -127,20 +127,51 @@
S = apply_status_effect(/datum/status_effect/incapacitating/stun, amount)
return S

/* DAZE (Light incapacitation) */
/// Overridable handler to adjust the numerical value of status effects. Expand as needed
/mob/living/proc/GetDazeDuration(amount)
return amount * GLOBAL_STATUS_MULTIPLIER
/mob/living/proc/IsDaze() //If we're stunned
return has_status_effect(/datum/status_effect/incapacitating/daze)
/mob/living/proc/AmountDAze() //How many deciseconds remains
var/datum/status_effect/incapacitating/daze/S = IsDaze()
if(S)
return S.get_duration_left() / GLOBAL_STATUS_MULTIPLIER
return 0
/mob/living/proc/Daze(amount)
if(status_flags & CANDAZE)
dazed = max(max(dazed,amount),0)
return

/mob/living/proc/SetDaze(amount)
if(status_flags & CANDAZE)
dazed = max(amount,0)
return

/mob/living/proc/AdjustDaze(amount)
if(status_flags & CANDAZE)
dazed = max(dazed + amount,0)
return
if(!(status_flags & CANDAZE))
return
amount = GetDazeDuration(amount)
var/datum/status_effect/incapacitating/daze/S = IsDaze()
if(S)
S.update_duration(amount, increment = TRUE)
else if(amount > 0)
S = apply_status_effect(/datum/status_effect/incapacitating/daze, amount)
return S
/mob/living/proc/SetDaze(amount, ignore_canstun = FALSE) //Sets remaining duration
if(!(status_flags & CANDAZE))
return
amount = GetDazeDuration(amount)
var/datum/status_effect/incapacitating/daze/S = IsDaze()
if(amount <= 0)
if(S)
qdel(S)
else
if(S)
S.update_duration(amount)
else
S = apply_status_effect(/datum/status_effect/incapacitating/daze, amount)
return S
/mob/living/proc/AdjustDaze(amount, ignore_canstun = FALSE) //Adds to remaining duration
if(!(status_flags & CANDAZE))
return
amount = GetStunDuration(amount)
var/datum/status_effect/incapacitating/daze/S = IsDaze()
if(S)
S.adjust_duration(amount)
else if(amount > 0)
S = apply_status_effect(/datum/status_effect/incapacitating/daze, amount)
return S

/mob/living/proc/Slow(amount)
if(status_flags & CANSLOW)
Expand Down
6 changes: 0 additions & 6 deletions code/modules/mob/mob.dm
Original file line number Diff line number Diff line change
Expand Up @@ -846,7 +846,6 @@ note dizziness decrements automatically in the mob's Life() proc.
handle_silent()
handle_drugged()
handle_slurring()
handle_dazed()
handle_slowed()
handle_superslowed()

Expand All @@ -855,11 +854,6 @@ note dizziness decrements automatically in the mob's Life() proc.
adjust_effect(-1, STUN)
return stunned

/mob/living/proc/handle_dazed()
if(dazed)
adjust_effect(-1, DAZE)
return dazed

/mob/living/proc/handle_slowed()
if(slowed)
adjust_effect(-1, SLOW)
Expand Down

0 comments on commit d525d91

Please sign in to comment.