bitburner-src/src/PersonObjects/Person.ts

69 lines
2.1 KiB
TypeScript
Raw Normal View History

import * as personMethods from "./PersonMethods";
import { PlayerOwnedAugmentation } from "../Augmentation/PlayerOwnedAugmentation";
import { CityName } from "../Locations/data/CityNames";
import { calculateSkill } from "./formulas/skill";
import { calculateIntelligenceBonus } from "./formulas/intelligence";
import { defaultMultipliers } from "./Multipliers";
import { Skills } from "./Skills";
import { HP } from "./HP";
import { IReviverValue } from "../utils/JSONReviver";
// Base class representing a person-like object
export abstract class Person {
hp: HP = { current: 10, max: 10 };
skills: Skills = {
hacking: 1,
strength: 1,
defense: 1,
dexterity: 1,
agility: 1,
charisma: 1,
2022-08-15 15:38:10 +02:00
intelligence: 0,
};
exp: Skills = {
hacking: 0,
strength: 0,
defense: 0,
dexterity: 0,
agility: 0,
charisma: 0,
intelligence: 0,
};
2022-07-15 00:43:33 +02:00
mults = defaultMultipliers();
2022-09-27 19:27:17 +02:00
/** Augmentations */
augmentations: PlayerOwnedAugmentation[] = [];
queuedAugmentations: PlayerOwnedAugmentation[] = [];
2022-09-27 19:27:17 +02:00
/** City that the person is in */
2021-09-05 01:09:30 +02:00
city: CityName = CityName.Sector12;
gainHackingExp = personMethods.gainHackingExp;
gainStrengthExp = personMethods.gainStrengthExp;
gainDefenseExp = personMethods.gainDefenseExp;
gainDexterityExp = personMethods.gainDexterityExp;
gainAgilityExp = personMethods.gainAgilityExp;
gainCharismaExp = personMethods.gainCharismaExp;
gainIntelligenceExp = personMethods.gainIntelligenceExp;
gainStats = personMethods.gainStats;
regenerateHp = personMethods.regenerateHp;
queryStatFromString = personMethods.queryStatFromString;
updateSkillLevels = personMethods.updateSkillLevels;
2022-09-27 22:23:53 +02:00
hasAugmentation = personMethods.hasAugmentation;
calculateSkill = calculateSkill; //Class version is equal to imported version
2021-09-05 01:09:30 +02:00
2022-09-27 19:27:17 +02:00
/** Reset all multipliers to 1 */
resetMultipliers() {
2022-07-15 00:43:33 +02:00
this.mults = defaultMultipliers();
2021-09-05 01:09:30 +02:00
}
getIntelligenceBonus(weight: number): number {
return calculateIntelligenceBonus(this.skills.intelligence, weight);
2021-09-05 01:09:30 +02:00
}
abstract takeDamage(amt: number): boolean;
abstract whoAmI(): string;
abstract toJSON(): IReviverValue;
}