Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 'use strict';
- const readline = require("readline");
- const colors = require("colors");
- const rl = readline.createInterface({input: process.stdin, output: process.stdout});
- let choon = function() {
- this.happiness = 0;
- this.numfamiliar = 0;
- this.pointless = 144.441;
- this.name = "Choon";
- this.spec = "human";
- this.reisenCount = 0;
- }
- let args = [];
- for (var i = 2; i < process.argv.length; i++) {
- if (process.argv[i]) args[i - 2] = process.argv[i];
- }
- let newChoon = new choon();
- let happy = 0;
- let str = "";
- let buffer = "";
- let buffer2 = 0;
- if (args[0]) newChoon.name = args[0];
- console.log("A new Choon called \"" + newChoon.name + "\" was created.");
- let main = function () {
- happy = 8 - (newChoon.happiness < 256) - (newChoon.happiness < 128) - (newChoon.happiness < 64) - (newChoon.happiness < 1) - (newChoon.happiness < 0) - (newChoon.happiness < -64) - (newChoon.happiness < -128) - (newChoon.happiness < -256);
- rl.question(newChoon.name.gray + ' is awaiting your command... '.gray, function (cmd) {
- cmd = cmd.toLowerCase();
- if (cmd === "goodbye") {
- str = [" is relieved to see you leave.", " is relieved to see you leave.", " ignores you.", " ignores you.", " waves goodbye.", " waves goodbye.", " gives you a goodbye hug.", " gives you a goodbye hug.", " starts to cry because you're leaving."][happy];
- console.log(newChoon.name + str);
- rl.close();
- return process.exit(0);
- } else if (cmd === "help") {
- str = "List of commands:\ngoodbye, happy, give [reisen|manga], feed [cupcake|ramen|carrot|cereal]";
- } else if (cmd === "happy") {
- str = newChoon.name;
- str += [" doesn't want to have anything to do with you.", " is giving you a death glare.", " appears to hate you.", " appears to dislike you.", " doesn't really have a solid opinion of you.", " appears to like you.", " appears to like you a lot.", " looks elated.", " is lost in his own world of happiness."][happy];
- } else if (cmd.substr(0, 5) === "give " || cmd === "give") {
- if (cmd === "give" || cmd === "give ") {
- str = "You can't give " + newChoon.name + " nothing...";
- } else {
- buffer = cmd.substr(5);
- if (buffer === "reisen" && newChoon.reisenCount === 0) {
- str = "You gave " + newChoon.name + " Reisen. He looks really happy!";
- newChoon.reisenCount++;
- newChoon.happiness += 100;
- } else if (buffer === "reisen" && newChoon.reisenCount === 1) {
- str = "You gave " + newChoon.name + " Reisen II as well. He looks even happier.";
- newChoon.reisenCount++;
- newChoon.happiness += 50;
- } else if (buffer === "reisen" && newChoon.reisenCount === 2) {
- str = newChoon.name + " already has both Reisens. Where are you going to find another one?";
- } else if (buffer === "manga") {
- str = "You gave " + newChoon.name + " a manga. He reads it. ";
- buffer2 = Math.floor(Math.random()*20);
- if (buffer2 === 0) {
- str += "Bleh. Ecchi. He throws it away.";
- newChoon.happiness -= 50;
- } else if (buffer2 < 3) {
- str += "Yaoi. He gives it back as he isn't interested in reading that sort of thing.";
- newChoon.happiness -= 10;
- } else if (buffer2 < 5) {
- str += "Yuri. After sending the title to a group of his friends so they can read it later, he returns it.";
- } else if (buffer2 < 12) {
- str += "He seemed to enjoy the story, so he kept it for later.";
- newChoon.happiness += 10;
- } else if (buffer2 < 19) {
- str += "He liked the art style, so he kept it for later.";
- newChoon.happiness += 10;
- } else {
- str += "It's a good touhou manga. He kept it for later.";
- newChoon.happiness += 20;
- }
- } else if (buffer === "manga?") {
- str = "You gave " + newChoon.name + " a questionable manga. After glancing at the cover for a split second he threw it on the ground and burned it. Man, he really hated that.";
- newChoon.happiness -= 2147483648;
- } else {
- str = newChoon.name + " doesn't know what you gave him, but appreciates it anyway.";
- }
- }
- } else if (cmd.substr(0, 5) === "feed " || cmd === "feed") {
- if (cmd === "feed" || cmd === "feed ") {
- str = "You can't feed " + newChoon.name + " nothing...";
- } else {
- buffer = cmd.substr(5);
- if (buffer === "cupcake" || buffer === "cupcakes") {
- str = "You fed " + newChoon.name + " a cupcake. He seems to enjoy it!";
- newChoon.happiness += 20;
- } else if (buffer === "ramen") {
- str = "You fed " + newChoon.name + " a bowl of ramen. He seems to like the taste.";
- newChoon.happiness += 10;
- } else if (buffer === "reisen" && newChoon.reisenCount === 2) {
- str = "You don't have any more Reisens to attempt to feed him.";
- } else if (buffer === "reisen" && newChoon.reisenCount === 1) {
- str = "You thought about feeding " + newChoon.name + " Reisen II, until you realized that it was a terrible idea.";
- } else if (buffer === "reisen" && newChoon.reisenCount === 0) {
- str = "You thought about feeding " + newChoon.name + " Reisen. You sicko.";
- } else if (buffer === "walfaser" || buffer === "walfasers") {
- str = "You thought about feeding " + newChoon.name + " walfasers. Why would you even think that's a good idea?";
- } else if (buffer === "carrot" && newChoon.reisenCount === 2) {
- str = "You gave " + newChoon.name + " a carrot. He splits it into 2 and gives it to the Reisens, who seem to enjoy it.";
- newChoon.happiness += 10;
- } else if (buffer === "carrot" && newChoon.reisenCount === 1) {
- str = "You gave " + newChoon.name + " a carrot. He shares it with Reisen.";
- newChoon.happiness += 15;
- } else if (buffer === "carrot" && newChoon.reisenCount === 0) {
- str = "You gave " + newChoon.name + " a carrot. He chomps on it.";
- newChoon.happiness += 5;
- } else if (buffer === "cereal") {
- buffer2 = Math.floor(Math.random()*9);
- switch (buffer2) {
- case 8:
- str = "You fed " + newChoon.name + " a bowl of 'FSteak. He seems to enjoy playing with the free walfaser toy more than he does the cereal itself.";
- newChoon.happiness += 10;
- break;
- case 7:
- str = "You fed " + newChoon.name + " a bowl of Alice's Dolls. He thinks it's okay, but a bit crunchy.";
- newChoon.happiness += 5;
- break;
- case 6:
- str = "You fed " + newChoon.name + " a bowl of Cirnos. He enjoys the frosting.";
- newChoon.happiness += 10;
- break;
- case 5:
- str = "You fed " + newChoon.name + " a bowl of Hmm Flakes. He contemplates the flavor before rejecting it.";
- newChoon.happiness -= 5;
- break;
- case 4:
- str = "You fed " + newChoon.name + " a bowl of Junk-Os. He thinks it's junk.";
- newChoon.happiness -= 10;
- break;
- case 3:
- str = "You fed " + newChoon.name + " a bowl of I'm Bored. He gets bored of the taste.";
- newChoon.happiness -= 5;
- break;
- case 2:
- str = "You fed " + newChoon.name + " a bowl of Kagewoo Krunch. He howls out of enjoyment.";
- newChoon.happiness += 10;
- break;
- case 1:
- str = "You fed " + newChoon.name + " a bowl of Ran Flakes. He calculates the amount of nutrients in it.";
- newChoon.happiness += 5;
- break;
- case 0:
- if (newChoon.reisenCount === 2) {
- str = "You gave " + newChoon.name + " a bowl of Reisen Bran. He shares it with the others, who also appear to like it.";
- newChoon.happiness += 20;
- } else if (newChoon.reisenCount === 1) {
- str = "You gave " + newChoon.name + " a bowl of Reisen Bran. He shares it with Reisen, who also appears to like it.";
- newChoon.happiness += 20;
- } else {
- str = "You gave " + newChoon.name + " a bowl of Reisen Bran. After making sure that the raisins aren't actually Reisen, he seemed to like it.";
- newChoon.happiness += 10;
- }
- break;
- default:
- str = "You gave " + newChoon.name + " a bowl of ???????????. Wait that isn't supposed to happen!";
- }
- } else {
- str = newChoon.name + " wants to be sure that he knows what that is before he eats it.";
- }
- }
- } else {
- str = "I'm pretty sure that's an invalid command.";
- }
- console.log(str);
- main();
- });
- }
- main();
Advertisement
Add Comment
Please, Sign In to add comment