upgrades.lua 8.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282
  1. Upgrades = {}
  2. -- TODO Player:has(Minion) etc.
  3. local function hasVuju() return ctx.player.minions[2] == Vuju end
  4. Upgrades.clear = function()
  5. Upgrades.zuju = {
  6. empower = {
  7. level = 0,
  8. costs = {45, 65, 95, 135, 185},
  9. description = 'Zuju strike with increased force.',
  10. values = {
  11. [0] = '17 - 23 damage',
  12. [1] = '23 - 29 damage',
  13. [2] = '31 - 37 damage',
  14. [3] = '41 - 47 damage',
  15. [4] = '53 - 59 damage',
  16. [5] = '67 - 73 damage'
  17. }
  18. },
  19. fortify = {
  20. level = 0,
  21. costs = {35, 60, 100, 150, 250},
  22. description = 'Fortify Zuju with spiritual energy, increasing their maximum health.',
  23. values = {
  24. [0] = '80 health',
  25. [1] = '125 health',
  26. [2] = '175 health',
  27. [3] = '235 health',
  28. [4] = '300 health',
  29. [5] = '400 health'
  30. }
  31. },
  32. burst = {
  33. level = 0,
  34. costs = {50, 75, 100, 125, 150},
  35. description = 'Zuju burst into a spirit flame on death, damaging nearby enemies.',
  36. values = {
  37. [1] = '20 damage',
  38. [2] = '40 damage',
  39. [3] = '60 damage',
  40. [4] = '80 damage',
  41. [5] = '100 damage'
  42. }
  43. },
  44. siphon = {
  45. level = 0,
  46. costs = {80, 160, 240},
  47. prerequisites = {empower = 3, fortify = 3},
  48. description = 'Zuju siphon life from their enemies with every strike, granting them lifesteal.',
  49. values = {
  50. [1] = '10% lifesteal',
  51. [2] = '20% lifesteal',
  52. [3] = '30% lifesteal'
  53. }
  54. },
  55. sanctuary = {
  56. level = 0,
  57. costs = {80, 160, 240},
  58. prerequisites = {fortify = 3, burst = 3},
  59. description = 'The spirit flame leaves behind an aura that slowly heals allies.',
  60. values = {
  61. [1] = '10 hp/s for 3 seconds.',
  62. [2] = '20 hp/s for 4 seconds.',
  63. [3] = '30 hp/s for 5 seconds.'
  64. }
  65. }
  66. }
  67. Upgrades.vuju = {
  68. surge = {
  69. level = 0,
  70. costs = {25, 40, 55, 70, 85},
  71. prerequisites = {hasVuju},
  72. description = 'Vuju surge with increased energy, increasing their cast range.',
  73. values = {
  74. [0] = '125 range',
  75. [1] = '150 range',
  76. [2] = '175 range',
  77. [3] = '200 range',
  78. [4] = '225 range',
  79. [5] = '250 range'
  80. }
  81. },
  82. charge = {
  83. level = 0,
  84. costs = {60, 80, 100, 120, 140},
  85. prerequisites = {hasVuju},
  86. description = 'Vuju become more charged and deal increased damage with lightning.',
  87. values = {
  88. [0] = '30 damage',
  89. [1] = '37 damage',
  90. [2] = '47 damage',
  91. [3] = '60 damage',
  92. [4] = '76 damage',
  93. [5] = '95 damage'
  94. }
  95. },
  96. condemn = {
  97. level = 0,
  98. costs = {100, 50, 50, 50, 50},
  99. prerequisites = {hasVuju},
  100. description = 'Vuju gain the ability to hex enemies, reducing the damage they deal for 5 seconds.',
  101. values = {
  102. [1] = '40% damage reduction, 8 second cooldown',
  103. [2] = '50% damage reduction, 7 second cooldown',
  104. [3] = '60% damage reduction, 6 second cooldown',
  105. [4] = '70% damage reduction, 5 second cooldown',
  106. [5] = '80% damage reduction, 4 second cooldown'
  107. }
  108. },
  109. arc = {
  110. level = 0,
  111. costs = {100, 200, 300},
  112. prerequisites = {surge = 3, charge = 3, hasVuju},
  113. description = 'Lightning jumps to additional nearby enemies. Each arc deals 50% reduced damage, down to a minimum of 25% damage.',
  114. values = {
  115. [1] = '2 jumps at 50 range',
  116. [2] = '4 jumps at 75 range',
  117. [3] = '6 jumps at 100 range'
  118. }
  119. },
  120. soak = {
  121. level = 0,
  122. costs = {30, 60, 90},
  123. prerequisites = {charge = 3, condemn = 3, hasVuju},
  124. description = 'The curse also soaks enemies, increasing the damage they take from lightning.',
  125. values = {
  126. [1] = '33% increase',
  127. [2] = '67% increase',
  128. [3] = '100% increase'
  129. }
  130. }
  131. }
  132. Upgrades.muju = {
  133. flow = {
  134. level = 0,
  135. costs = {30, 50, 70, 90, 110},
  136. description = 'Muju channels juju more effectively, increasing the rate at which he can summon minions.',
  137. values = {
  138. [1] = '10% cooldown reduction',
  139. [2] = '20% cooldown reduction',
  140. [3] = '30% cooldown reduction',
  141. [4] = '40% cooldown reduction',
  142. [5] = '50% cooldown reduction'
  143. }
  144. },
  145. harvest = {
  146. level = 0,
  147. costs = {75, 150, 200},
  148. prerequisites = {flow = 3},
  149. description = 'The souls of minions are harvested after death, producing a small amount of juju.',
  150. values = {
  151. [1] = 'very juju',
  152. [2] = 'many points',
  153. [3] = 'wow'
  154. }
  155. },
  156. refresh = {
  157. level = 0,
  158. costs = {200},
  159. prerequisites = {harvest = 1},
  160. description = 'Muju has a chance to instantly refresh the cooldown of an ability after casting it.',
  161. values = {
  162. [1] = '15% chance'
  163. }
  164. },
  165. zeal = {
  166. level = 0,
  167. costs = {20, 30, 40, 50, 60},
  168. description = 'Muju moves more freely in the juju realm.',
  169. values = {
  170. [1] = '20% faster',
  171. [2] = '40% faster',
  172. [3] = '60% faster',
  173. [4] = '80% faster',
  174. [5] = '100% faster'
  175. }
  176. },
  177. absorb = {
  178. level = 0,
  179. costs = {50, 75, 100},
  180. prerequisites = {zeal = 3},
  181. description = 'Muju attracts juju towards himself while in the juju realm. Juju magnets, how do they work?',
  182. values = {
  183. [1] = 'weak pull',
  184. [2] = 'average pull',
  185. [3] = 'strong pull'
  186. }
  187. },
  188. diffuse = {
  189. level = 0,
  190. costs = {200},
  191. prerequisites = {absorb = 1},
  192. description = 'Spiritual mastery of juju is attained, allowing Muju to return to his body at any point while in the juju realm.',
  193. values = {
  194. [1] = '+100% body returning-ness'
  195. }
  196. },
  197. imbue = {
  198. level = 0,
  199. costs = {40, 70, 100, 130, 150},
  200. description = 'The shrine becomes imbued with magical juju powers, allowing it to recover health over time.',
  201. values = {
  202. [1] = '0.5% max health per second',
  203. [2] = '1.0% max health per second',
  204. [3] = '1.5% max health per second',
  205. [4] = '2.0% max health per second',
  206. [5] = '2.5% max health per second'
  207. }
  208. },
  209. mirror = {
  210. level = 0,
  211. costs = {30, 60, 120},
  212. prerequisites = {imbue = 3},
  213. description = 'Gives the shrine a protective magic coating, reflecting a portion of damage dealt to it.',
  214. values = {
  215. [1] = '25% damage reflection',
  216. [2] = '50% damage reflection',
  217. [3] = '75% damage reflection'
  218. }
  219. },
  220. distort = {
  221. level = 0,
  222. costs = {200},
  223. prerequisites = {mirror = 1},
  224. description = 'While in the juju realm, the shrine slows time in the material world by 50%',
  225. values = {
  226. [1] = '1 metric flux capacitor'
  227. }
  228. }
  229. }
  230. Upgrades.makeTooltip = function(who, what)
  231. local pieces = {}
  232. local upgrade = Upgrades[who][what]
  233. table.insert(pieces, '{white}{title}' .. what:capitalize() .. '{normal}')
  234. table.insert(pieces, '{whoCares}' .. upgrade.description .. '\n')
  235. table.insert(pieces, '{white}{bold}Level ' .. upgrade.level .. (upgrade.values[upgrade.level] and ': ' .. upgrade.values[upgrade.level] or ''))
  236. if not upgrade.values[upgrade.level + 1] then
  237. table.insert(pieces, '{whoCares}{normal}Max Level')
  238. else
  239. table.insert(pieces, '{white}{bold}Next Level: ' .. upgrade.values[upgrade.level + 1])
  240. local color = ctx.player.juju >= upgrade.costs[upgrade.level + 1] and '{green}' or '{red}'
  241. table.insert(pieces, color .. upgrade.costs[upgrade.level + 1] .. ' juju')
  242. if upgrade.prerequisites then
  243. for name, min in pairs(upgrade.prerequisites) do
  244. if type(min) == 'function' then
  245. if min == hasVuju then
  246. local color = hasVuju() and '{green}' or '{red}'
  247. table.insert(pieces, color .. 'Requires Vuju')
  248. end
  249. else
  250. local color = Upgrades[who][name].level >= min and '{green}' or '{red}'
  251. local points = (min == 1) and 'point' or 'points'
  252. table.insert(pieces, color .. min .. ' ' .. points .. ' in ' .. name:capitalize())
  253. end
  254. end
  255. end
  256. end
  257. return table.concat(pieces, '\n')
  258. end
  259. Upgrades.canBuy = function(who, what)
  260. local upgrade = Upgrades[who][what]
  261. if not upgrade.costs[upgrade.level + 1] then return false end
  262. if ctx.player.juju < upgrade.costs[upgrade.level + 1] then return false end
  263. return Upgrades.checkPrerequisites(who, what)
  264. end
  265. Upgrades.checkPrerequisites = function(who, what)
  266. local upgrade = Upgrades[who][what]
  267. if not upgrade.prerequisites then return true end
  268. for key, level in pairs(upgrade.prerequisites) do
  269. if type(level) == 'function' then if not level() then return false end
  270. elseif ctx.upgrades[who][key].level < level then return false end
  271. end
  272. return true
  273. end
  274. end