From d6792635f94a9a84e9a0714521839dfb17a4dc03 Mon Sep 17 00:00:00 2001 From: Deukhoofd Date: Fri, 22 May 2020 14:17:19 +0200 Subject: [PATCH] Don't calculate experience gained if the Pokemon is not allowed to receive experience. --- src/Battling/Library/ExperienceLibrary.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/Battling/Library/ExperienceLibrary.cpp b/src/Battling/Library/ExperienceLibrary.cpp index bdddf98..3a7b3e9 100644 --- a/src/Battling/Library/ExperienceLibrary.cpp +++ b/src/Battling/Library/ExperienceLibrary.cpp @@ -14,6 +14,8 @@ void PkmnLib::Battling::ExperienceLibrary::HandleExperienceGain( auto v1 = (expGain * level) / 5; for (auto op : opponents) { + if (!op->AllowedExperienceGain()) + continue; auto v2 = pow(2 * level + 10, 2.5) / pow(level + op->GetLevel() + 10, 2.5); uint32_t experienceGain = v1 * v2 + 1; // TODO: Check owner and international