mirror of
https://github.com/doublespeakgames/adarkroom.git
synced 2026-05-28 08:11:54 +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" />
|
||||
<link rel="shortcut icon" href="favicon.ico" />
|
||||
<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="lib/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.color-2.1.2.min.js"></script>
|
||||
<script src="lib/jquery.event.move.js"></script>
|
||||
<script src="lib/jquery.event.swipe.js"></script>
|
||||
|
||||
+6
-5
@@ -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() {
|
||||
|
||||
+41
-28
@@ -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;
|
||||
}*/
|
||||
}
|
||||
|
||||
}
|
||||
+9
-3
@@ -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 = {};
|
||||
}
|
||||
});
|
||||
|
||||
+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.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);
|
||||
|
||||
Reference in New Issue
Block a user