Files
Bubberstation/code/modules/unit_tests/combat_stamina.dm
SkyratBot 59069eac1e [MIRROR] Small adjustment to the new stamcrit unit test (#28169)
Small adjustment to the new stamcrit unit test

Co-authored-by: Bloop <13398309+vinylspiders@users.noreply.github.com>
Co-authored-by: Gandalf <9026500+Gandalf2k15@users.noreply.github.com>
2024-06-15 18:30:28 +01:00

26 lines
1.3 KiB
Plaintext

/// Tests 100 stamina damage = stamcrit
/datum/unit_test/stamcrit
priority = TEST_LONGER
/datum/unit_test/stamcrit/Run()
var/mob/living/carbon/human/consistent/tider = allocate(__IMPLIED_TYPE__)
tider.stamina_regen_time = 0.2 SECONDS
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 [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")
/// Tests stamina regen after the set time
/datum/unit_test/stam_regen
priority = TEST_LONGER
/datum/unit_test/stam_regen/Run()
var/mob/living/carbon/human/consistent/tider = allocate(__IMPLIED_TYPE__)
tider.stamina_regen_time = 0.2 SECONDS
tider.adjustStaminaLoss(50)
sleep(tider.stamina_regen_time * 2)
TEST_ASSERT_EQUAL(tider.getStaminaLoss(), 0, "Stamina should be fully regenerated after regen time")