bitburner-src/src/Hospital/Hospital.ts
rderfler 2613948bad Add bladeburner actions to sleeves
This adds bladeburner actions to sleeves. In addition this bulked out the IPerson functionality and updated bladeburner functions to be more sleeve compatible
2022-04-14 11:40:59 -04:00

19 lines
480 B
TypeScript

import { CONSTANTS } from "../Constants";
import { IPerson } from "../PersonObjects/IPerson";
export function getHospitalizationCost(p: IPerson): number {
if (p.money < 0) {
return 0;
}
return Math.min(p.money * 0.1, (p.max_hp - p.hp) * CONSTANTS.HospitalCostPerHp);
}
export function calculateHospitalizationCost(p: IPerson, damage: number): number {
const oldhp = p.hp;
p.hp -= damage;
const cost = getHospitalizationCost(p);
p.hp = oldhp;
return cost;
}