mirror of
https://github.com/doublespeakgames/adarkroom.git
synced 2026-06-08 21:47:13 +08:00
@@ -9,26 +9,27 @@ a minimalist text adventure game for your browser
|
|||||||
<table>
|
<table>
|
||||||
<tr><th colspan=4>Available Languages</tr>
|
<tr><th colspan=4>Available Languages</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td><a href="http://adarkroom.doublespeakgames.com/?lang=zh_cn">Chinese</a></td>
|
<td><a href="http://adarkroom.doublespeakgames.com/?lang=zh_cn">Chinese (Simplified)</a></td>
|
||||||
|
<td><a href="http://adarkroom.doublespeakgames.com/?lang=zh_cn">Chinese (Traditional)</a></td>
|
||||||
<td><a href="http://adarkroom.doublespeakgames.com/?lang=en">English</a></td>
|
<td><a href="http://adarkroom.doublespeakgames.com/?lang=en">English</a></td>
|
||||||
<td><a href="http://adarkroom.doublespeakgames.com/?lang=fr">French</a></td>
|
<td><a href="http://adarkroom.doublespeakgames.com/?lang=fr">French</a></td>
|
||||||
</tr><tr>
|
</tr><tr>
|
||||||
<td><a href="http://adarkroom.doublespeakgames.com/?lang=de">German</a></td>
|
<td><a href="http://adarkroom.doublespeakgames.com/?lang=de">German</a></td>
|
||||||
<td><a href="http://adarkroom.doublespeakgames.com/?lang=el">Greek</a></td>
|
<td><a href="http://adarkroom.doublespeakgames.com/?lang=el">Greek</a></td>
|
||||||
|
<td><a href="http://adarkroom.doublespeakgames.com/?lang=id">Indonesian</a></td>
|
||||||
<td><a href="http://adarkroom.doublespeakgames.com/?lang=it">Italian</a></td>
|
<td><a href="http://adarkroom.doublespeakgames.com/?lang=it">Italian</a></td>
|
||||||
</tr><tr>
|
</tr><tr>
|
||||||
<td><a href="http://adarkroom.doublespeakgames.com/?lang=ja">Japanese</a></td>
|
<td><a href="http://adarkroom.doublespeakgames.com/?lang=ja">Japanese</a></td>
|
||||||
<td><a href="http://adarkroom.doublespeakgames.com/?lang=ko">Korean</a></td>
|
<td><a href="http://adarkroom.doublespeakgames.com/?lang=ko">Korean</a></td>
|
||||||
<td><a href="http://adarkroom.doublespeakgames.com/?lang=nb">Norwegian</a></td>
|
<td><a href="http://adarkroom.doublespeakgames.com/?lang=nb">Norwegian</a></td>
|
||||||
</tr><tr>
|
|
||||||
<td><a href="http://adarkroom.doublespeakgames.com/?lang=pl">Polish</a></td>
|
<td><a href="http://adarkroom.doublespeakgames.com/?lang=pl">Polish</a></td>
|
||||||
|
</tr><tr>
|
||||||
<td><a href="http://adarkroom.doublespeakgames.com/?lang=pt">Portuguese</a></td>
|
<td><a href="http://adarkroom.doublespeakgames.com/?lang=pt">Portuguese</a></td>
|
||||||
<td><a href="http://adarkroom.doublespeakgames.com/?lang=pt_br">Portuguese (Brazil)</a></td>
|
<td><a href="http://adarkroom.doublespeakgames.com/?lang=pt_br">Portuguese (Brazil)</a></td>
|
||||||
</tr><tr>
|
|
||||||
<td><a href="http://adarkroom.doublespeakgames.com/?lang=ru">Russian</a></td>
|
<td><a href="http://adarkroom.doublespeakgames.com/?lang=ru">Russian</a></td>
|
||||||
<td><a href="http://adarkroom.doublespeakgames.com/?lang=es">Spanish</a></td>
|
<td><a href="http://adarkroom.doublespeakgames.com/?lang=es">Spanish</a></td>
|
||||||
<td><a href="http://adarkroom.doublespeakgames.com/?lang=sv">Swedish</a></td>
|
|
||||||
</tr><tr>
|
</tr><tr>
|
||||||
|
<td><a href="http://adarkroom.doublespeakgames.com/?lang=sv">Swedish</a></td>
|
||||||
<td><a href="http://adarkroom.doublespeakgames.com/?lang=tr">Turkish</a></td>
|
<td><a href="http://adarkroom.doublespeakgames.com/?lang=tr">Turkish</a></td>
|
||||||
<td><a href="http://adarkroom.doublespeakgames.com/?lang=uk">Ukrainian</a></td>
|
<td><a href="http://adarkroom.doublespeakgames.com/?lang=uk">Ukrainian</a></td>
|
||||||
<td><a href="http://adarkroom.doublespeakgames.com/?lang=vi">Vietnamese</a></td>
|
<td><a href="http://adarkroom.doublespeakgames.com/?lang=vi">Vietnamese</a></td>
|
||||||
|
|||||||
@@ -182,6 +182,10 @@ div.row_val {
|
|||||||
float: right;
|
float: right;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
div.total {
|
||||||
|
font-weight: bold;
|
||||||
|
}
|
||||||
|
|
||||||
/* Notifications */
|
/* Notifications */
|
||||||
|
|
||||||
div#notifications {
|
div#notifications {
|
||||||
|
|||||||
+1
-1
File diff suppressed because one or more lines are too long
+1689
-1576
File diff suppressed because it is too large
Load Diff
+1
-1
File diff suppressed because one or more lines are too long
+1
-1
File diff suppressed because one or more lines are too long
+2699
-1838
File diff suppressed because it is too large
Load Diff
+1
-1
File diff suppressed because one or more lines are too long
+2
-2
@@ -137,7 +137,7 @@ msgstr "Un village bruyant"
|
|||||||
|
|
||||||
#: ../../script/outside.js:551
|
#: ../../script/outside.js:551
|
||||||
msgid "the sky is grey and the wind blows relentlessly"
|
msgid "the sky is grey and the wind blows relentlessly"
|
||||||
msgstr "le ciel est gris et le vents souffle implacablement"
|
msgstr "le ciel est gris et le vent souffle implacablement"
|
||||||
|
|
||||||
#: ../../script/outside.js:561
|
#: ../../script/outside.js:561
|
||||||
msgid "dry brush and dead branches litter the forest floor"
|
msgid "dry brush and dead branches litter the forest floor"
|
||||||
@@ -516,7 +516,7 @@ msgstr "aciérie"
|
|||||||
#: ../../script/room.js:134
|
#: ../../script/room.js:134
|
||||||
msgid "builder says the villagers could make steel, given the tools"
|
msgid "builder says the villagers could make steel, given the tools"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
"l'ouvrière dit qu'avec les bon outils, les villageois pourraient fabriquer "
|
"l'ouvrière dit qu'avec les bons outils, les villageois pourraient fabriquer "
|
||||||
"de l'acier"
|
"de l'acier"
|
||||||
|
|
||||||
#: ../../script/room.js:135
|
#: ../../script/room.js:135
|
||||||
|
|||||||
@@ -0,0 +1,3 @@
|
|||||||
|
.button{width: 100px !important;}
|
||||||
|
#outsidePanel .button{width: 115px !important;}
|
||||||
|
.eventPanel .button {width: 122px !important;}
|
||||||
File diff suppressed because one or more lines are too long
+3468
File diff suppressed because it is too large
Load Diff
+1
-1
File diff suppressed because one or more lines are too long
+1
-1
File diff suppressed because one or more lines are too long
+1
-1
File diff suppressed because one or more lines are too long
+3
-1
@@ -4,6 +4,7 @@ var langs = {
|
|||||||
'en':'english',
|
'en':'english',
|
||||||
'es':'español',
|
'es':'español',
|
||||||
'fr':'français',
|
'fr':'français',
|
||||||
|
'id':'bahasa indonesia',
|
||||||
'it':'italiano',
|
'it':'italiano',
|
||||||
'ja':'日本語',
|
'ja':'日本語',
|
||||||
'ko':'한국어',
|
'ko':'한국어',
|
||||||
@@ -16,5 +17,6 @@ var langs = {
|
|||||||
'tr':'türkçe',
|
'tr':'türkçe',
|
||||||
'uk':'українська',
|
'uk':'українська',
|
||||||
'vi':'tiếng việt',
|
'vi':'tiếng việt',
|
||||||
'zh_cn':'简体中文'
|
'zh_cn':'简体中文',
|
||||||
|
'zh_tw':'繁體中文'
|
||||||
};
|
};
|
||||||
|
|||||||
+1
-1
File diff suppressed because one or more lines are too long
+1
-1
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
+928
-880
File diff suppressed because it is too large
Load Diff
+1
-1
File diff suppressed because one or more lines are too long
+1
-1
@@ -50,7 +50,7 @@ msgstr "добыватель угля"
|
|||||||
|
|
||||||
#: ../../script/outside.js:69 ../../script/localization.js:32
|
#: ../../script/outside.js:69 ../../script/localization.js:32
|
||||||
msgid "sulphur miner"
|
msgid "sulphur miner"
|
||||||
msgstr "добыватель серы"
|
msgstr "спелеолог"
|
||||||
|
|
||||||
#: ../../script/outside.js:77 ../../script/localization.js:35
|
#: ../../script/outside.js:77 ../../script/localization.js:35
|
||||||
msgid "steelworker"
|
msgid "steelworker"
|
||||||
|
|||||||
+1
-1
File diff suppressed because one or more lines are too long
+1
-1
File diff suppressed because one or more lines are too long
+1
-1
File diff suppressed because one or more lines are too long
+1
-1
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -0,0 +1,3 @@
|
|||||||
|
.button{width: 100px !important;}
|
||||||
|
#outsidePanel .button{width: 115px !important;}
|
||||||
|
.eventPanel .button {width: 122px !important;}
|
||||||
File diff suppressed because one or more lines are too long
File diff suppressed because it is too large
Load Diff
+46
-13
@@ -24,6 +24,9 @@ var Button = {
|
|||||||
|
|
||||||
el.append($("<div>").addClass('cooldown'));
|
el.append($("<div>").addClass('cooldown'));
|
||||||
|
|
||||||
|
// waiting for expiry of residual cooldown detected in state
|
||||||
|
Button.cooldown(el, 'state');
|
||||||
|
|
||||||
if(options.cost) {
|
if(options.cost) {
|
||||||
var ttPos = options.ttPos ? options.ttPos : "bottom right";
|
var ttPos = options.ttPos ? options.ttPos : "bottom right";
|
||||||
var costTooltip = $('<div>').addClass('tooltip ' + ttPos);
|
var costTooltip = $('<div>').addClass('tooltip ' + ttPos);
|
||||||
@@ -43,6 +46,8 @@ var Button = {
|
|||||||
return el;
|
return el;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
saveCooldown: true,
|
||||||
|
|
||||||
setDisabled: function(btn, disabled) {
|
setDisabled: function(btn, disabled) {
|
||||||
if(btn) {
|
if(btn) {
|
||||||
if(!disabled && !btn.data('onCooldown')) {
|
if(!disabled && !btn.data('onCooldown')) {
|
||||||
@@ -61,29 +66,57 @@ var Button = {
|
|||||||
return false;
|
return false;
|
||||||
},
|
},
|
||||||
|
|
||||||
cooldown: function(btn) {
|
cooldown: function(btn, option) {
|
||||||
var cd = btn.data("cooldown");
|
var cd = btn.data("cooldown");
|
||||||
|
var id = 'cooldown.'+ btn.attr('id');
|
||||||
if(cd > 0) {
|
if(cd > 0) {
|
||||||
milliseconds = cd * 1000;
|
// param "start" takes value from cooldown time if not specified
|
||||||
if (Engine.options.doubleTime){
|
var start, left;
|
||||||
milliseconds /= 2;
|
switch(option){
|
||||||
|
// a switch will allow for several uses of cooldown function
|
||||||
|
case 'state':
|
||||||
|
if(!$SM.get(id)){
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
start = Math.min($SM.get(id), cd);
|
||||||
|
left = (start / cd).toFixed(4);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
start = cd;
|
||||||
|
left = 1;
|
||||||
}
|
}
|
||||||
|
Button.clearCooldown(btn);
|
||||||
$('div.cooldown', btn).stop(true, true).width("100%").animate({width: '0%'}, milliseconds, 'linear', function() {
|
if(Button.saveCooldown){
|
||||||
var b = $(this).closest('.button');
|
$SM.set(id,start);
|
||||||
b.data('onCooldown', false);
|
// residual value is measured in seconds
|
||||||
if(!b.data('disabled')) {
|
// saves program performance
|
||||||
b.removeClass('disabled');
|
btn.data('countdown', Engine.setInterval(function(){
|
||||||
}
|
$SM.set(id, $SM.get(id, true) - 0.5, true);
|
||||||
|
},500));
|
||||||
|
}
|
||||||
|
var time = start;
|
||||||
|
if (Engine.options.doubleTime){
|
||||||
|
time /= 2;
|
||||||
|
}
|
||||||
|
$('div.cooldown', btn).width(left * 100 +"%").animate({width: '0%'}, time * 1000, 'linear', function() {
|
||||||
|
Button.clearCooldown(btn, true);
|
||||||
});
|
});
|
||||||
btn.addClass('disabled');
|
btn.addClass('disabled');
|
||||||
btn.data('onCooldown', true);
|
btn.data('onCooldown', true);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
clearCooldown: function(btn) {
|
clearCooldown: function(btn, ended) {
|
||||||
$('div.cooldown', btn).stop(true, true);
|
var ended = ended || false;
|
||||||
|
if(!ended){
|
||||||
|
$('div.cooldown', btn).stop(true, true);
|
||||||
|
}
|
||||||
btn.data('onCooldown', false);
|
btn.data('onCooldown', false);
|
||||||
|
if(btn.data('countdown')){
|
||||||
|
window.clearInterval(btn.data('countdown'));
|
||||||
|
$SM.remove('cooldown.'+ btn.attr('id'));
|
||||||
|
btn.removeData('countdown');
|
||||||
|
}
|
||||||
if(!btn.data('disabled')) {
|
if(!btn.data('disabled')) {
|
||||||
btn.removeClass('disabled');
|
btn.removeClass('disabled');
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -955,6 +955,7 @@ var Events = {
|
|||||||
Engine.event('game event', 'event');
|
Engine.event('game event', 'event');
|
||||||
Engine.keyLock = true;
|
Engine.keyLock = true;
|
||||||
Engine.tabNavigation = false;
|
Engine.tabNavigation = false;
|
||||||
|
Button.saveCooldown = false;
|
||||||
Events.eventStack.unshift(event);
|
Events.eventStack.unshift(event);
|
||||||
event.eventPanel = $('<div>').attr('id', 'event').addClass('eventPanel').css('opacity', '0');
|
event.eventPanel = $('<div>').attr('id', 'event').addClass('eventPanel').css('opacity', '0');
|
||||||
if(options != null && options.width != null) {
|
if(options != null && options.width != null) {
|
||||||
@@ -988,6 +989,7 @@ var Events = {
|
|||||||
Engine.log(Events.eventStack.length + ' events remaining');
|
Engine.log(Events.eventStack.length + ' events remaining');
|
||||||
Engine.keyLock = false;
|
Engine.keyLock = false;
|
||||||
Engine.tabNavigation = true;
|
Engine.tabNavigation = true;
|
||||||
|
Button.saveCooldown = true;
|
||||||
if (Events.BLINK_INTERVAL) {
|
if (Events.BLINK_INTERVAL) {
|
||||||
Events.stopTitleBlink();
|
Events.stopTitleBlink();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -171,6 +171,8 @@ var Outside = {
|
|||||||
cooldown: Outside._GATHER_DELAY,
|
cooldown: Outside._GATHER_DELAY,
|
||||||
width: '80px'
|
width: '80px'
|
||||||
}).appendTo('div#outsidePanel');
|
}).appendTo('div#outsidePanel');
|
||||||
|
|
||||||
|
Outside.updateTrapButton();
|
||||||
},
|
},
|
||||||
|
|
||||||
getMaxPopulation: function() {
|
getMaxPopulation: function() {
|
||||||
|
|||||||
@@ -885,6 +885,7 @@ var Room = {
|
|||||||
|
|
||||||
updateIncomeView: function() {
|
updateIncomeView: function() {
|
||||||
var stores = $('div#resources');
|
var stores = $('div#resources');
|
||||||
|
var totalIncome = {};
|
||||||
if(stores.length === 0 || typeof $SM.get('income') == 'undefined') return;
|
if(stores.length === 0 || typeof $SM.get('income') == 'undefined') return;
|
||||||
$('div.storeRow', stores).each(function(index, el) {
|
$('div.storeRow', stores).each(function(index, el) {
|
||||||
el = $(el);
|
el = $(el);
|
||||||
@@ -900,10 +901,18 @@ var Room = {
|
|||||||
.addClass('row_val')
|
.addClass('row_val')
|
||||||
.text(Engine.getIncomeMsg(income.stores[store], income.delay))
|
.text(Engine.getIncomeMsg(income.stores[store], income.delay))
|
||||||
.appendTo(tt);
|
.appendTo(tt);
|
||||||
|
if (!totalIncome[store] || totalIncome[store].income === undefined) {
|
||||||
|
totalIncome[store] = { income: 0 };
|
||||||
|
}
|
||||||
|
totalIncome[store].income += Number(income.stores[store]);
|
||||||
|
totalIncome[store].delay = income.delay;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(tt.children().length > 0) {
|
if(tt.children().length > 0) {
|
||||||
|
var total = totalIncome[storeName].income;
|
||||||
|
$('<div>').addClass('total row_key').text(_('total')).appendTo(tt);
|
||||||
|
$('<div>').addClass('total row_val').text(Engine.getIncomeMsg(total, totalIncome[storeName].delay)).appendTo(tt);
|
||||||
tt.appendTo(el);
|
tt.appendTo(el);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -28,17 +28,18 @@ var StateManager = {
|
|||||||
|
|
||||||
//create categories
|
//create categories
|
||||||
var cats = [
|
var cats = [
|
||||||
'features', //big features like buildings, location availability, unlocks, etc
|
'features', // big features like buildings, location availability, unlocks, etc
|
||||||
'stores', //little stuff, items, weapons, etc
|
'stores', // little stuff, items, weapons, etc
|
||||||
'character', //this is for player's character stats such as perks
|
'character', // this is for player's character stats such as perks
|
||||||
'income',
|
'income',
|
||||||
'timers',
|
'timers',
|
||||||
'game', //mostly location related: fire temp, workers, population, world map, etc
|
'game', // mostly location related: fire temp, workers, population, world map, etc
|
||||||
'playStats', //anything play related: play time, loads, etc
|
'playStats', // anything play related: play time, loads, etc
|
||||||
'previous', // prestige, score, trophies (in future), achievements (again, not yet), etc
|
'previous', // prestige, score, trophies (in future), achievements (again, not yet), etc
|
||||||
'outfit', // used to temporarily store the items to be taken on the path
|
'outfit', // used to temporarily store the items to be taken on the path
|
||||||
'config',
|
'config',
|
||||||
'wait' // mysterious wanderers are coming back
|
'wait', // mysterious wanderers are coming back
|
||||||
|
'cooldown' // residual values for cooldown buttons
|
||||||
];
|
];
|
||||||
|
|
||||||
for(var which in cats) {
|
for(var which in cats) {
|
||||||
@@ -193,7 +194,7 @@ var StateManager = {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
removeBranch(stateName, noEvent) {
|
removeBranch: function(stateName, noEvent) {
|
||||||
for(var i in $SM.get(stateName)){
|
for(var i in $SM.get(stateName)){
|
||||||
if(typeof $SM.get(stateName)[i] == 'object'){
|
if(typeof $SM.get(stateName)[i] == 'object'){
|
||||||
$SM.removeBranch(stateName +'["'+ i +'"]');
|
$SM.removeBranch(stateName +'["'+ i +'"]');
|
||||||
|
|||||||
+86
-86
@@ -1,5 +1,5 @@
|
|||||||
var World = {
|
var World = {
|
||||||
|
|
||||||
RADIUS: 30,
|
RADIUS: 30,
|
||||||
VILLAGE_POS: [30, 30],
|
VILLAGE_POS: [30, 30],
|
||||||
TILE: {
|
TILE: {
|
||||||
@@ -101,7 +101,7 @@ var World = {
|
|||||||
cost: { 'bolas': 1 }
|
cost: { 'bolas': 1 }
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
name: 'World',
|
name: 'World',
|
||||||
options: {}, // Nothing for now
|
options: {}, // Nothing for now
|
||||||
init: function(options) {
|
init: function(options) {
|
||||||
@@ -109,12 +109,12 @@ var World = {
|
|||||||
this.options,
|
this.options,
|
||||||
options
|
options
|
||||||
);
|
);
|
||||||
|
|
||||||
// Setup probabilities. Sum must equal 1.
|
// Setup probabilities. Sum must equal 1.
|
||||||
World.TILE_PROBS[World.TILE.FOREST] = 0.15;
|
World.TILE_PROBS[World.TILE.FOREST] = 0.15;
|
||||||
World.TILE_PROBS[World.TILE.FIELD] = 0.35;
|
World.TILE_PROBS[World.TILE.FIELD] = 0.35;
|
||||||
World.TILE_PROBS[World.TILE.BARRENS] = 0.5;
|
World.TILE_PROBS[World.TILE.BARRENS] = 0.5;
|
||||||
|
|
||||||
// Setpiece definitions
|
// Setpiece definitions
|
||||||
World.LANDMARKS[World.TILE.OUTPOST] = { num: 0, minRadius: 0, maxRadius: 0, scene: 'outpost', label: _('An Outpost') };
|
World.LANDMARKS[World.TILE.OUTPOST] = { num: 0, minRadius: 0, maxRadius: 0, scene: 'outpost', label: _('An Outpost') };
|
||||||
World.LANDMARKS[World.TILE.IRON_MINE] = { num: 1, minRadius: 5, maxRadius: 5, scene: 'ironmine', label: _('Iron Mine') };
|
World.LANDMARKS[World.TILE.IRON_MINE] = { num: 1, minRadius: 5, maxRadius: 5, scene: 'ironmine', label: _('Iron Mine') };
|
||||||
@@ -128,12 +128,12 @@ 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')};
|
||||||
|
|
||||||
// Only add the cache if there is prestige data
|
// Only add the cache if there is prestige data
|
||||||
if($SM.get('previous.stores')) {
|
if($SM.get('previous.stores')) {
|
||||||
World.LANDMARKS[World.TILE.CACHE] = { num: 1, minRadius: 10, maxRadius: World.RADIUS * 1.5, scene: 'cache', label: _('A Destroyed Village')};
|
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);
|
||||||
$SM.setM('game.world', {
|
$SM.setM('game.world', {
|
||||||
@@ -141,37 +141,37 @@ var World = {
|
|||||||
mask: World.newMask()
|
mask: World.newMask()
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
// Create the World panel
|
// Create the World panel
|
||||||
this.panel = $('<div>').attr('id', "worldPanel").addClass('location').appendTo('#outerSlider');
|
this.panel = $('<div>').attr('id', "worldPanel").addClass('location').appendTo('#outerSlider');
|
||||||
|
|
||||||
// Create the shrink wrapper
|
// Create the shrink wrapper
|
||||||
var outer = $('<div>').attr('id', 'worldOuter').appendTo(this.panel);
|
var outer = $('<div>').attr('id', 'worldOuter').appendTo(this.panel);
|
||||||
|
|
||||||
// Create the bag panel
|
// Create the bag panel
|
||||||
$('<div>').attr('id', 'bagspace-world').append($('<div>')).appendTo(outer);
|
$('<div>').attr('id', 'bagspace-world').append($('<div>')).appendTo(outer);
|
||||||
$('<div>').attr('id', 'backpackTitle').appendTo(outer);
|
$('<div>').attr('id', 'backpackTitle').appendTo(outer);
|
||||||
$('<div>').attr('id', 'backpackSpace').appendTo(outer);
|
$('<div>').attr('id', 'backpackSpace').appendTo(outer);
|
||||||
$('<div>').attr('id', 'healthCounter').appendTo(outer);
|
$('<div>').attr('id', 'healthCounter').appendTo(outer);
|
||||||
|
|
||||||
Engine.updateOuterSlider();
|
Engine.updateOuterSlider();
|
||||||
|
|
||||||
// Map the ship and show compass tooltip
|
// Map the ship and show compass tooltip
|
||||||
World.ship = World.mapSearch(World.TILE.SHIP,$SM.get('game.world.map'),1);
|
World.ship = World.mapSearch(World.TILE.SHIP,$SM.get('game.world.map'),1);
|
||||||
World.dir = World.compassDir(World.ship[0]);
|
World.dir = World.compassDir(World.ship[0]);
|
||||||
// compass tooltip text
|
// compass tooltip text
|
||||||
Room.compassTooltip(World.dir);
|
Room.compassTooltip(World.dir);
|
||||||
|
|
||||||
//subscribe to stateUpdates
|
//subscribe to stateUpdates
|
||||||
$.Dispatch('stateUpdate').subscribe(World.handleStateUpdates);
|
$.Dispatch('stateUpdate').subscribe(World.handleStateUpdates);
|
||||||
},
|
},
|
||||||
|
|
||||||
clearDungeon: function() {
|
clearDungeon: function() {
|
||||||
Engine.event('progress', 'dungeon cleared');
|
Engine.event('progress', 'dungeon cleared');
|
||||||
World.state.map[World.curPos[0]][World.curPos[1]] = World.TILE.OUTPOST;
|
World.state.map[World.curPos[0]][World.curPos[1]] = World.TILE.OUTPOST;
|
||||||
World.drawRoad();
|
World.drawRoad();
|
||||||
},
|
},
|
||||||
|
|
||||||
drawRoad: function() {
|
drawRoad: function() {
|
||||||
var findClosestRoad = function(startPos) {
|
var findClosestRoad = function(startPos) {
|
||||||
// We'll search in a spiral to find the closest road tile
|
// We'll search in a spiral to find the closest road tile
|
||||||
@@ -226,7 +226,7 @@ var World = {
|
|||||||
xIntersect = closestRoad[0] + xDist;
|
xIntersect = closestRoad[0] + xDist;
|
||||||
yIntersect = closestRoad[1];
|
yIntersect = closestRoad[1];
|
||||||
}
|
}
|
||||||
|
|
||||||
for(var x = 0; x < Math.abs(xDist); x++) {
|
for(var x = 0; x < Math.abs(xDist); x++) {
|
||||||
if(World.isTerrain(World.state.map[closestRoad[0] + (xDir*x)][yIntersect])) {
|
if(World.isTerrain(World.state.map[closestRoad[0] + (xDir*x)][yIntersect])) {
|
||||||
World.state.map[closestRoad[0] + (xDir*x)][yIntersect] = World.TILE.ROAD;
|
World.state.map[closestRoad[0] + (xDir*x)][yIntersect] = World.TILE.ROAD;
|
||||||
@@ -239,14 +239,14 @@ var World = {
|
|||||||
}
|
}
|
||||||
World.drawMap();
|
World.drawMap();
|
||||||
},
|
},
|
||||||
|
|
||||||
updateSupplies: function() {
|
updateSupplies: function() {
|
||||||
var supplies = $('div#bagspace-world > div');
|
var supplies = $('div#bagspace-world > div');
|
||||||
|
|
||||||
if(!Path.outfit) {
|
if(!Path.outfit) {
|
||||||
Path.outfit = {};
|
Path.outfit = {};
|
||||||
}
|
}
|
||||||
|
|
||||||
// Add water
|
// Add water
|
||||||
var water = $('div#supply_water');
|
var water = $('div#supply_water');
|
||||||
if(World.water > 0 && water.length === 0) {
|
if(World.water > 0 && water.length === 0) {
|
||||||
@@ -257,7 +257,7 @@ var World = {
|
|||||||
} else {
|
} else {
|
||||||
water.remove();
|
water.remove();
|
||||||
}
|
}
|
||||||
|
|
||||||
var total = 0;
|
var total = 0;
|
||||||
for(var k in Path.outfit) {
|
for(var k in Path.outfit) {
|
||||||
var item = $('div#supply_' + k.replace(' ', '-'), supplies);
|
var item = $('div#supply_' + k.replace(' ', '-'), supplies);
|
||||||
@@ -278,18 +278,18 @@ var World = {
|
|||||||
item.remove();
|
item.remove();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Update label
|
// Update label
|
||||||
var t = _('pockets');
|
var t = _('pockets');
|
||||||
if($SM.get('stores.rucksack', true) > 0) {
|
if($SM.get('stores.rucksack', true) > 0) {
|
||||||
t = _('rucksack');
|
t = _('rucksack');
|
||||||
}
|
}
|
||||||
$('#backpackTitle').text(t);
|
$('#backpackTitle').text(t);
|
||||||
|
|
||||||
// Update bagspace
|
// Update bagspace
|
||||||
$('#backpackSpace').text(_('free {0}/{1}', Math.floor(Path.getCapacity() - total) , Path.getCapacity()));
|
$('#backpackSpace').text(_('free {0}/{1}', Math.floor(Path.getCapacity() - total) , Path.getCapacity()));
|
||||||
},
|
},
|
||||||
|
|
||||||
setWater: function(w) {
|
setWater: function(w) {
|
||||||
World.water = w;
|
World.water = w;
|
||||||
if(World.water > World.getMaxWater()) {
|
if(World.water > World.getMaxWater()) {
|
||||||
@@ -297,7 +297,7 @@ var World = {
|
|||||||
}
|
}
|
||||||
World.updateSupplies();
|
World.updateSupplies();
|
||||||
},
|
},
|
||||||
|
|
||||||
setHp: function(hp) {
|
setHp: function(hp) {
|
||||||
if(typeof hp == 'number' && !isNaN(hp)) {
|
if(typeof hp == 'number' && !isNaN(hp)) {
|
||||||
World.health = hp;
|
World.health = hp;
|
||||||
@@ -307,35 +307,35 @@ var World = {
|
|||||||
$('#healthCounter').text(_('hp: {0}/{1}', World.health , World.getMaxHealth()));
|
$('#healthCounter').text(_('hp: {0}/{1}', World.health , World.getMaxHealth()));
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
createItemDiv: function(name, num) {
|
createItemDiv: function(name, num) {
|
||||||
var div = $('<div>').attr('id', 'supply_' + name.replace(' ', '-'))
|
var div = $('<div>').attr('id', 'supply_' + name.replace(' ', '-'))
|
||||||
.addClass('supplyItem')
|
.addClass('supplyItem')
|
||||||
.text(_('{0}:{1}',_(name), num));
|
.text(_('{0}:{1}',_(name), num));
|
||||||
|
|
||||||
return div;
|
return div;
|
||||||
},
|
},
|
||||||
|
|
||||||
moveNorth: function() {
|
moveNorth: function() {
|
||||||
Engine.log('North');
|
Engine.log('North');
|
||||||
if(World.curPos[1] > 0) World.move(World.NORTH);
|
if(World.curPos[1] > 0) World.move(World.NORTH);
|
||||||
},
|
},
|
||||||
|
|
||||||
moveSouth: function() {
|
moveSouth: function() {
|
||||||
Engine.log('South');
|
Engine.log('South');
|
||||||
if(World.curPos[1] < World.RADIUS * 2) World.move(World.SOUTH);
|
if(World.curPos[1] < World.RADIUS * 2) World.move(World.SOUTH);
|
||||||
},
|
},
|
||||||
|
|
||||||
moveWest: function() {
|
moveWest: function() {
|
||||||
Engine.log('West');
|
Engine.log('West');
|
||||||
if(World.curPos[0] > 0) World.move(World.WEST);
|
if(World.curPos[0] > 0) World.move(World.WEST);
|
||||||
},
|
},
|
||||||
|
|
||||||
moveEast: function() {
|
moveEast: function() {
|
||||||
Engine.log('East');
|
Engine.log('East');
|
||||||
if(World.curPos[0] < World.RADIUS * 2) World.move(World.EAST);
|
if(World.curPos[0] < World.RADIUS * 2) World.move(World.EAST);
|
||||||
},
|
},
|
||||||
|
|
||||||
move: function(direction) {
|
move: function(direction) {
|
||||||
var oldTile = World.state.map[World.curPos[0]][World.curPos[1]];
|
var oldTile = World.state.map[World.curPos[0]][World.curPos[1]];
|
||||||
World.curPos[0] += direction[0];
|
World.curPos[0] += direction[0];
|
||||||
@@ -352,7 +352,7 @@ var World = {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
keyDown: function(event) {
|
keyDown: function(event) {
|
||||||
switch(event.which) {
|
switch(event.which) {
|
||||||
case 38: // Up
|
case 38: // Up
|
||||||
@@ -412,14 +412,14 @@ var World = {
|
|||||||
World.moveEast();
|
World.moveEast();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
checkDanger: function() {
|
checkDanger: function() {
|
||||||
World.danger = typeof World.danger == 'undefined' ? false: World.danger;
|
World.danger = typeof World.danger == 'undefined' ? false: World.danger;
|
||||||
if(!World.danger) {
|
if(!World.danger) {
|
||||||
if($SM.get('stores["i armour"]', true) === 0 && World.getDistance() >= 8) {
|
if($SM.get('stores["i armour"]', true) === 0 && World.getDistance() >= 8) {
|
||||||
World.danger = true;
|
World.danger = true;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if($SM.get('stores["s armour"]', true) === 0 && World.getDistance() >= 18) {
|
if($SM.get('stores["s armour"]', true) === 0 && World.getDistance() >= 18) {
|
||||||
World.danger = true;
|
World.danger = true;
|
||||||
return true;
|
return true;
|
||||||
@@ -436,7 +436,7 @@ var World = {
|
|||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
},
|
},
|
||||||
|
|
||||||
useSupplies: function() {
|
useSupplies: function() {
|
||||||
World.foodMove++;
|
World.foodMove++;
|
||||||
World.waterMove++;
|
World.waterMove++;
|
||||||
@@ -501,15 +501,15 @@ var World = {
|
|||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
},
|
},
|
||||||
|
|
||||||
meatHeal: function() {
|
meatHeal: function() {
|
||||||
return World.MEAT_HEAL * ($SM.hasPerk('gastronome') ? 2 : 1);
|
return World.MEAT_HEAL * ($SM.hasPerk('gastronome') ? 2 : 1);
|
||||||
},
|
},
|
||||||
|
|
||||||
medsHeal: function() {
|
medsHeal: function() {
|
||||||
return World.MEDS_HEAL;
|
return World.MEDS_HEAL;
|
||||||
},
|
},
|
||||||
|
|
||||||
checkFight: function() {
|
checkFight: function() {
|
||||||
World.fightMove = typeof World.fightMove == 'number' ? World.fightMove : 0;
|
World.fightMove = typeof World.fightMove == 'number' ? World.fightMove : 0;
|
||||||
World.fightMove++;
|
World.fightMove++;
|
||||||
@@ -522,7 +522,7 @@ var World = {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
doSpace: function() {
|
doSpace: function() {
|
||||||
var curTile = World.state.map[World.curPos[0]][World.curPos[1]];
|
var curTile = World.state.map[World.curPos[0]][World.curPos[1]];
|
||||||
|
|
||||||
@@ -538,17 +538,17 @@ var World = {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
getDistance: function(from, to) {
|
getDistance: function(from, to) {
|
||||||
from = from || World.curPos;
|
from = from || World.curPos;
|
||||||
to = to || World.VILLAGE_POS;
|
to = to || World.VILLAGE_POS;
|
||||||
return Math.abs(from[0] - to[0]) + Math.abs(from[1] - to[1]);
|
return Math.abs(from[0] - to[0]) + Math.abs(from[1] - to[1]);
|
||||||
},
|
},
|
||||||
|
|
||||||
getTerrain: function() {
|
getTerrain: function() {
|
||||||
return World.state.map[World.curPos[0]][World.curPos[1]];
|
return World.state.map[World.curPos[0]][World.curPos[1]];
|
||||||
},
|
},
|
||||||
|
|
||||||
narrateMove: function(oldTile, newTile) {
|
narrateMove: function(oldTile, newTile) {
|
||||||
var msg = null;
|
var msg = null;
|
||||||
switch(oldTile) {
|
switch(oldTile) {
|
||||||
@@ -587,7 +587,7 @@ var World = {
|
|||||||
Notifications.notify(World, msg);
|
Notifications.notify(World, msg);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
newMask: function() {
|
newMask: function() {
|
||||||
var mask = new Array(World.RADIUS * 2 + 1);
|
var mask = new Array(World.RADIUS * 2 + 1);
|
||||||
for(var i = 0; i <= World.RADIUS * 2; i++) {
|
for(var i = 0; i <= World.RADIUS * 2; i++) {
|
||||||
@@ -596,33 +596,33 @@ var World = {
|
|||||||
World.lightMap(World.RADIUS, World.RADIUS, mask);
|
World.lightMap(World.RADIUS, World.RADIUS, mask);
|
||||||
return mask;
|
return mask;
|
||||||
},
|
},
|
||||||
|
|
||||||
lightMap: function(x, y, mask) {
|
lightMap: function(x, y, mask) {
|
||||||
var r = World.LIGHT_RADIUS;
|
var r = World.LIGHT_RADIUS;
|
||||||
r *= $SM.hasPerk('scout') ? 2 : 1;
|
r *= $SM.hasPerk('scout') ? 2 : 1;
|
||||||
World.uncoverMap(x, y, r, mask);
|
World.uncoverMap(x, y, r, mask);
|
||||||
return mask;
|
return mask;
|
||||||
},
|
},
|
||||||
|
|
||||||
uncoverMap: function(x, y, r, mask) {
|
uncoverMap: function(x, y, r, mask) {
|
||||||
mask[x][y] = true;
|
mask[x][y] = true;
|
||||||
for(var i = -r; i <= r; i++) {
|
for(var i = -r; i <= r; i++) {
|
||||||
for(var j = -r + Math.abs(i); j <= r - Math.abs(i); j++) {
|
for(var j = -r + Math.abs(i); j <= r - Math.abs(i); j++) {
|
||||||
if(y + j >= 0 && y + j <= World.RADIUS * 2 &&
|
if(y + j >= 0 && y + j <= World.RADIUS * 2 &&
|
||||||
x + i <= World.RADIUS * 2 &&
|
x + i <= World.RADIUS * 2 &&
|
||||||
x + i >= 0) {
|
x + i >= 0) {
|
||||||
mask[x+i][y+j] = true;
|
mask[x+i][y+j] = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
applyMap: function() {
|
applyMap: function() {
|
||||||
var x = Math.floor(Math.random() * (World.RADIUS * 2) + 1);
|
var x = Math.floor(Math.random() * (World.RADIUS * 2) + 1);
|
||||||
var y = Math.floor(Math.random() * (World.RADIUS * 2) + 1);
|
var y = Math.floor(Math.random() * (World.RADIUS * 2) + 1);
|
||||||
World.uncoverMap(x, y, 5, $SM.get('game.world.mask'));
|
World.uncoverMap(x, y, 5, $SM.get('game.world.mask'));
|
||||||
},
|
},
|
||||||
|
|
||||||
generateMap: function() {
|
generateMap: function() {
|
||||||
var map = new Array(World.RADIUS * 2 + 1);
|
var map = new Array(World.RADIUS * 2 + 1);
|
||||||
for(var i = 0; i <= World.RADIUS * 2; i++) {
|
for(var i = 0; i <= World.RADIUS * 2; i++) {
|
||||||
@@ -647,11 +647,11 @@ var World = {
|
|||||||
x = World.RADIUS - r;
|
x = World.RADIUS - r;
|
||||||
y = World.RADIUS + (7 * r) - t;
|
y = World.RADIUS + (7 * r) - t;
|
||||||
}
|
}
|
||||||
|
|
||||||
map[x][y] = World.chooseTile(x, y, map);
|
map[x][y] = World.chooseTile(x, y, map);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Place landmarks
|
// Place landmarks
|
||||||
for(var k in World.LANDMARKS) {
|
for(var k in World.LANDMARKS) {
|
||||||
var landmark = World.LANDMARKS[k];
|
var landmark = World.LANDMARKS[k];
|
||||||
@@ -659,10 +659,10 @@ var World = {
|
|||||||
var pos = World.placeLandmark(landmark.minRadius, landmark.maxRadius, k, map);
|
var pos = World.placeLandmark(landmark.minRadius, landmark.maxRadius, k, map);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return map;
|
return map;
|
||||||
},
|
},
|
||||||
|
|
||||||
mapSearch: function(target,map,required){
|
mapSearch: function(target,map,required){
|
||||||
var max = World.LANDMARKS[target].num;
|
var max = World.LANDMARKS[target].num;
|
||||||
if(!max){
|
if(!max){
|
||||||
@@ -681,7 +681,7 @@ var World = {
|
|||||||
// items are listed as they appear in the map, tl-br
|
// items are listed as they appear in the map, tl-br
|
||||||
// each item has relative coordinates and a compass-type direction
|
// each item has relative coordinates and a compass-type direction
|
||||||
targets[index] = {
|
targets[index] = {
|
||||||
x : i - World.RADIUS,
|
x : i - World.RADIUS,
|
||||||
y : j - World.RADIUS,
|
y : j - World.RADIUS,
|
||||||
}
|
}
|
||||||
index++;
|
index++;
|
||||||
@@ -694,7 +694,7 @@ var World = {
|
|||||||
}
|
}
|
||||||
return targets;
|
return targets;
|
||||||
},
|
},
|
||||||
|
|
||||||
compassDir: function(pos){
|
compassDir: function(pos){
|
||||||
var dir = '';
|
var dir = '';
|
||||||
var horz = pos.x < 0 ? 'west' : 'east';
|
var horz = pos.x < 0 ? 'west' : 'east';
|
||||||
@@ -708,9 +708,9 @@ var World = {
|
|||||||
}
|
}
|
||||||
return dir;
|
return dir;
|
||||||
},
|
},
|
||||||
|
|
||||||
placeLandmark: function(minRadius, maxRadius, landmark, map) {
|
placeLandmark: function(minRadius, maxRadius, landmark, map) {
|
||||||
|
|
||||||
var x = World.RADIUS, y = World.RADIUS;
|
var x = World.RADIUS, y = World.RADIUS;
|
||||||
while(!World.isTerrain(map[x][y])) {
|
while(!World.isTerrain(map[x][y])) {
|
||||||
var r = Math.floor(Math.random() * (maxRadius - minRadius)) + minRadius;
|
var r = Math.floor(Math.random() * (maxRadius - minRadius)) + minRadius;
|
||||||
@@ -728,20 +728,20 @@ var World = {
|
|||||||
map[x][y] = landmark;
|
map[x][y] = landmark;
|
||||||
return [x, y];
|
return [x, y];
|
||||||
},
|
},
|
||||||
|
|
||||||
isTerrain: function(tile) {
|
isTerrain: function(tile) {
|
||||||
return tile == World.TILE.FOREST || tile == World.TILE.FIELD || tile == World.TILE.BARRENS;
|
return tile == World.TILE.FOREST || tile == World.TILE.FIELD || tile == World.TILE.BARRENS;
|
||||||
},
|
},
|
||||||
|
|
||||||
chooseTile: function(x, y, map) {
|
chooseTile: function(x, y, map) {
|
||||||
|
|
||||||
var adjacent = [
|
var adjacent = [
|
||||||
y > 0 ? map[x][y-1] : null,
|
y > 0 ? map[x][y-1] : null,
|
||||||
y < World.RADIUS * 2 ? map[x][y+1] : null,
|
y < World.RADIUS * 2 ? map[x][y+1] : null,
|
||||||
x < World.RADIUS * 2 ? map[x+1][y] : null,
|
x < World.RADIUS * 2 ? map[x+1][y] : null,
|
||||||
x > 0 ? map[x-1][y] : null
|
x > 0 ? map[x-1][y] : null
|
||||||
];
|
];
|
||||||
|
|
||||||
var chances = {};
|
var chances = {};
|
||||||
var nonSticky = 1;
|
var nonSticky = 1;
|
||||||
for(var i in adjacent) {
|
for(var i in adjacent) {
|
||||||
@@ -764,7 +764,7 @@ var World = {
|
|||||||
chances[tile] = cur;
|
chances[tile] = cur;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
var list = [];
|
var list = [];
|
||||||
for(var t in chances) {
|
for(var t in chances) {
|
||||||
list.push(chances[t] + '' + t);
|
list.push(chances[t] + '' + t);
|
||||||
@@ -774,7 +774,7 @@ var World = {
|
|||||||
var n2 = parseFloat(b.substring(0, b.length - 1));
|
var n2 = parseFloat(b.substring(0, b.length - 1));
|
||||||
return n2 - n1;
|
return n2 - n1;
|
||||||
});
|
});
|
||||||
|
|
||||||
var c = 0;
|
var c = 0;
|
||||||
var r = Math.random();
|
var r = Math.random();
|
||||||
for(var i in list) {
|
for(var i in list) {
|
||||||
@@ -784,14 +784,14 @@ var World = {
|
|||||||
return prob.charAt(prob.length - 1);
|
return prob.charAt(prob.length - 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return World.TILE.BARRENS;
|
return World.TILE.BARRENS;
|
||||||
},
|
},
|
||||||
|
|
||||||
markVisited: function(x, y) {
|
markVisited: function(x, y) {
|
||||||
World.state.map[x][y] = World.state.map[x][y] + '!';
|
World.state.map[x][y] = World.state.map[x][y] + '!';
|
||||||
},
|
},
|
||||||
|
|
||||||
drawMap: function() {
|
drawMap: function() {
|
||||||
var map = $('#map');
|
var map = $('#map');
|
||||||
if(map.length === 0) {
|
if(map.length === 0) {
|
||||||
@@ -840,7 +840,7 @@ var World = {
|
|||||||
}
|
}
|
||||||
map.html(mapString);
|
map.html(mapString);
|
||||||
},
|
},
|
||||||
|
|
||||||
die: function() {
|
die: function() {
|
||||||
if(!World.dead) {
|
if(!World.dead) {
|
||||||
World.dead = true;
|
World.dead = true;
|
||||||
@@ -858,8 +858,8 @@ var World = {
|
|||||||
Engine.activeModule = Room;
|
Engine.activeModule = Room;
|
||||||
$('div.headerButton').removeClass('selected');
|
$('div.headerButton').removeClass('selected');
|
||||||
Room.tab.addClass('selected');
|
Room.tab.addClass('selected');
|
||||||
Engine.setTimeout(function(){
|
Engine.setTimeout(function(){
|
||||||
Room.onArrival();
|
Room.onArrival();
|
||||||
$('#outerSlider').animate({opacity:'1'}, 600, 'linear');
|
$('#outerSlider').animate({opacity:'1'}, 600, 'linear');
|
||||||
Button.cooldown($('#embarkButton'));
|
Button.cooldown($('#embarkButton'));
|
||||||
Engine.keyLock = false;
|
Engine.keyLock = false;
|
||||||
@@ -868,7 +868,7 @@ var World = {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
goHome: function() {
|
goHome: function() {
|
||||||
// Home safe! Commit the changes.
|
// Home safe! Commit the changes.
|
||||||
$SM.setM('game.world', World.state);
|
$SM.setM('game.world', World.state);
|
||||||
@@ -889,31 +889,29 @@ var World = {
|
|||||||
Engine.event('progress', 'ship');
|
Engine.event('progress', 'ship');
|
||||||
}
|
}
|
||||||
World.state = null;
|
World.state = null;
|
||||||
|
|
||||||
// Clear the embark cooldown
|
|
||||||
var btn = Button.clearCooldown($('#embarkButton'));
|
|
||||||
if(Path.outfit['cured meat'] > 0) {
|
if(Path.outfit['cured meat'] > 0) {
|
||||||
Button.setDisabled(btn, false);
|
Button.setDisabled($('#embarkButton'), false);
|
||||||
}
|
}
|
||||||
|
|
||||||
for(var k in Path.outfit) {
|
for(var k in Path.outfit) {
|
||||||
$SM.add('stores["'+k+'"]', Path.outfit[k]);
|
$SM.add('stores["'+k+'"]', Path.outfit[k]);
|
||||||
if(World.leaveItAtHome(k)) {
|
if(World.leaveItAtHome(k)) {
|
||||||
Path.outfit[k] = 0;
|
Path.outfit[k] = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$('#outerSlider').animate({left: '0px'}, 300);
|
$('#outerSlider').animate({left: '0px'}, 300);
|
||||||
Engine.activeModule = Path;
|
Engine.activeModule = Path;
|
||||||
Path.onArrival();
|
Path.onArrival();
|
||||||
Engine.restoreNavigation = true;
|
Engine.restoreNavigation = true;
|
||||||
},
|
},
|
||||||
|
|
||||||
leaveItAtHome: function(thing) {
|
leaveItAtHome: function(thing) {
|
||||||
return thing != 'cured meat' && thing != 'bullets' && thing != 'energy cell' && thing != 'charm' && thing != 'medicine' &&
|
return thing != 'cured meat' && thing != 'bullets' && thing != 'energy cell' && thing != 'charm' && thing != 'medicine' &&
|
||||||
typeof World.Weapons[thing] == 'undefined' && typeof Room.Craftables[thing] == 'undefined';
|
typeof World.Weapons[thing] == 'undefined' && typeof Room.Craftables[thing] == 'undefined';
|
||||||
},
|
},
|
||||||
|
|
||||||
getMaxHealth: function() {
|
getMaxHealth: function() {
|
||||||
if($SM.get('stores["s armour"]', true) > 0) {
|
if($SM.get('stores["s armour"]', true) > 0) {
|
||||||
return World.BASE_HEALTH + 35;
|
return World.BASE_HEALTH + 35;
|
||||||
@@ -924,14 +922,14 @@ var World = {
|
|||||||
}
|
}
|
||||||
return World.BASE_HEALTH;
|
return World.BASE_HEALTH;
|
||||||
},
|
},
|
||||||
|
|
||||||
getHitChance: function() {
|
getHitChance: function() {
|
||||||
if($SM.hasPerk('precise')) {
|
if($SM.hasPerk('precise')) {
|
||||||
return World.BASE_HIT_CHANCE + 0.1;
|
return World.BASE_HIT_CHANCE + 0.1;
|
||||||
}
|
}
|
||||||
return World.BASE_HIT_CHANCE;
|
return World.BASE_HIT_CHANCE;
|
||||||
},
|
},
|
||||||
|
|
||||||
getMaxWater: function() {
|
getMaxWater: function() {
|
||||||
if($SM.get('stores["water tank"]', true) > 0) {
|
if($SM.get('stores["water tank"]', true) > 0) {
|
||||||
return World.BASE_WATER + 50;
|
return World.BASE_WATER + 50;
|
||||||
@@ -942,23 +940,25 @@ var World = {
|
|||||||
}
|
}
|
||||||
return World.BASE_WATER;
|
return World.BASE_WATER;
|
||||||
},
|
},
|
||||||
|
|
||||||
outpostUsed: function(x, y) {
|
outpostUsed: function(x, y) {
|
||||||
x = typeof x == 'number' ? x : World.curPos[0];
|
x = typeof x == 'number' ? x : World.curPos[0];
|
||||||
y = typeof y == 'number' ? y : World.curPos[1];
|
y = typeof y == 'number' ? y : World.curPos[1];
|
||||||
var used = World.usedOutposts[x + ',' + y];
|
var used = World.usedOutposts[x + ',' + y];
|
||||||
return typeof used != 'undefined' && used === true;
|
return typeof used != 'undefined' && used === true;
|
||||||
},
|
},
|
||||||
|
|
||||||
useOutpost: function() {
|
useOutpost: function() {
|
||||||
Notifications.notify(null, _('water replenished'));
|
Notifications.notify(null, _('water replenished'));
|
||||||
World.setWater(World.getMaxWater());
|
World.setWater(World.getMaxWater());
|
||||||
// Mark this outpost as used
|
// Mark this outpost as used
|
||||||
World.usedOutposts[World.curPos[0] + ',' + World.curPos[1]] = true;
|
World.usedOutposts[World.curPos[0] + ',' + World.curPos[1]] = true;
|
||||||
},
|
},
|
||||||
|
|
||||||
onArrival: function() {
|
onArrival: function() {
|
||||||
Engine.tabNavigation = false;
|
Engine.tabNavigation = false;
|
||||||
|
// Clear the embark cooldown
|
||||||
|
Button.clearCooldown($('#embarkButton'));
|
||||||
Engine.keyLock = false;
|
Engine.keyLock = false;
|
||||||
// Explore in a temporary world-state. We'll commit the changes if you return home safe.
|
// Explore in a temporary world-state. We'll commit the changes if you return home safe.
|
||||||
World.state = $.extend(true, {}, $SM.get('game.world'));
|
World.state = $.extend(true, {}, $SM.get('game.world'));
|
||||||
@@ -977,16 +977,16 @@ var World = {
|
|||||||
World.updateSupplies();
|
World.updateSupplies();
|
||||||
$('#bagspace-world').width($('#map').width());
|
$('#bagspace-world').width($('#map').width());
|
||||||
},
|
},
|
||||||
|
|
||||||
setTitle: function() {
|
setTitle: function() {
|
||||||
document.title = _('A Barren World');
|
document.title = _('A Barren World');
|
||||||
},
|
},
|
||||||
|
|
||||||
copyPos: function(pos) {
|
copyPos: function(pos) {
|
||||||
return [pos[0], pos[1]];
|
return [pos[0], pos[1]];
|
||||||
},
|
},
|
||||||
|
|
||||||
handleStateUpdates: function(e){
|
handleStateUpdates: function(e){
|
||||||
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user