Prestige shouldn't contain decimals

Corrects issue of Prestige containing decimals and Infinity

Closes #69
This commit is contained in:
Blake Grotewold
2014-11-18 10:14:50 -05:00
parent 8284026853
commit 94d1388b1d
+13 -5
View File
@@ -40,8 +40,8 @@ var Prestige = {
for(var i in this.storesMap) { for(var i in this.storesMap) {
var s = this.storesMap[i]; var s = this.storesMap[i];
stores.push($SM.get('stores["' + s.store + '"]', true) / stores.push(Math.floor($SM.get('stores["' + s.store + '"]', true) /
(reduce ? this.randGen(s.type) : 1)); (reduce ? this.randGen(s.type) : 1)));
} }
return stores; return stores;
@@ -80,16 +80,24 @@ var Prestige = {
}, },
randGen : function(storeType) { randGen : function(storeType) {
var amount;
switch(storeType) { switch(storeType) {
case 'g': case 'g':
return Math.floor(Math.random() * 10); amount = Math.floor(Math.random() * 10);
break;
case 'w': case 'w':
return Math.floor(Math.floor(Math.random() * 10) / 2); amount = Math.floor(Math.floor(Math.random() * 10) / 2);
break;
case 'a': case 'a':
return Math.ceil(Math.random() * 10 * Math.ceil(Math.random() * 10)); amount = Math.ceil(Math.random() * 10 * Math.ceil(Math.random() * 10));
break;
default: default:
return 1; return 1;
} }
if (amount !== 0) {
return amount;
}
return 1;
} }
}; };