| 197 | } |
| 198 | |
| 199 | float StatSet::setResourcePercentage(String const& resourceName, float resourcePercentage) { |
| 200 | auto& resource = getResource(resourceName); |
| 201 | if (!resource.maxValue) |
| 202 | throw StatusException::format("setResourcePersentage called on resource '{}' which has no maximum", resourceName); |
| 203 | return resource.setValue(resourcePercentage * *resource.maxValue); |
| 204 | } |
| 205 | |
| 206 | float StatSet::modifyResourcePercentage(String const& resourceName, float resourcePercentage) { |
| 207 | auto& resource = getResource(resourceName); |