Files
adarkroom/script/events/outside.js
T

283 lines
6.7 KiB
JavaScript
Raw Normal View History

2013-07-03 07:56:13 -07:00
/**
* Events that can occur when the Outside module is active
**/
Events.Outside = [
2014-07-13 11:43:19 -04:00
{ /* Ruined traps */
title: _('A Ruined Trap'),
2013-07-03 07:56:13 -07:00
isAvailable: function() {
return Engine.activeModule == Outside && $SM.get('game.buildings["trap"]', true) > 0;
2013-07-03 07:56:13 -07:00
},
scenes: {
'start': {
text: [
2014-02-04 22:27:00 +01:00
_('some of the traps have been torn apart.'),
_('large prints lead away, into the forest.')
2013-07-03 07:56:13 -07:00
],
onLoad: function() {
var numWrecked = Math.floor(Math.random() * $SM.get('game.buildings["trap"]', true)) + 1;
$SM.add('game.buildings["trap"]', -numWrecked);
2013-07-03 07:56:13 -07:00
Outside.updateVillage();
Outside.updateTrapButton();
},
2014-02-04 22:27:00 +01:00
notification: _('some traps have been destroyed'),
2014-07-24 12:00:51 -04:00
blink: true,
2013-07-03 07:56:13 -07:00
buttons: {
'track': {
2014-02-04 22:27:00 +01:00
text: _('track them'),
2013-07-03 07:56:13 -07:00
nextScene: {0.5: 'nothing', 1: 'catch'}
},
'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
_('the tracks disappear after just a few minutes.'),
_('the forest is silent.')
2013-07-03 07:56:13 -07:00
],
buttons: {
'end': {
2014-02-04 22:27:00 +01:00
text: _('go home'),
2013-07-03 07:56:13 -07:00
nextScene: 'end'
}
}
},
'catch': {
text: [
2014-07-13 11:43:19 -04:00
_('not far from the village lies a large beast, its fur matted with blood.'),
_('it puts up little resistance before the knife.')
],
2013-07-03 07:56:13 -07:00
reward: {
fur: 100,
meat: 100,
teeth: 10
},
buttons: {
'end': {
2014-02-04 22:27:00 +01:00
text: _('go home'),
2013-07-03 07:56:13 -07:00
nextScene: 'end'
}
}
}
}
2014-07-13 11:43:19 -04:00
},
2015-02-06 16:26:18 -05:00
{
title: _('Fire'),
isAvailable: function() {
2015-02-08 22:33:18 -05:00
return Engine.activeModule == Outside && $SM.get('game.buildings["hut"]', true) > 0 && $SM.get('game.population', true) > 5;
2015-02-06 16:26:18 -05:00
},
scenes: {
'start': {
text: [
_('a fire rampages through one of the huts, destroying it.'),
_('all residents in the hut perished in the fire.')
],
notification: _('a fire has started'),
blink: true,
onLoad: function() {
var population = $SM.get('game.population', true);
var huts = $SM.get('game.buildings["hut"]', true);
$SM.set('game.buildings["hut"]', (huts - 1));
$SM.set('game.population', (population - 4));
},
buttons: {
'mourn': {
text: _('mourn'),
notification: _('some villagers have died'),
nextScene: 'end'
}
}
}
}
},
2014-07-13 11:43:19 -04:00
{ /* Sickness */
title: _('Sickness'),
isAvailable: function() {
return Engine.activeModule == Outside && $SM.get('game.population', true) > 10 && $SM.get('game.population', true) < 50 && $SM.get('stores.medicine', true) > 0;
},
scenes: {
'start': {
text: [
_('a sickness is spreading through the village.'),
_('medicine is needed immediately.')
],
2014-07-24 12:00:51 -04:00
blink: true,
2014-07-13 11:43:19 -04:00
buttons: {
'heal': {
text: _('1 medicine'),
cost: { 'medicine' : 1 },
nextScene: {1: 'healed'}
},
'ignore': {
text: _('ignore it'),
nextScene: {1: 'death'}
}
}
},
'healed': {
text: [
_('the sickness is cured in time.')
],
buttons: {
'end': {
text: _('go home'),
nextScene: 'end'
}
}
},
'death': {
text: [
_('the sickness spreads through the village.'),
_('the days are spent with burials.'),
_('the nights are rent with screams.')
],
onLoad: function() {
var numKilled = Math.floor(Math.random() * 20) + 1;
Outside.killVillagers(numKilled);
},
buttons: {
'end': {
text: _('go home'),
nextScene: 'end'
}
}
}
}
},
{ /* Plague */
title: _('Plague'),
isAvailable: function() {
return Engine.activeModule == Outside && $SM.get('game.population', true) > 50 && $SM.get('stores.medicine', true) > 0;
},
scenes: {
'start': {
text: [
_('a terrible plague is fast spreading through the village.'),
_('medicine is needed immediately.')
],
2014-07-24 12:00:51 -04:00
blink: true,
2014-07-13 11:43:19 -04:00
buttons: {
2015-01-03 09:40:16 -05:00
/* Because there is a serious need for medicine, the price is raised. */
'buyMedicine': {
text: _('buy medicine'),
cost: { 'scales': 70,
'teeth': 50 },
reward: { 'medicine': 1 }
},
2014-07-13 11:43:19 -04:00
'heal': {
text: _('5 medicine'),
cost: { 'medicine' : 5 },
nextScene: {1: 'healed'}
},
'ignore': {
text: _('do nothing'),
nextScene: {1: 'death'}
}
}
},
'healed': {
text: [
_('the plague is kept from spreading.'),
_('only a few die.'),
_('the rest bury them.')
],
onLoad: function() {
var numKilled = Math.floor(Math.random() * 5) + 2;
Outside.killVillagers(numKilled);
},
buttons: {
'end': {
text: _('go home'),
nextScene: 'end'
}
}
},
'death': {
text: [
_('the plague rips through the village.'),
_('the nights are rent with screams.'),
_('the only hope is a quick death.')
],
onLoad: function() {
var numKilled = Math.floor(Math.random() * 80) + 10;
Outside.killVillagers(numKilled);
},
buttons: {
'end': {
text: _('go home'),
nextScene: 'end'
}
}
}
}
},
{ /* Beast attack */
title: _('A Beast Attack'),
2013-07-03 07:56:13 -07:00
isAvailable: function() {
return Engine.activeModule == Outside && $SM.get('game.population', true) > 0;
2013-07-03 07:56:13 -07:00
},
scenes: {
'start': {
text: [
2014-07-13 11:43:19 -04:00
_('a pack of snarling beasts pours out of the trees.'),
_('the fight is short and bloody, but the beasts are repelled.'),
_('the villagers retreat to mourn the dead.')
],
onLoad: function() {
2013-07-03 07:56:13 -07:00
var numKilled = Math.floor(Math.random() * 10) + 1;
Outside.killVillagers(numKilled);
},
2014-07-24 12:00:51 -04:00
reward: {
2014-07-13 11:43:19 -04:00
fur: 100,
meat: 100,
teeth: 10
2014-07-24 12:00:51 -04:00
},
blink: true,
buttons: {
2013-07-03 07:56:13 -07:00
'end': {
2014-02-04 22:27:00 +01:00
text: _('go home'),
2013-07-03 07:56:13 -07:00
nextScene: 'end'
}
}
}
}
2014-07-13 11:43:19 -04:00
},
{ /* Soldier attack */
title: _('A Military Raid'),
2013-07-03 07:56:13 -07:00
isAvailable: function() {
return Engine.activeModule == Outside && $SM.get('game.population', true) > 0 && $SM.get('game.cityCleared');;
2013-07-03 07:56:13 -07:00
},
scenes: {
'start': {
text: [
2014-07-13 11:43:19 -04:00
_('a gunshot rings through the trees.'),
_('well armed men charge out of the forest, firing into the crowd.'),
_('after a skirmish they are driven away, but not without losses.')
],
onLoad: function() {
2013-07-03 07:56:13 -07:00
var numKilled = Math.floor(Math.random() * 40) + 1;
Outside.killVillagers(numKilled);
},
2014-07-13 11:43:19 -04:00
reward: {
bullets: 10,
'cured meat': 50
},
2014-07-24 12:00:51 -04:00
blink: true,
2014-07-13 11:43:19 -04:00
buttons: {
2013-07-03 07:56:13 -07:00
'end': {
2014-02-04 22:27:00 +01:00
text: _('go home'),
2013-07-03 07:56:13 -07:00
nextScene: 'end'
}
}
}
}
2014-07-13 11:43:19 -04:00
}
2013-07-03 07:56:13 -07:00
];