Don't calculate experience gained if the Pokemon is not allowed to receive experience.
continuous-integration/drone/push Build is passing Details

This commit is contained in:
Deukhoofd 2020-05-22 14:17:19 +02:00
parent 92135a88eb
commit d6792635f9
Signed by: Deukhoofd
GPG Key ID: ADF2E9256009EDCE
1 changed files with 2 additions and 0 deletions

View File

@ -14,6 +14,8 @@ void PkmnLib::Battling::ExperienceLibrary::HandleExperienceGain(
auto v1 = (expGain * level) / 5; auto v1 = (expGain * level) / 5;
for (auto op : opponents) { for (auto op : opponents) {
if (!op->AllowedExperienceGain())
continue;
auto v2 = pow(2 * level + 10, 2.5) / pow(level + op->GetLevel() + 10, 2.5); auto v2 = pow(2 * level + 10, 2.5) / pow(level + op->GetLevel() + 10, 2.5);
uint32_t experienceGain = v1 * v2 + 1; uint32_t experienceGain = v1 * v2 + 1;
// TODO: Check owner and international // TODO: Check owner and international