diff --git a/project/src/controllers/HideoutController.ts b/project/src/controllers/HideoutController.ts index 694aafad..c79bb00a 100644 --- a/project/src/controllers/HideoutController.ts +++ b/project/src/controllers/HideoutController.ts @@ -1166,15 +1166,20 @@ export class HideoutController { 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; + 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; + pmcData.Health.Energy.Current += relevantQte.results.singleFailEffect.energy; + pmcData.Health.Hydration.Current += relevantQte.results.singleFailEffect.hydration; } } + const hasMildPain = !!pmcData.Health.BodyParts.Chest.Effects?.MildMusclePain; + + // Should never happen + const hasSeverePain = !!pmcData.Health.BodyParts.Chest.Effects?.SevereMusclePain; + if (pmcData.Health.Energy.Current < 1) { pmcData.Health.Energy.Current = 1; } @@ -1182,6 +1187,24 @@ export class HideoutController { if (pmcData.Health.Hydration.Current < 1) { pmcData.Health.Hydration.Current = 1; } + + // Has no muscle pain at all, add mild + if (!hasMildPain && !hasSeverePain) { + // nullguard + pmcData.Health.BodyParts.Chest.Effects ||= {}; + pmcData.Health.BodyParts.Chest.Effects.MildMusclePain = { + Time: relevantQte.results.finishEffect.rewardsRange[0].time, // TODO - remove hard coded access, get value properly + }; + } + + if (hasMildPain) { + // Already has mild pain, remove mild and add severe + delete pmcData.Health.BodyParts.Chest.Effects.MildMusclePain; + + pmcData.Health.BodyParts.Chest.Effects.SevereMusclePain = { + Time: relevantQte.results.finishEffect.rewardsRange[0].time, + }; + } } /** diff --git a/project/src/models/eft/health/IWorkoutData.ts b/project/src/models/eft/health/IWorkoutData.ts index 54536469..ab160747 100644 --- a/project/src/models/eft/health/IWorkoutData.ts +++ b/project/src/models/eft/health/IWorkoutData.ts @@ -1,6 +1,43 @@ // TODO: Type this properly. export interface IWorkoutData extends Record { - skills: any; - effects: any; + skills: IWorkoutSkills; + effects: IWorkoutEffects; +} + +export interface IWorkoutSkills { + Common: IWorkoutSkillCommon[]; + Mastering: any[]; + Bonuses: any; + Points: number; +} + +export interface IWorkoutSkillCommon { + Id: string; + Progress: number; + PointsEarnedDuringSession: number; + LastAccess: number; +} + +export interface IWorkoutEffects { + Effects: IWorkoutEffectsParts; + Hydration: number; + Energy: number; +} + +export interface IWorkoutEffectsParts { + Head: IWorkoutBodyPart; + Chest: IWorkoutBodyPart; + Stomach: IWorkoutBodyPart; + LeftArm: IWorkoutBodyPart; + RightArm: IWorkoutBodyPart; + LeftLeg: IWorkoutBodyPart; + RightLeg: IWorkoutBodyPart; + Common: IWorkoutBodyPart; +} + +export interface IWorkoutBodyPart { + Regeneration: number; + Fracture: number; + MildMusclePain: number; } diff --git a/project/src/models/enums/hideout/QteEffectType.ts b/project/src/models/enums/hideout/QteEffectType.ts index dcefc1c6..8014e6ca 100644 --- a/project/src/models/enums/hideout/QteEffectType.ts +++ b/project/src/models/enums/hideout/QteEffectType.ts @@ -1,5 +1,5 @@ export enum QteEffectType { - FINISH_EFFECT = "FinishEffect", - SINGLE_SUCCESS_EFFECT = "SingleSuccessEffect", - SINGLE_FAIL_EFFECT = "SingleFailEffect", + FINISH_EFFECT = "finishEffect", + SINGLE_SUCCESS_EFFECT = "singleSuccessEffect", + SINGLE_FAIL_EFFECT = "singleFailEffect", }