From 77882165cc69be1eff7ae38fc2fdd365ba0d38db Mon Sep 17 00:00:00 2001
From: kopareigns <kopareigns@gmail.com>
Date: Fri, 8 Jun 2018 20:57:38 -0400
Subject: [PATCH] Tweaks

---
 src/uncategorized/corporationDevelopments.tw | 85 +++++++++++---------
 1 file changed, 47 insertions(+), 38 deletions(-)

diff --git a/src/uncategorized/corporationDevelopments.tw b/src/uncategorized/corporationDevelopments.tw
index 1ecb67cbc45..a72913b7832 100644
--- a/src/uncategorized/corporationDevelopments.tw
+++ b/src/uncategorized/corporationDevelopments.tw
@@ -159,28 +159,33 @@ You hold <<print commaNum($personalShares)>> shares personally while <<print com
 
 	<br>Sell personal shares:
 	<<if $personalShares-1000 > $publicShares>>
-		 <<link "1000">><<set $personalShares -= 1000>><<set $publicShares += 1000>><<set $cash += 1000*$sharePrice>><<set $sharePrice = (Math.trunc($sharePrice*either(98,99,$PC.trading >= 100 ? 99 : 98)))/100>><<replace "#CorpAction">><br><<print "You sold 1000 shares, driving the share price down slightly.">><</replace>><</link>><</if>>
-	<<if $personalShares-5000 > $publicShares>>
-		 | <<link "5000">><<set $personalShares -= 5000>><<set $publicShares += 5000>><<set $cash += 5000*$sharePrice>><<set $sharePrice = (Math.trunc($sharePrice*either(98,99,$PC.trading >= 100 ? 99 : 98)))/100>><<replace "#CorpAction">><br><<print "You sold 5000 shares, driving the share price down slightly.">><</replace>><</link>><</if>>
-	<<if $personalShares-10000 > $publicShares>>
-		 | <<link "10000">><<set $personalShares -= 10000>><<set $publicShares += 10000>><<set $cash += 10000*$sharePrice>><<set $sharePrice = (Math.trunc($sharePrice*either(97,99,$PC.trading >= 100 ? 99 : 98)))/100>><<replace "#CorpAction">><br><<print "You sold 10000 shares, driving the share price down slightly.">><</replace>><</link>><</if>>
-	<<if $personalShares-15000 > $publicShares>>
-		 | <<link "15000">><<set $personalShares -= 15000>><<set $publicShares += 15000>><<set $cash += 10000*$sharePrice>><<set $sharePrice = (Math.trunc($sharePrice*either(96,98,$PC.trading >= 100 ? 98 : 97)))/100>><<replace "#CorpAction">><br><<print "You sold 15000 shares, driving the share price down somewhat.">><</replace>><</link>><</if>>
-	<<if $personalShares-20000 > $publicShares>>
-		 | <<link "20000">><<set $personalShares -= 20000>><<set $publicShares += 20000>><<set $cash += 10000*$sharePrice>><<set $sharePrice = (Math.trunc($sharePrice*either(95,97,$PC.trading >= 100 ? 97 : 96)))/100>><<replace "#CorpAction">><br><<print "You sold 20000 shares, driving the share price down significantly.">><</replace>><</link>><</if>>
+		<<link "1000">><<set $personalShares -= 1000>><<set $publicShares += 1000>><<set $cash += 1000*$sharePrice>><<set $sharePrice = (Math.trunc($sharePrice*either(98,99,$PC.trading >= 100 ? 99 : 98)))/100>><<replace "#CorpAction">><br><<print "You sold 1000 shares, driving the share price down slightly.">><</replace>><</link>>
+		<<if $personalShares-5000 > $publicShares>>
+			| <<link "5000">><<set $personalShares -= 5000>><<set $publicShares += 5000>><<set $cash += 5000*$sharePrice>><<set $sharePrice = (Math.trunc($sharePrice*either(98,99,$PC.trading >= 100 ? 99 : 98)))/100>><<replace "#CorpAction">><br><<print "You sold 5000 shares, driving the share price down slightly.">><</replace>><</link>><</if>>
+		<<if $personalShares-10000 > $publicShares>>
+			| <<link "10000">><<set $personalShares -= 10000>><<set $publicShares += 10000>><<set $cash += 10000*$sharePrice>><<set $sharePrice = (Math.trunc($sharePrice*either(97,99,$PC.trading >= 100 ? 99 : 98)))/100>><<replace "#CorpAction">><br><<print "You sold 10000 shares, driving the share price down slightly.">><</replace>><</link>><</if>>
+		<<if $personalShares-15000 > $publicShares>>
+			| <<link "15000">><<set $personalShares -= 15000>><<set $publicShares += 15000>><<set $cash += 10000*$sharePrice>><<set $sharePrice = (Math.trunc($sharePrice*either(96,98,$PC.trading >= 100 ? 98 : 97)))/100>><<replace "#CorpAction">><br><<print "You sold 15000 shares, driving the share price down somewhat.">><</replace>><</link>><</if>>
+		<<if $personalShares-20000 > $publicShares>>
+			| <<link "20000">><<set $personalShares -= 20000>><<set $publicShares += 20000>><<set $cash += 10000*$sharePrice>><<set $sharePrice = (Math.trunc($sharePrice*either(95,97,$PC.trading >= 100 ? 97 : 96)))/100>><<replace "#CorpAction">><br><<print "You sold 20000 shares, driving the share price down significantly.">><</replace>><</link>><</if>>
+	<<else>>
+		//You cannot give up majority control.//
+	<</if>>
 
 	<br>Issue new public shares:
 	<<if $personalShares-1000 > $publicShares>>
