From 8e63755bdb5abe5c4ce2b5a4698de660c6d35902 Mon Sep 17 00:00:00 2001 From: deathride58 Date: Sun, 29 Apr 2018 22:13:27 -0400 Subject: [PATCH] fixes the intergalactic stock market crash --- code/modules/stock_market/stocks.dm | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/code/modules/stock_market/stocks.dm b/code/modules/stock_market/stocks.dm index 563e76c0a93..f3bd43c4936 100644 --- a/code/modules/stock_market/stocks.dm +++ b/code/modules/stock_market/stocks.dm @@ -1,3 +1,6 @@ +#define STOCK_MARKET_SPECPERF_MOD_MIN 0.9 +#define STOCK_MARKET_SPECPERF_MOD_MAX 1.2 + /datum/borrow var/broker = "" var/borrower = "" @@ -139,11 +142,7 @@ speculation += rand(-400, 0) / 1000 * speculation if (prob(1) && prob(5)) // pop that bubble speculation += rand(-4000, 0) / 1000 * speculation - var/fucking_stock_spikes = current_value + 500 - var/piece_of_shit_fuck = current_value - 500 - var/i_hate_this_code = (speculation / rand(25000, 50000) + performance / rand(100, 800)) * current_value - if(i_hate_this_code < fucking_stock_spikes || i_hate_this_code > piece_of_shit_fuck) - current_value = i_hate_this_code + current_value = CLAMP((speculation / rand(25000, 50000) + performance / rand(100, 800)) * current_value, current_value*STOCK_MARKET_SPECPERF_MOD_MIN, current_value*STOCK_MARKET_SPECPERF_MOD_MAX) if (current_value < 5) current_value = 5 @@ -310,3 +309,6 @@ /datum/stock/proc/displayValues(var/mob/user) user << browse(plotBarGraph(values, "[name] share value per share"), "window=stock_[name];size=450x450") + +#undef STOCK_MARKET_SPECPERF_MOD_MIN +#undef STOCK_MARKET_SPECPERF_MOD_MAX