From 94175877d7ee6b25b7355c4979df6393c0bdda14 Mon Sep 17 00:00:00 2001 From: danielyxie Date: Thu, 16 May 2019 23:55:21 -0700 Subject: [PATCH 1/5] Changed stock market price movements so that upward and downward movements use different trackers. Forecast can no longer be inverted due to price movements. Updated stock market unit tests --- doc/source/advancedgameplay/sleeves.rst | 7 +- .../basicfunctions/hackAnalyzeThreads.rst | 11 +- src/Faction/ui/Root.tsx | 2 +- src/Hacknet/HacknetHelpers.jsx | 4 +- src/StockMarket/OrderProcessing.ts | 4 +- src/StockMarket/Stock.ts | 37 ++--- src/StockMarket/StockMarket.jsx | 3 +- src/StockMarket/StockMarketHelpers.ts | 133 ++++++++++++------ src/StockMarket/ui/StockTicker.tsx | 30 ++-- src/StockMarket/ui/StockTickers.tsx | 2 + src/ui/displayCharacterInfo.ts | 21 +-- test/StockMarketTests.js | 91 +++++++----- 12 files changed, 216 insertions(+), 129 deletions(-) diff --git a/doc/source/advancedgameplay/sleeves.rst b/doc/source/advancedgameplay/sleeves.rst index 35eeaa9ac..17b173242 100644 --- a/doc/source/advancedgameplay/sleeves.rst +++ b/doc/source/advancedgameplay/sleeves.rst @@ -86,8 +86,11 @@ Sleeve memory dictates what a sleeve's synchronization will be when its reset by switching BitNodes. For example, if a sleeve has a memory of 10, then when you switch BitNodes its synchronization will initially be set to 10, rather than 1. -Memory can only be increased by purchasing upgrades from The Covenant. -It is a persistent stat, meaning it never gets reset back to 1. +Memory can only be increased by purchasing upgrades from The Covenant. Just like +the ability to purchase additional sleeves, this is only available in BitNodes-10 +and above, and is only available after defeating BitNode-10 at least once. + +Memory is a persistent stat, meaning it never gets reset back to 1. The maximum possible value for a sleeve's memory is 100. Re-sleeving diff --git a/doc/source/netscript/basicfunctions/hackAnalyzeThreads.rst b/doc/source/netscript/basicfunctions/hackAnalyzeThreads.rst index 97ae1803c..445b70c4c 100644 --- a/doc/source/netscript/basicfunctions/hackAnalyzeThreads.rst +++ b/doc/source/netscript/basicfunctions/hackAnalyzeThreads.rst @@ -21,4 +21,13 @@ hackAnalyzeThreads() Netscript Function If this function returns 50, this means that if your next `hack()` call is run on a script with 50 threads, it will steal $1m from the `foodnstuff` server. - **Warning**: The value returned by this function isn't necessarily a whole number. + .. warning:: The value returned by this function isn't necessarily a whole number. + .. warning:: It is possible for this function to return :code:`Infinity` or :code:`NaN` in + certain uncommon scenarios. This is because in JavaScript: + + * :code:`0 / 0 = NaN` + * :code:`N / 0 = Infinity` for 0 < N < Infinity. + + For example, if a server has no money available and you want to hack some positive + amount from it, then the function would return :code:`Infinity` because + this would be impossible. diff --git a/src/Faction/ui/Root.tsx b/src/Faction/ui/Root.tsx index e2436d3ad..aa0c2a935 100644 --- a/src/Faction/ui/Root.tsx +++ b/src/Faction/ui/Root.tsx @@ -279,7 +279,7 @@ export class FactionRoot extends React.Component { { canPurchaseSleeves &&