Added support for upgrade levels functions #4

Merged
merged 2 commits into from Apr 27, 2015

Projects

None yet

3 participants

@rahatarmanahmed
Contributor

No description provided.

rahatarmanahmed added some commits Apr 27, 2015
@rahatarmanahmed rahatarmanahmed Added support for upgrade levels functions 25f974e
@rahatarmanahmed rahatarmanahmed Merge branch 'master' of github.com:seiyria/c
85fda1e
@houndci-bot houndci-bot commented on the diff Apr 27, 2015
src/js/gamestate.js
@@ -66,7 +66,10 @@ var gameState = function($q, UPGRADES, GainCalculator, localStorage, AnimatedFly
inc: function(key) {
var nextLevel = upgrades[key] || 0;
- var cost = UPGRADES[key].levels[nextLevel].cost;
+
+ var cost = _.isFunction(UPGRADES[key].levels) ?
@houndci-bot
houndci-bot Apr 27, 2015 Collaborator

'_' is not defined.

@houndci-bot houndci-bot commented on the diff Apr 27, 2015
src/js/visibleupgrades.js
@@ -22,7 +22,14 @@ var visibleUpgrades = function(GameState, UPGRADES, favico) {
if(!meetsAllReqs) { return; }
- _.each(item.levels, (level, i) => {
+ var levels = item.levels;
+ if(_.isFunction(item.levels)) {
+ var nextLevel = GameState.upgrade.getKey(itemName) || 0;
+ levels = {};
+ levels[nextLevel] = item.levels(nextLevel);
+ }
+
+ _.each(levels, (level, i) => {
@houndci-bot
houndci-bot Apr 27, 2015 Collaborator

'arrow function syntax (=>)' is only available in ES6 (use esnext option).
'_' is not defined.

@houndci-bot houndci-bot commented on the diff Apr 27, 2015
src/js/visibleupgrades.js
@@ -22,7 +22,14 @@ var visibleUpgrades = function(GameState, UPGRADES, favico) {
if(!meetsAllReqs) { return; }
- _.each(item.levels, (level, i) => {
+ var levels = item.levels;
+ if(_.isFunction(item.levels)) {
@houndci-bot
houndci-bot Apr 27, 2015 Collaborator

'_' is not defined.

@seiyria seiyria merged commit 5f591df into seiyria:master Apr 27, 2015

2 checks passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details
hound 4 violations found.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment