1
0
Fork 0
mirror of https://github.com/Acamaeda/The-Modding-Tree.git synced 2024-11-24 17:31:50 +00:00

Beta v1.01

This commit is contained in:
Jacorb90 2020-08-25 18:42:43 -04:00
parent 156925f97c
commit 9ca463deee
4 changed files with 42 additions and 15 deletions

View file

@ -70,10 +70,23 @@
<li>Added a "time played" display in the info tab</li> <li>Added a "time played" display in the info tab</li>
<li>Implemented a NaN check system</li> <li>Implemented a NaN check system</li>
</ul><br><br> </ul><br><br>
<h3>Beta v1.01</h3>
<ul>
<li>Display Generator Power in the Space tab</li>
<li>Add a credits page in the info tab</li>
<li>Implemented a few minor QoL/visual fixes</li>
</ul><br><br>
</div>
<div v-if="player.tab=='credits'" class="col right">
<button class="back" onclick="showTab('tree')"></button><br><br><br><br><br>
This game uses <a href="https://github.com/Patashu/break_eternity.js/tree/master" target="_blank">break_eternity.js</a> by Patashu.<br>
This game was inspired by a post shown to me by Crimson406<br>
Note: If anyone wishes to make a mod of this game, that is perfectly fine with me, just make sure to name it something different (ex: Prestige Tree NG+) and to let me know on <a href="https://discord.gg/wwQfgPa" target="_blank">my discord</a>.
</div> </div>
<div v-if="player.tab=='info'" class="col right"> <div v-if="player.tab=='info'" class="col right">
<button class="back" onclick="showTab('tree')"></button><br><br><br><br><br> <button class="back" onclick="showTab('tree')"></button><br><br><br><br><br>
Time Played: {{ formatTime(player.timePlayed) }}<br><br><br> Time Played: {{ formatTime(player.timePlayed) }}<br><br><br>
<div id="cl" onclick="showTab('credits')">Credits</div><br>
<div id="cl" onclick="showTab('changelog')">Changelog</div><br><br><br> <div id="cl" onclick="showTab('changelog')">Changelog</div><br><br><br>
<h3>Hotkeys</h3><br><br> <h3>Hotkeys</h3><br><br>
P: Prestige reset<br> P: Prestige reset<br>
@ -100,7 +113,7 @@
</tr> </tr>
</table> </table>
</div> </div>
<div class="col left"> <div id="treeTab" onscroll="resizeCanvas()" class="col left">
<img id="optionWheel" v-if="player.tab!='options'" src="options_wheel.png" onclick="showTab('options')"></img> <img id="optionWheel" v-if="player.tab!='options'" src="options_wheel.png" onclick="showTab('options')"></img>
<br>You have <h2>{{format(player.points)}}</h2> Points <br>You have <h2>{{format(player.points)}}</h2> Points
<br><br><br><br><br> <br><br><br><br><br>
@ -161,13 +174,14 @@
<button v-bind:class="{ upgBig: true, can: (player.b.points.gte(getExtCapsuleCost())&&player.t.unl), locked: (player.b.points.lt(getExtCapsuleCost())||!player.t.unl), t: true }" onclick="buyExtCapsule()">Buy an extra Time Capsule<br>Cost: {{formatWhole(getExtCapsuleCost())}} Boosters<br>Amount: {{formatWhole(player.t.extCapsules)}}</button> <button v-bind:class="{ upgBig: true, can: (player.b.points.gte(getExtCapsuleCost())&&player.t.unl), locked: (player.b.points.lt(getExtCapsuleCost())||!player.t.unl), t: true }" onclick="buyExtCapsule()">Buy an extra Time Capsule<br>Cost: {{formatWhole(getExtCapsuleCost())}} Boosters<br>Amount: {{formatWhole(player.t.extCapsules)}}</button>
</div> </div>
<div v-if="layer=='s'"> <div v-if="layer=='s'">
You have {{formatWhole(getSpace())}} Space.<br><br> You have {{formatWhole(getSpace())}} Space remaining for Space Buildings.<br><br>
<table><tr><td v-bind:class="{ milestone: player.s.best.lt(2), milestoneDone: player.s.best.gte(2) }">2 space energy<br>Keep Booster/Generator milestones on reset</td></tr> <table><tr><td v-bind:class="{ milestone: player.s.best.lt(2), milestoneDone: player.s.best.gte(2) }">2 space energy<br>Keep Booster/Generator milestones on reset</td></tr>
<tr><td v-bind:class="{ milestone: player.s.best.lt(3), milestoneDone: player.s.best.gte(3) }">3 space energy<br>Keep Prestige Upgrades on reset</td></tr> <tr><td v-bind:class="{ milestone: player.s.best.lt(3), milestoneDone: player.s.best.gte(3) }">3 space energy<br>Keep Prestige Upgrades on reset</td></tr>
<tr><td v-bind:class="{ milestone: player.s.best.lt(4), milestoneDone: player.s.best.gte(4) }">4 space energy<br>Keep Generator Upgrades on all row 3 resets</td></tr> <tr><td v-bind:class="{ milestone: player.s.best.lt(4), milestoneDone: player.s.best.gte(4) }">4 space energy<br>Keep Generator Upgrades on all row 3 resets</td></tr>
<tr><td v-bind:class="{ milestone: player.s.best.lt(5), milestoneDone: player.s.best.gte(5) }">5 space energy<br>Automatically purchase Generators&nbsp;&nbsp;&nbsp;<button v-if="player.s.best.gte(5)" class="smallUpg can g" onclick="toggleAuto('g')">{{player.g.auto?"ON":"OFF"}}</button></td></tr> <tr><td v-bind:class="{ milestone: player.s.best.lt(5), milestoneDone: player.s.best.gte(5) }">5 space energy<br>Automatically purchase Generators&nbsp;&nbsp;&nbsp;<button v-if="player.s.best.gte(5)" class="smallUpg can g" onclick="toggleAuto('g')">{{player.g.auto?"ON":"OFF"}}</button></td></tr>
<tr><td v-bind:class="{ milestone: player.s.best.lt(12), milestoneDone: player.s.best.gte(12) }">12 space energy<br>Generators reset nothing</td></tr> <tr><td v-bind:class="{ milestone: player.s.best.lt(12), milestoneDone: player.s.best.gte(12) }">12 space energy<br>Generators reset nothing</td></tr>
</table><br><br> </table><br><br>
You have {{ format(player.g.power) }} Generator Power<br><br>
<button onclick="respecSpaceBuildings()" v-bind:class="{ longUpg: true, can: player.s.unl, locked: !player.s.unl }">Respec Space Buildings</button><br> <button onclick="respecSpaceBuildings()" v-bind:class="{ longUpg: true, can: player.s.unl, locked: !player.s.unl }">Respec Space Buildings</button><br>
<div class="upgRow"> <div class="upgRow">
<div v-for="id in 5"> <div v-for="id in 5">
@ -180,8 +194,8 @@
<tr><td v-bind:class="{ milestone: player.sb.best.lt(4), milestoneDone: player.sb.best.gte(4) }">4 Super-Boosters<br>Keep Booster/Generator milestones on reset</td></tr></table> <tr><td v-bind:class="{ milestone: player.sb.best.lt(4), milestoneDone: player.sb.best.gte(4) }">4 Super-Boosters<br>Keep Booster/Generator milestones on reset</td></tr></table>
</div> </div>
<br><br><br> <br><br><br>
<button v-if="LAYER_TYPE[layer]=='normal'" v-bind:class="{ [layer]: true, reset: true, locked: tmp.layerAmt[layer].lt(tmp.layerReqs[layer]), can: tmp.layerAmt[layer].gte(tmp.layerReqs[layer]) }" v-on:click="doReset(layer)">+{{formatWhole(tmp.resetGain[layer])}} {{LAYER_RES[layer]}}<br>Next at {{ format(tmp.nextAt[layer]) }} {{ LAYER_AMT_NAMES[layer] }}</button> <button v-if="LAYER_TYPE[layer]=='normal'" v-bind:class="{ [layer]: true, reset: true, locked: tmp.layerAmt[layer].lt(tmp.layerReqs[layer]), can: tmp.layerAmt[layer].gte(tmp.layerReqs[layer]) }" v-on:click="doReset(layer)">+{{formatWhole(tmp.resetGain[layer])}} {{LAYER_RES[layer]}}<br>Next at {{ (LAYER_RES_CEIL.includes(layer) ? formatWhole(tmp.nextAt[layer]) : format(tmp.nextAt[layer])) }} {{ LAYER_AMT_NAMES[layer] }}</button>
<button v-if="LAYER_TYPE[layer]=='static'" v-bind:class="{ [layer]: true, reset: true, locked: tmp.layerAmt[layer].lt(tmp.nextAt[layer]), can: tmp.layerAmt[layer].gte(tmp.nextAt[layer]) }" v-on:click="doReset(layer)">+{{formatWhole(tmp.resetGain[layer])}} {{LAYER_RES[layer]}}<br>Req: {{format(tmp.nextAt[layer])}} {{ LAYER_AMT_NAMES[layer] }}</button> <button v-if="LAYER_TYPE[layer]=='static'" v-bind:class="{ [layer]: true, reset: true, locked: tmp.layerAmt[layer].lt(tmp.nextAt[layer]), can: tmp.layerAmt[layer].gte(tmp.nextAt[layer]) }" v-on:click="doReset(layer)">+{{formatWhole(tmp.resetGain[layer])}} {{LAYER_RES[layer]}}<br>Req: {{(LAYER_RES_CEIL.includes(layer) ? formatWhole(tmp.nextAt[layer]) : format(tmp.nextAt[layer]))}} {{ LAYER_AMT_NAMES[layer] }}</button>
<br><br><br> <br><br><br>
<div class="upgTable"> <div class="upgTable">
<div v-for="row in LAYER_UPGS[layer].rows" class="upgRow"> <div v-for="row in LAYER_UPGS[layer].rows" class="upgRow">

