Files
adarkroom/script/events/room.js
T

603 lines
14 KiB
JavaScript
Raw Normal View History

2013-07-03 07:56:13 -07:00
/**
* Events that can occur when the Room module is active
**/
Events.Room = [
{ /* The Nomad -- Merchant */
2014-02-04 22:27:00 +01:00
title: _('The Nomad'),
2013-07-03 07:56:13 -07:00
isAvailable: function() {
2013-07-24 17:41:36 -06:00
return Engine.activeModule == Room && $SM.get('stores.fur', true) > 0;
2013-07-03 07:56:13 -07:00
},
scenes: {
'start': {
text: [
2014-02-04 22:27:00 +01:00
_('a nomad shuffles into view, laden with makeshift bags bound with rough twine.'),
_("won't say from where he came, but it's clear that he's not staying.")
2013-07-03 07:56:13 -07:00
],
2014-02-04 22:27:00 +01:00
notification: _('a nomad arrives, looking to trade'),
2014-07-24 12:00:51 -04:00
blink: true,
2013-07-03 07:56:13 -07:00
buttons: {
'buyScales': {
2014-02-04 22:27:00 +01:00
text: _('buy scales'),
2013-07-03 07:56:13 -07:00
cost: { 'fur': 100 },
reward: { 'scales': 1 }
},
'buyTeeth': {
2014-02-04 22:27:00 +01:00
text: _('buy teeth'),
2013-07-03 07:56:13 -07:00
cost: { 'fur': 200 },
reward: { 'teeth': 1 }
},
'buyBait': {
2014-02-04 22:27:00 +01:00
text: _('buy bait'),
2013-07-03 07:56:13 -07:00
cost: { 'fur': 5 },
reward: { 'bait': 1 },
2014-02-04 22:27:00 +01:00
notification: _('traps are more effective with bait.')
2013-07-03 07:56:13 -07:00
},
'buyCompass': {
available: function() {
2013-07-24 17:41:36 -06:00
return $SM.get('stores.compass', true) < 1;
2013-07-03 07:56:13 -07:00
},
2014-02-04 22:27:00 +01:00
text: _('buy compass'),
2013-07-03 07:56:13 -07:00
cost: { fur: 300, scales: 15, teeth: 5 },
reward: { 'compass': 1 },
2014-02-04 22:27:00 +01:00
notification: _('the old compass is dented and dusty, but it looks to work.'),
2013-07-24 17:41:36 -06:00
onChoose: Path.openPath
2013-07-03 07:56:13 -07:00
},
'goodbye': {
2014-02-04 22:27:00 +01:00
text: _('say goodbye'),
2013-07-03 07:56:13 -07:00
nextScene: 'end'
}
}
}
}
}, { /* Noises Outside -- gain wood/fur */
2014-02-04 22:27:00 +01:00
title: _('Noises'),
2013-07-03 07:56:13 -07:00
isAvailable: function() {
2013-07-24 17:41:36 -06:00
return Engine.activeModule == Room && $SM.get('stores.wood');
2013-07-03 07:56:13 -07:00
},
scenes: {
'start': {
text: [
2014-02-04 22:27:00 +01:00
_('through the walls, shuffling noises can be heard.'),
_("can't tell what they're up to.")
2013-07-03 07:56:13 -07:00
],
2014-02-04 22:27:00 +01:00
notification: _('strange noises can be heard through the walls'),
2014-07-24 12:00:51 -04:00
blink: true,
2013-07-03 07:56:13 -07:00
buttons: {
'investigate': {
2014-02-04 22:27:00 +01:00
text: _('investigate'),
2013-07-03 07:56:13 -07:00
nextScene: { 0.3: 'stuff', 1: 'nothing' }
},
'ignore': {
2014-02-04 22:27:00 +01:00
text: _('ignore them'),
2013-07-03 07:56:13 -07:00
nextScene: 'end'
}
}
},
'nothing': {
text: [
2014-02-04 22:27:00 +01:00
_('vague shapes move, just out of sight.'),
_('the sounds stop.')
2013-07-03 07:56:13 -07:00
],
buttons: {
'backinside': {
2014-02-04 22:27:00 +01:00
text: _('go back inside'),
2013-07-03 07:56:13 -07:00
nextScene: 'end'
}
}
},
'stuff': {
reward: { wood: 100, fur: 10 },
text: [
2014-02-04 22:27:00 +01:00
_('a bundle of sticks lies just beyond the threshold, wrapped in coarse furs.'),
_('the night is silent.')
2013-07-03 07:56:13 -07:00
],
buttons: {
'backinside': {
2014-02-04 22:27:00 +01:00
text: _('go back inside'),
2013-07-03 07:56:13 -07:00
nextScene: 'end'
}
}
}
}
},
{ /* Noises Inside -- trade wood for better good */
2014-02-04 22:27:00 +01:00
title: _('Noises'),
2013-07-03 07:56:13 -07:00
isAvailable: function() {
2013-07-24 17:41:36 -06:00
return Engine.activeModule == Room && $SM.get('stores.wood');
2013-07-03 07:56:13 -07:00
},
scenes: {
start: {
text: [
2014-07-13 11:52:19 -04:00
_('scratching noises can be heard from the store room.'),
_('something\'s in there.')
2013-07-03 07:56:13 -07:00
],
2014-02-04 22:27:00 +01:00
notification: _('something\'s in the store room'),
2014-07-24 12:00:51 -04:00
blink: true,
2013-07-03 07:56:13 -07:00
buttons: {
'investigate': {
2014-02-04 22:27:00 +01:00
text: _('investigate'),
2013-07-03 07:56:13 -07:00
nextScene: { 0.5: 'scales', 0.8: 'teeth', 1: 'cloth' }
},
'ignore': {
2014-02-04 22:27:00 +01:00
text: _('ignore them'),
2013-07-03 07:56:13 -07:00
nextScene: 'end'
}
}
},
scales: {
text: [
2014-07-13 11:52:19 -04:00
_('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'
}
}
2013-07-03 07:56:13 -07:00
},
teeth: {
text: [
2014-07-13 11:52:19 -04:00
_('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'
}
}
2013-07-03 07:56:13 -07:00
},
cloth: {
text: [
2014-07-13 11:52:19 -04:00
_('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'
}
}
2013-07-03 07:56:13 -07:00
}
}
},
{ /* The Beggar -- trade fur for better good */
2014-02-04 22:27:00 +01:00
title: _('The Beggar'),
2013-07-03 07:56:13 -07:00
isAvailable: function() {
2013-07-24 17:41:36 -06:00
return Engine.activeModule == Room && $SM.get('stores.fur');
2013-07-03 07:56:13 -07:00
},
scenes: {
start: {
text: [
2014-07-13 11:52:19 -04:00
_('a beggar arrives.'),
_('asks for any spare furs to keep him warm at night.')
2013-07-03 07:56:13 -07:00
],
2014-02-04 22:27:00 +01:00
notification: _('a beggar arrives'),
2014-07-24 12:00:51 -04:00
blink: true,
2013-07-03 07:56:13 -07:00
buttons: {
'50furs': {
2014-02-04 22:27:00 +01:00
text: _('give 50'),
2013-07-03 07:56:13 -07:00
cost: {fur: 50},
nextScene: { 0.5: 'scales', 0.8: 'teeth', 1: 'cloth' }
},
'100furs': {
2014-02-04 22:27:00 +01:00
text: _('give 100'),
2013-07-03 07:56:13 -07:00
cost: {fur: 100},
nextScene: { 0.5: 'teeth', 0.8: 'scales', 1: 'cloth' }
},
'deny': {
2014-02-04 22:27:00 +01:00
text: _('turn him away'),
2013-07-03 07:56:13 -07:00
nextScene: 'end'
}
}
},
scales: {
reward: { scales: 20 },
text: [
2014-07-13 11:52:19 -04:00
_('the beggar expresses his thanks.'),
_('leaves a pile of small scales behind.')
],
buttons: {
'leave': {
text: _('say goodbye'),
nextScene: 'end'
}
}
2013-07-03 07:56:13 -07:00
},
teeth: {
reward: { teeth: 20 },
text: [
2014-07-13 11:52:19 -04:00
_('the beggar expresses his thanks.'),
_('leaves a pile of small teeth behind.')
],
buttons: {
'leave': {
text: _('say goodbye'),
nextScene: 'end'
}
}
2013-07-03 07:56:13 -07:00
},
cloth: {
reward: { cloth: 20 },
text: [
2014-07-13 11:52:19 -04:00
_('the beggar expresses his thanks.'),
_('leaves some scraps of cloth behind.')
],
buttons: {
'leave': {
text: _('say goodbye'),
nextScene: 'end'
}
}
2013-07-03 07:56:13 -07:00
}
}
},
{ /* Mysterious Wanderer -- wood gambling */
2014-02-04 22:27:00 +01:00
title: _('The Mysterious Wanderer'),
2013-07-03 07:56:13 -07:00
isAvailable: function() {
2013-07-24 17:41:36 -06:00
return Engine.activeModule == Room && $SM.get('stores.wood');
2013-07-03 07:56:13 -07:00
},
scenes: {
start: {
text: [
2014-07-13 11:52:19 -04:00
_('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.")
2013-07-03 07:56:13 -07:00
],
2014-02-04 22:27:00 +01:00
notification: _('a mysterious wanderer arrives'),
2014-07-24 12:00:51 -04:00
blink: true,
2013-07-03 07:56:13 -07:00
buttons: {
'100wood': {
2014-02-04 22:27:00 +01:00
text: _('give 100'),
2013-07-03 07:56:13 -07:00
cost: {wood: 100},
nextScene: { 1: '100wood'}
},
'500wood': {
2014-02-04 22:27:00 +01:00
text: _('give 500'),
2013-07-03 07:56:13 -07:00
cost: {wood: 500},
nextScene: { 1: '500wood' }
},
'deny': {
2014-02-04 22:27:00 +01:00
text: _('turn him away'),
2013-07-03 07:56:13 -07:00
nextScene: 'end'
}
}
},
'100wood': {
text: [
2014-07-13 11:52:19 -04:00
_('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'
}
}
2013-07-03 07:56:13 -07:00
},
'500wood': {
text: [
2014-07-13 11:52:19 -04:00
_('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'
}
}
2013-07-03 07:56:13 -07:00
}
}
},
{ /* Mysterious Wanderer -- fur gambling */
2014-02-04 22:27:00 +01:00
title: _('The Mysterious Wanderer'),
2013-07-03 07:56:13 -07:00
isAvailable: function() {
2013-07-24 17:41:36 -06:00
return Engine.activeModule == Room && $SM.get('stores.fur');
2013-07-03 07:56:13 -07:00
},
scenes: {
start: {
text: [
2014-07-13 11:52:19 -04:00
_('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.")
2013-07-03 07:56:13 -07:00
],
2014-02-04 22:27:00 +01:00
notification: _('a mysterious wanderer arrives'),
2014-07-24 12:00:51 -04:00
blink: true,
2013-07-03 07:56:13 -07:00
buttons: {
'100fur': {
2014-02-04 22:27:00 +01:00
text: _('give 100'),
2013-07-03 07:56:13 -07:00
cost: {fur: 100},
nextScene: { 1: '100fur'}
},
'500fur': {
2014-02-04 22:27:00 +01:00
text: _('give 500'),
2013-07-03 07:56:13 -07:00
cost: {fur: 500},
nextScene: { 1: '500fur' }
},
'deny': {
2014-02-04 22:27:00 +01:00
text: _('turn her away'),
2013-07-03 07:56:13 -07:00
nextScene: 'end'
}
}
},
'100fur': {
text: [
2014-07-13 11:52:19 -04:00
_('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'
}
}
2013-07-03 07:56:13 -07:00
},
'500fur': {
text: [
2014-07-13 11:52:19 -04:00
_('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'
}
}
2013-07-03 07:56:13 -07:00
}
}
},
{ /* The Scout -- Map Merchant */
2014-02-04 22:27:00 +01:00
title: _('The Scout'),
2013-07-03 07:56:13 -07:00
isAvailable: function() {
return Engine.activeModule == Room && $SM.get('features.location.world');
2013-07-03 07:56:13 -07:00
},
scenes: {
'start': {
text: [
2014-02-04 22:27:00 +01:00
_("the scout says she's been all over."),
_("willing to talk about it, for a price.")
2013-07-03 07:56:13 -07:00
],
2014-02-04 22:27:00 +01:00
notification: _('a scout stops for the night'),
2014-07-24 12:00:51 -04:00
blink: true,
2013-07-03 07:56:13 -07:00
buttons: {
'buyMap': {
2014-02-04 22:27:00 +01:00
text: _('buy map'),
2013-07-03 07:56:13 -07:00
cost: { 'fur': 200, 'scales': 10 },
2014-02-04 22:27:00 +01:00
notification: _('the map uncovers a bit of the world'),
2013-07-03 07:56:13 -07:00
onChoose: World.applyMap
},
'learn': {
2014-02-04 22:27:00 +01:00
text: _('learn scouting'),
2013-07-03 07:56:13 -07:00
cost: { 'fur': 1000, 'scales': 50, 'teeth': 20 },
available: function() {
2013-07-24 17:41:36 -06:00
return !$SM.hasPerk('scout');
2013-07-03 07:56:13 -07:00
},
onChoose: function() {
2013-07-24 17:41:36 -06:00
$SM.addPerk('scout');
2013-07-03 07:56:13 -07:00
}
},
'leave': {
2014-07-13 11:52:19 -04:00
text: _('say goodbye'),
nextScene: 'end'
}
2013-07-03 07:56:13 -07:00
}
}
}
},
{ /* The Wandering Master */
2014-02-04 22:27:00 +01:00
title: _('The Master'),
2013-07-03 07:56:13 -07:00
isAvailable: function() {
return Engine.activeModule == Room && $SM.get('features.location.world');
2013-07-03 07:56:13 -07:00
},
scenes: {
'start': {
text: [
2014-02-04 22:27:00 +01:00
_('an old wanderer arrives.'),
_('he smiles warmly and asks for lodgings for the night.')
2013-07-03 07:56:13 -07:00
],
2014-02-04 22:27:00 +01:00
notification: _('an old wanderer arrives'),
2014-07-24 12:00:51 -04:00
blink: true,
2013-07-03 07:56:13 -07:00
buttons: {
'agree': {
2014-02-04 22:27:00 +01:00
text: _('agree'),
2013-07-03 07:56:13 -07:00
cost: {
'cured meat': 100,
'fur': 100,
'torch': 1
},
nextScene: {1: 'agree'}
},
'deny': {
2014-02-04 22:27:00 +01:00
text: _('turn him away'),
2013-07-03 07:56:13 -07:00
nextScene: 'end'
}
}
},
'agree': {
text: [
2014-07-13 11:52:19 -04:00
_('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'
}
}
2013-07-03 07:56:13 -07:00
}
}
2013-07-10 12:53:28 +02:00
},
{ /* The Sick Man */
2014-07-13 11:52:19 -04:00
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'),
2014-07-24 12:00:51 -04:00
blink: true,
2014-07-13 11:52:19 -04:00
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'
}
}
}
}
2013-07-03 07:56:13 -07:00
}
];