"use strict"; function DialogNode() { this.text = []; this.hooks = []; this.requirements = []; this.visit = function() { for (let i=0; i= 2; }); } { let nodeSoda = new DialogNode(); this.addChoice("Buy a soda ($4, +150 stamina)", 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™"]; nodeSoda.hooks.push(function() { player.cash -= 2; player.changeStamina(150); }); nodeSoda.requirements.push(function(player) { return player.cash >= 2; }); } { let prey = new Micro(); let nodeMicro = new DialogNode(); 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.hooks.push(function() { player.stomach.feed(prey); player.cash -= 10; }); nodeMicro.requirements.push(function(player) { return player.cash >= 10; }); } { let nodeCancel = new DialogNode(); this.addChoice("Nevermind", nodeCancel); nodeCancel.text = ["You decide to not purchase anything."]; } }