lint and made a some code more robust to older save file

This commit is contained in:
Olivier Gagnon
2022-10-16 14:25:42 -04:00
parent 6c84d64e67
commit c3b2c6396c
2 changed files with 9 additions and 12 deletions
+8 -4
View File
@@ -51,8 +51,10 @@ export function gainDefenseExp(this: Person, exp: number): void {
this.mults.defense * BitNodeMultipliers.DefenseLevelMultiplier,
);
const ratio = this.hp.current / this.hp.max;
this.hp.max = Math.floor(10 + this.skills.defense / 10);
this.hp.current = Math.round(this.hp.max * ratio);
this.hp = {
max: Math.floor(10 + this.skills.defense / 10),
current: Math.round(this.hp.max * ratio),
};
}
export function gainDexterityExp(this: Person, exp: number): void {
@@ -194,8 +196,10 @@ export function updateSkillLevels(this: Person): void {
);
const ratio: number = this.hp.current / this.hp.max;
this.hp.max = Math.floor(10 + this.skills.defense / 10);
this.hp.current = Math.round(this.hp.max * ratio);
this.hp = {
max: Math.floor(10 + this.skills.defense / 10),
current: Math.round(this.hp.max * ratio),
};
}
export function hasAugmentation(this: Person, augName: string, ignoreQueued = false) {