-		 <<link "1000">><<set $publicShares += 1000>><<set $corpCash += 1000*Math.ceil($sharePrice)>><<set $sharePrice = (Math.trunc($sharePrice*either(98,99)))/100>><<replace "#CorpAction">><br><<print "The corporation issued 1000 new shares, driving the share price down slightly.">><</replace>><</link>><</if>>
-	<<if $personalShares-5000 > $publicShares>>
-		 | <<link "5000">><<set $publicShares += 5000>><<set $corpCash += 5000*Math.ceil($sharePrice)>><<set $sharePrice = (Math.trunc($sharePrice*either(98,99)))/100>><<replace "#CorpAction">><br><<print "The corporation issued 5000 new shares, driving the share price down slightly.">><</replace>><</link>><</if>>
-	<<if $personalShares-10000 > $publicShares>>
-		 | <<link "10000">><<set $publicShares += 10000>><<set $corpCash += 10000*Math.ceil($sharePrice)>><<set $sharePrice = (Math.trunc($sharePrice*random(97,99)))/100>><<replace "#CorpAction">><br><<print "The corporation issued 10000 new shares, driving the share price down slightly.">><</replace>><</link>><</if>>
-	<<if $personalShares-15000 > $publicShares>>
-		 | <<link "15000">><<set $publicShares += 15000>><<set $corpCash += 15000*Math.ceil($sharePrice)>><<set $sharePrice = (Math.trunc($sharePrice*random(96,98)))/100>><<replace "#CorpAction">><br><<print "The corporation issued 15000 new shares, driving the share price down somewhat.">><</replace>><</link>><</if>>
-	<<if $personalShares-20000 > $publicShares>>
-		 | <<link "20000">><<set $publicShares += 20000>><<set $corpCash += 20000*Math.ceil($sharePrice)>><<set $sharePrice = (Math.trunc($sharePrice*random(95,97)))/100>><<replace "#CorpAction">><br><<print "The corporation issued 20000 new shares, driving the share price down significantly.">><</replace>><</link>><</if>>
-
+		<<link "1000">><<set $publicShares += 1000>><<set $corpCash += 1000*Math.ceil($sharePrice)>><<set $sharePrice = (Math.trunc($sharePrice*either(98,99)))/100>><<replace "#CorpAction">><br><<print "The corporation issued 1000 new shares, driving the share price down slightly.">><</replace>><</link>>
+		<<if $personalShares-5000 > $publicShares>>
+			| <<link "5000">><<set $publicShares += 5000>><<set $corpCash += 5000*Math.ceil($sharePrice)>><<set $sharePrice = (Math.trunc($sharePrice*either(98,99)))/100>><<replace "#CorpAction">><br><<print "The corporation issued 5000 new shares, driving the share price down slightly.">><</replace>><</link>><</if>>
+		<<if $personalShares-10000 > $publicShares>>
+			| <<link "10000">><<set $publicShares += 10000>><<set $corpCash += 10000*Math.ceil($sharePrice)>><<set $sharePrice = (Math.trunc($sharePrice*random(97,99)))/100>><<replace "#CorpAction">><br><<print "The corporation issued 10000 new shares, driving the share price down slightly.">><</replace>><</link>><</if>>
+		<<if $personalShares-15000 > $publicShares>>
+			| <<link "15000">><<set $publicShares += 15000>><<set $corpCash += 15000*Math.ceil($sharePrice)>><<set $sharePrice = (Math.trunc($sharePrice*random(96,98)))/100>><<replace "#CorpAction">><br><<print "The corporation issued 15000 new shares, driving the share price down somewhat.">><</replace>><</link>><</if>>
+		<<if $personalShares-20000 > $publicShares>>
+			| <<link "20000">><<set $publicShares += 20000>><<set $corpCash += 20000*Math.ceil($sharePrice)>><<set $sharePrice = (Math.trunc($sharePrice*random(95,97)))/100>><<replace "#CorpAction">><br><<print "The corporation issued 20000 new shares, driving the share price down significantly.">><</replace>><</link>><</if>>
+	<<else>>
+		//You cannot give up majority control.//
+	<</if>>
 <</if>>/* closes actions that reduce private ownership percentage */
 
 <<if _PublicOwnershipPercentage <= 5>><br>//You cannot make the corporation privately held.//
