money is readonly

This commit is contained in:
Olivier Gagnon 2021-10-27 13:28:36 -04:00
parent 150b8600e4
commit 9f6767062b
2 changed files with 6 additions and 5 deletions

@ -56,7 +56,7 @@ export interface IPlayer {
numPeopleKilled: number; numPeopleKilled: number;
location: LocationName; location: LocationName;
max_hp: number; max_hp: number;
money: any; readonly money: any;
moneySourceA: MoneySourceTracker; moneySourceA: MoneySourceTracker;
moneySourceB: MoneySourceTracker; moneySourceB: MoneySourceTracker;
playtimeSinceLastAug: number; playtimeSinceLastAug: number;

@ -1,4 +1,5 @@
import { IPlayer } from "../IPlayer"; import { IPlayer } from "../IPlayer";
import { PlayerObject } from "./PlayerObject";
import { Augmentations } from "../../Augmentation/Augmentations"; import { Augmentations } from "../../Augmentation/Augmentations";
import { applyAugmentation } from "../../Augmentation/AugmentationHelpers"; import { applyAugmentation } from "../../Augmentation/AugmentationHelpers";
import { PlayerOwnedAugmentation } from "../../Augmentation/PlayerOwnedAugmentation"; import { PlayerOwnedAugmentation } from "../../Augmentation/PlayerOwnedAugmentation";
@ -78,7 +79,7 @@ export function init(this: IPlayer): void {
this.getHomeComputer().programs.push(Programs.NukeProgram.name); this.getHomeComputer().programs.push(Programs.NukeProgram.name);
} }
export function prestigeAugmentation(this: IPlayer): void { export function prestigeAugmentation(this: PlayerObject): void {
this.currentServer = SpecialServers.Home; this.currentServer = SpecialServers.Home;
this.numPeopleKilled = 0; this.numPeopleKilled = 0;
@ -319,7 +320,7 @@ export function hasProgram(this: IPlayer, programName: string): boolean {
return false; return false;
} }
export function setMoney(this: IPlayer, money: number): void { export function setMoney(this: PlayerObject, money: number): void {
if (isNaN(money)) { if (isNaN(money)) {
console.error("NaN passed into Player.setMoney()"); console.error("NaN passed into Player.setMoney()");
return; return;
@ -327,7 +328,7 @@ export function setMoney(this: IPlayer, money: number): void {
this.money = new Decimal(money); this.money = new Decimal(money);
} }
export function gainMoney(this: IPlayer, money: number): void { export function gainMoney(this: PlayerObject, money: number): void {
if (isNaN(money)) { if (isNaN(money)) {
console.error("NaN passed into Player.gainMoney()"); console.error("NaN passed into Player.gainMoney()");
return; return;
@ -335,7 +336,7 @@ export function gainMoney(this: IPlayer, money: number): void {
this.money = this.money.plus(money); this.money = this.money.plus(money);
} }
export function loseMoney(this: IPlayer, money: number): void { export function loseMoney(this: PlayerObject, money: number): void {
if (isNaN(money)) { if (isNaN(money)) {
console.error("NaN passed into Player.loseMoney()"); console.error("NaN passed into Player.loseMoney()");
return; return;