+
diff --git a/js/app.js b/js/app.js
index 4d3f1a2..212d48f 100644
--- a/js/app.js
+++ b/js/app.js
@@ -10,7 +10,7 @@
game.load();
var lab = game.lab;
- var research = game.research;
+ var elements = game.elements;
var workers = game.workers;
var upgrades = game.upgrades;
var achievements = game.achievements;
@@ -40,6 +40,11 @@
};
}]);
+ // Hack to prevent text highlighting
+ document.getElementById('detector').addEventListener('mousedown', function(e) {
+ e.preventDefault();
+ });
+
// controllers
app.controller('DetectorController', function() {
this.click = function() {
@@ -50,10 +55,26 @@
};
});
- // Hack to prevent text highlighting
- document.getElementById('detector').addEventListener('mousedown', function(e) {
- e.preventDefault();
- });
+ app.controller('ElementController', ['$compile', function($compile) {
+ this.elements = elements;
+ this.isVisible = function(item) {
+ return item.isVisible(lab);
+ };
+ this.isAvailable = function(item) {
+ return item.isAvailable(lab);
+ };
+ this.doElement = function(item) {
+ var cost = item.element(lab);
+ if (cost > 0) {
+ UI.showUpdateValue("#update-data", -cost);
+ UI.showUpdateValue("#update-reputation", item.state.reputation);
+ }
+ };
+ this.showInfo = function(r) {
+ UI.showModal(r.name, r.getInfo());
+ UI.showLevels(r.state.level);
+ };
+ }]);
app.controller('LabController', ['$interval', function($interval) {
this.lab = lab;
@@ -80,27 +101,6 @@
}, 1000);
}]);
- app.controller('ResearchController', ['$compile', function($compile) {
- this.research = research;
- this.isVisible = function(item) {
- return item.isVisible(lab);
- };
- this.isAvailable = function(item) {
- return item.isAvailable(lab);
- };
- this.doResearch = function(item) {
- var cost = item.research(lab);
- if (cost > 0) {
- UI.showUpdateValue("#update-data", -cost);
- UI.showUpdateValue("#update-reputation", item.state.reputation);
- }
- };
- this.showInfo = function(r) {
- UI.showModal(r.name, r.getInfo());
- UI.showLevels(r.state.level);
- };
- }]);
-
app.controller('HRController', function() {
this.workers = workers;
this.isVisible = function(worker) {
diff --git a/js/detector/bubblr.js b/js/detector/bubblr.js
index 52c38e3..e7a06a1 100644
--- a/js/detector/bubblr.js
+++ b/js/detector/bubblr.js
@@ -64,9 +64,6 @@
self.animationLoop();
}, this.options.animationSpeed);
-
- $(window).on('resize',this.onResize.bind(this));
-
};
Bubblr.prototype.onResize= function(){
diff --git a/js/game.js b/js/game.js
index 2f13809..2c43666 100644
--- a/js/game.js
+++ b/js/game.js
@@ -6,7 +6,7 @@ var Game = (function(Helpers,GameObjects,ObjectStorage) {
var Game = function() {
this.lab = new GameObjects.Lab();
- this.research = null;
+ this.elements = null;
this.workers = null;
this.upgrades = null;
this.achievements = null;
@@ -23,10 +23,12 @@ var Game = (function(Helpers,GameObjects,ObjectStorage) {
// However, I don't see any other reasonable way to do this in order to
// make it work with Angular. If you know a way, let me know, and I'll
// give you a beer. - Kevin
- this.research = Helpers.loadFile('json/research.json');
+ this.elements = Helpers.loadFile('json/elements.json');
this.workers = Helpers.loadFile('json/workers.json');
this.upgrades = Helpers.loadFile('json/upgrades.json');
this.achievements = Helpers.loadFile('json/achievements.json');
+ this.runes = Helpers.loadFile('json/runes.json');
+ this.keywords = Helpers.loadFile('json/keywords.json');
// Turn JSON files into actual game objects and fill map of all objects
var _this = this;
@@ -37,8 +39,8 @@ var Game = (function(Helpers,GameObjects,ObjectStorage) {
_this.allObjects[o.key] = o;
return o;
};
- this.research = this.research.map(
- function(r) { return makeGameObject(GameObjects.Research, r); });
+ this.elements = this.elements.map(
+ function(r) { return makeGameObject(GameObjects.Element, r); });
this.workers = this.workers.map(
function(w) { return makeGameObject(GameObjects.Worker, w); });
this.upgrades = this.upgrades.map(
diff --git a/js/gameobjects.js b/js/gameobjects.js
index 75ca21d..c6c7182 100644
--- a/js/gameobjects.js
+++ b/js/gameobjects.js
@@ -82,34 +82,35 @@ var GameObjects = (function() {
return false;
};
- /** @class Research
+ /** @class Element
*/
- var Research = function(obj) {
+ var Element = function(obj) {
GameObject.apply(this, [obj]);
- this.state.level = 0;
- this.state.interesting = false;
+ this.state.amount = Math.round(Math.random()*2);
+ this.state.discovered = Math.random()<0.1;
+ this.state.interesting = Math.random()<0.1;
+ this.state.color = Math.round(Math.random()*12);
};
- Research.prototype = Object.create(GameObject.prototype);
+ Element.prototype = Object.create(GameObject.prototype);
- Research.prototype.constructor = Research;
+ Element.prototype.constructor = Element;
- Research.prototype.isVisible = function(lab) {
+ Element.prototype.isVisible = function(lab) {
if (!lab) {
return false;
}
- return this.state.level > 0 ||
- lab.state.data >= this.state.cost * GLOBAL_VISIBILITY_THRESHOLD;
+ return this.state.discovered;
};
- Research.prototype.isAvailable = function(lab) {
+ Element.prototype.isAvailable = function(lab) {
if (!lab) {
return false;
}
- return lab.state.data >= this.state.cost;
+ return this.state.amount>0;
};
- Research.prototype.research = function(lab) {
+ Element.prototype.research = function(lab) {
if (lab && lab.research(this.state.cost, this.state.reputation)) {
this.state.level++;
if (this.state.info_levels.length > 0 &&
@@ -124,7 +125,7 @@ var GameObjects = (function() {
return -1;
};
- Research.prototype.getInfo = function() {
+ Element.prototype.getInfo = function() {
if (!this._info) {
this._info = Helpers.loadFile(this.info);
}
@@ -269,7 +270,7 @@ var GameObjects = (function() {
// Expose classes in module.
return {
Lab: Lab,
- Research: Research,
+ Element: Element,
Worker: Worker,
Upgrade: Upgrade,
Achievement: Achievement
diff --git a/js/ui.js b/js/ui.js
index 8630d23..541d88f 100644
--- a/js/ui.js
+++ b/js/ui.js
@@ -18,7 +18,7 @@ var UI = (function () {
}
$('.scrollable').height(h - offset + 'px');
- var types = ['research', 'hr', 'upgrades'];
+ var types = ['element', 'hr', 'upgrades'];
if ($(window).width() < 992) {
for (var i = 0; i < types.length; i++) {
@@ -65,6 +65,8 @@ var UI = (function () {
detector.init(400);
}
}
+
+ detector.bubblr.onResize();
}
$(window).resize(resize);
diff --git a/json/elements.json b/json/elements.json
new file mode 100644
index 0000000..bc51132
--- /dev/null
+++ b/json/elements.json
@@ -0,0 +1,83 @@
+[
+ {"key":"ᚠ"},
+ {"key":"ᚡ"},
+ {"key":"ᚢ"},
+ {"key":"ᚣ"},
+ {"key":"ᚤ"},
+ {"key":"ᚥ"},
+ {"key":"ᚦ"},
+ {"key":"ᚧ"},
+ {"key":"ᚨ"},
+ {"key":"ᚩ"},
+ {"key":"ᚪ"},
+ {"key":"ᚫ"},
+ {"key":"ᚬ"},
+ {"key":"ᚭ"},
+ {"key":"ᚮ"},
+ {"key":"ᚯ"},
+ {"key":"ᚰ"},
+ {"key":"ᚱ"},
+ {"key":"ᚲ"},
+ {"key":"ᚳ"},
+ {"key":"ᚴ"},
+ {"key":"ᚵ"},
+ {"key":"ᚶ"},
+ {"key":"ᚷ"},
+ {"key":"ᚸ"},
+ {"key":"ᚹ"},
+ {"key":"ᚺ"},
+ {"key":"ᚻ"},
+ {"key":"ᚼ"},
+ {"key":"ᚽ"},
+ {"key":"ᚾ"},
+ {"key":"ᚿ"},
+ {"key":"ᛀ"},
+ {"key":"ᛁ"},
+ {"key":"ᛂ"},
+ {"key":"ᛃ"},
+ {"key":"ᛄ"},
+ {"key":"ᛅ"},
+ {"key":"ᛆ"},
+ {"key":"ᛇ"},
+ {"key":"ᛈ"},
+ {"key":"ᛉ"},
+ {"key":"ᛊ"},
+ {"key":"ᛋ"},
+ {"key":"ᛌ"},
+ {"key":"ᛍ"},
+ {"key":"ᛎ"},
+ {"key":"ᛏ"},
+ {"key":"ᛐ"},
+ {"key":"ᛑ"},
+ {"key":"ᛒ"},
+ {"key":"ᛓ"},
+ {"key":"ᛔ"},
+ {"key":"ᛕ"},
+ {"key":"ᛖ"},
+ {"key":"ᛗ"},
+ {"key":"ᛘ"},
+ {"key":"ᛙ"},
+ {"key":"ᛚ"},
+ {"key":"ᛛ"},
+ {"key":"ᛜ"},
+ {"key":"ᛝ"},
+ {"key":"ᛞ"},
+ {"key":"ᛟ"},
+ {"key":"ᛠ"},
+ {"key":"ᛡ"},
+ {"key":"ᛢ"},
+ {"key":"ᛣ"},
+ {"key":"ᛤ"},
+ {"key":"ᛥ"},
+ {"key":"ᛦ"},
+ {"key":"ᛧ"},
+ {"key":"ᛨ"},
+ {"key":"ᛩ"},
+ {"key":"ᛪ"},
+ {"key":"᛫"},
+ {"key":"᛬"},
+ {"key":"᛭"},
+ {"key":"ᛮ"},
+ {"key":"ᛯ"},
+ {"key":"ᛰ"}
+]
diff --git a/json/runes.json b/json/runes.json
deleted file mode 100644
index 702d808..0000000
--- a/json/runes.json
+++ /dev/null
@@ -1,83 +0,0 @@
-[
- "ᚠ",
- "ᚡ",
- "ᚢ",
- "ᚣ",
- "ᚤ",
- "ᚥ",
- "ᚦ",
- "ᚧ",
- "ᚨ",
- "ᚩ",
- "ᚪ",
- "ᚫ",
- "ᚬ",
- "ᚭ",
- "ᚮ",
- "ᚯ",
- "ᚰ",
- "ᚱ",
- "ᚲ",
- "ᚳ",
- "ᚴ",
- "ᚵ",
- "ᚶ",
- "ᚷ",
- "ᚸ",
- "ᚹ",
- "ᚺ",
- "ᚻ",
- "ᚼ",
- "ᚽ",
- "ᚾ",
- "ᚿ",
- "ᛀ",
- "ᛁ",
- "ᛂ",
- "ᛃ",
- "ᛄ",
- "ᛅ",
- "ᛆ",
- "ᛇ",
- "ᛈ",
- "ᛉ",
- "ᛊ",
- "ᛋ",
- "ᛌ",
- "ᛍ",
- "ᛎ",
- "ᛏ",
- "ᛐ",
- "ᛑ",
- "ᛒ",
- "ᛓ",
- "ᛔ",
- "ᛕ",
- "ᛖ",
- "ᛗ",
- "ᛘ",
- "ᛙ",
- "ᛚ",
- "ᛛ",
- "ᛜ",
- "ᛝ",
- "ᛞ",
- "ᛟ",
- "ᛠ",
- "ᛡ",
- "ᛢ",
- "ᛣ",
- "ᛤ",
- "ᛥ",
- "ᛦ",
- "ᛧ",
- "ᛨ",
- "ᛩ",
- "ᛪ",
- "᛫",
- "᛬",
- "᛭",
- "ᛮ",
- "ᛯ",
- "ᛰ"
-]