Various bugfixes

This commit is contained in:
danielyxie
2019-02-20 00:42:27 -08:00
parent 6d81c00f37
commit 107977e6f4
19 changed files with 139 additions and 71 deletions
+14
View File
@@ -1690,6 +1690,11 @@ PlayerObject.prototype.singularityStopWork = function() {
//Returns true if hospitalized, false otherwise
PlayerObject.prototype.takeDamage = function(amt) {
if (typeof amt !== "number") {
console.warn(`Player.takeDamage() called without a numeric argument: ${amt}`);
return;
}
this.hp -= amt;
if (this.hp <= 0) {
this.hospitalize();
@@ -1699,6 +1704,15 @@ PlayerObject.prototype.takeDamage = function(amt) {
}
}
PlayerObject.prototype.regenerateHp = function(amt) {
if (typeof amt !== "number") {
console.warn(`Player.regenerateHp() called without a numeric argument: ${amt}`);
return;
}
this.hp += amt;
if (this.hp > this.max_hp) { this.hp = this.max_hp; }
}
PlayerObject.prototype.hospitalize = function() {
if (Settings.SuppressHospitalizationPopup === false) {
dialogBoxCreate(