Bläddra i källkod

Fixed display of prod upgrades, adjusted numbers

tags/v0.0.1
Fen Dweller 7 år sedan
förälder
incheckning
d69855a52b
Ingen känd nyckel hittad för denna signaturen i databasen GPG-nyckel ID: E80B35A6F11C3656
3 ändrade filer med 12 tillägg och 7 borttagningar
  1. +7
    -6
      constants.js
  2. +1
    -1
      gorge.js
  3. +4
    -0
      util.js

+ 7
- 6
constants.js Visa fil

@@ -119,7 +119,8 @@ const upgrade_types = {
return productivity * 2; return productivity * 2;
}, },
"desc": function(effect) { "desc": function(effect) {
return "2x food production from " + effect.target;
console.log(effect);
return round(effect.amount, 2) + "x food production from " + buildings[effect.target].plural;
} }
}, },
"prod-all": { "prod-all": {
@@ -127,7 +128,7 @@ const upgrade_types = {
return productivity * effect.amount; return productivity * effect.amount;
}, },
"desc": function(effect) { "desc": function(effect) {
return Math.round((effect.amount - 1) * 100) + "% increase to food production";
return round((effect.amount - 1) * 100) + "% increase to food production";
} }
} }
} }
@@ -137,7 +138,7 @@ const upgrades = {
"name": "Bigger Micros", "name": "Bigger Micros",
"desc": "A macro micro? Certainly more filling.", "desc": "A macro micro? Certainly more filling.",
"cost": { "cost": {
"food": buildings.micro.cost * 5
"food": buildings.micro.cost * 10
}, },
"effect": { "effect": {
"type": "prod", "type": "prod",
@@ -159,11 +160,11 @@ const upgrades = {
"effect": { "effect": {
"type": "prod", "type": "prod",
"target": "micro", "target": "micro",
"amount": 2,
"amount": 2.25,
}, },
"prereqs": { "prereqs": {
"buildings": { "buildings": {
"micro": 10
"micro": 5
}, },
"upgrades": [ "upgrades": [
"micro-prod-1" "micro-prod-1"
@@ -196,7 +197,7 @@ const upgrades = {
"effect": { "effect": {
"type": "prod", "type": "prod",
"target": "anthro", "target": "anthro",
"amount": 2,
"amount": 2.25,
}, },
"prereqs": { "prereqs": {
"buildings": { "buildings": {


+ 1
- 1
gorge.js Visa fil

@@ -100,7 +100,7 @@ function addResources() {
function displayResources() { function displayResources() {
document.getElementById("resource-food").innerText = "Food: " + render(resources.food); document.getElementById("resource-food").innerText = "Food: " + render(resources.food);


document.getElementById("productivity").innerText = (Math.round(calculateProductivity() * 10) / 10) + " food/sec";
document.getElementById("productivity").innerText = round(calculateProductivity(), 1) + " food/sec";
} }


function displayBuildings() { function displayBuildings() {


+ 4
- 0
util.js Visa fil

@@ -14,3 +14,7 @@ function removeChildren(element) {
element.removeChild(element.lastChild); element.removeChild(element.lastChild);
} }
} }

function round(val, places) {
return Math.round(val * Math.pow(10, places)) / Math.pow(10, places);
}

Laddar…
Avbryt
Spara