View file

@ -1,11 +1,13 @@
var canvas; var canvas;
var ctx var ctx;
window.addEventListener("resize", (_=>resizeCanvas())); window.addEventListener("resize", (_=>resizeCanvas()));
function retrieveCanvasData() { function retrieveCanvasData() {
let treeCanv = document.getElementById("treeCanvas") let treeCanv = document.getElementById("treeCanvas")
let treeTab = document.getElementById("treeTab")
if (treeCanv===undefined||treeCanv===null) return false; if (treeCanv===undefined||treeCanv===null) return false;
if (treeTab===undefined||treeTab===null) return false;
canvas = treeCanv; canvas = treeCanv;
ctx = canvas.getContext("2d"); ctx = canvas.getContext("2d");
return true; return true;
@ -15,8 +17,8 @@ function resizeCanvas() {
if (!retrieveCanvasData()) return if (!retrieveCanvasData()) return
canvas.width = 0; canvas.width = 0;
canvas.height = 0; canvas.height = 0;
canvas.width = document.body.scrollWidth; canvas.width = document.getElementById("treeTab").scrollWidth;
canvas.height = document.body.scrollHeight; canvas.height = document.getElementById("treeTab").scrollHeight;
drawTree(); drawTree();
} }
@ -39,10 +41,10 @@ function drawTree() {
function drawTreeBranch(num1, num2) { // taken from Antimatter Dimensions & adjusted slightly function drawTreeBranch(num1, num2) { // taken from Antimatter Dimensions & adjusted slightly
let start = document.getElementById(num1).getBoundingClientRect(); let start = document.getElementById(num1).getBoundingClientRect();
let end = document.getElementById(num2).getBoundingClientRect(); let end = document.getElementById(num2).getBoundingClientRect();
let x1 = start.left + (start.width / 2) + (document.documentElement.scrollLeft || document.body.scrollLeft); let x1 = start.left + (start.width / 2) + (document.getElementById("treeTab").scrollLeft || document.body.scrollLeft);
let y1 = start.top + (start.height / 2) + (document.documentElement.scrollTop || document.body.scrollTop); let y1 = start.top + (start.height / 2) + (document.getElementById("treeTab").scrollTop || document.body.scrollTop);
let x2 = end.left + (end.width / 2) + (document.documentElement.scrollLeft || document.body.scrollLeft); let x2 = end.left + (end.width / 2) + (document.getElementById("treeTab").scrollLeft || document.body.scrollLeft);
let y2 = end.top + (end.height / 2) + (document.documentElement.scrollTop || document.body.scrollTop); let y2 = end.top + (end.height / 2) + (document.getElementById("treeTab").scrollTop || document.body.scrollTop);
ctx.lineWidth = 15; ctx.lineWidth = 15;
ctx.beginPath(); ctx.beginPath();
ctx.strokeStyle = "white" ctx.strokeStyle = "white"

View file

@ -9,7 +9,7 @@ function getStartPlayer() {
time: Date.now(), time: Date.now(),
autosave: true, autosave: true,
versionType: "beta", versionType: "beta",
version: 1.0, version: 1.01,
timePlayed: 0, timePlayed: 0,
hasNaN: false, hasNaN: false,
points: new Decimal(10), points: new Decimal(10),
@ -98,6 +98,8 @@ const LAYER_RES = {
sb: "super-boosters", sb: "super-boosters",
} }
const LAYER_RES_CEIL = ["sb"]
const LAYER_TYPE = { const LAYER_TYPE = {
p: "normal", p: "normal",
b: "static", b: "static",
@ -624,6 +626,7 @@ const TAB_REQS = {
options: function() { return true }, options: function() { return true },
info: function() { return true }, info: function() { return true },
changelog: function() { return true }, changelog: function() { return true },
credits: function() { return true },
p: function() { return (player.p.unl||player.points.gte(tmp.layerReqs.p))&&layerUnl('p') }, p: function() { return (player.p.unl||player.points.gte(tmp.layerReqs.p))&&layerUnl('p') },
b: function() { return (player.b.unl||player.points.gte(tmp.layerReqs.b))&&layerUnl('b') }, b: function() { return (player.b.unl||player.points.gte(tmp.layerReqs.b))&&layerUnl('b') },
g: function() { return (player.g.unl||player.points.gte(tmp.layerReqs.g))&&layerUnl('g') }, g: function() { return (player.g.unl||player.points.gte(tmp.layerReqs.g))&&layerUnl('g') },
@ -903,8 +906,14 @@ function getNextAt(layer) {
let amt = player[layer].points let amt = player[layer].points
if (amt.gte(12)) amt = amt.pow(2).div(12) if (amt.gte(12)) amt = amt.pow(2).div(12)
let extraCost = Decimal.pow(LAYER_BASE[layer], amt.pow(LAYER_EXP[layer])).times(tmp.gainMults[layer]) let extraCost = Decimal.pow(LAYER_BASE[layer], amt.pow(LAYER_EXP[layer])).times(tmp.gainMults[layer])
return extraCost.times(tmp.layerReqs[layer]).max(tmp.layerReqs[layer]) let cost = extraCost.times(tmp.layerReqs[layer]).max(tmp.layerReqs[layer])
} else return tmp.resetGain[layer].plus(1).div(tmp.gainMults[layer]).root(LAYER_EXP[layer]).times(tmp.layerReqs[layer]).max(tmp.layerReqs[layer]) if (LAYER_RES_CEIL.includes(layer)) cost = cost.ceil()
return cost;
} else {
let next = tmp.resetGain[layer].plus(1).div(tmp.gainMults[layer]).root(LAYER_EXP[layer]).times(tmp.layerReqs[layer]).max(tmp.layerReqs[layer])
if (LAYER_RES_CEIL.includes(layer)) next = next.ceil()
return next;
}
} }
function layerUnl(layer) { function layerUnl(layer) {
@ -1350,6 +1359,7 @@ function gameLoop(diff) {
if (player.hasNaN&&!NaNalert) { if (player.hasNaN&&!NaNalert) {
alert("We have detected a corruption in your save. Please visit https://discord.gg/wwQfgPa for help.") alert("We have detected a corruption in your save. Please visit https://discord.gg/wwQfgPa for help.")
clearInterval(interval);
NaNalert = true; NaNalert = true;
} }
} }

View file

@ -25,7 +25,8 @@ function loadVue() {
LAYER_TYPE, LAYER_TYPE,
LAYER_UPGS, LAYER_UPGS,
LAYER_EFFS, LAYER_EFFS,
LAYER_AMT_NAMES LAYER_AMT_NAMES,
LAYER_RES_CEIL
}, },
}) })
} }