@@ -188,49 +193,53 @@ You hold <<print commaNum($personalShares)>> shares personally while <<print com
 	<br>Purchase shares from corporation:
 	<<if $cash > 1000*$sharePrice>>
 		<<if $cash > 1000*$sharePrice>>
-			 <<link "1000">><<set $personalShares += 1000>><<set $cash -= 1000*$sharePrice>><<set $corpCash += 1000*Math.floor($sharePrice)>><<set $sharePrice = (Math.trunc($sharePrice*either(98,99)))/100>><<replace "#CorpAction">><br><<print "You purchased 1000 shares from the corporation, driving the share price down slightly.">><</replace>><</link>><</if>>
+			<<link "1000">><<set $personalShares += 1000>><<set $cash -= 1000*$sharePrice>><<set $corpCash += 1000*Math.floor($sharePrice)>><<set $sharePrice = (Math.trunc($sharePrice*either(98,99)))/100>><<replace "#CorpAction">><br><<print "You purchased 1000 shares from the corporation, driving the share price down slightly.">><</replace>><</link>><</if>>
 		<<if $cash > 5000*$sharePrice>>
-			 | <<link "5000">><<set $personalShares += 5000>><<set $cash -= 5000*$sharePrice>><<set $corpCash += 5000*Math.floor($sharePrice)>><<set $sharePrice = (Math.trunc($sharePrice*either(98,99)))/100>><<replace "#CorpAction">><br><<print "You purchased 5000 shares from the corporation, driving the share price down slightly.">><</replace>><</link>><</if>>
+			| <<link "5000">><<set $personalShares += 5000>><<set $cash -= 5000*$sharePrice>><<set $corpCash += 5000*Math.floor($sharePrice)>><<set $sharePrice = (Math.trunc($sharePrice*either(98,99)))/100>><<replace "#CorpAction">><br><<print "You purchased 5000 shares from the corporation, driving the share price down slightly.">><</replace>><</link>><</if>>
 		<<if $cash > 10000*$sharePrice>>
