"use strict"; const resourceTypes = { "food": { name: "Food" } } const buildings = { "micro": { "name": "Micro", "plural": "Micros", "desc": "A tasty, squirmy treat.", "cost": 1e1, "prod": 1e-1/1, "icon": "fa-universal-access" }, "anthro": { "name": "Anthro", "plural": "Anthros", "desc": "Something more substantial to sate your hunger.", "cost": 1e2, "prod": 1e0/1.1, "icon": "fa-male" }, "car": { "name": "Car", "plural": "Cars", "desc": "Crunchy shell, tasty center.", "cost": 1.2e3, "prod": 1e1/1.2, "icon": "fa-car" }, "bus": { "name": "Bus", "plural": "Buses", "desc": "Probably the worst place to be when a macro is aroud.", "cost": 1.4e4, "prod": 1e2/1.3, "icon": "fa-bus" }, "house": { "name": "House", "plural": "Houses", "desc": "Home sweet home - but it doesn't taste sweet?", "cost": 1.6e5, "prod": 1e3/1.4, "icon": "fa-home" }, "apartment": { "name": "Apartment", "plural": "Apartments", "desc": "More snacks, less packaging.", "cost": 1.8e6, "prod": 1e4/1.5, "icon": "fa-building" }, "block": { "name": "Block", "plural": "Blocks", "desc": "A whole pile of buildings.", "cost": 2e7, "prod": 1e5/1.6, "icon": "fa-warehouse" }, "town": { "name": "Town", "plural": "Towns", "desc": "'Tourist trap' has never been this literal.", "cost": 2.2e8, "prod": 1e6/1.7, "icon": "fa-store" }, "city": { "name": "City", "plural": "Cities", "desc": "Please no sitty on our city.", "cost": 2.4e9, "prod": 1e7/1.8, "icon": "fa-city" }, "metro": { "name": "Metropolis", "plural": "Metropolises", "desc": "A big ol' city. Tasty, too.", "cost": 2.6e10, "prod": 1e8/1.9, "icon": "fa-landmark" }, "county": { "name": "County", "plural": "Counties", "desc": "Why salt the land when you can slurp it?", "cost": 2.8e11, "prod": 1e9/2, "icon": "fa-map" }, "state": { "name": "State", "plural": "States", "desc": "The United States is made up of...43 states - no, 42...", "cost": 3e12, "prod": 1e10/2.1, "icon": "fa-map-signs" }, "country": { "name": "Country", "plural": "Countries", "desc": "One nation, under paw.", "cost": 3.2e13, "prod": 1e11/2.2, "icon": "fa-flag" }, "continent": { "name": "Continent", "plural": "Continents", "desc": "Earth-shattering appetite!", "cost": 3.4e14, "prod": 1e12/2.3, "icon": "fa-mountain" }, "planet": { "name": "Planet", "plural": "Planets", "desc": "Earth appetite!", "cost": 3.6e15, "prod": 1e13/2.4, "icon": "fa-globe-europe" }, "solar-system": { "name": "Solar System", "plural": "Solar Systems", "desc": "Earths appetite!", "cost": 3.8e16, "prod": 1e14/2.5, "icon": "fa-meteor" }, "galaxy": { "name": "Galaxy", "plural": "Galaxies", "desc": "In a galaxy far, far down your gullet...", "cost": 4.0e17, "prod": 1e15/2.6, "icon": "fa-sun" }, "universe": { "name": "Universe", "plural": "Universes", "desc": "Into the you-verse.", "cost": 4.2e18, "prod": 1e16/2.7, "icon": "fa-asterisk" }, "multiverse": { "name": "Multiverse", "plural": "Multiverses", "desc": "This is getting very silly.", "cost": 4.4e19, "prod": 1e17/2.8, "icon": "fa-infinity" } } const effect_types = { "prod": { "apply": function(effect, productivity) { return productivity * effect.amount; }, "desc": function(effect) { return round(effect.amount, 2) + "x food production from " + buildings[effect.target].plural; } }, "prod-all": { "apply": function(effect, productivity) { return productivity * effect.amount; }, "desc": function(effect) { return round((effect.amount - 1) * 100) + "% increase to food production"; } }, "helper": { "apply": function(effect, productivity, helperCount) { return productivity * (1 + effect.amount * helperCount); }, "desc": function(effect) { return "+" + round(effect.amount * 100) + "% food/sec from " + buildings[effect.helped].name + " for every " + buildings[effect.helper].name + " owned."; } }, "click": { "apply": function(effect, bonus, productivity) { return bonus + productivity * effect.amount; }, "desc": function(effect) { return round(effect.amount * 100) + "% of food/sec gained per click"; } }, "click-victim": { "desc": function(effect) { return "Devour larger prey"; } } } let upgrades = { } function createTemplateUpgrades() { createProdUpgrades(); createProdAllUpgrades(); createClickUpgrades(); createHelperUpgrades(); createClickVictimUpgrades(); } const prodUpgradeCounts = [1, 5, 10, 25, 50, 75, 100]; function createProdUpgrades() { for (const [key, value] of Object.entries(prodUpgradeText)) { let counter = 1; let prefix = key + "-prod-"; for (let contents of value) { upgrades[prefix + counter] = { "name": contents.name, "desc": contents.desc, "icon": buildings[key].icon, "cost": { "food": buildings[key].cost * 5 * Math.pow(10,counter - 1) }, "effects": [ { "type": "prod", "amount": 2 + (counter - 1) * 0.25, "target": key } ] }; upgrades[prefix + counter]["prereqs"] = {}; upgrades[prefix + counter]["prereqs"]["buildings"] = {}; upgrades[prefix + counter]["prereqs"]["buildings"][key] = prodUpgradeCounts[counter - 1]; if (counter > 1) { upgrades[prefix + counter]["prereqs"]["upgrades"] = [ prefix + (counter - 1) ]; } counter += 1; } } } function createProdAllUpgrades() { let prefix = "prod-all-" let counter = 1; for (let contents of prodAllUpgradeText) { upgrades[prefix + counter] = { "name": contents.name, "desc": contents.desc, "icon": "fa-cogs", "cost": { "food": 5 * Math.pow(10, counter+1) }, "effects": [ { "type": "prod-all", "amount": 1.05 } ], "prereqs": { "productivity": { "food": Math.pow(10, counter) } } }; if (counter > 1) { upgrades[prefix + counter]["prereqs"].upgrades = [ prefix + (counter - 1) ]; } counter += 1; } } function createClickUpgrades() { let prefix = "prod-click-"; let counter = 1 ; for (let contents of clickUpgradeText) { upgrades[prefix + counter] = { name: contents.name, desc: contents.desc, icon: "fa-hand-pointer", cost: { food: Math.pow(10, (counter*2)+1) }, effects: [ { type: "click", amount: 0.01 } ], prereqs: { productivity: { food: Math.pow(10, counter) } } }; if (counter > 1) { upgrades[prefix + counter]["prereqs"].upgrades = [ prefix + (counter - 1) ]; } counter += 1; } } function createHelperUpgrades() { const infix = "-help-"; Object.entries(helperUpgradeText).forEach(([helper, helpees]) => { const prefix = helper; Object.entries(helpees).forEach(([helped, texts]) => { const suffix = helped; let counter = 1; for (let text of texts) { const key = prefix + infix + suffix + "-" + counter; console.log(key); upgrades[key] = { "name": text.name, "desc": text.desc, "icon": "fa-hand-holding", "cost": { "food": buildings[helper].cost * 25 * counter + buildings[helped].cost * 50 * counter }, "effects": [ { "type": "helper", "helper": helper, "helped": helped, "amount": 0.01 * counter } ], "prereqs": { "buildings": { }, "upgrades": [ helper + "-prod-1" ] } }; upgrades[key]["prereqs"]["buildings"][helper] = 10 * counter; if (counter > 1) { upgrades[key]["prereqs"]["upgrades"].push(prefix + infix + suffix + "-" + (counter - 1) ) } counter += 1; } }); }); } function createClickVictimUpgrades() { const prefix = "click-"; let counter = 1; let previous = "micro"; Object.entries(clickVictimUpgradeText).forEach(([key, text]) => { upgrades[prefix + key] = { "name": text.name, "desc": text.desc, "icon": buildings[key].icon, "cost": { "food": 1000 * Math.pow(10, counter) }, "effects": [ { "type": "click-victim", "id": key } ], "prereqs": { "upgrades": [ ] } }; if (counter > 1) { upgrades[prefix + key].prereqs.upgrades.push(prefix + previous); } counter += 1; previous = key; }); } let prodUpgradeText = { "micro": [ { "name": "Bigger Micros", "desc": "A macro micro? It's more filling, for sure.", }, { "name": "Beefy Micros", "desc": "25% more protein, 10% fewer carbs." }, { "name": "Delicious Micros", "desc": "Betcha' can't eat just one." }, { "name": "Irresistable Micros", "desc": "Genetically engineered to be delectable." }, { "name": "Exquisite Micros", "desc": "Dangerously delicious." } ], "anthro": [ { "name": "Willing Prey", "desc": "Why bother chasing down your meal?" }, { "name": "Fattened Prey", "desc": "9 calories per gram!" }, { "name": "Mesmerized Prey", "desc": "Why bother walking to your meal?" }, { "name": "Food-Safe Lubricant", "desc": "Ease them down your gullet with ease. Thanks, chemistry!" }, { "name": "Mandatory Meal Training", "desc": "Educating prey on basic food etiquette helps reduce maw congestion and speeds digestion by 27%." } ], "car": [ { "name": "HOV Lane", "desc": "Think of the environment! And of your impending digestion, I guess." }, { "name": "Lightweight Frames", "desc": "Although crunchy, the shell around the snacks isn't very appetizing." }, { "name": "Traffic Engineering", "desc": "Maximizing throughput into your gullet." }, { "name": "Super Highways", "desc": "Six lanes! Fresh pavement! A ravenous maw!" }, { "name": "Stacked Cars", "desc": "When we couldn't make the roads any wider, we tried stacking the cars higher." } ], "bus": [ { "name": "Bus Passes", "desc": "Save on greenhouse emissions. Save your predator's effort. Everyone wins!" }, { "name": "Double Deckers", "desc": "Stack 'em up! Slurp 'em down!" }, { "name": "Articulated Buses", "desc": "The bend really helps them slip down your throat." }, { "name": "Tour Buses", "desc": "People come from around the world to see your intestinal tract.", }, { "name": "Double Double Deckers", "desc": "Hard to swallow, true, but filling nonetheless." } ], "house": [ { "name": "Second Story", "desc": "Twice as many snacks, half as much chewing." }, { "name": "Remodeling", "desc": "Strip out that icky asbestos." }, { "name": "Smaller Yards", "desc": "Less wasted space. More wasted homes." }, { "name": "House Parties", "desc": "More people! More party! More prey!" }, { "name": "Suburbia", "desc": "It's like a buffet line!" } ], "apartment": [ { "name": "Rent Subsidies", "desc": "Encourage high-density living. Enjoy the result." }, { "name": "High-Rises", "desc": "These sure are some Tilted Towers..." }, { "name": "Reverse Eviction", "desc": "Forcibly putting people IN your lunch!" }, { "name": "Higher High-Rises", "desc": "Almost as tall as you! Almost." }, { "name": "Vertical Beds", "desc": "You can fit way more people in a studio apartment with this one weird tip..." } ], "block": [ { "name": "Street Sweepers", "desc": "Keeps the gunk off the sidewalk, and thus, off your tongue." }, { "name": "Zoning Laws", "desc": "Mandatory prey-per-square-meter requirements." }, { "name": "Alleyway Appetizers", "desc": "You can fit people *between* the buildings." }, { "name": "Block Party", "desc": "Everyone's invited!" }, { "name": "Vertical Blocks", "desc": "There's no reason you can't stack them on top of each other, right?" } ], "town": [ { "name": "Going to Town", "desc": "That's where the food is." }, { "name": "Going to Town, II: Revelations", "desc": "That's where the food is, again." }, { "name": "Going to Town 0: Origins", "desc": "That's where the food was." }, { "name": "Going to Town III: Revengeance", "desc": "Look, it's just how nature works. Food gets ate." }, { "name": "Going to Town IV: Endgame", "desc": "Food IS something one considers when eating the universe." } ], "city": [ { "name": "Gridlock", "desc": "Keeps people within arm's reach." }, { "name": "Skyscrapers", "desc": "Corn on the cob? Corn on the cob." }, { "name": "Protest March", "desc": "\"We have rights!\" chants the crowd. Unfortunately, they also have calories." }, { "name": "Urban Sprawl", "desc": "What a lovely spread of Hors d'oeuvres!" }, { "name": "Sim City", "desc": "You wouldn't download a city." } ], "metro": [ { "name": "Suburbia", "desc": "As far as the eye can see!" }, { "name": "Mass Transit", "desc": "Mass transit? Ass transit." }, { "name": "Slackened Building Codes", "desc": "Who cares about things over 'overcrowding'?" }, { "name": "Over-Ground Subway", "desc": "Putting the subway above-ground makes it a *lot* easier to feed on." }, { "name": "No Building Codes", "desc": "Just cram people inside." } ], "county": [ { "name": "County Roads", "desc": "Eh, close enough." }, { "name": "Redistricting", "desc": "Optimize your snacking excursions." }, { "name": "Peoplesheds", "desc": "Like watersheds, but, you know, people." }, { "name": "Economic Stimulus", "desc": "Just kidding! It's just an excuse to devour more people." }, { "name": "Giant Pile of People", "desc": "Literally no pretenses anymore. You're just eating big piles of people." } ], "state": [ { "name": "States' Rights", "desc": "...to feed you lots and lots of people." }, { "name": "Interstate Commerce", "desc": "Exports: People. Imports: Not people." }, { "name": "Gerrymandering", "desc": "Unethical? Yes. Illegal? Maybe. Delicious? Absolutely!" }, { "name": "State of Hunger", "desc": "It's a regional emergency! Feed the poor beast!" }, { "name": "Arcologies", "desc": "Just put everyone in one building. One big building." } ], "country": [ { "name": "Country Roads", "desc": "Take me hooooooome / to the plaaaaaace / where GULP." }, { "name": "Election Mawnth", "desc": "Get out the vote! Get in the monster!" }, { "name": "Voretime Economy", "desc": "Better than a wartime economy." }, { "name": "Two-Party Stomach", "desc": "We take the parties, and we put them in the stomach. Truly bipartisan!" }, { "name": "Civil Vore", "desc": "I ran out of puns." }, ], "continent": [ { "name": "Continental Drift", "desc": "Drifting right into your mouth." }, { "name": "Queso", "desc": "To go with the continent chips." }, { "name": "More Queso", "desc": "To go with the queso and the continent chips." }, { "name": "Pangaea", "desc": "It's like a BIG corn chip." }, { "name": "Extra Dip", "desc": "MORE." } ], "planet": [ { "name": "Flat Earth Rebuttal", "desc": "A flat earth wouldn't have the chewy center." }, { "name": "Extra Quarters", "desc": "To put in the gumball machine." }, { "name": "Earth-Like Planets", "desc": "They're a *lot* easier to eat than the gas giants." }, { "name": "Ringworlds", "desc": "They're artificial, yes, but they're very nutritious." }, { "name": "BFG", "desc": "The Big Fucking Gumball" } ], "solar-system": [ { "name": "Sol Survivor", "desc": "Just kidding! Sol didn't survive." }, { "name": "Solar Snacks", "desc": "Betcha' can't just eat one." }, { "name": "Orbital Plain", "desc": "Sometimes you just want the vanilla flavor." }, { "name": "Comet Cruncher", "desc": "A refreshing icy treat." }, { "name": "Vorrery", "desc": "Orrery. Vorrery. Heh." } ], "galaxy": [ { "name": "Galactic Hitman", "desc": "You're basically a hitman, right? You're taking people out." }, { "name": "Mass Effect", "desc": "All of the mass you're eating is gonna have an effect on your waistline." }, { "name": "Star Vores", "desc": "Munch." }, { "name": "Star Citizens", "desc": "I'm sure we'll get to eat them eventually." }, { "name": "Good Old Galaxies", "desc": "There are some great gems out there." } ], "universe": [ { "name": "Universal Healthcare", "desc": "Gotta keep everyone in peak condition, right?" }, { "name": "Big Crunch", "desc": "A heckin cromch." }, { "name": "Bigger Cosmological Constant", "desc": "I don't know what this does, but it sure makes things tastier!" }, { "name": "Big Bang 2", "desc": "If the big bang was so good..." }, { "name": "Spacetime Salad", "desc": "Don't forget the quantum salt!" } ], "multiverse": [ { "name": "Theory of Everything", "desc": "My theory: everything is edible." }, { "name": "Extradimensional Fork", "desc": "To eat the multiverses with, duh." }, { "name": "Multi-Multiverses", "desc": "Eh, why not?" }, { "name": "More Food", "desc": "We're running out of ideas here." }, { "name": "Gorge 2", "desc": "Coming Soon™" } ], } let prodAllUpgradeText = [ { "name": "Sloth Metabolism", "desc": "Burn those calories. Eventually." }, { "name": "Decent Metabolism", "desc": "Picking up the pace." }, { "name": "Perky Metabolism", "desc": "Sweat a little." }, { "name": "Quick Metabolism", "desc": "Burn those calories." }, { "name": "Speedy Metabolism", "desc": "More prey, more power." }, { "name": "Fast Metabolism", "desc": "You're a furnace. Fueled by people." }, { "name": "Powerful Metabolism", "desc": "Digest them all." }, { "name": "Unbelievable Metabolism", "desc": "Digest them all and more." }, { "name": "Supernatural Metabolism", "desc": "Digest everything." }, { "name": "Godly Metabolism", "desc": "Digest." } ] const clickUpgradeText = [ { "name": "Grabby Hands", "desc": "Gathers prey, opens rooftops" }, { "name": "Long Tongue", "desc": "Catches stragglers, tastes architecture" }, { "name": "Sharp Eyes", "desc": "Spots snacks, probably unblinking" }, { "name": "Sensitive Nose", "desc": "Sniffs meals, savors scents" }, { "name": "Sensitive Ears", "desc": "Hears screams, finds leftovers" }, { "name": "Greedy Hands", "desc": "Hoards prey, no leftovers" }, { "name": "Nimble Tongue", "desc": "Snares snacks, without escape" }, { "name": "Eagle Eyes", "desc": "Scans streets, always keen" }, { "name": "Keen Nose", "desc": "Finds prey, never fooled" }, { "name": "Perfect Ears", "desc": "Senses scuttles, won't relent" }, ] const helperUpgradeText = { "anthro": { "micro": [ { "name": "Gatherers", "desc": "Why bother chasing them, really?" }, { "name": "Servants", "desc": "Why bother walking anywhere, really?" }, ] } } const clickVictimUpgradeText = { "anthro": { "name": "Same-Size Prey", "desc": "Devour an anthro with every click" }, "car": { "name": "Car Crusher", "desc": "Consume a car with every click" }, "bus": { "name": "Bus Buffet", "desc": "Swallow an entire bus with every click" }, "house": { "name": "Homewrecker", "desc": "Eat a home with every click" }, "apartment": { "name": "Rent-Seeker", "desc": "Guzzle an apartment with every click" }, "block": { "name": "Block Breaker", "desc": "Gulp an entire block with every click" }, "town": { "name": "Town Terrorizer", "desc": "Bolt down a whole town with every click" }, "city": { "name": "City Cafe", "desc": "Feast on an entire city with every click" }, "metro": { "name": "Metro Muncher", "desc": "Polish off a metropolis with every click" }, "county": { "name": "County Glurk", "desc": "Ingest an entire county with every click" }, "state": { "name": "Stomached State", "desc": "Gobble an entire state with every click" }, "country": { "name": "Country Chow", "desc": "Erase a country with every click" }, "continent": { "name": "Continental Drift", "desc": "Chow down on a continent with every click" }, "planet": { "name": "Popcorn Planets", "desc": "Ingest a planet whole with every click" }, "solar-system": { "name": "Solar Snacks", "desc": "Dine on whole solar systems with every click" }, "galaxy": { "name": "Galactic Center", "desc": "Dispatch a galaxy with every click" }, "universe": { "name": "Universal Predator", "desc": "Digest a universe with every click" }, "multiverse": { "name": "Omniscience", "desc": "Gorge on the multiverse" } }; // to avoid yoinking stuff from global variables directly... // state.ownedUpgrades == ownedUpgrades // state.resources == resources // state.currentProductivity == currentProductivity // state.belongings == belongings const news = [ { condition: state => { return true; }, lines: [ state => "This is news.", state => "This is also news.", state => "SPORTS!" ] }, { condition: state => { return state.resources.food > 100; }, lines: [ state => "You have at least 100 food. Wow!" ] }, { condition: state => { return state.currentProductivity.food > 100; }, lines: [ state => "You're eating more than 100 food per second. Wow!" ] }, { condition: state => { return state.belongings.micro.count >= 50; }, lines: [ state => "You have at least 50 micros. Wow!" ] } ]