diff --git a/src/uncategorized/corporationDevelopments.tw b/src/uncategorized/corporationDevelopments.tw index ece1c3d8e19c54b09d0edd9a5c8794fc6aefa32b..762edaf229ace8ce73846dd57a7bf9dd377fbf56 100644 --- a/src/uncategorized/corporationDevelopments.tw +++ b/src/uncategorized/corporationDevelopments.tw @@ -1,6 +1,60 @@ :: Corporation Developments [nobr] -<<if $detailedCorpControls == 1>> +/*Main Corporation Loop*/ +<<set _corpTurnover = Math.trunc(($corpAssets + random(1,10) * 1000) * $slaveCostFactor * $localEcon * 0.04), +_corpUpkeep = Math.trunc($corpAssets * $corpSizePenalty), +$corpDividend += Math.trunc(_corpTurnover * $dividendRatio), +$corpCash += _corpTurnover * (1 - $dividendRatio) - _corpUpkeep>> +<<if $corpAssets == $corpAssetCap>> /*The corporation is at it's current asset limit and will not invest in assets until it can afford a major investment*/ + <<if $corpCash >= $corpInvestment>> + <<set $corpCash -= $corpInvestment, + $corpAssets += $corpUpgrade, + $corpSize += 1, + $corpAssetCap = some function of $corpSize, /*The specific functions are TBD*/ + $corpInvestment = some function of $corpSize, + $corpUpgrade = some function of $corpSize, + $corpSizePenalty = some function of $corpSize>> + <</if>> +<<elseif $corpCash > $corpAssets * 0.05>> /*The corporation wants to have a cash buffer of 5% of it's total assets to run smoothly. Everything else is invested in additional assets.*/ + <<set _assetBuy = $corpCash - $corpAssets * 0.05, + $corpCash -= _assetBuy>> + <<if _assetBuy > $corpAssetCap - $corpAssets>> /*When the corporation reaches the asset cap*/ + <<set _assetBuy -= $corpAssetCap - $corpAssets, + $corpCash += _assetBuy, + $corpAssets = $corpAssetCap>> + <<else>> /*Otherwise it invests in assets freely*/ + <<set $corpAssets += _assetBuy>> + <</if>> +<<elseif $corpCash < 0>> /*If the corporation runs out of cash it has to liquidate assets, should only happen once upkeep gets very large*/ + <<set _assetSell = Math.trunc($corpCash * 1.2), + $corpAssets += _assetSell, + $corpCash = 0>> +<</if>> +<<set $corpValue = $corpAssets * 1.5 + $corpCash>> + +/*Dividends +The player can choose the level of dividends they want*/ +<<if $dividendRatio > 0.5>> + <br>The corporation is currently reserving 75% of its turnover to be paid out as dividends. +<<elseif $dividendRatio > 0.25>> + <br>The corporation is currently reserving 50% of its turnover to be paid out as dividends. +<<elseif $dividendRatio > 0>> + <br>The corporation is currently reserving 25% of its turnover to be paid out as dividends. +<<else>> + <br>The corporation is currently not reserving money to be paid out as dividends. +<</if>> +/*Need to still implement the choices themselves*/ + +/*The corporation pays out every quarter (13 weeks)*/ +<<if $dividendTimer == 0>> + <<set _dividendPayout = Math.trunc($corpDividend * $personalShares / ($personalShares + $publicShares)), + $cash += _dividendPayout, + $dividendTimer = 12>> +<<elseif $corpIncorporated == 1>> + <<set $dividendTimer -= 1>> +<</if>> + +/*<<if $detailedCorpControls == 1>> <<set _Numgeneral = "ALL">> <<set _Numslave = "ALL">> <<set _Numentrapment = "ALL">> @@ -1715,3 +1769,4 @@ You hold <<print commaNum($personalShares)>> shares valued at @@.yellowgreen;<<p <</if>> </span> +*/ \ No newline at end of file