Selaa lähdekoodia

Changed dialog and combat to return arrays of strings. Updated feast.js accordingly

tags/v0.2.8
Fen Dweller 7 vuotta sitten
vanhempi
commit
780cb0787d
4 muutettua tiedostoa jossa 73 lisäystä ja 72 poistoa
  1. +35
    -35
      combat.js
  2. +12
    -12
      customs.js
  3. +21
    -21
      dialog.js
  4. +5
    -4
      feast.js

+ 35
- 35
combat.js Näytä tiedosto

@@ -38,10 +38,10 @@ function punchAttack(attacker) {
name: "Punch", name: "Punch",
desc: "Punch a nerd", desc: "Punch a nerd",
attack: function(defender) { attack: function(defender) {
return "You punch " + defender.description("the") + " for " + attack(attacker, defender, attacker.str) + " damage";
return ["You punch " + defender.description("the") + " for " + attack(attacker, defender, attacker.str) + " damage"];
}, },
attackPlayer: function(defender) { attackPlayer: function(defender) {
return attacker.description("The") + " punches you for " + attack(attacker, defender, attacker.str) + " damage";
return [attacker.description("The") + " punches you for " + attack(attacker, defender, attacker.str) + " damage"];
}, requirements: [ }, requirements: [
function(attacker, defender) { return isNormal(attacker) && isNormal(defender); } function(attacker, defender) { return isNormal(attacker) && isNormal(defender); }
], ],
@@ -55,10 +55,10 @@ function flankAttack(attacker) {
name: "Flank", name: "Flank",
desc: "Be sneaky", desc: "Be sneaky",
attack: function(defender) { attack: function(defender) {
return "You run around " + defender.description("the") + " and attack for " + attack(attacker, defender, attacker.dex) + " damage";
return ["You run around " + defender.description("the") + " and attack for " + attack(attacker, defender, attacker.dex) + " damage"];
}, },
attackPlayer: function(defender) { attackPlayer: function(defender) {
return attacker.description("The") + " runs past you, then turns and hits you for " + attack(attacker, defender, attacker.str) + " damage";
return [attacker.description("The") + " runs past you, then turns and hits you for " + attack(attacker, defender, attacker.str) + " damage"];
}, requirements: [ }, requirements: [
function(attacker, defender) { return isNormal(attacker) && isNormal(defender); } function(attacker, defender) { return isNormal(attacker) && isNormal(defender); }
], ],
@@ -75,18 +75,18 @@ function grapple(attacker) {
let success = statHealthCheck(attacker, defender, "str"); let success = statHealthCheck(attacker, defender, "str");
if (success) { if (success) {
defender.flags.grappled = true; defender.flags.grappled = true;
return "You charge at " + defender.description("the") + ", tackling them and knocking them to the ground.";
return ["You charge at " + defender.description("the") + ", tackling them and knocking them to the ground."];
} else { } else {
return "You charge at " + defender.description("the") + ", but they dodge out of the way!";
return ["You charge at " + defender.description("the") + ", but they dodge out of the way!"];
} }
}, },
attackPlayer: function(defender) { attackPlayer: function(defender) {
let success = Math.random() < 0.5; let success = Math.random() < 0.5;
if (success) { if (success) {
defender.flags.grappled = true; defender.flags.grappled = true;
return attacker.description("The") + " lunges at you, pinning you to the floor!";
return [attacker.description("The") + " lunges at you, pinning you to the floor!"];
} else { } else {
return attacker.description("The") + " tries to tackle you, but you deftly avoid them.";
return [attacker.description("The") + " tries to tackle you, but you deftly avoid them."];
} }
}, },
requirements: [ requirements: [
@@ -108,9 +108,9 @@ function grappleDevour(attacker) {
defender.flags.grappled = false; defender.flags.grappled = false;
changeMode("explore"); changeMode("explore");
attacker.cash += defender.cash; attacker.cash += defender.cash;
return "You open your jaws wide, stuffing " + defender.description("the") + "'s head into your gullet and greedily wolfing them down. Delicious. You hack up their wallet with $" + defender.cash + " inside a moment later. Nice!";
return ["You open your jaws wide, stuffing " + defender.description("the") + "'s head into your gullet and greedily wolfing them down. Delicious.", newline, "You hack up their wallet with $" + defender.cash + " inside a moment later. Nice!"];
} else { } else {
return "Your jaws open wide, but " + defender.description("the") + " manages to avoid becoming " + attacker.species + " chow.";
return ["Your jaws open wide, but " + defender.description("the") + " manages to avoid becoming " + attacker.species + " chow."];
} }
}, },
attackPlayer: function(defender) { attackPlayer: function(defender) {
@@ -118,9 +118,9 @@ function grappleDevour(attacker) {
if(success) { if(success) {
defender.flags.grappled = false; defender.flags.grappled = false;
changeMode("eaten"); changeMode("eaten");
return attacker.description("The") + " forces your head into their sloppy jaws, devouring you despite your frantic struggles. Glp.";
return [attacker.description("The") + " forces your head into their sloppy jaws, devouring you despite your frantic struggles. Glp."];
} else { } else {
return attacker.description("The") + " tries to swallow you down, but you manage to resist their hunger.";
return [attacker.description("The") + " tries to swallow you down, but you manage to resist their hunger."];
} }
}, requirements: [ }, requirements: [
function(attacker, defender) { return isNormal(attacker) && isGrappled(defender) && defender.flags.shrunk != true; } function(attacker, defender) { return isNormal(attacker) && isGrappled(defender) && defender.flags.shrunk != true; }
@@ -142,9 +142,9 @@ function grappleAnalVore(attacker) {
defender.flags.grappled = false; defender.flags.grappled = false;
attacker.cash += defender.cash; attacker.cash += defender.cash;
changeMode("explore"); changeMode("explore");
return "You shove " + defender.description("the") + " between your cheeks. Their head slips into your ass with a wet <i>shlk</i>, and the rest of their body follows suit. You moan and gasp, working them deeper and deeper...and noticing their wallet with $" + defender.cash + " on the ground. Score!";
return ["You shove " + defender.description("the") + " between your cheeks. Their head slips into your ass with a wet <i>shlk</i>, and the rest of their body follows suit. You moan and gasp, working them deeper and deeper.", newline, "You notice their wallet with $" + defender.cash + " lying on the ground. Score!"];
} else { } else {
return "Your grasp and shove " + defender.description("the") + ", but they manage to avoid becoming " + attacker.species + " chow.";
return ["Your grasp and shove " + defender.description("the") + ", but they manage to avoid becoming " + attacker.species + " chow."];
} }
}, requirements: [ }, requirements: [
function(attacker, defender) { return isNormal(attacker) && isGrappled(defender) && defender.flags.shrunk != true ; } function(attacker, defender) { return isNormal(attacker) && isGrappled(defender) && defender.flags.shrunk != true ; }
@@ -161,7 +161,7 @@ function grappleRelease(attacker) {
desc: "Release your opponent", desc: "Release your opponent",
attack: function(defender) { attack: function(defender) {
defender.flags.grappled = false; defender.flags.grappled = false;
return "You throw " + defender.description("the") + " back, dealing " + attack(attacker, defender, attacker.str*1.5) + " damage";
return ["You throw " + defender.description("the") + " back, dealing " + attack(attacker, defender, attacker.str*1.5) + " damage"];
}, requirements: [ }, requirements: [
function(attacker, defender) { return isNormal(attacker) && isGrappled(defender); } function(attacker, defender) { return isNormal(attacker) && isGrappled(defender); }
], ],
@@ -177,18 +177,18 @@ function grappledStruggle(attacker) {
let success = statHealthCheck(attacker, defender, "str"); let success = statHealthCheck(attacker, defender, "str");
if (success) { if (success) {
attacker.flags.grappled = false; attacker.flags.grappled = false;
return "You struggle and shove " + defender.description("the") + " off of you.";
return ["You struggle and shove " + defender.description("the") + " off of you."];
} else { } else {
return "You struggle, but to no avail.";
return ["You struggle, but to no avail."];
} }
}, },
attackPlayer: function(defender) { attackPlayer: function(defender) {
let success = statHealthCheck(attacker, defender, "str"); let success = statHealthCheck(attacker, defender, "str");
if (success) { if (success) {
attacker.flags.grappled = false; attacker.flags.grappled = false;
return "Your prey shoves you back, breaking your grapple!";
return ["Your prey shoves you back, breaking your grapple!"];
} else { } else {
return "Your prey squirms, but remains pinned.";
return ["Your prey squirms, but remains pinned."];
} }
}, },
requirements: [ requirements: [
@@ -207,9 +207,9 @@ function grappledReverse(attacker) {
if (success) { if (success) {
attacker.flags.grappled = false; attacker.flags.grappled = false;
defender.flags.grappled = true; defender.flags.grappled = true;
return "You surprise " + defender.description("the") + " with a burst of strength, flipping them over and pinning them.";
return ["You surprise " + defender.description("the") + " with a burst of strength, flipping them over and pinning them."];
} else { } else {
return "You try to throw your opponent off of you, but fail.";
return ["You try to throw your opponent off of you, but fail."];
} }
}, },
attackPlayer: function(defender) { attackPlayer: function(defender) {
@@ -217,9 +217,9 @@ function grappledReverse(attacker) {
if (success) { if (success) {
attacker.flags.grappled = false; attacker.flags.grappled = false;
defender.flags.grappled = true; defender.flags.grappled = true;
return "Your prey suddenly grabs hold and flips you over, pinning you!";
return ["Your prey suddenly grabs hold and flips you over, pinning you!"];
} else { } else {
return "Your prey tries to grab at you, but you keep them under control.";
return ["Your prey tries to grab at you, but you keep them under control."];
} }
}, },
requirements: [ requirements: [
@@ -237,9 +237,9 @@ function shrunkGrapple(attacker) {
let success = statCheck(attacker, defender, "dex") || statCheck(attacker, defender, "dex"); let success = statCheck(attacker, defender, "dex") || statCheck(attacker, defender, "dex");
if (success) { if (success) {
defender.flags.grappled = true; defender.flags.grappled = true;
return "You snatch up " + defender.description("the");
return ["You snatch up " + defender.description("the")];
} else { } else {
return "You try to grab " + defender.description("the") + ", but they elude your grasp.";
return ["You try to grab " + defender.description("the") + ", but they elude your grasp."];
} }
}, },
requirements: [ requirements: [
@@ -258,7 +258,7 @@ function shrunkSwallow(attacker) {
attack: function(defender) { attack: function(defender) {
changeMode("explore"); changeMode("explore");
attacker.stomach.feed(defender); attacker.stomach.feed(defender);
return "With a light swallow, " + defender.description("the") + " is dragged down to your sloppy guts.";
return ["With a light swallow, " + defender.description("the") + " is dragged down to your sloppy guts."];
}, },
requirements: [ requirements: [
function(attacker, defender) { function(attacker, defender) {
@@ -277,7 +277,7 @@ function shrunkStomp(attacker) {
let success = statCheck(attacker, defender, "dex") || statCheck(attacker, defender, "dex") || defender.stamina == 0; let success = statCheck(attacker, defender, "dex") || statCheck(attacker, defender, "dex") || defender.stamina == 0;
defender.stamina = 0; defender.stamina = 0;
defender.health = Math.max(0, defender.health - 50); defender.health = Math.max(0, defender.health - 50);
return "Your paw comes crashing down on " + defender.description("the") + ", burying them under your heavy toes and pinning them down hard.";
return ["Your paw comes crashing down on " + defender.description("the") + ", burying them under your heavy toes and pinning them down hard."];
}, },
requirements: [ requirements: [
function(attacker, defender) { function(attacker, defender) {
@@ -296,9 +296,9 @@ function flee(attacker) {
if (success) { if (success) {
attacker.clear(); attacker.clear();
changeMode("explore"); changeMode("explore");
return "You successfully run away.";
return ["You successfully run away."];
} else { } else {
return "You can't escape!";
return ["You can't escape!"];
} }
}, },
requirements: [ requirements: [
@@ -311,10 +311,10 @@ function pass(attacker) {
name: "Pass", name: "Pass",
desc: "You can't do anything!", desc: "You can't do anything!",
attack: function(defender) { attack: function(defender) {
return "You do nothing.";
return ["You do nothing."];
}, },
attackPlayer: function(defender) { attackPlayer: function(defender) {
return attacker.description("The") + " does nothing.";
return [attacker.description("The") + " does nothing."];
}, },
priority: 0, priority: 0,
}; };
@@ -332,7 +332,7 @@ function devourPlayer(attacker) {
], ],
attackPlayer: function(defender) { attackPlayer: function(defender) {
changeMode("eaten"); changeMode("eaten");
return "The voracious " + attacker.description() + " pins you down and devours you in seconds.";
return ["The voracious " + attacker.description() + " pins you down and devours you in seconds."];
}, },
priority: 1, priority: 1,
}; };
@@ -358,7 +358,7 @@ function poke(attacker) {
name: "Poke", name: "Poke",
desc: "Poke a nerd", desc: "Poke a nerd",
attackPlayer: function(defender) { attackPlayer: function(defender) {
return attacker.description("The") + " pokes you on the snout for " + attack(attacker, defender, 1e12) + " damage";
return [attacker.description("The") + " pokes you on the snout for " + attack(attacker, defender, 1e12) + " damage"];
}, },
priority: 1, priority: 1,
}; };
@@ -368,7 +368,7 @@ function digestPlayerStomach(predator,damage=20) {
return { return {
digest: function(player) { digest: function(player) {
attack(predator, player, damage); attack(predator, player, damage);
return predator.description("The") + "'s stomach grinds over your body, swiftly digesting you.";
return [predator.description("The") + "'s stomach grinds over your body, swiftly digesting you."];
}, },
priority: 1, priority: 1,
}; };
@@ -378,7 +378,7 @@ function instakillPlayerStomach(pedator) {
return { return {
digest: function(player) { digest: function(player) {
player.health = -100; player.health = -100;
return "The stomach walls churn, clench, and swiftly crush you into nothingnes.";
return ["The stomach walls churn, clench, and swiftly crush you into nothingnes."];
}, },
priority: 1, priority: 1,
weight: function(attacker, defender) { return 1/3; }, weight: function(attacker, defender) { return 1/3; },


+ 12
- 12
customs.js Näytä tiedosto

@@ -38,10 +38,10 @@ function getaShrink(attacker) {


if (success) { if (success) {
defender.flags.shrunk = true; defender.flags.shrunk = true;
return attacker.description() + " pulls a strange device from his pocket and points it at you. A blinding flash envelops your vision...and as your sight returns, you find yourself shrunken down to no more than two inches tall.";
return [attacker.description() + " pulls a strange device from his pocket and points it at you. A blinding flash envelops your vision...and as your sight returns, you find yourself shrunken down to no more than two inches tall."];
} else { } else {
attacker.flags.shrunk = true; attacker.flags.shrunk = true;
return attacker.description() + " pulls a strange device from his pocket and points it at you. A blinding flash envelops your vision...and as your sight returns, you see that he's shrunk himself!";
return [attacker.description() + " pulls a strange device from his pocket and points it at you. A blinding flash envelops your vision...and as your sight returns, you see that he's shrunk himself!"];
} }
}, },
requirements: [ requirements: [
@@ -57,7 +57,7 @@ function getaGrab(attacker) {
return { return {
attackPlayer: function(defender) { attackPlayer: function(defender) {
defender.flags.grappled = true; defender.flags.grappled = true;
return attacker.description() + " leans down and snatches you up, stuffing you into his maw.";
return [attacker.description() + " leans down and snatches you up, stuffing you into his maw."];
}, },
conditions: [ conditions: [
function(attacker, defender) { function(attacker, defender) {
@@ -77,7 +77,7 @@ function getaTease(attacker) {
return { return {
attackPlayer: function(defender) { attackPlayer: function(defender) {
defender.stamina = Math.max(defender.stamina - 25, 0); defender.stamina = Math.max(defender.stamina - 25, 0);
return attacker.description() + " grinds you against the roof of his maw with his tongue.";
return [attacker.description() + " grinds you against the roof of his maw with his tongue."];
}, },
requirements: [ requirements: [
function(attacker, defender) { function(attacker, defender) {
@@ -92,7 +92,7 @@ function getaSuckle(attacker) {
return { return {
attackPlayer: function(defender) { attackPlayer: function(defender) {
defender.stamina = Math.max(defender.stamina - 45, 0); defender.stamina = Math.max(defender.stamina - 45, 0);
return attacker.description() + " shuts his jaws and suckles on you.";
return [attacker.description() + " shuts his jaws and suckles on you."];
}, },
requirements: [ requirements: [
function(attacker, defender) { function(attacker, defender) {
@@ -107,7 +107,7 @@ function getaSalivaSwallow(attacker) {
return { return {
attackPlayer: function(defender) { attackPlayer: function(defender) {
defender.stamina = Math.max(defender.stamina - 15, 0); defender.stamina = Math.max(defender.stamina - 15, 0);
return attacker.description() + " swallows, draining the drool from his jaws - leaving you on the precipice of his gullet.";
return [attacker.description() + " swallows, draining the drool from his jaws - leaving you on the precipice of his gullet."];
}, },
requirements: [ requirements: [
function(attacker, defender) { function(attacker, defender) {
@@ -122,7 +122,7 @@ function getaSwallow(attacker) {
return { return {
attackPlayer: function(defender) { attackPlayer: function(defender) {
changeMode("eaten"); changeMode("eaten");
return attacker.description() + " shuts his jaws and swallows, dragging you down into his tight throat and dumping you into a caustic stomach.";
return [attacker.description() + " shuts his jaws and swallows, dragging you down into his tight throat and dumping you into a caustic stomach."];
}, },
requirements: [ requirements: [
function(attacker, defender) { function(attacker, defender) {
@@ -140,9 +140,9 @@ function getaStomp(attacker) {
if (success) { if (success) {
defender.health = Math.max(-100, defender.health - 50 - Math.round(Math.random() * 25)); defender.health = Math.max(-100, defender.health - 50 - Math.round(Math.random() * 25));
defender.stamina = 0; defender.stamina = 0;
return attacker.description() + "'s paw comes crashing down on your little body, smashing you into the dirt.";
return [attacker.description() + "'s paw comes crashing down on your little body, smashing you into the dirt."];
} else { } else {
return "You dive away as " + attacker.description() + "'s paw slams down, narrowly missing your little body.";
return ["You dive away as " + attacker.description() + "'s paw slams down, narrowly missing your little body."];
} }
}, },
requirements: [ requirements: [
@@ -158,7 +158,7 @@ function getaStompFinish(attacker) {
return { return {
attackPlayer: function(defender) { attackPlayer: function(defender) {
defender.health = -100; defender.health = -100;
return attacker.description() + " looms over your stunned body. You can only watch as his toes flex, squeeze...and come down hard. The fox's paw crushes you like an insect, tearing you open and spilling your guts across the dusty trail. He grinds you a few times more for good measure, leaving a disfigured, broken mess in your place.";
return [attacker.description() + " looms over your stunned body. You can only watch as his toes flex, squeeze...and come down hard. The fox's paw crushes you like an insect, tearing you open and spilling your guts across the dusty trail. He grinds you a few times more for good measure, leaving a disfigured, broken mess in your place."];
}, },
requirements: [ requirements: [
function(attacker, defender) { function(attacker, defender) {
@@ -190,13 +190,13 @@ function GetaObj() {
function GetaDialog() { function GetaDialog() {
DialogNode.call(this); DialogNode.call(this);


this.text = "You approach the sandy-furred fox.";
this.text = ["You approach the sandy-furred fox."];


{ {
let nodeFight = new DialogNode(); let nodeFight = new DialogNode();
this.addChoice("He certainly looks tasty...", nodeFight); this.addChoice("He certainly looks tasty...", nodeFight);


nodeFight.text = "You stalk up to your prey, but he sees you coming. You're going to have to fight!";
nodeFight.text = ["You stalk up to your prey, but he sees you coming. You're going to have to fight!"];
nodeFight.hooks.push( function(){ nodeFight.hooks.push( function(){
currentFoe = new Geta(); currentFoe = new Geta();
changeMode("combat"); changeMode("combat");


+ 21
- 21
dialog.js Näytä tiedosto

@@ -1,7 +1,7 @@
"use strict"; "use strict";


function DialogNode() { function DialogNode() {
this.text = "Foo bar baz.";
this.text = [];
this.hooks = []; this.hooks = [];


this.requirements = []; this.requirements = [];
@@ -23,15 +23,15 @@ function EatDude() {


let nerd = new Anthro(); let nerd = new Anthro();


this.text = "You approach " + nerd.description("the");
this.text = ["You approach " + nerd.description("the")];


let eatHim = new DialogNode(); let eatHim = new DialogNode();


eatHim.text = "You eat the nerd. Burp.";
eatHim.text = ["You eat the nerd. Burp."];
eatHim.hooks.push(function() { player.stomach.feed(nerd); }); eatHim.hooks.push(function() { player.stomach.feed(nerd); });


let dontEatHim = new DialogNode(); let dontEatHim = new DialogNode();
dontEatHim.text = "You don't eat the nerd.";
dontEatHim.text = ["You don't eat the nerd."];


this.addChoice("Eat him lol",eatHim); this.addChoice("Eat him lol",eatHim);
this.addChoice("Actually don't",dontEatHim); this.addChoice("Actually don't",dontEatHim);
@@ -40,25 +40,25 @@ function EatDude() {
function PhoneCall() { function PhoneCall() {
DialogNode.call(this); DialogNode.call(this);


this.text = "You pick up the phone. Who do you want to call?";
this.text = ["You pick up the phone. Who do you want to call?"];


{ {
let nodeFen = new DialogNode(); let nodeFen = new DialogNode();
this.addChoice("Fen",nodeFen); this.addChoice("Fen",nodeFen);
nodeFen.text = "You dial Fen's number. Milliseconds later, he kicks open your front door and dabs on you, then runs away.";
nodeFen.text = ["You dial Fen's number. Milliseconds later, he kicks open your front door and dabs on you, then runs away."];
} }


{ {
let nodeNerd = new DialogNode(); let nodeNerd = new DialogNode();
this.addChoice("Some nerd",nodeNerd); this.addChoice("Some nerd",nodeNerd);
nodeNerd.text = "You dial some nerd. He shows up at your front door.";
nodeNerd.text = ["You dial some nerd. He shows up at your front door."];
nodeNerd.hooks.push(function() { startDialog(new EatDude()); }); nodeNerd.hooks.push(function() { startDialog(new EatDude()); });
} }


{ {
let nodeCrash = new DialogNode(); let nodeCrash = new DialogNode();
this.addChoice("Crash the game",nodeCrash); this.addChoice("Crash the game",nodeCrash);
nodeCrash.text = "Oh no oops";
nodeCrash.text = ["Oh no oops"];
nodeCrash.hooks.push(function() { potato() }); nodeCrash.hooks.push(function() { potato() });
} }
} }
@@ -66,12 +66,12 @@ function PhoneCall() {
function FallenFoe(foe) { function FallenFoe(foe) {
DialogNode.call(this); DialogNode.call(this);


this.text = "What do you want to do with your enemy?";
this.text = ["What do you want to do with your enemy?"];


{ {
let nodeEat = new DialogNode(); let nodeEat = new DialogNode();
this.addChoice("Devour!",nodeEat); this.addChoice("Devour!",nodeEat);
nodeEat.text = "You grab your helpless prey and force them down your gullet. You hack up their wallet a minute later, finding $" + foe.cash + " inside.";
nodeEat.text = ["You grab your helpless prey and force them down your gullet. You hack up their wallet a minute later, finding $" + foe.cash + " inside."];


nodeEat.hooks.push(function() { nodeEat.hooks.push(function() {
player.cash += foe.cash; player.cash += foe.cash;
@@ -85,7 +85,7 @@ function FallenFoe(foe) {
{ {
let nodeSpare = new DialogNode(); let nodeSpare = new DialogNode();
this.addChoice("Spare",nodeSpare); this.addChoice("Spare",nodeSpare);
nodeSpare.text = "You decide to leave your foe uneaten. You do help yourself to the $" + foe.cash + " in their pockets, though.";
nodeSpare.text = ["You decide to leave your foe uneaten.", newline, "You do help yourself to the $" + foe.cash + " in their pockets, though."];


nodeSpare.hooks.push(function() { nodeSpare.hooks.push(function() {
player.cash += foe.cash; player.cash += foe.cash;
@@ -95,7 +95,7 @@ function FallenFoe(foe) {
{ {
let nodeCrush = new DialogNode(); let nodeCrush = new DialogNode();
this.addChoice("Crush",nodeCrush); this.addChoice("Crush",nodeCrush);
nodeCrush.text = "You slam your paw down hard, crushing " + foe.description("the") + " like a bug";
nodeCrush.text = ["You slam your paw down hard, crushing " + foe.description("the") + " like a bug"];
nodeCrush.requirements.push( function(attacker, defender) { nodeCrush.requirements.push( function(attacker, defender) {
return defender.flags.shrunk == true; return defender.flags.shrunk == true;
}); });
@@ -105,12 +105,12 @@ function FallenFoe(foe) {
function NatureExercise() { function NatureExercise() {
DialogNode.call(this); DialogNode.call(this);


this.text = "What do you want to do?";
this.text = ["What do you want to do?"];


{ {
let nodeStrength = new DialogNode(); let nodeStrength = new DialogNode();
this.addChoice("Rock Climbing (+STR)", nodeStrength); this.addChoice("Rock Climbing (+STR)", nodeStrength);
nodeStrength.text = "You clamber up walls for a while. You feel a little stronger.";
nodeStrength.text = ["You clamber up walls for a while. You feel a little stronger."];
nodeStrength.hooks.push(function() { nodeStrength.hooks.push(function() {
player.str += 1; player.str += 1;
advanceTime(60*30); advanceTime(60*30);
@@ -120,7 +120,7 @@ function NatureExercise() {
{ {
let nodeDexterity = new DialogNode(); let nodeDexterity = new DialogNode();
this.addChoice("Jogging (+DEX)", nodeDexterity); 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.text = ["You go run for a run around the three-mile-long trail. You feel a little more agile."];
nodeDexterity.hooks.push(function() { nodeDexterity.hooks.push(function() {
player.dex += 1; player.dex += 1;
advanceTime(60*30); advanceTime(60*30);
@@ -130,7 +130,7 @@ function NatureExercise() {
{ {
let nodeConstitution = new DialogNode(); let nodeConstitution = new DialogNode();
this.addChoice("Bang your head on a tree (+CON)", nodeConstitution); 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.text = ["You bash your face on a tree for half an hour. I guess that helps."];
nodeConstitution.hooks.push(function() { nodeConstitution.hooks.push(function() {
player.con += 1; player.con += 1;
advanceTime(60*30); advanceTime(60*30);
@@ -141,12 +141,12 @@ function NatureExercise() {
function VendingMachinePurchase() { function VendingMachinePurchase() {
DialogNode.call(this); DialogNode.call(this);


this.text = "You walk up to the vending machine. A variety of foodstuffs and drinks are on display...along with some more unconventional items.";
this.text = ["You walk up to the vending machine. A variety of foodstuffs and drinks are on display...along with some more unconventional items."];


{ {
let nodeCandy = new DialogNode(); let nodeCandy = new DialogNode();
this.addChoice("Buy a candy bar ($2)", nodeCandy); this.addChoice("Buy a candy bar ($2)", nodeCandy);
nodeCandy.text = "You insert two dollar bills into the machine and select the candy bar. Chocolate and nougat, mmm.";
nodeCandy.text = ["You insert two dollar bills into the machine and select the candy bar. Chocolate and nougat, mmm."];


nodeCandy.hooks.push(function() { nodeCandy.hooks.push(function() {
player.cash -= 2; player.cash -= 2;
@@ -160,7 +160,7 @@ function VendingMachinePurchase() {
{ {
let nodeSoda = new DialogNode(); let nodeSoda = new DialogNode();
this.addChoice("Buy a soda ($2)", nodeSoda); this.addChoice("Buy a soda ($2)", nodeSoda);
nodeSoda.text = "You insert a dollar and coins, then select a soda. You're pretty you saw something on the news about it turning people purple, but you can't resist that delicious Citrus Substitute Flavor&trade;";
nodeSoda.text = ["You insert a dollar and coins, then select a soda. You're pretty you saw something on the news about it turning people purple, but you can't resist that delicious Citrus Substitute Flavor&trade;"];


nodeSoda.hooks.push(function() { nodeSoda.hooks.push(function() {
player.cash -= 2; player.cash -= 2;
@@ -175,7 +175,7 @@ function VendingMachinePurchase() {
let prey = new Micro(); let prey = new Micro();
let nodeMicro = new DialogNode(); let nodeMicro = new DialogNode();
this.addChoice("Buy a micro ($10)", nodeMicro); this.addChoice("Buy a micro ($10)", nodeMicro);
nodeMicro.text = "You stuff a wad of bills into the machine. " + prey.description("A") + " tumbles into the vending slot; you scoop them up and stuff them into your jaws without a second thought. Tasty.";
nodeMicro.text = ["You stuff a wad of bills into the machine. " + prey.description("A") + " tumbles into the vending slot; you scoop them up and stuff them into your jaws without a second thought. Tasty."];


nodeMicro.hooks.push(function() { nodeMicro.hooks.push(function() {
player.stomach.feed(prey); player.stomach.feed(prey);
@@ -190,6 +190,6 @@ function VendingMachinePurchase() {
{ {
let nodeCancel = new DialogNode(); let nodeCancel = new DialogNode();
this.addChoice("Nevermind", nodeCancel); this.addChoice("Nevermind", nodeCancel);
nodeCancel.text = "You decide to not purchase anything.";
nodeCancel.text = ["You decide to not purchase anything."];
} }
} }

+ 5
- 4
feast.js Näytä tiedosto

@@ -332,6 +332,7 @@ function saveSettings() {
function retrieveSettings() { function retrieveSettings() {
return JSON.parse(window.localStorage.getItem("settings")); return JSON.parse(window.localStorage.getItem("settings"));
} }

function update(lines=[]) { function update(lines=[]) {
let log = document.getElementById("log"); let log = document.getElementById("log");
for (let i=0; i<lines.length; i++) { for (let i=0; i<lines.length; i++) {
@@ -382,7 +383,7 @@ function startCombat(opponent) {
} }


function attackClicked(index) { function attackClicked(index) {
update([playerAttacks[index].attack(currentFoe)]);
update(playerAttacks[index].attack(currentFoe));


if (currentFoe.health <= 0) { if (currentFoe.health <= 0) {
update([currentFoe.description("The") + " falls to the ground!"]); update([currentFoe.description("The") + " falls to the ground!"]);
@@ -394,7 +395,7 @@ function attackClicked(index) {
attack = currentFoe.backupAttack; attack = currentFoe.backupAttack;
} }


update([attack.attackPlayer(player)]);
update(attack.attackPlayer(player));


if (player.health <= -100) { if (player.health <= -100) {
update(["You die..."]); update(["You die..."]);
@@ -446,14 +447,14 @@ function struggleHovered(index) {
function startDialog(dialog) { function startDialog(dialog) {
currentDialog = dialog; currentDialog = dialog;
changeMode("dialog"); changeMode("dialog");
update([currentDialog.text]);
update(currentDialog.text);
currentDialog.visit(); currentDialog.visit();
updateDisplay(); updateDisplay();
} }


function dialogClicked(index) { function dialogClicked(index) {
currentDialog = currentDialog.choices[index].node; currentDialog = currentDialog.choices[index].node;
update([currentDialog.text]);
update(currentDialog.text);
currentDialog.visit(); currentDialog.visit();
if (currentDialog.choices.length == 0 && mode == "dialog") { if (currentDialog.choices.length == 0 && mode == "dialog") {
changeMode("explore"); changeMode("explore");


Loading…
Peruuta
Tallenna