| 799 | } |
| 800 | |
| 801 | void Agent::updateSpeed() |
| 802 | { |
| 803 | int encumbrance = 0; |
| 804 | for (auto &item : equipment) |
| 805 | { |
| 806 | encumbrance += item->getWeight(); |
| 807 | } |
| 808 | overEncumbred = current_stats.strength * 4 < encumbrance; |
| 809 | encumbrance *= encumbrance; |
| 810 | |
| 811 | // Expecting str to never be 0 |
| 812 | int strength = current_stats.strength; |
| 813 | strength *= strength * 16; |
| 814 | |
| 815 | // Ensure actual speed is at least "1" |
| 816 | modified_stats.speed = std::max( |
| 817 | 8, ((strength + encumbrance) / 2 + current_stats.speed * (strength - encumbrance)) / |
| 818 | (strength + encumbrance)); |
| 819 | } |
| 820 | |
| 821 | void Agent::updateModifiedStats() |
| 822 | { |
no test coverage detected