diff --git a/index.html b/index.html
index 6eea46f3c..d1e492e5c 100644
--- a/index.html
+++ b/index.html
@@ -15,8 +15,8 @@
-
-
+
+
diff --git a/script/engine.js b/script/engine.js
index f6ed806d0..74b3efa68 100644
--- a/script/engine.js
+++ b/script/engine.js
@@ -10,6 +10,7 @@ var Engine = {
VERSION: 1.3,
MAX_STORE: 99999999999999,
SAVE_DISPLAY: 30 * 1000,
+ GAME_OVER: false,
//object event types
topics: {},
@@ -206,12 +207,12 @@ var Engine = {
},
deleteSave: function() {
- //var carriedPrestige = $SM.get('previous.stores');
- if(typeof Storage != 'undefined' && localStorage) {
- localStorage.clear();
- }
+ if (!Engine.GAME_OVER) {
+ if(typeof Storage != 'undefined' && localStorage) {
+ localStorage.clear();
+ }
+ }
location.reload();
- //$SM.set('previous.stores',carriedPrestige);
},
share: function() {
diff --git a/script/prestige.js b/script/prestige.js
index fa25d7aca..a832ffda9 100644
--- a/script/prestige.js
+++ b/script/prestige.js
@@ -12,35 +12,48 @@ var Prestige = {
save: function() {
var prevStores = [ //g = goods, w = weapons, a = ammo
- $SM.get('stores["wood"]'),
- $SM.get('stores["fur"]'),
- $SM.get('stores["meat"]'),
- $SM.get('stores["iron"]'),
- $SM.get('stores["coal"]'),
- $SM.get('stores["sulphur"]'),
- $SM.get('stores["steel"]'),
- $SM.get('stores["cured meat"]'),
- $SM.get('stores["scales"]'),
- $SM.get('stores["teeth"]'),
- $SM.get('stores["leather"]'),
- $SM.get('stores["bait"]'),
- $SM.get('stores["torch"]'),
- $SM.get('stores["cloth"]'),
- $SM.get('stores["bone spear"]'),
- $SM.get('stores["iron sword"]'),
- $SM.get('stores["steel sword"]'),
- $SM.get('stores["bayonet"]'),
- $SM.get('stores["rifle"]'),
- $SM.get('stores["laser rifle"]'),
- $SM.get('stores["bullets"]'),
- $SM.get('stores["energy cell"]'),
- $SM.get('stores["grenade"]'),
- $SM.get('stores["bolas"]')
+ 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};
+ }
$SM.set('previous.stores', prevStores);
return prevStores;
},
+ populateNewSave: function(newstate) {
+ State = {
+ previous: {
+ stores: newstate
+ }
+ };
+ Engine.init({state: State});
+ return State;
+ },
+
load: function() {
var prevStores = $SM.get('previous.stores');
$SM.add('stores["wood"]',prevStores[0]),
@@ -68,9 +81,9 @@ var Prestige = {
$SM.add('stores["grenade"]',prevStores[22]),
$SM.add('stores["bolas"]',prevStores[23])
return prevStores;
- }
+ },
- /*randGen: function(storeType) {
+ randGen: function(storeType) {
if (storeType == 'g') {
divisor = Math.floor(Math.random()*10)
}
@@ -78,13 +91,13 @@ var Prestige = {
divisor = Math.floor(Math.floor(Math.random()*10)/2)
}
else if (storeType == 'a') {
- divisor = Math.floor(Math.random()*10*Math.floor(Math.random()*10/5))
+ divisor = Math.ceil(Math.random()*10*Math.ceil(Math.random()*10))
}
else { divisor = 1 };
if (divisor === 0) {
divisor = 1
};
return divisor;
- }*/
+ }
}
\ No newline at end of file
diff --git a/script/space.js b/script/space.js
index cf0a4e89c..76f3a0a85 100644
--- a/script/space.js
+++ b/script/space.js
@@ -386,12 +386,18 @@ var Space = {
$('#notifyGradient').attr('style', 'background-color:'+cur+';background:-webkit-' + s + ';background:' + s);
},
complete: function() {
- //Prestige.save();
- $('#starsContainer').remove();
+ Engine.GAME_OVER = true;
+ var backup;
+ $('#starsContainer').remove();
if(typeof Storage != 'undefined' && localStorage) {
- localStorage.clear();
+ backup = Prestige.save();
+ localStorage.clear();
}
delete window.State;
+ $('.deleteSave, .share').remove();
+ Prestige.populateNewSave(backup);
+ $('#content, #notifications').remove();
+ $('.deleteSave, .share').attr('style', 'color: white;');
Engine.options = {};
}
});
diff --git a/script/world.js b/script/world.js
index d12040671..e4a1e3d56 100644
--- a/script/world.js
+++ b/script/world.js
@@ -128,7 +128,7 @@ var World = {
World.LANDMARKS[World.TILE.BOREHOLE] = { num: 10, minRadius: 15, maxRadius: World.RADIUS * 1.5, scene: 'borehole', label: 'A Borehole'};
World.LANDMARKS[World.TILE.BATTLEFIELD] = { num: 5, minRadius: 18, maxRadius: World.RADIUS * 1.5, scene: 'battlefield', label: 'A Battlefield'};
World.LANDMARKS[World.TILE.SWAMP] = { num: 1, minRadius: 15, maxRadius: World.RADIUS * 1.5, scene: 'swamp', label: 'A Murky Swamp'};
- World.LANDMARKS[World.TILE.CACHE] = { num: 1, minRadius: 10, maxRadius: World.RADIUS * 1.5, scene: 'cache', label: 'An Underground Cache'};
+ World.LANDMARKS[World.TILE.CACHE] = { num: 1, minRadius: 10, maxRadius: World.RADIUS * 1.5, scene: 'cache', label: 'A Destroyed Village'};
if(typeof $SM.get('features.location.world') == 'undefined') {
$SM.set('features.location.world', true);