JSFiddle - React, Tailwind, and code Playground
by gdarussian
JavaScript
const warden_time = 10
const eidolon_time = 15
const wisp_time = 20
const souls_cost_mult = 0.1
const wisp_cost = 6400
const eidolon_cost = 800
const warden_cost = 100
const costs = [wisp_cost, eidolon_cost, warden_cost]
const default_times = [wisp_time, eidolon_time, warden_time]
var production_mult = 26.7
var production_time_mult = 2
var times = default_times.map(function(n) { return n / production_time_mult })
var starting_wisps = 283
var starting_eidolons = 4.4e3
var starting_wardens = 1.0e9
var starting_pixies = 1.7e13
// var starting_wisps = 1
// var starting_eidolons = 12
// var starting_wardens = 23
// var starting_pixies = 34
var starting_amounts = [starting_wisps, starting_eidolons, starting_wardens, starting_pixies]
var time_increment = 1
function runCurrent(time) {
var current_amounts = starting_amounts.slice()
var time_left = times.slice()
for (var i = 0; i < time / time_increment; i++) {
for (var creature = 0; creature < time_left.length; creature++) {
time_left[creature] -= time_increment;
if (time_left[creature] <= 0) {
time_left[creature] += times[creature]
current_amounts[creature + 1] += current_amounts[creature] * production_mult
}
}
}
return current_amounts
}
function howLongUntil(pixieAmount, current_amounts) {
var time_left = times.slice()
var time = 0
while (current_amounts[current_amounts.length - 1] < pixieAmount) {
time += time_increment
for (var creature = 0; creature < time_left.length; creature++) {
time_left[creature] -= time_increment;
if (time_left[creature] <= 0) {
time_left[creature] += times[creature]
current_amounts[creature + 1] += current_amounts[creature] * production_mult
}
}
}
return time
}
function buyCreatures(wispAmount, eidolonAmount, wardenAmount) {
var current_amounts = starting_amounts.slice()
current_amounts[3] -= wardenAmount *...