').appendTo(btns).attr('id','healButtons');
+ Events.createEatMeatButton().appendTo(healBtns);
if((Path.outfit['medicine'] || 0) !== 0) {
- Events.createUseMedsButton().appendTo(btns);
+ Events.createUseMedsButton().appendTo(healBtns);
}
+ $('
').addClass('clear').appendTo(healBtns);
+ Events.setHeal(healBtns);
// Set up the enemy attack timer
- Events._enemyAttackTimer = Engine.setTimeout(Events.enemyAttack, scene.attackDelay * 1000);
+ Events._enemyAttackTimer = Engine.setInterval(Events.enemyAttack, scene.attackDelay * 1000);
+ },
+
+ setPause: function(btn, state){
+ if(!btn) {
+ btn = $('#pause');
+ }
+ var event = btn.closest('#event');
+ var string, log;
+ if(state == 'set') {
+ string = 'start.';
+ log = 'loaded';
+ } else {
+ string = 'resume.';
+ log = 'paused';
+ }
+ btn.children('.text').first().text( _(string) )
+ Events.paused = (state == 'auto') ? 'auto' : true;
+ event.addClass('paused');
+ Button.clearCooldown(btn);
+ $('#buttons').find('.button').each(function(i){
+ if($(this).data('onCooldown')){
+ $(this).children('.cooldown').stop(true,false);
+ }
+ });
+ Engine.log('fight '+ log +'.');
+ },
+
+ removePause: function(btn, state){
+ if(!btn) {
+ btn = $('#pause');
+ }
+ var event = btn.closest('#event');
+ var log, time, target;
+ if(state == 'auto' && Events.paused != 'auto') {
+ return;
+ }
+ switch(state){
+ case 'set':
+ Button.cooldown(btn, Events._LEAVE_COOLDOWN);
+ log = 'started';
+ time = Events._LEAVE_COOLDOWN * 1000;
+ target = $();
+ break;
+ case 'end':
+ Button.setDisabled(btn, true);
+ log = 'ended';
+ time = Events._FIGHT_SPEED;
+ target = $();
+ break;
+ case 'auto':
+ Button.cooldown(btn);
+ default:
+ log = 'resumed';
+ time = Events._PAUSE_COOLDOWN * 1000;
+ target = $('#buttons').find('.button');
+ break;
+ }
+ Engine.setTimeout(function(){
+ btn.children('.text').first().text( _('pause.') );
+ Events.paused = false;
+ event.removeClass('paused');
+ target.each(function(i){
+ if($(this).data('onCooldown')){
+ Button.cooldown($(this), 'pause');
+ }
+ });
+ Engine.log('Event '+ log);
+ }, time);
+ },
+
+ togglePause: function(btn, auto){
+ if(!btn) {
+ btn = $('#pause');
+ }
+ if((auto) && (document.hasFocus() == !Events.paused)) {
+ return;
+ }
+ var f = (Events.paused) ? Events.removePause : Events.setPause;
+ var state = (auto) ? 'auto' : false;
+ f(btn, state);
},
createEatMeatButton: function(cooldown) {
@@ -201,52 +301,48 @@ var Events = {
});
},
- eatMeat: function() {
- if(Path.outfit['cured meat'] > 0) {
- Path.outfit['cured meat']--;
+ setHeal: function(healBtns) {
+ if(!healBtns){
+ healBtns = $('#healButtons');
+ }
+ healBtns = healBtns.children('.button');
+ var canHeal = (World.health < World.getMaxHealth());
+ healBtns.each(function(i){
+ Button.setDisabled($(this), !canHeal);
+ });
+ return canHeal;
+ },
+
+ doHeal: function(healing, cured, btn) {
+ if(Path.outfit[healing] > 0) {
+ Path.outfit[healing]--;
World.updateSupplies();
- if(Path.outfit['cured meat'] === 0) {
- Button.setDisabled($('#eat'), true);
+ if(Path.outfit[healing] === 0) {
+ Button.setDisabled(btn, true);
}
- var hp = World.health;
- hp += World.meatHeal();
- hp = hp > World.getMaxHealth() ? World.getMaxHealth() : hp;
+ var hp = World.health + cured;
+ hp = Math.min(World.getMaxHealth(),hp);
World.setHp(hp);
+ Events.setHeal();
if(Events.activeEvent()) {
var w = $('#wanderer');
w.data('hp', hp);
Events.updateFighterDiv(w);
- Events.drawFloatText('+' + World.meatHeal(), '#wanderer .hp');
+ Events.drawFloatText('+' + cured, '#wanderer .hp');
var takeETbutton = Events.setTakeAll();
Events.canLeave(takeETbutton);
}
}
},
- useMeds: function() {
- if(Path.outfit['medicine'] > 0) {
- Path.outfit['medicine']--;
- World.updateSupplies();
- if(Path.outfit['medicine'] === 0) {
- Button.setDisabled($('#meds'), true);
- }
+ eatMeat: function(btn) {
+ Events.doHeal('cured meat', World.meatHeal(), btn);
+ },
- var hp = World.health;
- hp += World.medsHeal();
- hp = hp > World.getMaxHealth() ? World.getMaxHealth() : hp;
- World.setHp(hp);
-
- if(Events.activeEvent()) {
- var w = $('#wanderer');
- w.data('hp', hp);
- Events.updateFighterDiv(w);
- Events.drawFloatText('+' + World.medsHeal(), '#wanderer .hp');
- var takeETbutton = Events.setTakeAll();
- Events.canLeave(takeETbutton);
- }
- }
+ useMeds: function(btn) {
+ Events.doHeal('medicine', World.medsHeal(), btn);
},
useWeapon: function(btn) {
@@ -330,6 +426,33 @@ var Events = {
}
},
+ damage: function(fighter, enemy, dmg) {
+ var enemyHp = enemy.data('hp');
+ var msg = "";
+ if(typeof dmg == 'number') {
+ if(dmg < 0) {
+ msg = _('miss');
+ dmg = 0;
+ } else {
+ msg = '-' + dmg;
+ enemyHp = ((enemyHp - dmg) < 0) ? 0 : (enemyHp - dmg);
+ enemy.data('hp', enemyHp);
+ if(fighter.attr('id') == 'enemy') {
+ World.setHp(enemyHp);
+ Events.setHeal();
+ }
+ Events.updateFighterDiv(enemy);
+ }
+ } else {
+ if(dmg == 'stun') {
+ msg = _('stunned');
+ enemy.data('stunned', Events.STUN_DURATION);
+ }
+ }
+
+ Events.drawFloatText(msg, $('.hp', enemy));
+ },
+
animateMelee: function(fighter, dmg, callback) {
var start, end, enemy;
if(fighter.attr('id') == 'wanderer') {
@@ -343,32 +466,8 @@ var Events = {
}
fighter.stop(true, true).animate(start, Events._FIGHT_SPEED, function() {
- var enemyHp = enemy.data('hp');
- var msg = "";
- if(typeof dmg == 'number') {
- if(dmg < 0) {
- msg = _('miss');
- dmg = 0;
- } else {
- msg = '-' + dmg;
- enemyHp = ((enemyHp - dmg) < 0) ? 0 : (enemyHp - dmg);
- enemy.data('hp', enemyHp);
- if(fighter.attr('id') == 'enemy') {
- World.setHp(enemyHp);
- }
- Events.updateFighterDiv(enemy);
- }
- } else {
- if(dmg == 'stun') {
- msg = _('stunned');
- enemy.data('stunned', true);
- Engine.setTimeout(function() {
- enemy.data('stunned', false);
- }, Events.STUN_DURATION);
- }
- }
- Events.drawFloatText(msg, $('.hp', enemy));
+ Events.damage(fighter, enemy, dmg);
$(this).animate(end, Events._FIGHT_SPEED, callback);
});
@@ -387,33 +486,9 @@ var Events = {
}
$('
').css(start).addClass('bullet').text('o').appendTo('#description')
- .animate(end, Events._FIGHT_SPEED * 2, 'linear', function() {
- var enemyHp = enemy.data('hp');
- var msg = "";
- if(typeof dmg == 'number') {
- if(dmg < 0) {
- msg = _('miss');
- dmg = 0;
- } else {
- msg = '-' + dmg;
- enemyHp = ((enemyHp - dmg) < 0) ? 0 : (enemyHp - dmg);
- enemy.data('hp', enemyHp);
- if(fighter.attr('id') == 'enemy') {
- World.setHp(enemyHp);
- }
- Events.updateFighterDiv(enemy);
- }
- } else {
- if(dmg == 'stun') {
- msg = _('stunned');
- enemy.data('stunned', true);
- Engine.setTimeout(function() {
- enemy.data('stunned', false);
- }, Events.STUN_DURATION);
- }
- }
+ .animate(end, Events._FIGHT_SPEED * 2, 'linear', function() {
- Events.drawFloatText(msg, $('.hp', enemy));
+ Events.damage(fighter, enemy, dmg);
$(this).remove();
if(typeof callback == 'function') {
@@ -423,6 +498,7 @@ var Events = {
},
enemyAttack: function() {
+ // Events.togglePause($('#pause'),'auto');
var scene = Events.activeEvent().scenes[Events.activeScene];
@@ -445,16 +521,22 @@ var Events = {
}
});
}
+ },
- Events._enemyAttackTimer = Engine.setTimeout(Events.enemyAttack, scene.attackDelay * 1000);
+ endFight: function() {
+ Events.fought = true;
+ clearTimeout(Events._enemyAttackTimer);
+ Events.removePause($('#pause'), 'end');
},
winFight: function() {
- Events.won = true;
- clearTimeout(Events._enemyAttackTimer);
- $('#enemy').animate({opacity: 0}, 300, 'linear', function() {
- Engine.setTimeout(function() {
- try {
+ Engine.setTimeout(function() {
+ if(Events.fought) {
+ return;
+ }
+ Events.endFight();
+ $('#enemy').animate({opacity: 0}, 300, 'linear', function() {
+ Engine.setTimeout(function() {
var scene = Events.activeEvent().scenes[Events.activeScene];
var leaveBtn = false;
var desc = $('#description', Events.eventPanel());
@@ -465,6 +547,7 @@ var Events = {
var takeETbtn = Events.drawLoot(scene.loot);
+ var exitBtns = $('
').appendTo(btns).attr('id','exitButtons');
if(scene.buttons) {
// Draw the buttons
leaveBtn = Events.drawButtons(scene);
@@ -481,19 +564,28 @@ var Events = {
},
text: _('leave')
});
- Button.cooldown(leaveBtn.appendTo(btns));
+ Button.cooldown(leaveBtn.appendTo(exitBtns));
- Events.createEatMeatButton(0).appendTo(btns);
+ var healBtns = $('
').appendTo(btns).attr('id','healButtons');
+ Events.createEatMeatButton(0).appendTo(healBtns);
if((Path.outfit['medicine'] || 0) !== 0) {
- Events.createUseMedsButton(0).appendTo(btns);
+ Events.createUseMedsButton(0).appendTo(healBtns);
}
+ $('
').addClass('clear').appendTo(healBtns);
+ Events.setHeal(healBtns);
}
+ $('
').addClass('clear').appendTo(exitBtns);
+
Events.allowLeave(takeETbtn, leaveBtn);
- } catch(e) {
- // It is possible to die and win if the timing is perfect. Just let it fail.
- }
- }, 1000, true);
- });
+ }, 1000, true);
+ });
+ }, Events._FIGHT_SPEED);
+ },
+
+ loseFight: function(){
+ Events.endFight();
+ Events.endEvent();
+ World.die();
},
drawDrop:function(btn) {
@@ -604,7 +696,9 @@ var Events = {
},
setTakeAll: function(lootButtons){
- var lootButtons = lootButtons || $('#lootButtons');
+ if(!lootButtons) {
+ lootButtons = $('#lootButtons');
+ }
var canTakeSomething = false;
var free = Path.getFreeSpace();
var takeETbutton = lootButtons.find('#loot_takeEverything');
@@ -628,11 +722,7 @@ var Events = {
takeAll.children('span').first().text(_('all'));
}
});
- if(canTakeSomething){
- takeETbutton.removeClass('disabled');
- } else {
- takeETbutton.addClass('disabled');
- }
+ Button.setDisabled(takeETbutton, !canTakeSomething);
takeETbutton.data('canTakeEverything', (free >= 0) ? true : false);
return takeETbutton;
},
@@ -647,18 +737,16 @@ var Events = {
},
canLeave: function(btn){
- var basetext = _('take everything');
+ var basetext = (btn.data('canTakeEverything')) ? _('take everything') : _('take all you can');
var textbox = btn.children('span');
var takeAndLeave = (btn.data('leaveBtn')) ? btn.data('canTakeEverything') : false;
+ var text = _(basetext);
if(takeAndLeave){
- var verb = btn.data('leaveBtn').text() || _('leave');
- textbox.text( basetext + _(' and ') + verb);
- btn.data('canLeave', true);
Button.cooldown(btn);
- } else {
- textbox.text( basetext );
- btn.data('canLeave', false)
+ text += _(' and ') + btn.data('leaveBtn').text();
}
+ textbox.text( text );
+ btn.data('canLeave', takeAndLeave);
},
dropStuff: function(e) {
@@ -774,13 +862,16 @@ var Events = {
}
// Draw the buttons
+ var exitBtns = $('
').attr('id','exitButtons').appendTo($('#buttons', Events.eventPanel()));
leaveBtn = Events.drawButtons(scene);
+ $('
').addClass('clear').appendTo(exitBtns);
+
Events.allowLeave(takeETbtn, leaveBtn);
},
drawButtons: function(scene) {
- var btns = $('#buttons', Events.eventPanel());
+ var btns = $('#exitButtons', Events.eventPanel());
var btnsList = [];
for(var id in scene.buttons) {
var info = scene.buttons[id];
diff --git a/script/events/outside.js b/script/events/outside.js
index d54a1c4..71d7790 100644
--- a/script/events/outside.js
+++ b/script/events/outside.js
@@ -68,7 +68,7 @@ Events.Outside = [
{ /* Hut fire */
title: _('Fire'),
isAvailable: function() {
- return Engine.activeModule == Outside && $SM.get('game.buildings["hut"]', true) > 0 && $SM.get('game.population', true) > 5;
+ return Engine.activeModule == Outside && $SM.get('game.buildings["hut"]', true) > 0 && $SM.get('game.population', true) > 50;
},
scenes: {
'start': {
diff --git a/script/events/room.js b/script/events/room.js
index 9a503df..6710b25 100644
--- a/script/events/room.js
+++ b/script/events/room.js
@@ -433,6 +433,9 @@ Events.Room = [
'buyMap': {
text: _('buy map'),
cost: { 'fur': 200, 'scales': 10 },
+ available: function() {
+ return !World.seenAll;
+ },
notification: _('the map uncovers a bit of the world'),
onChoose: World.applyMap
},
diff --git a/script/path.js b/script/path.js
index d675672..347b880 100644
--- a/script/path.js
+++ b/script/path.js
@@ -157,20 +157,19 @@ var Path = {
$('.row_val', wRow).text(World.getMaxWater());
}
-
var space = Path.getFreeSpace();
- var total = 0;
+ var currentBagCapacity = 0;
// Add the non-craftables to the craftables
var carryable = $.extend({
- 'cured meat': { type: 'tool' },
- 'bullets': { type: 'tool' },
+ 'cured meat': { type: 'tool', desc: 'restores '+ World.MEAT_HEAL + ' hp' },
+ 'bullets': { type: 'tool', desc: 'use with rifle' },
'grenade': {type: 'weapon' },
'bolas': {type: 'weapon' },
'laser rifle': {type: 'weapon' },
- 'energy cell': {type: 'tool' },
+ 'energy cell': {type: 'tool', desc: 'use with laser rifle' },
'bayonet': {type: 'weapon' },
'charm': {type: 'tool'},
- 'medicine': {type: 'tool'}
+ 'medicine': {type: 'tool', desc: 'restores ' + World.MEDS_HEAL + ' hp' }
}, Room.Craftables);
for(var k in carryable) {
@@ -179,13 +178,16 @@ var Path = {
var have = $SM.get('stores["'+k+'"]');
var num = Path.outfit[k];
num = typeof num == 'number' ? num : 0;
- if (have < num) { num = have; }
- var numAvailable = $SM.get('stores["'+k+'"]', true);
+ if (have !== undefined) {
+ if (have < num) { num = have; }
+ $SM.set(k, num, true);
+ }
+
var row = $('div#outfit_row_' + k.replace(' ', '-'), outfit);
if((store.type == 'tool' || store.type == 'weapon') && have > 0) {
- total += num * Path.getWeight(k);
+ currentBagCapacity += num * Path.getWeight(k);
if(row.length === 0) {
- row = Path.createOutfittingRow(k, num, store.name);
+ row = Path.createOutfittingRow(k, num, store, store.name);
var curPrev = null;
outfit.children().each(function(i) {
@@ -204,7 +206,7 @@ var Path = {
}
} else {
$('div#' + row.attr('id') + ' > div.row_val > span', outfit).text(num);
- $('div#' + row.attr('id') + ' .tooltip .numAvailable', outfit).text(numAvailable - num);
+ $('div#' + row.attr('id') + ' .tooltip .numAvailable', outfit).text(have - num);
}
if(num === 0) {
$('.dnBtn', row).addClass('disabled');
@@ -213,10 +215,10 @@ var Path = {
$('.dnBtn', row).removeClass('disabled');
$('.dnManyBtn', row).removeClass('disabled');
}
- if(num >= numAvailable || space < Path.getWeight(k)) {
+ if(num == have || space < Path.getWeight(k)) {
$('.upBtn', row).addClass('disabled');
$('.upManyBtn', row).addClass('disabled');
- } else if(space >= Path.getWeight(k)) {
+ } else {
$('.upBtn', row).removeClass('disabled');
$('.upManyBtn', row).removeClass('disabled');
}
@@ -224,21 +226,27 @@ var Path = {
row.remove();
}
}
-
+
+ Path.updateBagSpace(currentBagCapacity);
+
+ },
+
+ updateBagSpace: function(currentBagCapacity) {
// Update bagspace
- $('#bagspace').text(_('free {0}/{1}', Math.floor(Path.getCapacity() - total) , Path.getCapacity()));
-
+ $('#bagspace').text(_('free {0}/{1}', Math.floor(Path.getCapacity() - currentBagCapacity) , Path.getCapacity()));
+
if(Path.outfit['cured meat'] > 0) {
Button.setDisabled($('#embarkButton'), false);
} else {
Button.setDisabled($('#embarkButton'), true);
}
+
},
- createOutfittingRow: function(key, num, name) {
- if(!name) name = _(key);
+ createOutfittingRow: function(key, num, store) {
+ if(!store.name) store.name = _(key);
var row = $('
').attr('id', 'outfit_row_' + key.replace(' ', '-')).addClass('outfitRow').attr('key',key);
- $('
').addClass('row_key').text(name).appendTo(row);
+ $('
').addClass('row_key').text(store.name).appendTo(row);
var val = $('
').addClass('row_val').appendTo(row);
$('
').text(num).appendTo(val);
@@ -250,6 +258,14 @@ var Path = {
var numAvailable = $SM.get('stores["'+key+'"]', true);
var tt = $('').addClass('tooltip bottom right').appendTo(row);
+
+ if(store.type == 'weapon') {
+ $('
').addClass('row_key').text(_('damage')).appendTo(tt);
+ $('
').addClass('row_val').text(World.getDamage(key)).appendTo(tt);
+ } else if(store.type == 'tool' && store.desc != "undefined") {
+ $('
').addClass('row_key').text(store.desc).appendTo(tt);
+ }
+
$('
').addClass('row_key').text(_('weight')).appendTo(tt);
$('
').addClass('row_val').text(Path.getWeight(key)).appendTo(tt);
$('
').addClass('row_key').text(_('available')).appendTo(tt);
@@ -266,8 +282,7 @@ var Path = {
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;
- Path.outfit[supply] = cur + Math.min(maxExtraByBtn, Math.min(maxExtraByWeight, maxExtraByStore));
+ Path.outfit[supply] = cur + Math.min(btn.data, maxExtraByWeight, maxExtraByStore);
$SM.set('outfit['+supply+']', Path.outfit[supply]);
Path.updateOutfitting();
}
@@ -289,7 +304,6 @@ var Path = {
Path.setTitle();
Path.updateOutfitting();
Path.updatePerks(true);
- $SM.set('outfit', Path.outfit);
Engine.moveStoresView($('#perks'), transition_diff);
},
@@ -302,7 +316,6 @@ var Path = {
for(var k in Path.outfit) {
$SM.add('stores["'+k+'"]', -Path.outfit[k]);
}
- $SM.remove('outfit');
World.onArrival();
$('#outerSlider').animate({left: '-700px'}, 300);
Engine.activeModule = World;
@@ -311,7 +324,9 @@ var Path = {
handleStateUpdates: function(e){
if(e.category == 'character' && e.stateName.indexOf('character.perks') === 0 && Engine.activeModule == Path){
Path.updatePerks();
- };
+ } else if(e.category == 'income' && Engine.activeModule == Path){
+ Path.updateOutfitting();
+ }
},
scrollSidebar: function(direction, reset){
diff --git a/script/room.js b/script/room.js
index d569154..11e807b 100644
--- a/script/room.js
+++ b/script/room.js
@@ -750,7 +750,7 @@ var Room = {
updateStoresView: function() {
var stores = $('div#stores');
- var resources = $('div#resources');
+ var resources = $('div#resources');
var special = $('div#special');
var weapons = $('div#weapons');
var needsAppend = false, rNeedsAppend = false, sNeedsAppend = false, wNeedsAppend = false, newRow = false;
@@ -796,6 +796,9 @@ var Room = {
case 'upgrade':
// Don't display upgrades on the Room screen
continue;
+ case 'building':
+ // Don't display buildings either
+ continue;
case 'weapon':
location = weapons;
break;
@@ -825,7 +828,7 @@ var Room = {
$SM.startThieves();
}
- if(row.length === 0 && num > 0) {
+ if(row.length === 0) {
row = $('
').attr('id', id).addClass('storeRow');
$('
').addClass('row_key').text(lk).appendTo(row);
$('
').addClass('row_val').text(Math.floor(num)).appendTo(row);
@@ -844,7 +847,7 @@ var Room = {
row.insertAfter(location.find('#' + curPrev));
}
newRow = true;
- } else if(num>= 0){
+ } else {
$('div#' + row.attr('id') + ' > div.row_val', location).text(Math.floor(num));
}
}
@@ -890,7 +893,8 @@ var Room = {
$('div.storeRow', stores).each(function(index, el) {
el = $(el);
$('div.tooltip', el).remove();
- var tt = $('
').addClass('tooltip bottom right');
+ var ttPos = index > 10 ? 'top right' : 'bottom right';
+ var tt = $('
').addClass('tooltip ' + ttPos);
var storeName = el.attr('id').substring(4).replace('-', ' ');
for(var incomeSource in $SM.get('income')) {
var income = $SM.get('income["'+incomeSource+'"]');
@@ -1114,7 +1118,8 @@ var Room = {
cost: good.cost(),
text: _(k),
click: Room.buy,
- width: '80px'
+ width: '80px',
+ ttPos: buySection.children().length > 10 ? 'top right' : 'bottom right'
}).css('opacity', 0).attr('buildThing', k).appendTo(buySection).animate({opacity:1}, 300, 'linear');
}
} else {
@@ -1149,7 +1154,8 @@ var Room = {
},
compassTooltip: function(direction){
- var tt = $('
').addClass('tooltip bottom right');
+ var ttPos = $('div#resources').children().length > 10 ? 'top right' : 'bottom right';
+ var tt = $('
').addClass('tooltip ' + ttPos);
$('
').addClass('row_key').text(_('the compass points '+ direction)).appendTo(tt);
tt.appendTo($('#row_compass'));
},
diff --git a/script/space.js b/script/space.js
index c12ef0d..8cdd178 100644
--- a/script/space.js
+++ b/script/space.js
@@ -445,12 +445,31 @@ var Space = {
.animate({opacity:1},1500);
$('
')
.appendTo('.centerCont');
+ $('
')
+ .appendTo('.centerCont');
+ $('')
+ .addClass('endGame')
+ .text(_('expanded story. alternate ending. behind the scenes commentary. get the app.'))
+ .appendTo('.centerCont')
+ .animate({opacity:1}, 1500);
+ $('
')
+ .appendTo('.centerCont');
+ $('
')
+ .appendTo('.centerCont');
$('')
.addClass('endGame endGameOption')
- .text(_('app store.'))
+ .text(_('iOS.'))
.click(function() { window.open('https://itunes.apple.com/app/apple-store/id736683061?pt=2073437&ct=gameover&mt=8'); })
.appendTo('.centerCont')
.animate({opacity:1},1500);
+ $('
')
+ .appendTo('.centerCont');
+ $('')
+ .addClass('endGame endGameOption')
+ .text(_('android.'))
+ .click(function() { window.open('https://play.google.com/store/apps/details?id=com.yourcompany.adarkroom'); })
+ .appendTo('.centerCont')
+ .animate({opacity:1},1500);
Engine.options = {};
Engine.deleteSave(true);
}
diff --git a/script/world.js b/script/world.js
index f0f21d9..d40e629 100644
--- a/script/world.js
+++ b/script/world.js
@@ -162,6 +162,9 @@ var World = {
// compass tooltip text
Room.compassTooltip(World.dir);
+ // Check if everything has been seen
+ World.testMap();
+
//subscribe to stateUpdates
$.Dispatch('stateUpdate').subscribe(World.handleStateUpdates);
},
@@ -549,6 +552,10 @@ var World = {
return World.state.map[World.curPos[0]][World.curPos[1]];
},
+ getDamage: function(thing) {
+ return World.Weapons[thing].damage;
+ },
+
narrateMove: function(oldTile, newTile) {
var msg = null;
switch(oldTile) {
@@ -617,10 +624,33 @@ var World = {
}
},
+ testMap: function() {
+ if(!World.seenAll) {
+ var dark;
+ var mask = $SM.get('game.world.mask');
+ loop:
+ for(var i = 0; i < mask.length; i++) {
+ for(var j = 0; j < mask[i].length; j++) {
+ if(!mask[i][j]) {
+ dark = true;
+ break loop;
+ }
+ }
+ }
+ World.seenAll = !dark;
+ }
+ },
+
applyMap: function() {
- var x = 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'));
+ if(!World.seenAll){
+ var x,y,mask = $SM.get('game.world.mask');
+ do {
+ x = Math.floor(Math.random() * (World.RADIUS * 2) + 1);
+ y = Math.floor(Math.random() * (World.RADIUS * 2) + 1);
+ } while (mask[x][y]);
+ World.uncoverMap(x, y, 5, mask);
+ }
+ World.testMap();
},
generateMap: function() {
@@ -851,6 +881,7 @@ var World = {
Notifications.notify(World, _('the world fades'));
World.state = null;
Path.outfit = {};
+ $SM.remove('outfit');
$('#outerSlider').animate({opacity: '0'}, 600, 'linear', function() {
$('#outerSlider').css('left', '0px');
$('#locationSlider').css('left', '0px');
@@ -872,6 +903,8 @@ var World = {
goHome: function() {
// Home safe! Commit the changes.
$SM.setM('game.world', World.state);
+ World.testMap();
+
if(World.state.sulphurmine && $SM.get('game.buildings["sulphur mine"]', true) === 0) {
$SM.add('game.buildings["sulphur mine"]', 1);
Engine.event('progress', 'sulphur mine');