blob: d213d0725bf5a6c2ea0df1249269f703257c4e5f (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
|
#include <kurator/universe/TurretType.h>
#include <algorithm>
#include <cmath>
namespace kurator
{
namespace universe
{
double
TurretType::effective_damage(const double distance) const
{
const auto overflow = distance - optimal_range;
const auto falloff = std::max(0.0, overflow / optimal_range / falloff_modifier);
return base_damage * std::round(std::pow(falloff_intensity, std::pow(falloff, 2)) * 1000) / 1000;
}
} // namespace universe
} // namespace kurator
|