(heroConfigStats, callback)
| 886 | } |
| 887 | |
| 888 | static formatStatsForHeroConfig (heroConfigStats, callback) { |
| 889 | const heroConfigStatValues = _.values(heroConfigStats) |
| 890 | if (Array.from(heroConfigStatValues).includes('loading')) { return } |
| 891 | const heroStats = _.find(heroConfigStatValues, { kind: 'hero' }) |
| 892 | const totals = { health: heroStats.baseHealth != null ? heroStats.baseHealth : 11, speed: 0, gems: 0 } |
| 893 | for (const stats of Array.from(heroConfigStatValues)) { |
| 894 | if (stats.gems) { totals.gems += stats.gems } |
| 895 | if (stats.health) { totals.health += stats.health * (heroStats.healthMultiplier || 1) } |
| 896 | if (stats.attack) { totals.attack = stats.attack * (heroStats.attackMultiplier || 1) } |
| 897 | if (stats.speed) { totals.speed += stats.speed } |
| 898 | } |
| 899 | return callback(totals) |
| 900 | } |
| 901 | } |
| 902 | ThangType.initClass() |
| 903 | return ThangType |
no outgoing calls
no test coverage detected