diff --git a/css/main.css b/css/main.css index 629ed05..da93235 100644 --- a/css/main.css +++ b/css/main.css @@ -438,6 +438,7 @@ body.noMask #description { #buttons > .button { margin: 0 5px 5px; + margin-right: 15px; } /* Combat! */ diff --git a/script/events.js b/script/events.js index 6219a4c..ba12210 100644 --- a/script/events.js +++ b/script/events.js @@ -7,6 +7,7 @@ var Events = { _PANEL_FADE: 200, _FIGHT_SPEED: 100, _EAT_COOLDOWN: 5, + _MEDS_COOLDOWN: 7, STUN_DURATION: 4000, init: function(options) { @@ -103,7 +104,10 @@ var Events = { Events.createAttackButton('fists').prependTo(btns); } - Events.createEatMeatButton().prependTo(btns); + Events.createEatMeatButton().appendTo(btns); + if((Path.outfit['medicine'] || 0) != 0) { + Events.createUseMedsButton().appendTo(btns); + } // Set up the enemy attack timer Events._enemyAttackTimer = setTimeout(Events.enemyAttack, scene.attackDelay * 1000); @@ -129,6 +133,26 @@ var Events = { return btn; }, + createUseMedsButton: function(cooldown) { + if (cooldown == null) { + cooldown = Events._MEDS_COOLDOWN; + } + + var btn = new Button.Button({ + id: 'meds', + text: 'use meds', + cooldown: cooldown, + click: Events.useMeds, + cost: { 'medicine': 1 } + }); + + if((Path.outfit['medicine'] || 0) == 0) { + Button.setDisabled(btn, true); + } + + return btn; + }, + createAttackButton: function(weaponName) { var weapon = World.Weapons[weaponName]; var cd = weapon.cooldown; @@ -192,6 +216,28 @@ var Events = { } }, + useMeds: function() { + if(Path.outfit['medicine'] > 0) { + Path.outfit['medicine']--; + World.updateSupplies(); + if(Path.outfit['medicine'] == 0) { + Button.setDisabled($('#meds'), true); + } + + var hp = World.health; + hp += World.medsHeal(); + hp = hp > World.getMaxHealth() ? World.getMaxHealth() : hp; + World.setHp(hp); + + if(Events.activeEvent()) { + var w = $('#wanderer'); + w.data('hp', hp); + Events.updateFighterDiv(w); + Events.drawFloatText('+' + World.medsHeal(), '#wanderer .hp'); + } + } + }, + useWeapon: function(btn) { if(Events.activeEvent()) { var weaponName = btn.attr('id').substring(7).replace('-', ' '); @@ -426,6 +472,9 @@ var Events = { }).appendTo(btns); Events.createEatMeatButton(0).appendTo(btns); + if((Path.outfit['medicine'] || 0) != 0) { + Events.createUseMedsButton(0).appendTo(btns); + } } } catch(e) { // It is possible to die and win if the timing is perfect. Just let it fail. diff --git a/script/events/encounters.js b/script/events/encounters.js index 891f48d..bcaf26c 100644 --- a/script/events/encounters.js +++ b/script/events/encounters.js @@ -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() { @@ -169,11 +209,16 @@ Events.Encounters = [ max: 10, chance: 0.8 }, - 'iron': { - min: 1, - max: 5, - chance: 0.5 - } + 'iron': { + min: 1, + max: 5, + chance: 0.5 + }, + 'medicine': { + min: 1, + max: 2, + chance: 0.1 + } }, notification: 'a scavenger draws close, hoping for an easy score' } @@ -271,16 +316,21 @@ Events.Encounters = [ max: 10, chance: 0.8 }, - 'bullets': { - min: 1, - max: 5, - chance: 0.5 - }, - 'rifle': { - min: 1, - max: 1, - chance: 0.2 - } + 'bullets': { + min: 1, + max: 5, + chance: 0.5 + }, + 'rifle': { + min: 1, + max: 1, + chance: 0.2 + }, + 'medicine': { + min: 1, + max: 2, + chance: 0.1 + } }, notification: 'a soldier opens fire from across the desert' } @@ -307,16 +357,21 @@ Events.Encounters = [ max: 10, chance: 0.8 }, - 'bullets': { - min: 1, - max: 5, - chance: 0.5 - }, - 'rifle': { - min: 1, - max: 1, - chance: 0.2 - } + 'bullets': { + min: 1, + max: 5, + chance: 0.5 + }, + 'rifle': { + min: 1, + max: 1, + chance: 0.2 + }, + 'medicine': { + min: 1, + max: 2, + chance: 0.1 + } }, notification: 'a shot rings out, from somewhere in the long grass' } diff --git a/script/events/outside.js b/script/events/outside.js index c6a1db0..aa1b7c7 100644 --- a/script/events/outside.js +++ b/script/events/outside.js @@ -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() { diff --git a/script/events/room.js b/script/events/room.js index aebe941..246ff06 100644 --- a/script/events/room.js +++ b/script/events/room.js @@ -215,7 +215,7 @@ Events.Room = [ scales: { reward: { scales: 20 }, text: [ - 'the beggar thanks you.', + 'the beggar expresses his thanks.', 'leaves a pile of small scales behind.' ], buttons: { @@ -228,7 +228,7 @@ Events.Room = [ teeth: { reward: { teeth: 20 }, text: [ - 'the beggar thanks you.', + 'the beggar expresses his thanks.', 'leaves a pile of small teeth behind.' ], buttons: { @@ -241,7 +241,7 @@ Events.Room = [ cloth: { reward: { cloth: 20 }, text: [ - 'the beggar thanks you.', + 'the beggar expresses his thanks.', 'leaves some scraps of cloth behind.' ], buttons: { @@ -502,5 +502,92 @@ 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 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 is thankful.", + 'he leaves 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 is thankful.", + 'he leaves 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 is thankful.", + 'he leaves 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 expresses his thanks and hobbles off." + ], + buttons: { + 'bye': { + text: 'say goodbye', + nextScene: 'end' + } + } + } + } } -] \ No newline at end of file +]; \ No newline at end of file diff --git a/script/events/setpieces.js b/script/events/setpieces.js index af55075..79681a4 100644 --- a/script/events/setpieces.js +++ b/script/events/setpieces.js @@ -210,6 +210,11 @@ Events.Setpieces = { min: 1, max: 3, chance: 0.5 + }, + 'medicine': { + min: 1, + max: 2, + chance: 0.1 } }, buttons: { @@ -444,6 +449,11 @@ Events.Setpieces = { min: 1, max: 3, chance: 0.3 + }, + 'medicine': { + min: 1, + max: 4, + chance: 0.15 } }, onLoad: function() { @@ -470,7 +480,12 @@ Events.Setpieces = { min: 1, max: 3, chance: 0.5 - } + }, + 'medicine': { + min: 1, + max: 3, + chance: 0.3 + } }, onLoad: function() { World.clearDungeon(); @@ -496,7 +511,7 @@ Events.Setpieces = { buttons: { 'enter': { text: 'explore', - nextScene: {0.5: 'a1', 1: 'a2'} + nextScene: {0.3: 'a1', 0.7: 'a3', 1: 'a2'} }, 'leave': { text: 'leave', @@ -522,6 +537,7 @@ Events.Setpieces = { } } }, + 'a2': { combat: true, enemy: 'thug', @@ -559,6 +575,23 @@ Events.Setpieces = { } } }, + 'a3': { + text: [ + "a squat building up ahead.", + 'a green cross barely visible behind grimy windows.' + ], + buttons: { + 'enter': { + text: 'enter', + nextScene: {0.5: 'b5', 1: 'end5'}, + cost: {torch: 1} + }, + 'leave': { + text: 'leave town', + nextScene: 'end' + } + } + }, 'b1': { text: [ 'a small cache of supplies is tucked inside a rusting locker.' @@ -578,7 +611,12 @@ Events.Setpieces = { min: 1, max: 5, chance: 0.3 - } + }, + 'medicine': { + min: 1, + max: 3, + chance: 0.05 + } }, buttons: { 'continue': { @@ -610,11 +648,11 @@ Events.Setpieces = { max: 10, chance: 0.8 }, - 'cured meat': { - min: 1, - max: 5, - chance: 0.5 - } + 'cured meat': { + min: 1, + max: 5, + chance: 0.5 + } }, notification: 'a scavenger waits just inside the door.', buttons: { @@ -680,6 +718,11 @@ Events.Setpieces = { min: 1, max: 5, chance: 0.3 + }, + 'medicine': { + min: 1, + max: 3, + chance: 0.1 } }, buttons: { @@ -693,6 +736,43 @@ Events.Setpieces = { } } }, + 'b5': { + combat: true, + enemy: 'madman', + char: 'M', + damage: 6, + hit: 0.3, + attackDelay: 1, + health: 10, + loot: { + 'cloth': { + min: 2, + max: 4, + chance: 0.3 + }, + 'cured meat': { + min: 1, + max: 5, + chance: 0.9 + }, + 'medicine': { + min: 1, + max: 2, + chance: 0.4 + } + }, + notification: 'a madman attacks, screeching.', + buttons: { + 'continue': { + text: 'continue', + nextScene: {0.3: 'end5', 1: 'end6'} + }, + 'leave': { + text: 'leave town', + nextScene: 'end' + } + } + }, 'c1': { combat: true, enemy: 'thug', @@ -906,11 +986,11 @@ Events.Setpieces = { max: 10, chance: 0.8 }, - 'steel sword': { - min: 1, - max: 1, - chance: 0.5 - } + 'steel sword': { + min: 1, + max: 1, + chance: 0.5 + } }, notification: "a man stands over a dead wanderer. notices he's not alone.", buttons: { @@ -952,6 +1032,11 @@ Events.Setpieces = { min: 1, max: 5, chance: 0.5 + }, + 'medicine': { + min: 1, + max: 2, + chance: 0.3 } }, buttons: { @@ -1049,6 +1134,11 @@ Events.Setpieces = { min: 1, max: 5, chance: 0.5 + }, + 'medicine': { + min: 1, + max: 2, + chance: 0.1 } }, buttons: { @@ -1057,6 +1147,42 @@ Events.Setpieces = { nextScene: 'end' } } + }, + 'end5': { + text: [ + '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' + } + } } } }, @@ -1073,7 +1199,7 @@ Events.Setpieces = { buttons: { 'enter': { text: 'explore', - nextScene: {0.4: 'a1', 0.8: 'a2', 1: 'a3'} + nextScene: {0.2: 'a1', 0.5: 'a2', 0.8: 'a3', 1: 'a4'} }, 'leave': { text: 'leave', @@ -1129,6 +1255,22 @@ Events.Setpieces = { } } }, + 'a4': { + text: [ + 'the shell of an abandoned hospital looms ahead.' + ], + buttons: { + 'enter': { + text: 'enter', + cost: { 'torch': 1 }, + nextScene: {0.5: 'b7', 1: 'b8'} + }, + 'leave': { + text: 'leave city', + nextScene: 'end' + } + } + }, 'b1': { text: [ 'the old tower seems mostly intact.', @@ -1274,16 +1416,21 @@ Events.Setpieces = { max: 5, chance: 0.8 }, - 'cloth': { - min: 1, - max: 5, - chance: 0.5 - }, - 'leather': { - min: 1, - max: 1, - chance: 0.2 - } + 'cloth': { + min: 1, + max: 5, + chance: 0.5 + }, + 'leather': { + min: 1, + max: 1, + chance: 0.2 + }, + 'medicine': { + min: 1, + max: 3, + chance: 0.05 + } }, buttons: { 'continue': { @@ -1311,6 +1458,59 @@ Events.Setpieces = { nextScene: 'end' } } + }, + 'b7': { + text: [ + 'empty corridors.', + 'the place has been swept clean by scavengers.' + ], + buttons: { + 'continue': { + text: 'continue', + nextScene: {0.3: 'c12', 0.7: 'c10', 1: 'c11'} + }, + 'leave': { + text: 'leave city', + nextScene: 'end' + } + } + }, + 'b8': { + notification: 'an old man bursts through a door, wielding a scalpel.', + combat: true, + enemy: 'old man', + char: 'M', + damage: 3, + hit: 0.5, + attackDelay: 2, + health: 10, + loot: { + 'cured meat': { + min: 1, + max: 3, + chance: 0.5 + }, + 'cloth': { + min: 1, + max: 5, + chance: 0.8 + }, + 'medicine': { + min: 1, + max: 2, + chance: 0.5 + } + }, + buttons: { + 'continue': { + text: 'continue', + nextScene: {0.3: 'c13', 0.7: 'c11', 1: 'end15'} + }, + 'leave': { + text: 'leave city', + nextScene: 'end' + } + } }, 'c1': { notification: 'a thug is waiting on the other side of the wall.', @@ -1501,6 +1701,11 @@ Events.Setpieces = { min: 1, max: 1, chance: 0.01 + }, + 'medicine': { + min: 1, + max: 4, + chance: 0.5 } }, buttons: { @@ -1539,6 +1744,123 @@ Events.Setpieces = { } }, + 'c10': { + text: [ + 'someone has locked and barricaded the door to this operating theatre.' + ], + buttons: { + 'enter': { + text: 'continue', + nextScene: {0.2: 'end12', 0.6: 'd10', 1: 'd11'} + }, + 'leave': { + text: 'leave city', + nextScene: 'end' + } + } + }, + + 'c11': { + notification: 'a tribe of elderly squatters is camped out in this ward.', + combat: true, + enemy: 'squatters', + plural: true, + char: 'SSS', + damage: 2, + hit: 0.7, + attackDelay: 0.5, + health: 40, + loot: { + 'cured meat': { + min: 1, + max: 3, + chance: 0.5 + }, + 'cloth': { + min: 3, + max: 8, + chance: 0.8 + }, + 'medicine': { + min: 1, + max: 3, + chance: 0.3 + } + }, + buttons: { + 'continue': { + text: 'continue', + nextScene: 'end10' + }, + 'leave': { + text: 'leave city', + nextScene: 'end' + } + } + }, + + 'c12': { + notification: 'a pack of lizards rounds the corner.', + combat: true, + enemy: 'lizards', + plural: true, + char: 'LLL', + damage: 4, + hit: 0.7, + attackDelay: 0.7, + health: 30, + loot: { + 'meat': { + min: 3, + max: 8, + chance: 1 + }, + 'teeth': { + min: 2, + max: 4, + chance: 1 + }, + 'scales': { + min: 3, + max: 5, + chance: 1 + } + }, + buttons: { + 'continue': { + text: 'continue', + nextScene: 'end10' + }, + 'leave': { + text: 'leave city', + nextScene: 'end' + } + } + }, + + 'c13': { + text: [ + 'strips of meat are hung up to dry in this ward.' + ], + loot: { + 'cured meat': { + min: 3, + max: 10, + chance: 1 + } + }, + buttons: { + 'continue': { + text: 'continue', + nextScene: { 0.5: 'end10', 1: 'end11' } + }, + 'leave': { + text: 'leave city', + nextScene: 'end' + } + } + }, + 'd1': { notification: 'a large bird nests at the top of the stairs.', combat: true, @@ -1850,6 +2172,70 @@ Events.Setpieces = { } } }, + + 'd10': { + notification: 'behind the door, a deformed figure awakes and attacks.', + combat: true, + enemy: 'deformed', + char: 'D', + damage: 8, + hit: 0.6, + attackDelay: 2, + health: 40, + loot: { + 'cloth': { + min: 1, + max: 5, + chance: 0.8 + }, + 'teeth': { + min: 2, + max: 2, + chance: 1 + }, + 'steel': { + min: 1, + max: 3, + chance: 0.6 + }, + 'scales': { + min: 2, + max: 3, + chance: 0.1 + } + }, + buttons: { + 'continue': { + text: 'continue', + nextScene: {1: 'end14'} + } + } + }, + + 'd11': { + notification: 'as soon as the door is open a little bit, hundreds of tentacles erupt.', + combat: true, + enemy: 'tentacles', + plural: true, + char: 'TTT', + damage: 2, + hit: 0.6, + attackDelay: 0.5, + health: 60, + loot: { + 'meat': { + min: 10, + max: 20, + chance: 1 + } + }, + buttons: { + 'continue': { + text: 'continue', + nextScene: {1: 'end13'} + } + } + }, 'end1': { text: [ @@ -2020,6 +2406,11 @@ Events.Setpieces = { min: 1, max: 5, chance: 0.8 + }, + 'medicine': { + min: 1, + max: 4, + chance: 0.1 } }, buttons: { @@ -2173,7 +2564,260 @@ Events.Setpieces = { nextScene: 'end' } } - } + }, + + 'end10': { + text: [ + 'the stench of rot and death fills the operating theatres.', + "a few items are scattered on the ground.", + 'there is nothing else here.' + ], + onLoad: function() { + World.clearDungeon(); + State.cityCleared = true; + }, + loot: { + 'energy cell': { + min: 1, + max: 1, + chance: 0.3 + }, + 'medicine': { + min: 1, + max: 5, + chance: 0.3 + }, + 'teeth': { + min: 3, + max: 8, + chance: 1 + }, + 'scales': { + min: 4, + max: 7, + chance: 0.9 + } + }, + buttons: { + 'leave': { + text: 'leave city', + nextScene: 'end' + } + } + }, + + 'end11': { + text: [ + 'a pristine medicine cabinet at the end of a hallway.', + "the rest of the hospital is empty." + ], + onLoad: function() { + World.clearDungeon(); + State.cityCleared = true; + }, + loot: { + 'energy cell': { + min: 1, + max: 1, + chance: 0.2 + }, + 'medicine': { + min: 3, + max: 10, + chance: 1 + }, + 'teeth': { + min: 1, + max: 2, + chance: 0.2 + } + }, + buttons: { + 'leave': { + text: 'leave city', + nextScene: 'end' + } + } + }, + + 'end12': { + text: [ + 'someone had been stockpiling loot here.' + ], + onLoad: function() { + World.clearDungeon(); + State.cityCleared = true; + }, + loot: { + 'energy cell': { + min: 1, + max: 3, + chance: 0.2 + }, + 'medicine': { + min: 3, + max: 10, + chance: 0.5 + }, + 'bullets': { + min: 2, + max: 8, + chance: 1 + }, + 'torch': { + min: 1, + max: 3, + chance: 0.5 + }, + 'grenade': { + min: 1, + max: 1, + chance: 0.5 + }, + 'alien alloy': { + min: 1, + max: 2, + chance: 0.8 + } + }, + buttons: { + 'leave': { + text: 'leave city', + nextScene: 'end' + } + } + }, + + 'end13': { + text: [ + 'the tentacular horror is defeated.', + 'inside, the remains of its victims are everywhere.' + ], + onLoad: function() { + World.clearDungeon(); + State.cityCleared = true; + }, + loot: { + 'steel sword': { + min: 1, + max: 3, + chance: 0.5 + }, + 'rifle': { + min: 1, + max: 2, + chance: 0.3 + }, + 'teeth': { + min: 2, + max: 8, + chance: 1 + }, + 'cloth': { + min: 3, + max: 6, + chance: 0.5 + }, + 'alien alloy': { + min: 1, + max: 1, + chance: 0.1 + } + }, + buttons: { + 'leave': { + text: 'leave city', + nextScene: 'end' + } + } + }, + + 'end14': { + text: [ + 'the warped man lies dead.', + 'the operating theatre has a lot of curious equipment.' + ], + onLoad: function() { + World.clearDungeon(); + State.cityCleared = true; + }, + loot: { + 'energy cell': { + min: 2, + max: 5, + chance: 0.8 + }, + 'medicine': { + min: 3, + max: 12, + chance: 1 + }, + 'cloth': { + min: 1, + max: 3, + chance: 0.5 + }, + 'steel': { + min: 2, + max: 3, + chance: 0.3 + }, + 'alien alloy': { + min: 1, + max: 1, + chance: 0.3 + } + }, + buttons: { + 'leave': { + text: 'leave city', + nextScene: 'end' + } + } + }, + + 'end15': { + text: [ + 'the old man had a small cache of interesting items.' + ], + onLoad: function() { + World.clearDungeon(); + State.cityCleared = true; + }, + loot: { + 'alien alloy': { + min: 1, + max: 1, + chance: 0.8 + }, + 'medicine': { + min: 1, + max: 4, + chance: 1 + }, + 'cured meat': { + min: 3, + max: 7, + chance: 1 + }, + 'bolas': { + min: 1, + max: 3, + chance: 0.5 + }, + 'fur': { + min: 1, + max: 5, + chance: 0.8 + } + }, + buttons: { + 'leave': { + text: 'leave city', + nextScene: 'end' + } + } + }, } }, "house": { /* Abandoned House */ @@ -2188,7 +2832,7 @@ Events.Setpieces = { buttons: { 'enter': { text: 'go inside', - nextScene: { 0.5: 'supplies', 1: 'occupied' } + nextScene: { 0.25: 'medicine', 0.5: 'supplies', 1: 'occupied' } }, 'leave': { text: 'leave', @@ -2230,6 +2874,28 @@ Events.Setpieces = { } } }, + 'medicine': { + text: [ + 'the house has been ransacked.', + 'but there is a cache of medicine under the floorboards.' + ], + onLoad: function() { + World.markVisited(World.curPos[0], World.curPos[1]); + }, + loot: { + 'medicine': { + min: 2, + max: 5, + chance: 1 + } + }, + buttons: { + 'leave': { + text: 'leave', + nextScene: 'end' + } + } + }, 'occupied': { combat: true, enemy: 'squatter', diff --git a/script/path.js b/script/path.js index e098623..17abf0b 100644 --- a/script/path.js +++ b/script/path.js @@ -160,7 +160,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) { diff --git a/script/room.js b/script/room.js index f4f4f90..17f4f85 100644 --- a/script/room.js +++ b/script/room.js @@ -349,6 +349,14 @@ var Room = { } } }, + 'medicine': { + type: 'good', + cost: function() { + return { + 'scales': 50, 'teeth': 30 + } + } + }, 'bullets': { type: 'good', cost: function() { diff --git a/script/world.js b/script/world.js index 4719d81..d20f6b6 100644 --- a/script/world.js +++ b/script/world.js @@ -32,7 +32,8 @@ var World = { FIGHT_CHANCE: 0.20, BASE_HEALTH: 10, BASE_HIT_CHANCE: 0.8, - MEAT_HEAL: 10, + MEAT_HEAL: 8, + MEDS_HEAL: 20, FIGHT_DELAY: 3, // At least three moves between fights NORTH: [ 0, -1], SOUTH: [ 0, 1], @@ -489,6 +490,10 @@ var World = { return World.MEAT_HEAL * (Engine.hasPerk('gastronome') ? 2 : 1); }, + medsHeal: function() { + return World.MEDS_HEAL; + }, + checkFight: function() { World.fightMove = typeof World.fightMove == 'number' ? World.fightMove : 0; World.fightMove++; @@ -855,7 +860,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'; },