Fixes GetEffectiveness in type library using integer instead of float.
continuous-integration/drone/push Build is failing Details

This commit is contained in:
Deukhoofd 2020-05-06 13:27:50 +02:00
parent 5cd5059e42
commit 51415895a4
Signed by: Deukhoofd
GPG Key ID: ADF2E9256009EDCE
1 changed files with 2 additions and 5 deletions

View File

@ -1,14 +1,11 @@
#include "TypeLibrary.hpp" #include "TypeLibrary.hpp"
#include <Arbutils/Assert.hpp> #include <Arbutils/Assert.hpp>
#include <numeric>
using namespace CreatureLib::Library; using namespace CreatureLib::Library;
float TypeLibrary::GetEffectiveness(uint8_t attacking, const List<uint8_t>& defensive) const { float TypeLibrary::GetEffectiveness(uint8_t attacking, const List<uint8_t>& defensive) const {
auto eff = 1; return std::accumulate(defensive.begin(), defensive.end(), (float)1, std::multiplies<float>());
for (auto def : defensive) {
eff *= GetSingleEffectiveness(attacking, def);
}
return eff;
} }
float TypeLibrary::GetSingleEffectiveness(uint8_t attacking, uint8_t defensive) const { float TypeLibrary::GetSingleEffectiveness(uint8_t attacking, uint8_t defensive) const {