Stamina Damage Rework (#12591)

This commit is contained in:
Fox McCloud
2019-10-27 00:23:22 -04:00
committed by variableundefined
parent 573d390d93
commit 00f5e0613c
39 changed files with 91 additions and 67 deletions
@@ -25,7 +25,7 @@
icon_state = "alien[caste]_dead"
pixel_y = 0
else if(stat == UNCONSCIOUS || weakened)
else if(stat == UNCONSCIOUS || IsWeakened())
icon_state = "alien[caste]_unconscious"
pixel_y = 0
else if(leap_on_click)
@@ -383,7 +383,7 @@
message = "<B>[src]</B> flips in [M]'s general direction."
SpinAnimation(5,1)
else
if(lying || weakened)
if(lying || IsWeakened())
message = "<B>[src]</B> flops and flails around on the floor."
else
var/obj/item/grab/G
@@ -633,7 +633,7 @@ emp_act
if("brute")
if(M.force > 35) // durand and other heavy mechas
Paralyse(1)
else if(M.force > 20 && !weakened) // lightweight mechas like gygax
else if(M.force > 20 && !IsWeakened()) // lightweight mechas like gygax
Weaken(2)
update |= affecting.receive_damage(dmg, 0)
playsound(src, 'sound/weapons/punch4.ogg', 50, TRUE)
@@ -246,7 +246,7 @@
if(H.r_hand && (H.r_hand.flags & HANDSLOW))
. += H.r_hand.slowdown
var/health_deficiency = (H.maxHealth - H.health + H.staminaloss)
var/health_deficiency = max(H.maxHealth - H.health, H.staminaloss)
var/hungry = (500 - H.nutrition)/5 // So overeat would be 100 and default level would be 80
if(H.reagents)
for(var/datum/reagent/R in H.reagents.reagent_list)
@@ -751,7 +751,7 @@
return FALSE //Unsupported slot
/datum/species/proc/get_perceived_trauma(mob/living/carbon/human/H)
return H.health - H.getStaminaLoss()
return min(H.health, H.maxHealth - H.getStaminaLoss())
/datum/species/proc/handle_hud_icons(mob/living/carbon/human/H)
if(!H.client)
+4 -2
View File
@@ -258,8 +258,10 @@
//this updates all special effects: stunned, sleeping, weakened, druggy, stuttering, etc..
/mob/living/carbon/handle_status_effects()
..()
setStaminaLoss(max((staminaloss - 3), 0))
if(stam_regen_start_time <= world.time)
if(stam_paralyzed)
update_stamina()
setStaminaLoss(0, FALSE)
var/restingpwr = 1 + 4 * resting
@@ -0,0 +1,15 @@
/mob/living/carbon/IsWeakened(include_stamcrit = TRUE)
return ..() || (include_stamcrit && stam_paralyzed)
/mob/living/carbon/proc/enter_stamcrit()
if(!(status_flags & CANWEAKEN))
return
if(absorb_stun(0)) //continuous effect, so we don't want it to increment the stuns absorbed.
return
if(!IsWeakened())
to_chat(src, "<span class='notice'>You're too exhausted to keep going...</span>")
var/prev = stam_paralyzed
stam_paralyzed = TRUE
update_canmove()
if(!prev && getStaminaLoss() < 120) // Puts you a little further into the initial stamcrit, makes stamcrit harder to outright counter with chems.
adjustStaminaLoss(30, FALSE)
@@ -18,15 +18,13 @@
create_debug_log("woke up, trigger reason: [reason]")
/mob/living/carbon/update_stamina()
..()
if(staminaloss)
var/total_health = (health - staminaloss)
if(total_health <= HEALTH_THRESHOLD_CRIT && !stat)
to_chat(src, "<span class='notice'>You're too exhausted to keep going...</span>")
Weaken(5)
setStaminaLoss(health - 2)
handle_hud_icons_health()
return
var/stam = getStaminaLoss()
if(stam > DAMAGE_PRECISION && (maxHealth - stam) <= HEALTH_THRESHOLD_CRIT && !stat)
enter_stamcrit()
else if(stam_paralyzed)
stam_paralyzed = FALSE
update_canmove()
handle_hud_icons_health()
/mob/living/carbon/can_hear()
. = FALSE
+6 -4
View File
@@ -260,28 +260,30 @@
if(status_flags & GODMODE)
return FALSE
var/old_stamloss = staminaloss
staminaloss = max(staminaloss + amount, 0)
staminaloss = min(max(staminaloss + amount, 0), 120)
if(old_stamloss == staminaloss)
updating = FALSE
. = STATUS_UPDATE_NONE
else
. = STATUS_UPDATE_STAMINA
if(amount > 0)
stam_regen_start_time = world.time + STAMINA_REGEN_BLOCK_TIME
if(updating)
handle_hud_icons_health()
update_stamina()
/mob/living/proc/setStaminaLoss(amount, updating = TRUE)
if(status_flags & GODMODE)
return FALSE
var/old_stamloss = staminaloss
staminaloss = amount
staminaloss = min(max(amount, 0), 120)
if(old_stamloss == staminaloss)
updating = FALSE
. = STATUS_UPDATE_NONE
else
. = STATUS_UPDATE_STAMINA
if(amount > 0)
stam_regen_start_time = world.time + STAMINA_REGEN_BLOCK_TIME
if(updating)
handle_hud_icons_health()
update_stamina()
/mob/living/proc/getMaxHealth()
@@ -69,3 +69,5 @@
var/deathgasp_on_death = FALSE
var/stun_absorption = null //converted to a list of stun absorption sources this mob has when one is added
var/stam_regen_start_time = 0 //used to halt stamina regen temporarily
var/stam_paralyzed = FALSE //knocks you down
+2 -2
View File
@@ -318,7 +318,7 @@
set category = "pAI Commands"
set name = "Unfold Chassis"
if(stat || sleeping || paralysis || weakened)
if(stat || sleeping || paralysis || IsWeakened())
return
if(loc != card)
@@ -353,7 +353,7 @@
set category = "pAI Commands"
set name = "Collapse Chassis"
if(stat || sleeping || paralysis || weakened)
if(stat || sleeping || paralysis || IsWeakened())
return
if(loc == card)
@@ -169,7 +169,7 @@
weaponlock_time = 120
/mob/living/silicon/robot/update_canmove(delay_action_updates = 0)
if(paralysis || stunned || weakened || buckled || lockcharge || stat)
if(paralysis || stunned || IsWeakened() || buckled || lockcharge || stat)
canmove = 0
else
canmove = 1
@@ -906,7 +906,7 @@ var/list/robot_verbs_default = list(
/mob/living/silicon/robot/update_icons()
overlays.Cut()
if(stat != DEAD && !(paralysis || stunned || weakened || low_power_mode)) //Not dead, not stunned.
if(stat != DEAD && !(paralysis || stunned || IsWeakened() || low_power_mode)) //Not dead, not stunned.
if(custom_panel in custom_eye_names)
overlays += "eyes-[custom_panel]"
else
@@ -1,6 +1,6 @@
// No args for restraints because robots don't have those
/mob/living/silicon/robot/incapacitated(ignore_restraints = FALSE, ignore_grab = FALSE, ignore_lying = FALSE)
if(stat || lockcharge || weakened || stunned || paralysis || !is_component_functioning("actuator"))
if(stat || lockcharge || IsWeakened() || stunned || paralysis || !is_component_functioning("actuator"))
return TRUE
/mob/living/silicon/robot/has_vision(information_only = FALSE)
@@ -14,7 +14,7 @@
death()
create_debug_log("died of damage, trigger reason: [reason]")
return
if(!is_component_functioning("actuator") || !is_component_functioning("power cell") || paralysis || sleeping || resting || stunned || weakened || getOxyLoss() > maxHealth * 0.5)
if(!is_component_functioning("actuator") || !is_component_functioning("power cell") || paralysis || sleeping || resting || stunned || IsWeakened() || getOxyLoss() > maxHealth * 0.5)
if(stat == CONSCIOUS)
KnockOut()
create_debug_log("fell unconscious, trigger reason: [reason]")
@@ -500,7 +500,7 @@
. |= pcollar.GetAccess()
/mob/living/simple_animal/update_canmove(delay_action_updates = 0)
if(paralysis || stunned || weakened || stat || resting)
if(paralysis || stunned || IsWeakened() || stat || resting)
drop_r_hand()
drop_l_hand()
canmove = 0
+2 -2
View File
@@ -62,11 +62,11 @@
// Whether the mob is capable of standing or not
/mob/living/proc/can_stand()
return !(weakened || paralysis || stat || (status_flags & FAKEDEATH))
return !(IsWeakened() || paralysis || stat || (status_flags & FAKEDEATH))
// Whether the mob is capable of actions or not
/mob/living/incapacitated(ignore_restraints = FALSE, ignore_grab = FALSE, ignore_lying = FALSE)
if(stat || paralysis || stunned || weakened || (!ignore_restraints && restrained()) || (!ignore_lying && lying))
if(stat || paralysis || stunned || IsWeakened() || (!ignore_restraints && restrained()) || (!ignore_lying && lying))
return TRUE
// wonderful proc names, I know - used to check whether the blur overlay
+3
View File
@@ -190,6 +190,9 @@
return
/mob/proc/IsWeakened()
return weakened
/mob/proc/Weaken()
return