diff --git a/code/__DEFINES/stamina.dm b/code/__DEFINES/stamina.dm index 94c743c79b26..df8badbf2c0f 100644 --- a/code/__DEFINES/stamina.dm +++ b/code/__DEFINES/stamina.dm @@ -77,3 +77,8 @@ #define STAMINA_GRAB_AGGRESSIVE_RESIST_CHANCE 60 /// Chance to resist out of chokeholds grabs. #define STAMINA_GRAB_CHOKE_RESIST_CHANCE 45 + +//// +/// TRAITS +//// +#define TRAIT_CANT_STAMCRIT "cant_stamcrit" diff --git a/code/game/objects/items/melee/baton.dm b/code/game/objects/items/melee/baton.dm index c054ccfb48b0..25ec917416e5 100644 --- a/code/game/objects/items/melee/baton.dm +++ b/code/game/objects/items/melee/baton.dm @@ -204,7 +204,11 @@ target.Paralyze((isnull(stun_override) ? stun_time_cyborg : stun_override) * (trait_check ? 0.1 : 1)) additional_effects_cyborg(target, user) else - target.stamina.adjust(-stamina_damage) + if(!trait_check) + target.stamina.adjust(-stamina_damage) + else + var/stamina_to_min = (target.stamina.maximum * 0.35) + target.stamina.adjust_to(-stamina_damage, stamina_to_min) if(!trait_check) target.Knockdown((isnull(stun_override) ? knockdown_time : stun_override)) additional_effects_non_cyborg(target, user) diff --git a/code/modules/antagonists/heretic/magic/realignment.dm b/code/modules/antagonists/heretic/magic/realignment.dm index 07c8d57e76a4..a1b8061a102e 100644 --- a/code/modules/antagonists/heretic/magic/realignment.dm +++ b/code/modules/antagonists/heretic/magic/realignment.dm @@ -59,6 +59,7 @@ /datum/status_effect/realignment/on_apply() ADD_TRAIT(owner, TRAIT_PACIFISM, id) + ADD_TRAIT(owner, TRAIT_CANT_STAMCRIT, id) owner.add_filter(id, 2, list("type" = "outline", "color" = "#d6e3e7", "size" = 2)) var/filter = owner.get_filter(id) animate(filter, alpha = 127, time = 1 SECONDS, loop = -1) @@ -67,10 +68,11 @@ /datum/status_effect/realignment/on_remove() REMOVE_TRAIT(owner, TRAIT_PACIFISM, id) + REMOVE_TRAIT(owner, TRAIT_CANT_STAMCRIT, id) owner.remove_filter(id) /datum/status_effect/realignment/tick(seconds_per_tick, times_fired) - owner.stamina.adjust(5, TRUE) + owner.stamina.adjust(15, TRUE) owner.AdjustAllImmobility(-0.5 SECONDS) /atom/movable/screen/alert/status_effect/realignment diff --git a/code/modules/mob/living/carbon/status_procs.dm b/code/modules/mob/living/carbon/status_procs.dm index 190885e1b48e..964617ec6c87 100644 --- a/code/modules/mob/living/carbon/status_procs.dm +++ b/code/modules/mob/living/carbon/status_procs.dm @@ -13,7 +13,7 @@ return /mob/living/carbon/stamina_stun() - if(HAS_TRAIT(src, TRAIT_BATON_RESISTANCE)) + if(HAS_TRAIT(src, TRAIT_CANT_STAMCRIT)) return //baton resistance can't stam crit but can still be non sprinted if(HAS_TRAIT_FROM(src, TRAIT_INCAPACITATED, STAMINA)) //Already in stamcrit return diff --git a/code/modules/reagents/chemistry/reagents/cat2_medicine_reagents.dm b/code/modules/reagents/chemistry/reagents/cat2_medicine_reagents.dm index b2776171fdd5..9ea62c503cbf 100644 --- a/code/modules/reagents/chemistry/reagents/cat2_medicine_reagents.dm +++ b/code/modules/reagents/chemistry/reagents/cat2_medicine_reagents.dm @@ -129,12 +129,14 @@ . = TRUE /datum/reagent/medicine/c2/probital/overdose_process(mob/living/affected_mob, seconds_per_tick, times_fired) - affected_mob.stamina.adjust(-3 * REM * seconds_per_tick, FALSE) + affected_mob.stamina.adjust(-3 * REM * seconds_per_tick, TRUE) if(affected_mob.stamina.loss >= 80) affected_mob.adjust_drowsiness(2 SECONDS * REM * seconds_per_tick) if(affected_mob.stamina.loss >= 100) to_chat(affected_mob,span_warning("You feel more tired than you usually do, perhaps if you rest your eyes for a bit...")) affected_mob.stamina.adjust(100, TRUE) + if(HAS_TRAIT(affected_mob, TRAIT_INCAPACITATED)) + affected_mob.exit_stamina_stun() affected_mob.Sleeping(10 SECONDS) ..() . = TRUE diff --git a/code/modules/reagents/chemistry/reagents/medicine_reagents.dm b/code/modules/reagents/chemistry/reagents/medicine_reagents.dm index 741f644b29e6..9519846b59b6 100644 --- a/code/modules/reagents/chemistry/reagents/medicine_reagents.dm +++ b/code/modules/reagents/chemistry/reagents/medicine_reagents.dm @@ -1066,10 +1066,12 @@ ph = 8.7 chemical_flags = REAGENT_CAN_BE_SYNTHESIZED|REAGENT_NO_RANDOM_RECIPE addiction_types = list(/datum/addiction/stimulants = 4) //0.8 per 2 seconds - metabolized_traits = list(TRAIT_BATON_RESISTANCE, TRAIT_ANALGESIA) + metabolized_traits = list(TRAIT_BATON_RESISTANCE, TRAIT_ANALGESIA, TRAIT_CANT_STAMCRIT) /datum/reagent/medicine/stimulants/on_mob_metabolize(mob/living/affected_mob) ..() + if(HAS_TRAIT(affected_mob, TRAIT_INCAPACITATED)) + affected_mob.exit_stamina_stun() affected_mob.add_movespeed_modifier(/datum/movespeed_modifier/reagent/stimulants) /datum/reagent/medicine/stimulants/on_mob_end_metabolize(mob/living/affected_mob) @@ -1084,7 +1086,7 @@ affected_mob.adjustBruteLoss(-1 * REM * seconds_per_tick, FALSE, required_bodytype = affected_bodytype) affected_mob.adjustFireLoss(-1 * REM * seconds_per_tick, FALSE, required_bodytype = affected_bodytype) affected_mob.AdjustAllImmobility(-60 * REM * seconds_per_tick) - affected_mob.stamina.adjust(5 * REM * seconds_per_tick, TRUE) + affected_mob.stamina.adjust(10 * REM * seconds_per_tick, TRUE) ..() . = TRUE @@ -1294,12 +1296,12 @@ /datum/reagent/medicine/changelingadrenaline/on_mob_metabolize(mob/living/affected_mob) ..() - affected_mob.add_traits(list(TRAIT_SLEEPIMMUNE, TRAIT_BATON_RESISTANCE), type) + affected_mob.add_traits(list(TRAIT_SLEEPIMMUNE, TRAIT_BATON_RESISTANCE, TRAIT_CANT_STAMCRIT), type) affected_mob.add_movespeed_mod_immunities(type, /datum/movespeed_modifier/damage_slowdown) /datum/reagent/medicine/changelingadrenaline/on_mob_end_metabolize(mob/living/affected_mob) ..() - affected_mob.remove_traits(list(TRAIT_SLEEPIMMUNE, TRAIT_BATON_RESISTANCE), type) + affected_mob.remove_traits(list(TRAIT_SLEEPIMMUNE, TRAIT_BATON_RESISTANCE, TRAIT_CANT_STAMCRIT), type) affected_mob.remove_movespeed_mod_immunities(type, /datum/movespeed_modifier/damage_slowdown) affected_mob.remove_status_effect(/datum/status_effect/dizziness) affected_mob.remove_status_effect(/datum/status_effect/jitter) diff --git a/monkestation/code/datums/stamina_container.dm b/monkestation/code/datums/stamina_container.dm index 60c948b2d218..4be931363d8d 100644 --- a/monkestation/code/datums/stamina_container.dm +++ b/monkestation/code/datums/stamina_container.dm @@ -86,3 +86,17 @@ /// Revitalize the stamina to the maximum this container can have. /datum/stamina_container/proc/revitalize(forced = FALSE) return adjust(maximum, forced) + +/datum/stamina_container/proc/adjust_to(amount, lowest_stamina_value, forced = FALSE) + if((!amount || !COOLDOWN_FINISHED(src, stamina_grace_period)) && !forced) + return + + var/stamina_after_loss = current + amount + if(stamina_after_loss < lowest_stamina_value) + amount = current - lowest_stamina_value + + current = round(clamp(current + amount, 0, maximum), DAMAGE_PRECISION) + update() + if((amount < 0) && is_regenerating) + pause(STAMINA_REGEN_TIME) + return amount