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.

220 lines
5.8 KiB

  1. const universespeed = 1;
  2. function metalmineCost(lvl) {
  3. const base = {
  4. Metal: 60,
  5. Crystal: 15,
  6. Deuterium: 0,
  7. Energy: 0,
  8. };
  9. // cost = base * 1.5^(lvl-1)
  10. let cost = {};
  11. cost.Metal = Math.floor(base.Metal * 1.5**(lvl-1));
  12. cost.Crystal = Math.floor(base.Crystal * 1.5**(lvl-1));
  13. cost.Deuterium = Math.floor(base.Deuterium * 1.5**(lvl-1));
  14. cost.Energy = Math.floor(base.Energy * 1.5**(lvl-1));
  15. return cost;
  16. }
  17. function crystalmineCost(lvl) {
  18. const base = {
  19. Metal: 48,
  20. Crystal: 24,
  21. Deuterium: 0,
  22. Energy: 0,
  23. };
  24. // cost = base * 1.6^(lvl-1)
  25. let cost = {};
  26. cost.Metal = Math.floor(base.Metal * 1.6**(lvl-1));
  27. cost.Crystal = Math.floor(base.Crystal * 1.6**(lvl-1));
  28. cost.Deuterium = Math.floor(base.Deuterium * 1.6**(lvl-1));
  29. cost.Energy = Math.floor(base.Energy * 1.6**(lvl-1));
  30. return cost;
  31. }
  32. function deuteriummineCost(lvl) {
  33. const base = {
  34. Metal: 225,
  35. Crystal: 75,
  36. Deuterium: 0,
  37. Energy: 0,
  38. };
  39. // cost = base * 1.5^(lvl-1)
  40. let cost = {};
  41. cost.Metal = Math.floor(base.Metal * 1.5**(lvl-1));
  42. cost.Crystal = Math.floor(base.Crystal * 1.5**(lvl-1));
  43. cost.Deuterium = Math.floor(base.Deuterium * 1.5**(lvl-1));
  44. cost.Energy = Math.floor(base.Energy * 1.5**(lvl-1));
  45. return cost;
  46. }
  47. function energymineCost(lvl) {
  48. const base = {
  49. Metal: 75,
  50. Crystal: 30,
  51. Deuterium: 0,
  52. Energy: 0,
  53. };
  54. // cost = base * 1.5^(lvl-1)
  55. let cost = {};
  56. cost.Metal = Math.floor(base.Metal * 1.5**(lvl-1));
  57. cost.Crystal = Math.floor(base.Crystal * 1.5**(lvl-1));
  58. cost.Deuterium = Math.floor(base.Deuterium * 1.5**(lvl-1));
  59. cost.Energy = Math.floor(base.Energy * 1.5**(lvl-1));
  60. return cost;
  61. }
  62. function fusionreactorCost(lvl) {
  63. const base = {
  64. Metal: 900,
  65. Crystal: 360,
  66. Deuterium: 180,
  67. Energy: 0,
  68. };
  69. // cost = base * 1.8^(lvl-1)
  70. let cost = {};
  71. cost.Metal = Math.floor(base.Metal * 1.8**(lvl-1));
  72. cost.Crystal = Math.floor(base.Crystal * 1.8**(lvl-1));
  73. cost.Deuterium = Math.floor(base.Deuterium * 1.8**(lvl-1));
  74. cost.Energy = Math.floor(base.Energy * 1.8**(lvl-1));
  75. return cost;
  76. }
  77. function roboticsfactoryCost(lvl) {
  78. const base = {
  79. Metal: 400,
  80. Crystal: 120,
  81. Deuterium: 200,
  82. Energy: 0,
  83. };
  84. // cost = base * 2^(lvl-1)
  85. let cost = {};
  86. cost.Metal = Math.floor(base.Metal * 2**(lvl-1));
  87. cost.Crystal = Math.floor(base.Crystal * 2**(lvl-1));
  88. cost.Deuterium = Math.floor(base.Deuterium * 2**(lvl-1));
  89. cost.Energy = Math.floor(base.Energy * 2**(lvl-1));
  90. return cost;
  91. }
  92. function shipyardCost(lvl) {
  93. const base = {
  94. Metal: 400,
  95. Crystal: 200,
  96. Deuterium: 100,
  97. Energy: 0,
  98. };
  99. // cost = base * 2^(lvl-1)
  100. let cost = {};
  101. cost.Metal = Math.floor(base.Metal * 2**(lvl-1));
  102. cost.Crystal = Math.floor(base.Crystal * 2**(lvl-1));
  103. cost.Deuterium = Math.floor(base.Deuterium * 2**(lvl-1));
  104. cost.Energy = Math.floor(base.Energy * 2**(lvl-1));
  105. return cost;
  106. }
  107. function metalstorageCost(lvl) {
  108. const base = {
  109. Metal: 1000,
  110. Crystal: 0,
  111. Deuterium: 0,
  112. Energy: 0,
  113. };
  114. // cost = base * 2^(lvl-1)
  115. let cost = {};
  116. cost.Metal = Math.floor(base.Metal * 2**(lvl-1));
  117. cost.Crystal = 0;
  118. cost.Deuterium = 0;
  119. cost.Energy = 0;
  120. return cost;
  121. }
  122. function crystalstorageCost(lvl) {
  123. const base = {
  124. Metal: 1000,
  125. Crystal: 500,
  126. Deuterium: 0,
  127. Energy: 0,
  128. };
  129. // cost = base * 2^(lvl-1)
  130. let cost = {};
  131. cost.Metal = Math.floor(base.Metal * 2**(lvl-1));
  132. cost.Crystal = Math.floor(base.Crystal * 2**(lvl-1));
  133. cost.Deuterium = Math.floor(base.Deuterium * 2**(lvl-1));
  134. cost.Energy = Math.floor(base.Energy * 2**(lvl-1));
  135. return cost;
  136. }
  137. function deuteriumstorageCost(lvl) {
  138. const base = {
  139. Metal: 1000,
  140. Crystal: 1000,
  141. Deuterium: 0,
  142. Energy: 0,
  143. };
  144. // cost = base * 2^(lvl-1)
  145. let cost = {};
  146. cost.Metal = Math.floor(base.Metal * 2**(lvl-1));
  147. cost.Crystal = Math.floor(base.Crystal * 2**(lvl-1));
  148. cost.Deuterium = Math.floor(base.Deuterium * 2**(lvl-1));
  149. cost.Energy = Math.floor(base.Energy * 2**(lvl-1));
  150. return cost;
  151. }
  152. function ressearchlabCost(lvl) {
  153. const base = {
  154. Metal: 200,
  155. Crystal: 400,
  156. Deuterium: 200,
  157. Energy: 0,
  158. };
  159. // cost = base * 1.5^(lvl-1)
  160. let cost = {};
  161. cost.Metal = Math.floor(base.Metal * 1.5**(lvl-1));
  162. cost.Crystal = Math.floor(base.Crystal * 1.5**(lvl-1));
  163. cost.Deuterium = Math.floor(base.Deuterium * 1.5**(lvl-1));
  164. cost.Energy = Math.floor(base.Energy * 1.5**(lvl-1));
  165. return cost;
  166. }
  167. function alliancedepotCost(lvl) {
  168. const base = {
  169. Metal: 20000,
  170. Crystal: 40000,
  171. Deuterium: 0,
  172. Energy: 0,
  173. };
  174. // cost = base * 2^(lvl-1)
  175. let cost = {};
  176. cost.Metal = Math.floor(base.Metal * 2**(lvl-1));
  177. cost.Crystal = Math.floor(base.Crystal * 2**(lvl-1));
  178. cost.Deuterium = Math.floor(base.Deuterium * 2**(lvl-1));
  179. cost.Energy = Math.floor(base.Energy * 2**(lvl-1));
  180. return cost;
  181. }
  182. function missilesiloCost(lvl) {
  183. const base = {
  184. Metal: 20000,
  185. Crystal: 20000,
  186. Deuterium: 1000,
  187. Energy: 0,
  188. };
  189. // cost = base * 2^(lvl-1)
  190. let cost = {};
  191. cost.Metal = Math.floor(base.Metal * 2**(lvl-1));
  192. cost.Crystal = Math.floor(base.Crystal * 2**(lvl-1));
  193. cost.Deuterium = Math.floor(base.Deuterium * 2**(lvl-1));
  194. cost.Energy = Math.floor(base.Energy * 2**(lvl-1));
  195. return cost;
  196. }
  197. function spacedockCost(lvl) {
  198. const base = {
  199. Metal: 20000,
  200. Crystal: 20000,
  201. Deuterium: 1000,
  202. Energy: 0,
  203. };
  204. // cost = base * 2^(lvl-1)
  205. let cost = {};
  206. cost.Metal = Math.floor(base.Metal * 2**(lvl-1));
  207. cost.Crystal = Math.floor(base.Crystal * 2**(lvl-1));
  208. cost.Deuterium = Math.floor(base.Deuterium * 2**(lvl-1));
  209. cost.Energy = Math.floor(base.Energy * 2**(lvl-1));
  210. return cost;
  211. }
  212. function constructionTime(r, roboticsLvl) {
  213. const naniteLvl = 1;
  214. // T(h) = (metal + crystal) / (2500 * (1+roboticsLvl) * 2^naniteLvl * universespeed)
  215. tHours = (r.Metal + r.Crystal) / (2500 * (1 + roboticsLvl) * 2**naniteLvl * universespeed);
  216. return Math.floor(tHours * 3600);
  217. }