mirror of
https://github.com/Acamaeda/The-Modding-Tree.git
synced 2025-02-16 09:41:41 +00:00
Brought things up to some minimal standard of usability
This commit is contained in:
parent
b55185d96c
commit
e876386729
4 changed files with 96 additions and 27 deletions
|
@ -132,10 +132,11 @@
|
||||||
<br><br>
|
<br><br>
|
||||||
<span v-if="layer!='c'">Your best {{layers[layer].resource}} is {{formatWhole(player[layer].best)}}<br></span>
|
<span v-if="layer!='c'">Your best {{layers[layer].resource}} is {{formatWhole(player[layer].best)}}<br></span>
|
||||||
<span v-if="player[layer].total">You have made a total of {{formatWhole(player[layer].total)}} {{layers[layer].resource}}<br></span>
|
<span v-if="player[layer].total">You have made a total of {{formatWhole(player[layer].total)}} {{layers[layer].resource}}<br></span>
|
||||||
<div v-if="layer=='aefaf'">
|
<div v-if="layers[layer].milestones">
|
||||||
<table>
|
<table>
|
||||||
<tr v-if="milestoneShown(player.c.best.gte(8))"><td v-bind:class="{ milestone: player.c.best.lt(8)&&player.c.best.lt(1)&&player.c.best.lt(1), milestoneDone: player.c.best.gte(8)||player.c.best.gte(1)||player.c.best.gte(1) }"><h3>8 Boosters</h3><br>Keep Prestige Upgrades on reset</td></tr>
|
<tr v-for="id in Object.keys(layers[layer].milestones)">
|
||||||
<tr v-if="milestoneShown(player.c.best.gte(15))"><td v-bind:class="{ milestone: player.c.best.lt(15), milestoneDone: player.c.best.gte(15) }"><h3>15 Boosters</h3><br>You can buy max Boosters</td></tr>
|
<div><td v-if="milestoneShown(layer, id)" v-bind:class="{milestone: !player[layer].milestones.includes(id), milestoneDone: player[layer].milestones.includes(id)}"><h3>{{layers[layer].milestones[id].requirementDesc}}</h3><br>{{layers[layer].milestones[id].effectDesc}}<br><span v-if="(layers[layer].milestones[id].toggles)&&(player[layer].milestones.includes(id))" v-for="toggle in layers[layer].milestones[id].toggles"><button class="smallUpg can" v-bind:style="{'background-color': layers[toggle[0]].color}" v-on:click="toggleAuto(toggle)">{{player[toggle[0]][toggle[1]]?"ON":"OFF"}}</button> </span></td></tr>
|
||||||
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
<br><br>
|
<br><br>
|
||||||
|
|
44
js/game.js
44
js/game.js
|
@ -171,7 +171,7 @@ function format(decimal, precision=3) {
|
||||||
var slog = decimal.slog()
|
var slog = decimal.slog()
|
||||||
if (slog.gte(1e6)) return "F" + format(slog.floor())
|
if (slog.gte(1e6)) return "F" + format(slog.floor())
|
||||||
else return Decimal.pow(10, slog.sub(slog.floor())).toStringWithDecimalPlaces(3) + "F" + commaFormat(slog.floor(), 0)
|
else return Decimal.pow(10, slog.sub(slog.floor())).toStringWithDecimalPlaces(3) + "F" + commaFormat(slog.floor(), 0)
|
||||||
} else if (decimal.gte("1e1000")) return "e"+formatWhole(decimal.log10())
|
} else if (decimal.gte("1e1000")) return (Math.floor(decimal.mantissa) + formatWhole("e"+formatWhole(decimal.log10())))
|
||||||
else if (decimal.gte(1e9)) return exponentialFormat(decimal, precision)
|
else if (decimal.gte(1e9)) return exponentialFormat(decimal, precision)
|
||||||
else if (decimal.gte(1e3)) return commaFormat(decimal, 0)
|
else if (decimal.gte(1e3)) return commaFormat(decimal, 0)
|
||||||
else return commaFormat(decimal, precision)
|
else return commaFormat(decimal, precision)
|
||||||
|
@ -253,14 +253,19 @@ function layerUnl(layer) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function rowReset(row, layer) {
|
function rowReset(row, layer) {
|
||||||
switch(row) {
|
for (lr in ROW_LAYERS[row]){
|
||||||
case 0:
|
console.log(lr)
|
||||||
player.points = new Decimal(0);
|
if(layers[lr].doReset)
|
||||||
break;
|
layers[lr].doReset(layer)
|
||||||
|
else
|
||||||
|
if(layers[layer].row > layers[lr].row) fullLayerReset(lr)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function fullLayerReset(layer) {
|
||||||
|
player[layer] = layers[layer].startData();
|
||||||
|
}
|
||||||
|
|
||||||
function addPoints(layer, gain) {
|
function addPoints(layer, gain) {
|
||||||
player[layer].points = player[layer].points.add(gain).max(0)
|
player[layer].points = player[layer].points.add(gain).max(0)
|
||||||
player[layer].best = player[layer].best.max(player[layer].points)
|
player[layer].best = player[layer].best.max(player[layer].points)
|
||||||
|
@ -303,8 +308,9 @@ function doReset(layer, force=false) {
|
||||||
}
|
}
|
||||||
|
|
||||||
prevOnReset = {...player} //Deep Copy
|
prevOnReset = {...player} //Deep Copy
|
||||||
if (row == 0) rowReset(0, layer)
|
player.points = (row == 0 ? new Decimal(0) : new Decimal(10))
|
||||||
else for (let x = row; x >= 1; x--) rowReset(x, layer)
|
|
||||||
|
for (let x = row; x >= 0; x--) rowReset(x, layer)
|
||||||
prevOnReset = undefined
|
prevOnReset = undefined
|
||||||
|
|
||||||
updateTemp()
|
updateTemp()
|
||||||
|
@ -368,13 +374,14 @@ function resetRow(row) {
|
||||||
player[layers[layer]].unl = false
|
player[layers[layer]].unl = false
|
||||||
if (player[layers[layer]].order) player[layers[layer]].order = 0
|
if (player[layers[layer]].order) player[layers[layer]].order = 0
|
||||||
}
|
}
|
||||||
|
player.points = new Decimal(10)
|
||||||
updateTemp();
|
updateTemp();
|
||||||
resizeCanvas();
|
resizeCanvas();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
function toggleAuto(layer, end="") {
|
function toggleAuto(toggle) {
|
||||||
player[layer]["auto"+end] = !player[layer]["auto"+end]
|
player[toggle[0]][toggle[1]] = !player[toggle[0]][toggle[1]]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -407,13 +414,16 @@ function adjustMSDisp() {
|
||||||
player.msDisplay = displays[(displays.indexOf(player.msDisplay)+1)%4]
|
player.msDisplay = displays[(displays.indexOf(player.msDisplay)+1)%4]
|
||||||
}
|
}
|
||||||
|
|
||||||
function milestoneShown(complete, auto=false) {
|
function milestoneShown(layer, id) {
|
||||||
|
complete = player[layer].milestones.includes(id)
|
||||||
|
auto = layers[layer].milestones[id].toggles
|
||||||
|
|
||||||
switch(player.msDisplay) {
|
switch(player.msDisplay) {
|
||||||
case "always":
|
case "always":
|
||||||
return true;
|
return true;
|
||||||
break;
|
break;
|
||||||
case "automation":
|
case "automation":
|
||||||
return auto||!complete
|
return (auto)||!complete
|
||||||
break;
|
break;
|
||||||
case "incomplete":
|
case "incomplete":
|
||||||
return !complete
|
return !complete
|
||||||
|
@ -448,6 +458,13 @@ function toNumber(x) {
|
||||||
return x
|
return x
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function updateMilestones(layer){
|
||||||
|
for (id in layers[layer].milestones){
|
||||||
|
if (!(player[layer].milestones.includes(id)) && layers[layer].milestones[id].done())
|
||||||
|
player[layer].milestones.push(id)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
function addTime(diff, layer) {
|
function addTime(diff, layer) {
|
||||||
let data = player
|
let data = player
|
||||||
let time = data.timePlayed
|
let time = data.timePlayed
|
||||||
|
@ -490,7 +507,10 @@ function gameLoop(diff) {
|
||||||
|
|
||||||
for (layer in layers){
|
for (layer in layers){
|
||||||
if (layers[layer].automate) layers[layer].automate();
|
if (layers[layer].automate) layers[layer].automate();
|
||||||
|
}
|
||||||
|
|
||||||
|
for (layer in layers){
|
||||||
|
if (layers[layer].milestones) updateMilestones(layer);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (player.hasNaN&&!NaNalert) {
|
if (player.hasNaN&&!NaNalert) {
|
||||||
|
|
51
js/layers.js
51
js/layers.js
|
@ -5,6 +5,8 @@ var layers = {
|
||||||
points: new Decimal(0),
|
points: new Decimal(0),
|
||||||
best: new Decimal(0),
|
best: new Decimal(0),
|
||||||
upgrades: [],
|
upgrades: [],
|
||||||
|
milestones: [],
|
||||||
|
beep: false,
|
||||||
}},
|
}},
|
||||||
color: "#4BEC13",
|
color: "#4BEC13",
|
||||||
requires() {return new Decimal(10)}, // Can be a function that takes requirement increases into account
|
requires() {return new Decimal(10)}, // Can be a function that takes requirement increases into account
|
||||||
|
@ -34,6 +36,19 @@ var layers = {
|
||||||
eff = layer.c.effect();
|
eff = layer.c.effect();
|
||||||
return "which are boosting waffles by "+format(eff.waffleBoost)+" and increasing the Ice Cream cap by "+format(eff.icecreamCap)
|
return "which are boosting waffles by "+format(eff.waffleBoost)+" and increasing the Ice Cream cap by "+format(eff.icecreamCap)
|
||||||
},
|
},
|
||||||
|
milestones: {
|
||||||
|
0: {requirementDesc: "3 Lollipops",
|
||||||
|
done() {return player.c.best.gte(3)},
|
||||||
|
effectDesc: "Makes this green",
|
||||||
|
},
|
||||||
|
1: {requirementDesc: "4 Lollipops",
|
||||||
|
done() {return player.c.best.gte(4)},
|
||||||
|
effectDesc: "You can toggle beep and boop (which do nothing)",
|
||||||
|
toggles: [
|
||||||
|
["c", "beep"], // Each toggle is defined by a layer and the data toggled for that layer
|
||||||
|
["f", "boop"]],
|
||||||
|
}
|
||||||
|
},
|
||||||
upgrades: {
|
upgrades: {
|
||||||
rows: 1,
|
rows: 1,
|
||||||
cols: 3,
|
cols: 3,
|
||||||
|
@ -65,6 +80,9 @@ var layers = {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
doReset(layer){
|
||||||
|
if(layers[layer].row > layers["c"].row) fullLayerReset('c') // This is actually the default behavior
|
||||||
|
},
|
||||||
convertToDecimal() {
|
convertToDecimal() {
|
||||||
// Convert any layer-specific values (besides points, total, and best) to Decimal
|
// Convert any layer-specific values (besides points, total, and best) to Decimal
|
||||||
},
|
},
|
||||||
|
@ -79,29 +97,31 @@ var layers = {
|
||||||
resetsNothing() {return false},
|
resetsNothing() {return false},
|
||||||
incr_order: [], // Array of layer names to have their order increased when this one is first unlocked
|
incr_order: [], // Array of layer names to have their order increased when this one is first unlocked
|
||||||
},
|
},
|
||||||
|
|
||||||
f: {
|
f: {
|
||||||
startData() { return {
|
startData() { return {
|
||||||
unl: false,
|
unl: false,
|
||||||
points: new Decimal(0),
|
points: new Decimal(0),
|
||||||
best: new Decimal(0),
|
best: new Decimal(0),
|
||||||
|
boop: false,
|
||||||
}},
|
}},
|
||||||
color: "#FE0102",
|
color: "#FE0102",
|
||||||
requires() {return new Decimal(200)}, // Can be a function that takes requirement increases into account
|
requires() {return new Decimal(200)},
|
||||||
resource: "butts", // Name of prestige currency
|
resource: "things",
|
||||||
baseResource: "points", // Name of resource prestige is based on
|
baseResource: "points",
|
||||||
baseAmount() {return player.points},
|
baseAmount() {return player.points},
|
||||||
type: "normal", // normal: cost to gain currency depends on amount gained. static: cost depends on how much you already have
|
type: "normal",
|
||||||
exponent: 0.5, // Prestige currency exponent
|
exponent: 0.5,
|
||||||
resCeil: false, // True if the resource needs to be rounded up
|
resCeil: false,
|
||||||
gainMult() {
|
gainMult() {
|
||||||
mult = new Decimal(1)
|
return new Decimal(1)
|
||||||
},
|
},
|
||||||
gainExp() {
|
gainExp() {
|
||||||
return new Decimal(1)
|
return new Decimal(1)
|
||||||
},
|
},
|
||||||
row: 1,
|
row: 1,
|
||||||
effect() {return},
|
effect() {return},
|
||||||
layerShown() {return true}, // Condition for when layer appears
|
layerShown() {return true},
|
||||||
resetsNothing() {return false},
|
resetsNothing() {return false},
|
||||||
branches: [["c", 1]] // Each pair corresponds to a line added to the tree when this node is unlocked. The letter is the other end of the line, and the number affects the color, 1 is default
|
branches: [["c", 1]] // Each pair corresponds to a line added to the tree when this node is unlocked. The letter is the other end of the line, and the number affects the color, 1 is default
|
||||||
},
|
},
|
||||||
|
@ -111,7 +131,7 @@ function layerShown(layer){
|
||||||
return layers[layer].layerShown();
|
return layers[layer].layerShown();
|
||||||
}
|
}
|
||||||
|
|
||||||
const LAYERS = Object.keys(layers);
|
var LAYERS = Object.keys(layers);
|
||||||
|
|
||||||
var ROW_LAYERS = {}
|
var ROW_LAYERS = {}
|
||||||
for (layer in layers){
|
for (layer in layers){
|
||||||
|
@ -121,3 +141,14 @@ for (layer in layers){
|
||||||
ROW_LAYERS[row][layer]=layer;
|
ROW_LAYERS[row][layer]=layer;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function addLayer(layerName, layerData){ // Call this to add layers from a different file!
|
||||||
|
layers[name] = layerData
|
||||||
|
LAYERS = Object.keys(layers);
|
||||||
|
ROW_LAYERS = {}
|
||||||
|
for (layer in layers){
|
||||||
|
row = layers[layer].row
|
||||||
|
if(!ROW_LAYERS[row]) ROW_LAYERS[row] = {}
|
||||||
|
|
||||||
|
ROW_LAYERS[row][layer]=layer;
|
||||||
|
}
|
||||||
|
}
|
|
@ -5,7 +5,9 @@ var layers = {
|
||||||
points: new Decimal(0),
|
points: new Decimal(0),
|
||||||
best: new Decimal(0),
|
best: new Decimal(0),
|
||||||
upgrades: [],
|
upgrades: [],
|
||||||
|
milestones: [],
|
||||||
challs: [],
|
challs: [],
|
||||||
|
beep:false,
|
||||||
}},
|
}},
|
||||||
color: "#4BEC13",
|
color: "#4BEC13",
|
||||||
requires() {return new Decimal(10)}, // Can be a function that takes requirement increases into account
|
requires() {return new Decimal(10)}, // Can be a function that takes requirement increases into account
|
||||||
|
@ -66,6 +68,20 @@ var layers = {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
milestones: {
|
||||||
|
0: {requirementDesc: "3 Lollipops",
|
||||||
|
done() {return player.c.best.gte(3)},
|
||||||
|
effectDesc: "Makes this green",
|
||||||
|
},
|
||||||
|
1: {requirementDesc: "4 Lollipops",
|
||||||
|
done() {return player.c.best.gte(4)},
|
||||||
|
effectDesc: "You can toggle beep and boop (which do nothing)",
|
||||||
|
toggles: [
|
||||||
|
["c", "beep"], // Each toggle is defined by a layer and the data toggled for that layer
|
||||||
|
["f", "boop"]
|
||||||
|
],
|
||||||
|
}
|
||||||
|
},
|
||||||
challs: {
|
challs: {
|
||||||
rows: 1,
|
rows: 1,
|
||||||
cols: 1,
|
cols: 1,
|
||||||
|
@ -100,7 +116,8 @@ var layers = {
|
||||||
startData() { return {
|
startData() { return {
|
||||||
unl: false,
|
unl: false,
|
||||||
points: new Decimal(0),
|
points: new Decimal(0),
|
||||||
best: new Decimal(0),
|
best: new Decimal(0),
|
||||||
|
boop: false,
|
||||||
}},
|
}},
|
||||||
color: "#FE0102",
|
color: "#FE0102",
|
||||||
requires() {return new Decimal(200)},
|
requires() {return new Decimal(200)},
|
||||||
|
@ -111,7 +128,7 @@ var layers = {
|
||||||
exponent: 0.5,
|
exponent: 0.5,
|
||||||
resCeil: false,
|
resCeil: false,
|
||||||
gainMult() {
|
gainMult() {
|
||||||
mult = new Decimal(1)
|
return new Decimal(1)
|
||||||
},
|
},
|
||||||
gainExp() {
|
gainExp() {
|
||||||
return new Decimal(1)
|
return new Decimal(1)
|
||||||
|
|
Loading…
Add table
Reference in a new issue