From 748f68b6d84ae307af8b1e799f902bea8dad2b21 Mon Sep 17 00:00:00 2001 From: Deukhoofd Date: Wed, 6 May 2020 13:32:11 +0200 Subject: [PATCH] Fixes for earlier commit to fix GetEffectiveness in type library. --- src/Library/TypeLibrary.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/Library/TypeLibrary.cpp b/src/Library/TypeLibrary.cpp index 220a16b..75250fa 100644 --- a/src/Library/TypeLibrary.cpp +++ b/src/Library/TypeLibrary.cpp @@ -5,7 +5,9 @@ using namespace CreatureLib::Library; float TypeLibrary::GetEffectiveness(uint8_t attacking, const List& defensive) const { - return std::accumulate(defensive.begin(), defensive.end(), (float)1, std::multiplies()); + 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 {