From f52ff9bdb94c9185457c196bd96988bfb6f410e5 Mon Sep 17 00:00:00 2001 From: Kevin Dungs Date: Sun, 19 Oct 2014 19:26:19 +0200 Subject: [PATCH] Fix small errors. Some content was not displayed correctly. --- index.html | 4 ++-- js/app.js | 7 ++++--- js/gameobjects.js | 12 ++++++------ json/upgrades.json | 20 ++++++++++---------- 4 files changed, 22 insertions(+), 21 deletions(-) diff --git a/index.html b/index.html index 4300e80..e0c4d00 100644 --- a/index.html +++ b/index.html @@ -92,8 +92,8 @@

{{ r.state.level > 0 ? r.name : '?????' }} Level {{ r.state.level }}

-

{{ r.description }}

-

Research yields {{ r.state.reputation | niceNumber }} reputation.

+

{{ r.description }}

+

Research yields {{ r.state.reputation | niceNumber }} reputation.

diff --git a/js/app.js b/js/app.js index 51dda6e..678228b 100644 --- a/js/app.js +++ b/js/app.js @@ -8,6 +8,7 @@ var workers = game.workers; var upgrades = game.upgrades; var achievements = game.achievements; + var allObjects = game.allObjects; UI.validateVersion(lab.version); @@ -103,13 +104,13 @@ app.controller('UpgradesController', function() { this.upgrades = upgrades; this.isVisible = function(upgrade) { - return upgrade.isVisible(lab); + return upgrade.isVisible(lab, allObjects); }; this.isAvailable = function(upgrade) { - return upgrade.isAvailable(lab); + return upgrade.isAvailable(lab, allObjects); }; this.upgrade = function(upgrade) { - if (upgrade.buy(lab)) { + if (upgrade.buy(lab, allObjects)) { UI.showUpdateValue("#update-funding", upgrade.cost); } } diff --git a/js/gameobjects.js b/js/gameobjects.js index fca5a77..9f5e34e 100644 --- a/js/gameobjects.js +++ b/js/gameobjects.js @@ -188,22 +188,22 @@ var GameObjects = (function() { return true; }; - Upgrade.prototype.isAvailable = function(lab) { - if (!lab) { + Upgrade.prototype.isAvailable = function(lab, allObjects) { + if (!lab || !allObjects) { return false; } return !this.state.used && lab.state.money >= this.cost && - this.meetsRequirements(); + this.meetsRequirements(allObjects); }; - Upgrade.prototype.isVisible = function(lab) { - if (!lab) { + Upgrade.prototype.isVisible = function(lab, allObjects) { + if (!lab || !allObjects) { return false; } if (!this.state.used && (this.state.visible || lab.state.money >= this.cost * GLOBAL_VISIBILITY_THRESHOLD && - this.meetsRequirements())) { + this.meetsRequirements(allObjects))) { this._visible = true; return true; } diff --git a/json/upgrades.json b/json/upgrades.json index 998a2a5..b5de8fd 100644 --- a/json/upgrades.json +++ b/json/upgrades.json @@ -6,8 +6,8 @@ "effect": "PhD Students produce twice as much data per second.", "icon": "fa-group", "cost": 100, - "targets": [{"key": "PhD Students", "property": "rate"}], - "requirements": [{"key": "PhD Students", "property": "hired", "threshold": 1}], + "targets": [{"key": "workers-phdstudents", "property": "rate"}], + "requirements": [{"key": "workers-phdstudents", "property": "hired", "threshold": 1}], "factor": 2, "constant": 0 }, @@ -18,8 +18,8 @@ "effect": "PhD Students produce twice as much data per second.", "icon": "fa-group", "cost": 10000, - "targets": [{"key": "PhD Students", "property": "rate"}], - "requirements": [{"key": "Thesis supervision", "property": "_used", "threshold": 1}], + "targets": [{"key": "workers-phdstudents", "property": "rate"}], + "requirements": [{"key": "upgrade-thesissupervision", "property": "_used", "threshold": 1}], "factor": 2 }, { @@ -30,12 +30,12 @@ "icon": "fa-group", "cost": 1e6, "targets": [ - {"key": "PhD Students", "property": "rate"}, - {"key": "Postdocs", "property": "rate"}, - {"key": "Research Fellows", "property": "rate"}, - {"key": "Tenured Professors", "property": "rate"}, - {"key": "Nobel Prize Winners", "property": "rate"}, - {"key": "Summer Students", "property": "rate"} + {"key": "workers-phdstudents", "property": "rate"}, + {"key": "workers-postdocs", "property": "rate"}, + {"key": "workers-fellows", "property": "rate"}, + {"key": "workers-profs", "property": "rate"}, + {"key": "workers-nobel", "property": "rate"}, + {"key": "workers-summies", "property": "rate"} ], "requirements": [], "factor": 2