Adding ADR to Github

This commit is contained in:
Michael Townsend
2013-07-03 07:56:13 -07:00
parent 9616c79816
commit 19abccfcc4
36 changed files with 9668 additions and 0 deletions
+325
View File
@@ -0,0 +1,325 @@
/**
* Events that can occur when wandering around the world
**/
Events.Encounters = [
/* Tier 1 */
{ /* Snarling Beast */
title: 'A Snarling Beast',
isAvailable: function() {
return World.getDistance() <= 10 && World.getTerrain() == World.TILE.FOREST;
},
scenes: {
'start': {
combat: true,
enemy: 'snarling beast',
char: 'B',
damage: 1,
hit: 0.8,
attackDelay: 1,
health: 5,
loot: {
'fur': {
min: 1,
max: 3,
chance: 1
},
'meat': {
min: 1,
max: 3,
chance: 1
},
'teeth': {
min: 1,
max: 3,
chance: 0.8
}
},
notification: 'a snarling beast leaps out of the underbrush'
}
}
},
{ /* Gaunt Man */
title: 'A Gaunt Man',
isAvailable: function() {
return World.getDistance() <= 10 && World.getTerrain() == World.TILE.BARRENS;
},
scenes: {
'start': {
combat: true,
enemy: 'gaunt man',
char: 'G',
damage: 2,
hit: 0.8,
attackDelay: 2,
health: 6,
loot: {
'cloth': {
min: 1,
max: 3,
chance: 0.8
},
'teeth': {
min: 1,
max: 2,
chance: 0.8
},
'leather': {
min: 1,
max: 2,
chance: 0.5
}
},
notification: 'a gaunt man approaches, a crazed look in his eye'
}
}
},
{ /* Strange Bird */
title: 'A Strange Bird',
isAvailable: function() {
return World.getDistance() <= 10 && World.getTerrain() == World.TILE.FIELD;
},
scenes: {
'start': {
combat: true,
enemy: 'strange bird',
char: 'B',
damage: 3,
hit: 0.8,
attackDelay: 2,
health: 4,
loot: {
'scales': {
min: 1,
max: 3,
chance: 0.8
},
'teeth': {
min: 1,
max: 2,
chance: 0.5
},
'meat': {
min: 1,
max: 3,
chance: 0.8
}
},
notification: 'a strange looking bird speeds across the plains'
}
}
},
/* Tier 2*/
{ /* Man-eater */
title: 'A Man-Eater',
isAvailable: function() {
return World.getDistance() > 10 && World.getDistance() <= 20 && World.getTerrain() == World.TILE.FOREST;
},
scenes: {
'start': {
combat: true,
enemy: 'man-eater',
char: 'E',
damage: 3,
hit: 0.8,
attackDelay: 1,
health: 25,
loot: {
'fur': {
min: 5,
max: 10,
chance: 1
},
'meat': {
min: 5,
max: 10,
chance: 1
},
'teeth': {
min: 5,
max: 10,
chance: 0.8
}
},
notification: 'a large creature attacks, claws freshly bloodied'
}
}
},
{ /* Scavenger */
title: 'A Scavenger',
isAvailable: function() {
return World.getDistance() > 10 && World.getDistance() <= 20 && World.getTerrain() == World.TILE.BARRENS;
},
scenes: {
'start': {
combat: true,
enemy: 'scavenger',
char: 'S',
damage: 4,
hit: 0.8,
attackDelay: 2,
health: 30,
loot: {
'cloth': {
min: 5,
max: 10,
chance: 0.8
},
'leather': {
min: 5,
max: 10,
chance: 0.8
},
'iron': {
min: 1,
max: 5,
chance: 0.5
}
},
notification: 'a scavenger draws close, hoping for an easy score'
}
}
},
{ /* Huge Lizard */
title: 'A Huge Lizard',
isAvailable: function() {
return World.getDistance() > 10 && World.getDistance() <= 20 && World.getTerrain() == World.TILE.FIELD;
},
scenes: {
'start': {
combat: true,
enemy: 'lizard',
char: 'L',
damage: 5,
hit: 0.8,
attackDelay: 2,
health: 20,
loot: {
'scales': {
min: 5,
max: 10,
chance: 0.8
},
'teeth': {
min: 5,
max: 10,
chance: 0.5
},
'meat': {
min: 5,
max: 10,
chance: 0.8
}
},
notification: 'the grass thrashes wildly as a huge lizard pushes through'
}
}
},
/* Tier 3*/
{ /* Feral Terror */
title: 'A Feral Terror',
isAvailable: function() {
return World.getDistance() > 20 && World.getTerrain() == World.TILE.FOREST;
},
scenes: {
'start': {
combat: true,
enemy: 'feral terror',
char: 'F',
damage: 6,
hit: 0.8,
attackDelay: 1,
health: 45,
loot: {
'fur': {
min: 5,
max: 10,
chance: 1
},
'meat': {
min: 5,
max: 10,
chance: 1
},
'teeth': {
min: 5,
max: 10,
chance: 0.8
}
},
notification: 'a beast, wilder than imagining, erupts out of the foliage'
}
}
},
{ /* Soldier */
title: 'A Soldier',
isAvailable: function() {
return World.getDistance() > 20 && World.getTerrain() == World.TILE.BARRENS;
},
scenes: {
'start': {
combat: true,
enemy: 'soldier',
ranged: true,
char: 'D',
damage: 8,
hit: 0.8,
attackDelay: 2,
health: 50,
loot: {
'cloth': {
min: 5,
max: 10,
chance: 0.8
},
'bullets': {
min: 1,
max: 5,
chance: 0.5
},
'rifle': {
min: 1,
max: 1,
chance: 0.2
}
},
notification: 'a soldier opens fire from across the desert'
}
}
},
{ /* Sniper */
title: 'A Sniper',
isAvailable: function() {
return World.getDistance() > 20 && World.getTerrain() == World.TILE.FIELD;
},
scenes: {
'start': {
combat: true,
enemy: 'sniper',
char: 'S',
damage: 15,
hit: 0.8,
attackDelay: 4,
health: 30,
ranged: true,
loot: {
'cloth': {
min: 5,
max: 10,
chance: 0.8
},
'bullets': {
min: 1,
max: 5,
chance: 0.5
},
'rifle': {
min: 1,
max: 1,
chance: 0.2
}
},
notification: 'a shot rings out, from somewhere in the long grass'
}
}
},
];
+65
View File
@@ -0,0 +1,65 @@
/**
* Events that can occur when any module is active (Except World. It's special.)
**/
Events.Global = [
{ /* The Thief */
title: 'The Thief',
isAvailable: function() {
return (Engine.activeModule == Room || Engine.activeModule == Outside) && State.thieves == 1;
},
scenes: {
'start': {
text: [
'the villagers haul a filthy man out of the store room.',
"say his folk have been skimming the supplies.",
'say he should be strung up as an example.'
],
notification: 'a thief is caught',
buttons: {
'kill': {
text: 'hang him',
nextScene: {1: 'hang'}
},
'spare': {
text: 'spare him',
nextScene: {1: 'spare'}
}
}
},
'hang': {
text: [
'the villagers hang the thief high in front of the store room.',
'the point is made. in the next few days, the missing supplies are returned.'
],
onLoad: function() {
State.thieves = 2;
Engine.removeIncome('thieves');
Engine.addStores(State.stolen);
},
buttons: {
'leave': {
text: 'leave',
nextScene: 'end'
}
}
},
'spare': {
text: [
"the man says he's grateful. says he won't come around any more.",
"shares what he knows about sneaking before he goes."
],
onLoad: function() {
State.thieves = 2;
Engine.removeIncome('thieves');
Engine.addPerk('stealthy');
},
buttons: {
'leave': {
text: 'leave',
nextScene: 'end'
}
}
}
}
}
];
+127
View File
@@ -0,0 +1,127 @@
/**
* Events that can occur when the Outside module is active
**/
Events.Outside = [
{ /* Ruined traps */
title: 'A Ruined Trap',
isAvailable: function() {
return Engine.activeModule == Outside && Outside.numBuilding('trap') > 0;
},
scenes: {
'start': {
text: [
'some of the traps have been torn apart.',
'large prints lead away, into the forest.'
],
onLoad: function() {
var numWrecked = Math.floor(Math.random() * Outside.numBuilding('trap')) + 1;
Outside.addBuilding('trap', -numWrecked);
Outside.updateVillage();
Outside.updateTrapButton();
},
notification: 'some traps have been destroyed',
buttons: {
'track': {
text: 'track them',
nextScene: {0.5: 'nothing', 1: 'catch'}
},
'ignore': {
text: 'ignore them',
nextScene: 'end'
}
}
},
'nothing': {
text: [
'the tracks disappear after just a few minutes.',
'the forest is silent.'
],
buttons: {
'end': {
text: 'go home',
nextScene: 'end'
}
}
},
'catch': {
text: [
'not far from the village lies a large beast, its fur matted with blood.',
'it puts up little resistance before the knife.'
],
reward: {
fur: 100,
meat: 100,
teeth: 10
},
buttons: {
'end': {
text: 'go home',
nextScene: 'end'
}
}
}
}
},
{ /* Beast attack */
title: 'A Beast Attack',
isAvailable: function() {
return Engine.activeModule == Outside && Outside.getPopulation() > 0;
},
scenes: {
'start': {
text: [
'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() {
var numKilled = Math.floor(Math.random() * 10) + 1;
Outside.killVillagers(numKilled);
},
reward: {
fur: 100,
meat: 100,
teeth: 10
},
buttons: {
'end': {
text: 'go home',
nextScene: 'end'
}
}
}
}
},
{ /* Soldier attack */
title: 'A Military Raid',
isAvailable: function() {
return Engine.activeModule == Outside && Outside.getPopulation() > 0 && State.cityCleared;
},
scenes: {
'start': {
text: [
'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() {
var numKilled = Math.floor(Math.random() * 40) + 1;
Outside.killVillagers(numKilled);
},
reward: {
bullets: 10,
'cured meat': 50
},
buttons: {
'end': {
text: 'go home',
nextScene: 'end'
}
}
}
}
}
];
+506
View File
@@ -0,0 +1,506 @@
/**
* Events that can occur when the Room module is active
**/
Events.Room = [
{ /* The Nomad -- Merchant */
title: 'The Nomad',
isAvailable: function() {
return Engine.activeModule == Room && Engine.getStore('fur') > 0;
},
scenes: {
'start': {
text: [
'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."
],
notification: 'a nomad arrives, looking to trade',
buttons: {
'buyScales': {
text: 'buy scales',
cost: { 'fur': 100 },
reward: { 'scales': 1 }
},
'buyTeeth': {
text: 'buy teeth',
cost: { 'fur': 200 },
reward: { 'teeth': 1 }
},
'buyBait': {
text: 'buy bait',
cost: { 'fur': 5 },
reward: { 'bait': 1 },
notification: 'traps are more effective with bait.'
},
'buyCompass': {
available: function() {
return Engine.getStore('compass') < 1;
},
text: 'buy compass',
cost: { fur: 300, scales: 15, teeth: 5 },
reward: { 'compass': 1 },
notification: 'the old compass is dented and dusty, but it looks to work.',
onChoose: Engine.openPath
},
'goodbye': {
text: 'say goodbye',
nextScene: 'end'
}
}
}
}
}, { /* Noises Outside -- gain wood/fur */
title: 'Noises',
isAvailable: function() {
return Engine.activeModule == Room && Engine.storeAvailable('wood');
},
scenes: {
'start': {
text: [
'through the walls, shuffling noises can be heard.',
"can't tell what they're up to."
],
notification: 'strange noises can be heard through the walls',
buttons: {
'investigate': {
text: 'investigate',
nextScene: { 0.3: 'stuff', 1: 'nothing' }
},
'ignore': {
text: 'ignore them',
nextScene: 'end'
}
}
},
'nothing': {
text: [
'vague shapes move, just out of sight.',
'the sounds stop.'
],
buttons: {
'backinside': {
text: 'go back inside',
nextScene: 'end'
}
}
},
'stuff': {
reward: { wood: 100, fur: 10 },
text: [
'a bundle of stick lies just beyond the threshold, wrapped in course furs.',
'the night is silent.'
],
buttons: {
'backinside': {
text: 'go back inside',
nextScene: 'end'
}
}
}
}
},
{ /* Noises Inside -- trade wood for better good */
title: 'Noises',
isAvailable: function() {
return Engine.activeModule == Room && Engine.storeAvailable('wood');
},
scenes: {
start: {
text: [
'scratching noises can be heard from the store room.',
'something\'s in there.'
],
notification: 'something\'s in the store room',
buttons: {
'investigate': {
text: 'investigate',
nextScene: { 0.5: 'scales', 0.8: 'teeth', 1: 'cloth' }
},
'ignore': {
text: 'ignore them',
nextScene: 'end'
}
}
},
scales: {
text: [
'some wood is missing.',
'the ground is littered with small scales'
],
onLoad: function() {
var numWood = Engine.getStore('wood');
numWood = Math.floor(numWood * 0.1);
if(numWood == 0) numWood = 1;
var numScales = Math.floor(numWood / 5);
if(numScales == 0) numScales = 1;
Engine.addStores({wood: -numWood, scales: numScales});
},
buttons: {
'leave': {
text: 'leave',
nextScene: 'end'
}
}
},
teeth: {
text: [
'some wood is missing.',
'the ground is littered with small teeth'
],
onLoad: function() {
var numWood = Engine.getStore('wood');
numWood = Math.floor(numWood * 0.1);
if(numWood == 0) numWood = 1;
var numTeeth = Math.floor(numWood / 5);
if(numTeeth == 0) numTeeth = 1;
Engine.addStores({wood: -numWood, teeth: numTeeth});
},
buttons: {
'leave': {
text: 'leave',
nextScene: 'end'
}
}
},
cloth: {
text: [
'some wood is missing.',
'the ground is littered with scraps of cloth'
],
onLoad: function() {
var numWood = Engine.getStore('wood');
numWood = Math.floor(numWood * 0.1);
if(numWood == 0) numWood = 1;
var numCloth = Math.floor(numWood / 5);
if(numCloth == 0) numCloth = 1;
Engine.addStores({wood: -numWood, cloth: numCloth});
},
buttons: {
'leave': {
text: 'leave',
nextScene: 'end'
}
}
}
}
},
{ /* The Beggar -- trade fur for better good */
title: 'The Beggar',
isAvailable: function() {
return Engine.activeModule == Room && Engine.storeAvailable('fur');
},
scenes: {
start: {
text: [
'a beggar arrives.',
'asks for any spare furs to keep him warm at night.'
],
notification: 'a beggar arrives',
buttons: {
'50furs': {
text: 'give 50',
cost: {fur: 50},
nextScene: { 0.5: 'scales', 0.8: 'teeth', 1: 'cloth' }
},
'100furs': {
text: 'give 100',
cost: {fur: 100},
nextScene: { 0.5: 'teeth', 0.8: 'scales', 1: 'cloth' }
},
'deny': {
text: 'turn him away',
nextScene: 'end'
}
}
},
scales: {
reward: { scales: 20 },
text: [
'the beggar thanks you.',
'leaves a pile of small scales behind.'
],
buttons: {
'leave': {
text: 'say goodbye',
nextScene: 'end'
}
}
},
teeth: {
reward: { teeth: 20 },
text: [
'the beggar thanks you.',
'leaves a pile of small teeth behind.'
],
buttons: {
'leave': {
text: 'say goodbye',
nextScene: 'end'
}
}
},
cloth: {
reward: { cloth: 20 },
text: [
'the beggar thanks you.',
'leaves some scraps of cloth behind.'
],
buttons: {
'leave': {
text: 'say goodbye',
nextScene: 'end'
}
}
}
}
},
{ /* Mysterious Wanderer -- wood gambling */
title: 'The Mysterious Wanderer',
isAvailable: function() {
return Engine.activeModule == Room && Engine.storeAvailable('wood');
},
scenes: {
start: {
text: [
'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."
],
notification: 'a mysterious wanderer arrives',
buttons: {
'100wood': {
text: 'give 100',
cost: {wood: 100},
nextScene: { 1: '100wood'}
},
'500wood': {
text: 'give 500',
cost: {wood: 500},
nextScene: { 1: '500wood' }
},
'deny': {
text: 'turn him away',
nextScene: 'end'
}
}
},
'100wood': {
text: [
'the wanderer leaves, cart loaded with wood',
],
onLoad: function() {
if(Math.random() < 0.5) {
setTimeout(function() {
Engine.addStore('wood', 300);
Notifications.notify(Room, 'the mysterious wanderer returns, cart piled high with wood.');
}, 60 * 1000);
}
},
buttons: {
'leave': {
text: 'say goodbye',
nextScene: 'end'
}
}
},
'500wood': {
text: [
'the wanderer leaves, cart loaded with wood',
],
onLoad: function() {
if(Math.random() < 0.3) {
setTimeout(function() {
Engine.addStore('wood', 1500);
Notifications.notify(Room, 'the mysterious wanderer returns, cart piled high with wood.');
}, 60 * 1000);
}
},
buttons: {
'leave': {
text: 'say goodbye',
nextScene: 'end'
}
}
}
}
},
{ /* Mysterious Wanderer -- fur gambling */
title: 'The Mysterious Wanderer',
isAvailable: function() {
return Engine.activeModule == Room && Engine.storeAvailable('fur');
},
scenes: {
start: {
text: [
'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."
],
notification: 'a mysterious wanderer arrives',
buttons: {
'100fur': {
text: 'give 100',
cost: {fur: 100},
nextScene: { 1: '100fur'}
},
'500fur': {
text: 'give 500',
cost: {fur: 500},
nextScene: { 1: '500fur' }
},
'deny': {
text: 'turn her away',
nextScene: 'end'
}
}
},
'100fur': {
text: [
'the wanderer leaves, cart loaded with furs',
],
onLoad: function() {
if(Math.random() < 0.5) {
setTimeout(function() {
Engine.addStore('fur', 300);
Notifications.notify(Room, 'the mysterious wanderer returns, cart piled high with furs.');
}, 60 * 1000);
}
},
buttons: {
'leave': {
text: 'say goodbye',
nextScene: 'end'
}
}
},
'500fur': {
text: [
'the wanderer leaves, cart loaded with furs',
],
onLoad: function() {
if(Math.random() < 0.3) {
setTimeout(function() {
Engine.addStore('fur', 1500);
Notifications.notify(Room, 'the mysterious wanderer returns, cart piled high with furs.');
}, 60 * 1000);
}
},
buttons: {
'leave': {
text: 'say goodbye',
nextScene: 'end'
}
}
}
}
},
{ /* The Scout -- Map Merchant */
title: 'The Scout',
isAvailable: function() {
return Engine.activeModule == Room && typeof State.world == 'object';
},
scenes: {
'start': {
text: [
"the scout says she's been all over.",
"willing to talk about it, for a price."
],
notification: 'a scout stops for the night',
buttons: {
'buyMap': {
text: 'buy map',
cost: { 'fur': 200, 'scales': 10 },
notification: 'the map uncovers a bit of the world',
onChoose: World.applyMap
},
'learn': {
text: 'learn scouting',
cost: { 'fur': 1000, 'scales': 50, 'teeth': 20 },
available: function() {
return !Engine.hasPerk('scout');
},
onChoose: function() {
Engine.addPerk('scout');
}
},
'leave': {
text: 'say goodbye',
nextScene: 'end'
}
}
}
}
},
{ /* The Wandering Master */
title: 'The Master',
isAvailable: function() {
return Engine.activeModule == Room && typeof State.world == 'object';
},
scenes: {
'start': {
text: [
'an old wanderer arrives.',
'he smiles warmly and asks for lodgings for the night.'
],
notification: 'an old wanderer arrives',
buttons: {
'agree': {
text: 'agree',
cost: {
'cured meat': 100,
'fur': 100,
'torch': 1
},
nextScene: {1: 'agree'}
},
'deny': {
text: 'turn him away',
nextScene: 'end'
}
}
},
'agree': {
text: [
'in exchange, the wanderer offers his wisdom.'
],
buttons: {
'evasion': {
text: 'evasion',
available: function() {
return !Engine.hasPerk('evasive');
},
onChoose: function() {
Engine.addPerk('evasive');
},
nextScene: 'end'
},
'precision': {
text: 'precision',
available: function() {
return !Engine.hasPerk('precise');
},
onChoose: function() {
Engine.addPerk('precise');
},
nextScene: 'end'
},
'force': {
text: 'force',
available: function() {
return !Engine.hasPerk('barbarian');
},
onChoose: function() {
Engine.addPerk('barbarian');
},
nextScene: 'end'
},
'nothing': {
text: 'nothing',
nextScene: 'end'
}
}
}
}
}
]
File diff suppressed because it is too large Load Diff