"use strict"; const start_color = "#882222"; const end_color = "#228888"; //const range = chroma.scale([start_color, end_color]).mode("lab"); const range = chroma.cubehelix().scale().domain([-0.2, 1]).mode("lab"); // literally just stealing these from cookie clicker const tiers = [ "#fffeff", "#fa8ce3", "#00dffe", "#ffca32", "#e8d676", "#a7c091", "#6c5759", "#d4c1bc", "#9bb637", "#05ddf8", "#b76133", "#e1dfde" ] const resourceTypes = { "food": { name: "food", desc: "Earned from eating. Pays for lots of things.", generated: true }, "powerups": { name: "power crystals", desc: "Earned from clicking powerups. Pays for powerup upgrades.", generated: false } } deepFreeze(resourceTypes); const buildings = { "micro": { "name": "Micro", "plural": "Micros", "desc": "A tasty, squirmy treat.", "cost": { "food": 1e1 }, "prod": { "food": 1e-1 / 1 }, "icon": "fa-universal-access" }, "anthro": { "name": "Anthro", "plural": "Anthros", "desc": "Something more substantial to sate your hunger.", "cost": { "food": 1e2 }, "prod": { "food": 1e0 / 1.1 }, "icon": "fa-male" }, "car": { "name": "Car", "plural": "Cars", "desc": "Crunchy shell, tasty center.", "cost": { "food": 1.2e3 }, "prod": { "food": 1e1 / 1.2 }, "icon": "fa-car" }, "bus": { "name": "Bus", "plural": "Buses", "desc": "Probably the worst place to be when a macro is aroud.", "cost": { "food": 1.4e4 }, "prod": { "food": 1e2 / 1.3 }, "icon": "fa-bus" }, "house": { "name": "House", "plural": "Houses", "desc": "Home sweet home - but it doesn't taste sweet?", "cost": { "food": 1.6e5 }, "prod": { "food": 1e3 / 1.4 }, "icon": "fa-home" }, "apartment": { "name": "Apartment", "plural": "Apartments", "desc": "More snacks, less packaging.", "cost": { "food": 1.8e6 }, "prod": { "food": 1e4 / 1.5 }, "icon": "fa-building" }, "block": { "name": "Block", "plural": "Blocks", "desc": "A whole pile of buildings.", "cost": { "food": 2e7 }, "prod": { "food": 1e5 / 1.6 }, "icon": "fa-warehouse" }, "town": { "name": "Town", "plural": "Towns", "desc": "'Tourist trap' has never been this literal.", "cost": { "food": 2.2e8 }, "prod": { "food": 1e6 / 1.7 }, "icon": "fa-store" }, "city": { "name": "City", "plural": "Cities", "desc": "Please no sitty on our city.", "cost": { "food": 2.4e9 }, "prod": { "food": 1e7 / 1.8 }, "icon": "fa-city" }, "metro": { "name": "Metropolis", "plural": "Metropolises", "desc": "A big ol' city. Tasty, too.", "cost": { "food": 2.6e10 }, "prod": { "food": 1e8 / 1.9 }, "icon": "fa-landmark" }, "county": { "name": "County", "plural": "Counties", "desc": "Why salt the land when you can slurp it?", "cost": { "food": 2.8e11 }, "prod": { "food": 1e9 / 2 }, "icon": "fa-map" }, "state": { "name": "State", "plural": "States", "desc": "The United States is made up of...43 states - no, 42...", "cost": { "food": 3e12 }, "prod": { "food": 1e10 / 2.1 }, "icon": "fa-map-signs" }, "country": { "name": "Country", "plural": "Countries", "desc": "One nation, under paw.", "cost": { "food": 3.2e13 }, "prod": { "food": 1e11 / 2.2 }, "icon": "fa-flag" }, "continent": { "name": "Continent", "plural": "Continents", "desc": "Earth-shattering appetite!", "cost": { "food": 3.4e14 }, "prod": { "food": 1e12 / 2.3 }, "icon": "fa-mountain" }, "planet": { "name": "Planet", "plural": "Planets", "desc": "Earth appetite!", "cost": { "food": 3.6e15 }, "prod": { "food": 1e13 / 2.4 }, "icon": "fa-globe-europe" }, "solar-system": { "name": "Solar System", "plural": "Solar Systems", "desc": "Earths appetite!", "cost": { "food": 3.8e16 }, "prod": { "food": 1e14 / 2.5 }, "icon": "fa-meteor" }, "galaxy": { "name": "Galaxy", "plural": "Galaxies", "desc": "In a galaxy far, far down your gullet...", "cost": { "food": 4.0e17 }, "prod": { "food": 1e15 / 2.6 }, "icon": "fa-sun" }, "universe": { "name": "Universe", "plural": "Universes", "desc": "Into the you-verse.", "cost": { "food": 4.2e18 }, "prod": { "food": 1e16 / 2.7 }, "icon": "fa-asterisk" }, "multiverse": { "name": "Multiverse", "plural": "Multiverses", "desc": "This is getting very silly.", "cost": { "food": 4.4e19 }, "prod": { "food": 1e17 / 2.8 }, "icon": "fa-infinity" } } deepFreeze(buildings); const effect_types = { "prod": { "apply": function (effect, productivity) { return scaleCost(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 scaleCost(productivity, effect.amount); }, "desc": function (effect) { return round((effect.amount - 1) * 100) + "% increase to food production"; } }, "helper": { "apply": function (effect, productivity, helperCount) { return scaleCost(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"; } }, "powerup-freq": { "apply": function (effect, delay) { return delay * effect.amount; }, "desc": function (effect) { return "Speed up powerup spawns by " + Math.round((1 / effect.amount - 1) * 100) + "%"; } } } deepFreeze(effect_types); let upgrades = { } function createTemplateUpgrades() { createProdUpgrades(); createProdAllUpgrades(); createClickUpgrades(); createHelperUpgrades(); createClickVictimUpgrades(); createPowerupFreqUpgrades(); createFreeBuildingPowerups(); createNews(); deepFreeze(upgrades); deepFreeze(powerups); deepFreeze(news); } const prodUpgradeCounts = [1, 25, 50, 100, 150]; const prodUpgradeColors = range.colors(5); 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": [ { icon: buildings[key].icon, color: tiers[counter - 1] } ], "cost": { "food": buildings[key].cost.food * 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; } } } const prodAllUpgradeColors = range.colors(10) function createProdAllUpgrades() { let prefix = "prod-all-" let counter = 1; for (let contents of prodAllUpgradeText) { upgrades[prefix + counter] = { "name": contents.name, "desc": contents.desc, "icon": [ { icon: "fa-cogs", color: tiers[counter - 1] } ], "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; } } const clickUpgradeColors = range.colors(10); function createClickUpgrades() { let prefix = "prod-click-"; let counter = 1; for (let contents of clickUpgradeText) { upgrades[prefix + counter] = { name: contents.name, desc: contents.desc, icon: [ { icon: "fa-hand-pointer", color: tiers[counter - 1] } ], 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; } } const helperUpgradeColors = range.colors(3); function createHelperUpgrades() { const infix = "-help-"; let previousHelped = undefined; 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; upgrades[key] = { "name": text.name, "desc": text.desc, "icon": [ { icon: "fa-hand-holding", color: "black" }, { icon: buildings[helped].icon, color: tiers[counter - 1], transform: "scale(0.5, 0.5) translate(0, -30px)" } ], "cost": { "food": buildings[helper].cost.food * 25 * counter + buildings[helped].cost.food * 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; upgrades[key]["prereqs"]["buildings"][helped] = 1; if (counter > 1) { upgrades[key]["prereqs"]["upgrades"].push(prefix + infix + suffix + "-" + (counter - 1)) } if (previousHelped !== undefined && counter == 1) { upgrades[key]["prereqs"]["upgrades"].push(prefix + infix + previousHelped + "-" + "1") } counter += 1; } previousHelped = helped; }); }); } const clickVictimUpgradeColors = range.colors(Object.keys(buildings).length - 1); function createClickVictimUpgrades() { const prefix = "click-"; let counter = 1; let previous = "micro"; Object.entries(clickVictimUpgradeText).forEach(([key, text]) => { let newColor = clickVictimUpgradeColors[counter - 1] + "dd"; upgrades[prefix + key] = { "name": text.name, "desc": text.desc, "icon": [ { icon: buildings[key].icon, color: "#eee" }, { icon: "fa-hand-pointer", color: newColor, transform: "scale(0.75, 0.75) translate(20px, 20px) rotate(-15deg)" } ], "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; }); } const powerupFreqColors = range.colors(5); function createPowerupFreqUpgrades() { const prefix = "powerup-freq-"; let counter = 1; powerupFreqUpgradeText.forEach(text => { upgrades[prefix + counter] = { "name": text.name, "desc": text.desc, "icon": [ { icon: "fa-drumstick-bite", color: tiers[counter - 1] } ], "cost": { "food": Math.pow(10, counter+3), "powerups": Math.pow(counter, 2) }, "effects": [ { "type": "powerup-freq", "id": prefix + counter, "amount": 0.75 + 0.03 * (counter - 1) } ], "prereqs": { "upgrades": [ ], "stats": { "powerups": 1 } } }; if (counter > 1) { upgrades[prefix + counter].prereqs.upgrades.push(prefix + (counter - 1)); } counter += 1; }); } 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?" } ], "car": [ { name: "Drivers", desc: "Better than a baby driver" } ], bus: [ { name: "Thank the bus driver", desc: "Thank the bus driver" } ], house: [ { name: "Carpenters", desc: "It's tool time!" } ], apartment: [ { name: "Landlords", desc: "Eat 'em" } ], block: [ { name: "Inspectors", desc: "Bringing everything up to code" } ], town: [ { name: "Mayors", desc: "I Vored" } ], city: [ { name: "Councils", desc: "Pass those ordinances" } ], metro: [ { name: "Urban Planners", desc: "Blueprints? Chewprints." } ], county: [ { name: "Survey Crews", desc: "You don't want to chip a tooth on a hard bit of rock, now do you?" } ], state: [ { name: "Census Takers", desc: "Population: You" } ], country: [ { name: "Senators", desc: "Lobbying for a better, tastier future" } ], continent: [ { name: "Drifters", desc: "Because of continental drift. Duh." } ], planet: [ { name: "Geologists", desc: "Turns out that the mantle is actually REALLY TASTY" } ], "solar-system": [ { name: "Astronauts", desc: "With enough effort, the moon WILL be turned to cheese" } ], galaxy: [ { name: "Voyagers", desc: "Boldly snacking where no macro has snacked before" } ], universe: [ { name: "Reality Warpers", desc: "I'm pretty sure this is heretical..." } ], multiverse: [ { name: "Fractal Servants", desc: "So very many!" } ] } } 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" } }; const powerupFreqUpgradeText = [ { name: "All-You-Can-Eat", desc: "Pour on the powerups.", }, { name: "Buffet", desc: "Chow down on more and more.", }, { name: "Bottomless Bowl", desc: "Eat up!", }, { name: "Endless Edibles", desc: "For every one you eat, two more appear.", }, { name: "UNLIMITED BREADSTICKS", desc: "UNLIMITED BREADSTICKS", } ] // 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 => "SPORTS!" ] } ] function createNews() { createNewsFoodAmount(); createNewsStart(); createNewsFoodRate(); createNewsFoodRatePermanent(); createNewsBuildingCount(); } function createNewsFoodAmount() { } function createNewsStart() { let counter = 0; for (let set of newsStartText) { const factor = counter; let cond; cond = state => { return state.currentProductivity.food < 5 } news.push({ condition: cond, lines: set }); counter += 1; }; } function createNewsFoodRate() { let counter = 0; for (let set of newsFoodRateText) { const factor = counter; let cond; if (counter + 1 == newsFoodRateText.length) { cond = state => { return state.currentProductivity.food >= 5*Math.pow(10, factor) } } else { cond = state => { return state.currentProductivity.food >= 5*Math.pow(10, factor) && state.currentProductivity.food < 5*Math.pow(10, (factor+1)) } } news.push({ condition: cond, lines: set }); counter += 1; }; } function createNewsFoodRatePermanent() { let counter = 0; for (let set of newsFoodRatePermanentText) { const factor = counter; let cond = state => { return state.currentProductivity.food >= 5*Math.pow(10, factor) } news.push({ condition: cond, lines: set }); counter += 1; }; } function createNewsBuildingCount() { Object.entries(newsBuildingCountText).forEach(([key, sets]) => { for (let [i, set] of sets.entries()) { const conditions = []; conditions.push(state => state.belongings[key].count >= newsBuildingCountCutoffs[i]); news.push({ condition: state => conditions.every(cond => cond(state)), lines: set }) } }); } const newsBuildingCountCutoffs = [ 1, 25, 50, 100, 150, 200, 300, 400, 500 ] const newsStartText = [ state => "This just in: Everything is fine", state => "\"Kinda hungry ngl,\" tweets " + macroDesc.name, state => "There are no giant monsters!" ] const newsFoodRateText = [ [ state => "Your neighbors are complaining about the noise", state => "You are a very hungry caterpillar", state => "You're hungry enough to eat an entire burger" ], [ state => "You ate your neighbors", state => "Your former neighbors' neighbors are complaining about the noise", state => "You're hungry enough to eat a whole turkey", ], [ state => "You no longer have any neighbors", state => "You're hungry enough to eat a whole person" ], [ state => "You're hungry enough to eat a whole bunch of people" ], [ state => "You're hungry enough to eat a LOT of people" ], [ state => "You're very hungry" ] ] const newsFoodRatePermanentText = [ [ state => "Should we be concerned by " + macroDesc.name + "'s ever-growing hunger? \"No,\" says local " + macroDesc.species + "." ], [ state => weekday() + " night football game cancelled due to " + macroDesc.species + " slobbering all over the field." ], [ state => weekday() + " night football game cancelled due to " + macroDesc.species + " eating everyone involved." ] ] const newsBuildingCountText = { micro: [ [ state => "Micro-only diet: fad or fact? Our experts weigh in.", state => "\"What's the deal with micros, anyway?\" asks local comedian." ], [ state => "\"I don't have a problem,\" says macro eating " + showBuilding("micro") + " per second", state => "\"Isn't it weird how macros eat so many micros?\" asked confused citizen. \"Like, doesn't that mean they're double micros?\"" ], [ state => "Local macro celebrated for cleaning up the \"unending tide\" of micros", ], [ state => "That's a lot of micros." ] ], anthro: [ [ state => "\"Nobody liked those guys anyway\" - few people concerned about " + macroDesc.name + "'s newly-acquired taste for people" ], [ state => "#FeedThe" + capitalize(macroDesc.species) + " is trending on Twitter." ], [ state => "\"average person eats 3 people a year\" factoid actualy just statistical error. average person eats 0 people per year. Peoples " + macroDesc.name + ", who lives on planet & eats over " + 8640 * belongings.anthro.count + " each day, is an outlier adn should not have been counted" ], [ state => "A new study finds that " + macroDesc.name + " has, indeed, eaten everyone." ], [ state => "A newer study finds that " + macroDesc.name + " has, actually eaten everyone TWICE." ] ], car: [ [ state => "Car insurance premiums up " + (state.belongings.car.count * 3 + 12) + "%. Why? Our experts weigh in." ] ], bus: [ [ state => "Macro craze fuels explosion in bus ridership." ], [ state => "Isn't it kind of weird how well-designed buses are for macros? Like, really. I saw a " + macroDesc.name + " stick one up " + macroDesc.proPossessive + " a-" ] ], house: [ [ state => "Property values skyrocket as the huge " + macroDesc.species + " starts munching on buildings." ], [ state => "\"Full House\" eclipsed by new sitcom, \"Full Of House\"" ] ], apartment: [ [ state => "Construction is booming thanks to the macro's thooming" ] ], block: [ [ state => "BLOCK PARTY! WOOO!" ] ], town: [ [ state => "Yes, we get it. " + macroDesc.name + " is going to town. Good one." ] ], city: [ [ state => "Public opinion remains indifferent about consumption of whole cities - \"downtown was kind of ugly; someone had to take intiative,\" claims local citizen." ] ], metro: [ [ state => "What is a metro? Why did " + macroDesc.name + " start eating them? Our experts weigh in." ] ], county: [ [ state => "\"Obviously,\" says an unfazed governor, \"we didn't really need that many counties. No need to worry.\"" ] ], state: [ [ state => "\"Obviously,\" says an unfazed governor, \"we were planning to move the capital to " + macroDesc.name + "'s digestive tract all along. No need to worry.\"" ] ], country: [ [ state => "State governor realizes the entire country got ate; sources report that he is \"mildly fazed\"." ] ], continent: [ [ state => "Tonight at 11: Multiple reports from Australia that the continent \"ƃoʇ qloopʎ ɐʇǝ\". Why? Our experts weigh in." ] ], planet: [ [ state => "The Earth has been eaten. Everyone on it has been eaten.", state => macroDesc.name + " has eaten the entire planet." ] ], "solar-system": [ [ state => "Scientists propose new \"" + macroDesc.name + " Unit\" to replace the outdated Astronomical Unit." ] ], galaxy: [ [ state => "\"Please stop telling us that this is Star Vores\", pleads an exasperated news anchor. \"We know.\"" ] ], universe: [ [ state => "Decades of scientific speculation have been abruptly resolved by the Big " + macroDesc.name + " Theory." ] ], multiverse: [ [ state => "BIG munch" ] ], } const powerups = { "instant-food": { name: "Free Food", description: "Tasty!", icon: "fa-drumstick-bite", prereqs: state => true, effect: state => state.resources.food += state.currentProductivity.food * 300, popup: (self, e) => { clickPopup("GULP!", "gulp", [e.clientX, e.clientY]); clickPopup("+300 seconds of food", "food", [e.clientX, e.clientY]); } }, "double": { name: "Double Dip", description: "Quintupled productivity!", icon: "fa-cogs", duration: 30000, prereqs: state => true, effect: state => state.currentProductivity.food *= 5, popup: (self, e) => { clickPopup("VROOM!", "gulp", [e.clientX, e.clientY]); } }, "click": { name: "Chaos Click", description: "A hundred times the clicking!", icon: "fa-hand-pointer", duration: 20000, prereqs: state => true, effect: state => state.clickPowers.clickMultiplier *= 100, popup: (self, e) => clickPopup("CLICK TIME!!", "gulp", [e.clientX, e.clientY]) } } function createFreeBuildingPowerups() { const prefix = "free-"; Object.entries(freeBuildingPowerupText).forEach(([building, text]) => { const key = prefix + building; powerups[key] = { name: text.name, description: text.desc, icon: buildings[building].icon, prereqs: state => state.belongings[building].count > 0 && state.belongings[building].count < 100, effect: state => state.belongings[building].count += 1, popup: (self, e) => clickPopup("+1 " + buildings[building].name, "food", [e.clientX, e.clientY]) } }); } const freeBuildingPowerupText = { car: { name: "Free Car", desc: "It's FREE!" }, bus: { name: "Deserted Bus", desc: "Just kidding. It's full of people." } } const statTypes = { powerups: { name: "Powerups Clicked" }, seconds: { name: "Seconds Played" }, clicks: { name: "Clicks" }, foodClicked: { name: "Food from clicks" }, food: { name: "Total food" } } const options = { name: { name: "Name", type: "text", set: value => macroDesc.name = value, get: () => macroDesc.name }, species: { name: "Species", type: "text", set: value => macroDesc.species = value, get: () => macroDesc.species }, subject: { name: "Subject pronoun (e.g. he/she)", type: "text", set: value => macroDesc.proSubject = value, get: () => macroDesc.proSubject }, possessive: { name: "Possessive pronoun (e.g. his/her)", type: "text", set: value => macroDesc.proPossessive = value, get: () => macroDesc.proPossessive }, object: { name: "Object pronoun (e.g. him/her)", type: "text", set: value => macroDesc.proObject = value, get: () => macroDesc.proObject } } deepFreeze(prodUpgradeText); deepFreeze(prodAllUpgradeText); deepFreeze(clickUpgradeText); deepFreeze(helperUpgradeText); deepFreeze(clickVictimUpgradeText); deepFreeze(powerupFreqUpgradeText);