2022-10-10 00:42:14 +02:00
|
|
|
import { Player } from "@player";
|
2021-04-06 09:50:09 +02:00
|
|
|
import { CONSTANTS } from "../Constants";
|
|
|
|
|
2022-09-06 15:07:12 +02:00
|
|
|
export function getHospitalizationCost(): number {
|
|
|
|
if (Player.money < 0) {
|
2021-09-05 01:09:30 +02:00
|
|
|
return 0;
|
|
|
|
}
|
2021-04-06 09:50:09 +02:00
|
|
|
|
2022-09-06 15:07:12 +02:00
|
|
|
return Math.min(Player.money * 0.1, (Player.hp.max - Player.hp.current) * CONSTANTS.HospitalCostPerHp);
|
2021-04-06 09:50:09 +02:00
|
|
|
}
|
|
|
|
|
2022-09-06 15:07:12 +02:00
|
|
|
export function calculateHospitalizationCost(damage: number): number {
|
|
|
|
const oldhp = Player.hp.current;
|
|
|
|
Player.hp.current -= damage;
|
|
|
|
const cost = getHospitalizationCost();
|
|
|
|
Player.hp.current = oldhp;
|
2021-09-05 01:09:30 +02:00
|
|
|
return cost;
|
|
|
|
}
|