From f1656f9a4f9f470ac7e9e1a563f5c20bfa210b49 Mon Sep 17 00:00:00 2001 From: Andrea Rendine Date: Sun, 14 Feb 2016 13:46:26 +0100 Subject: [PATCH] Buy map when needed Maps cost! And casual gamers could possibly forget whether they've explored everything. The Buy map button is now disabled if the whole map has been seen (yes, even a single uncovered tile is enough). --- script/events/room.js | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/script/events/room.js b/script/events/room.js index 9a503df..32f766a 100644 --- a/script/events/room.js +++ b/script/events/room.js @@ -433,6 +433,20 @@ Events.Room = [ 'buyMap': { text: _('buy map'), cost: { 'fur': 200, 'scales': 10 }, + available: function() { + var mask = $SM.get('game.world.mask'); + var dark = false; + 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; + } + } + } + return dark; + }, notification: _('the map uncovers a bit of the world'), onChoose: World.applyMap },