Add a 'damage' key for [effect] applying to attack.

Support standard ranges like '1-10,20-30,42'
This commit is contained in:
Ali El Gariani 2009-05-11 18:03:30 +00:00
parent 365041657d
commit b380b2970f

View file

@ -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;