@@ -23,11 +23,14 @@ CM.Sim = {};
2323 *********/
2424
2525CM . Cache . RemakeIncome = function ( ) {
26- // Simulate Building Buys
27- CM . Sim . BuyBuildings ( ) ;
26+ // Simulate Building Buys for 1 amount
27+ CM . Sim . BuyBuildings ( 1 , 'Objects' ) ;
2828
2929 // Simulate Upgrade Buys
3030 CM . Sim . BuyUpgrades ( ) ;
31+
32+ // Simulate Building Buys for 10 amount
33+ CM . Sim . BuyBuildings ( 10 , 'Objects10' ) ;
3134}
3235
3336CM . Cache . RemakeBuildingsBCI = function ( ) {
@@ -65,12 +68,31 @@ CM.Cache.RemakeUpgradeBCI = function() {
6568 }
6669}
6770
71+ CM . Cache . RemakeBuildings10BCI = function ( ) {
72+ for ( var i in CM . Cache . Objects10 ) {
73+ CM . Cache . Objects10 [ i ] . price = CM . Sim . BuildingGetPrice ( Game . Objects [ i ] . basePrice , Game . Objects [ i ] . amount , 10 ) ;
74+ CM . Cache . Objects10 [ i ] . bci = CM . Cache . Objects10 [ i ] . price / CM . Cache . Objects10 [ i ] . bonus ;
75+ var color = '' ;
76+ if ( CM . Cache . Objects10 [ i ] . bci <= 0 || CM . Cache . Objects10 [ i ] . bci == 'Infinity' ) color = CM . Disp . colorGray ;
77+ else if ( CM . Cache . Objects10 [ i ] . bci < CM . Disp . min ) color = CM . Disp . colorBlue ;
78+ else if ( CM . Cache . Objects10 [ i ] . bci == CM . Disp . min ) color = CM . Disp . colorGreen ;
79+ else if ( CM . Cache . Objects10 [ i ] . bci == CM . Disp . max ) color = CM . Disp . colorRed ;
80+ else if ( CM . Cache . Objects10 [ i ] . bci > CM . Disp . max ) color = CM . Disp . colorPurple ;
81+ else if ( CM . Cache . Objects10 [ i ] . bci > CM . Disp . mid ) color = CM . Disp . colorOrange ;
82+ else color = CM . Disp . colorYellow ;
83+ CM . Cache . Objects10 [ i ] . color = color ;
84+ }
85+ }
86+
6887CM . Cache . RemakeBCI = function ( ) {
69- // Buildings
88+ // Buildings for 1 amount
7089 CM . Cache . RemakeBuildingsBCI ( ) ;
7190
7291 // Upgrades
7392 CM . Cache . RemakeUpgradeBCI ( ) ;
93+
94+ // Buildings for 10 amount
95+ CM . Cache . RemakeBuildings10BCI ( ) ;
7496}
7597
7698CM . Cache . RemakeLucky = function ( ) {
@@ -203,7 +225,7 @@ CM.LoadConfig = function() {
203225 if ( mod ) CM . SaveConfig ( CM . Config ) ;
204226 CM . Loop ( ) ; // Do loop once
205227 for ( var i in CM . ConfigDefault ) {
206- if ( CM . ConfigData [ i ] . func != undefined ) {
228+ if ( i != 'StatsPref' && CM . ConfigData [ i ] . func != undefined ) {
207229 CM . ConfigData [ i ] . func ( ) ;
208230 }
209231 }
@@ -1040,7 +1062,7 @@ CM.Disp.AddMenuStats = function(title) {
10401062 span . style . color = 'black' ;
10411063 span . style . fontSize = '13px' ;
10421064 span . style . verticalAlign = 'middle' ;
1043- span . textContent = CM . Config . StatsPref [ config ] ? '+ ' : '- ' ;
1065+ span . textContent = CM . Config . StatsPref [ config ] ? '- ' : '+ ' ;
10441066 span . onclick = function ( ) { CM . ToggleStatsConfig ( config ) ; Game . UpdateMenu ( ) ; } ;
10451067 div . appendChild ( span ) ;
10461068 return div ;
@@ -1371,9 +1393,20 @@ CM.Disp.AddTooltipUpgrade = function() {
13711393 }
13721394}
13731395
1396+ CM . Disp . AddTooltipBuild10 = function ( ) {
1397+ for ( var i in Game . Objects ) {
1398+ var me = Game . Objects [ i ] ;
1399+ l ( 'buttonBuy10-' + me . id ) . onmouseover = function ( ) { CM . Disp . Buy10 = true ; } ;
1400+ l ( 'buttonBuy10-' + me . id ) . onmouseout = function ( ) { CM . Disp . Buy10 = false ; } ;
1401+ }
1402+ }
1403+
13741404CM . Disp . Tooltip = function ( type , name ) {
13751405 if ( type == 'b' ) {
13761406 l ( 'tooltip' ) . innerHTML = Game . Objects [ name ] . tooltip ( ) ;
1407+ if ( CM . Disp . Buy10 ) {
1408+ l ( 'tooltip' ) . innerHTML = l ( 'tooltip' ) . innerHTML . split ( Beautify ( Game . Objects [ name ] . getPrice ( ) ) ) . join ( Beautify ( CM . Cache . Objects10 [ name ] . price ) ) ;
1409+ }
13771410 }
13781411 else { // Upgrades
13791412 CM . Disp . TooltipUpgradeBack [ name ] ( ) ;
@@ -1432,12 +1465,23 @@ CM.Disp.UpdateTooltip = function() {
14321465 var price ;
14331466 var bonus ;
14341467 if ( CM . Disp . tooltipType == 'b' ) {
1435- bonus = CM . Cache . Objects [ CM . Disp . tooltipName ] . bonus ;
1436- price = Game . Objects [ CM . Disp . tooltipName ] . getPrice ( ) ;
1437- if ( CM . Config . Tooltip == 1 ) {
1438- l ( 'CMTooltipBorder' ) . style . color = CM . Cache . Objects [ CM . Disp . tooltipName ] . color ;
1439- l ( 'CMTooltipBCI' ) . textContent = Beautify ( CM . Cache . Objects [ CM . Disp . tooltipName ] . bci , 2 ) ;
1440- l ( 'CMTooltipBCI' ) . style . color = CM . Cache . Objects [ CM . Disp . tooltipName ] . color ;
1468+ if ( ! CM . Disp . Buy10 ) {
1469+ bonus = CM . Cache . Objects [ CM . Disp . tooltipName ] . bonus ;
1470+ price = Game . Objects [ CM . Disp . tooltipName ] . getPrice ( ) ;
1471+ if ( CM . Config . Tooltip == 1 ) {
1472+ l ( 'CMTooltipBorder' ) . style . color = CM . Cache . Objects [ CM . Disp . tooltipName ] . color ;
1473+ l ( 'CMTooltipBCI' ) . textContent = Beautify ( CM . Cache . Objects [ CM . Disp . tooltipName ] . bci , 2 ) ;
1474+ l ( 'CMTooltipBCI' ) . style . color = CM . Cache . Objects [ CM . Disp . tooltipName ] . color ;
1475+ }
1476+ }
1477+ else {
1478+ bonus = CM . Cache . Objects10 [ CM . Disp . tooltipName ] . bonus ;
1479+ price = CM . Cache . Objects10 [ CM . Disp . tooltipName ] . price ;
1480+ if ( CM . Config . Tooltip == 1 ) {
1481+ l ( 'CMTooltipBorder' ) . style . color = CM . Cache . Objects10 [ CM . Disp . tooltipName ] . color ;
1482+ l ( 'CMTooltipBCI' ) . textContent = Beautify ( CM . Cache . Objects10 [ CM . Disp . tooltipName ] . bci , 2 ) ;
1483+ l ( 'CMTooltipBCI' ) . style . color = CM . Cache . Objects10 [ CM . Disp . tooltipName ] . color ;
1484+ }
14411485 }
14421486 }
14431487 else { // Upgrades
@@ -1551,6 +1595,8 @@ CM.Disp.lastGoldenCookieState = 'none';
15511595CM . Disp . metric = [ 'M' , 'G' , 'T' , 'P' , 'E' , 'Z' , 'Y' ] ;
15521596CM . Disp . shortScale = [ 'M' , 'B' , 'Tr' , 'Quadr' , 'Quint' , 'Sext' , 'Sept' , 'Oct' , 'Non' , 'Dec' , 'Undec' , 'Duodec' , 'Tredec' ] ;
15531597
1598+ CM . Disp . Buy10 = false ;
1599+
15541600/********
15551601 * Main *
15561602 ********/
@@ -1659,6 +1705,7 @@ CM.Init = function() {
16591705 CM . Disp . CreateGCTimer ( ) ;
16601706 CM . Disp . CreateTooltipWarnCaut ( ) ;
16611707 CM . Disp . AddTooltipBuild ( ) ;
1708+ CM . Disp . AddTooltipBuild10 ( ) ;
16621709 CM . ReplaceNative ( ) ;
16631710 Game . CalculateGains ( ) ;
16641711 CM . LoadConfig ( ) ; // Must be after all things are created!
@@ -1680,6 +1727,20 @@ CM.VersionMinor = '7';
16801727 * Sim *
16811728 *******/
16821729
1730+ CM . Sim . BuildingGetPrice = function ( basePrice , start , increase ) {
1731+ var totalPrice = 0 ;
1732+ var count = 0 ;
1733+ while ( count < increase ) {
1734+ var price = basePrice * Math . pow ( Game . priceIncrease , start + count ) ;
1735+ if ( Game . Has ( 'Season savings' ) ) price *= 0.99 ;
1736+ if ( Game . Has ( 'Santa\'s dominion' ) ) price *= 0.99 ;
1737+ if ( Game . Has ( 'Faberge egg' ) ) price *= 0.99 ;
1738+ totalPrice += Math . ceil ( price ) ;
1739+ count ++ ;
1740+ }
1741+ return totalPrice ;
1742+ }
1743+
16831744eval ( 'CM.Sim.Has = ' + Game . Has . toString ( ) . split ( 'Game' ) . join ( 'CM.Sim' ) ) ;
16841745
16851746CM . Sim . Win = function ( what ) {
@@ -1884,12 +1945,12 @@ CM.Sim.CheckOtherAchiev = function() {
18841945 if ( hasAllChristCook ) CM . Sim . Win ( 'Let it snow' ) ;
18851946}
18861947
1887- CM . Sim . BuyBuildings = function ( ) {
1888- CM . Cache . Objects = [ ] ;
1948+ CM . Sim . BuyBuildings = function ( amount , target ) {
1949+ CM . Cache [ target ] = [ ] ;
18891950 for ( var i in Game . Objects ) {
18901951 CM . Sim . CopyData ( ) ;
18911952 var me = CM . Sim . Objects [ i ] ;
1892- me . amount ++ ;
1953+ me . amount += amount ;
18931954
18941955 if ( i == 'Cursor' ) {
18951956 if ( me . amount >= 1 ) CM . Sim . Win ( 'Click' ) ;
@@ -1982,8 +2043,8 @@ CM.Sim.BuyBuildings = function() {
19822043 CM . Sim . CalculateGains ( ) ;
19832044 }
19842045
1985- CM . Cache . Objects [ i ] = { } ;
1986- CM . Cache . Objects [ i ] . bonus = CM . Sim . cookiesPs - Game . cookiesPs ;
2046+ CM . Cache [ target ] [ i ] = { } ;
2047+ CM . Cache [ target ] [ i ] . bonus = CM . Sim . cookiesPs - Game . cookiesPs ;
19872048 }
19882049}
19892050
0 commit comments