From 6f6ec555fb1b2362da5111da2aae09166eaac27b Mon Sep 17 00:00:00 2001 From: Bloop <13398309+vinylspiders@users.noreply.github.com> Date: Fri, 14 Jun 2024 01:47:51 -0400 Subject: [PATCH] Small adjustment to the new stamcrit unit test (#83931) ## About The Pull Request Not all downstreams have 100 hp as `maxHealth`, so this makes the test work in those cases by no longer having it be hardcoded. ## Why It's Good For The Game More universal unit tests. ## Changelog Nothing player facing. --- code/modules/unit_tests/combat_stamina.dm | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/code/modules/unit_tests/combat_stamina.dm b/code/modules/unit_tests/combat_stamina.dm index fa0b6b4219b..7c84f8281ae 100644 --- a/code/modules/unit_tests/combat_stamina.dm +++ b/code/modules/unit_tests/combat_stamina.dm @@ -5,10 +5,11 @@ /datum/unit_test/stamcrit/Run() var/mob/living/carbon/human/consistent/tider = allocate(__IMPLIED_TYPE__) tider.stamina_regen_time = 0.2 SECONDS - tider.adjustStaminaLoss(99) - TEST_ASSERT(!tider.has_status_effect(/datum/status_effect/incapacitating/stamcrit), "Stamcrit should not be applied at 99 stamina damage") + var/stamloss_to_reach_crit_threshold = tider.maxHealth + tider.adjustStaminaLoss(stamloss_to_reach_crit_threshold - 1) + TEST_ASSERT(!tider.has_status_effect(/datum/status_effect/incapacitating/stamcrit), "Stamcrit should not be applied at [stamloss_to_reach_crit_threshold - 1] stamina damage") tider.adjustStaminaLoss(1) - TEST_ASSERT(tider.has_status_effect(/datum/status_effect/incapacitating/stamcrit), "Stamcrit should be applied at 100 stamina damage") + TEST_ASSERT(tider.has_status_effect(/datum/status_effect/incapacitating/stamcrit), "Stamcrit should be applied at [stamloss_to_reach_crit_threshold] stamina damage") sleep(tider.stamina_regen_time * 2) TEST_ASSERT(!tider.has_status_effect(/datum/status_effect/incapacitating/stamcrit), "Stamcrit should be removed after regen time")