UNPKG

discord-battle-en

Version:
315 lines (289 loc) 22.4 kB
const {MessageEmbed, Collection} = require('discord.js') const scenarios = { mom: { }, dad: { }, partner: { }, weddedPartner: { } } class createLife { constructor(message, lifeCollection = new Collection(), cooldownCollection = new Collection()) { this.message = message this.lifeCollection = lifeCollection this.cooldownCollection = cooldownCollection } async strLife(name) { const message = this.message if (await this.lifeCollection.get(message.author.id)) return message.channel.send('You already have a life!') if (!message.author) return message.channel.send("Looks like the message object is messed up :/"); if (!name.includes(' ')) return message.channel.send("You have to include a last/proper name!") let binaryGenders = ['Male', 'Female'] let binaryGendersRandom = Math.floor(Math.random() * binaryGenders.length) let femaleFirstNames = ["Emily", "Hannah", "Madison", "Ashley", "Sarah", "Alexis", "Samantha", "Jessica", "Elizabeth", "Taylor", "Lauren", "Alyssa", "Kayla", "Abigail", "Brianna", "Olivia", "Emma", "Megan", "Grace", "Victoria", "Rachel", "Anna", "Sydney", "Destiny", "Morgan", "Jennifer", "Jasmine", "Haley", "Julia", "Kaitlyn", "Nicole", "Amanda", "Katherine", "Natalie", "Hailey", "Alexandra", "Savannah", "Chloe", "Rebecca", "Stephanie", "Maria", "Sophia", "Mackenzie", "Allison", "Isabella", "Amber", "Mary", "Danielle", "Gabrielle", "Jordan", "Brooke", "Michelle", "Sierra", "Katelyn", "Andrea", "Madeline", "Sara", "Kimberly", "Courtney", "Erin", "Brittany", "Vanessa", "Jenna", "Jacqueline", "Caroline", "Faith", "Makayla", "Bailey", "Paige", "Shelby", "Melissa", "Kaylee", "Christina", "Trinity", "Mariah", "Caitlin", "Autumn", "Marissa", "Breanna", "Angela", "Catherine", "Zoe", "Briana", "Jada", "Laura", "Claire", "Alexa", "Kelsey", "Kathryn", "Leslie", "Alexandria", "Sabrina", "Mia", "Isabel", "Molly", "Leah", "Katie", "Gabriella", "Cheyenne", "Cassandra", "Tiffany", "Erica", "Lindsey", "Kylie", "Amy", "Diana", "Cassidy", "Mikayla", "Ariana", "Margaret", "Kelly", "Miranda", "Maya", "Melanie", "Audrey", "Jade", "Gabriela", "Caitlyn", "Angel", "Jillian", "Alicia", "Jocelyn", "Erika", "Lily", "Heather", "Madelyn", "Adriana", "Arianna", "Lillian", "Kiara", "Riley", "Crystal", "Mckenzie", "Meghan", "Skylar", "Ana", "Britney", "Angelica", "Kennedy", "Chelsea", "Daisy", "Kristen", "Veronica", "Isabelle", "Summer", "Hope", "Brittney", "Lydia", "Hayley", "Evelyn", "Bethany", "Shannon", "Michaela", "Karen", "Jamie", "Daniela", "Angelina", "Kaitlin", "Karina", "Sophie", "Sofia", "Diamond", "Payton", "Cynthia", "Alexia", "Valerie", "Monica", "Peyton", "Carly", "Bianca", "Hanna", "Brenda", "Rebekah", "Alejandra", "Mya", "Avery", "Brooklyn", "Ashlyn", "Lindsay", "Ava", "Desiree", "Alondra", "Camryn", "Ariel", "Naomi", "Jordyn", "Kendra", "Mckenna", "Holly", "Julie", "Kendall", "Kara", "Jasmin", "Selena", "Esmeralda", "Amaya", "Kylee", "Maggie", "Makenzie", "Claudia", "Kyra", "Cameron", "Karla", "Kathleen", "Abby", "Delaney", "Amelia", "Casey", "Serena", "Savanna", "Aaliyah", "Giselle", "Mallory", "April", "Raven", "Adrianna", "Christine", "Kristina", "Nina", "Asia", "Natalia", "Valeria", "Aubrey", "Lauryn", "Kate", "Patricia", "Jazmin", "Rachael", "Katelynn", "Cierra", "Alison", "Macy", "Nancy", "Elena", "Kyla", "Katrina", "Jazmine", "Joanna", "Tara", "Gianna", "Juliana", "Fatima", "Allyson", "Gracie", "Sadie", "Guadalupe", "Genesis", "Yesenia", "Julianna", "Skyler", "Tatiana", "Alexus", "Alana", "Elise", "Kirsten", "Nadia", "Sandra", "Dominique", "Ruby", "Haylee", "Jayla", "Tori", "Cindy", "Sidney", "Ella", "Tessa", "Carolina", "Camille", "Jaqueline", "Whitney", "Carmen", "Vivian", "Priscilla", "Bridget", "Celeste", "Kiana", "Makenna", "Alissa", "Madeleine", "Miriam", "Natasha", "Ciara", "Cecilia", "Mercedes", "Kassandra", "Reagan"] let maleFirstNames = ["Jacob", "Michael", "Matthew", "Joshua", "Christopher", "Nicholas", "Andrew", "Joseph", "Daniel", "Tyler", "William", "Brandon", "Ryan", "John", "Zachary", "David", "Anthony", "James", "Justin", "Alexander", "Jonathan", "Christian", "Austin", "Dylan", "Ethan", "Benjamin", "Noah", "Samuel", "Robert", "Nathan", "Cameron", "Kevin", "Thomas", "Jose", "Hunter", "Jordan", "Kyle", "Caleb", "Jason", "Logan", "Aaron", "Eric", "Brian", "Gabriel", "Adam", "Jack", "Isaiah", "Juan", "Luis", "Connor", "Charles", "Elijah", "Isaac", "Steven", "Evan", "Jared", "Sean", "Timothy", "Luke", "Cody", "Nathaniel", "Alex", "Seth", "Mason", "Richard", "Carlos", "Angel", "Patrick", "Devin", "Bryan", "Cole", "Jackson", "Ian", "Garrett", "Trevor", "Jesus", "Chase", "Adrian", "Mark", "Blake", "Sebastian", "Antonio", "Lucas", "Jeremy", "Gavin", "Miguel", "Julian", "Dakota", "Alejandro", "Jesse", "Dalton", "Bryce", "Tanner", "Kenneth", "Stephen", "Jake", "Victor", "Spencer", "Marcus", "Paul", "Brendan", "Jeremiah", "Xavier", "Jeffrey", "Tristan", "Jalen", "Jorge", "Edward", "Riley", "Wyatt", "Colton", "Joel", "Maxwell", "Aidan", "Travis", "Shane", "Colin", "Dominic", "Carson", "Vincent", "Derek", "Oscar", "Grant", "Eduardo", "Peter", "Henry", "Parker", "Hayden", "Collin", "George", "Bradley", "Mitchell", "Devon", "Ricardo", "Shawn", "Taylor", "Nicolas", "Francisco", "Gregory", "Liam", "Kaleb", "Preston", "Erik", "Alexis", "Owen", "Omar", "Diego", "Dustin", "Corey", "Fernando", "Clayton", "Carter", "Ivan", "Jaden", "Javier", "Alec", "Johnathan", "Scott", "Manuel", "Cristian", "Alan", "Raymond", "Brett", "Max", "Andres", "Gage", "Mario", "Dawson", "Dillon", "Cesar", "Wesley", "Levi", "Jakob", "Chandler", "Martin", "Malik", "Edgar", "Trenton", "Sergio", "Josiah", "Nolan", "Marco", "Peyton", "Harrison", "Hector", "Micah", "Roberto", "Drew", "Brady", "Erick", "Conner", "Jonah", "Casey", "Jayden", "Emmanuel", "Edwin", "Andre", "Phillip", "Brayden", "Landon", "Giovanni", "Bailey", "Ronald", "Braden", "Damian", "Donovan", "Ruben", "Frank", "Pedro", "Gerardo", "Andy", "Chance", "Abraham", "Calvin", "Trey", "Cade", "Donald", "Derrick", "Payton", "Darius", "Enrique", "Keith", "Raul", "Jaylen", "Troy", "Jonathon", "Cory", "Marc", "Skyler", "Rafael", "Trent", "Griffin", "Colby", "Johnny", "Eli", "Chad", "Armando", "Kobe", "Caden", "Cooper", "Marcos", "Elias", "Brenden", "Israel", "Avery", "Zane", "Dante", "Josue", "Zackary", "Allen", "Mathew", "Dennis", "Leonardo", "Ashton", "Philip", "Julio", "Miles", "Damien", "Ty", "Gustavo", "Drake", "Jaime", "Simon", "Jerry", "Curtis", "Kameron", "Lance", "Brock", "Bryson", "Alberto", "Dominick", "Jimmy", "Kaden", "Douglas", "Gary", "Brennan", "Zachery", "Randy", "Louis", "Larry", "Nickolas", "Tony", "Albert", "Fabian", "Keegan", "Saul", "Danny", "Tucker", "Damon", "Myles", "Arturo", "Corbin", "Deandre", "Ricky", "Kristopher", "Lane", "Pablo", "Darren", "Zion", "Jarrett", "Alfredo", "Micheal", "Angelo", "Carl", "Oliver", "Kyler", "Tommy", "Walter", "Dallas", "Jace", "Quinn", "Theodore", "Grayson", "Lorenzo", "Joe", "Arthur", "Bryant", "Brent", "Roman", "Russell", "Ramon", "Lawrence", "Moises", "Aiden", "Quentin", "Tyrese", "Jay", "Tristen", "Emanuel", "Salvador", "Terry", "Morgan", "Jeffery", "Esteban", "Tyson", "Braxton", "Branden", "Brody", "Craig", "Marvin", "Ismael", "Rodney", "Isiah", "Maurice", "Marshall", "Ernesto", "Emilio", "Brendon", "Kody", "Eddie", "Malachi", "Abel", "Keaton", "Jon", "Shaun", "Skylar", "Nikolas", "Ezekiel", "Santiago", "Kendall", "Axel", "Camden", "Trevon"] let femaleFirstNameRandom = Math.floor(Math.random() * femaleFirstNames.length) let maleFirstNameRandom = Math.floor(Math.random() * maleFirstNames.length) let looksRandom = Math.floor(Math.random() * (100 - 30)) + 30 let smartsRandom = Math.floor(Math.random() * (100 - 25)) + 25 let happinessRandom = Math.floor(Math.random() * (100 - 50)) + 50 let healthRandom = Math.floor(Math.random() * (100 - 70)) + 70 let illnesses = ['depression', 'anxiety', 'measles', 'migraines', 'arthritis', 'ALL'] let illnessesRandomArray = ['depression', 'anxiety', 'measles', 'migraines', 'arthritis', 'ALL', 'none', 'none', 'none', 'none', 'none', 'none', 'none', 'none', 'none', 'none', 'none', 'none', 'none', 'none', 'none', 'none', 'none', 'none', 'none', 'none', 'none', 'none', 'none', 'none', 'none', 'none', 'none', 'none', 'none', 'none', 'none', 'none', 'none', 'none', 'none', 'none', 'none', 'none', 'none', 'none', 'none', 'none'] let illnessesStartRandom = Math.floor(Math.random() * illnessesRandomArray.length) this.life = { id: message.author.id, name: name, gender: binaryGenders[binaryGendersRandom], dad: { name: maleFirstNames[maleFirstNameRandom] + " " + name.split(' ')[1], relationship: 100 }, mom: { name: femaleFirstNames[femaleFirstNameRandom] + " " + name.split(' ')[1], relationship: 100 }, partner: { name: "none", relationship: 0 }, weddedPartner: { name: "none", relationship: 0 }, age: 0, car: "none", house: "none", job: "none", illnesses: { depression: false, anxiety: false, measles: false, migraines: false, arthritis: false, ALL: false }, health: healthRandom, happiness: happinessRandom, looks: looksRandom, smarts: smartsRandom, vacinated: false, items: ["rattle", "binky"] } this.depression = { name: "depression", health: Math.floor(Math.random() * (50 - 30) + 30), happiness: Math.floor(Math.random() * (40 - 5) + 5) } this.anxiety = { name: "anxiety", health: Math.floor(Math.random() * (50 - 30) + 30), happiness: Math.floor(Math.random() * (20 - 15) + 15), smarts: Math.floor(Math.random() * (40 - 15) + 15) } this.measles = { name: "measles", health: Math.floor(Math.random() * (50 - 25) + 25) } this.migraines = { name: "migraines", health: Math.floor(Math.random() * (50 - 25) + 25), smarts: Math.floor(Math.random() * (30 - 10) + 10) } this.arthritis = { name: "arthritis", health: Math.floor(Math.random() * (40 - 10) + 10) } this.ALL = { name: "ALL (Acute lymphocytic leukemia)", health: Math.floor(Math.random() * (15 - 5) + 5) } let startIllness; if (illnessesRandomArray[illnessesStartRandom] !== "none") { if (illnessesRandomArray[illnessesStartRandom] === "depression") { startIllness = this.depression this.life.illnesses.depression = true } if (illnessesRandomArray[illnessesStartRandom] === "anxiety") { startIllness = this.anxiety this.life.illnesses.anxiety = true } if (illnessesRandomArray[illnessesStartRandom] === "measles") { startIllness = this.measles this.life.illnesses.measles = true } if (illnessesRandomArray[illnessesStartRandom] === "migraines") { startIllness = this.migraines this.life.illnesses.migraines = true } if (illnessesRandomArray[illnessesStartRandom] === "arthritis") { startIllness = this.arthritis this.life.illnesses.arthritis = true } if (illnessesRandomArray[illnessesStartRandom] === "ALL") { startIllness = this.ALL this.life.illnesses.ALL = true } } else startIllness = "none" if (startIllness) { if (startIllness.health && !this.life.health <= startIllness.health) this.life.health = startIllness.health if (startIllness.happiness && !this.life.happiness <= startIllness.happiness) this.life.happiness = startIllness.happiness if (startIllness.smarts && !this.life.smarts <= startIllness.smarts) this.life.smarts = startIllness.smarts if (startIllness.looks && !this.life.looks <= startIllness.looks) this.life.looks = startIllness.looks } await this.lifeCollection.set(message.author.id, this.life) return message.channel.send(new MessageEmbed() .setTitle(`[${this.life.gender}] ${name}'s life!`) .addFields( { name: "Parents", value: `Dad: \`${this.life.dad.name}\` \`[${this.life.dad.relationship} / 100]\`\nMom: \`${this.life.mom.name}\` \`[${this.life.mom.relationship} / 100]\``, inline: true }, { name: "Statistics", value: `Health: \`${this.life.health} / 100\`\nHappiness: \`${this.life.happiness} / 100\`\nLooks: \`${this.life.looks} / 100\`\nSmarts: \`${this.life.smarts} / 100\``, inline: true }, { name: "Illnesses", value: `Depression: \`${this.life.illnesses.depression}\`\nAnxiety: \`${this.life.illnesses.anxiety}\`\nMeasles: \`${this.life.illnesses.measles}\`\nMigraines: \`${this.life.illnesses.migraines}\`\nAcute lymphocytic leukemia: \`${this.life.illnesses.ALL}\``, inline: true }, { name: "Items", value: `\`${this.life.items.join('`, `')}\``, inline: true } ) .setFooter('Gender can be changed') .setColor("GREEN") ); } async addYear(message) { if (!await this.lifeCollection.get(message.author.id)) return message.channel.send('You haven\'t made a life yet!') if (await this.cooldownCollection.get(message.author.id) === true) return message.channel.send('Please wait, you are on cooldown for about \`45\` seconds!') const life = await this.lifeCollection.get(message.author.id) let illnessesRandomArray = ['depression', 'anxiety', 'measles', 'migraines', 'arthritis', 'ALL', 'none', 'none', 'none', 'none', 'none', 'none', 'none', 'none', 'none', 'none', 'none', 'none', 'none', 'none', 'none', 'none', 'none', 'none', 'none', 'none', 'none', 'none', 'none', 'none', 'none', 'none', 'none', 'none', 'none', 'none', 'none', 'none', 'none', 'none', 'none', 'none', 'none', 'none', 'none', 'none', 'none', 'none'] let illnessesRandom = Math.floor(Math.random() * illnessesRandomArray.length) let youngHealthyDeathChance = Math.floor(Math.random() * 250) let youngMediumHealthyDeathChance = Math.floor(Math.random() * 225) let youngUnhealthyDeathChance = Math.floor(Math.random() * 200) let adultHealthyDeathChance = Math.floor(Math.random() * 200) let adultMediumHealthyDeathChance = Math.floor(Math.random() * 175) let adultUnhealthyDeathChance = Math.floor(Math.random() * 150) let elderHealthyDeathChance = Math.floor(Math.random() * 150) let elderMediumHealthyDeathChance = Math.floor(Math.random() * 125) let elderUnhealthyDeathChance = Math.floor(Math.random() * 100) let unhappySuicideChance = Math.floor(Math.random() * 50) if (life.health === 0) return this.death(message, "Natural Causes"); if (life.age <= 20 && life.health >= 70 && youngHealthyDeathChance === 250) return this.death(message, "Natural Causes"); if (life.age <= 20 && life.health >= 40 && life.health < 70 && youngMediumHealthyDeathChance === 225) return this.death(message, "Natural Causes"); if (life.age <= 20 && life.health >= 1 && life.health < 40 && youngUnhealthyDeathChance === 200) return this.death(message, "Natural Causes"); if (life.age > 20 && life.age <= 60 && life.health >= 70 && adultHealthyDeathChance === 200) return this.death(message, "Natural Causes"); if (life.age > 20 && life.age <= 60 && life.health >= 40 && life.health < 70 && adultMediumHealthyDeathChance === 175) return this.death(message); if (life.age > 20 && life.age <= 60 && life.health >= 1 && life.health < 40 && adultUnhealthyDeathChance === 150) return this.death(message, "Natural Causes"); if (life.age > 60 && life.age <= 100 && life.health >= 70 && elderHealthyDeathChance === 200) return this.death(message, "Natural Causes"); if (life.age > 60 && life.age <= 100 && life.health >= 40 && life.health < 70 && elderMediumHealthyDeathChance === 175) return this.death(message, "Natural Causes"); if (life.age > 60 && life.age <= 100 && life.health >= 1 && life.health < 40 && elderUnhealthyDeathChance === 150) return this.death(message, "Natural Causes"); if (life.age > 12 && life.happiness <= 5 && unhappySuicideChance === 50) return this.death(message, "Suicide (Not Chosen)") life.age += 1 await message.channel.send(`You are now ${life.age}!`) let illness; if (illnessesRandomArray[illnessesRandom] !== "none") { if (illnessesRandomArray[illnessesRandom] === "depression" && life.illnesses.depression === false) { illness = this.depression life.illnesses.depression = true } if (illnessesRandomArray[illnessesRandom] === "anxiety" && life.illnesses.anxiety === false) { illness = this.anxiety life.illnesses.anxiety = true } if (illnessesRandomArray[illnessesRandom] === "measles" && life.illnesses.measles === false) { illness = this.measles life.illnesses.measles = true } if (illnessesRandomArray[illnessesRandom] === "migraines" && life.illnesses.migraines === false) { illness = this.migraines life.illnesses.migraines = true } if (illnessesRandomArray[illnessesRandom] === "arthritis" && life.illnesses.arthritis === false) { illness = this.arthritis life.illnesses.arthritis = true } if (illnessesRandomArray[illnessesRandom] === "ALL" && life.illnesses.ALL === false) { illness = this.ALL life.illnesses.ALL = true } } if (illness) { if (illness.health && !life.health <= illness.health) life.health = illness.health if (illness.happiness && !life.happiness <= illness.happiness) life.happiness = illness.happiness if (illness.smarts && !life.smarts <= illness.smarts) life.smarts = illness.smarts if (illness.looks && !life.looks <= illness.looks) life.looks = illness.looks message.channel.send(`You are now suffering from \`${illness.name}\`!`) } if (life.age === 2) { message.channel.send(new MessageEmbed() .setTitle('Vaccination') .setDescription(`Your mom wants to take you to get vaccinated will you:\n1 Throw a fit\n2 Let her vaccinate you\n3 Bite her`) .setColor("ORANGE") ).then(async msg => { await msg.react("1️⃣") await msg.react("2️⃣") await msg.react("3️⃣") const filter1 = (reaction, user) => reaction.emoji.name === "1️⃣" && user.id === life.id; const collector1 = msg.createReactionCollector(filter1, {max: 1}) collector1.on('collect', async collected => { await msg.edit(new MessageEmbed() .setTitle('Vaccination') .setDescription('You threw a fit\nShe took you to get vaccinated anyway') .setColor("RED") ) life.vacinated = true }) const filter2 = (reaction, user) => reaction.emoji.name === "2️⃣" && user.id === life.id; const collector2 = msg.createReactionCollector(filter2, {max: 1}) collector2.on('collect', async collected => { await msg.edit(new MessageEmbed() .setTitle('Vaccination') .setDescription('You let her vaccinate you\nYou got vaccinated') .setColor("GREEN") ) life.vacinated = true }) const filter3 = (reaction, user) => reaction.emoji.name === "3️⃣" && user.id === life.id; const collector3 = msg.createReactionCollector(filter3, {max: 1}) collector3.on('collect', async collected => { msg.edit(new MessageEmbed() .setTitle('Vaccination') .setDescription('You bit her\nShe didn\'t take you to get vaccinated') .setColor("GREEN") ) }) }) } console.log(life) await this.cooldownCollection.set(message.author.id, true) setTimeout(async () => { await this.cooldownCollection.set(message.author.id, false) return this.lifeCollection.set(message.author.id, life) }, 45000) } async seeRelationship(message, person) { } async commitCrime(message, crime) { } async buyItem(message, item) { } async death(message, reason) { if (await this.cooldownCollection.get(message.author.id) === true) return message.channel.send('Please wait, you are on cooldown for about \`45\` seconds!') await this.cooldownCollection.delete(message.author.id) console.log(await this.lifeCollection.get(message.author.id)) await this.lifeCollection.delete(message.author.id) return message.channel.send(reason) } } module.exports.createLife = createLife