mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2025-01-28 17:01:25 +01:00
2613948bad
This adds bladeburner actions to sleeves. In addition this bulked out the IPerson functionality and updated bladeburner functions to be more sleeve compatible
19 lines
480 B
TypeScript
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;
|
|
}
|