| 204 | } |
| 205 | |
| 206 | float StatSet::modifyResourcePercentage(String const& resourceName, float resourcePercentage) { |
| 207 | auto& resource = getResource(resourceName); |
| 208 | if (!resource.maxValue) |
| 209 | throw StatusException::format( |
| 210 | "modifyResourcePercentage called on resource '{}' which has no maximum", resourceName); |
| 211 | return resource.setValue(resource.value + resourcePercentage * *resource.maxValue); |
| 212 | } |
| 213 | |
| 214 | void StatSet::update(float dt) { |
| 215 | // We use two intermediate values for calculating the effective stat value. |