Merge pull request #102 from anubisthejackle/whitespace-fixes

Covert whitespace to tabs as per coding standard
This commit is contained in:
Blake Grotewold
2014-07-17 19:25:45 -04:00
15 changed files with 2261 additions and 2203 deletions
+100 -100
View File
@@ -6,136 +6,136 @@
**/
var Base64 = {
// private property
_keyStr : "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",
// private property
_keyStr : "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",
// public method for encoding
encode : function (input) {
var output = "";
var chr1, chr2, chr3, enc1, enc2, enc3, enc4;
var i = 0;
// public method for encoding
encode : function (input) {
var output = "";
var chr1, chr2, chr3, enc1, enc2, enc3, enc4;
var i = 0;
input = Base64._utf8_encode(input);
input = Base64._utf8_encode(input);
while (i < input.length) {
while (i < input.length) {
chr1 = input.charCodeAt(i++);
chr2 = input.charCodeAt(i++);
chr3 = input.charCodeAt(i++);
chr1 = input.charCodeAt(i++);
chr2 = input.charCodeAt(i++);
chr3 = input.charCodeAt(i++);
enc1 = chr1 >> 2;
enc2 = ((chr1 & 3) << 4) | (chr2 >> 4);
enc3 = ((chr2 & 15) << 2) | (chr3 >> 6);
enc4 = chr3 & 63;
enc1 = chr1 >> 2;
enc2 = ((chr1 & 3) << 4) | (chr2 >> 4);
enc3 = ((chr2 & 15) << 2) | (chr3 >> 6);
enc4 = chr3 & 63;
if (isNaN(chr2)) {
enc3 = enc4 = 64;
} else if (isNaN(chr3)) {
enc4 = 64;
}
if (isNaN(chr2)) {
enc3 = enc4 = 64;
} else if (isNaN(chr3)) {
enc4 = 64;
}
output = output +
this._keyStr.charAt(enc1) + this._keyStr.charAt(enc2) +
this._keyStr.charAt(enc3) + this._keyStr.charAt(enc4);
output = output +
this._keyStr.charAt(enc1) + this._keyStr.charAt(enc2) +
this._keyStr.charAt(enc3) + this._keyStr.charAt(enc4);
}
}
return output;
},
return output;
},
// public method for decoding
decode : function (input) {
var output = "";
var chr1, chr2, chr3;
var enc1, enc2, enc3, enc4;
var i = 0;
// public method for decoding
decode : function (input) {
var output = "";
var chr1, chr2, chr3;
var enc1, enc2, enc3, enc4;
var i = 0;
input = input.replace(/[^A-Za-z0-9\+\/\=]/g, "");
input = input.replace(/[^A-Za-z0-9\+\/\=]/g, "");
while (i < input.length) {
while (i < input.length) {
enc1 = this._keyStr.indexOf(input.charAt(i++));
enc2 = this._keyStr.indexOf(input.charAt(i++));
enc3 = this._keyStr.indexOf(input.charAt(i++));
enc4 = this._keyStr.indexOf(input.charAt(i++));
enc1 = this._keyStr.indexOf(input.charAt(i++));
enc2 = this._keyStr.indexOf(input.charAt(i++));
enc3 = this._keyStr.indexOf(input.charAt(i++));
enc4 = this._keyStr.indexOf(input.charAt(i++));
chr1 = (enc1 << 2) | (enc2 >> 4);
chr2 = ((enc2 & 15) << 4) | (enc3 >> 2);
chr3 = ((enc3 & 3) << 6) | enc4;
chr1 = (enc1 << 2) | (enc2 >> 4);
chr2 = ((enc2 & 15) << 4) | (enc3 >> 2);
chr3 = ((enc3 & 3) << 6) | enc4;
output = output + String.fromCharCode(chr1);
output = output + String.fromCharCode(chr1);
if (enc3 != 64) {
output = output + String.fromCharCode(chr2);
}
if (enc4 != 64) {
output = output + String.fromCharCode(chr3);
}
if (enc3 != 64) {
output = output + String.fromCharCode(chr2);
}
if (enc4 != 64) {
output = output + String.fromCharCode(chr3);
}
}
}
output = Base64._utf8_decode(output);
output = Base64._utf8_decode(output);
return output;
return output;
},
},
// private method for UTF-8 encoding
_utf8_encode : function (string) {
string = string.replace(/\r\n/g,"\n");
var utftext = "";
// private method for UTF-8 encoding
_utf8_encode : function (string) {
string = string.replace(/\r\n/g,"\n");
var utftext = "";
for (var n = 0; n < string.length; n++) {
for (var n = 0; n < string.length; n++) {
var c = string.charCodeAt(n);
var c = string.charCodeAt(n);
if (c < 128) {
utftext += String.fromCharCode(c);
}
else if((c > 127) && (c < 2048)) {
utftext += String.fromCharCode((c >> 6) | 192);
utftext += String.fromCharCode((c & 63) | 128);
}
else {
utftext += String.fromCharCode((c >> 12) | 224);
utftext += String.fromCharCode(((c >> 6) & 63) | 128);
utftext += String.fromCharCode((c & 63) | 128);
}
if (c < 128) {
utftext += String.fromCharCode(c);
}
else if((c > 127) && (c < 2048)) {
utftext += String.fromCharCode((c >> 6) | 192);
utftext += String.fromCharCode((c & 63) | 128);
}
else {
utftext += String.fromCharCode((c >> 12) | 224);
utftext += String.fromCharCode(((c >> 6) & 63) | 128);
utftext += String.fromCharCode((c & 63) | 128);
}
}
}
return utftext;
},
return utftext;
},
// private method for UTF-8 decoding
_utf8_decode : function (utftext) {
var string = "";
var i = 0;
var c = c1 = c2 = 0;
// private method for UTF-8 decoding
_utf8_decode : function (utftext) {
var string = "";
var i = 0;
var c = c1 = c2 = 0;
while ( i < utftext.length ) {
while ( i < utftext.length ) {
c = utftext.charCodeAt(i);
c = utftext.charCodeAt(i);
if (c < 128) {
string += String.fromCharCode(c);
i++;
}
else if((c > 191) && (c < 224)) {
c2 = utftext.charCodeAt(i+1);
string += String.fromCharCode(((c & 31) << 6) | (c2 & 63));
i += 2;
}
else {
c2 = utftext.charCodeAt(i+1);
c3 = utftext.charCodeAt(i+2);
string += String.fromCharCode(((c & 15) << 12) | ((c2 & 63) << 6) | (c3 & 63));
i += 3;
}
if (c < 128) {
string += String.fromCharCode(c);
i++;
}
else if((c > 191) && (c < 224)) {
c2 = utftext.charCodeAt(i+1);
string += String.fromCharCode(((c & 31) << 6) | (c2 & 63));
i += 2;
}
else {
c2 = utftext.charCodeAt(i+1);
c3 = utftext.charCodeAt(i+2);
string += String.fromCharCode(((c & 15) << 12) | ((c2 & 63) << 6) | (c3 & 63));
i += 3;
}
}
}
return string;
}
return string;
}
}
+256 -235
View File
@@ -114,10 +114,10 @@
.appendTo('body');
if(typeof langs != 'undefined'){
var selectWrap = $('<span>')
.addClass('select-wrap')
.appendTo(menu);
var select = $('<select>')
var selectWrap = $('<span>')
.addClass('select-wrap')
.appendTo(menu);
var select = $('<select>')
.addClass('menuBtn')
.append($('<option>').text("language."))
.change(Engine.switchLanguage)
@@ -127,9 +127,8 @@
$('<option>').text(display).val(name).appendTo(select)
});
}
$('<span>')
$('<span>')
.addClass('lightsOff menuBtn')
.text(_('lights off.'))
.click(Engine.turnLightsOff)
@@ -146,7 +145,7 @@
.text(_('share.'))
.click(Engine.share)
.appendTo(menu);
$('<span>')
.addClass('menuBtn')
.text(_('save.'))
@@ -204,14 +203,11 @@
},
browserValid: function() {
return location.search.indexOf('ignorebrowser=true') >= 0 || (
typeof Storage != 'undefined' &&
!oldIE);
return ( location.search.indexOf( 'ignorebrowser=true' ) >= 0 || ( typeof Storage != 'undefined' && !oldIE ) );
},
isMobile: function() {
return location.search.indexOf('ignorebrowser=true') < 0 &&
/Android|webOS|iPhone|iPad|iPod|BlackBerry/i.test(navigator.userAgent);
return ( location.search.indexOf( 'ignorebrowser=true' ) < 0 && /Android|webOS|iPhone|iPad|iPod|BlackBerry/i.test( navigator.userAgent ) );
},
saveGame: function() {
@@ -242,111 +238,133 @@
}
},
exportImport: function() {
Events.startEvent({
title: _('Export / Import'),
scenes: {
start: {
text: [_('export or import save data, for backing up'),
_('or migrating computers')],
buttons: {
'export': {
text: _('export'),
onChoose: Engine.export64
exportImport: function() {
Events.startEvent({
title: _('Export / Import'),
scenes: {
start: {
text: [
_('export or import save data, for backing up'),
_('or migrating computers')
],
buttons: {
'export': {
text: _('export'),
onChoose: Engine.export64
},
'import': {
text: _('import'),
nextScene: {1: 'confirm'},
},
'cancel': {
text: _('cancel'),
nextScene: 'end'
}
},
'import': {
text: _('import'),
nextScene: {1: 'confirm'},
'confirm': {
text: [
_('are you sure?'),
_('if the code is invalid, all data will be lost.'),
_('this is irreversible.')
],
buttons: {
'yes': {
text: _('yes'),
nextScene: {1: 'inputImport'},
onChoose: Engine.enableSelection
},
'no': {
text: _('no'),
nextScene: 'end'
}
}
},
'cancel': {
text: _('cancel'),
nextScene: 'end'
'inputImport': {
text: [
_('put the save code here.')
],
textarea: '',
buttons: {
'okay': {
text: _('import'),
nextScene: 'end',
onChoose: Engine.import64
},
'cancel': {
text: _('cancel'),
nextScene: 'end'
}
}
}
}
},
'confirm': {
text: [_('are you sure?'),
_('if the code is invalid, all data will be lost.'),
_('this is irreversible.')],
buttons: {
'yes': {
text: _('yes'),
nextScene: {1: 'inputImport'},
onChoose: Engine.enableSelection
},
'no': {
text: _('no'),
nextScene: 'end'
}
}
},
'inputImport': {
text: [_('put the save code here.')],
textarea: '',
buttons: {
'okay': {
text: _('import'),
nextScene: 'end',
onChoose: Engine.import64
},
'cancel': {
text: _('cancel'),
nextScene: 'end'
},
'inputImport': {
text: [_('put the save code here.')],
textarea: '',
buttons: {
'okay': {
text: _('import'),
nextScene: 'end',
onChoose: Engine.import64
},
'cancel': {
text: _('cancel'),
nextScene: 'end'
}
}
}
}
}
});
},
});
},
generateExport64: function(){
var string64 = Base64.encode(localStorage.gameState);
string64 = string64.replace(/\s/g, '');
string64 = string64.replace(/\./g, '');
string64 = string64.replace(/\n/g, '');
generateExport64: function(){
var string64 = Base64.encode(localStorage.gameState);
string64 = string64.replace(/\s/g, '');
string64 = string64.replace(/\./g, '');
string64 = string64.replace(/\n/g, '');
return string64;
},
export64: function() {
Engine.saveGame();
var string64 = Engine.generateExport64();
Engine.enableSelection();
Events.startEvent({
title: _('Export'),
scenes: {
start: {
text: [_('save this.')],
textarea: string64,
buttons: {
'done': {
text: _('got it'),
nextScene: 'end',
onChoose: Engine.disableSelection
}
}
}
}
});
Engine.autoSelect('#description textarea')
},
import64: function(string64) {
Engine.disableSelection();
string64 = string64.replace(/\s/g, '');
string64 = string64.replace(/\./g, '');
string64 = string64.replace(/\n/g, '');
var decodedSave = Base64.decode(string64);
localStorage.gameState = decodedSave;
location.reload();
},
return string64;
},
export64: function() {
Engine.saveGame();
var string64 = Engine.generateExport64();
Engine.enableSelection();
Events.startEvent({
title: _('Export'),
scenes: {
start: {
text: [_('save this.')],
textarea: string64,
buttons: {
'done': {
text: _('got it'),
nextScene: 'end',
onChoose: Engine.disableSelection
}
}
}
}
});
Engine.autoSelect('#description textarea')
},
import64: function(string64) {
Engine.disableSelection();
string64 = string64.replace(/\s/g, '');
string64 = string64.replace(/\./g, '');
string64 = string64.replace(/\n/g, '');
var decodedSave = Base64.decode(string64);
localStorage.gameState = decodedSave;
location.reload();
},
event: function(cat, act) {
if(typeof ga === 'function') {
ga('send', 'event', cat, act);
}
},
confirmDelete: function() {
Events.startEvent({
title: _('Restart?'),
@@ -368,19 +386,19 @@
}
});
},
deleteSave: function(noReload) {
if(typeof Storage != 'undefined' && localStorage) {
var prestige = Prestige.get();
window.State = {};
localStorage.clear();
Prestige.set(prestige);
}
if(!noReload) {
location.reload();
}
if(typeof Storage != 'undefined' && localStorage) {
var prestige = Prestige.get();
window.State = {};
localStorage.clear();
Prestige.set(prestige);
}
if(!noReload) {
location.reload();
}
},
share: function() {
Events.startEvent({
title: _('Share'),
@@ -404,17 +422,17 @@
},
'twitter': {
text: _('twitter'),
nextScene: 'end',
onChoose: function() {
window.open('https://twitter.com/intent/tweet?text=A%20Dark%20Room&url=' + Engine.SITE_URL, 'sharer', 'width=660,height=260,location=no,menubar=no,resizable=no,scrollbars=yes,status=no,toolbar=no');
},
nextScene: 'end'
}
},
'reddit': {
text: _('reddit'),
nextScene: 'end',
onChoose: function() {
window.open('http://www.reddit.com/submit?url=' + Engine.SITE_URL, 'sharer', 'width=960,height=700,location=no,menubar=no,resizable=no,scrollbars=yes,status=no,toolbar=no');
},
nextScene: 'end'
}
},
'close': {
text: _('close'),
@@ -423,78 +441,77 @@
}
}
}
}, {width: '400px'});
},
{
width: '400px'
});
},
findStylesheet: function(title) {
for(var i=0; i<document.styleSheets.length; i++) {
var sheet = document.styleSheets[i];
if(sheet.title == title) {
return sheet;
}
}
return null;
},
isLightsOff: function() {
var darkCss = Engine.findStylesheet('darkenLights');
if ( darkCss != null && !darkCss.disabled ) {
return true;
}
return false;
},
findStylesheet: function(title) {
for(var i=0; i<document.styleSheets.length; i++) {
var sheet = document.styleSheets[i];
if(sheet.title == title) {
return sheet;
}
}
return null;
},
turnLightsOff: function() {
var darkCss = Engine.findStylesheet('darkenLights');
if (darkCss == null) {
$('head').append('<link rel="stylesheet" href="css/dark.css" type="text/css" title="darkenLights" />');
Engine.turnLightsOff;
$('.lightsOff').text(_('lights on.'));
} else if (darkCss.disabled) {
darkCss.disabled = false;
$('.lightsOff').text(_('lights on.'));
} else {
$("#darkenLights").attr("disabled", "disabled");
darkCss.disabled = true;
$('.lightsOff').text(_('lights off.'));
}
},
isLightsOff: function() {
var darkCss = Engine.findStylesheet('darkenLights');
if (darkCss != null) {
if (darkCss.disabled)
return false;
return true;
}
return false;
},
turnLightsOff: function() {
var darkCss = Engine.findStylesheet('darkenLights');
if (darkCss == null) {
$('head').append('<link rel="stylesheet" href="css/dark.css" type="text/css" title="darkenLights" />');
Engine.turnLightsOff;
$('.lightsOff').text(_('lights on.'));
}
else if (darkCss.disabled) {
darkCss.disabled = false;
$('.lightsOff').text(_('lights on.'));
}
else {
$("#darkenLights").attr("disabled", "disabled");
darkCss.disabled = true;
$('.lightsOff').text(_('lights off.'));
}
},
// Gets a guid
getGuid: function() {
return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function(c) {
var r = Math.random()*16|0, v = c == 'x' ? r : (r&0x3|0x8);
return v.toString(16);
var r = Math.random()*16|0, v = c == 'x' ? r : (r&0x3|0x8);
return v.toString(16);
});
},
activeModule: null,
travelTo: function(module) {
if(Engine.activeModule != module) {
var currentIndex = Engine.activeModule ? $('.location').index(Engine.activeModule.panel) : 1;
$('div.headerButton').removeClass('selected');
module.tab.addClass('selected');
var slider = $('#locationSlider');
var stores = $('#storesContainer');
var panelIndex = $('.location').index(module.panel);
var diff = Math.abs(panelIndex - currentIndex);
slider.animate({left: -(panelIndex * 700) + 'px'}, 300 * diff);
if($SM.get('stores.wood') != undefined) {
// FIXME Why does this work if there's an animation queue...?
stores.animate({right: -(panelIndex * 700) + 'px'}, 300 * diff);
}
Engine.activeModule = module;
module.onArrival(diff);
if(Engine.activeModule == Room || Engine.activeModule == Path) {
// Don't fade out the weapons if we're switching to a module
// where we're going to keep showing them anyway.
@@ -502,28 +519,28 @@
$('div#weapons').animate({opacity: 0}, 300);
}
}
if(module == Room || module == Path) {
$('div#weapons').animate({opacity: 1}, 300);
}
Notifications.printQueue(module);
}
},
// Move the stores panel beneath top_container (or to top: 0px if top_container
// either hasn't been filled in or is null) using transition_diff to sync with
// the animation in Engine.travelTo().
/* Move the stores panel beneath top_container (or to top: 0px if top_container
* either hasn't been filled in or is null) using transition_diff to sync with
* the animation in Engine.travelTo().
*/
moveStoresView: function(top_container, transition_diff) {
var stores = $('#storesContainer');
// If we don't have a storesContainer yet, leave.
if(typeof(stores) === 'undefined') return;
if(typeof(transition_diff) === 'undefined') transition_diff = 1;
if(top_container === null) {
stores.animate({top: '0px'}, {queue: false, duration: 300 * transition_diff});
}
@@ -531,32 +548,37 @@
stores.animate({top: '0px'}, {queue: false, duration: 300 * transition_diff});
}
else {
stores.animate({top: top_container.height() + 26 + 'px'},
{queue: false, duration: 300 * transition_diff});
stores.animate({
top: top_container.height() + 26 + 'px'
},
{
queue: false,
duration: 300 * transition_diff
});
}
},
log: function(msg) {
if(this._log) {
console.log(msg);
}
},
updateSlider: function() {
var slider = $('#locationSlider');
slider.width((slider.children().length * 700) + 'px');
},
updateOuterSlider: function() {
var slider = $('#outerSlider');
slider.width((slider.children().length * 700) + 'px');
},
getIncomeMsg: function(num, delay) {
return _("{0} per {1}s", (num > 0 ? "+" : "") + num, delay);
//return (num > 0 ? "+" : "") + num + " per " + delay + "s";
},
keyDown: function(e) {
if(!Engine.keyPressed && !Engine.keyLock) {
Engine.pressed = true;
@@ -566,91 +588,91 @@
}
return !(jQuery.inArray(window.event.keycode, [37,38,39,40]));
},
keyUp: function(e) {
Engine.pressed = false;
if(Engine.activeModule.keyUp) {
Engine.activeModule.keyUp(e);
}
else
{
switch(e.which) {
case 38: // Up
case 87:
Engine.log('up');
break;
case 40: // Down
case 83:
Engine.log('down');
break;
case 37: // Left
case 65:
if(Engine.activeModule == Ship && Path.tab)
Engine.travelTo(Path);
else if(Engine.activeModule == Path && Outside.tab)
Engine.travelTo(Outside);
else if(Engine.activeModule == Outside && Room.tab)
Engine.travelTo(Room);
Engine.log('left');
break;
case 39: // Right
case 68:
if(Engine.activeModule == Room && Outside.tab)
Engine.travelTo(Outside);
else if(Engine.activeModule == Outside && Path.tab)
Engine.travelTo(Path);
else if(Engine.activeModule == Path && Ship.tab)
Engine.travelTo(Ship);
Engine.log('right');
break;
}
else
{
switch(e.which) {
case 38: // Up
case 87:
Engine.log('up');
break;
case 40: // Down
case 83:
Engine.log('down');
break;
case 37: // Left
case 65:
if(Engine.activeModule == Ship && Path.tab)
Engine.travelTo(Path);
else if(Engine.activeModule == Path && Outside.tab)
Engine.travelTo(Outside);
else if(Engine.activeModule == Outside && Room.tab)
Engine.travelTo(Room);
Engine.log('left');
break;
case 39: // Right
case 68:
if(Engine.activeModule == Room && Outside.tab)
Engine.travelTo(Outside);
else if(Engine.activeModule == Outside && Path.tab)
Engine.travelTo(Path);
else if(Engine.activeModule == Path && Ship.tab)
Engine.travelTo(Ship);
Engine.log('right');
break;
}
}
return false;
},
swipeLeft: function(e) {
if(Engine.activeModule.swipeLeft) {
Engine.activeModule.swipeLeft(e);
}
},
swipeRight: function(e) {
if(Engine.activeModule.swipeRight) {
Engine.activeModule.swipeRight(e);
}
},
swipeUp: function(e) {
if(Engine.activeModule.swipeUp) {
Engine.activeModule.swipeUp(e);
}
},
swipeDown: function(e) {
if(Engine.activeModule.swipeDown) {
Engine.activeModule.swipeDown(e);
}
},
disableSelection: function() {
document.onselectstart = eventNullifier; // this is for IE
document.onmousedown = eventNullifier; // this is for the rest
},
enableSelection: function() {
document.onselectstart = eventPassthrough;
document.onmousedown = eventPassthrough;
},
autoSelect: function(selector) {
$(selector).focus().select();
},
handleStateUpdates: function(e){
},
},
switchLanguage: function(dom){
var lang = $(this).val();
if(document.location.href.search(/[\?\&]lang=[a-z]+/) != -1){
@@ -659,7 +681,7 @@
document.location.href = document.location.href + ( (document.location.href.search(/\?/) != -1 )?"&":"?") + "lang="+lang;
}
},
saveLanguage: function(){
var lang = decodeURIComponent((new RegExp('[?|&]lang=' + '([^&;]+?)(&|#|;|$)').exec(location.search)||[,""])[1].replace(/\+/g, '%20'))||null;
if(lang && typeof Storage != 'undefined' && localStorage) {
@@ -667,21 +689,20 @@
}
}
};
function eventNullifier(e) {
return $(e.target).hasClass('menuBtn');
}
function eventPassthrough(e) {
return true;
}
})();
//create jQuery Callbacks() to handle object events
$.Dispatch = function( id ) {
var callbacks,
topic = id && Engine.topics[ id ];
var callbacks, topic = id && Engine.topics[ id ];
if ( !topic ) {
callbacks = jQuery.Callbacks();
topic = {
+58 -59
View File
@@ -109,8 +109,8 @@ var Events = {
Events.createEatMeatButton().appendTo(btns);
if((Path.outfit['medicine'] || 0) != 0) {
Events.createUseMedsButton().appendTo(btns);
}
Events.createUseMedsButton().appendTo(btns);
}
// Set up the enemy attack timer
Events._enemyAttackTimer = setTimeout(Events.enemyAttack, scene.attackDelay * 1000);
@@ -438,8 +438,7 @@ var Events = {
});
}
Events._enemyAttackTimer =
setTimeout(Events.enemyAttack, scene.attackDelay * 1000);
Events._enemyAttackTimer = setTimeout(Events.enemyAttack, scene.attackDelay * 1000);
},
winFight: function() {
@@ -476,8 +475,8 @@ var Events = {
Events.createEatMeatButton(0).appendTo(btns);
if((Path.outfit['medicine'] || 0) != 0) {
Events.createUseMedsButton(0).appendTo(btns);
}
Events.createUseMedsButton(0).appendTo(btns);
}
}
} catch(e) {
// It is possible to die and win if the timing is perfect. Just let it fail.
@@ -728,41 +727,41 @@ var Events = {
}
},
// Makes an event happen!
triggerEvent: function() {
if(Events.activeEvent() == null) {
var possibleEvents = [];
for(var i in Events.EventPool) {
var event = Events.EventPool[i];
if(event.isAvailable()) {
possibleEvents.push(event);
}
}
// Makes an event happen!
triggerEvent: function() {
if(Events.activeEvent() == null) {
var possibleEvents = [];
for(var i in Events.EventPool) {
var event = Events.EventPool[i];
if(event.isAvailable()) {
possibleEvents.push(event);
}
}
if(possibleEvents.length == 0) {
Events.scheduleNextEvent(0.5);
return;
} else {
var r = Math.floor(Math.random()*(possibleEvents.length));
Events.startEvent(possibleEvents[r]);
}
}
Events.scheduleNextEvent();
},
triggerFight: function() {
var possibleFights = [];
for(var i in Events.Encounters) {
var fight = Events.Encounters[i];
if(fight.isAvailable()) {
possibleFights.push(fight);
}
}
var r = Math.floor(Math.random()*(possibleEvents.length));
Events.startEvent(possibleEvents[r]);
}
}
Events.scheduleNextEvent();
},
triggerFight: function() {
var possibleFights = [];
for(var i in Events.Encounters) {
var fight = Events.Encounters[i];
if(fight.isAvailable()) {
possibleFights.push(fight);
}
}
var r = Math.floor(Math.random()*(possibleFights.length));
Events.startEvent(possibleFights[r]);
},
Events.startEvent(possibleFights[r]);
},
activeEvent: function() {
if(Events.eventStack && Events.eventStack.length > 0) {
@@ -774,8 +773,8 @@ var Events = {
eventPanel: function() {
return Events.activeEvent().eventPanel;
},
startEvent: function(event, options) {
startEvent: function(event, options) {
if(event) {
Engine.event('game event', 'event');
Engine.keyLock = true;
@@ -791,30 +790,30 @@ var Events = {
$('div#wrapper').append(Events.eventPanel());
Events.eventPanel().animate({opacity: 1}, Events._PANEL_FADE, 'linear');
}
},
scheduleNextEvent: function(scale) {
var nextEvent = Math.floor(Math.random()*(Events._EVENT_TIME_RANGE[1] - Events._EVENT_TIME_RANGE[0])) + Events._EVENT_TIME_RANGE[0];
if(scale > 0) { nextEvent *= scale; }
Engine.log('next event scheduled in ' + nextEvent + ' minutes');
Events._eventTimeout = setTimeout(Events.triggerEvent, nextEvent * 60 * 1000);
},
endEvent: function() {
Events.eventPanel().animate({opacity:0}, Events._PANEL_FADE, 'linear', function() {
Events.eventPanel().remove();
},
scheduleNextEvent: function(scale) {
var nextEvent = Math.floor(Math.random()*(Events._EVENT_TIME_RANGE[1] - Events._EVENT_TIME_RANGE[0])) + Events._EVENT_TIME_RANGE[0];
if(scale > 0) { nextEvent *= scale; }
Engine.log('next event scheduled in ' + nextEvent + ' minutes');
Events._eventTimeout = setTimeout(Events.triggerEvent, nextEvent * 60 * 1000);
},
endEvent: function() {
Events.eventPanel().animate({opacity:0}, Events._PANEL_FADE, 'linear', function() {
Events.eventPanel().remove();
Events.activeEvent().eventPanel = null;
Events.eventStack.shift();
Engine.log(Events.eventStack.length + ' events remaining');
Engine.keyLock = false;
// Force refocus on the body. I hate you, IE.
$('body').focus();
});
},
handleStateUpdates: function(e){
Engine.log(Events.eventStack.length + ' events remaining');
Engine.keyLock = false;
// Force refocus on the body. I hate you, IE.
$('body').focus();
});
},
handleStateUpdates: function(e){
if(e.category == 'stores' && Events.activeEvent() != null){
Events.updateButtons();
}
}
};
};
+367 -367
View File
@@ -5,396 +5,396 @@ Events.Encounters = [
/* Tier 1 */
{ /* Snarling Beast */
title: _('A Snarling Beast'),
isAvailable: function() {
return World.getDistance() <= 10 && World.getTerrain() == World.TILE.FOREST;
},
scenes: {
'start': {
combat: true,
enemy: 'snarling beast',
enemyName: _('snarling beast'),
deathMessage: _('the snarling beast is dead'),
chara: 'B',
damage: 1,
hit: 0.8,
attackDelay: 1,
health: 5,
loot: {
'fur': {
min: 1,
max: 3,
chance: 1
},
'meat': {
min: 1,
max: 3,
chance: 1
},
'teeth': {
min: 1,
max: 3,
chance: 0.8
}
},
notification: _('a snarling beast leaps out of the underbrush')
}
}
isAvailable: function() {
return World.getDistance() <= 10 && World.getTerrain() == World.TILE.FOREST;
},
scenes: {
'start': {
combat: true,
enemy: 'snarling beast',
enemyName: _('snarling beast'),
deathMessage: _('the snarling beast is dead'),
chara: 'B',
damage: 1,
hit: 0.8,
attackDelay: 1,
health: 5,
loot: {
'fur': {
min: 1,
max: 3,
chance: 1
},
'meat': {
min: 1,
max: 3,
chance: 1
},
'teeth': {
min: 1,
max: 3,
chance: 0.8
}
},
notification: _('a snarling beast leaps out of the underbrush')
}
}
},
{ /* Gaunt Man */
title: _('A Gaunt Man'),
isAvailable: function() {
return World.getDistance() <= 10 && World.getTerrain() == World.TILE.BARRENS;
},
scenes: {
'start': {
combat: true,
enemy: 'gaunt man',
enemyName: _('gaunt man'),
deathMessage: _('the gaunt man is dead'),
chara: 'G',
damage: 2,
hit: 0.8,
attackDelay: 2,
health: 6,
loot: {
'cloth': {
min: 1,
max: 3,
chance: 0.8
},
'teeth': {
min: 1,
max: 2,
chance: 0.8
},
'leather': {
min: 1,
max: 2,
chance: 0.5
}
},
notification: _('a gaunt man approaches, a crazed look in his eye')
}
title: _('A Gaunt Man'),
isAvailable: function() {
return World.getDistance() <= 10 && World.getTerrain() == World.TILE.BARRENS;
},
scenes: {
'start': {
combat: true,
enemy: 'gaunt man',
enemyName: _('gaunt man'),
deathMessage: _('the gaunt man is dead'),
chara: 'G',
damage: 2,
hit: 0.8,
attackDelay: 2,
health: 6,
loot: {
'cloth': {
min: 1,
max: 3,
chance: 0.8
},
'teeth': {
min: 1,
max: 2,
chance: 0.8
},
'leather': {
min: 1,
max: 2,
chance: 0.5
}
},
notification: _('a gaunt man approaches, a crazed look in his eye')
}
}
},
},
{ /* Strange Bird */
title: _('A Strange Bird'),
isAvailable: function() {
return World.getDistance() <= 10 && World.getTerrain() == World.TILE.FIELD;
},
scenes: {
'start': {
combat: true,
enemy: 'strange bird',
enemyName: _('strange bird'),
deathMessage: _('the strange bird is dead'),
chara: 'B',
damage: 3,
hit: 0.8,
attackDelay: 2,
health: 4,
loot: {
'scales': {
min: 1,
max: 3,
chance: 0.8
},
'teeth': {
min: 1,
max: 2,
chance: 0.5
},
'meat': {
min: 1,
max: 3,
chance: 0.8
}
},
notification: _('a strange looking bird speeds across the plains')
}
title: _('A Strange Bird'),
isAvailable: function() {
return World.getDistance() <= 10 && World.getTerrain() == World.TILE.FIELD;
},
scenes: {
'start': {
combat: true,
enemy: 'strange bird',
enemyName: _('strange bird'),
deathMessage: _('the strange bird is dead'),
chara: 'B',
damage: 3,
hit: 0.8,
attackDelay: 2,
health: 4,
loot: {
'scales': {
min: 1,
max: 3,
chance: 0.8
},
'teeth': {
min: 1,
max: 2,
chance: 0.5
},
'meat': {
min: 1,
max: 3,
chance: 0.8
}
},
notification: _('a strange looking bird speeds across the plains')
}
}
},
},
/* Tier 2*/
{ /* Shivering Man */
title: _('A Shivering Man'),
isAvailable: function() {
return World.getDistance() > 10 && World.getDistance() <= 20 && World.getTerrain() == World.TILE.BARRENS;
},
scenes: {
'start': {
combat: true,
enemy: 'shivering man',
enemyName: _('shivering man'),
deathMessage: _('the shivering man is dead'),
chara: 'S',
damage: 5,
hit: 0.5,
attackDelay: 1,
health: 20,
loot: {
'cloth': {
min: 1,
max: 1,
chance: 0.2
},
'teeth': {
min: 1,
max: 2,
chance: 0.8
},
'leather': {
min: 1,
max: 1,
chance: 0.2
},
'medicine': {
min: 1,
max: 3,
chance: 0.7
}
},
notification: _('a shivering man approaches and attacks with surprising strength')
}
title: _('A Shivering Man'),
isAvailable: function() {
return World.getDistance() > 10 && World.getDistance() <= 20 && World.getTerrain() == World.TILE.BARRENS;
},
scenes: {
'start': {
combat: true,
enemy: 'shivering man',
enemyName: _('shivering man'),
deathMessage: _('the shivering man is dead'),
chara: 'S',
damage: 5,
hit: 0.5,
attackDelay: 1,
health: 20,
loot: {
'cloth': {
min: 1,
max: 1,
chance: 0.2
},
'teeth': {
min: 1,
max: 2,
chance: 0.8
},
'leather': {
min: 1,
max: 1,
chance: 0.2
},
'medicine': {
min: 1,
max: 3,
chance: 0.7
}
},
notification: _('a shivering man approaches and attacks with surprising strength')
}
}
},
},
{ /* Man-eater */
title: _('A Man-Eater'),
isAvailable: function() {
return World.getDistance() > 10 && World.getDistance() <= 20 && World.getTerrain() == World.TILE.FOREST;
},
scenes: {
'start': {
combat: true,
enemy: 'man-eater',
enemyName: _('man-eater'),
deathMessage: _('the man-eater is dead'),
chara: 'E',
damage: 3,
hit: 0.8,
attackDelay: 1,
health: 25,
loot: {
'fur': {
min: 5,
max: 10,
chance: 1
},
'meat': {
min: 5,
max: 10,
chance: 1
},
'teeth': {
min: 5,
max: 10,
chance: 0.8
}
},
notification: _('a large creature attacks, claws freshly bloodied')
}
}
isAvailable: function() {
return World.getDistance() > 10 && World.getDistance() <= 20 && World.getTerrain() == World.TILE.FOREST;
},
scenes: {
'start': {
combat: true,
enemy: 'man-eater',
enemyName: _('man-eater'),
deathMessage: _('the man-eater is dead'),
chara: 'E',
damage: 3,
hit: 0.8,
attackDelay: 1,
health: 25,
loot: {
'fur': {
min: 5,
max: 10,
chance: 1
},
'meat': {
min: 5,
max: 10,
chance: 1
},
'teeth': {
min: 5,
max: 10,
chance: 0.8
}
},
notification: _('a large creature attacks, claws freshly bloodied')
}
}
},
{ /* Scavenger */
title: _('A Scavenger'),
isAvailable: function() {
return World.getDistance() > 10 && World.getDistance() <= 20 && World.getTerrain() == World.TILE.BARRENS;
},
scenes: {
'start': {
combat: true,
enemy: 'scavenger',
enemyName: _('scavenger'),
deathMessage: _('the scavenger is dead'),
chara: 'S',
damage: 4,
hit: 0.8,
attackDelay: 2,
health: 30,
loot: {
'cloth': {
min: 5,
max: 10,
chance: 0.8
},
'leather': {
min: 5,
max: 10,
chance: 0.8
},
'iron': {
min: 1,
max: 5,
chance: 0.5
},
'medicine': {
min: 1,
max: 2,
chance: 0.1
}
},
notification: _('a scavenger draws close, hoping for an easy score')
}
title: _('A Scavenger'),
isAvailable: function() {
return World.getDistance() > 10 && World.getDistance() <= 20 && World.getTerrain() == World.TILE.BARRENS;
},
scenes: {
'start': {
combat: true,
enemy: 'scavenger',
enemyName: _('scavenger'),
deathMessage: _('the scavenger is dead'),
chara: 'S',
damage: 4,
hit: 0.8,
attackDelay: 2,
health: 30,
loot: {
'cloth': {
min: 5,
max: 10,
chance: 0.8
},
'leather': {
min: 5,
max: 10,
chance: 0.8
},
'iron': {
min: 1,
max: 5,
chance: 0.5
},
'medicine': {
min: 1,
max: 2,
chance: 0.1
}
},
notification: _('a scavenger draws close, hoping for an easy score')
}
}
},
},
{ /* Huge Lizard */
title: _('A Huge Lizard'),
isAvailable: function() {
return World.getDistance() > 10 && World.getDistance() <= 20 && World.getTerrain() == World.TILE.FIELD;
},
scenes: {
'start': {
combat: true,
enemy: 'lizard',
enemyName: _('lizard'),
deathMessage: _('the lizard is dead'),
chara: 'L',
damage: 5,
hit: 0.8,
attackDelay: 2,
health: 20,
loot: {
'scales': {
min: 5,
max: 10,
chance: 0.8
},
'teeth': {
min: 5,
max: 10,
chance: 0.5
},
'meat': {
min: 5,
max: 10,
chance: 0.8
}
},
notification: _('the grass thrashes wildly as a huge lizard pushes through')
}
title: _('A Huge Lizard'),
isAvailable: function() {
return World.getDistance() > 10 && World.getDistance() <= 20 && World.getTerrain() == World.TILE.FIELD;
},
scenes: {
'start': {
combat: true,
enemy: 'lizard',
enemyName: _('lizard'),
deathMessage: _('the lizard is dead'),
chara: 'L',
damage: 5,
hit: 0.8,
attackDelay: 2,
health: 20,
loot: {
'scales': {
min: 5,
max: 10,
chance: 0.8
},
'teeth': {
min: 5,
max: 10,
chance: 0.5
},
'meat': {
min: 5,
max: 10,
chance: 0.8
}
},
notification: _('the grass thrashes wildly as a huge lizard pushes through')
}
}
},
},
/* Tier 3*/
{ /* Feral Terror */
title: _('A Feral Terror'),
isAvailable: function() {
return World.getDistance() > 20 && World.getTerrain() == World.TILE.FOREST;
},
scenes: {
'start': {
combat: true,
enemy: 'feral terror',
enemyName: _('feral terror'),
deathMessage: _('the feral terror is dead'),
chara: 'F',
damage: 6,
hit: 0.8,
attackDelay: 1,
health: 45,
loot: {
'fur': {
min: 5,
max: 10,
chance: 1
},
'meat': {
min: 5,
max: 10,
chance: 1
},
'teeth': {
min: 5,
max: 10,
chance: 0.8
}
},
notification: _('a beast, wilder than imagining, erupts out of the foliage')
}
}
isAvailable: function() {
return World.getDistance() > 20 && World.getTerrain() == World.TILE.FOREST;
},
scenes: {
'start': {
combat: true,
enemy: 'feral terror',
enemyName: _('feral terror'),
deathMessage: _('the feral terror is dead'),
chara: 'F',
damage: 6,
hit: 0.8,
attackDelay: 1,
health: 45,
loot: {
'fur': {
min: 5,
max: 10,
chance: 1
},
'meat': {
min: 5,
max: 10,
chance: 1
},
'teeth': {
min: 5,
max: 10,
chance: 0.8
}
},
notification: _('a beast, wilder than imagining, erupts out of the foliage')
}
}
},
{ /* Soldier */
title: _('A Soldier'),
isAvailable: function() {
return World.getDistance() > 20 && World.getTerrain() == World.TILE.BARRENS;
},
scenes: {
'start': {
combat: true,
enemy: 'soldier',
enemyName: _('soldier'),
deathMessage: _('the soldier is dead'),
title: _('A Soldier'),
isAvailable: function() {
return World.getDistance() > 20 && World.getTerrain() == World.TILE.BARRENS;
},
scenes: {
'start': {
combat: true,
enemy: 'soldier',
enemyName: _('soldier'),
deathMessage: _('the soldier is dead'),
ranged: true,
chara: 'D',
damage: 8,
hit: 0.8,
attackDelay: 2,
health: 50,
loot: {
'cloth': {
min: 5,
max: 10,
chance: 0.8
},
'bullets': {
min: 1,
max: 5,
chance: 0.5
},
'rifle': {
min: 1,
max: 1,
chance: 0.2
},
'medicine': {
min: 1,
max: 2,
chance: 0.1
}
},
notification: _('a soldier opens fire from across the desert')
}
chara: 'D',
damage: 8,
hit: 0.8,
attackDelay: 2,
health: 50,
loot: {
'cloth': {
min: 5,
max: 10,
chance: 0.8
},
'bullets': {
min: 1,
max: 5,
chance: 0.5
},
'rifle': {
min: 1,
max: 1,
chance: 0.2
},
'medicine': {
min: 1,
max: 2,
chance: 0.1
}
},
notification: _('a soldier opens fire from across the desert')
}
}
},
},
{ /* Sniper */
title: _('A Sniper'),
isAvailable: function() {
return World.getDistance() > 20 && World.getTerrain() == World.TILE.FIELD;
},
scenes: {
'start': {
combat: true,
enemy: 'sniper',
enemyName: _('sniper'),
deathMessage: _('the sniper is dead'),
chara: 'S',
damage: 15,
hit: 0.8,
attackDelay: 4,
health: 30,
title: _('A Sniper'),
isAvailable: function() {
return World.getDistance() > 20 && World.getTerrain() == World.TILE.FIELD;
},
scenes: {
'start': {
combat: true,
enemy: 'sniper',
enemyName: _('sniper'),
deathMessage: _('the sniper is dead'),
chara: 'S',
damage: 15,
hit: 0.8,
attackDelay: 4,
health: 30,
ranged: true,
loot: {
'cloth': {
min: 5,
max: 10,
chance: 0.8
},
'bullets': {
min: 1,
max: 5,
chance: 0.5
},
'rifle': {
min: 1,
max: 1,
chance: 0.2
},
'medicine': {
min: 1,
max: 2,
chance: 0.1
}
},
notification: _('a shot rings out, from somewhere in the long grass')
}
loot: {
'cloth': {
min: 5,
max: 10,
chance: 0.8
},
'bullets': {
min: 1,
max: 5,
chance: 0.5
},
'rifle': {
min: 1,
max: 1,
chance: 0.2
},
'medicine': {
min: 1,
max: 2,
chance: 0.1
}
},
notification: _('a shot rings out, from somewhere in the long grass')
}
}
}
}
];
+24 -24
View File
@@ -28,15 +28,15 @@ Events.Global = [
},
'hang': {
text: [
_('the villagers hang the thief high in front of the store room.'),
_('the point is made. in the next few days, the missing supplies are returned.')
],
onLoad: function() {
$SM.set('game.thieves', 2);
$SM.remove('income.thieves');
$SM.addM('stores', $SM.get('game.stolen'));
},
buttons: {
_('the villagers hang the thief high in front of the store room.'),
_('the point is made. in the next few days, the missing supplies are returned.')
],
onLoad: function() {
$SM.set('game.thieves', 2);
$SM.remove('income.thieves');
$SM.addM('stores', $SM.get('game.stolen'));
},
buttons: {
'leave': {
text: _('leave'),
nextScene: 'end'
@@ -45,21 +45,21 @@ Events.Global = [
},
'spare': {
text: [
_("the man says he's grateful. says he won't come around any more."),
_("shares what he knows about sneaking before he goes.")
],
onLoad: function() {
$SM.set('game.thieves', 2);
$SM.remove('income.thieves');
$SM.addPerk('stealthy');
},
buttons: {
'leave': {
text: _('leave'),
nextScene: 'end'
}
}
_("the man says he's grateful. says he won't come around any more."),
_("shares what he knows about sneaking before he goes.")
],
onLoad: function() {
$SM.set('game.thieves', 2);
$SM.remove('income.thieves');
$SM.addPerk('stealthy');
},
buttons: {
'leave': {
text: _('leave'),
nextScene: 'end'
}
}
}
}
}
];
];
+149 -153
View File
@@ -2,8 +2,8 @@
* Events that can occur when the Outside module is active
**/
Events.Outside = [
{ /* Ruined traps */
title: _('A Ruined Trap'),
{ /* Ruined traps */
title: _('A Ruined Trap'),
isAvailable: function() {
return Engine.activeModule == Outside && $SM.get('game.buildings["trap"]', true) > 0;
},
@@ -45,9 +45,9 @@ Events.Outside = [
},
'catch': {
text: [
_('not far from the village lies a large beast, its fur matted with blood.'),
_('it puts up little resistance before the knife.')
],
_('not far from the village lies a large beast, its fur matted with blood.'),
_('it puts up little resistance before the knife.')
],
reward: {
fur: 100,
meat: 100,
@@ -61,147 +61,144 @@ Events.Outside = [
}
}
}
},
{ /* Sickness */
title: _('Sickness'),
isAvailable: function() {
return Engine.activeModule == Outside &&
$SM.get('game.population', true) > 10 &&
$SM.get('game.population', true) < 50 &&
$SM.get('stores.medicine', true) > 0;
},
scenes: {
'start': {
text: [
_('a sickness is spreading through the village.'),
_('medicine is needed immediately.')
],
buttons: {
'heal': {
text: _('1 medicine'),
cost: { 'medicine' : 1 },
nextScene: {1: 'healed'}
},
'ignore': {
text: _('ignore it'),
nextScene: {1: 'death'}
}
}
},
'healed': {
text: [
_('the sickness is cured in time.')
],
buttons: {
'end': {
text: _('go home'),
nextScene: 'end'
}
}
},
'death': {
text: [
_('the sickness spreads through the village.'),
_('the days are spent with burials.'),
_('the nights are rent with screams.')
],
onLoad: function() {
var numKilled = Math.floor(Math.random() * 20) + 1;
Outside.killVillagers(numKilled);
},
buttons: {
'end': {
text: _('go home'),
nextScene: 'end'
}
}
}
}
},
{ /* Plague */
title: _('Plague'),
isAvailable: function() {
return Engine.activeModule == Outside && $SM.get('game.population', true) > 50 && $SM.get('stores.medicine', true) > 0;
},
scenes: {
'start': {
text: [
_('a terrible plague is fast spreading through the village.'),
_('medicine is needed immediately.')
],
buttons: {
'heal': {
text: _('5 medicine'),
cost: { 'medicine' : 5 },
nextScene: {1: 'healed'}
},
'ignore': {
text: _('do nothing'),
nextScene: {1: 'death'}
}
}
},
'healed': {
text: [
_('the plague is kept from spreading.'),
_('only a few die.'),
_('the rest bury them.')
],
onLoad: function() {
var numKilled = Math.floor(Math.random() * 5) + 2;
Outside.killVillagers(numKilled);
},
buttons: {
'end': {
text: _('go home'),
nextScene: 'end'
}
}
},
'death': {
text: [
_('the plague rips through the village.'),
_('the nights are rent with screams.'),
_('the only hope is a quick death.')
],
onLoad: function() {
var numKilled = Math.floor(Math.random() * 80) + 10;
Outside.killVillagers(numKilled);
},
buttons: {
'end': {
text: _('go home'),
nextScene: 'end'
}
}
}
}
},
{ /* Beast attack */
title: _('A Beast Attack'),
},
{ /* Sickness */
title: _('Sickness'),
isAvailable: function() {
return Engine.activeModule == Outside && $SM.get('game.population', true) > 10 && $SM.get('game.population', true) < 50 && $SM.get('stores.medicine', true) > 0;
},
scenes: {
'start': {
text: [
_('a sickness is spreading through the village.'),
_('medicine is needed immediately.')
],
buttons: {
'heal': {
text: _('1 medicine'),
cost: { 'medicine' : 1 },
nextScene: {1: 'healed'}
},
'ignore': {
text: _('ignore it'),
nextScene: {1: 'death'}
}
}
},
'healed': {
text: [
_('the sickness is cured in time.')
],
buttons: {
'end': {
text: _('go home'),
nextScene: 'end'
}
}
},
'death': {
text: [
_('the sickness spreads through the village.'),
_('the days are spent with burials.'),
_('the nights are rent with screams.')
],
onLoad: function() {
var numKilled = Math.floor(Math.random() * 20) + 1;
Outside.killVillagers(numKilled);
},
buttons: {
'end': {
text: _('go home'),
nextScene: 'end'
}
}
}
}
},
{ /* Plague */
title: _('Plague'),
isAvailable: function() {
return Engine.activeModule == Outside && $SM.get('game.population', true) > 50 && $SM.get('stores.medicine', true) > 0;
},
scenes: {
'start': {
text: [
_('a terrible plague is fast spreading through the village.'),
_('medicine is needed immediately.')
],
buttons: {
'heal': {
text: _('5 medicine'),
cost: { 'medicine' : 5 },
nextScene: {1: 'healed'}
},
'ignore': {
text: _('do nothing'),
nextScene: {1: 'death'}
}
}
},
'healed': {
text: [
_('the plague is kept from spreading.'),
_('only a few die.'),
_('the rest bury them.')
],
onLoad: function() {
var numKilled = Math.floor(Math.random() * 5) + 2;
Outside.killVillagers(numKilled);
},
buttons: {
'end': {
text: _('go home'),
nextScene: 'end'
}
}
},
'death': {
text: [
_('the plague rips through the village.'),
_('the nights are rent with screams.'),
_('the only hope is a quick death.')
],
onLoad: function() {
var numKilled = Math.floor(Math.random() * 80) + 10;
Outside.killVillagers(numKilled);
},
buttons: {
'end': {
text: _('go home'),
nextScene: 'end'
}
}
}
}
},
{ /* Beast attack */
title: _('A Beast Attack'),
isAvailable: function() {
return Engine.activeModule == Outside && $SM.get('game.population', true) > 0;
},
scenes: {
'start': {
text: [
_('a pack of snarling beasts pours out of the trees.'),
_('the fight is short and bloody, but the beasts are repelled.'),
_('the villagers retreat to mourn the dead.')
],
onLoad: function() {
_('a pack of snarling beasts pours out of the trees.'),
_('the fight is short and bloody, but the beasts are repelled.'),
_('the villagers retreat to mourn the dead.')
],
onLoad: function() {
var numKilled = Math.floor(Math.random() * 10) + 1;
Outside.killVillagers(numKilled);
},
reward: {
fur: 100,
meat: 100,
teeth: 10
},
buttons: {
reward: {
fur: 100,
meat: 100,
teeth: 10
},
buttons: {
'end': {
text: _('go home'),
nextScene: 'end'
@@ -209,29 +206,29 @@ Events.Outside = [
}
}
}
},
{ /* Soldier attack */
title: _('A Military Raid'),
},
{ /* Soldier attack */
title: _('A Military Raid'),
isAvailable: function() {
return Engine.activeModule == Outside && $SM.get('game.population', true) > 0 && $SM.get('game.cityCleared');;
},
scenes: {
'start': {
text: [
_('a gunshot rings through the trees.'),
_('well armed men charge out of the forest, firing into the crowd.'),
_('after a skirmish they are driven away, but not without losses.')
],
onLoad: function() {
_('a gunshot rings through the trees.'),
_('well armed men charge out of the forest, firing into the crowd.'),
_('after a skirmish they are driven away, but not without losses.')
],
onLoad: function() {
var numKilled = Math.floor(Math.random() * 40) + 1;
Outside.killVillagers(numKilled);
},
reward: {
bullets: 10,
'cured meat': 50
},
buttons: {
reward: {
bullets: 10,
'cured meat': 50
},
buttons: {
'end': {
text: _('go home'),
nextScene: 'end'
@@ -239,6 +236,5 @@ Events.Outside = [
}
}
}
}
}
];
+275 -275
View File
@@ -106,8 +106,8 @@ Events.Room = [
scenes: {
start: {
text: [
_('scratching noises can be heard from the store room.'),
_('something\'s in there.')
_('scratching noises can be heard from the store room.'),
_('something\'s in there.')
],
notification: _('something\'s in the store room'),
buttons: {
@@ -123,63 +123,63 @@ Events.Room = [
},
scales: {
text: [
_('some wood is missing.'),
_('the ground is littered with small scales')
],
onLoad: function() {
var numWood = $SM.get('stores.wood', true);
numWood = Math.floor(numWood * 0.1);
if(numWood == 0) numWood = 1;
var numScales = Math.floor(numWood / 5);
if(numScales == 0) numScales = 1;
$SM.addM('stores', {'wood': -numWood, 'scales': numScales});
},
buttons: {
'leave': {
text: _('leave'),
nextScene: 'end'
}
}
_('some wood is missing.'),
_('the ground is littered with small scales')
],
onLoad: function() {
var numWood = $SM.get('stores.wood', true);
numWood = Math.floor(numWood * 0.1);
if(numWood == 0) numWood = 1;
var numScales = Math.floor(numWood / 5);
if(numScales == 0) numScales = 1;
$SM.addM('stores', {'wood': -numWood, 'scales': numScales});
},
buttons: {
'leave': {
text: _('leave'),
nextScene: 'end'
}
}
},
teeth: {
text: [
_('some wood is missing.'),
_('the ground is littered with small teeth')
],
onLoad: function() {
var numWood = $SM.get('stores.wood', true);
numWood = Math.floor(numWood * 0.1);
if(numWood == 0) numWood = 1;
var numTeeth = Math.floor(numWood / 5);
if(numTeeth == 0) numTeeth = 1;
$SM.addM('stores', {'wood': -numWood, 'teeth': numTeeth});
},
buttons: {
'leave': {
text: _('leave'),
nextScene: 'end'
}
}
_('some wood is missing.'),
_('the ground is littered with small teeth')
],
onLoad: function() {
var numWood = $SM.get('stores.wood', true);
numWood = Math.floor(numWood * 0.1);
if(numWood == 0) numWood = 1;
var numTeeth = Math.floor(numWood / 5);
if(numTeeth == 0) numTeeth = 1;
$SM.addM('stores', {'wood': -numWood, 'teeth': numTeeth});
},
buttons: {
'leave': {
text: _('leave'),
nextScene: 'end'
}
}
},
cloth: {
text: [
_('some wood is missing.'),
_('the ground is littered with scraps of cloth')
],
onLoad: function() {
var numWood = $SM.get('stores.wood', true);
numWood = Math.floor(numWood * 0.1);
if(numWood == 0) numWood = 1;
var numCloth = Math.floor(numWood / 5);
if(numCloth == 0) numCloth = 1;
$SM.addM('stores', {'wood': -numWood, 'cloth': numCloth});
},
buttons: {
'leave': {
text: _('leave'),
nextScene: 'end'
}
}
_('some wood is missing.'),
_('the ground is littered with scraps of cloth')
],
onLoad: function() {
var numWood = $SM.get('stores.wood', true);
numWood = Math.floor(numWood * 0.1);
if(numWood == 0) numWood = 1;
var numCloth = Math.floor(numWood / 5);
if(numCloth == 0) numCloth = 1;
$SM.addM('stores', {'wood': -numWood, 'cloth': numCloth});
},
buttons: {
'leave': {
text: _('leave'),
nextScene: 'end'
}
}
}
}
},
@@ -191,8 +191,8 @@ Events.Room = [
scenes: {
start: {
text: [
_('a beggar arrives.'),
_('asks for any spare furs to keep him warm at night.')
_('a beggar arrives.'),
_('asks for any spare furs to keep him warm at night.')
],
notification: _('a beggar arrives'),
buttons: {
@@ -215,41 +215,41 @@ Events.Room = [
scales: {
reward: { scales: 20 },
text: [
_('the beggar expresses his thanks.'),
_('leaves a pile of small scales behind.')
],
buttons: {
'leave': {
text: _('say goodbye'),
nextScene: 'end'
}
}
_('the beggar expresses his thanks.'),
_('leaves a pile of small scales behind.')
],
buttons: {
'leave': {
text: _('say goodbye'),
nextScene: 'end'
}
}
},
teeth: {
reward: { teeth: 20 },
text: [
_('the beggar expresses his thanks.'),
_('leaves a pile of small teeth behind.')
],
buttons: {
'leave': {
text: _('say goodbye'),
nextScene: 'end'
}
}
_('the beggar expresses his thanks.'),
_('leaves a pile of small teeth behind.')
],
buttons: {
'leave': {
text: _('say goodbye'),
nextScene: 'end'
}
}
},
cloth: {
reward: { cloth: 20 },
text: [
_('the beggar expresses his thanks.'),
_('leaves some scraps of cloth behind.')
],
buttons: {
'leave': {
text: _('say goodbye'),
nextScene: 'end'
}
}
_('the beggar expresses his thanks.'),
_('leaves some scraps of cloth behind.')
],
buttons: {
'leave': {
text: _('say goodbye'),
nextScene: 'end'
}
}
}
}
},
@@ -262,8 +262,8 @@ Events.Room = [
scenes: {
start: {
text: [
_('a wanderer arrives with an empty cart. says if he leaves with wood, he\'ll be back with more.'),
_("builder's not sure he's to be trusted.")
_('a wanderer arrives with an empty cart. says if he leaves with wood, he\'ll be back with more.'),
_("builder's not sure he's to be trusted.")
],
notification: _('a mysterious wanderer arrives'),
buttons: {
@@ -285,41 +285,41 @@ Events.Room = [
},
'100wood': {
text: [
_('the wanderer leaves, cart loaded with wood')
],
onLoad: function() {
if(Math.random() < 0.5) {
setTimeout(function() {
$SM.add('stores.wood', 300);
Notifications.notify(Room, _('the mysterious wanderer returns, cart piled high with wood.'));
}, 60 * 1000);
}
},
buttons: {
'leave': {
text: _('say goodbye'),
nextScene: 'end'
}
}
_('the wanderer leaves, cart loaded with wood')
],
onLoad: function() {
if(Math.random() < 0.5) {
setTimeout(function() {
$SM.add('stores.wood', 300);
Notifications.notify(Room, _('the mysterious wanderer returns, cart piled high with wood.'));
}, 60 * 1000);
}
},
buttons: {
'leave': {
text: _('say goodbye'),
nextScene: 'end'
}
}
},
'500wood': {
text: [
_('the wanderer leaves, cart loaded with wood')
],
onLoad: function() {
if(Math.random() < 0.3) {
setTimeout(function() {
$SM.add('stores.wood', 1500);
Notifications.notify(Room, _('the mysterious wanderer returns, cart piled high with wood.'));
}, 60 * 1000);
}
},
buttons: {
'leave': {
text: _('say goodbye'),
nextScene: 'end'
}
}
_('the wanderer leaves, cart loaded with wood')
],
onLoad: function() {
if(Math.random() < 0.3) {
setTimeout(function() {
$SM.add('stores.wood', 1500);
Notifications.notify(Room, _('the mysterious wanderer returns, cart piled high with wood.'));
}, 60 * 1000);
}
},
buttons: {
'leave': {
text: _('say goodbye'),
nextScene: 'end'
}
}
}
}
},
@@ -332,8 +332,8 @@ Events.Room = [
scenes: {
start: {
text: [
_('a wanderer arrives with an empty cart. says if she leaves with furs, she\'ll be back with more.'),
_("builder's not sure she's to be trusted.")
_('a wanderer arrives with an empty cart. says if she leaves with furs, she\'ll be back with more.'),
_("builder's not sure she's to be trusted.")
],
notification: _('a mysterious wanderer arrives'),
buttons: {
@@ -355,41 +355,41 @@ Events.Room = [
},
'100fur': {
text: [
_('the wanderer leaves, cart loaded with furs')
],
onLoad: function() {
if(Math.random() < 0.5) {
setTimeout(function() {
$SM.add('stores.fur', 300);
Notifications.notify(Room, _('the mysterious wanderer returns, cart piled high with furs.'));
}, 60 * 1000);
}
},
buttons: {
'leave': {
text: _('say goodbye'),
nextScene: 'end'
}
}
_('the wanderer leaves, cart loaded with furs')
],
onLoad: function() {
if(Math.random() < 0.5) {
setTimeout(function() {
$SM.add('stores.fur', 300);
Notifications.notify(Room, _('the mysterious wanderer returns, cart piled high with furs.'));
}, 60 * 1000);
}
},
buttons: {
'leave': {
text: _('say goodbye'),
nextScene: 'end'
}
}
},
'500fur': {
text: [
_('the wanderer leaves, cart loaded with furs')
],
onLoad: function() {
if(Math.random() < 0.3) {
setTimeout(function() {
$SM.add('stores.fur', 1500);
Notifications.notify(Room, _('the mysterious wanderer returns, cart piled high with furs.'));
}, 60 * 1000);
}
},
buttons: {
'leave': {
text: _('say goodbye'),
nextScene: 'end'
}
}
_('the wanderer leaves, cart loaded with furs')
],
onLoad: function() {
if(Math.random() < 0.3) {
setTimeout(function() {
$SM.add('stores.fur', 1500);
Notifications.notify(Room, _('the mysterious wanderer returns, cart piled high with furs.'));
}, 60 * 1000);
}
},
buttons: {
'leave': {
text: _('say goodbye'),
nextScene: 'end'
}
}
}
}
},
@@ -424,9 +424,9 @@ Events.Room = [
}
},
'leave': {
text: _('say goodbye'),
nextScene: 'end'
}
text: _('say goodbye'),
nextScene: 'end'
}
}
}
}
@@ -462,132 +462,132 @@ Events.Room = [
},
'agree': {
text: [
_('in exchange, the wanderer offers his wisdom.')
],
buttons: {
'evasion': {
text: _('evasion'),
available: function() {
return !$SM.hasPerk('evasive');
},
onChoose: function() {
$SM.addPerk('evasive');
},
nextScene: 'end'
},
'precision': {
text: _('precision'),
available: function() {
return !$SM.hasPerk('precise');
},
onChoose: function() {
$SM.addPerk('precise');
},
nextScene: 'end'
},
'force': {
text: _('force'),
available: function() {
return !$SM.hasPerk('barbarian');
},
onChoose: function() {
$SM.addPerk('barbarian');
},
nextScene: 'end'
},
'nothing': {
text: _('nothing'),
nextScene: 'end'
}
}
_('in exchange, the wanderer offers his wisdom.')
],
buttons: {
'evasion': {
text: _('evasion'),
available: function() {
return !$SM.hasPerk('evasive');
},
onChoose: function() {
$SM.addPerk('evasive');
},
nextScene: 'end'
},
'precision': {
text: _('precision'),
available: function() {
return !$SM.hasPerk('precise');
},
onChoose: function() {
$SM.addPerk('precise');
},
nextScene: 'end'
},
'force': {
text: _('force'),
available: function() {
return !$SM.hasPerk('barbarian');
},
onChoose: function() {
$SM.addPerk('barbarian');
},
nextScene: 'end'
},
'nothing': {
text: _('nothing'),
nextScene: 'end'
}
}
}
}
},
{ /* The Sick Man */
title: _('The Sick Man'),
isAvailable: function() {
return Engine.activeModule == Room && $SM.get('stores.medicine', true) > 0;
},
scenes: {
'start': {
text: [
_("a man hobbles up, coughing."),
_("he begs for medicine.")
],
notification: _('a sick man hobbles up'),
buttons: {
'help': {
text: _('give 1 medicine'),
cost: { 'medicine': 1 },
notification: _('the man swallows the medicine eagerly'),
nextScene: { 0.1: 'alloy', 0.3: 'cells', 0.5: 'scales', 1.0: 'nothing' }
},
'ignore': {
text: _('tell him to leave'),
nextScene: 'end'
}
}
},
'alloy': {
text: [
_("the man is thankful."),
_('he leaves a reward.'),
_('some weird metal he picked up on his travels.')
],
onLoad: function() {
$SM.add('stores["alien alloy"]', 1);
},
buttons: {
'bye': {
text: _('say goodbye'),
nextScene: 'end'
}
}
},
'cells': {
text: [
_("the man is thankful."),
_('he leaves a reward.'),
_('some weird glowing boxes he picked up on his travels.')
],
onLoad: function() {
$SM.add('stores["energy cell"]', 3);
},
buttons: {
'bye': {
text: _('say goodbye'),
nextScene: 'end'
}
}
},
'scales': {
text: [
_("the man is thankful."),
_('he leaves a reward.'),
_('all he has are some scales.')
],
onLoad: function() {
$SM.add('stores.scales', 5);
},
buttons: {
'bye': {
text: _('say goodbye'),
nextScene: 'end'
}
}
},
'nothing': {
text: [
_("the man expresses his thanks and hobbles off.")
],
buttons: {
'bye': {
text: _('say goodbye'),
nextScene: 'end'
}
}
}
}
title: _('The Sick Man'),
isAvailable: function() {
return Engine.activeModule == Room && $SM.get('stores.medicine', true) > 0;
},
scenes: {
'start': {
text: [
_("a man hobbles up, coughing."),
_("he begs for medicine.")
],
notification: _('a sick man hobbles up'),
buttons: {
'help': {
text: _('give 1 medicine'),
cost: { 'medicine': 1 },
notification: _('the man swallows the medicine eagerly'),
nextScene: { 0.1: 'alloy', 0.3: 'cells', 0.5: 'scales', 1.0: 'nothing' }
},
'ignore': {
text: _('tell him to leave'),
nextScene: 'end'
}
}
},
'alloy': {
text: [
_("the man is thankful."),
_('he leaves a reward.'),
_('some weird metal he picked up on his travels.')
],
onLoad: function() {
$SM.add('stores["alien alloy"]', 1);
},
buttons: {
'bye': {
text: _('say goodbye'),
nextScene: 'end'
}
}
},
'cells': {
text: [
_("the man is thankful."),
_('he leaves a reward.'),
_('some weird glowing boxes he picked up on his travels.')
],
onLoad: function() {
$SM.add('stores["energy cell"]', 3);
},
buttons: {
'bye': {
text: _('say goodbye'),
nextScene: 'end'
}
}
},
'scales': {
text: [
_("the man is thankful."),
_('he leaves a reward.'),
_('all he has are some scales.')
],
onLoad: function() {
$SM.add('stores.scales', 5);
},
buttons: {
'bye': {
text: _('say goodbye'),
nextScene: 'end'
}
}
},
'nothing': {
text: [
_("the man expresses his thanks and hobbles off.")
],
buttons: {
'bye': {
text: _('say goodbye'),
nextScene: 'end'
}
}
}
}
}
];
+914 -916
View File
File diff suppressed because it is too large Load Diff
+67 -21
View File
@@ -1,29 +1,75 @@
(function(){
//only used for poedit to find translatable strings
var keywords = [ _('saved.'), _('wood'),_('builder'),_('teeth'),_('meat'),_('fur'), _('alien alloy'), _('bullets'),
_('charm'),_('leather'),_('iron'), _('steel'), _('coal'), _('enegy cell'),
_('torch'),_('medicine'),_('hunter'),_('trapper'),_('tanner'), _('grenade'), _('bolas'),
_("charcutier"),_('iron miner'),_('coal miner'), _('sulphur miner'), _('armourer'),
_('steelworker'),_('bait'),_('cured meat'), _('scales'), _('compass'), _('laser rifle'),
_('gatherer'),_('cloth'), _('scales'), _('cured meat'), _('thieves'),
_('not enough fur'), _('not enough wood'), _('not enough coal'), _('not enough iron'), _('not enough steel'), _('baited trap'),
_('not enough scales'),_('not enough cloth'), _('not enough teeth'), _('not enough leather'),
_('the compass points east.'), _('the compass points west.'), _('the compass points north.'), _('the compass points south.'),
_('the compass points northeast.'), _('the compass points northwest.'), _('the compass points southeast.'), _('the compass points southwest.')];
var keywords = [
_('saved.'),
_('wood'),
_('builder'),
_('teeth'),
_('meat'),
_('fur'),
_('alien alloy'),
_('bullets'),
_('charm'),
_('leather'),
_('iron'),
_('steel'),
_('coal'),
_('enegy cell'),
_('torch'),
_('medicine'),
_('hunter'),
_('trapper'),
_('tanner'),
_('grenade'),
_('bolas'),
_("charcutier"),
_('iron miner'),
_('coal miner'),
_('sulphur miner'), _('armourer'),
_('steelworker'),
_('bait'),
_('cured meat'),
_('scales'),
_('compass'),
_('laser rifle'),
_('gatherer'),
_('cloth'),
_('scales'),
_('cured meat'),
_('thieves'),
_('not enough fur'),
_('not enough wood'),
_('not enough coal'),
_('not enough iron'),
_('not enough steel'),
_('baited trap'),
_('not enough scales'),
_('not enough cloth'), _('not enough teeth'),
_('not enough leather'),
_('the compass points east.'),
_('the compass points west.'),
_('the compass points north.'),
_('the compass points south.'),
_('the compass points northeast.'),
_('the compass points northwest.'),
_('the compass points southeast.'),
_('the compass points southwest.')
];
delete keywords;
//translate text in css by overriding attributes
$("<style>").text('\
div#stores:before{ content: \''+ _("stores") + '\'}\
div#weapons:before{ content: \''+ _("weapons") + '\'}\
div#buildBtns:before{ content: \''+ _("build:") + '\'}\
div#craftBtns:before{ content: \''+ _("craft:") + '\'}\
div#buyBtns:before{ content: \''+ _("buy:") + '\'}\
div#outfitting:before{ content: \''+ _("supplies:") + '\'}\
div#perks:before{ content: \''+ _("perks:") + '\'}\
div#lootButtons:before { content: \''+ _("take:") + '\'}\
div#dropMenu:before { content: \''+ _("drop:") + '\'}\
div#village.noHuts:before { content: \'' + _("forest") + '\'}\
div#village:before { content: \'' + _("village") + '\'}\
div#stores:before{ content: \''+ _("stores") + '\'}\
div#weapons:before{ content: \''+ _("weapons") + '\'}\
div#buildBtns:before{ content: \''+ _("build:") + '\'}\
div#craftBtns:before{ content: \''+ _("craft:") + '\'}\
div#buyBtns:before{ content: \''+ _("buy:") + '\'}\
div#outfitting:before{ content: \''+ _("supplies:") + '\'}\
div#perks:before{ content: \''+ _("perks:") + '\'}\
div#lootButtons:before { content: \''+ _("take:") + '\'}\
div#dropMenu:before { content: \''+ _("drop:") + '\'}\
div#village.noHuts:before { content: \'' + _("forest") + '\'}\
div#village:before { content: \'' + _("village") + '\'}\
').appendTo($('head'));
})();
+7 -8
View File
@@ -219,8 +219,8 @@ var Outside = {
schedulePopIncrease: function() {
var nextIncrease = Math.floor(Math.random()*(Outside._POP_DELAY[1] - Outside._POP_DELAY[0])) + Outside._POP_DELAY[0];
Engine.log('next population increase scheduled in ' + nextIncrease + ' minutes');
Outside._popTimeout = setTimeout(Outside.increasePopulation, nextIncrease * 60 * 1000);
Engine.log('next population increase scheduled in ' + nextIncrease + ' minutes');
Outside._popTimeout = setTimeout(Outside.increasePopulation, nextIncrease * 60 * 1000);
},
updateWorkersView: function() {
@@ -322,7 +322,7 @@ var Outside = {
$('<span>').text(num).appendTo(val);
if(key != 'gatherer') {
$('<div>').addClass('upManyBtn').appendTo(val).click([10], Outside.increaseWorker);
$('<div>').addClass('upManyBtn').appendTo(val).click([10], Outside.increaseWorker);
$('<div>').addClass('upBtn').appendTo(val).click([1], Outside.increaseWorker);
$('<div>').addClass('dnBtn').appendTo(val).click([1], Outside.decreaseWorker);
$('<div>').addClass('dnManyBtn').appendTo(val).click([10], Outside.decreaseWorker);
@@ -345,7 +345,7 @@ var Outside = {
increaseWorker: function(btn) {
var worker = $(this).closest('.workerRow').attr('key');
if(Outside.getNumGatherers() > 0) {
var increaseAmt = Math.min(Outside.getNumGatherers(), btn.data);
var increaseAmt = Math.min(Outside.getNumGatherers(), btn.data);
Engine.log('increasing ' + worker + ' by ' + increaseAmt);
$SM.add('game.workers["'+worker+'"]', increaseAmt);
}
@@ -354,7 +354,7 @@ var Outside = {
decreaseWorker: function(btn) {
var worker = $(this).closest('.workerRow').attr('key');
if($SM.get('game.workers["'+worker+'"]') > 0) {
var decreaseAmt = Math.min($SM.get('game.workers["'+worker+'"]') || 0, btn.data);
var decreaseAmt = Math.min($SM.get('game.workers["'+worker+'"]') || 0, btn.data);
Engine.log('decreasing ' + worker + ' by ' + decreaseAmt);
$SM.add('game.workers["'+worker+'"]', decreaseAmt * -1);
}
@@ -604,11 +604,10 @@ var Outside = {
handleStateUpdates: function(e){
if(e.category == 'stores'){
Outside.updateVillage();
} else if(e.stateName.indexOf('game.workers') == 0
|| e.stateName.indexOf('game.population') == 0){
} else if(e.stateName.indexOf('game.workers') == 0 || e.stateName.indexOf('game.population') == 0){
Outside.updateVillage();
Outside.updateWorkersView();
Outside.updateVillageIncome();
};
}
};
};
+4 -4
View File
@@ -258,15 +258,15 @@ var Path = {
return row;
},
increaseSupply: function(btn) {
increaseSupply: function(btn) {
var supply = $(this).closest('.outfitRow').attr('key');
Engine.log('increasing ' + supply + ' by up to ' + btn.data);
var cur = Path.outfit[supply];
cur = typeof cur == 'number' ? cur : 0;
if(Path.getFreeSpace() >= Path.getWeight(supply) && cur < $SM.get('stores["'+supply+'"]', true)) {
var maxExtraByWeight = Math.floor(Path.getFreeSpace() / Path.getWeight(supply));
var maxExtraByStore = $SM.get('stores["'+supply+'"]', true) - cur;
var maxExtraByBtn = btn.data;
var maxExtraByWeight = Math.floor(Path.getFreeSpace() / Path.getWeight(supply));
var maxExtraByStore = $SM.get('stores["'+supply+'"]', true) - cur;
var maxExtraByBtn = btn.data;
Path.outfit[supply] = cur + Math.min(maxExtraByBtn, Math.min(maxExtraByWeight, maxExtraByStore));
Path.updateOutfitting();
}
+4 -4
View File
@@ -450,9 +450,9 @@ var Room = {
},
MiscItems: {
'laser rifle': {
type: 'weapon'
}
'laser rifle': {
type: 'weapon'
}
},
name: _("Room"),
@@ -770,7 +770,7 @@ var Room = {
} else if(Room.TradeGoods[k]) {
type = Room.TradeGoods[k].type;
} else if (Room.MiscItems[k]) {
type = Room.MiscItems[k].type;
type = Room.MiscItems[k].type;
}
var location;
+32 -33
View File
@@ -409,39 +409,38 @@ var Space = {
},
complete: function() {
Engine.GAME_OVER = true;
Score.save();
Prestige.save();
$('<center>')
.addClass('centerCont')
.appendTo('body');
$('<span>')
.addClass('endGame')
.text(_('score for this game: {0}', Score.calculateScore()))
.appendTo('.centerCont')
.animate({opacity:1},1500);
$('<br />')
.appendTo('.centerCont');
$('<span>')
.addClass('endGame')
.text(_('total score: {0}', Prestige.get().score))
.appendTo('.centerCont')
.animate({opacity:1},1500);
$('<br />')
.appendTo('.centerCont');
$('<br />')
.appendTo('.centerCont');
$('#starsContainer').remove();
$('#content, #notifications').remove();
$('<span>')
.addClass('endGame endGameRestart')
.text(_('restart.'))
.click(Engine.confirmDelete)
.appendTo('.centerCont')
.animate({opacity:1},1500);
Engine.options = {};
Engine.deleteSave(true);
Score.save();
Prestige.save();
$('<center>')
.addClass('centerCont')
.appendTo('body');
$('<span>')
.addClass('endGame')
.text(_('score for this game: {0}', Score.calculateScore()))
.appendTo('.centerCont')
.animate({opacity:1},1500);
$('<br />')
.appendTo('.centerCont');
$('<span>')
.addClass('endGame')
.text(_('total score: {0}', Prestige.get().score))
.appendTo('.centerCont')
.animate({opacity:1},1500);
$('<br />')
.appendTo('.centerCont');
$('<br />')
.appendTo('.centerCont');
$('#starsContainer').remove();
$('#content, #notifications').remove();
$('<span>')
.addClass('endGame endGameRestart')
.text(_('restart.'))
.click(Engine.confirmDelete)
.appendTo('.centerCont')
.animate({opacity:1},1500);
Engine.options = {};
Engine.deleteSave(true);
}
});
}, 2000);
+2 -2
View File
@@ -51,7 +51,7 @@ var StateManager = {
var words = stateName.split(/[.\[\]'"]+/);
//for some reason there are sometimes empty strings
for (var i = 0; i < words.length; i++) {
if (words[i] == '') {
if (words[i] == '') {
words.splice(i, 1);
i--;
}
@@ -402,4 +402,4 @@ var StateManager = {
};
//alias
var $SM = StateManager;
var $SM = StateManager;
+2 -2
View File
@@ -20,7 +20,7 @@ var World = {
BOREHOLE: 'B',
BATTLEFIELD: 'F',
SWAMP: 'M',
CACHE: 'U'
CACHE: 'U'
},
TILE_PROBS: {},
LANDMARKS: {},
@@ -131,7 +131,7 @@ var World = {
// Only add the cache if there is prestige data
if($SM.get('previous.stores')) {
World.LANDMARKS[World.TILE.CACHE] = { num: 1, minRadius: 10, maxRadius: World.RADIUS * 1.5, scene: 'cache', label: _('A&nbsp;Destroyed&nbsp;Village')};
World.LANDMARKS[World.TILE.CACHE] = { num: 1, minRadius: 10, maxRadius: World.RADIUS * 1.5, scene: 'cache', label: _('A&nbsp;Destroyed&nbsp;Village')};
}
if(typeof $SM.get('features.location.world') == 'undefined') {