mirror of
https://github.com/doublespeakgames/adarkroom.git
synced 2026-05-28 00:01:54 +08:00
Finished first version of medicine feature.
This commit is contained in:
@@ -438,6 +438,7 @@ body.noMask #description {
|
||||
|
||||
#buttons > .button {
|
||||
margin: 0 5px 5px;
|
||||
margin-right: 15px;
|
||||
}
|
||||
|
||||
/* Combat! */
|
||||
|
||||
+2
-2
@@ -104,10 +104,10 @@ var Events = {
|
||||
Events.createAttackButton('fists').prependTo(btns);
|
||||
}
|
||||
|
||||
Events.createEatMeatButton().appendTo(btns);
|
||||
if((Path.outfit['medicine'] || 0) != 0) {
|
||||
Events.createUseMedsButton().prependTo(btns);
|
||||
Events.createUseMedsButton().appendTo(btns);
|
||||
}
|
||||
Events.createEatMeatButton().prependTo(btns);
|
||||
|
||||
// Set up the enemy attack timer
|
||||
Events._enemyAttackTimer = setTimeout(Events.enemyAttack, scene.attackDelay * 1000);
|
||||
|
||||
@@ -109,6 +109,46 @@ Events.Encounters = [
|
||||
}
|
||||
},
|
||||
/* Tier 2*/
|
||||
{ /* Shivering Man */
|
||||
title: 'A Shivering Man',
|
||||
isAvailable: function() {
|
||||
return World.getDistance() > 10 && World.getDistance() <= 20 && World.getTerrain() == World.TILE.BARRENS;
|
||||
},
|
||||
scenes: {
|
||||
'start': {
|
||||
combat: true,
|
||||
enemy: 'shivering man',
|
||||
char: 'S',
|
||||
damage: 5,
|
||||
hit: 0.5,
|
||||
attackDelay: 1,
|
||||
health: 20,
|
||||
loot: {
|
||||
'cloth': {
|
||||
min: 1,
|
||||
max: 1,
|
||||
chance: 0.2
|
||||
},
|
||||
'teeth': {
|
||||
min: 1,
|
||||
max: 2,
|
||||
chance: 0.8
|
||||
},
|
||||
'leather': {
|
||||
min: 1,
|
||||
max: 1,
|
||||
chance: 0.2
|
||||
},
|
||||
'medicine': {
|
||||
min: 1,
|
||||
max: 3,
|
||||
chance: 0.7
|
||||
}
|
||||
},
|
||||
notification: 'a shivering man approaches and attacks with surprising strength'
|
||||
}
|
||||
}
|
||||
},
|
||||
{ /* Man-eater */
|
||||
title: 'A Man-Eater',
|
||||
isAvailable: function() {
|
||||
|
||||
@@ -63,6 +63,120 @@ Events.Outside = [
|
||||
}
|
||||
},
|
||||
|
||||
{ /* Sickness */
|
||||
title: 'Sickness',
|
||||
isAvailable: function() {
|
||||
return Engine.activeModule == Outside && Outside.getPopulation() > 10 && Outside.getPopulation() < 50;
|
||||
},
|
||||
scenes: {
|
||||
'start': {
|
||||
text: [
|
||||
'a sickness is spreading through the village.',
|
||||
'medicine is needed immediately.'
|
||||
],
|
||||
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 && Outside.getPopulation() > 50;
|
||||
},
|
||||
scenes: {
|
||||
'start': {
|
||||
text: [
|
||||
'a terrible plague is fast spreading through the village.',
|
||||
'medicine is needed immediately.'
|
||||
],
|
||||
buttons: {
|
||||
'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',
|
||||
isAvailable: function() {
|
||||
|
||||
+85
-1
@@ -502,5 +502,89 @@ Events.Room = [
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
{ /* The Sick Man */
|
||||
title: 'The Sick Man',
|
||||
isAvailable: function() {
|
||||
return Engine.activeModule == Room && typeof State.world == 'object';
|
||||
},
|
||||
scenes: {
|
||||
'start': {
|
||||
text: [
|
||||
"a man hobbles up, coughing.",
|
||||
"he begs you for medicine."
|
||||
],
|
||||
notification: 'a sick man hobbles up',
|
||||
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 thanks you and gives you a reward.",
|
||||
'some weird metal he picked up on his travels.'
|
||||
],
|
||||
onLoad: function() {
|
||||
Engine.addStore('alien alloy', 1);
|
||||
},
|
||||
buttons: {
|
||||
'bye': {
|
||||
text: 'say goodbye',
|
||||
nextScene: 'end'
|
||||
}
|
||||
}
|
||||
},
|
||||
'cells': {
|
||||
text: [
|
||||
"the man thanks you and gives you a reward.",
|
||||
'some weird glowing boxes he picked up on his travels.'
|
||||
],
|
||||
onLoad: function() {
|
||||
Engine.addStore('energy cell', 3);
|
||||
},
|
||||
buttons: {
|
||||
'bye': {
|
||||
text: 'say goodbye',
|
||||
nextScene: 'end'
|
||||
}
|
||||
}
|
||||
},
|
||||
'scales': {
|
||||
text: [
|
||||
"the man thanks you and gives you a reward.",
|
||||
'all he has are some scales.'
|
||||
],
|
||||
onLoad: function() {
|
||||
Engine.addStore('scales', 5);
|
||||
},
|
||||
buttons: {
|
||||
'bye': {
|
||||
text: 'say goodbye',
|
||||
nextScene: 'end'
|
||||
}
|
||||
}
|
||||
},
|
||||
'nothing': {
|
||||
text: [
|
||||
"the man thanks you and hobbles off."
|
||||
],
|
||||
buttons: {
|
||||
'bye': {
|
||||
text: 'say goodbye',
|
||||
nextScene: 'end'
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
];
|
||||
+40
-35
@@ -583,7 +583,7 @@ Events.Setpieces = {
|
||||
buttons: {
|
||||
'enter': {
|
||||
text: 'enter',
|
||||
nextScene: {0.5: 'b5', 1: 'c7'},
|
||||
nextScene: {0.5: 'b5', 1: 'end5'},
|
||||
cost: {torch: 1}
|
||||
},
|
||||
'leave': {
|
||||
@@ -765,7 +765,7 @@ Events.Setpieces = {
|
||||
buttons: {
|
||||
'continue': {
|
||||
text: 'continue',
|
||||
nextScene: {0.3: 'c7', 1: 'c8'}
|
||||
nextScene: {0.3: 'end5', 1: 'end6'}
|
||||
},
|
||||
'leave': {
|
||||
text: 'leave town',
|
||||
@@ -930,37 +930,6 @@ Events.Setpieces = {
|
||||
}
|
||||
}
|
||||
},
|
||||
'c7': {
|
||||
text: [
|
||||
'you search the clinic and find some medicine abandoned in the drawers.'
|
||||
],
|
||||
loot: {
|
||||
'medicine': {
|
||||
min: 2,
|
||||
max: 5,
|
||||
chance: 1
|
||||
}
|
||||
},
|
||||
buttons: {
|
||||
'leave': {
|
||||
text: 'leave town',
|
||||
nextScene: 'end'
|
||||
}
|
||||
}
|
||||
},
|
||||
'c8': {
|
||||
text: [
|
||||
'the clinic has been ransacked.',
|
||||
'only dust and stains remain.'
|
||||
],
|
||||
loot: {},
|
||||
buttons: {
|
||||
'leave': {
|
||||
text: 'leave town',
|
||||
nextScene: 'end'
|
||||
}
|
||||
}
|
||||
},
|
||||
'd1': {
|
||||
combat: true,
|
||||
enemy: 'scavenger',
|
||||
@@ -1178,6 +1147,42 @@ Events.Setpieces = {
|
||||
nextScene: 'end'
|
||||
}
|
||||
}
|
||||
},
|
||||
'end5': {
|
||||
text: [
|
||||
'you search the clinic and find some medicine abandoned in the drawers.'
|
||||
],
|
||||
onLoad: function() {
|
||||
World.clearDungeon();
|
||||
},
|
||||
loot: {
|
||||
'medicine': {
|
||||
min: 2,
|
||||
max: 5,
|
||||
chance: 1
|
||||
}
|
||||
},
|
||||
buttons: {
|
||||
'leave': {
|
||||
text: 'leave town',
|
||||
nextScene: 'end'
|
||||
}
|
||||
}
|
||||
},
|
||||
'end6': {
|
||||
text: [
|
||||
'the clinic has been ransacked.',
|
||||
'only dust and stains remain.'
|
||||
],
|
||||
onLoad: function() {
|
||||
World.clearDungeon();
|
||||
},
|
||||
buttons: {
|
||||
'leave': {
|
||||
text: 'leave town',
|
||||
nextScene: 'end'
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
@@ -2202,7 +2207,7 @@ Events.Setpieces = {
|
||||
buttons: {
|
||||
'continue': {
|
||||
text: 'continue',
|
||||
nextScene: 'end14'
|
||||
nextScene: {1: 'end14'}
|
||||
}
|
||||
}
|
||||
},
|
||||
@@ -2227,7 +2232,7 @@ Events.Setpieces = {
|
||||
buttons: {
|
||||
'continue': {
|
||||
text: 'continue',
|
||||
nextScene: 'end13'
|
||||
nextScene: {1: 'end13'}
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
+2
-1
@@ -156,7 +156,8 @@ var Path = {
|
||||
'laser rifle': {type: 'weapon' },
|
||||
'energy cell': {type: 'tool' },
|
||||
'bayonet': {type: 'weapon' },
|
||||
'charm': {type: 'tool'}
|
||||
'charm': {type: 'tool'},
|
||||
'medicine': {type: 'tool'}
|
||||
}, Room.Craftables);
|
||||
|
||||
for(var k in carryable) {
|
||||
|
||||
+1
-1
@@ -815,7 +815,7 @@ var World = {
|
||||
},
|
||||
|
||||
leaveItAtHome: function(thing) {
|
||||
return thing != 'cured meat' && thing != 'bullets' && thing != 'energy cell' && thing != 'charm'
|
||||
return thing != 'cured meat' && thing != 'bullets' && thing != 'energy cell' && thing != 'charm' && thing != 'medicine'
|
||||
&& typeof World.Weapons[thing] == 'undefined' && typeof Room.Craftables[thing] == 'undefined';
|
||||
},
|
||||
|
||||
|
||||
Reference in New Issue
Block a user