Total Complexity | 7 |
Complexity/F | 2.33 |
Lines of Code | 29 |
Function Count | 3 |
Duplicated Lines | 0 |
Ratio | 0 % |
Changes | 2 | ||
Bugs | 0 | Features | 0 |
1 | /** |
||
9 | 'use strict'; |
||
10 | |||
11 | angular |
||
12 | .module('game') |
||
13 | .service('upgrade', ['data', |
||
14 | function(data) { |
||
15 | let sv = this; |
||
16 | |||
17 | <%= fireOnceFunctions %> |
||
18 | |||
19 | this.buyUpgrade = function (player, upgrades, upgradeData, name, price, currency) { |
||
20 | if (upgrades[name]) { |
||
21 | return; |
||
22 | } |
||
23 | if (player.resources[currency].number >= price) { |
||
24 | player.resources[currency].number -= price; |
||
25 | upgrades[name] = true; |
||
26 | let func = upgradeData.fire_once_function; |
||
27 | if(func){ |
||
28 | sv[func](player); |
||
29 | } |
||
30 | } |
||
31 | }; |
||
32 | |||
33 | this.resetElement = function(player, element) { |
||
34 | let exotic = data.elements[element].exotic; |
||
35 | if (!player.resources[exotic].unlocked) { |
||
36 | return; |
||
37 | } |
||
38 | |||
46 |