From 9ca463deee8f474468d7903d895291a2d1ef4982 Mon Sep 17 00:00:00 2001 From: Jacorb90 <39597610+Jacorb90@users.noreply.github.com> Date: Tue, 25 Aug 2020 18:42:43 -0400 Subject: [PATCH] Beta v1.01 --- index.html | 22 ++++++++++++++++++---- js/canvas.js | 16 +++++++++------- js/game.js | 16 +++++++++++++--- js/v.js | 3 ++- 4 files changed, 42 insertions(+), 15 deletions(-) diff --git a/index.html b/index.html index d2ea2ec..7791ae2 100644 --- a/index.html +++ b/index.html @@ -70,10 +70,23 @@
  • Added a "time played" display in the info tab
  • Implemented a NaN check system


  • +

    Beta v1.01

    +

    + +
    +




    + This game uses break_eternity.js by Patashu.
    + This game was inspired by a post shown to me by Crimson406
    + 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 my discord.





    Time Played: {{ formatTime(player.timePlayed) }}


    +
    Credits

    Changelog



    Hotkeys



    P: Prestige reset
    @@ -100,7 +113,7 @@
    -
    +

    You have

    {{format(player.points)}}

    Points




    @@ -161,13 +174,14 @@
    - You have {{formatWhole(getSpace())}} Space.

    + You have {{formatWhole(getSpace())}} Space remaining for Space Buildings.

    2 space energy
    Keep Booster/Generator milestones on reset
    3 space energy
    Keep Prestige Upgrades on reset
    4 space energy
    Keep Generator Upgrades on all row 3 resets
    5 space energy
    Automatically purchase Generators   
    12 space energy
    Generators reset nothing


    + You have {{ format(player.g.power) }} Generator Power


    @@ -180,8 +194,8 @@ 4 Super-Boosters
    Keep Booster/Generator milestones on reset



    - - + +


    diff --git a/js/canvas.js b/js/canvas.js index 03c7993..691536e 100644 --- a/js/canvas.js +++ b/js/canvas.js @@ -1,11 +1,13 @@ var canvas; -var ctx +var ctx; window.addEventListener("resize", (_=>resizeCanvas())); function retrieveCanvasData() { let treeCanv = document.getElementById("treeCanvas") + let treeTab = document.getElementById("treeTab") if (treeCanv===undefined||treeCanv===null) return false; + if (treeTab===undefined||treeTab===null) return false; canvas = treeCanv; ctx = canvas.getContext("2d"); return true; @@ -15,8 +17,8 @@ function resizeCanvas() { if (!retrieveCanvasData()) return canvas.width = 0; canvas.height = 0; - canvas.width = document.body.scrollWidth; - canvas.height = document.body.scrollHeight; + canvas.width = document.getElementById("treeTab").scrollWidth; + canvas.height = document.getElementById("treeTab").scrollHeight; drawTree(); } @@ -39,10 +41,10 @@ function drawTree() { function drawTreeBranch(num1, num2) { // taken from Antimatter Dimensions & adjusted slightly let start = document.getElementById(num1).getBoundingClientRect(); let end = document.getElementById(num2).getBoundingClientRect(); - let x1 = start.left + (start.width / 2) + (document.documentElement.scrollLeft || document.body.scrollLeft); - let y1 = start.top + (start.height / 2) + (document.documentElement.scrollTop || document.body.scrollTop); - let x2 = end.left + (end.width / 2) + (document.documentElement.scrollLeft || document.body.scrollLeft); - let y2 = end.top + (end.height / 2) + (document.documentElement.scrollTop || document.body.scrollTop); + let x1 = start.left + (start.width / 2) + (document.getElementById("treeTab").scrollLeft || document.body.scrollLeft); + let y1 = start.top + (start.height / 2) + (document.getElementById("treeTab").scrollTop || document.body.scrollTop); + let x2 = end.left + (end.width / 2) + (document.getElementById("treeTab").scrollLeft || document.body.scrollLeft); + let y2 = end.top + (end.height / 2) + (document.getElementById("treeTab").scrollTop || document.body.scrollTop); ctx.lineWidth = 15; ctx.beginPath(); ctx.strokeStyle = "white" diff --git a/js/game.js b/js/game.js index e195824..0cde771 100644 --- a/js/game.js +++ b/js/game.js @@ -9,7 +9,7 @@ function getStartPlayer() { time: Date.now(), autosave: true, versionType: "beta", - version: 1.0, + version: 1.01, timePlayed: 0, hasNaN: false, points: new Decimal(10), @@ -98,6 +98,8 @@ const LAYER_RES = { sb: "super-boosters", } +const LAYER_RES_CEIL = ["sb"] + const LAYER_TYPE = { p: "normal", b: "static", @@ -624,6 +626,7 @@ const TAB_REQS = { options: function() { return true }, info: 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') }, 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') }, @@ -903,8 +906,14 @@ function getNextAt(layer) { let amt = player[layer].points 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]) - return 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]) + let cost = extraCost.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) { @@ -1350,6 +1359,7 @@ function gameLoop(diff) { if (player.hasNaN&&!NaNalert) { alert("We have detected a corruption in your save. Please visit https://discord.gg/wwQfgPa for help.") + clearInterval(interval); NaNalert = true; } } diff --git a/js/v.js b/js/v.js index c3c3195..d5de885 100644 --- a/js/v.js +++ b/js/v.js @@ -25,7 +25,8 @@ function loadVue() { LAYER_TYPE, LAYER_UPGS, LAYER_EFFS, - LAYER_AMT_NAMES + LAYER_AMT_NAMES, + LAYER_RES_CEIL }, }) } \ No newline at end of file