Fixes for earlier commit to fix GetEffectiveness in type library.
continuous-integration/drone/push Build is passing Details

This commit is contained in:
Deukhoofd 2020-05-06 13:32:11 +02:00
parent 51415895a4
commit 748f68b6d8
Signed by: Deukhoofd
GPG Key ID: ADF2E9256009EDCE
1 changed files with 3 additions and 1 deletions

View File

@ -5,7 +5,9 @@
using namespace CreatureLib::Library;
float TypeLibrary::GetEffectiveness(uint8_t attacking, const List<uint8_t>& defensive) const {
return std::accumulate(defensive.begin(), defensive.end(), (float)1, std::multiplies<float>());
return std::accumulate(
defensive.begin(), defensive.end(), (float)1,
[this, attacking](float init, uint8_t defense) { return init * GetSingleEffectiveness(attacking, defense); });
}
float TypeLibrary::GetSingleEffectiveness(uint8_t attacking, uint8_t defensive) const {