diff --git a/src/js/datatypeCleanupJS.tw b/src/js/datatypeCleanupJS.tw index 75f7f434a08e2cc76dfa91515779e4b118ad843e..63307a7559b62ddca122a495d94ce6786e1da8e6 100644 --- a/src/js/datatypeCleanupJS.tw +++ b/src/js/datatypeCleanupJS.tw @@ -598,7 +598,7 @@ window.slaveMiscellaneousDatatypeCleanup = function slaveMiscellaneousDatatypeCl slave.death = ""; } if (slave.slaveCost !== 0) { - slave.slaveCost = Math.max(+slave.slaveCost, -1) || -1; + slave.slaveCost = Math.min(+slave.slaveCost, 1) || 1; } slave.lifetimeCashExpenses = Math.max(+slave.lifetimeCashExpenses, 0) || 0; slave.lifetimeCashIncome = Math.max(+slave.lifetimeCashIncome, 0) || 0; diff --git a/src/js/economyJS.tw b/src/js/economyJS.tw index fd813506d0b0858a086e573037492cac22f5e0d8..bcd0c23e57b7821ed226e2ec201d0bb984cea30f 100644 --- a/src/js/economyJS.tw +++ b/src/js/economyJS.tw @@ -981,7 +981,7 @@ window.cashX = function(cost, what, who) { V.lastWeeksCashIncome[what] += cost; //record the slave, if available - if (who !== undefined){ + if (typeof who !== 'undefined'){ who.lastWeeksCashIncome += cost; who.lifetimeCashIncome += cost; } @@ -995,25 +995,25 @@ window.cashX = function(cost, what, who) { //EXPENSES else if(cost < 0) { - if (typeof V.lastWeeksCashExpenses[what] !== 'undefined') { - - //record the action - V.lastWeeksCashExpenses[what] += cost; - - //record the slave, if available - if (who !== undefined){ - if (what == "slaveTransfer"){ - who.slaveCost += cost; - } else { - who.lifetimeCashExpenses += cost; - } + if (typeof V.lastWeeksCashExpenses[what] !== 'undefined') { + + //record the action + V.lastWeeksCashExpenses[what] += cost; + + //record the slave, if available + if (typeof who !== 'undefined'){ + if (what === "slaveTransfer"){ + who.slaveCost = cost; + } else { + who.lifetimeCashExpenses += cost; } - - //Spend the money - V.cash += cost; - } else { - V.lastWeeksErrors += `Unknown place "${what}",`; } + + //Spend the money + V.cash += cost; + } else { + V.lastWeeksErrors += `Unknown place "${what}",`; + } } else { //somebody probably tried to pass a 0, ignore it. diff --git a/src/js/slaveGenerationJS.tw b/src/js/slaveGenerationJS.tw index 62987b67111b8d6fad147b4ab43957be37249629..e9aa0247ffbbd76bb3d12adab22191692fc141ce 100644 --- a/src/js/slaveGenerationJS.tw +++ b/src/js/slaveGenerationJS.tw @@ -1747,7 +1747,14 @@ window.BaseSlave = function BaseSlave() { override_Brow_H_Color: 0, missingEyes: 0, missingArms: 0, - missingLegs: 0 + missingLegs: 0, + slaveCost: 0, + lifetimeCashExpenses: 0, + lifetimeCashIncome: 0, + lastWeeksCashIncome: 0, + lifetimeRepExpenses: 0, + lifetimeRepIncome: 0, + lastWeeksRepIncome: 0 }; }; diff --git a/src/uncategorized/corporateMarket.tw b/src/uncategorized/corporateMarket.tw index 99152ad2974828637886a5e1f812b7042703cced..019fcb19cdb7e2a24a7712c74a6b48023d0e1f06 100644 --- a/src/uncategorized/corporateMarket.tw +++ b/src/uncategorized/corporateMarket.tw @@ -87,7 +87,7 @@ while you browse. The offered price is <<print cashFormat($slaveCost)>>.<<if $slavesSeen > $slaveMarketLimit>> You have cast such a wide net for slaves this week that it is becoming more expensive to find more for sale. Your reputation helps determine your reach within the slave market.<</if>> <br> <<if $cash >= $slaveCost>> - [["Buy " + $his + " slave contract"|New Slave Intro][cashX($slaveCost, "slaveTransfer", $activeSlave),$nextButton = "Continue",$nextLink = "AS Dump",$returnTo = "Main"]] + [["Buy " + $his + " slave contract"|New Slave Intro][cashX(forceNeg($slaveCost), "slaveTransfer", $activeSlave),$nextButton = "Continue",$nextLink = "AS Dump",$returnTo = "Main"]] <<else>> //You lack the necessary funds to buy this slave.// <</if>> diff --git a/src/uncategorized/costsWidgets.tw b/src/uncategorized/costsWidgets.tw index d406383f29b2244dc5be0e6aac6538489bde15b7..b259ecb3e44181a66563d6311c477c4aabd276f1 100644 --- a/src/uncategorized/costsWidgets.tw +++ b/src/uncategorized/costsWidgets.tw @@ -409,7 +409,7 @@ <<if $args[0].origin != 0>> $args[0].origin<br> <</if>> - <<if $args[0].slaveCost > 0>> + <<if $args[0].slaveCost < 0>> You bought her for: ¤$args[0].slaveCost. <<set _Cost = $args[0].slaveCost>> <<elseif $args[0].slaveCost == 0>> diff --git a/src/uncategorized/genericPlotEvents.tw b/src/uncategorized/genericPlotEvents.tw index 8cfecb1e08bf8bd358542bb69f3978d509935671..c4e124a1eeb73763f13f33ba46a11df4d59ddc57 100644 --- a/src/uncategorized/genericPlotEvents.tw +++ b/src/uncategorized/genericPlotEvents.tw @@ -1333,7 +1333,7 @@ A screen opposite your desk springs to life, <<if $assistant == 0>>showing your <<replace "#result">> <<for _genPlot = 0; _genPlot < _newSlaves.length; _genPlot++>> <<slaveCost _newSlaves[_genPlot]>> - <<run cashX($slaveCost, "slaveTransfer")>> + <<run cashX(forceNeg($slaveCost), "slaveTransfer")>> <</for>> Prisoners @@.green;sold.@@ <</replace>> diff --git a/src/uncategorized/pCoupAttempt.tw b/src/uncategorized/pCoupAttempt.tw index 24788e6e0fe12203d88cbfd2b245ab0e1300c30c..1891bd4f87267bff9188e1052f04d1777ba366cf 100644 --- a/src/uncategorized/pCoupAttempt.tw +++ b/src/uncategorized/pCoupAttempt.tw @@ -262,7 +262,7 @@ You are awakened in the middle of the night by a jolt that shakes the entire arc <<replace "#result">> <<for _pca = 0; _pca < _newSlaves.length; _pca++>> <<slaveCost _newSlaves[_pca]>> - <<run cashX($slaveCost, "slaveTransfer")>> + <<run cashX(forceNeg($slaveCost), "slaveTransfer")>> <</for>> Prisoners sold. <</replace>> diff --git a/src/uncategorized/pInvasion.tw b/src/uncategorized/pInvasion.tw index 0a46fb9ff0441fe4a9ec9ae146355c355add55d6..ab202522e993b82c9d5ff0d4124c47c2d79912bb 100644 --- a/src/uncategorized/pInvasion.tw +++ b/src/uncategorized/pInvasion.tw @@ -116,7 +116,7 @@ The loose militia lately organized by the arcology owners has been called out to <<replace "#result">> <<for _i = 0; _i < _newSlaves.length; _i++>> <<slaveCost _newSlaves[_i]>> - <<run cashX($slaveCost, "slaveTransfer")>> + <<run cashX(forceNeg($slaveCost), "slaveTransfer")>> <</for>> Prisoners sold. <</replace>> diff --git a/src/uncategorized/pMercenaryRomeo.tw b/src/uncategorized/pMercenaryRomeo.tw index 67ce4b964c2439c863159a7d4fc8ca2247d84004..713bddbd343baab4938a380ecf5ef14fc2dc9207 100644 --- a/src/uncategorized/pMercenaryRomeo.tw +++ b/src/uncategorized/pMercenaryRomeo.tw @@ -103,7 +103,7 @@ proffered by an attentive slave girl, he seems almost bashful. As he picks up her limbless form to give her a hug, <</if>> she gives the nearest camera a little nod and silently mouths the words "Thank you, <<= WrittenMaster($activeSlave)>>." Soon the romantic story of The Mercenary and the Slave Girl is being told in bars and brothels across the Free City, with you naturally playing @@.green;a supporting role.@@ - <<run cashX($slaveCost, "slaveTransfer")>> + <<run cashX(forceNeg($slaveCost), "slaveTransfer")>> <<include "Remove activeSlave">> <</if>> <<unset $romeoID>> diff --git a/src/uncategorized/pRaidResult.tw b/src/uncategorized/pRaidResult.tw index 4e1460f643a9ba73f5c4c76736242f46f8d8fc65..efcd84e8e22335d01e821a5ddd2e88aba1a888c1 100644 --- a/src/uncategorized/pRaidResult.tw +++ b/src/uncategorized/pRaidResult.tw @@ -50,7 +50,7 @@ Out ahead of the main body of refugees there is a small knot moving quickly and <<replace "#result">> <<for _prr = 0; _prr < _newSlaves.length; _prr++>> <<slaveCost _newSlaves[_prr]>> - <<run cashX($slaveCost, "slaveTransfer")>> + <<run cashX(forceNeg($slaveCost), "slaveTransfer")>> <</for>> Prisoners sold. <</replace>> diff --git a/src/uncategorized/reBoomerang.tw b/src/uncategorized/reBoomerang.tw index a4e695dc1be235f66bcc389219a4245edf0a8eb5..89405f94f27e2c3394b2c965ef60b78ef21f839a 100644 --- a/src/uncategorized/reBoomerang.tw +++ b/src/uncategorized/reBoomerang.tw @@ -468,7 +468,7 @@ It isn't obvious how $he managed to escape, though no doubt you could review the <</replace>> <</link>> //This will cost in <<print cashFormat($contractCost)>>.// <br><<link "Sell $him immediately">> - <<run cashX($slaveCost, "slaveTransfer")>> + <<run cashX(forceNeg($slaveCost), "slaveTransfer")>> <<replace "#result">> The penthouse opens, and $activeSlave.slaveName stumbles inside, sobbing $his thanks. $He's immediately conducted to the autosurgery for some quick cosmetic surgery, while you and $assistantName do the necessary work to falsify the arcology records and conceal $his origins. Before $he's even out from under anesthesia, $he's bundled off into one of the hundreds of slave shipments that move between arcologies every day. This time $he'll be sold far enough away that no matter how much of an escape artist $he is, you won't be seeing any more of $him. $He can whine elsewhere. <<set $boomerangStats = 0>> diff --git a/src/uncategorized/reFSAcquisition.tw b/src/uncategorized/reFSAcquisition.tw index 70301817bf489706eadaed338cce0a2e1cb73345..e5ff5c674158100829e435c3b4c0e27f2a641cd3 100644 --- a/src/uncategorized/reFSAcquisition.tw +++ b/src/uncategorized/reFSAcquisition.tw @@ -1421,7 +1421,7 @@ The call comes in from an office, and you suppress the urge to check whether $as <</replace>> <</link>> //This will cost <<print cashFormat($contractCost)>>// <br><<link "Sell $him immediately">> - <<run cashX($slaveCost, "slaveTransfer")>> + <<run cashX(forceNeg($slaveCost), "slaveTransfer")>> <<replace "#result">> <<switch $FSAcquisitionEvents>> <<case "Pastoralist">> diff --git a/src/uncategorized/reMalefactor.tw b/src/uncategorized/reMalefactor.tw index bf2ffeab58df0a25cb465c5d7d4f0344858499c9..a2a54aac5e629fae7378b40f733ed562c77b0b82 100644 --- a/src/uncategorized/reMalefactor.tw +++ b/src/uncategorized/reMalefactor.tw @@ -590,7 +590,7 @@ $He is easily taken into custody and $his contraband confiscated once the jeerin <</link>> <</if>> <br><<link "Sell $him immediately">> - <<run cashX($slaveCost, "slaveTransfer")>> + <<run cashX(forceNeg($slaveCost), "slaveTransfer")>> <<if $cash4Babies == 1 && $malefactor == "anchorBaby">> <<run cashX(random(20,30), "slaveTransfer")>> <</if>> diff --git a/src/uncategorized/reRecruit.tw b/src/uncategorized/reRecruit.tw index 0b304fe8db99b1eac6092b3b5b565ff3083ed91c..e6e1ce7f2285505ca2dbc90fab035c6ac3f826c2 100644 --- a/src/uncategorized/reRecruit.tw +++ b/src/uncategorized/reRecruit.tw @@ -2674,7 +2674,7 @@ He explains that one of his servant <<= $girl>>s was impregnated by his fool of <<case "forbidden love">> <<default>> <br><<link "Sell $him immediately">> - <<run cashX($slaveCost, "slaveTransfer")>> + <<run cashX(forceNeg($slaveCost), "slaveTransfer")>> <<replace "#result">> <<switch $recruit>> <<case "held POW">> diff --git a/src/uncategorized/resFailure.tw b/src/uncategorized/resFailure.tw index b5fd4e4e3caed6cdd823b17ba613b405841f8edd..590353b311319c31974af0ad86a04df47e06e437 100644 --- a/src/uncategorized/resFailure.tw +++ b/src/uncategorized/resFailure.tw @@ -804,56 +804,56 @@ The failure of a prominent organization within your arcology has @@.red;affected <<if $RESFailure == "TSS">> <<if ($slaves[$i].origin == "She was given to you by a failed branch campus of The Slavegirl School right after her majority.") || ($slaves[$i].origin == "She was given to you by a failed branch campus of The Slavegirl School after she was retrained as a slave girl.")>> <<slaveCost $slaves[$i]>> - <<run cashX($slaveCost, "slaveTransfer")>> + <<run cashX(forceNeg($slaveCost), "slaveTransfer")>> <<include "Remove activeSlave">> <<set $i -= 1>> <</if>> <<elseif $RESFailure == "GRI">> <<if $slaves[$i].origin == "She was given to you by a failed subsidiary lab of the Growth Research Institute right after her use as a test subject ended.">> <<slaveCost $slaves[$i]>> - <<run cashX($slaveCost, "slaveTransfer")>> + <<run cashX(forceNeg($slaveCost), "slaveTransfer")>> <<include "Remove activeSlave">> <<set $i -= 1>> <</if>> <<elseif $RESFailure == "SCP">> <<if $slaves[$i].origin == "She was given to you by a failed branch campus of St. Claver Preparatory after she served as a plastic surgeon's passing final exam.">> <<slaveCost $slaves[$i]>> - <<run cashX($slaveCost, "slaveTransfer")>> + <<run cashX(forceNeg($slaveCost), "slaveTransfer")>> <<include "Remove activeSlave">> <<set $i -= 1>> <</if>> <<elseif $RESFailure == "LDE">> <<if $slaves[$i].origin == "She was given to you by a failed branch campus of the innovative École des Enculées right after her graduation.">> <<slaveCost $slaves[$i]>> - <<run cashX($slaveCost, "slaveTransfer")>> + <<run cashX(forceNeg($slaveCost), "slaveTransfer")>> <<include "Remove activeSlave">> <<set $i -= 1>> <</if>> <<elseif $RESFailure == "TGA">> <<if $slaves[$i].origin == "She was given to you by a failed branch campus of the intense Gymnasium-Academy right after her majority.">> <<slaveCost $slaves[$i]>> - <<run cashX($slaveCost, "slaveTransfer")>> + <<run cashX(forceNeg($slaveCost), "slaveTransfer")>> <<include "Remove activeSlave">> <<set $i -= 1>> <</if>> <<elseif $RESFailure == "HA">> <<if $slaves[$i].origin == "She was given to you by a failed branch campus of the Hippolyta Academy right after her majority.">> <<slaveCost $slaves[$i]>> - <<run cashX($slaveCost, "slaveTransfer")>> + <<run cashX(forceNeg($slaveCost), "slaveTransfer")>> <<include "Remove activeSlave">> <<set $i -= 1>> <</if>> <<elseif $RESFailure == "TCR">> <<if $slaves[$i].origin == "She is a prized dairy cow given to you by a failed local pasture of The Cattle Ranch.">> <<slaveCost $slaves[$i]>> - <<run cashX($slaveCost, "slaveTransfer")>> + <<run cashX(forceNeg($slaveCost), "slaveTransfer")>> <<include "Remove activeSlave">> <<set $i -= 1>> <</if>> <<else>> <<if ($slaves[$i].origin == "She was the leader of your arcology's Futanari Sisters until you engineered her community's failure and enslavement.") || ($slaves[$i].origin == "She was a Futanari Sister until you engineered her early enslavement.")>> <<slaveCost $slaves[$i]>> - <<run cashX($slaveCost, "slaveTransfer")>> + <<run cashX(forceNeg($slaveCost), "slaveTransfer")>> <<include "Remove activeSlave">> <<set $i -= 1>> <</if>> diff --git a/src/uncategorized/seRecruiterSuccess.tw b/src/uncategorized/seRecruiterSuccess.tw index 7411a622b220886313470b7c9ba5b6e7d361ee28..5dd8d366a6b51f880dca10b89a8c56c015f4431e 100644 --- a/src/uncategorized/seRecruiterSuccess.tw +++ b/src/uncategorized/seRecruiterSuccess.tw @@ -256,7 +256,7 @@ Your recruiter $Recruiter.slaveName has succeeded; $he's convinced a desperate o <</replace>> <</link>> //This will cost <<print cashFormat($contractCost)>>// <br><<link "Sell _him2 immediately">> - <<run cashX($slaveCost, "slaveTransfer", $Recruiter)>> + <<run cashX(forceNeg($slaveCost), "slaveTransfer", $Recruiter)>> <<replace "#result">> $activeSlave.slaveName accepts being resold without much fuss. _He2's merely exchanged one unknown owner for another. For all _he2 knows _his2 new buyer will be less abusive than you would have been. _He2 would be less complacent if _he2 knew who _his2 buyers are; _he2'll be immured in an arcade within the hour. <</replace>>