cookie clicker but bigger
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

439 line
9.5 KiB

  1. "use strict";
  2. const resourceTypes = {
  3. "food": {
  4. name: "Food"
  5. }
  6. }
  7. const buildings = {
  8. "micro": {
  9. "name": "Micro",
  10. "plural": "Micros",
  11. "desc": "A tasty, squirmy treat.",
  12. "cost": 1e1,
  13. "prod": 1e-1/1
  14. },
  15. "anthro": {
  16. "name": "Anthro",
  17. "plural": "Anthros",
  18. "desc": "Something more substantial to sate your hunger.",
  19. "cost": 1e2,
  20. "prod": 1e0/1.1
  21. },
  22. "car": {
  23. "name": "Car",
  24. "plural": "Cars",
  25. "desc": "Crunchy shell, tasty center.",
  26. "cost": 1.2e3,
  27. "prod": 1e1/1.2
  28. },
  29. "bus": {
  30. "name": "Bus",
  31. "plural": "Buses",
  32. "desc": "Probably the worst place to be when a macro is aroud.",
  33. "cost": 1.4e4,
  34. "prod": 1e2/1.3
  35. },
  36. "house": {
  37. "name": "House",
  38. "plural": "Houses",
  39. "desc": "Home sweet home - but it doesn't taste sweet?",
  40. "cost": 1.6e5,
  41. "prod": 1e3/1.4
  42. },
  43. "apartment": {
  44. "name": "Apartment",
  45. "plural": "Apartments",
  46. "desc": "More snacks, less packaging.",
  47. "cost": 1.8e6,
  48. "prod": 1e4/1.5
  49. },
  50. "block": {
  51. "name": "Block",
  52. "plural": "Blocks",
  53. "desc": "A whole pile of buildings.",
  54. "cost": 2e7,
  55. "prod": 1e5/1.6
  56. },
  57. "town": {
  58. "name": "Town",
  59. "plural": "Towns",
  60. "desc": "'Tourist trap' has never been this literal.",
  61. "cost": 2.2e8,
  62. "prod": 1e6/1.7
  63. },
  64. "city": {
  65. "name": "City",
  66. "plural": "Cities",
  67. "desc": "Please no sitty on our city.",
  68. "cost": 2.4e9,
  69. "prod": 1e7/1.8
  70. },
  71. "metro": {
  72. "name": "Metropolis",
  73. "plural": "Metropolises",
  74. "desc": "A big ol' city. Tasty, too.",
  75. "cost": 2.6e10,
  76. "prod": 1e8/1.9
  77. },
  78. "county": {
  79. "name": "County",
  80. "plural": "Counties",
  81. "desc": "Why salt the land when you can slurp it?",
  82. "cost": 2.8e11,
  83. "prod": 1e9/2
  84. },
  85. "state": {
  86. "name": "State",
  87. "plural": "States",
  88. "desc": "The United States is made up of...43 states - no, 42...",
  89. "cost": 3e12,
  90. "prod": 1e10/2.1
  91. },
  92. "country": {
  93. "name": "Country",
  94. "plural": "Countries",
  95. "desc": "One nation, under paw.",
  96. "cost": 3.2e13,
  97. "prod": 1e11/2.2
  98. },
  99. "continent": {
  100. "name": "Continent",
  101. "plural": "Continents",
  102. "desc": "Earth-shattering appetite!",
  103. "cost": 3.4e14,
  104. "prod": 1e12/2.3
  105. },
  106. "planet": {
  107. "name": "Planet",
  108. "plural": "Planets",
  109. "desc": "Earth appetite!",
  110. "cost": 3.6e15,
  111. "prod": 1e13/2.4
  112. }
  113. }
  114. const effect_types = {
  115. "prod": {
  116. "apply": function(effect, productivity) {
  117. return productivity * effect.amount;
  118. },
  119. "desc": function(effect) {
  120. return round(effect.amount, 2) + "x food production from " + buildings[effect.target].plural;
  121. }
  122. },
  123. "prod-all": {
  124. "apply": function(effect, productivity) {
  125. return productivity * effect.amount;
  126. },
  127. "desc": function(effect) {
  128. return round((effect.amount - 1) * 100) + "% increase to food production";
  129. }
  130. },
  131. "helper": {
  132. "apply": function(effect, productivity, helperCount) {
  133. return productivity * (1 + effect.amount * helperCount);
  134. },
  135. "desc": function(effect) {
  136. return "+" + round(effect.amount * 100) + "% food/sec from " + buildings[effect.helped].name + " for every " + buildings[effect.helper].name + " owned.";
  137. }
  138. },
  139. "click": {
  140. "apply": function(effect, bonus, productivity) {
  141. return bonus + productivity * effect.amount;
  142. },
  143. "desc": function(effect) {
  144. return round(effect.amount * 100) + "% of food/sec gained per click";
  145. }
  146. }
  147. }
  148. let upgrades = {
  149. "anthro-help-micro-1": {
  150. "name": "Servants",
  151. "desc": "Why bother walking anywhere, really?",
  152. "cost": {
  153. "food": buildings.anthro.cost * 25 + buildings.micro.cost * 50
  154. },
  155. "effects": [
  156. {
  157. "type": "helper",
  158. "helper": "anthro",
  159. "helped": "micro",
  160. "amount": 0.01
  161. }
  162. ],
  163. "prereqs": {
  164. "buildings": {
  165. "anthro": 10
  166. },
  167. "upgrades": [
  168. "anthro-prod-1"
  169. ]
  170. }
  171. }
  172. }
  173. function createTemplateUpgrades() {
  174. console.log("qwewq");
  175. createProdUpgrades();
  176. createProdAllUpgrades();
  177. createClickUpgrades();
  178. }
  179. const prodUpgradeCounts = [1, 5, 10, 25, 50, 75, 100];
  180. function createProdUpgrades() {
  181. for (const [key, value] of Object.entries(prodUpgradeText)) {
  182. let counter = 1;
  183. let prefix = key + "-prod-";
  184. for (let contents of value) {
  185. upgrades[prefix + counter] = {
  186. "name": contents.name,
  187. "desc": contents.desc,
  188. "cost": {
  189. "food": buildings[key].cost * 5 * Math.pow(10,counter - 1)
  190. },
  191. "effects": [
  192. {
  193. "type": "prod",
  194. "amount": 2 + (counter - 1) * 0.25,
  195. "target": key
  196. }
  197. ]
  198. };
  199. upgrades[prefix + counter]["prereqs"] = {};
  200. upgrades[prefix + counter]["prereqs"]["buildings"] = {};
  201. upgrades[prefix + counter]["prereqs"]["buildings"][key] = prodUpgradeCounts[counter - 1];
  202. if (counter > 1) {
  203. upgrades[prefix + counter]["prereqs"]["upgrades"] = [
  204. prefix + (counter - 1)
  205. ];
  206. }
  207. counter += 1;
  208. }
  209. }
  210. }
  211. function createProdAllUpgrades() {
  212. let prefix = "prod-all-"
  213. let counter = 1;
  214. for (let contents of prodAllUpgradeText) {
  215. upgrades[prefix + counter] = {
  216. "name": contents.name,
  217. "desc": contents.desc,
  218. "cost": {
  219. "food": 5 * Math.pow(10, counter+1)
  220. },
  221. "effects": [
  222. {
  223. "type": "prod-all",
  224. "amount": 1.05
  225. }
  226. ],
  227. "prereqs": {
  228. "productivity": {
  229. "food": Math.pow(10, counter)
  230. }
  231. }
  232. };
  233. if (counter > 1) {
  234. upgrades[prefix + counter]["prereqs"].upgrades = [
  235. prefix + (counter - 1)
  236. ];
  237. }
  238. counter += 1;
  239. }
  240. }
  241. function createClickUpgrades() {
  242. let prefix = "prod-click-";
  243. let counter = 1 ;
  244. for (let contents of clickUpgradeText) {
  245. upgrades[prefix + counter] = {
  246. name: contents.name,
  247. desc: contents.desc,
  248. cost: {
  249. food: Math.pow(10, (counter*2)+1)
  250. },
  251. effects: [
  252. {
  253. type: "click",
  254. amount: 0.01
  255. }
  256. ],
  257. prereqs: {
  258. productivity: {
  259. food: Math.pow(10, counter)
  260. }
  261. }
  262. };
  263. if (counter > 1) {
  264. upgrades[prefix + counter]["prereqs"].upgrades = [
  265. prefix + (counter - 1)
  266. ];
  267. }
  268. counter += 1;
  269. }
  270. }
  271. let prodUpgradeText = {
  272. "micro": [
  273. {
  274. "name": "Bigger Micros",
  275. "desc": "A macro micro? It's more filling, for sure.",
  276. },
  277. {
  278. "name": "Beefy Micros",
  279. "desc": "25% more protein, 10% fewer carbs."
  280. },
  281. {
  282. "name": "Delicious Micros",
  283. "desc": "Betcha' can't eat just one."
  284. },
  285. {
  286. "name": "Irresistable Micros",
  287. "desc": "Genetically engineered to be delectable."
  288. },
  289. {
  290. "name": "Exquisite Micros",
  291. "desc": "Dangerously delicious."
  292. }
  293. ],
  294. "anthro": [
  295. {
  296. "name": "Willing Prey",
  297. "desc": "Why bother chasing down your meal?"
  298. },
  299. {
  300. "name": "Fattened Prey",
  301. "desc": "9 calories per gram!"
  302. },
  303. {
  304. "name": "Mesmerized Prey",
  305. "desc": "Why bother walking to your meal?"
  306. },
  307. {
  308. "name": "Food-Safe Lubricant",
  309. "desc": "Ease them down your gullet with ease. Thanks, chemistry!"
  310. },
  311. {
  312. "name": "Mandatory Meal Training",
  313. "desc": "Educating prey on basic food etiquette helps reduce maw congestion and speeds digestion by 27%."
  314. }
  315. ],
  316. "car": [
  317. {
  318. "name": "HOV Lane",
  319. "desc": "Think of the environment! And of your impending digestion, I guess."
  320. },
  321. {
  322. "name": "Lightweight Frames",
  323. "desc": "Although crunchy, the shell around the snacks isn't very appetizing."
  324. },
  325. {
  326. "name": "Traffic Engineering",
  327. "desc": "Maximizing throughput into your gullet."
  328. },
  329. {
  330. "name": "Super Highways",
  331. "desc": "Six lanes! Fresh pavement! A ravenous maw!"
  332. },
  333. {
  334. "name": "Stacked Cars",
  335. "desc": "When we couldn't make the roads any wider, we tried stacking the cars higher."
  336. }
  337. ],
  338. "bus": [
  339. {
  340. "name": "Bus Passes",
  341. "desc": "Save on greenhouse emissions. Save your predator's effort. Everyone wins!"
  342. },
  343. {
  344. "name": "Double Deckers",
  345. "desc": "Stack 'em up! Slurp 'em down!"
  346. },
  347. {
  348. "name": "Articulated Buses",
  349. "desc": "The bend really helps them slip down your throat."
  350. }
  351. ],
  352. "house": [
  353. {
  354. "name": "Remodeling",
  355. "desc": "Strip out that icky asbestos."
  356. },
  357. {
  358. "name": "Suburbia",
  359. "desc": "It's like a buffet line!"
  360. },
  361. ]
  362. }
  363. let prodAllUpgradeText = [
  364. {
  365. "name": "Sloth Metabolism",
  366. "desc": "Burn those calories. Eventually."
  367. },
  368. {
  369. "name": "Decent Metabolism",
  370. "desc": "Picking up the pace."
  371. },
  372. {
  373. "name": "Perky Metabolism",
  374. "desc": "Sweat a little."
  375. },
  376. {
  377. "name": "Quick Metabolism",
  378. "desc": "Burn those calories."
  379. },
  380. {
  381. "name": "Speedy Metabolism",
  382. "desc": "More prey, more power."
  383. },
  384. {
  385. "name": "Fast Metabolism",
  386. "desc": "You're a furnace. Fueled by people."
  387. },
  388. {
  389. "name": "Powerful Metabolism",
  390. "desc": "Digest them all."
  391. }
  392. ]
  393. const clickUpgradeText = [
  394. {
  395. "name": "Grabby Hands",
  396. "desc": "Gathers prey, opens rooftops"
  397. },
  398. {
  399. "name": "Long Tongue",
  400. "desc": "Catches stragglers, tastes architecture"
  401. },
  402. {
  403. "name": "Sharp Eyes",
  404. "desc": "Spots snacks, probably unblinking"
  405. },
  406. {
  407. "name": "Keen Nose",
  408. "desc": "Sniffs meals, savors scents"
  409. },
  410. {
  411. "name": "Sensitive Ears",
  412. "desc": "Hears screams, finds leftovers"
  413. },
  414. ]