-			 | <<link "10000">><<set $personalShares += 10000>><<set $cash -= 10000*$sharePrice>><<set $corpCash += 10000*Math.floor($sharePrice)>><<set $sharePrice = (Math.trunc($sharePrice*random(97,99)))/100>><<replace "#CorpAction">><br><<print "You purchased 10000 shares from the corporation, driving the share price down slightly.">><</replace>><</link>><</if>>
+			| <<link "10000">><<set $personalShares += 10000>><<set $cash -= 10000*$sharePrice>><<set $corpCash += 10000*Math.floor($sharePrice)>><<set $sharePrice = (Math.trunc($sharePrice*random(97,99)))/100>><<replace "#CorpAction">><br><<print "You purchased 10000 shares from the corporation, driving the share price down slightly.">><</replace>><</link>><</if>>
 		<<if $cash > 15000*$sharePrice>>
-			 | <<link "15000">><<set $personalShares += 15000>><<set $cash -= 15000*$sharePrice>><<set $corpCash += 15000*Math.floor($sharePrice)>><<set $sharePrice = (Math.trunc($sharePrice*random(96,98)))/100>><<replace "#CorpAction">><br><<print "You purchased 15000 shares from the corporation, driving the share price down somewhat.">><</replace>><</link>><</if>>
+			| <<link "15000">><<set $personalShares += 15000>><<set $cash -= 15000*$sharePrice>><<set $corpCash += 15000*Math.floor($sharePrice)>><<set $sharePrice = (Math.trunc($sharePrice*random(96,98)))/100>><<replace "#CorpAction">><br><<print "You purchased 15000 shares from the corporation, driving the share price down somewhat.">><</replace>><</link>><</if>>
 		<<if $cash > 20000*$sharePrice>>
-			 | <<link "20000">><<set $personalShares += 20000>><<set $cash -= 20000*$sharePrice>><<set $corpCash += 20000*Math.floor($sharePrice)>><<set $sharePrice = (Math.trunc($sharePrice*random(95,97)))/100>><<replace "#CorpAction">><br><<print "You purchased 20000 shares from the corporation, driving the share price down significantly.">><</replace>><</link>><</if>>
+			| <<link "20000">><<set $personalShares += 20000>><<set $cash -= 20000*$sharePrice>><<set $corpCash += 20000*Math.floor($sharePrice)>><<set $sharePrice = (Math.trunc($sharePrice*random(95,97)))/100>><<replace "#CorpAction">><br><<print "You purchased 20000 shares from the corporation, driving the share price down significantly.">><</replace>><</link>><</if>>
 	<<else>>
 		//You are unable to purchase 1000 shares at the current share price.//
 	<</if>>
 
 	<br>Buy publicly held shares:
-	<<if $cash > 1000*$sharePrice>>
+	<<if $cash > 1000*$sharePrice && $publicShares > 1000>>
 		<<if $publicShares > 1000 && $cash >= 1000*$sharePrice>>
-			 <<link "1000">><<set $personalShares += 1000>><<set $publicShares -= 1000>><<set $cash -= 1000*$sharePrice>><<set $sharePrice = (Math.trunc($sharePrice*either(101,102,$PC.trading >= 100 ? 101 : 102)))/100>><<replace "#CorpAction">><br><<print "You bought 1000 shares, driving the share price up slightly.">><</replace>><</link>><</if>>
+			<<link "1000">><<set $personalShares += 1000>><<set $publicShares -= 1000>><<set $cash -= 1000*$sharePrice>><<set $sharePrice = (Math.trunc($sharePrice*either(101,102,$PC.trading >= 100 ? 101 : 102)))/100>><<replace "#CorpAction">><br><<print "You bought 1000 shares, driving the share price up slightly.">><</replace>><</link>><</if>>
 		<<if $publicShares > 5000 && $cash >= 5000*$sharePrice>>
