Adding more directory-related unit tests. Several more bug fixes and QoL improvements

This commit is contained in:
danielyxie
2019-05-14 01:35:37 -07:00
parent 1775ea86ff
commit fef7aaba8f
24 changed files with 423 additions and 85 deletions
+3 -1
View File
@@ -1,3 +1,4 @@
import * as augmentationMethods from "./PlayerObjectAugmentationMethods";
import * as bladeburnerMethods from "./PlayerObjectBladeburnerMethods";
import * as corporationMethods from "./PlayerObjectCorporationMethods";
import * as gangMethods from "./PlayerObjectGangMethods";
@@ -209,7 +210,8 @@ Object.assign(
serverMethods,
bladeburnerMethods,
corporationMethods,
gangMethods
gangMethods,
augmentationMethods
);
PlayerObject.prototype.toJSON = function() {
@@ -0,0 +1,20 @@
/**
* Augmentation-related methods for the Player class (PlayerObject)
*/
import { IPlayer } from "../IPlayer";
import { Augmentation } from "../../Augmentation/Augmentation";
export function hasAugmentation(this: IPlayer, aug: string | Augmentation): boolean {
const augName: string = (aug instanceof Augmentation) ? aug.name : aug;
for (const owned of this.augmentations) {
if (owned.name === augName) { return true; }
}
for (const owned of this.queuedAugmentations) {
if (owned.name === augName) { return true; }
}
return false;
}
@@ -219,6 +219,11 @@ export function prestigeSourceFile() {
}
}
const characterMenuHeader = document.getElementById("character-menu-header");
if (characterMenuHeader instanceof HTMLElement) {
characterMenuHeader.click(); characterMenuHeader.click();
}
this.isWorking = false;
this.currentWorkFactionName = "";
this.currentWorkFactionDescription = "";
@@ -1567,7 +1572,9 @@ export function hospitalize() {
);
}
this.loseMoney(this.max_hp * CONSTANTS.HospitalCostPerHp);
const cost = this.max_hp * CONSTANTS.HospitalCostPerHp
this.loseMoney(cost);
this.recordMoneySource(-1 * cost, "hospitalization");
this.hp = this.max_hp;
}