mirror of
https://github.com/doublespeakgames/adarkroom.git
synced 2026-05-28 08:11:54 +08:00
Prestige shouldn't contain decimals
Corrects issue of Prestige containing decimals and Infinity Closes #69
This commit is contained in:
+13
-5
@@ -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;
|
||||||
}
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user