-			 | <<link "5000">><<set $personalShares += 5000>><<set $publicShares -= 5000>><<set $cash -= 5000*$sharePrice>><<set $sharePrice = (Math.trunc($sharePrice*either(101,102,$PC.trading >= 100 ? 101 : 102)))/100>><<replace "#CorpAction">><br><<print "You bought 5000 shares, driving the share price up slightly.">><</replace>><</link>><</if>>
+			| <<link "5000">><<set $personalShares += 5000>><<set $publicShares -= 5000>><<set $cash -= 5000*$sharePrice>><<set $sharePrice = (Math.trunc($sharePrice*either(101,102,$PC.trading >= 100 ? 101 : 102)))/100>><<replace "#CorpAction">><br><<print "You bought 5000 shares, driving the share price up slightly.">><</replace>><</link>><</if>>
 		<<if $publicShares > 10000 && $cash >= 10000*$sharePrice>>
-			 | <<link "10000">><<set $personalShares += 10000>><<set $publicShares -= 10000>><<set $cash -= 10000*$sharePrice>><<set $sharePrice = (Math.trunc($sharePrice*either(101,103,$PC.trading >= 100 ? 101 : 102)))/100>><<replace "#CorpAction">><br><<print "You bought 10000 shares, driving the share price up slightly.">><</replace>><</link>><</if>>
+			| <<link "10000">><<set $personalShares += 10000>><<set $publicShares -= 10000>><<set $cash -= 10000*$sharePrice>><<set $sharePrice = (Math.trunc($sharePrice*either(101,103,$PC.trading >= 100 ? 101 : 102)))/100>><<replace "#CorpAction">><br><<print "You bought 10000 shares, driving the share price up slightly.">><</replace>><</link>><</if>>
 		<<if $publicShares > 15000 && $cash >= 15000*$sharePrice>>
-			 | <<link "15000">><<set $personalShares += 15000>><<set $publicShares -= 15000>><<set $cash -= 15000*$sharePrice>><<set $sharePrice = (Math.trunc($sharePrice*either(102,104,$PC.trading >= 100 ? 102 : 103)))/100>><<replace "#CorpAction">><br><<print "You bought 15000 shares, driving the share price up somewhat.">><</replace>><</link>><</if>>
+			| <<link "15000">><<set $personalShares += 15000>><<set $publicShares -= 15000>><<set $cash -= 15000*$sharePrice>><<set $sharePrice = (Math.trunc($sharePrice*either(102,104,$PC.trading >= 100 ? 102 : 103)))/100>><<replace "#CorpAction">><br><<print "You bought 15000 shares, driving the share price up somewhat.">><</replace>><</link>><</if>>
 		<<if $publicShares > 20000 && $cash >= 20000*$sharePrice>>
-			 | <<link "20000">><<set $personalShares += 20000>><<set $publicShares -= 20000>><<set $cash -= 20000*$sharePrice>><<set $sharePrice = (Math.trunc($sharePrice*either(103,105,$PC.trading >= 100 ? 103 : 104)))/100>><<replace "#CorpAction">><br><<print "You bought 20000 shares, driving the share price up significantly.">><</replace>><</link>><</if>>
-	<<else>>
+			| <<link "20000">><<set $personalShares += 20000>><<set $publicShares -= 20000>><<set $cash -= 20000*$sharePrice>><<set $sharePrice = (Math.trunc($sharePrice*either(103,105,$PC.trading >= 100 ? 103 : 104)))/100>><<replace "#CorpAction">><br><<print "You bought 20000 shares, driving the share price up significantly.">><</replace>><</link>><</if>>
+	<<elseif $publicShares > 1000>>
 		//You are unable to purchase 1000 shares at the current share price.//
+	<<else>>
+		//You cannot make the corporation privately held.//
 	<</if>>
 
 	<br>Direct the corporation to buy back publicly held shares:
-	<<if $corpCash > 1000*$sharePrice>>
+	<<if $corpCash > 1000*$sharePrice && $publicShares > 1000>>
 		<<if $publicShares > 1000 && $corpCash >= 1000*$sharePrice>>
