@@ -83,31 +83,48 @@ CM.Cache.RemakeLucky = function() {
8383 CM . Cache . LuckyRewardFrenzy = ( CM . Cache . LuckyFrenzy * 0.1 ) + 13 ;
8484}
8585
86- CM . Cache . RemakeChain = function ( ) {
87- CM . Cache . Chain = Game . cookiesPs * 60 * 60 * 3 / 0.25 ;
88-
89- var digit = 7 ;
86+ CM . Cache . MaxChainMoni = function ( digit , maxPayout ) {
9087 var chain = 1 + Math . max ( 0 , Math . ceil ( Math . log ( Game . cookies ) / Math . LN10 ) - 10 ) ;
91- var maxPayout = Game . cookiesPs * 60 * 60 * 3 ;
9288 var moni = Math . max ( digit , Math . min ( Math . floor ( 1 / 9 * Math . pow ( 10 , chain ) * digit ) , maxPayout ) ) ;
9389 var nextMoni = Math . max ( digit , Math . min ( Math . floor ( 1 / 9 * Math . pow ( 10 , chain + 1 ) * digit ) , maxPayout ) ) ;
9490 while ( nextMoni < maxPayout ) {
9591 chain ++ ;
9692 moni = Math . max ( digit , Math . min ( Math . floor ( 1 / 9 * Math . pow ( 10 , chain ) * digit ) , maxPayout ) ) ;
9793 nextMoni = Math . max ( digit , Math . min ( Math . floor ( 1 / 9 * Math . pow ( 10 , chain + 1 ) * digit ) , maxPayout ) ) ;
9894 }
99- CM . Cache . ChainReward = moni ;
95+ return moni ;
96+ }
97+
98+ CM . Cache . RemakeChain = function ( ) {
99+ var maxPayout = Game . cookiesPs * 60 * 60 * 3 ;
100+ if ( Game . frenzy > 0 ) {
101+ maxPayout /= Game . frenzyPower ;
102+ }
100103
101- digit = 6 ;
102- chain = 1 + Math . max ( 0 , Math . ceil ( Math . log ( Game . cookies ) / Math . LN10 ) - 10 ) ;
103- moni = Math . max ( digit , Math . min ( Math . floor ( 1 / 9 * Math . pow ( 10 , chain ) * digit ) , maxPayout ) ) ;
104- nextMoni = Math . max ( digit , Math . min ( Math . floor ( 1 / 9 * Math . pow ( 10 , chain + 1 ) * digit ) , maxPayout ) ) ;
105- while ( nextMoni < maxPayout ) {
106- chain ++ ;
107- moni = Math . max ( digit , Math . min ( Math . floor ( 1 / 9 * Math . pow ( 10 , chain ) * digit ) , maxPayout ) ) ;
108- nextMoni = Math . max ( digit , Math . min ( Math . floor ( 1 / 9 * Math . pow ( 10 , chain + 1 ) * digit ) , maxPayout ) ) ;
104+ CM . Cache . ChainReward = CM . Cache . MaxChainMoni ( 7 , maxPayout ) ;
105+
106+ CM . Cache . ChainWrathReward = CM . Cache . MaxChainMoni ( 6 , maxPayout ) ;
107+
108+ var base = 0 ;
109+ if ( CM . Cache . ChainReward > CM . Cache . ChainWrathReward ) {
110+ base = CM . Cache . ChainReward ;
109111 }
110- CM . Cache . ChainWrathReward = moni ;
112+ else {
113+ base = CM . Cache . ChainWrathReward ;
114+ }
115+ var count = 1 ;
116+ while ( base == base + count ) {
117+ count ++ ;
118+ }
119+ CM . Cache . Chain = ( base + count ) / 0.25 ;
120+
121+ CM . Cache . ChainFrenzyReward = CM . Cache . MaxChainMoni ( 7 , maxPayout * 7 ) ;
122+
123+ count = 1 ;
124+ while ( CM . Cache . ChainFrenzyReward == CM . Cache . ChainFrenzyReward + count ) {
125+ count ++ ;
126+ }
127+ CM . Cache . ChainFrenzy = ( CM . Cache . ChainFrenzyReward + count ) / 0.25 ;
111128}
112129
113130CM . Cache . RemakeSeaSpec = function ( ) {
@@ -125,6 +142,8 @@ CM.Cache.SeaSpec = 0;
125142CM . Cache . Chain = 0 ;
126143CM . Cache . ChainReward = 0 ;
127144CM . Cache . ChainWrathReward = 0 ;
145+ CM . Cache . ChainFrenzy = 0 ;
146+ CM . Cache . ChainFrenzyReward = 0 ;
128147/**********
129148 * Config *
130149 **********/
@@ -973,31 +992,50 @@ CM.Disp.AddMenu = function() {
973992
974993 var chainColor = ( Game . cookies < CM . Cache . Chain ) ? CM . Disp . colorRed : CM . Disp . colorGreen ;
975994 var chainTime = ( Game . cookies < CM . Cache . Chain ) ? CM . Disp . FormatTime ( ( CM . Cache . Chain - Game . cookies ) / ( Game . cookiesPs * ( 1 - Game . cpsSucked ) ) ) : '' ;
976-
995+ var chainColorFrenzy = ( Game . cookies < CM . Cache . ChainFrenzy ) ? CM . Disp . colorRed : CM . Disp . colorGreen ;
996+ var chainTimeFrenzy = ( Game . cookies < CM . Cache . ChainFrenzy ) ? CM . Disp . FormatTime ( ( CM . Cache . ChainFrenzy - Game . cookies ) / ( Game . cookiesPs * ( 1 - Game . cpsSucked ) ) ) : '' ;
997+ var chainCurMax = Math . min ( Game . cookiesPs * 60 * 60 * 3 , Game . cookies * 0.25 ) ;
998+ var chainCur = CM . Cache . MaxChainMoni ( 7 , chainCurMax ) ;
999+ var chainCurWrath = CM . Cache . MaxChainMoni ( 6 , chainCurMax ) ;
9771000
9781001 var possibleHC = Game . HowMuchPrestige ( Game . cookiesEarned + Game . cookiesReset ) ;
9791002 var neededCook = CM . Sim . CookNeedPrest ( possibleHC + 1 ) - ( Game . cookiesEarned + Game . cookiesReset ) ;
9801003
981- var halloCook = 0 ;
1004+ var specDisp = false ;
1005+ var halloCook = [ ] ;
9821006 for ( var i in CM . Data . HalloCookies ) {
983- if ( Game . Has ( CM . Data . HalloCookies [ i ] ) ) halloCook ++ ;
1007+ if ( ! Game . Has ( CM . Data . HalloCookies [ i ] ) ) {
1008+ halloCook . push ( CM . Data . HalloCookies [ i ] ) ;
1009+ specDisp = true ;
1010+ }
9841011 }
985- var christCook = 0 ;
1012+ var christCook = [ ] ;
9861013 for ( var i in CM . Data . ChristCookies ) {
987- if ( Game . Has ( CM . Data . ChristCookies [ i ] ) ) christCook ++ ;
1014+ if ( ! Game . Has ( CM . Data . ChristCookies [ i ] ) ) {
1015+ christCook . push ( CM . Data . ChristCookies [ i ] ) ;
1016+ specDisp = true ;
1017+ }
9881018 }
989- var valCook = 0 ;
1019+ var valCook = [ ] ;
9901020 for ( var i in CM . Data . ValCookies ) {
991- if ( Game . Has ( CM . Data . ValCookies [ i ] ) ) valCook ++ ;
992- else break ;
1021+ if ( ! Game . Has ( CM . Data . ValCookies [ i ] ) ) {
1022+ valCook . push ( CM . Data . ValCookies [ i ] ) ;
1023+ specDisp = true ;
1024+ }
9931025 }
994- var normEggs = 0 ;
1026+ var normEggs = [ ] ;
9951027 for ( var i in Game . eggDrops ) {
996- if ( Game . HasUnlocked ( Game . eggDrops [ i ] ) ) normEggs ++ ;
1028+ if ( ! Game . HasUnlocked ( Game . eggDrops [ i ] ) ) {
1029+ normEggs . push ( Game . eggDrops [ i ] ) ;
1030+ specDisp = true ;
1031+ }
9971032 }
998- var rareEggs = 0 ;
1033+ var rareEggs = [ ] ;
9991034 for ( var i in Game . rareEggDrops ) {
1000- if ( Game . HasUnlocked ( Game . rareEggDrops [ i ] ) ) rareEggs ++ ;
1035+ if ( ! Game . HasUnlocked ( Game . rareEggDrops [ i ] ) ) {
1036+ rareEggs . push ( Game . rareEggDrops [ i ] ) ;
1037+ specDisp = true ;
1038+ }
10011039 }
10021040
10031041 var listing = function ( name , text ) {
@@ -1050,9 +1088,24 @@ CM.Disp.AddMenu = function() {
10501088 chainReqSmall . textContent = ' (' + chainTime + ')' ;
10511089 chainReqFrag . appendChild ( chainReqSmall ) ;
10521090 }
1053- stats . appendChild ( listing ( 'Chain Cookies Required' , chainReqFrag ) ) ;
1054- stats . appendChild ( listing ( 'Chain Reward (MAX)' , document . createTextNode ( Beautify ( CM . Cache . ChainReward ) ) ) ) ;
1055- stats . appendChild ( listing ( 'Chain Reward (MAX) (Wrath)' , document . createTextNode ( Beautify ( CM . Cache . ChainWrathReward ) ) ) ) ;
1091+ stats . appendChild ( listing ( '\"Chain\" Cookies Required' , chainReqFrag ) ) ;
1092+ var chainReqFrenFrag = document . createDocumentFragment ( ) ;
1093+ var chainReqFrenSpan = document . createElement ( 'span' ) ;
1094+ chainReqFrenSpan . style . fontWeight = 'bold' ;
1095+ chainReqFrenSpan . style . color = chainColorFrenzy ;
1096+ chainReqFrenSpan . textContent = Beautify ( CM . Cache . ChainFrenzy ) ;
1097+ chainReqFrenFrag . appendChild ( chainReqFrenSpan ) ;
1098+ if ( chainTimeFrenzy != '' ) {
1099+ var chainReqFrenSmall = document . createElement ( 'small' ) ;
1100+ chainReqFrenSmall . textContent = ' (' + chainTimeFrenzy + ')' ;
1101+ chainReqFrenFrag . appendChild ( chainReqFrenSmall ) ;
1102+ }
1103+ stats . appendChild ( listing ( '\"Chain\" Cookies Required (Frenzy)' , chainReqFrenFrag ) ) ;
1104+ stats . appendChild ( listing ( '\"Chain\" Reward (MAX)' , document . createTextNode ( Beautify ( CM . Cache . ChainReward ) ) ) ) ;
1105+ stats . appendChild ( listing ( '\"Chain\" Reward (MAX) (Wrath)' , document . createTextNode ( Beautify ( CM . Cache . ChainWrathReward ) ) ) ) ;
1106+ stats . appendChild ( listing ( '\"Chain\" Reward (MAX) (Frenzy)' , document . createTextNode ( Beautify ( CM . Cache . ChainFrenzyReward ) ) ) ) ;
1107+ stats . appendChild ( listing ( '\"Chain\" Reward (CUR)' , document . createTextNode ( Beautify ( chainCur ) ) ) ) ;
1108+ stats . appendChild ( listing ( '\"Chain\" Reward (CUR) (Wrath)' , document . createTextNode ( Beautify ( chainCurWrath ) ) ) ) ;
10561109 stats . appendChild ( header ( 'Heavenly Chips' ) ) ;
10571110 var hcMaxFrag = document . createDocumentFragment ( ) ;
10581111 hcMaxFrag . appendChild ( document . createTextNode ( Beautify ( possibleHC ) ) ) ;
@@ -1079,14 +1132,55 @@ CM.Disp.AddMenu = function() {
10791132 if ( Game . Has ( 'Wrinklerspawn' ) ) sucked *= 1.05 ;
10801133 stats . appendChild ( listing ( 'Rewards of Popping' , document . createTextNode ( Beautify ( sucked ) ) ) ) ;
10811134 }
1082- stats . appendChild ( header ( 'Season Specials' ) ) ;
1083- stats . appendChild ( listing ( 'Halloween Cookies Bought' , document . createTextNode ( halloCook + ' of ' + CM . Data . HalloCookies . length ) ) ) ;
1084- stats . appendChild ( listing ( 'Christmas Cookies Bought' , document . createTextNode ( christCook + ' of ' + CM . Data . ChristCookies . length ) ) ) ;
1085- stats . appendChild ( listing ( 'Valentine Cookies Bought' , document . createTextNode ( valCook + ' of ' + CM . Data . ValCookies . length ) ) ) ;
1086- stats . appendChild ( listing ( 'Normal Easter Eggs Unlocked' , document . createTextNode ( normEggs + ' of ' + Game . eggDrops . length ) ) ) ;
1087- stats . appendChild ( listing ( 'Rare Easter Eggs Unlocked' , document . createTextNode ( rareEggs + ' of ' + Game . rareEggDrops . length ) ) ) ;
1088- if ( Game . season == 'christmas' ) {
1089- stats . appendChild ( listing ( 'Reindeer Reward' , document . createTextNode ( Beautify ( CM . Cache . SeaSpec ) ) ) ) ;
1135+ if ( Game . season == 'christmas' || specDisp ) {
1136+ stats . appendChild ( header ( 'Season Specials' ) ) ;
1137+
1138+ if ( specDisp ) {
1139+ var createSpecDisp = function ( theSpecDisp ) {
1140+ var frag = document . createDocumentFragment ( ) ;
1141+ frag . appendChild ( document . createTextNode ( theSpecDisp . length + ' ' ) ) ;
1142+ span = document . createElement ( 'span' ) ;
1143+ span . onmouseout = function ( ) { Game . tooltip . hide ( ) ; } ;
1144+ var placeholder = document . createElement ( 'div' ) ;
1145+ var missing = document . createElement ( 'div' ) ;
1146+ missing . style . minWidth = '140px' ;
1147+ missing . style . marginBottom = '4px' ;
1148+ var title = document . createElement ( 'div' ) ;
1149+ title . className = 'name' ;
1150+ title . style . marginBottom = '4px' ;
1151+ title . style . textAlign = 'center' ;
1152+ title . textContent = 'Missing' ;
1153+ missing . appendChild ( title ) ;
1154+ for ( var i in theSpecDisp ) {
1155+ var div = document . createElement ( 'div' ) ;
1156+ div . style . textAlign = 'center' ;
1157+ div . appendChild ( document . createTextNode ( theSpecDisp [ i ] ) ) ;
1158+ missing . appendChild ( div ) ;
1159+ }
1160+ placeholder . appendChild ( missing ) ;
1161+ span . onmouseover = function ( ) { Game . tooltip . draw ( this , escape ( placeholder . innerHTML ) ) ; } ;
1162+ span . style . cursor = 'default' ;
1163+ span . style . display = 'inline-block' ;
1164+ span . style . height = '10px' ;
1165+ span . style . width = '10px' ;
1166+ span . style . borderRadius = '5px' ;
1167+ span . style . textAlign = 'center' ;
1168+ span . style . backgroundColor = '#C0C0C0' ;
1169+ span . style . color = 'black' ;
1170+ span . style . fontSize = '9px' ;
1171+ span . style . verticalAlign = 'bottom' ;
1172+ span . textContent = '?' ;
1173+ frag . appendChild ( span ) ;
1174+ return frag ;
1175+ }
1176+ if ( halloCook . length != 0 ) stats . appendChild ( listing ( 'Halloween Cookies Left to Buy' , createSpecDisp ( halloCook ) ) ) ;
1177+ if ( christCook . length != 0 ) stats . appendChild ( listing ( 'Christmas Cookies Left to Buy' , createSpecDisp ( christCook ) ) ) ;
1178+ if ( valCook . length != 0 ) stats . appendChild ( listing ( 'Valentine Cookies Left to Buy' , createSpecDisp ( valCook ) ) ) ;
1179+ if ( normEggs . length != 0 ) stats . appendChild ( listing ( 'Normal Easter Eggs Left to Unlock' , createSpecDisp ( normEggs ) ) ) ;
1180+ if ( rareEggs . length != 0 ) stats . appendChild ( listing ( 'Rare Easter Eggs Left to Unlock' , createSpecDisp ( rareEggs ) ) ) ;
1181+ }
1182+
1183+ if ( Game . season == 'christmas' ) stats . appendChild ( listing ( 'Reindeer Reward' , document . createTextNode ( Beautify ( CM . Cache . SeaSpec ) ) ) ) ;
10901184 }
10911185
10921186 l ( 'menu' ) . insertBefore ( stats , l ( 'menu' ) . childNodes [ 2 ] ) ;
0 commit comments