From aec64455cb4696d3bb317db53bdb32caa5fa1458 Mon Sep 17 00:00:00 2001 From: Dev Date: Mon, 14 Oct 2024 18:57:13 +0100 Subject: [PATCH] Improved accuracy of gym workout reduction of energy/hydration --- project/src/controllers/HideoutController.ts | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/project/src/controllers/HideoutController.ts b/project/src/controllers/HideoutController.ts index b40bb28c..694aafad 100644 --- a/project/src/controllers/HideoutController.ts +++ b/project/src/controllers/HideoutController.ts @@ -1161,12 +1161,24 @@ export class HideoutController { // Skill changes are done in // /client/hideout/workout (applyWorkoutChanges). - pmcData.Health.Energy.Current -= 50; + const qteDb = this.databaseService.getHideout().qte; + const relevantQte = qteDb.find((qte) => qte.id === request.id); + for (const outcome of request.results) { + if (outcome) { + // Success + pmcData.Health.Energy.Current -= relevantQte.results.SingleSuccessEffect.energy; + pmcData.Health.Hydration.Current -= relevantQte.results.SingleSuccessEffect.hydration; + } else { + // Failed + pmcData.Health.Energy.Current -= relevantQte.results.SingleFailEffect.energy; + pmcData.Health.Hydration.Current -= relevantQte.results.SingleFailEffect.hydration; + } + } + if (pmcData.Health.Energy.Current < 1) { pmcData.Health.Energy.Current = 1; } - pmcData.Health.Hydration.Current -= 50; if (pmcData.Health.Hydration.Current < 1) { pmcData.Health.Hydration.Current = 1; }