Add a 'damage' key for [effect] applying to attack.
Support standard ranges like '1-10,20-30,42'
This commit is contained in:
parent
365041657d
commit
b380b2970f
1 changed files with 5 additions and 0 deletions
|
@ -101,6 +101,7 @@ std::string attack_type::accuracy_parry_description() const
|
|||
bool attack_type::matches_filter(const config& cfg,bool self) const
|
||||
{
|
||||
const std::vector<std::string>& filter_range = utils::split(cfg["range"]);
|
||||
const std::string& filter_damage = cfg["damage"];
|
||||
const std::vector<std::string> filter_name = utils::split(cfg["name"]);
|
||||
const std::vector<std::string> filter_type = utils::split(cfg["type"]);
|
||||
const std::string filter_special = cfg["special"];
|
||||
|
@ -108,6 +109,10 @@ bool attack_type::matches_filter(const config& cfg,bool self) const
|
|||
if(filter_range.empty() == false && std::find(filter_range.begin(),filter_range.end(),range()) == filter_range.end())
|
||||
return false;
|
||||
|
||||
if(filter_damage.empty() == false && !in_ranges(damage(), utils::parse_ranges(filter_damage))) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if(filter_name.empty() == false && std::find(filter_name.begin(),filter_name.end(),id()) == filter_name.end())
|
||||
return false;
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue