mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2025-12-10 09:42:29 +00:00
## 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.
26 lines
1.3 KiB
Plaintext
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")
|