From 44c4529d90639016588c9ead98627f18f533341a Mon Sep 17 00:00:00 2001 From: ChrissiQ <1127719+ChrissiQ@users.noreply.github.com> Date: Mon, 7 Mar 2022 23:18:51 -0700 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20=20(Bug:=20Corp)=20Fixes=20suffi?= =?UTF-8?q?cient=20player=20money=20check=20to=20buy=20back=20shares.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit `BuyBackShares()` checks the corp for sufficient funds, but since shares are purchased with player money, it should be checking the player's money instead. --- src/Corporation/Actions.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Corporation/Actions.ts b/src/Corporation/Actions.ts index 1b648e2b0..213ab9578 100644 --- a/src/Corporation/Actions.ts +++ b/src/Corporation/Actions.ts @@ -291,7 +291,7 @@ export function BuyBackShares(corporation: ICorporation, player: IPlayer, numSha if (numShares > corporation.issuedShares) throw new Error("You don't have that many shares to buy!"); if (!corporation.public) throw new Error("You haven't gone public!"); const buybackPrice = corporation.sharePrice * 1.1; - if (corporation.funds < (numShares * buybackPrice)) throw new Error("You cant afford that many shares!"); + if (player.money < (numShares * buybackPrice)) throw new Error("You cant afford that many shares!"); corporation.numShares += numShares; corporation.issuedShares -= numShares; player.loseMoney(numShares * buybackPrice, "corporation");