From cd174aa186aa9a23f642e883ec577b2c8283cfb0 Mon Sep 17 00:00:00 2001 From: Nero Ignis Date: Mon, 19 Apr 2021 23:28:19 +0200 Subject: [PATCH] Launch v0.5; --- index.html | 5 +++++ js/app.js | 50 +++++++++++++++++++++++++++++++++----------------- 2 files changed, 38 insertions(+), 17 deletions(-) diff --git a/index.html b/index.html index db6ad8a..986173b 100644 --- a/index.html +++ b/index.html @@ -12,6 +12,11 @@
+
+
+ This game is in an early state of development, resources could be resetted everytime and bugs may appear. Also not every building is balanced yet. +
+
diff --git a/js/app.js b/js/app.js index f9adbfc..84603f1 100644 --- a/js/app.js +++ b/js/app.js @@ -23,11 +23,14 @@ let game = new Vue({ isOwned: true, isUpgradeable: true, amount: 100, - amountMultiplicator: 1.5, - intervalInSeconds: 30, - intervalMultiplicator: 1, - price: 1000, - priceMultiplicator: 10, + amountMultiplicator: false, + intervalInSeconds: 15, + intervalMultiplicator: false, + price: 500, + priceMultiplicator: false, + amountPerLevel: [100, 250, 500, 750, 1000, 1500, 2000, 2500, 3000, 5000], + pricePerLevel: [500, 1000, 1500, 2000, 2500, 3000, 3500, 4000, 4500, 5000], + intervalPerLevel: [15, 25, 30, 45, 60, 90, 90, 120, 120, 120], }, { name: 'Lumberjack', @@ -141,7 +144,7 @@ let game = new Vue({ this.checkBuildings(); this.loadResourcesFromStorage(); - this.currentQuest = JSON.parse(localStorage.getItem('currentQuest')); + this.currentQuest = JSON.parse(localStorage.getItem(this.storageNames.currentQuest)); this.loadBuildingsFromStorage(); this.reloadBuildings(); @@ -153,17 +156,17 @@ let game = new Vue({ if (!savedBuildings) { localStorage.setItem(this.storageNames.buildings, JSON.stringify(this.buildings)); } else if (savedBuildings.length !== this.buildings.length) { - localStorage.setItem('buildings', JSON.stringify(this.buildings)); + localStorage.setItem(this.storageNames.buildings, JSON.stringify(this.buildings)); this.sendInfo('Buildings have been resetted due to an important update.'); } }, saveBuildingsToStorage() { - localStorage.setItem('buildings', JSON.stringify(this.buildings)); + localStorage.setItem(this.storageNames.buildings, JSON.stringify(this.buildings)); }, loadBuildingsFromStorage() { - let savedBuildings = JSON.parse(localStorage.getItem('buildings')); + let savedBuildings = JSON.parse(localStorage.getItem(this.storageNames.buildings)); if (savedBuildings) { savedBuildings.forEach((building) => { @@ -181,11 +184,11 @@ let game = new Vue({ }, saveResourcesToStorage() { - localStorage.setItem('resources', JSON.stringify(this.resources)); + localStorage.setItem(this.storageNames.resources, JSON.stringify(this.resources)); }, loadResourcesFromStorage: function () { - let savedResources = JSON.parse(localStorage.getItem('resources')); + let savedResources = JSON.parse(localStorage.getItem(this.storageNames.resources)); if (savedResources) { this.resources = savedResources; @@ -336,13 +339,26 @@ let game = new Vue({ building.isUpgradeable = false; } - building.price = Number( - building.price * building.priceMultiplicator - ).toFixed(2); + if (building.priceMultiplicator) { + building.price = Number( + building.price * building.priceMultiplicator + ).toFixed(0); + } else if (building.pricePerLevel) { + building.price = building.pricePerLevel[building.level]; + } if (first === false) { - building.amount = building.amount * building.amountMultiplicator; - building.intervalInSeconds = Number(building.intervalInSeconds * building.intervalMultiplicator).toFixed(2); + if (building.amountMultiplicator) { + building.amount = building.amount * building.amountMultiplicator; + } else if (building.amountPerLevel) { + building.amount = building.amountPerLevel[building.level]; + } + + if (building.intervalMultiplicator) { + building.intervalInSeconds = Number(building.intervalInSeconds * building.intervalMultiplicator).toFixed(2); + } else if (building.intervalPerLevel) { + building.intervalInSeconds = building.intervalPerLevel[building.level]; + } } this.reloadSingleBuilding(building); @@ -423,7 +439,7 @@ let game = new Vue({ this.sendInfo('There are no quests available, get some resources first.') } - localStorage.setItem('currentQuest', JSON.stringify(this.currentQuest)); + localStorage.setItem(this.storageNames.currentQuest, JSON.stringify(this.currentQuest)); return this.currentQuest; },