mirror of
https://github.com/doublespeakgames/adarkroom.git
synced 2026-06-12 23:47:13 +08:00
prestige system now absolutely complete
This commit is contained in:
+2
-2
@@ -15,8 +15,8 @@
|
|||||||
<meta itemprop="name" property="og:title" content="A Dark Room" />
|
<meta itemprop="name" property="og:title" content="A Dark Room" />
|
||||||
<link rel="shortcut icon" href="favicon.ico" />
|
<link rel="shortcut icon" href="favicon.ico" />
|
||||||
<link rel="image_src" href="img/adr.png" />
|
<link rel="image_src" href="img/adr.png" />
|
||||||
<!-- <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.1/jquery.min.js"></script> -->
|
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.1/jquery.min.js"></script>
|
||||||
<script src="lib/jquery.min.js"></script>
|
<!-- <script src="lib/jquery.min.js"></script> -->
|
||||||
<script src="lib/jquery.color-2.1.2.min.js"></script>
|
<script src="lib/jquery.color-2.1.2.min.js"></script>
|
||||||
<script src="lib/jquery.event.move.js"></script>
|
<script src="lib/jquery.event.move.js"></script>
|
||||||
<script src="lib/jquery.event.swipe.js"></script>
|
<script src="lib/jquery.event.swipe.js"></script>
|
||||||
|
|||||||
+6
-5
@@ -10,6 +10,7 @@ var Engine = {
|
|||||||
VERSION: 1.3,
|
VERSION: 1.3,
|
||||||
MAX_STORE: 99999999999999,
|
MAX_STORE: 99999999999999,
|
||||||
SAVE_DISPLAY: 30 * 1000,
|
SAVE_DISPLAY: 30 * 1000,
|
||||||
|
GAME_OVER: false,
|
||||||
|
|
||||||
//object event types
|
//object event types
|
||||||
topics: {},
|
topics: {},
|
||||||
@@ -206,12 +207,12 @@ var Engine = {
|
|||||||
},
|
},
|
||||||
|
|
||||||
deleteSave: function() {
|
deleteSave: function() {
|
||||||
//var carriedPrestige = $SM.get('previous.stores');
|
if (!Engine.GAME_OVER) {
|
||||||
if(typeof Storage != 'undefined' && localStorage) {
|
if(typeof Storage != 'undefined' && localStorage) {
|
||||||
localStorage.clear();
|
localStorage.clear();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
location.reload();
|
location.reload();
|
||||||
//$SM.set('previous.stores',carriedPrestige);
|
|
||||||
},
|
},
|
||||||
|
|
||||||
share: function() {
|
share: function() {
|
||||||
|
|||||||
+41
-28
@@ -12,35 +12,48 @@ var Prestige = {
|
|||||||
|
|
||||||
save: function() {
|
save: function() {
|
||||||
var prevStores = [ //g = goods, w = weapons, a = ammo
|
var prevStores = [ //g = goods, w = weapons, a = ammo
|
||||||
$SM.get('stores["wood"]'),
|
Math.floor($SM.get('stores["wood"]') / Prestige.randGen('g')),
|
||||||
$SM.get('stores["fur"]'),
|
Math.floor($SM.get('stores["fur"]') / Prestige.randGen('g')),
|
||||||
$SM.get('stores["meat"]'),
|
Math.floor($SM.get('stores["meat"]') / Prestige.randGen('g')),
|
||||||
$SM.get('stores["iron"]'),
|
Math.floor($SM.get('stores["iron"]') / Prestige.randGen('g')),
|
||||||
$SM.get('stores["coal"]'),
|
Math.floor($SM.get('stores["coal"]') / Prestige.randGen('g')),
|
||||||
$SM.get('stores["sulphur"]'),
|
Math.floor($SM.get('stores["sulphur"]') / Prestige.randGen('g')),
|
||||||
$SM.get('stores["steel"]'),
|
Math.floor($SM.get('stores["steel"]') / Prestige.randGen('g')),
|
||||||
$SM.get('stores["cured meat"]'),
|
Math.floor($SM.get('stores["cured meat"]') / Prestige.randGen('g')),
|
||||||
$SM.get('stores["scales"]'),
|
Math.floor($SM.get('stores["scales"]') / Prestige.randGen('g')),
|
||||||
$SM.get('stores["teeth"]'),
|
Math.floor($SM.get('stores["teeth"]') / Prestige.randGen('g')),
|
||||||
$SM.get('stores["leather"]'),
|
Math.floor($SM.get('stores["leather"]') / Prestige.randGen('g')),
|
||||||
$SM.get('stores["bait"]'),
|
Math.floor($SM.get('stores["bait"]') / Prestige.randGen('g')),
|
||||||
$SM.get('stores["torch"]'),
|
Math.floor($SM.get('stores["torch"]') / Prestige.randGen('g')),
|
||||||
$SM.get('stores["cloth"]'),
|
Math.floor($SM.get('stores["cloth"]') / Prestige.randGen('g')),
|
||||||
$SM.get('stores["bone spear"]'),
|
Math.floor($SM.get('stores["bone spear"]') / Prestige.randGen('w')),
|
||||||
$SM.get('stores["iron sword"]'),
|
Math.floor($SM.get('stores["iron sword"]') / Prestige.randGen('w')),
|
||||||
$SM.get('stores["steel sword"]'),
|
Math.floor($SM.get('stores["steel sword"]') / Prestige.randGen('w')),
|
||||||
$SM.get('stores["bayonet"]'),
|
Math.floor($SM.get('stores["bayonet"]') / Prestige.randGen('w')),
|
||||||
$SM.get('stores["rifle"]'),
|
Math.floor($SM.get('stores["rifle"]') / Prestige.randGen('w')),
|
||||||
$SM.get('stores["laser rifle"]'),
|
Math.floor($SM.get('stores["laser rifle"]') / Prestige.randGen('w')),
|
||||||
$SM.get('stores["bullets"]'),
|
Math.floor($SM.get('stores["bullets"]') / Prestige.randGen('a')),
|
||||||
$SM.get('stores["energy cell"]'),
|
Math.floor($SM.get('stores["energy cell"]') / Prestige.randGen('a')),
|
||||||
$SM.get('stores["grenade"]'),
|
Math.floor($SM.get('stores["grenade"]') / Prestige.randGen('a')),
|
||||||
$SM.get('stores["bolas"]')
|
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);
|
$SM.set('previous.stores', prevStores);
|
||||||
return prevStores;
|
return prevStores;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
populateNewSave: function(newstate) {
|
||||||
|
State = {
|
||||||
|
previous: {
|
||||||
|
stores: newstate
|
||||||
|
}
|
||||||
|
};
|
||||||
|
Engine.init({state: State});
|
||||||
|
return State;
|
||||||
|
},
|
||||||
|
|
||||||
load: function() {
|
load: function() {
|
||||||
var prevStores = $SM.get('previous.stores');
|
var prevStores = $SM.get('previous.stores');
|
||||||
$SM.add('stores["wood"]',prevStores[0]),
|
$SM.add('stores["wood"]',prevStores[0]),
|
||||||
@@ -68,9 +81,9 @@ var Prestige = {
|
|||||||
$SM.add('stores["grenade"]',prevStores[22]),
|
$SM.add('stores["grenade"]',prevStores[22]),
|
||||||
$SM.add('stores["bolas"]',prevStores[23])
|
$SM.add('stores["bolas"]',prevStores[23])
|
||||||
return prevStores;
|
return prevStores;
|
||||||
}
|
},
|
||||||
|
|
||||||
/*randGen: function(storeType) {
|
randGen: function(storeType) {
|
||||||
if (storeType == 'g') {
|
if (storeType == 'g') {
|
||||||
divisor = Math.floor(Math.random()*10)
|
divisor = Math.floor(Math.random()*10)
|
||||||
}
|
}
|
||||||
@@ -78,13 +91,13 @@ var Prestige = {
|
|||||||
divisor = Math.floor(Math.floor(Math.random()*10)/2)
|
divisor = Math.floor(Math.floor(Math.random()*10)/2)
|
||||||
}
|
}
|
||||||
else if (storeType == 'a') {
|
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 };
|
else { divisor = 1 };
|
||||||
if (divisor === 0) {
|
if (divisor === 0) {
|
||||||
divisor = 1
|
divisor = 1
|
||||||
};
|
};
|
||||||
return divisor;
|
return divisor;
|
||||||
}*/
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
+9
-3
@@ -386,12 +386,18 @@ var Space = {
|
|||||||
$('#notifyGradient').attr('style', 'background-color:'+cur+';background:-webkit-' + s + ';background:' + s);
|
$('#notifyGradient').attr('style', 'background-color:'+cur+';background:-webkit-' + s + ';background:' + s);
|
||||||
},
|
},
|
||||||
complete: function() {
|
complete: function() {
|
||||||
//Prestige.save();
|
Engine.GAME_OVER = true;
|
||||||
$('#starsContainer').remove();
|
var backup;
|
||||||
|
$('#starsContainer').remove();
|
||||||
if(typeof Storage != 'undefined' && localStorage) {
|
if(typeof Storage != 'undefined' && localStorage) {
|
||||||
localStorage.clear();
|
backup = Prestige.save();
|
||||||
|
localStorage.clear();
|
||||||
}
|
}
|
||||||
delete window.State;
|
delete window.State;
|
||||||
|
$('.deleteSave, .share').remove();
|
||||||
|
Prestige.populateNewSave(backup);
|
||||||
|
$('#content, #notifications').remove();
|
||||||
|
$('.deleteSave, .share').attr('style', 'color: white;');
|
||||||
Engine.options = {};
|
Engine.options = {};
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
+1
-1
@@ -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.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.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.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') {
|
if(typeof $SM.get('features.location.world') == 'undefined') {
|
||||||
$SM.set('features.location.world', true);
|
$SM.set('features.location.world', true);
|
||||||
|
|||||||
Reference in New Issue
Block a user