diff --git a/data/json/effects_on_condition/misc_effect_on_condition.json b/data/json/effects_on_condition/misc_effect_on_condition.json index d07e955552a8b..66440e41c1d60 100644 --- a/data/json/effects_on_condition/misc_effect_on_condition.json +++ b/data/json/effects_on_condition/misc_effect_on_condition.json @@ -14,7 +14,7 @@ "id": "ambient_subway", "recurrence": [ "1 hours", "2 hours" ], "global": true, - "condition": { "or": [ { "u_at_om_location": "subway_ns" }, { "u_at_om_location": "subway_ew" } ] }, + "condition": { "u_at_om_location": "subway" }, "effect": [ { "u_message": "", "snippet": true, "sound": true } ] }, { @@ -22,7 +22,7 @@ "id": "ambient_lab_subway", "recurrence": [ "1 hours", "2 hours" ], "global": true, - "condition": { "or": [ { "u_at_om_location": "lab_subway_ns" }, { "u_at_om_location": "lab_subway_ew" } ] }, + "condition": { "u_at_om_location": "lab_subway" }, "effect": [ { "u_message": "", "snippet": true, "sound": true } ] }, { @@ -30,7 +30,7 @@ "id": "ambient_sewer", "recurrence": [ "1 hours", "2 hours" ], "global": true, - "condition": { "or": [ { "u_at_om_location": "sewer_ns" }, { "u_at_om_location": "sewer_ew" } ] }, + "condition": { "u_at_om_location": "sewer" }, "effect": [ { "u_message": "", "snippet": true, "sound": true } ] }, { @@ -133,7 +133,7 @@ "id": "sewer_morale_debuff", "global": false, "recurrence": [ "20 minutes", "1 hour" ], - "condition": { "or": [ { "u_at_om_location": "sewer_ns" }, { "u_at_om_location": "sewer_ew" } ] }, + "condition": { "u_at_om_location": "sewer" }, "effect": [ { "u_message": "", "snippet": true }, { diff --git a/data/mods/Magiclysm/Spells/druid.json b/data/mods/Magiclysm/Spells/druid.json index 0532dd1d66050..e82e14eee5ca3 100644 --- a/data/mods/Magiclysm/Spells/druid.json +++ b/data/mods/Magiclysm/Spells/druid.json @@ -568,16 +568,6 @@ { "u_is_on_terrain_with_flag": "YOUNG" } ] }, - { "not": { "u_near_om_location": "road_curved", "range": 1 } }, - { "not": { "u_near_om_location": "road_four_way", "range": 1 } }, - { "not": { "u_near_om_location": "road_tee", "range": 1 } }, - { "not": { "u_near_om_location": "road_straight", "range": 1 } }, - { "not": { "u_near_om_location": "road_end", "range": 1 } }, - { "not": { "u_near_om_location": "road_sw", "range": 1 } }, - { "not": { "u_near_om_location": "road_ne", "range": 1 } }, - { "not": { "u_near_om_location": "road_ew", "range": 1 } }, - { "not": { "u_near_om_location": "road_ns", "range": 1 } }, - { "not": { "u_near_om_location": "road_nesw", "range": 1 } }, { "not": { "u_near_om_location": "road", "range": 1 } } ] }, @@ -731,16 +721,6 @@ { "u_is_on_terrain_with_flag": "YOUNG" } ] }, - { "not": { "u_near_om_location": "road_curved", "range": 1 } }, - { "not": { "u_near_om_location": "road_four_way", "range": 1 } }, - { "not": { "u_near_om_location": "road_tee", "range": 1 } }, - { "not": { "u_near_om_location": "road_straight", "range": 1 } }, - { "not": { "u_near_om_location": "road_end", "range": 1 } }, - { "not": { "u_near_om_location": "road_sw", "range": 1 } }, - { "not": { "u_near_om_location": "road_ne", "range": 1 } }, - { "not": { "u_near_om_location": "road_ew", "range": 1 } }, - { "not": { "u_near_om_location": "road_ns", "range": 1 } }, - { "not": { "u_near_om_location": "road_nesw", "range": 1 } }, { "not": { "u_near_om_location": "road", "range": 1 } } ] }, @@ -1302,16 +1282,6 @@ { "u_is_on_terrain_with_flag": "YOUNG" } ] }, - { "not": { "u_near_om_location": "road_curved", "range": 1 } }, - { "not": { "u_near_om_location": "road_four_way", "range": 1 } }, - { "not": { "u_near_om_location": "road_tee", "range": 1 } }, - { "not": { "u_near_om_location": "road_straight", "range": 1 } }, - { "not": { "u_near_om_location": "road_end", "range": 1 } }, - { "not": { "u_near_om_location": "road_sw", "range": 1 } }, - { "not": { "u_near_om_location": "road_ne", "range": 1 } }, - { "not": { "u_near_om_location": "road_ew", "range": 1 } }, - { "not": { "u_near_om_location": "road_ns", "range": 1 } }, - { "not": { "u_near_om_location": "road_nesw", "range": 1 } }, { "not": { "u_near_om_location": "road", "range": 1 } } ] }, @@ -1341,21 +1311,7 @@ { "not": { "u_is_on_terrain_with_flag": "YOUNG" } } ] }, - { - "or": [ - { "u_near_om_location": "road_curved", "range": 1 }, - { "u_near_om_location": "road_four_way", "range": 1 }, - { "u_near_om_location": "road_tee", "range": 1 }, - { "u_near_om_location": "road_straight", "range": 1 }, - { "u_near_om_location": "road_end", "range": 1 }, - { "u_near_om_location": "road_sw", "range": 1 }, - { "u_near_om_location": "road_ne", "range": 1 }, - { "u_near_om_location": "road_ew", "range": 1 }, - { "u_near_om_location": "road_ns", "range": 1 }, - { "u_near_om_location": "road_nesw", "range": 1 }, - { "u_near_om_location": "road", "range": 1 } - ] - } + { "u_near_om_location": "road", "range": 1 } ] } ] diff --git a/data/mods/Magiclysm/Spells/mana_upgrades.json b/data/mods/Magiclysm/Spells/mana_upgrades.json index d2c5ab2b971d7..aea425f5e2964 100644 --- a/data/mods/Magiclysm/Spells/mana_upgrades.json +++ b/data/mods/Magiclysm/Spells/mana_upgrades.json @@ -228,11 +228,7 @@ { "u_at_om_location": "river_c_not_ne" }, { "u_at_om_location": "river_c_not_nw" }, { "u_at_om_location": "river_c_not_se" }, - { "u_at_om_location": "river_c_not_sw" }, - { "u_at_om_location": "river_ne" }, - { "u_at_om_location": "river_se" }, - { "u_at_om_location": "river_sw" }, - { "u_at_om_location": "river_nw" } + { "u_at_om_location": "river_c_not_sw" } ] }, { "u_is_on_terrain_with_flag": "CURRENT" }, @@ -306,16 +302,6 @@ { "not": { "u_at_om_location": "FACTION_CAMP_ANY" } }, { "not": { "u_near_om_location": "cabin", "range": 4 } }, { "not": { "u_near_om_location": "magic_cabin", "range": 4 } }, - { "not": { "u_near_om_location": "road_curved", "range": 4 } }, - { "not": { "u_near_om_location": "road_four_way", "range": 4 } }, - { "not": { "u_near_om_location": "road_tee", "range": 4 } }, - { "not": { "u_near_om_location": "road_straight", "range": 4 } }, - { "not": { "u_near_om_location": "road_end", "range": 4 } }, - { "not": { "u_near_om_location": "road_sw", "range": 4 } }, - { "not": { "u_near_om_location": "road_ne", "range": 4 } }, - { "not": { "u_near_om_location": "road_ew", "range": 4 } }, - { "not": { "u_near_om_location": "road_ns", "range": 4 } }, - { "not": { "u_near_om_location": "road_nesw", "range": 4 } }, { "not": { "u_near_om_location": "road", "range": 4 } }, { "not": { "u_near_om_location": "dirt_road", "range": 4 } }, { "not": { "u_near_om_location": "dumpsite", "range": 4 } } @@ -384,16 +370,6 @@ { "not": { "u_at_om_location": "FACTION_CAMP_ANY" } }, { "not": { "u_near_om_location": "cabin", "range": 15 } }, { "not": { "u_near_om_location": "magic_cabin", "range": 15 } }, - { "not": { "u_near_om_location": "road_curved", "range": 15 } }, - { "not": { "u_near_om_location": "road_four_way", "range": 15 } }, - { "not": { "u_near_om_location": "road_tee", "range": 15 } }, - { "not": { "u_near_om_location": "road_straight", "range": 15 } }, - { "not": { "u_near_om_location": "road_end", "range": 15 } }, - { "not": { "u_near_om_location": "road_sw", "range": 15 } }, - { "not": { "u_near_om_location": "road_ne", "range": 15 } }, - { "not": { "u_near_om_location": "road_ew", "range": 15 } }, - { "not": { "u_near_om_location": "road_ns", "range": 15 } }, - { "not": { "u_near_om_location": "road_nesw", "range": 15 } }, { "not": { "u_near_om_location": "road", "range": 15 } }, { "not": { "u_near_om_location": "dirt_road", "range": 15 } }, { "not": { "u_near_om_location": "dumpsite", "range": 15 } } diff --git a/data/mods/Magiclysm/items/enchanted_boots.json b/data/mods/Magiclysm/items/enchanted_boots.json index d02ed20e1d32c..4b54f6c90a417 100644 --- a/data/mods/Magiclysm/items/enchanted_boots.json +++ b/data/mods/Magiclysm/items/enchanted_boots.json @@ -276,16 +276,6 @@ { "u_is_on_terrain_with_flag": "YOUNG" } ] }, - { "not": { "u_near_om_location": "road_curved", "range": 1 } }, - { "not": { "u_near_om_location": "road_four_way", "range": 1 } }, - { "not": { "u_near_om_location": "road_tee", "range": 1 } }, - { "not": { "u_near_om_location": "road_straight", "range": 1 } }, - { "not": { "u_near_om_location": "road_end", "range": 1 } }, - { "not": { "u_near_om_location": "road_sw", "range": 1 } }, - { "not": { "u_near_om_location": "road_ne", "range": 1 } }, - { "not": { "u_near_om_location": "road_ew", "range": 1 } }, - { "not": { "u_near_om_location": "road_ns", "range": 1 } }, - { "not": { "u_near_om_location": "road_nesw", "range": 1 } }, { "not": { "u_near_om_location": "road", "range": 1 } } ] }, diff --git a/data/mods/Xedra_Evolved/mutations/paraclesians/arvore_eocs.json b/data/mods/Xedra_Evolved/mutations/paraclesians/arvore_eocs.json index 19ee7a5ec104f..c1dfff5baa82d 100644 --- a/data/mods/Xedra_Evolved/mutations/paraclesians/arvore_eocs.json +++ b/data/mods/Xedra_Evolved/mutations/paraclesians/arvore_eocs.json @@ -10,21 +10,7 @@ "run_eocs": [ { "id": "EOC_CONDITION_CHECK_ARVORE_IN_THE_WILD_ON_OMT_ENTER_2", - "condition": { - "and": [ - { "not": { "u_near_om_location": "road_curved", "range": 2 } }, - { "not": { "u_near_om_location": "road_four_way", "range": 2 } }, - { "not": { "u_near_om_location": "road_tee", "range": 2 } }, - { "not": { "u_near_om_location": "road_straight", "range": 2 } }, - { "not": { "u_near_om_location": "road_end", "range": 2 } }, - { "not": { "u_near_om_location": "road_sw", "range": 2 } }, - { "not": { "u_near_om_location": "road_ne", "range": 2 } }, - { "not": { "u_near_om_location": "road_ew", "range": 2 } }, - { "not": { "u_near_om_location": "road_ns", "range": 2 } }, - { "not": { "u_near_om_location": "road_nesw", "range": 2 } }, - { "not": { "u_near_om_location": "road", "range": 2 } } - ] - }, + "condition": { "not": { "u_near_om_location": "road", "range": 2 } }, "effect": [ { "math": [ "u_arvore_is_in_wilderness", "=", "1" ] } ], "false_effect": [ { "math": [ "u_arvore_is_in_wilderness", "=", "0" ] } ] } diff --git a/data/mods/Xedra_Evolved/mutations/paraclesians/arvore_mutation_spells.json b/data/mods/Xedra_Evolved/mutations/paraclesians/arvore_mutation_spells.json index 5fbe6df4cf368..f4b914abeadfe 100644 --- a/data/mods/Xedra_Evolved/mutations/paraclesians/arvore_mutation_spells.json +++ b/data/mods/Xedra_Evolved/mutations/paraclesians/arvore_mutation_spells.json @@ -117,16 +117,6 @@ { "u_is_on_terrain_with_flag": "YOUNG" } ] }, - { "not": { "u_near_om_location": "road_curved", "range": 1 } }, - { "not": { "u_near_om_location": "road_four_way", "range": 1 } }, - { "not": { "u_near_om_location": "road_tee", "range": 1 } }, - { "not": { "u_near_om_location": "road_straight", "range": 1 } }, - { "not": { "u_near_om_location": "road_end", "range": 1 } }, - { "not": { "u_near_om_location": "road_sw", "range": 1 } }, - { "not": { "u_near_om_location": "road_ne", "range": 1 } }, - { "not": { "u_near_om_location": "road_ew", "range": 1 } }, - { "not": { "u_near_om_location": "road_ns", "range": 1 } }, - { "not": { "u_near_om_location": "road_nesw", "range": 1 } }, { "not": { "u_near_om_location": "road", "range": 1 } } ] }, diff --git a/data/mods/Xedra_Evolved/mutations/paraclesians/homullus_eocs.json b/data/mods/Xedra_Evolved/mutations/paraclesians/homullus_eocs.json index 2b0bad0b27708..ac3c2669d3841 100644 --- a/data/mods/Xedra_Evolved/mutations/paraclesians/homullus_eocs.json +++ b/data/mods/Xedra_Evolved/mutations/paraclesians/homullus_eocs.json @@ -336,27 +336,7 @@ { "type": "effect_on_condition", "id": "EOC_HOMULLUS_ALL_ROADS_TRANSLOCATE_CHECK", - "condition": { - "and": [ - "u_is_outside", - { - "or": [ - { "u_at_om_location": "road_curved" }, - { "u_at_om_location": "road_tee" }, - { "u_at_om_location": "road_four_way" }, - { "u_at_om_location": "road_end" }, - { "u_at_om_location": "road_sw" }, - { "u_at_om_location": "road_ne" }, - { "u_at_om_location": "road_ew" }, - { "u_at_om_location": "road_ns" }, - { "u_at_om_location": "road_nesw" }, - { "u_at_om_location": "road" }, - { "u_at_om_location": "road_straight" } - ] - }, - { "u_is_on_terrain_with_flag": "ROAD" } - ] - }, + "condition": { "and": [ "u_is_outside", { "u_at_om_location": "road" }, { "u_is_on_terrain_with_flag": "ROAD" } ] }, "effect": [ { "u_cast_spell": { "id": "paraclesian_translocate" } } ], "false_effect": [ { "u_message": "You must be standing on a road to cast this spell.", "type": "mixed" } ] }, diff --git a/data/mods/Xedra_Evolved/mutations/paraclesians/homullus_mutations.json b/data/mods/Xedra_Evolved/mutations/paraclesians/homullus_mutations.json index 8b2e3c843d24e..35c724b639aec 100644 --- a/data/mods/Xedra_Evolved/mutations/paraclesians/homullus_mutations.json +++ b/data/mods/Xedra_Evolved/mutations/paraclesians/homullus_mutations.json @@ -420,16 +420,6 @@ { "condition": { "or": [ - { "u_near_om_location": "road_curved", "range": 3 }, - { "u_near_om_location": "road_four_way", "range": 3 }, - { "u_near_om_location": "road_tee", "range": 3 }, - { "u_near_om_location": "road_straight", "range": 3 }, - { "u_near_om_location": "road_end", "range": 3 }, - { "u_near_om_location": "road_sw", "range": 3 }, - { "u_near_om_location": "road_ne", "range": 3 }, - { "u_near_om_location": "road_ew", "range": 3 }, - { "u_near_om_location": "road_ns", "range": 3 }, - { "u_near_om_location": "road_nesw", "range": 3 }, { "u_near_om_location": "road", "range": 3 }, { "u_near_om_location": "dirt_road", "range": 3 }, { "u_near_om_location": "subway", "range": 3 }, diff --git a/data/mods/Xedra_Evolved/mutations/paraclesians/paraclesian_magic_terrain_adjustments.json b/data/mods/Xedra_Evolved/mutations/paraclesians/paraclesian_magic_terrain_adjustments.json index cf5f94a81c911..641367387fe73 100644 --- a/data/mods/Xedra_Evolved/mutations/paraclesians/paraclesian_magic_terrain_adjustments.json +++ b/data/mods/Xedra_Evolved/mutations/paraclesians/paraclesian_magic_terrain_adjustments.json @@ -105,21 +105,7 @@ { "u_is_on_terrain": "t_dirtfloor_thatchroof" } ] }, - { - "or": [ - { "u_near_om_location": "road_curved", "range": 1 }, - { "u_near_om_location": "road_four_way", "range": 1 }, - { "u_near_om_location": "road_tee", "range": 1 }, - { "u_near_om_location": "road_straight", "range": 1 }, - { "u_near_om_location": "road_end", "range": 1 }, - { "u_near_om_location": "road_sw", "range": 1 }, - { "u_near_om_location": "road_ne", "range": 1 }, - { "u_near_om_location": "road_ew", "range": 1 }, - { "u_near_om_location": "road_ns", "range": 1 }, - { "u_near_om_location": "road_nesw", "range": 1 }, - { "u_near_om_location": "road", "range": 1 } - ] - } + { "u_near_om_location": "road", "range": 1 } ] } ] @@ -161,16 +147,6 @@ { "and": [ { "not": { "test_eoc": "EOC_HOMULLUS_IN_CIVILIZATION_CHECKER_CONDITION" } }, - { "not": { "u_near_om_location": "road_curved", "range": 1 } }, - { "not": { "u_near_om_location": "road_four_way", "range": 1 } }, - { "not": { "u_near_om_location": "road_tee", "range": 1 } }, - { "not": { "u_near_om_location": "road_straight", "range": 1 } }, - { "not": { "u_near_om_location": "road_end", "range": 1 } }, - { "not": { "u_near_om_location": "road_sw", "range": 1 } }, - { "not": { "u_near_om_location": "road_ne", "range": 1 } }, - { "not": { "u_near_om_location": "road_ew", "range": 1 } }, - { "not": { "u_near_om_location": "road_ns", "range": 1 } }, - { "not": { "u_near_om_location": "road_nesw", "range": 1 } }, { "not": { "u_near_om_location": "road", "range": 1 } } ] }, @@ -339,10 +315,6 @@ { "u_near_om_location": "river_c_not_nw", "range": 1 }, { "u_near_om_location": "river_c_not_se", "range": 1 }, { "u_near_om_location": "river_c_not_sw", "range": 1 }, - { "u_near_om_location": "river_ne", "range": 1 }, - { "u_near_om_location": "river_se", "range": 1 }, - { "u_near_om_location": "river_sw", "range": 1 }, - { "u_near_om_location": "river_nw", "range": 1 }, { "u_near_om_location": "lake_shore", "range": 1 }, { "u_near_om_location": "lake_surface", "range": 1 } ] @@ -396,10 +368,6 @@ { "u_at_om_location": "river_c_not_nw" }, { "u_at_om_location": "river_c_not_se" }, { "u_at_om_location": "river_c_not_sw" }, - { "u_at_om_location": "river_ne" }, - { "u_at_om_location": "river_se" }, - { "u_at_om_location": "river_sw" }, - { "u_at_om_location": "river_nw" }, { "u_at_om_location": "lake_shore" }, { "u_at_om_location": "lake_surface" } ] diff --git a/data/mods/Xedra_Evolved/mutations/paraclesians/undine_eocs.json b/data/mods/Xedra_Evolved/mutations/paraclesians/undine_eocs.json index 8174490f6b05e..89db0ee36b9d2 100644 --- a/data/mods/Xedra_Evolved/mutations/paraclesians/undine_eocs.json +++ b/data/mods/Xedra_Evolved/mutations/paraclesians/undine_eocs.json @@ -20,10 +20,6 @@ { "u_near_om_location": "river_c_not_nw", "range": 1 }, { "u_near_om_location": "river_c_not_se", "range": 1 }, { "u_near_om_location": "river_c_not_sw", "range": 1 }, - { "u_near_om_location": "river_ne", "range": 1 }, - { "u_near_om_location": "river_se", "range": 1 }, - { "u_near_om_location": "river_sw", "range": 1 }, - { "u_near_om_location": "river_nw", "range": 1 }, { "u_near_om_location": "lake_shore", "range": 1 }, { "u_near_om_location": "lake_surface", "range": 1 }, { "u_near_om_location": "ocean", "range": 1 }, @@ -214,10 +210,6 @@ { "u_at_om_location": "river_c_not_nw" }, { "u_at_om_location": "river_c_not_se" }, { "u_at_om_location": "river_c_not_sw" }, - { "u_at_om_location": "river_ne" }, - { "u_at_om_location": "river_se" }, - { "u_at_om_location": "river_sw" }, - { "u_at_om_location": "river_nw" }, { "u_at_om_location": "lake_shore" }, { "u_at_om_location": "lake_surface" }, { "u_at_om_location": "ocean" }, diff --git a/src/condition.cpp b/src/condition.cpp index 2cb499424da1d..5748b49829fbf 100644 --- a/src/condition.cpp +++ b/src/condition.cpp @@ -1050,7 +1050,7 @@ conditional_t::func f_at_om_location( const JsonObject &jo, std::string_view mem const std::optional *maybe_args = overmap_buffer.mapgen_args( omt_pos ); return !recipe_group::get_recipes_by_id( "all_faction_base_types", omt_ter, maybe_args ).empty(); } else { - return oter_no_dir( omt_ter ) == location_value; + return oter_no_dir_or_connections( omt_ter ) == location_value; } }; } @@ -1082,7 +1082,7 @@ conditional_t::func f_near_om_location( const JsonObject &jo, std::string_view m !recipe_group::get_recipes_by_id( "all_faction_base_types", omt_ter, maybe_args ).empty() ) { return true; } else { - if( oter_no_dir( omt_ter ) == location_value ) { + if( oter_no_dir_or_connections( omt_ter ) == location_value ) { return true; } } diff --git a/src/overmap.cpp b/src/overmap.cpp index 5fbdddc7f7463..07d72f010e8b4 100644 --- a/src/overmap.cpp +++ b/src/overmap.cpp @@ -7749,6 +7749,22 @@ std::string_view oter_no_dir( const oter_id &oter ) return base_oter_id; } +std::string_view oter_no_dir_or_connections( const oter_id &oter ) +{ + std::string_view base_oter_id = oter_no_dir( oter ); + for( const std::string &suffix : om_lines::mapgen_suffixes ) { + if( string_ends_with( base_oter_id, suffix ) ) { + base_oter_id = base_oter_id.substr( 0, base_oter_id.size() - suffix.size() ); + } + } + for( const auto &connection_type : om_lines::all ) { + if( string_ends_with( base_oter_id, connection_type.suffix ) ) { + base_oter_id = base_oter_id.substr( 0, base_oter_id.size() - connection_type.suffix.size() ); + } + } + return base_oter_id; +} + int oter_get_rotation( const oter_id &oter ) { std::string base_oter_id = oter.id().c_str(); diff --git a/src/overmap.h b/src/overmap.h index 3fc9a42c519b1..d24af49002727 100644 --- a/src/overmap.h +++ b/src/overmap.h @@ -699,6 +699,11 @@ om_special_sectors get_sectors( int sector_width ); */ std::string_view oter_no_dir( const oter_id &oter ); +/** +* Returns the string of oter without any directional, connection, or line suffix +*/ +std::string_view oter_no_dir_or_connections( const oter_id &oter ); + /** * Return 0, 1, 2, 3 respectively if the suffix is _north, _west, _south, _east * Return 0 if there's no suffix