From 5b4616b5988c04732245e5955b9c0305678a1a57 Mon Sep 17 00:00:00 2001 From: Procyonae <45432782+Procyonae@users.noreply.github.com> Date: Fri, 31 May 2024 20:44:28 +0100 Subject: [PATCH 1/6] Add npc_loc_relative Renames loc_relative_u to u_loc_relative in line with every other EoC thing --- data/json/effects_on_condition/example_eocs.json | 12 ++++++------ data/mods/TEST_DATA/EOC.json | 6 +++--- .../mutations/paraclesians/homullus_eocs.json | 4 ++-- .../homullus_spell_learning_eocs.json | 4 ++-- .../paraclesians/paraclesian_fae_bans.json | 4 ++-- src/condition.cpp | 16 +++++++++------- 6 files changed, 24 insertions(+), 22 deletions(-) diff --git a/data/json/effects_on_condition/example_eocs.json b/data/json/effects_on_condition/example_eocs.json index 8249500cbcdc6..2d4251a3cb296 100644 --- a/data/json/effects_on_condition/example_eocs.json +++ b/data/json/effects_on_condition/example_eocs.json @@ -186,7 +186,7 @@ "type": "effect_on_condition", "id": "EOC_map_item_test2", "effect": [ - { "set_string_var": { "mutator": "loc_relative_u", "target": "(0,1,0)" }, "target_var": { "context_val": "loc" } }, + { "set_string_var": { "mutator": "u_loc_relative", "target": "(0,1,0)" }, "target_var": { "context_val": "loc" } }, { "map_spawn_item": "bottle_plastic", "loc": { "context_val": "loc" } } ] }, @@ -195,12 +195,12 @@ "id": "EOC_map_condition_test", "effect": [ { - "if": { "map_in_city": { "mutator": "loc_relative_u", "target": "(0,0,0)" } }, + "if": { "map_in_city": { "mutator": "u_loc_relative", "target": "(0,0,0)" } }, "then": { "u_message": "Inside city" }, "else": { "u_message": "Outside city" } }, { - "set_string_var": { "mutator": "loc_relative_u", "target": "(0,-1,0)" }, + "set_string_var": { "mutator": "u_loc_relative", "target": "(0,-1,0)" }, "target_var": { "context_val": "loc" } }, { @@ -214,7 +214,7 @@ "else": { "u_message": "North furniture: Not TRANSPARENT" } }, { - "set_string_var": { "mutator": "loc_relative_u", "target": "(1,0,0)" }, + "set_string_var": { "mutator": "u_loc_relative", "target": "(1,0,0)" }, "target_var": { "context_val": "loc" } }, { @@ -228,7 +228,7 @@ "else": { "u_message": "East furniture: Not TRANSPARENT" } }, { - "set_string_var": { "mutator": "loc_relative_u", "target": "(0,1,0)" }, + "set_string_var": { "mutator": "u_loc_relative", "target": "(0,1,0)" }, "target_var": { "context_val": "loc" } }, { @@ -242,7 +242,7 @@ "else": { "u_message": "South furniture: Not TRANSPARENT" } }, { - "set_string_var": { "mutator": "loc_relative_u", "target": "(-1,0,0)" }, + "set_string_var": { "mutator": "u_loc_relative", "target": "(-1,0,0)" }, "target_var": { "context_val": "loc" } }, { diff --git a/data/mods/TEST_DATA/EOC.json b/data/mods/TEST_DATA/EOC.json index a0dfeecaff234..3dda3c024df7e 100644 --- a/data/mods/TEST_DATA/EOC.json +++ b/data/mods/TEST_DATA/EOC.json @@ -273,7 +273,7 @@ "type": "effect_on_condition", "id": "EOC_try_kill", "effect": [ - { "set_string_var": { "mutator": "loc_relative_u", "target": "(0,1,0)" }, "target_var": { "context_val": "kill_loc" } }, + { "set_string_var": { "mutator": "u_loc_relative", "target": "(0,1,0)" }, "target_var": { "context_val": "kill_loc" } }, { "run_eoc_with": "EOC_kill", "beta_loc": { "context_val": "kill_loc" } } ] }, @@ -313,7 +313,7 @@ { "set_string_var": "fd_blood", "target_var": { "global_val": "field_id_1" } }, { "set_string_var": "fd_blood_insect", "target_var": { "global_val": "field_id_2" } }, { - "set_string_var": { "mutator": "loc_relative_u", "target": "(0,1,0)" }, + "set_string_var": { "mutator": "u_loc_relative", "target": "(0,1,0)" }, "target_var": { "global_val": "loc" } }, { "math": [ "key_field_strength", "=", "u_field_strength(field_id_1)" ] }, @@ -803,7 +803,7 @@ "type": "effect_on_condition", "id": "EOC_map_test", "effect": [ - { "set_string_var": { "mutator": "loc_relative_u", "target": "(10,10,0)" }, "target_var": { "context_val": "loc" } }, + { "set_string_var": { "mutator": "u_loc_relative", "target": "(10,10,0)" }, "target_var": { "context_val": "loc" } }, { "math": [ "key_distance_loc", "=", "distance('u', _loc)" ] }, { "math": [ "key_distance_npc", "=", "distance('u', 'npc')" ] } ] diff --git a/data/mods/Xedra_Evolved/mutations/paraclesians/homullus_eocs.json b/data/mods/Xedra_Evolved/mutations/paraclesians/homullus_eocs.json index 561e30fa7840d..1a4619a1c6680 100644 --- a/data/mods/Xedra_Evolved/mutations/paraclesians/homullus_eocs.json +++ b/data/mods/Xedra_Evolved/mutations/paraclesians/homullus_eocs.json @@ -142,7 +142,7 @@ "id": "EOC_HOMULLUS_GOBLIN_FRUIT", "effect": [ { - "set_string_var": { "mutator": "loc_relative_u", "target": "(0,0,0)" }, + "set_string_var": { "mutator": "u_loc_relative", "target": "(0,0,0)" }, "target_var": { "context_val": "homullus_location" } }, { @@ -158,7 +158,7 @@ { "u_near_om_location": "ranch_camp_41", "range": 3 }, { "u_near_om_location": "godco_5", "range": 3 }, { "u_at_om_location": "FACTION_CAMP_ANY" }, - { "map_in_city": { "mutator": "loc_relative_u", "target": "(0,0,0)" } } + { "map_in_city": { "mutator": "u_loc_relative", "target": "(0,0,0)" } } ] }, "effect": [ { "u_cast_spell": { "id": "cultivate_goblin_fruit_real" } } ], diff --git a/data/mods/Xedra_Evolved/mutations/paraclesians/homullus_spell_learning_eocs.json b/data/mods/Xedra_Evolved/mutations/paraclesians/homullus_spell_learning_eocs.json index 448d08415c0c3..4811fd10cced0 100644 --- a/data/mods/Xedra_Evolved/mutations/paraclesians/homullus_spell_learning_eocs.json +++ b/data/mods/Xedra_Evolved/mutations/paraclesians/homullus_spell_learning_eocs.json @@ -26,7 +26,7 @@ "deactivate_condition": { "not": { "u_has_trait": "HOMULLUS" } }, "effect": [ { - "set_string_var": { "mutator": "loc_relative_u", "target": "(0,0,0)" }, + "set_string_var": { "mutator": "u_loc_relative", "target": "(0,0,0)" }, "target_var": { "context_val": "homullus_location" } }, { @@ -46,7 +46,7 @@ { "u_at_om_location": "homullus_genius_loci_NE" }, { "u_at_om_location": "homullus_genius_loci_SW" }, { "u_at_om_location": "homullus_genius_loci_SE" }, - { "map_in_city": { "mutator": "loc_relative_u", "target": "(0,0,0)" } } + { "map_in_city": { "mutator": "u_loc_relative", "target": "(0,0,0)" } } ] }, "effect": [ { "run_eocs": "EOC_HOMULLUS_SPELL_EXPERIENCE_INCREASER_SELECTOR" } ] diff --git a/data/mods/Xedra_Evolved/mutations/paraclesians/paraclesian_fae_bans.json b/data/mods/Xedra_Evolved/mutations/paraclesians/paraclesian_fae_bans.json index 1b550ad26212a..3fc987aeacbee 100644 --- a/data/mods/Xedra_Evolved/mutations/paraclesians/paraclesian_fae_bans.json +++ b/data/mods/Xedra_Evolved/mutations/paraclesians/paraclesian_fae_bans.json @@ -74,7 +74,7 @@ "condition": { "u_has_trait": "THRESH_ARVORE" }, "effect": [ { - "set_string_var": { "mutator": "loc_relative_u", "target": "(0,0,0)" }, + "set_string_var": { "mutator": "u_loc_relative", "target": "(0,0,0)" }, "target_var": { "context_val": "arvore_location" } }, { @@ -89,7 +89,7 @@ { "u_near_om_location": "isolated_road_field_0", "range": 2 }, { "u_near_om_location": "ranch_camp_41", "range": 3 }, { "u_near_om_location": "godco_5", "range": 3 }, - { "map_in_city": { "mutator": "loc_relative_u", "target": "(0,0,0)" } } + { "map_in_city": { "mutator": "u_loc_relative", "target": "(0,0,0)" } } ] }, "effect": [ diff --git a/src/condition.cpp b/src/condition.cpp index 986a25f7f0050..06cb2af065e9a 100644 --- a/src/condition.cpp +++ b/src/condition.cpp @@ -1945,17 +1945,18 @@ template static std::function get_get_str_( const JsonObject &jo, std::function ret_func ) { - if( jo.get_string( "mutator" ) == "mon_faction" ) { + const std::string &mutator = jo.get_string( "mutator" ); + if( mutator == "mon_faction" ) { str_or_var mtypeid = get_str_or_var( jo.get_member( "mtype_id" ), "mtype_id" ); return [mtypeid, ret_func]( const dialogue & d ) { return ret_func( ( static_cast( mtypeid.evaluate( d ) ) )->default_faction.str() ); }; - } else if( jo.get_string( "mutator" ) == "game_option" ) { + } else if( mutator == "game_option" ) { str_or_var option = get_str_or_var( jo.get_member( "option" ), "option" ); return [option, ret_func]( const dialogue & d ) { return ret_func( get_option( option.evaluate( d ) ) ); }; - } else if( jo.get_string( "mutator" ) == "valid_technique" ) { + } else if( mutator == "valid_technique" ) { std::vector blacklist; if( jo.has_array( "blacklist" ) ) { for( const JsonValue &jv : jo.get_array( "blacklist" ) ) { @@ -1976,14 +1977,15 @@ static std::function get_get_str_( const JsonObject &jo, return ret_func( d.actor( false )->get_random_technique( *d.actor( true )->get_creature(), crit, dodge_counter, block_counter, bl ).str() ); }; - } else if( jo.get_string( "mutator" ) == "loc_relative_u" ) { + } else if( mutator == "u_loc_relative" || mutator == "npc_loc_relative" ) { str_or_var target = get_str_or_var( jo.get_member( "target" ), "target" ); - return [target, ret_func]( const dialogue & d ) { - tripoint_abs_ms char_pos = get_map().getglobal( d.actor( false )->pos() ); + bool use_beta_talker = mutator == "npc_loc_relative"; + return [target, use_beta_talker, ret_func]( const dialogue & d ) { + tripoint_abs_ms char_pos = get_map().getglobal( d.actor( use_beta_talker )->pos() ); tripoint_abs_ms target_pos = char_pos + tripoint::from_string( target.evaluate( d ) ); return ret_func( target_pos.to_string() ); }; - } else if( jo.get_string( "mutator" ) == "topic_item" ) { + } else if( mutator == "topic_item" ) { return [ret_func]( const dialogue & d ) { return ret_func( d.cur_item.str() ); }; From 43f7c05526c2d402d564316b278723c2688fc97a Mon Sep 17 00:00:00 2001 From: Procyonae <45432782+Procyonae@users.noreply.github.com> Date: Fri, 31 May 2024 20:51:00 +0100 Subject: [PATCH 2/6] Correct and update docs --- doc/EFFECT_ON_CONDITION.md | 6 +++--- doc/NPCs.md | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/doc/EFFECT_ON_CONDITION.md b/doc/EFFECT_ON_CONDITION.md index 9ae57378b0553..a0c554e53acb0 100644 --- a/doc/EFFECT_ON_CONDITION.md +++ b/doc/EFFECT_ON_CONDITION.md @@ -1017,7 +1017,7 @@ Check the north terrain or furniture has `TRANSPARENT` flag. "type": "effect_on_condition", "id": "EOC_ter_furn_check", "effect": [ - { "set_string_var": { "mutator": "loc_relative_u", "target": "(0,-1,0)" }, "target_var": { "context_val": "loc" } }, + { "set_string_var": { "mutator": "u_loc_relative", "target": "(0,-1,0)" }, "target_var": { "context_val": "loc" } }, { "if": { "map_terrain_with_flag": "TRANSPARENT", "loc": { "context_val": "loc" } }, "then": { "u_message": "North terrain: TRANSPARENT" }, @@ -3587,8 +3587,8 @@ Spawn a plastic bottle on ground "type": "effect_on_condition", "id": "EOC_map_spawn_item", "effect": [ - { "set_string_var": { "mutator": "loc_relative_u", "target": "(0,1,0)" }, "target_var": { "context_val": "loc" } }, - { "map_spawn_item": "bottle_plastic", "loc": { "mutator": "loc_relative_u", "target": "(0,1,0)" } } + { "set_string_var": { "mutator": "u_loc_relative", "target": "(0,1,0)" }, "target_var": { "context_val": "loc" } }, + { "map_spawn_item": "bottle_plastic", "loc": { "mutator": "u_loc_relative", "target": "(0,1,0)" } } ] }, ``` diff --git a/doc/NPCs.md b/doc/NPCs.md index 8a2fb034e04b7..b4ea38878377b 100644 --- a/doc/NPCs.md +++ b/doc/NPCs.md @@ -1208,7 +1208,7 @@ Mutator Name | Required Keys | Description `"ma_technique_name"` | `matec_id`: String or [variable object](#variable-object). | Returns the name of the martial arts tech with ID `matec_id` `"ma_technique_description"` | `matec_id`: String or [variable object](#variable-object). | Returns the description of the martial arts tech with ID `matec_id` `"valid_technique`" | `blacklist`: array of String or [variable object](#variable-object).
`crit`: bool
`dodge_counter`: bool
`block_counter`: bool | Returns a random valid technique for the alpha talker to use against the beta talker with the provided specifications. -`"loc_relative_u"` | `target`: String or [variable object](#variable-object). | target should be a string like "(x,y,z)" where x,y,z are coordinates relative to the player. Returns the abs_ms coordinates as a string (ready to store as a location variable), in the form "(x,y,z)" of the provided point relative to the player. So `"target":"(0,1,0)"` would return the point south of the player. +`"u_/npc_loc_relative"` | `target`: String or [variable object](#variable-object). | target should be a string like "(x,y,z)" where x,y,z are coordinates relative to the player. Returns the abs_ms coordinates as a string (ready to store as a location variable), in the form "(x,y,z)" of the provided point relative to the alpha/beta talker respectively. So `"target":"(0,1,0)"` would return the point south of the talker. `"topic_item"` | | Returns current topic_item as a string. See [Repeat Responses](#repeat-responses) ### Math From 8c1877c057d0ad24898d2dded568b985855065e1 Mon Sep 17 00:00:00 2001 From: GuardianDll Date: Fri, 26 Jul 2024 18:43:06 +0200 Subject: [PATCH 3/6] catchup newly added uses of loc_relative --- .../Xedra_Evolved/mutations/paraclesians/homullus_eocs.json | 2 +- .../mutations/paraclesians/paraclesian_fae_bans.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/data/mods/Xedra_Evolved/mutations/paraclesians/homullus_eocs.json b/data/mods/Xedra_Evolved/mutations/paraclesians/homullus_eocs.json index 5d5a91b21f986..4e5d54ba03c84 100644 --- a/data/mods/Xedra_Evolved/mutations/paraclesians/homullus_eocs.json +++ b/data/mods/Xedra_Evolved/mutations/paraclesians/homullus_eocs.json @@ -14,7 +14,7 @@ "or": [ { "test_eoc": "EOC_CONDITION_HOMULLUS_NEAR_FACTION" }, { "u_near_om_location": "FACTION_CAMP_ANY", "range": 2 }, - { "map_in_city": { "mutator": "loc_relative_u", "target": "(0,0,0)" } } + { "map_in_city": { "mutator": "u_loc_relative", "target": "(0,0,0)" } } ] }, "effect": [ { "math": [ "u_homullus_is_in_civilization", "=", "1" ] } ], diff --git a/data/mods/Xedra_Evolved/mutations/paraclesians/paraclesian_fae_bans.json b/data/mods/Xedra_Evolved/mutations/paraclesians/paraclesian_fae_bans.json index 508cf21ba64d4..0d12f20bf29ad 100644 --- a/data/mods/Xedra_Evolved/mutations/paraclesians/paraclesian_fae_bans.json +++ b/data/mods/Xedra_Evolved/mutations/paraclesians/paraclesian_fae_bans.json @@ -77,7 +77,7 @@ { "or": [ { "test_eoc": "EOC_CONDITION_HOMULLUS_NEAR_FACTION" }, - { "map_in_city": { "mutator": "loc_relative_u", "target": "(0,0,0)" } } + { "map_in_city": { "mutator": "u_loc_relative", "target": "(0,0,0)" } } ] } ] From 3a37f5431262d08ba771f9c628eb50aaedc74f9d Mon Sep 17 00:00:00 2001 From: GuardianDll Date: Fri, 26 Jul 2024 18:43:31 +0200 Subject: [PATCH 4/6] expand EOC_map_test to test npc_loc_relative also --- data/mods/TEST_DATA/EOC.json | 11 +++++++++-- tests/eoc_test.cpp | 2 ++ 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/data/mods/TEST_DATA/EOC.json b/data/mods/TEST_DATA/EOC.json index 3dda3c024df7e..d9ef16615d416 100644 --- a/data/mods/TEST_DATA/EOC.json +++ b/data/mods/TEST_DATA/EOC.json @@ -803,8 +803,15 @@ "type": "effect_on_condition", "id": "EOC_map_test", "effect": [ - { "set_string_var": { "mutator": "u_loc_relative", "target": "(10,10,0)" }, "target_var": { "context_val": "loc" } }, - { "math": [ "key_distance_loc", "=", "distance('u', _loc)" ] }, + { + "set_string_var": { "mutator": "u_loc_relative", "target": "(10,10,0)" }, + "target_var": { "global_val": "map_test_loc_a" } + }, + { + "set_string_var": { "mutator": "npc_loc_relative", "target": "(0,0,0)" }, + "target_var": { "global_val": "map_test_loc_b" } + }, + { "math": [ "key_distance_loc", "=", "distance('u', map_test_loc_a)" ] }, { "math": [ "key_distance_npc", "=", "distance('u', 'npc')" ] } ] }, diff --git a/tests/eoc_test.cpp b/tests/eoc_test.cpp index 4582ddfce7808..3f12cf08a8a83 100644 --- a/tests/eoc_test.cpp +++ b/tests/eoc_test.cpp @@ -1278,6 +1278,8 @@ TEST_CASE( "EOC_map_test", "[eoc]" ) CHECK( effect_on_condition_EOC_map_test->activate( d ) ); CHECK( globvars.get_global_value( "npctalk_var_key_distance_loc" ) == "14" ); CHECK( globvars.get_global_value( "npctalk_var_key_distance_npc" ) == "10" ); + CHECK( globvars.get_global_value( "npctalk_var_map_test_loc_a" ) == "(70,70,0)"); + CHECK( globvars.get_global_value( "npctalk_var_map_test_loc_b" ) == "(70,60,0)"); } TEST_CASE( "EOC_martial_art_test", "[eoc]" ) From b445a1aa941c37a1c1a3e81abf21385c407074db Mon Sep 17 00:00:00 2001 From: GuardianDll Date: Fri, 26 Jul 2024 22:44:25 +0200 Subject: [PATCH 5/6] revert changes in EOC_map_test, implement EOC_loc_relative_test --- data/mods/TEST_DATA/EOC.json | 13 ++++++-- .../homullus_spell_learning_eocs.json | 2 +- tests/eoc_test.cpp | 32 +++++++++++++++++-- 3 files changed, 41 insertions(+), 6 deletions(-) diff --git a/data/mods/TEST_DATA/EOC.json b/data/mods/TEST_DATA/EOC.json index d9ef16615d416..b41904f8da30d 100644 --- a/data/mods/TEST_DATA/EOC.json +++ b/data/mods/TEST_DATA/EOC.json @@ -802,6 +802,15 @@ { "type": "effect_on_condition", "id": "EOC_map_test", + "effect": [ + { "set_string_var": { "mutator": "u_loc_relative", "target": "(10,10,0)" }, "target_var": { "context_val": "loc" } }, + { "math": [ "key_distance_loc", "=", "distance('u', _loc)" ] }, + { "math": [ "key_distance_npc", "=", "distance('u', 'npc')" ] } + ] + }, + { + "type": "effect_on_condition", + "id": "EOC_loc_relative_test", "effect": [ { "set_string_var": { "mutator": "u_loc_relative", "target": "(10,10,0)" }, @@ -810,9 +819,7 @@ { "set_string_var": { "mutator": "npc_loc_relative", "target": "(0,0,0)" }, "target_var": { "global_val": "map_test_loc_b" } - }, - { "math": [ "key_distance_loc", "=", "distance('u', map_test_loc_a)" ] }, - { "math": [ "key_distance_npc", "=", "distance('u', 'npc')" ] } + } ] }, { diff --git a/data/mods/Xedra_Evolved/mutations/paraclesians/homullus_spell_learning_eocs.json b/data/mods/Xedra_Evolved/mutations/paraclesians/homullus_spell_learning_eocs.json index 28dc4f98cdd47..9e988a1024b15 100644 --- a/data/mods/Xedra_Evolved/mutations/paraclesians/homullus_spell_learning_eocs.json +++ b/data/mods/Xedra_Evolved/mutations/paraclesians/homullus_spell_learning_eocs.json @@ -33,7 +33,7 @@ "or": [ { "test_eoc": "EOC_CONDITION_HOMULLUS_NEAR_FACTION" }, { "u_near_om_location": "FACTION_CAMP_ANY", "range": 2 }, - { "map_in_city": { "mutator": "loc_relative_u", "target": "(0,0,0)" } } + { "map_in_city": { "mutator": "u_loc_relative", "target": "(0,0,0)" } } ] }, "effect": [ { "run_eocs": "EOC_HOMULLUS_SPELL_EXPERIENCE_INCREASER_SELECTOR" } ] diff --git a/tests/eoc_test.cpp b/tests/eoc_test.cpp index 3f12cf08a8a83..141e26c926693 100644 --- a/tests/eoc_test.cpp +++ b/tests/eoc_test.cpp @@ -39,6 +39,8 @@ static const effect_on_condition_id effect_on_condition_EOC_item_teleport_test( "EOC_item_teleport_test" ); static const effect_on_condition_id effect_on_condition_EOC_jmath_test( "EOC_jmath_test" ); +static const effect_on_condition_id +effect_on_condition_EOC_loc_relative_test( "EOC_loc_relative_test" ); static const effect_on_condition_id effect_on_condition_EOC_map_test( "EOC_map_test" ); static const effect_on_condition_id effect_on_condition_EOC_martial_art_test_1( "EOC_martial_art_test_1" ); @@ -1278,8 +1280,34 @@ TEST_CASE( "EOC_map_test", "[eoc]" ) CHECK( effect_on_condition_EOC_map_test->activate( d ) ); CHECK( globvars.get_global_value( "npctalk_var_key_distance_loc" ) == "14" ); CHECK( globvars.get_global_value( "npctalk_var_key_distance_npc" ) == "10" ); - CHECK( globvars.get_global_value( "npctalk_var_map_test_loc_a" ) == "(70,70,0)"); - CHECK( globvars.get_global_value( "npctalk_var_map_test_loc_b" ) == "(70,60,0)"); +} + +TEST_CASE( "EOC_loc_relative_test", "[eoc]" ) +{ + global_variables &globvars = get_globals(); + globvars.clear_global_values(); + clear_avatar(); + clear_map(); + + map &m = get_map(); + g->place_player( tripoint_zero ); + + const tripoint_abs_ms start = get_avatar().get_location(); + const tripoint tgt = m.getlocal( start + tripoint_north ); + m.furn_set( tgt, furn_test_f_eoc ); + m.furn( tgt )->examine( get_avatar(), tgt ); + + const tripoint target_pos = get_avatar().pos() + point_east * 10; + npc &npc_dst = spawn_npc( target_pos.xy(), "thug" ); + dialogue d( get_talker_for( get_avatar() ), get_talker_for( npc_dst ) ); + + CHECK( effect_on_condition_EOC_loc_relative_test->activate( d ) ); + tripoint_abs_ms tmp_abs_a = tripoint_abs_ms( tripoint::from_string( + globvars.get_global_value( "npctalk_var_map_test_loc_a" ) ) ); + tripoint_abs_ms tmp_abs_b = tripoint_abs_ms( tripoint::from_string( + globvars.get_global_value( "npctalk_var_map_test_loc_b" ) ) ); + CHECK( m.getlocal( tmp_abs_a ) == tripoint( 70, 70, 0 ) ); + CHECK( m.getlocal( tmp_abs_b ) == tripoint( 70, 60, 0 ) ); } TEST_CASE( "EOC_martial_art_test", "[eoc]" ) From 2e6b1e30c369a3bd1186c17f5644c7d360f58482 Mon Sep 17 00:00:00 2001 From: GuardianDll Date: Sat, 27 Jul 2024 17:46:31 +0200 Subject: [PATCH 6/6] Clean after the test in attempt to please tests --- tests/eoc_test.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tests/eoc_test.cpp b/tests/eoc_test.cpp index 141e26c926693..4d7f9b44b2fe3 100644 --- a/tests/eoc_test.cpp +++ b/tests/eoc_test.cpp @@ -1308,6 +1308,10 @@ TEST_CASE( "EOC_loc_relative_test", "[eoc]" ) globvars.get_global_value( "npctalk_var_map_test_loc_b" ) ) ); CHECK( m.getlocal( tmp_abs_a ) == tripoint( 70, 70, 0 ) ); CHECK( m.getlocal( tmp_abs_b ) == tripoint( 70, 60, 0 ) ); + + globvars.clear_global_values(); + clear_avatar(); + clear_map(); } TEST_CASE( "EOC_martial_art_test", "[eoc]" )