Remove [filter_ability]type_value=

There are questions about how this filter should treat empty values, and the
use cases that we can think of can be implemented in other ways, for example,
if we want to look for big damage boosts, then we could filter for
`add=5-infinity` `[or]` `multiply=2-infinity`.

The simple answer seems to be to remove it from the API before we freeze for 1.18.
There's more discussion in issue 7944.
This commit is contained in:
Steve Cotton 2023-10-12 09:39:39 +02:00 committed by Steve Cotton
parent 07c1f7805b
commit 30eb439a27
4 changed files with 1 additions and 33 deletions

View file

@ -16,6 +16,5 @@
{SIMPLE_KEY affect_self s_bool}
{SIMPLE_KEY affect_allies s_bool}
{SIMPLE_KEY affect_enemies s_bool}
{DEFAULT_KEY type_value value_type empty}
{FILTER_BOOLEAN_OPS abilities}
[/tag]

View file

@ -40,10 +40,6 @@
name="ability_overwrite"
value="none|one_side|both_sides"
[/type]
[type]
name="value_type"
value="|value|add|sub|multiply|divide"
[/type]
[type]
name="addon_type"
value="sp|mp|hybrid"

View file

@ -42,9 +42,7 @@
overwrite_specials=both_sides
[overwrite]
[filter_specials]
[not]
type_value=value
[/not]
add=1-14
[/filter_specials]
[/overwrite]
[/damage]

View file

@ -1421,28 +1421,6 @@ void unit::remove_ability_by_id(const std::string& ability)
}
}
static bool type_value_if_present(const config& filter, const config& cfg)
{
if(filter["type_value"].empty()) {
return true;
}
std::string cfg_type_value;
const std::vector<std::string> filter_attribute = utils::split(filter["type_value"]);
if(!cfg["value"].empty()){
cfg_type_value ="value";
} else if(!cfg["add"].empty()){
cfg_type_value ="add";
} else if(!cfg["sub"].empty()){
cfg_type_value ="sub";
} else if(!cfg["multiply"].empty()){
cfg_type_value ="multiply";
} else if(!cfg["divide"].empty()){
cfg_type_value ="divide";
}
return ( std::find(filter_attribute.begin(), filter_attribute.end(), cfg_type_value) != filter_attribute.end() );
}
static bool matches_ability_filter(const config & cfg, const std::string& tag_name, const config & filter)
{
using namespace utils::config_filters;
@ -1497,9 +1475,6 @@ static bool matches_ability_filter(const config & cfg, const std::string& tag_na
if(!double_matches_if_present(filter, cfg, "divide"))
return false;
if(!type_value_if_present(filter, cfg))
return false;
// Passed all tests.
return true;
}