-			 <<link "1000">><<set $publicShares -= 1000>><<set $corpCash -= 1000*Math.ceil($sharePrice)>><<set $sharePrice = (Math.trunc($sharePrice*either(101,102)))/100>><<replace "#CorpAction">><br><<print "The corporation bought back 1000 public shares, driving the share price up slightly.">><</replace>><</link>><</if>>
+			<<link "1000">><<set $publicShares -= 1000>><<set $corpCash -= 1000*Math.ceil($sharePrice)>><<set $sharePrice = (Math.trunc($sharePrice*either(101,102)))/100>><<replace "#CorpAction">><br><<print "The corporation bought back 1000 public shares, driving the share price up slightly.">><</replace>><</link>><</if>>
 		<<if $publicShares > 5000 && $corpCash >= 5000*$sharePrice>>
-			 | <<link "5000">><<set $publicShares -= 5000>><<set $corpCash -= 5000*Math.ceil($sharePrice)>><<set $sharePrice = (Math.trunc($sharePrice*either(101,102)))/100>><<replace "#CorpAction">><br><<print "The corporation bought back 5000 public shares, driving the share price up slightly.">><</replace>><</link>><</if>>
+			| <<link "5000">><<set $publicShares -= 5000>><<set $corpCash -= 5000*Math.ceil($sharePrice)>><<set $sharePrice = (Math.trunc($sharePrice*either(101,102)))/100>><<replace "#CorpAction">><br><<print "The corporation bought back 5000 public shares, driving the share price up slightly.">><</replace>><</link>><</if>>
 		<<if $publicShares > 10000 && $corpCash >= 10000*$sharePrice>>
-			 | <<link "10000">><<set $publicShares -= 10000>><<set $corpCash -= 10000*Math.ceil($sharePrice)>><<set $sharePrice = (Math.trunc($sharePrice*random(101,103)))/100>><<replace "#CorpAction">><br><<print "The corporation bought back 10000 public shares, driving the share price up slightly.">><</replace>><</link>><</if>>
+			| <<link "10000">><<set $publicShares -= 10000>><<set $corpCash -= 10000*Math.ceil($sharePrice)>><<set $sharePrice = (Math.trunc($sharePrice*random(101,103)))/100>><<replace "#CorpAction">><br><<print "The corporation bought back 10000 public shares, driving the share price up slightly.">><</replace>><</link>><</if>>
 		<<if $publicShares > 15000 && $corpCash >= 15000*$sharePrice>>
-			 | <<link "15000">><<set $publicShares -= 15000>><<set $corpCash -= 15000*Math.ceil($sharePrice)>><<set $sharePrice = (Math.trunc($sharePrice*random(102,104)))/100>><<replace "#CorpAction">><br><<print "The corporation bought back 15000 public shares, driving the share price up somewhat.">><</replace>><</link>><</if>>
+			| <<link "15000">><<set $publicShares -= 15000>><<set $corpCash -= 15000*Math.ceil($sharePrice)>><<set $sharePrice = (Math.trunc($sharePrice*random(102,104)))/100>><<replace "#CorpAction">><br><<print "The corporation bought back 15000 public shares, driving the share price up somewhat.">><</replace>><</link>><</if>>
 		<<if $publicShares > 20000 && $corpCash >= 20000*$sharePrice>>
-			 | <<link "20000">><<set $publicShares -= 20000>><<set $corpCash -= 20000*Math.ceil($sharePrice)>><<set $sharePrice = (Math.trunc($sharePrice*random(103,105)))/100>><<replace "#CorpAction">><br><<print "The corporation bought back 20000 public shares, driving the share price up significantly.">><</replace>><</link>><</if>>
-	<<else>>
+			| <<link "20000">><<set $publicShares -= 20000>><<set $corpCash -= 20000*Math.ceil($sharePrice)>><<set $sharePrice = (Math.trunc($sharePrice*random(103,105)))/100>><<replace "#CorpAction">><br><<print "The corporation bought back 20000 public shares, driving the share price up significantly.">><</replace>><</link>><</if>>
+	<<elseif $publicShares > 1000>>
 		//The corporation is unable to purchase 1000 shares at the current share price.//
+	<<else>>
+		//You cannot make the corporation privately held.//
 	<</if>>
 
 <</if>> /* closes actions that reduce public ownership percentage */
-- 
GitLab