| @@ -221,8 +221,6 @@ function poke(attacker) { | |||||
| }; | }; | ||||
| } | } | ||||
| function digestPlayerStomach(predator,damage=20) { | function digestPlayerStomach(predator,damage=20) { | ||||
| return { | return { | ||||
| digest: function(player) { | digest: function(player) { | ||||
| @@ -81,3 +81,39 @@ function FallenFoe(foe) { | |||||
| nodeSpare.text = "You decide to leave your foe uneaten."; | nodeSpare.text = "You decide to leave your foe uneaten."; | ||||
| } | } | ||||
| } | } | ||||
| function NatureExercise() { | |||||
| DialogNode.call(this); | |||||
| this.text = "What do you want to do?"; | |||||
| { | |||||
| let nodeStrength = new DialogNode(); | |||||
| this.addChoice("Rock Climbing (+STR)", nodeStrength); | |||||
| nodeStrength.text = "You clamber up walls for a while. You feel a little stronger."; | |||||
| nodeStrength.hooks.push(function() { | |||||
| player.str += 1; | |||||
| advanceTime(60*30); | |||||
| }); | |||||
| } | |||||
| { | |||||
| let nodeDexterity = new DialogNode(); | |||||
| this.addChoice("Jogging (+DEX)", nodeDexterity); | |||||
| nodeDexterity.text = "You go run for a run around the three-mile-long trail. You feel a little more agile."; | |||||
| nodeDexterity.hooks.push(function() { | |||||
| player.dex += 1; | |||||
| advanceTime(60*30); | |||||
| }); | |||||
| } | |||||
| { | |||||
| let nodeConstitution = new DialogNode(); | |||||
| this.addChoice("Bang your head on a tree (+CON)", nodeConstitution); | |||||
| nodeConstitution.text = "You bash your face on a tree for half an hour. I guess that helps."; | |||||
| nodeConstitution.hooks.push(function() { | |||||
| player.con += 1; | |||||
| advanceTime(60*30); | |||||
| }); | |||||
| } | |||||
| } | |||||
| @@ -1,10 +1,12 @@ | |||||
| function Object(name="Potato") { | |||||
| "use strict"; | |||||
| function GameObject(name="Potato") { | |||||
| this.name = name; | this.name = name; | ||||
| this.actions = []; | this.actions = []; | ||||
| } | } | ||||
| function Burger() { | function Burger() { | ||||
| Object.call(this, "Burger"); | |||||
| GameObject.call(this, "Burger"); | |||||
| this.actions.push({ | this.actions.push({ | ||||
| "name": "Punch Burger", | "name": "Punch Burger", | ||||
| "action": function() { | "action": function() { | ||||
| @@ -15,7 +17,7 @@ function Burger() { | |||||
| } | } | ||||
| function Nerd() { | function Nerd() { | ||||
| Object.call(this, "Nerd"); | |||||
| GameObject.call(this, "Nerd"); | |||||
| this.actions.push({ | this.actions.push({ | ||||
| "name": "Eat Nerd", | "name": "Eat Nerd", | ||||
| "action": function() { | "action": function() { | ||||
| @@ -25,7 +27,7 @@ function Nerd() { | |||||
| } | } | ||||
| function Toilet() { | function Toilet() { | ||||
| Object.call(this, "Toilet"); | |||||
| GameObject.call(this, "Toilet"); | |||||
| this.actions.push({ | this.actions.push({ | ||||
| "name": "Admire toilet", | "name": "Admire toilet", | ||||
| "action": function() { | "action": function() { | ||||
| @@ -35,7 +37,7 @@ function Toilet() { | |||||
| } | } | ||||
| function TV() { | function TV() { | ||||
| Object.call(this, "TV"); | |||||
| GameObject.call(this, "TV"); | |||||
| this.actions.push({ | this.actions.push({ | ||||
| "name": "Watch TV", | "name": "Watch TV", | ||||
| "action": function() { | "action": function() { | ||||
| @@ -45,7 +47,7 @@ function TV() { | |||||
| } | } | ||||
| function Phone() { | function Phone() { | ||||
| Object.call(this, "Phone"); | |||||
| GameObject.call(this, "Phone"); | |||||
| this.actions.push({ | this.actions.push({ | ||||
| "name": "Use phone", | "name": "Use phone", | ||||
| "action": function() { | "action": function() { | ||||
| @@ -55,7 +57,7 @@ function Phone() { | |||||
| } | } | ||||
| function Bed() { | function Bed() { | ||||
| Object.call(this, "Bed"); | |||||
| GameObject.call(this, "Bed"); | |||||
| this.actions.push({ | this.actions.push({ | ||||
| "name": "Sleep", | "name": "Sleep", | ||||
| "action": function() { | "action": function() { | ||||
| @@ -67,11 +69,21 @@ function Bed() { | |||||
| } | } | ||||
| function Sofa() { | function Sofa() { | ||||
| Object.call(this, "Sofa"); | |||||
| GameObject.call(this, "Sofa"); | |||||
| this.actions.push({ | this.actions.push({ | ||||
| "name": "Sit on sofa", | "name": "Sit on sofa", | ||||
| "action": function(){ | "action": function(){ | ||||
| startDialog(SofaSit()); | startDialog(SofaSit()); | ||||
| } | } | ||||
| }) | |||||
| }); | |||||
| } | |||||
| function NatureTrailExercise() { | |||||
| GameObject.call(this, "Exercise"); | |||||
| this.actions.push({ | |||||
| "name": "Exercise", | |||||
| "action": function() { | |||||
| startDialog(new NatureExercise()); | |||||
| } | |||||
| }); | |||||
| } | } | ||||
| @@ -1,3 +1,5 @@ | |||||
| "use strict"; | |||||
| function pick(list) { | function pick(list) { | ||||
| if (list.length == 0) | if (list.length == 0) | ||||
| return null; | return null; | ||||
| @@ -5,23 +7,25 @@ function pick(list) { | |||||
| return list[Math.floor(Math.random()*list.length)]; | return list[Math.floor(Math.random()*list.length)]; | ||||
| } | } | ||||
| function Creature(name = "Creature") { | |||||
| function Creature(name = "Creature", str=10, dex=10, con=10) { | |||||
| this.name = name; | this.name = name; | ||||
| this.health = 100; | |||||
| this.maxHealth = 100; | |||||
| this.mass = 80; | this.mass = 80; | ||||
| this.bowels = new Bowels(); | this.bowels = new Bowels(); | ||||
| this.stomach = new Stomach(this.bowels); | this.stomach = new Stomach(this.bowels); | ||||
| this.butt = new Butt(this.bowels,this.stomach); | this.butt = new Butt(this.bowels,this.stomach); | ||||
| this.attacks = []; | this.attacks = []; | ||||
| this.str = 10; | |||||
| this.dex = 10; | |||||
| this.con = 10; | |||||
| this.str = str; | |||||
| this.dex = dex; | |||||
| this.con = con; | |||||
| Object.defineProperty(this, "maxHealth", {get: function() { return this.con * 10 }}); | |||||
| this.health = this.maxHealth; | |||||
| } | } | ||||
| function Player(name = "Player") { | function Player(name = "Player") { | ||||
| Creature.call(this, name); | |||||
| Creature.call(this, name, 15, 15, 15); | |||||
| this.fullness = function() { | this.fullness = function() { | ||||
| return this.stomach.fullness() + this.butt.fullness(); | return this.stomach.fullness() + this.butt.fullness(); | ||||
| @@ -38,9 +42,6 @@ function Player(name = "Player") { | |||||
| this.attacks.push(new grappledStruggle(this)); | this.attacks.push(new grappledStruggle(this)); | ||||
| this.backupAttack = new pass(this); | this.backupAttack = new pass(this); | ||||
| this.str = 15; | |||||
| this.dex = 15; | |||||
| this.con = 15; | |||||
| } | } | ||||
| function Anthro() { | function Anthro() { | ||||
| @@ -150,9 +150,28 @@ let locationsSrc = [ | |||||
| "name": "Crossroads", | "name": "Crossroads", | ||||
| "dir": NORTH, | "dir": NORTH, | ||||
| "desc": "You walk to the crossroads" | "desc": "You walk to the crossroads" | ||||
| }, | |||||
| { | |||||
| "name": "Nature Trail", | |||||
| "dir": SOUTH, | |||||
| "desc": "You head out into the woods" | |||||
| } | } | ||||
| ] | ] | ||||
| }, | }, | ||||
| { | |||||
| "name": "Nature Trail", | |||||
| "desc": "A winding train cutting through a thick forest", | |||||
| "conn": [ | |||||
| { | |||||
| "name": "South Street", | |||||
| "dir": NORTH, | |||||
| "desc": "You return to town." | |||||
| } | |||||
| ], | |||||
| "objs": [ | |||||
| NatureTrailExercise | |||||
| ] | |||||
| }, | |||||
| { | { | ||||
| "name": "DANGER ZONE", | "name": "DANGER ZONE", | ||||
| "desc": "THE DANGER ZONE", | "desc": "THE DANGER ZONE", | ||||