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

@@ -1,6 +1,14 @@
/*********
* 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() {
// Simulate Building Buys for 1 amount
@@ -119,11 +127,7 @@ CM.Cache.RemakeChain = function() {
CM.Cache.Chain = 0;
}
else {
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.Chain = (base + count) / 0.25;
CM.Cache.Chain = CM.Cache.NextNumber(base) / 0.25;
}
CM.Cache.ChainFrenzyReward = CM.Cache.MaxChainMoni(7, maxPayout * 7);
@@ -140,11 +144,7 @@ CM.Cache.RemakeChain = function() {
CM.Cache.ChainFrenzy = 0;
}
else {
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.ChainFrenzy = (base + count) / 0.25;
CM.Cache.ChainFrenzy = CM.Cache.NextNumber(base) / 0.25;
}
}

View File

@@ -2,7 +2,7 @@
* Sim *
*******/
CM.Sim.BuildingGetPrice = function (basePrice, start, increase) {
CM.Sim.BuildingGetPrice = function(basePrice, start, increase) {
var totalPrice = 0;
var count = 0;
while(count < increase) {