Fixed gym not applying muscle effect after use

This commit is contained in:
Dev 2024-10-14 19:38:26 +01:00
parent aec64455cb
commit 6b116024ca
3 changed files with 69 additions and 9 deletions

View File

@ -1166,15 +1166,20 @@ export class HideoutController {
for (const outcome of request.results) { for (const outcome of request.results) {
if (outcome) { if (outcome) {
// Success // Success
pmcData.Health.Energy.Current -= relevantQte.results.SingleSuccessEffect.energy; pmcData.Health.Energy.Current += relevantQte.results.singleSuccessEffect.energy;
pmcData.Health.Hydration.Current -= relevantQte.results.SingleSuccessEffect.hydration; pmcData.Health.Hydration.Current += relevantQte.results.singleSuccessEffect.hydration;
} else { } else {
// Failed // Failed
pmcData.Health.Energy.Current -= relevantQte.results.SingleFailEffect.energy; pmcData.Health.Energy.Current += relevantQte.results.singleFailEffect.energy;
pmcData.Health.Hydration.Current -= relevantQte.results.SingleFailEffect.hydration; 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) { if (pmcData.Health.Energy.Current < 1) {
pmcData.Health.Energy.Current = 1; pmcData.Health.Energy.Current = 1;
} }
@ -1182,6 +1187,24 @@ export class HideoutController {
if (pmcData.Health.Hydration.Current < 1) { if (pmcData.Health.Hydration.Current < 1) {
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,
};
}
} }
/** /**

View File

@ -1,6 +1,43 @@
// TODO: Type this properly. // TODO: Type this properly.
export interface IWorkoutData extends Record<string, any> { export interface IWorkoutData extends Record<string, any> {
skills: any; skills: IWorkoutSkills;
effects: any; 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;
} }

View File

@ -1,5 +1,5 @@
export enum QteEffectType { export enum QteEffectType {
FINISH_EFFECT = "FinishEffect", FINISH_EFFECT = "finishEffect",
SINGLE_SUCCESS_EFFECT = "SingleSuccessEffect", SINGLE_SUCCESS_EFFECT = "singleSuccessEffect",
SINGLE_FAIL_EFFECT = "SingleFailEffect", SINGLE_FAIL_EFFECT = "singleFailEffect",
} }