Skip to content

Commit

Permalink
Fix EOC test that expected alcohol to be consumed instantly
Browse files Browse the repository at this point in the history
  • Loading branch information
ZeroInternalReflection committed Mar 4, 2024
1 parent 717630e commit 5f216d4
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 5 deletions.
12 changes: 9 additions & 3 deletions data/mods/TEST_DATA/EOC.json
Original file line number Diff line number Diff line change
Expand Up @@ -284,15 +284,21 @@
},
{
"type": "effect_on_condition",
"id": "EOC_math_addiction",
"id": "EOC_math_addiction_setup",
"effect": [
{ "set_string_var": "caffeine", "target_var": { "global_val": "add_id" } },
{ "u_spawn_item": "backpack", "force_equip": true },
{ "u_spawn_item": "test_whiskey_caffenated", "container": "bottle_glass" },
{
"u_run_inv_eocs": "all",
"true_eocs": [ { "id": "EOC_math_addiction_nested", "effect": [ { "u_activate": "ALCOHOL" } ] } ]
},
}
]
},
{
"type": "effect_on_condition",
"id": "EOC_math_addiction_check",
"effect": [
{ "set_string_var": "caffeine", "target_var": { "global_val": "add_id" } },
{ "math": [ "key_add_intensity", "=", "u_addiction_intensity(add_id)" ] },
{ "math": [ "key_add_turn", "=", "u_addiction_turns(add_id)" ] }
]
Expand Down
11 changes: 9 additions & 2 deletions tests/eoc_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,9 @@ effect_on_condition_EOC_martial_art_test_1( "EOC_martial_art_test_1" );
static const effect_on_condition_id
effect_on_condition_EOC_martial_art_test_2( "EOC_martial_art_test_2" );
static const effect_on_condition_id
effect_on_condition_EOC_math_addiction( "EOC_math_addiction" );
effect_on_condition_EOC_math_addiction_setup( "EOC_math_addiction_setup" );
static const effect_on_condition_id
effect_on_condition_EOC_math_addiction_check( "EOC_math_addiction_check" );
static const effect_on_condition_id
effect_on_condition_EOC_math_armor( "EOC_math_armor" );
static const effect_on_condition_id
Expand Down Expand Up @@ -444,7 +446,12 @@ TEST_CASE( "EOC_math_addiction", "[eoc][math_parser]" )

REQUIRE( globvars.get_global_value( "npctalk_var_key_add_intensity" ).empty() );
REQUIRE( globvars.get_global_value( "npctalk_var_key_add_turn" ).empty() );
CHECK( effect_on_condition_EOC_math_addiction->activate( d ) );
CHECK( effect_on_condition_EOC_math_addiction_setup->activate( d ) );
// Finish drinking
complete_activity( get_avatar() );

CHECK( effect_on_condition_EOC_math_addiction_check->activate( d ) );

CHECK( globvars.get_global_value( "npctalk_var_key_add_intensity" ) == "1" );
CHECK( globvars.get_global_value( "npctalk_var_key_add_turn" ) == "3600" );
}
Expand Down

0 comments on commit 5f216d4

Please sign in to comment.