Skip to content

Commit

Permalink
fix affect_allies can have 3 value true,false and noexistent
Browse files Browse the repository at this point in the history
when abilities don't have affect_allies implemented, then onlyunit same side are affected, if affect_allies=yes, unit of allied side inclus and if falsethen none unit allied or same side are affected.
  • Loading branch information
newfrenchy83 committed Oct 9, 2023
1 parent c89864a commit e261eb8
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 2 deletions.
2 changes: 1 addition & 1 deletion data/schema/filters/abilities.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
{SIMPLE_KEY divide s_real_range_list}
{SIMPLE_KEY affect_adjacent s_bool}
{SIMPLE_KEY affect_self s_bool}
{SIMPLE_KEY affect_allies s_bool}
{DEFAULT_KEY affect_allies affect_allies_filter empty}
{SIMPLE_KEY affect_enemies s_bool}
{DEFAULT_KEY type_value value_type empty}
{FILTER_BOOLEAN_OPS abilities}
Expand Down
4 changes: 4 additions & 0 deletions data/schema/game_config.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,10 @@
name="value_type"
value="empty|value|add|sub|multiply|divide"
[/type]
[type]
name="affect_allies_filter"
value="empty|yes|no"
[/type]
[type]
name="addon_type"
value="sp|mp|hybrid"
Expand Down
7 changes: 6 additions & 1 deletion src/units/unit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1457,8 +1457,13 @@ static bool matches_ability_filter(const config & cfg, const std::string& tag_na
if(!bool_matches_if_present(filter, cfg, "affect_self", true))
return false;

if(!bool_matches_if_present(filter, cfg, "affect_allies", true))
if(!filter["affect_allies"].empty() && !cfg["affect_allies"].empty()){
if(!bool_matches_if_present(filter, cfg, "affect_allies", true)){
return false;
}
} else if(!filter["affect_allies"].empty() && filter["affect_allies"].str() != "empty"){
return false;
}

if(!bool_matches_if_present(filter, cfg, "affect_enemies", false))
return false;
Expand Down

0 comments on commit e261eb8

Please sign in to comment.