Fixed a bug with large numbers and chain calculations (Thanks to an anonymous wikia user)

This commit is contained in:
Aktanusa
2014-10-19 22:52:08 -04:00
parent cd18b1a402
commit b9486e9895
3 changed files with 22 additions and 22 deletions

View File

@@ -22,6 +22,14 @@ CM.Sim = {};
* Cache * * Cache *
*********/ *********/
CM.Cache.NextNumber = function(base) {
var count = base > Math.pow(2, 53) ? Math.pow(2, Math.floor(Math.log(base) / Math.log(2)) - 53) : 1;
while (base == base + count) {
count = CM.Cache.NextNumber(count);
}
return (base + count);
}
CM.Cache.RemakeIncome = function() { CM.Cache.RemakeIncome = function() {
// Simulate Building Buys for 1 amount // Simulate Building Buys for 1 amount
CM.Sim.BuyBuildings(1, 'Objects'); CM.Sim.BuyBuildings(1, 'Objects');
@@ -139,11 +147,7 @@ CM.Cache.RemakeChain = function() {
CM.Cache.Chain = 0; CM.Cache.Chain = 0;
} }
else { else {
count = base > Math.pow(2, 53) ? Math.pow(2, Math.floor(Math.log(base) / Math.log(2)) - 53) : 1; CM.Cache.Chain = CM.Cache.NextNumber(base) / 0.25;
while (base == base + count) {
count++;
}
CM.Cache.Chain = (base + count) / 0.25;
} }
CM.Cache.ChainFrenzyReward = CM.Cache.MaxChainMoni(7, maxPayout * 7); CM.Cache.ChainFrenzyReward = CM.Cache.MaxChainMoni(7, maxPayout * 7);
@@ -160,11 +164,7 @@ CM.Cache.RemakeChain = function() {
CM.Cache.ChainFrenzy = 0; CM.Cache.ChainFrenzy = 0;
} }
else { else {
count = base > Math.pow(2, 53) ? Math.pow(2, Math.floor(Math.log(base) / Math.log(2)) - 53) : 1; CM.Cache.ChainFrenzy = CM.Cache.NextNumber(base) / 0.25;
while(base == base + count) {
count++;
}
CM.Cache.ChainFrenzy = (base + count) / 0.25;
} }
} }

View File

@@ -2,6 +2,14 @@
* Cache * * Cache *
*********/ *********/
CM.Cache.NextNumber = function(base) {
var count = base > Math.pow(2, 53) ? Math.pow(2, Math.floor(Math.log(base) / Math.log(2)) - 53) : 1;
while (base == base + count) {
count = CM.Cache.NextNumber(count);
}
return (base + count);
}
CM.Cache.RemakeIncome = function() { CM.Cache.RemakeIncome = function() {
// Simulate Building Buys for 1 amount // Simulate Building Buys for 1 amount
CM.Sim.BuyBuildings(1, 'Objects'); CM.Sim.BuyBuildings(1, 'Objects');
@@ -119,11 +127,7 @@ CM.Cache.RemakeChain = function() {
CM.Cache.Chain = 0; CM.Cache.Chain = 0;
} }
else { else {
count = base > Math.pow(2, 53) ? Math.pow(2, Math.floor(Math.log(base) / Math.log(2)) - 53) : 1; CM.Cache.Chain = CM.Cache.NextNumber(base) / 0.25;
while (base == base + count) {
count++;
}
CM.Cache.Chain = (base + count) / 0.25;
} }
CM.Cache.ChainFrenzyReward = CM.Cache.MaxChainMoni(7, maxPayout * 7); CM.Cache.ChainFrenzyReward = CM.Cache.MaxChainMoni(7, maxPayout * 7);
@@ -140,11 +144,7 @@ CM.Cache.RemakeChain = function() {
CM.Cache.ChainFrenzy = 0; CM.Cache.ChainFrenzy = 0;
} }
else { else {
count = base > Math.pow(2, 53) ? Math.pow(2, Math.floor(Math.log(base) / Math.log(2)) - 53) : 1; CM.Cache.ChainFrenzy = CM.Cache.NextNumber(base) / 0.25;
while(base == base + count) {
count++;
}
CM.Cache.ChainFrenzy = (base + count) / 0.25;
} }
} }