From 7efe1426379ae5de469bfaddd6e3640ea1a604bd Mon Sep 17 00:00:00 2001 From: Elizabeth Donohew Date: Tue, 23 Feb 2016 20:46:19 -0600 Subject: [PATCH 1/4] Shows the damage that a weapon deals only when hovering over a weapon on the path tab. --- script/path.js | 14 ++++++++++---- script/world.js | 4 ++++ 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/script/path.js b/script/path.js index d675672..05d6206 100644 --- a/script/path.js +++ b/script/path.js @@ -185,7 +185,7 @@ var Path = { if((store.type == 'tool' || store.type == 'weapon') && have > 0) { total += 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) { @@ -235,10 +235,10 @@ var Path = { } }, - 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 +250,12 @@ 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); + } + $('
').addClass('row_key').text(_('weight')).appendTo(tt); $('
').addClass('row_val').text(Path.getWeight(key)).appendTo(tt); $('
').addClass('row_key').text(_('available')).appendTo(tt); diff --git a/script/world.js b/script/world.js index f0f21d9..3892bf9 100644 --- a/script/world.js +++ b/script/world.js @@ -549,6 +549,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) { From 4d9890f2eff7a2f50c692003d90dae5f1352452e Mon Sep 17 00:00:00 2001 From: Elizabeth Donohew Date: Tue, 23 Feb 2016 21:07:21 -0600 Subject: [PATCH 2/4] Renamed total to currentBagCapacity in the updateOutfitting method and extracted some functionality into a method called updateBagSpace. --- script/path.js | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/script/path.js b/script/path.js index 05d6206..15bd1c8 100644 --- a/script/path.js +++ b/script/path.js @@ -157,9 +157,8 @@ 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' }, @@ -183,7 +182,7 @@ var Path = { var numAvailable = $SM.get('stores["'+k+'"]', 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, store.name); @@ -224,15 +223,21 @@ 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, store) { From 9083a9582ca3cebb49494a0bcf68ad5268010016 Mon Sep 17 00:00:00 2001 From: Elizabeth Donohew Date: Tue, 23 Feb 2016 22:40:04 -0600 Subject: [PATCH 3/4] Hovering over a tool on the path tab now gives a small description on how the tool can be used. --- script/path.js | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/script/path.js b/script/path.js index 15bd1c8..160251f 100644 --- a/script/path.js +++ b/script/path.js @@ -161,15 +161,15 @@ var Path = { 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: 'healing: '+ World.MEAT_HEAL }, + 'bullets': { type: 'tool', desc: 'used with rifle' }, 'grenade': {type: 'weapon' }, 'bolas': {type: 'weapon' }, 'laser rifle': {type: 'weapon' }, - 'energy cell': {type: 'tool' }, + 'energy cell': {type: 'tool', desc: 'used with laser rifle' }, 'bayonet': {type: 'weapon' }, 'charm': {type: 'tool'}, - 'medicine': {type: 'tool'} + 'medicine': {type: 'tool', desc: 'healing: ' + World.MEDS_HEAL} }, Room.Craftables); for(var k in carryable) { @@ -259,6 +259,8 @@ var Path = { 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); From 41293d48a82d6f1723c7c64127e6a07100dfa58a Mon Sep 17 00:00:00 2001 From: Elizabeth Donohew Date: Wed, 24 Feb 2016 00:03:28 -0600 Subject: [PATCH 4/4] Rewrote a couple of the descriptions that I added before for the tools. --- script/path.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/script/path.js b/script/path.js index 160251f..39cbdd2 100644 --- a/script/path.js +++ b/script/path.js @@ -161,15 +161,15 @@ var Path = { var currentBagCapacity = 0; // Add the non-craftables to the craftables var carryable = $.extend({ - 'cured meat': { type: 'tool', desc: 'healing: '+ World.MEAT_HEAL }, - 'bullets': { type: 'tool', desc: 'used with rifle' }, + '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', desc: 'used with laser rifle' }, + 'energy cell': {type: 'tool', desc: 'use with laser rifle' }, 'bayonet': {type: 'weapon' }, 'charm': {type: 'tool'}, - 'medicine': {type: 'tool', desc: 'healing: ' + World.MEDS_HEAL} + 'medicine': {type: 'tool', desc: 'restores ' + World.MEDS_HEAL + ' hp' } }, Room.Craftables); for(var k in carryable) {