mirror of
https://github.com/doublespeakgames/adarkroom.git
synced 2026-06-11 06:57:13 +08:00
@@ -32,6 +32,7 @@
|
|||||||
<script src="script/path.js"></script>
|
<script src="script/path.js"></script>
|
||||||
<script src="script/ship.js"></script>
|
<script src="script/ship.js"></script>
|
||||||
<script src="script/space.js"></script>
|
<script src="script/space.js"></script>
|
||||||
|
<script src="script/prestige.js"></script>
|
||||||
<!-- Event modules -->
|
<!-- Event modules -->
|
||||||
<script src="script/events/global.js"></script>
|
<script src="script/events/global.js"></script>
|
||||||
<script src="script/events/room.js"></script>
|
<script src="script/events/room.js"></script>
|
||||||
|
|||||||
Vendored
+6
File diff suppressed because one or more lines are too long
+6
-3
@@ -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,9 +207,11 @@ var Engine = {
|
|||||||
},
|
},
|
||||||
|
|
||||||
deleteSave: function() {
|
deleteSave: function() {
|
||||||
if(typeof Storage != 'undefined' && localStorage) {
|
if (!Engine.GAME_OVER) {
|
||||||
localStorage.clear();
|
if(typeof Storage != 'undefined' && localStorage) {
|
||||||
}
|
localStorage.clear();
|
||||||
|
}
|
||||||
|
}
|
||||||
location.reload();
|
location.reload();
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|||||||
@@ -3392,5 +3392,55 @@ Events.Setpieces = {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
"cache": { /* Cache - contains some of supplies from previous game */
|
||||||
|
title: 'A Destroyed Village',
|
||||||
|
scenes: {
|
||||||
|
'start': {
|
||||||
|
text: [
|
||||||
|
'a destroyed village stands before you',
|
||||||
|
'charred bodies littering the ground.'
|
||||||
|
],
|
||||||
|
notification: 'you smell the metallic tang of a wanderer afterburner.',
|
||||||
|
buttons: {
|
||||||
|
'enter': {
|
||||||
|
text: 'enter',
|
||||||
|
nextScene: {1: 'underground'}
|
||||||
|
},
|
||||||
|
'leave': {
|
||||||
|
text: 'leave',
|
||||||
|
nextScene: 'end'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
'underground': {
|
||||||
|
text: [
|
||||||
|
'a shack stands at the center of the village.',
|
||||||
|
'there are still supplies inside.'
|
||||||
|
],
|
||||||
|
buttons: {
|
||||||
|
'take': {
|
||||||
|
text: 'take',
|
||||||
|
nextScene: {1: 'exit'}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
'exit': {
|
||||||
|
text: [
|
||||||
|
'all the work of a previous generation is here.',
|
||||||
|
'ripe for the picking.'
|
||||||
|
],
|
||||||
|
onLoad: function() {
|
||||||
|
World.markVisited(World.curPos[0], World.curPos[1]);
|
||||||
|
Prestige.load();
|
||||||
|
},
|
||||||
|
buttons: {
|
||||||
|
'leave': {
|
||||||
|
text: 'leave',
|
||||||
|
nextScene: 'end'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -0,0 +1,103 @@
|
|||||||
|
var Prestige = {
|
||||||
|
name: 'Prestige',
|
||||||
|
|
||||||
|
options: {},
|
||||||
|
|
||||||
|
init: function(options) {
|
||||||
|
this.options = $.extend(
|
||||||
|
this.options,
|
||||||
|
options
|
||||||
|
);
|
||||||
|
},
|
||||||
|
|
||||||
|
save: function() {
|
||||||
|
var prevStores = [ //g = goods, w = weapons, a = ammo
|
||||||
|
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]),
|
||||||
|
$SM.add('stores["fur"]',prevStores[1]),
|
||||||
|
$SM.add('stores["meat"]',prevStores[2]),
|
||||||
|
$SM.add('stores["iron"]',prevStores[3]),
|
||||||
|
$SM.add('stores["coal"]',prevStores[4]),
|
||||||
|
$SM.add('stores["sulphur"]',prevStores[5]),
|
||||||
|
$SM.add('stores["steel"]',prevStores[6]),
|
||||||
|
$SM.add('stores["cured meat"]',prevStores[7]),
|
||||||
|
$SM.add('stores["scales"]',prevStores[8]),
|
||||||
|
$SM.add('stores["teeth"]',prevStores[9]),
|
||||||
|
$SM.add('stores["leather"]',prevStores[10]),
|
||||||
|
$SM.add('stores["bait"]',prevStores[11]),
|
||||||
|
$SM.add('stores["torch"]',prevStores[12]),
|
||||||
|
$SM.add('stores["cloth"]',prevStores[13]),
|
||||||
|
$SM.add('stores["bone spear"]',prevStores[14]),
|
||||||
|
$SM.add('stores["iron sword"]',prevStores[15]),
|
||||||
|
$SM.add('stores["steel sword"]',prevStores[16]),
|
||||||
|
$SM.add('stores["bayonet"]',prevStores[17]),
|
||||||
|
$SM.add('stores["rifle"]',prevStores[18]),
|
||||||
|
$SM.add('stores["laser rifle"]',prevStores[19]),
|
||||||
|
$SM.add('stores["bullets"]',prevStores[20]),
|
||||||
|
$SM.add('stores["energy cell"]',prevStores[21]),
|
||||||
|
$SM.add('stores["grenade"]',prevStores[22]),
|
||||||
|
$SM.add('stores["bolas"]',prevStores[23])
|
||||||
|
return prevStores;
|
||||||
|
},
|
||||||
|
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
+9
-2
@@ -386,11 +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() {
|
||||||
$('#starsContainer').remove();
|
Engine.GAME_OVER = true;
|
||||||
|
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 = {};
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
+7
-5
@@ -19,7 +19,8 @@ var World = {
|
|||||||
SHIP: 'W',
|
SHIP: 'W',
|
||||||
BOREHOLE: 'B',
|
BOREHOLE: 'B',
|
||||||
BATTLEFIELD: 'F',
|
BATTLEFIELD: 'F',
|
||||||
SWAMP: 'M'
|
SWAMP: 'M',
|
||||||
|
CACHE: 'U'
|
||||||
},
|
},
|
||||||
TILE_PROBS: {},
|
TILE_PROBS: {},
|
||||||
LANDMARKS: {},
|
LANDMARKS: {},
|
||||||
@@ -123,10 +124,11 @@ var World = {
|
|||||||
World.LANDMARKS[World.TILE.CAVE] = { num: 5, minRadius: 3, maxRadius: 10, scene: 'cave', label: 'A Damp Cave' };
|
World.LANDMARKS[World.TILE.CAVE] = { num: 5, minRadius: 3, maxRadius: 10, scene: 'cave', label: 'A Damp Cave' };
|
||||||
World.LANDMARKS[World.TILE.TOWN] = { num: 10, minRadius: 10, maxRadius: 20, scene: 'town', label: 'An Abandoned Town' };
|
World.LANDMARKS[World.TILE.TOWN] = { num: 10, minRadius: 10, maxRadius: 20, scene: 'town', label: 'An Abandoned Town' };
|
||||||
World.LANDMARKS[World.TILE.CITY] = { num: 20, minRadius: 20, maxRadius: World.RADIUS * 1.5, scene: 'city', label: 'A Ruined City' };
|
World.LANDMARKS[World.TILE.CITY] = { num: 20, minRadius: 20, maxRadius: World.RADIUS * 1.5, scene: 'city', label: 'A Ruined City' };
|
||||||
World.LANDMARKS[World.TILE.SHIP] = {num: 1, minRadius: 28, maxRadius: 28, scene: 'ship', label: 'A Crashed Starship'};
|
World.LANDMARKS[World.TILE.SHIP] = { num: 1, minRadius: 28, maxRadius: 28, scene: 'ship', label: 'A Crashed Starship'};
|
||||||
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: '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