mirror of
https://github.com/doublespeakgames/adarkroom.git
synced 2026-06-09 22:17:14 +08:00
@@ -433,6 +433,9 @@ Events.Room = [
|
|||||||
'buyMap': {
|
'buyMap': {
|
||||||
text: _('buy map'),
|
text: _('buy map'),
|
||||||
cost: { 'fur': 200, 'scales': 10 },
|
cost: { 'fur': 200, 'scales': 10 },
|
||||||
|
available: function() {
|
||||||
|
return !World.seenAll;
|
||||||
|
},
|
||||||
notification: _('the map uncovers a bit of the world'),
|
notification: _('the map uncovers a bit of the world'),
|
||||||
onChoose: World.applyMap
|
onChoose: World.applyMap
|
||||||
},
|
},
|
||||||
|
|||||||
+31
-3
@@ -162,6 +162,9 @@ var World = {
|
|||||||
// compass tooltip text
|
// compass tooltip text
|
||||||
Room.compassTooltip(World.dir);
|
Room.compassTooltip(World.dir);
|
||||||
|
|
||||||
|
// Check if everything has been seen
|
||||||
|
World.testMap();
|
||||||
|
|
||||||
//subscribe to stateUpdates
|
//subscribe to stateUpdates
|
||||||
$.Dispatch('stateUpdate').subscribe(World.handleStateUpdates);
|
$.Dispatch('stateUpdate').subscribe(World.handleStateUpdates);
|
||||||
},
|
},
|
||||||
@@ -617,10 +620,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() {
|
applyMap: function() {
|
||||||
var x = Math.floor(Math.random() * (World.RADIUS * 2) + 1);
|
if(!World.seenAll){
|
||||||
var y = Math.floor(Math.random() * (World.RADIUS * 2) + 1);
|
var x,y,mask = $SM.get('game.world.mask');
|
||||||
World.uncoverMap(x, y, 5, $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() {
|
generateMap: function() {
|
||||||
@@ -873,6 +899,8 @@ var World = {
|
|||||||
goHome: function() {
|
goHome: function() {
|
||||||
// Home safe! Commit the changes.
|
// Home safe! Commit the changes.
|
||||||
$SM.setM('game.world', World.state);
|
$SM.setM('game.world', World.state);
|
||||||
|
World.testMap();
|
||||||
|
|
||||||
if(World.state.sulphurmine && $SM.get('game.buildings["sulphur mine"]', true) === 0) {
|
if(World.state.sulphurmine && $SM.get('game.buildings["sulphur mine"]', true) === 0) {
|
||||||
$SM.add('game.buildings["sulphur mine"]', 1);
|
$SM.add('game.buildings["sulphur mine"]', 1);
|
||||||
Engine.event('progress', 'sulphur mine');
|
Engine.event('progress', 'sulphur mine');
|
||||||
|
|||||||
Reference in New Issue
Block a user