made store collection routine in SM, and updated everything to suit

This commit is contained in:
Vermilingua
2013-11-01 17:01:21 +11:00
parent a68f58e648
commit d7fc109554
5 changed files with 97 additions and 70 deletions
+39 -47
View File
@@ -10,39 +10,36 @@ var Prestige = {
saveStores: function(saveBool) {
var prevStores = [ //g = goods, w = weapons, a = ammo
Math.floor($SM.get('stores["wood"]') / Prestige.randGen(saveBool, 'g')),
Math.floor($SM.get('stores["fur"]') / Prestige.randGen(saveBool, 'g')),
Math.floor($SM.get('stores["meat"]') / Prestige.randGen(saveBool, 'g')),
Math.floor($SM.get('stores["iron"]') / Prestige.randGen(saveBool, 'g')),
Math.floor($SM.get('stores["coal"]') / Prestige.randGen(saveBool, 'g')),
Math.floor($SM.get('stores["sulphur"]') / Prestige.randGen(saveBool, 'g')),
Math.floor($SM.get('stores["steel"]') / Prestige.randGen(saveBool, 'g')),
Math.floor($SM.get('stores["cured meat"]') / Prestige.randGen(saveBool, 'g')),
Math.floor($SM.get('stores["scales"]') / Prestige.randGen(saveBool, 'g')),
Math.floor($SM.get('stores["teeth"]') / Prestige.randGen(saveBool, 'g')),
Math.floor($SM.get('stores["leather"]') / Prestige.randGen(saveBool, 'g')),
Math.floor($SM.get('stores["bait"]') / Prestige.randGen(saveBool, 'g')),
Math.floor($SM.get('stores["torch"]') / Prestige.randGen(saveBool, 'g')),
Math.floor($SM.get('stores["cloth"]') / Prestige.randGen(saveBool, 'g')),
Math.floor($SM.get('stores["bone spear"]') / Prestige.randGen(saveBool, 'w')),
Math.floor($SM.get('stores["iron sword"]') / Prestige.randGen(saveBool, 'w')),
Math.floor($SM.get('stores["steel sword"]') / Prestige.randGen(saveBool, 'w')),
Math.floor($SM.get('stores["bayonet"]') / Prestige.randGen(saveBool, 'w')),
Math.floor($SM.get('stores["rifle"]') / Prestige.randGen(saveBool, 'w')),
Math.floor($SM.get('stores["laser rifle"]') / Prestige.randGen(saveBool, 'w')),
Math.floor($SM.get('stores["bullets"]') / Prestige.randGen(saveBool, 'a')),
Math.floor($SM.get('stores["energy cell"]') / Prestige.randGen(saveBool, 'a')),
Math.floor($SM.get('stores["grenade"]') / Prestige.randGen(saveBool, 'a')),
Math.floor($SM.get('stores["bolas"]') / Prestige.randGen(saveBool, 'a'))
Math.floor($SM.get('stores["wood"]') / Prestige.randGen('g')),
Math.floor($SM.get('stores["fur"]') / Prestige.randGen('g')),
Math.floor($SM.get('stores["meat"]') / Prestige.randGen('g')),
Math.floor($SM.get('stores["iron"]') / Prestige.randGen('g')),
Math.floor($SM.get('stores["coal"]') / Prestige.randGen('g')),
Math.floor($SM.get('stores["sulphur"]') / Prestige.randGen('g')),
Math.floor($SM.get('stores["steel"]') / Prestige.randGen('g')),
Math.floor($SM.get('stores["cured meat"]') / Prestige.randGen('g')),
Math.floor($SM.get('stores["scales"]') / Prestige.randGen('g')),
Math.floor($SM.get('stores["teeth"]') / Prestige.randGen('g')),
Math.floor($SM.get('stores["leather"]') / Prestige.randGen('g')),
Math.floor($SM.get('stores["bait"]') / Prestige.randGen('g')),
Math.floor($SM.get('stores["torch"]') / Prestige.randGen('g')),
Math.floor($SM.get('stores["cloth"]') / Prestige.randGen('g')),
Math.floor($SM.get('stores["bone spear"]') / Prestige.randGen('w')),
Math.floor($SM.get('stores["iron sword"]') / Prestige.randGen('w')),
Math.floor($SM.get('stores["steel sword"]') / Prestige.randGen('w')),
Math.floor($SM.get('stores["bayonet"]') / Prestige.randGen('w')),
Math.floor($SM.get('stores["rifle"]') / Prestige.randGen('w')),
Math.floor($SM.get('stores["laser rifle"]') / Prestige.randGen('w')),
Math.floor($SM.get('stores["bullets"]') / Prestige.randGen('a')),
Math.floor($SM.get('stores["energy cell"]') / Prestige.randGen('a')),
Math.floor($SM.get('stores["grenade"]') / Prestige.randGen('a')),
Math.floor($SM.get('stores["bolas"]') / Prestige.randGen('a'))
];
for (var n = 0; n <= 23; n++) {
if (isNaN(prevStores[n])) {
prevStores[n] = 0;
}
}
if(saveBool) {
$SM.set('previous.stores', prevStores);
}
return prevStores;
},
@@ -96,26 +93,21 @@ var Prestige = {
return prevStores;
},
randGen : function(saveBool, storeType) {
if (saveBool) {
if (storeType == 'g') {
divisor = Math.floor(Math.random() * 10);
} else if (storeType == 'w') {
divisor = Math.floor(Math.floor(Math.random() * 10) / 2);
} else if (storeType == 'a') {
divisor = Math.ceil(Math.random() * 10
* Math.ceil(Math.random() * 10));
} else {
divisor = 1;
}
if (divisor === 0) {
divisor = 1;
}
return divisor;
}
else {
return 1;
};
randGen : function(storeType) {
if (storeType == 'g') {
divisor = Math.floor(Math.random() * 10);
} else if (storeType == 'w') {
divisor = Math.floor(Math.floor(Math.random() * 10) / 2);
} else if (storeType == 'a') {
divisor = Math.ceil(Math.random() * 10
* Math.ceil(Math.random() * 10));
} else {
divisor = 1;
}
if (divisor === 0) {
divisor = 1;
}
return divisor;
}
};