2020-05-09 14:45:23 +00:00
|
|
|
import { findNiceIntegerValue } from "../core/utils";
|
2020-05-09 17:14:11 +00:00
|
|
|
import { ShapeDefinition } from "./shape_definition";
|
2020-05-09 14:45:23 +00:00
|
|
|
|
2020-05-17 13:32:19 +00:00
|
|
|
export const finalGameShape = "RuCw--Cw:----Ru--";
|
2020-05-28 12:53:11 +00:00
|
|
|
export const blueprintShape = "CbCbCbRb:CwCwCwCw";
|
2020-05-17 12:46:33 +00:00
|
|
|
|
2020-05-09 14:45:23 +00:00
|
|
|
export const UPGRADES = {
|
|
|
|
belt: {
|
|
|
|
tiers: [
|
|
|
|
{
|
2020-05-17 12:46:33 +00:00
|
|
|
required: [{ shape: "CuCuCuCu", amount: 150 }],
|
2020-05-09 14:45:23 +00:00
|
|
|
improvement: 1,
|
|
|
|
},
|
|
|
|
{
|
2020-05-17 12:46:33 +00:00
|
|
|
required: [{ shape: "--CuCu--", amount: 1500 }],
|
2020-05-09 14:45:23 +00:00
|
|
|
improvement: 2,
|
|
|
|
},
|
|
|
|
{
|
2020-05-17 12:46:33 +00:00
|
|
|
required: [{ shape: "CpCpCpCp", amount: 15000 }],
|
2020-05-18 14:08:33 +00:00
|
|
|
improvement: 2,
|
2020-05-17 12:46:33 +00:00
|
|
|
},
|
|
|
|
{
|
|
|
|
required: [{ shape: "SrSrSrSr:CyCyCyCy", amount: 40000 }],
|
2020-05-18 14:08:33 +00:00
|
|
|
improvement: 2,
|
2020-05-17 12:46:33 +00:00
|
|
|
},
|
|
|
|
{
|
|
|
|
required: [{ shape: "SrSrSrSr:CyCyCyCy:SwSwSwSw", amount: 40000 }],
|
2020-05-18 14:08:33 +00:00
|
|
|
improvement: 2,
|
2020-05-09 14:45:23 +00:00
|
|
|
},
|
|
|
|
{
|
2020-05-17 13:32:19 +00:00
|
|
|
required: [{ shape: finalGameShape, amount: 150000 }],
|
2020-05-18 14:08:33 +00:00
|
|
|
improvement: 5,
|
2020-05-17 12:46:33 +00:00
|
|
|
excludePrevious: true,
|
2020-05-09 14:45:23 +00:00
|
|
|
},
|
|
|
|
],
|
|
|
|
},
|
|
|
|
|
|
|
|
miner: {
|
|
|
|
tiers: [
|
|
|
|
{
|
2020-05-17 12:46:33 +00:00
|
|
|
required: [{ shape: "RuRuRuRu", amount: 400 }],
|
2020-05-09 14:45:23 +00:00
|
|
|
improvement: 1,
|
|
|
|
},
|
|
|
|
{
|
2020-05-17 12:46:33 +00:00
|
|
|
required: [{ shape: "Cu------", amount: 5500 }],
|
2020-05-09 14:45:23 +00:00
|
|
|
improvement: 2,
|
|
|
|
},
|
|
|
|
{
|
2020-05-17 12:46:33 +00:00
|
|
|
required: [{ shape: "ScScScSc", amount: 20000 }],
|
2020-05-18 14:08:33 +00:00
|
|
|
improvement: 2,
|
2020-05-17 12:46:33 +00:00
|
|
|
},
|
|
|
|
{
|
|
|
|
required: [{ shape: "CwCwCwCw:WbWbWbWb", amount: 40000 }],
|
2020-05-18 14:08:33 +00:00
|
|
|
improvement: 2,
|
2020-05-17 12:46:33 +00:00
|
|
|
},
|
|
|
|
{
|
|
|
|
required: [{ shape: "CbRbRbCb:CwCwCwCw:WbWbWbWb", amount: 40000 }],
|
2020-05-18 14:08:33 +00:00
|
|
|
improvement: 2,
|
2020-05-09 14:45:23 +00:00
|
|
|
},
|
|
|
|
{
|
2020-05-17 13:32:19 +00:00
|
|
|
required: [{ shape: finalGameShape, amount: 150000 }],
|
2020-05-18 14:08:33 +00:00
|
|
|
improvement: 5,
|
2020-05-17 12:46:33 +00:00
|
|
|
excludePrevious: true,
|
2020-05-09 14:45:23 +00:00
|
|
|
},
|
|
|
|
],
|
|
|
|
},
|
|
|
|
|
|
|
|
processors: {
|
|
|
|
tiers: [
|
|
|
|
{
|
2020-05-17 12:46:33 +00:00
|
|
|
required: [{ shape: "SuSuSuSu", amount: 1000 }],
|
2020-05-09 14:45:23 +00:00
|
|
|
improvement: 1,
|
|
|
|
},
|
|
|
|
{
|
2020-05-17 12:46:33 +00:00
|
|
|
required: [{ shape: "RuRu----", amount: 2000 }],
|
2020-05-09 14:45:23 +00:00
|
|
|
improvement: 2,
|
|
|
|
},
|
|
|
|
{
|
2020-05-17 12:46:33 +00:00
|
|
|
required: [{ shape: "CgScScCg", amount: 25000 }],
|
2020-05-18 14:08:33 +00:00
|
|
|
improvement: 2,
|
2020-05-09 14:45:23 +00:00
|
|
|
},
|
|
|
|
{
|
2020-05-17 12:46:33 +00:00
|
|
|
required: [{ shape: "CwCrCwCr:SgSgSgSg", amount: 40000 }],
|
2020-05-18 14:08:33 +00:00
|
|
|
improvement: 2,
|
2020-05-09 14:45:23 +00:00
|
|
|
},
|
2020-05-17 12:46:33 +00:00
|
|
|
{
|
|
|
|
required: [{ shape: "WrRgWrRg:CwCrCwCr:SgSgSgSg", amount: 40000 }],
|
2020-05-18 14:08:33 +00:00
|
|
|
improvement: 2,
|
2020-05-17 12:46:33 +00:00
|
|
|
},
|
|
|
|
{
|
2020-05-17 13:32:19 +00:00
|
|
|
required: [{ shape: finalGameShape, amount: 150000 }],
|
2020-05-18 14:08:33 +00:00
|
|
|
improvement: 5,
|
2020-05-17 12:46:33 +00:00
|
|
|
excludePrevious: true,
|
|
|
|
},
|
2020-05-09 14:45:23 +00:00
|
|
|
],
|
|
|
|
},
|
|
|
|
|
|
|
|
painting: {
|
|
|
|
tiers: [
|
|
|
|
{
|
2020-05-28 18:36:53 +00:00
|
|
|
required: [{ shape: "RbRb----", amount: 1500 }],
|
|
|
|
improvement: 2,
|
2020-05-09 14:45:23 +00:00
|
|
|
},
|
|
|
|
{
|
2020-05-28 18:36:53 +00:00
|
|
|
required: [{ shape: "WrWrWrWr", amount: 5000 }],
|
|
|
|
improvement: 1,
|
2020-05-09 14:45:23 +00:00
|
|
|
},
|
|
|
|
{
|
2020-05-17 12:46:33 +00:00
|
|
|
required: [{ shape: "RpRpRpRp:CwCwCwCw", amount: 30000 }],
|
2020-05-18 14:08:33 +00:00
|
|
|
improvement: 2,
|
2020-05-09 14:45:23 +00:00
|
|
|
},
|
|
|
|
{
|
2020-05-17 12:46:33 +00:00
|
|
|
required: [{ shape: "WpWpWpWp:CwCwCwCw:WpWpWpWp", amount: 40000 }],
|
2020-05-18 14:08:33 +00:00
|
|
|
improvement: 2,
|
2020-05-09 14:45:23 +00:00
|
|
|
},
|
2020-05-17 12:46:33 +00:00
|
|
|
{
|
|
|
|
required: [{ shape: "WpWpWpWp:CwCwCwCw:WpWpWpWp:CwCwCwCw", amount: 40000 }],
|
2020-05-18 14:08:33 +00:00
|
|
|
improvement: 2,
|
2020-05-17 12:46:33 +00:00
|
|
|
},
|
|
|
|
{
|
2020-05-17 13:32:19 +00:00
|
|
|
required: [{ shape: finalGameShape, amount: 150000 }],
|
2020-05-18 14:08:33 +00:00
|
|
|
improvement: 5,
|
2020-05-17 12:46:33 +00:00
|
|
|
excludePrevious: true,
|
|
|
|
},
|
2020-05-09 14:45:23 +00:00
|
|
|
],
|
|
|
|
},
|
|
|
|
};
|
|
|
|
|
|
|
|
// Tiers need % of the previous tier as requirement too
|
2020-05-17 12:46:33 +00:00
|
|
|
const tierGrowth = 2.5;
|
2020-05-09 14:45:23 +00:00
|
|
|
|
|
|
|
// Automatically generate tier levels
|
|
|
|
for (const upgradeId in UPGRADES) {
|
|
|
|
const upgrade = UPGRADES[upgradeId];
|
|
|
|
|
|
|
|
let currentTierRequirements = [];
|
|
|
|
for (let i = 0; i < upgrade.tiers.length; ++i) {
|
|
|
|
const tierHandle = upgrade.tiers[i];
|
|
|
|
const originalRequired = tierHandle.required.slice();
|
|
|
|
|
|
|
|
for (let k = currentTierRequirements.length - 1; k >= 0; --k) {
|
|
|
|
const oldTierRequirement = currentTierRequirements[k];
|
2020-05-17 12:46:33 +00:00
|
|
|
if (!tierHandle.excludePrevious) {
|
|
|
|
tierHandle.required.unshift({
|
|
|
|
shape: oldTierRequirement.shape,
|
|
|
|
amount: oldTierRequirement.amount,
|
|
|
|
});
|
|
|
|
}
|
2020-05-09 14:45:23 +00:00
|
|
|
}
|
|
|
|
currentTierRequirements.push(
|
|
|
|
...originalRequired.map(req => ({
|
|
|
|
amount: req.amount,
|
|
|
|
shape: req.shape,
|
|
|
|
}))
|
|
|
|
);
|
|
|
|
currentTierRequirements.forEach(tier => {
|
|
|
|
tier.amount = findNiceIntegerValue(tier.amount * tierGrowth);
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (G_IS_DEV) {
|
|
|
|
for (const upgradeId in UPGRADES) {
|
|
|
|
const upgrade = UPGRADES[upgradeId];
|
|
|
|
upgrade.tiers.forEach(tier => {
|
|
|
|
tier.required.forEach(({ shape }) => {
|
|
|
|
try {
|
|
|
|
ShapeDefinition.fromShortKey(shape);
|
|
|
|
} catch (ex) {
|
|
|
|
throw new Error("Invalid upgrade goal: '" + ex + "' for shape" + shape);
|
|
|
|
}
|
|
|
|
});
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|