Skip to content

Commit

Permalink
tests: Comments, minmaxing section
Browse files Browse the repository at this point in the history
  • Loading branch information
wapcaplet committed Dec 20, 2021
1 parent 89b54b6 commit 957b591
Showing 1 changed file with 55 additions and 6 deletions.
61 changes: 55 additions & 6 deletions tests/cardio_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,21 @@ static int running_turns( Character &they )
// + 10 * [ Athletics skill ]
//
// For NPCs (having no cardio), the formula is simply 2 * BMR.


// Trait Modifiers
// ---------------
// There are at least two ways mutations/traits can influence cardio fitness level:
//
// - Using "cardio_multiplier" to affect cardio level directly
// - Affecting total body size, which affects base BMR and thus cardio
//
// Being SMALL or having a trait with cardio_multiplier less than 1 reduces cardio,
// meaning Tiny, Little, and Languorous characters cannot run as far.
//
// Conversely, being LARGE or having cardio_multiplier greater than 1 increases cardio,
// meaning Inconveniently Large, Freakishly Huge, Indefatigable, and Hyperactive
// characters can run longer before their stamina gives out.
//
TEST_CASE( "traits affecting cardio fitness level", "[cardio][fitness][traits]" )
{
Expand Down Expand Up @@ -166,48 +181,82 @@ TEST_CASE( "traits affecting cardio fitness level", "[cardio][fitness][traits]"
// Body size affects BMR, which in turn affects cardio fitness and stamina
SECTION( "smaller or larger body size from mutation" ) {
// Tiny (SMALL2)
GIVEN( "small body size" ) {
GIVEN( "Tiny (SMALL2) body size" ) {
set_single_trait( they, "SMALL2" );
REQUIRE( they.get_size() == creature_size::tiny );
REQUIRE( they.base_bmr() == 439 );
CHECK( they.get_cardiofit() == 1088 );
CHECK( they.get_stamina_max() == 6764 );
THEN( "they can run for 45 turns" ) {
CHECK( running_turns( they ) == 45 );
}
}

// Little (SMALL)
GIVEN( "tiny body size" ) {
GIVEN( "Little (SMALL) body size" ) {
set_single_trait( they, "SMALL" );
REQUIRE( they.get_size() == creature_size::small );
REQUIRE( they.base_bmr() == 1014 );
CHECK( they.get_cardiofit() == 1376 );
CHECK( they.get_stamina_max() == 7628 );
THEN( "they can run for 51 turns" ) {
CHECK( running_turns( they ) == 51 );
}
}

// No size mutations - default avatar with medium body size
GIVEN( "medium body size" ) {
GIVEN( "Normal medium body size" ) {
clear_avatar();
REQUIRE( they.get_size() == creature_size::medium );
REQUIRE( they.base_bmr() == base_bmr );
CHECK( they.get_cardiofit() == base_bmr );
CHECK( they.get_stamina_max() == base_stamina );
THEN( "they can run for 58 turns" ) {
CHECK( running_turns( they ) == 58 );
}
}

// Large (LARGE)
GIVEN( "large body size" ) {
// Inconveniently Large (LARGE)
GIVEN( "Inconveniently Large (LARGE) body size" ) {
set_single_trait( they, "LARGE" );
REQUIRE( they.get_size() == creature_size::large );
REQUIRE( they.base_bmr() == 2586 );
CHECK( they.get_cardiofit() == 2162 );
CHECK( they.get_stamina_max() == 9986 );
THEN( "they can run for 66 turns" ) {
CHECK( running_turns( they ) == 66 );
}
}

// Freakishly Huge (HUGE)
GIVEN( "huge body size" ) {
GIVEN( "Freakishly Huge (HUGE) body size" ) {
set_single_trait( they, "HUGE" );
REQUIRE( they.get_size() == creature_size::huge );
REQUIRE( they.base_bmr() == 3589 );
CHECK( they.get_cardiofit() == 2663 );
CHECK( they.get_stamina_max() == 11489 );
THEN( "they can run for 76 turns" ) {
CHECK( running_turns( they ) == 76 );
}
}
}

SECTION( "minmaxing mutations" ) {
GIVEN( "Tiny and Hyperactive" ) {
they.clear_mutations();
they.toggle_trait( trait_id( "SMALL2" ) );
they.toggle_trait( trait_id( "GOODCARDIO2" ) );
THEN( "they can run for 76 turns" ) {
CHECK( running_turns( they ) == 54 );
}
}
GIVEN( "Freakishly Huge and Hyperactive" ) {
they.clear_mutations();
they.toggle_trait( trait_id( "HUGE" ) );
they.toggle_trait( trait_id( "GOODCARDIO2" ) );
THEN( "they can run for 76 turns" ) {
CHECK( running_turns( they ) == 97 );
}
}
}
}
Expand Down

0 comments on commit 957b591

Please sign in to comment.