diff --git a/css/components.css b/css/components.css index ac42fd62d1..1706e8cf6e 100644 --- a/css/components.css +++ b/css/components.css @@ -1,7 +1,7 @@ .upg { min-height: 120px; width: 120px; - border-radius: 25%; + border-radius: 10%; border: 2px solid; border-color: rgba(0, 0, 0, 0.125); font-size: 10px; @@ -11,7 +11,7 @@ .achievement { height: 90px; width: 90px; - border-radius: 25%; + border-radius: 10%; border: 2px solid; border-color: rgba(0, 0, 0, 0.125); font-size: 10px; @@ -26,7 +26,7 @@ .buyable { height: 200px; width: 200px; - border-radius: 25%; + border-radius: 10%; border: 2px solid; border-color: rgba(0, 0, 0, 0.125); font-size: 10px; diff --git a/css/misc.css b/css/misc.css index 1a9ec6e8cb..7803bbcce4 100644 --- a/css/misc.css +++ b/css/misc.css @@ -15,7 +15,7 @@ cursor: pointer; padding: 5px 20px; margin: 5px; - border-radius: 10px; + border-radius: 0px; border: 2px solid; color: var(--color); diff --git a/css/tree-node.css b/css/tree-node.css index 8e11d00d6a..54178bc2ae 100644 --- a/css/tree-node.css +++ b/css/tree-node.css @@ -4,14 +4,14 @@ width: 100px; border: var(--hqProperty1); border-color: rgba(0, 0, 0, 0.125); - border-radius: 50%; + border-radius: 0%; box-shadow: var(--hqProperty2a), var(--hqProperty2b); font-size: 40px; font-family: "Lucida Console", "Courier New", monospace; color: rgba(0, 0, 0, 0.5); text-shadow: var(--hqProperty3); padding: 0; - margin: 0 10px 0 10px; + margin: 0 30px 0 30px; } .nodeLabel { diff --git a/js/layers.js b/js/layers.js index f9488fb9b0..6d2da87334 100644 --- a/js/layers.js +++ b/js/layers.js @@ -1,18 +1,27 @@ -addLayer("p", { - name: "prestige", // This is optional, only used in a few places, If absent it just uses the layer id. - symbol: "P", // This appears on the layer's node. Default is the id with the first letter capitalized + +addLayer("mb", { + name: "Mars Base", // This is optional, only used in a few places, If absent it just uses the layer id. + symbol: "🧱", // This appears on the layer's node. Default is the id with the first letter capitalized position: 0, // Horizontal position within a row. By default it uses the layer id and sorts in alphabetical order startData() { return { unlocked: true, points: new Decimal(0), + amps: new Decimal(0), + watts: new Decimal(0), + time: new Decimal(1), + day: new Decimal(1), + night: new Decimal(1), + temperature: new Decimal(0), + temperatureTime: new Decimal(0), + joules: new Decimal(0) }}, - color: "#4BDC13", - requires: new Decimal(10), // Can be a function that takes requirement increases into account - resource: "prestige points", // Name of prestige currency - baseResource: "points", // Name of resource prestige is based on + color: "#b5894aff", + requires: new Decimal(1), // Can be a function that takes requirement increases into account + resource: "volts", // Name of prestige currency + baseResource: "energy", // Name of resource prestige is based on baseAmount() {return player.points}, // Get the current amount of baseResource - type: "normal", // normal: cost to gain currency depends on amount gained. static: cost depends on how much you already have - exponent: 0.5, // Prestige currency exponent + type: "static", // normal: cost to gain currency depends on amount gained. static: cost depends on how much you already have + exponent: 0.7, // Prestige currency exponent gainMult() { // Calculate the multiplier for main currency from bonuses mult = new Decimal(1) return mult @@ -20,9 +29,553 @@ addLayer("p", { gainExp() { // Calculate the exponent on main currency from bonuses return new Decimal(1) }, +update(diff) { + player.mb.watts = player.mb.points.times(player.mb.amps) + player.mb.joules = player.mb.joules.plus(player.mb.watts.times(diff)) + player.mb.time = player.mb.time.plus(diff); + const PERIOD = 500; + const MIN_TEMPA = -80; + const MAX_TEMPA = 45; + const cycleTime = player.mb.time.toNumber() % PERIOD; + const cycleProgress = cycleTime / PERIOD; + const normalized = Math.sin(cycleProgress * 2 * Math.PI - Math.PI / 2) * 0.5 + 0.5; //sine wave + const temp = MIN_TEMPA + normalized * (MAX_TEMPA - MIN_TEMPA); + player.mb.temperature = new Decimal(temp); + let isDay = normalized >= 0.5; + if (typeof player.mb.isDay !== "boolean") player.mb.isDay = !isDay; + if (!player.mb.isDay && isDay) { + player.mb.day = player.mb.day.plus(1); + } + player.mb.isDay = isDay; + player.mb.night = isDay ? new Decimal(0) : new Decimal(1); +}, row: 0, // Row the layer is in on the tree (0 is the first row) hotkeys: [ - {key: "p", description: "P: Reset for prestige points", onPress(){if (canReset(this.layer)) doReset(this.layer)}}, + {key: "v", description: "V: Reset for volts", onPress(){if (canReset(this.layer)) doReset(this.layer)}}, ], - layerShown(){return true} -}) + layerShown(){return true}, + upgrades: { + 11: { + title: "Electricity Production", + description: "Begin to produce joules to power your machinery. (Start off with 1 amp)", + cost: new Decimal(1), + onPurchase() { + player.mb.amps = new Decimal(1) + } + }, + 12: { + title: "Voltage", + description: "The amount of voltages will boost the amount of energy you get.", + cost: new Decimal(25), + currencyDisplayName: "Joules", + currencyInternalName: "joules", + currencyLayer: "mb", + effect() { + return player[this.layer].points.add(1).pow(0.5) + }, + effectDisplay() { return format(upgradeEffect(this.layer, this.id))+"x" }, // Add formatting to the effect + }, + 13: { + title: "More Amps", + description: "1.0 Amps -> 1.25 Amps", + cost: new Decimal(70), + currencyDisplayName: "Joules", + currencyInternalName: "joules", + currencyLayer: "mb", + onPurchase() { + player.mb.amps = new Decimal(1.25) + } + }, + 14: { + title: "Efficient Energy", + description: "The amount of watts you have boosts the amount of energy you get.", + cost: new Decimal(100), + currencyDisplayName: "Joules", + currencyInternalName: "joules", + currencyLayer: "mb", + effect() { + return player[this.layer].watts.add(1).pow(0.2) + }, + effectDisplay() { return format(upgradeEffect(this.layer, this.id))+"x" }, // Add formatting to the effect + + }, + 15: { + title: "More Amps II", + description: "1.25 Amps -> 1.5 Amps", + cost: new Decimal(250), + currencyDisplayName: "Joules", + currencyInternalName: "joules", + currencyLayer: "mb", + onPurchase() { + player.mb.amps = new Decimal(1.5) + } + }, + 21: { + title: "Energy Efficiency I", + description: "Double the amount of energy you generate", + cost: new Decimal(300), + currencyDisplayName: "Joules", + currencyInternalName: "joules", + currencyLayer: "mb", + unlocked() { + return hasUpgrade('mb',15) + } + }, + 22: { + title: "Energy Efficiency II", + description: "Triple the amount of energy you generate", + cost: new Decimal(300), + currencyDisplayName: "Joules", + currencyInternalName: "joules", + currencyLayer: "mb", + unlocked() { + return hasUpgrade('mb',15) + } + }, + 23: { + title: "Outside of the base", + description: "You must activate all the solar panels on your mars base for maximum efficiency.", + cost: new Decimal(8), + + unlocked() { + return hasUpgrade('mb',15) + } + }, + 24: { + title: "Energy Efficiency III", + description: "The amount of amps you have boosts energy.", + cost: new Decimal(1000), + currencyDisplayName: "Joules", + currencyInternalName: "joules", + currencyLayer: "mb", + unlocked() { + return hasUpgrade('mb',15) + }, + effect() { + return player[this.layer].amps.add(1).pow(0.5) + }, + effectDisplay() { return format(upgradeEffect(this.layer, this.id))+"x" }, // Add formatting to the effect + }, + 25: { + title: "Researching", + description: "Unlock the research tree", + cost: new Decimal(1500), + currencyDisplayName: "Joules", + currencyInternalName: "joules", + currencyLayer: "mb", + unlocked() { + return hasUpgrade('mb',15) + } + } + }, + achievements: { + 11: { + name: "Electricity", + tooltip: "Obtain 10 Joules", + done() { return player.mb.joules.gte(10) }, + unlocked() {return true}, + }, + 12: { + name: "Low Voltage", + tooltip: "Obtain 5 Voltages", + done() { return player.mb.points.gte(5) }, + unlocked() {return true}, + } + }, + bars: { + temperature: { + direction: RIGHT, + width: 600, + height: 30, + progress() { + const MIN_TEMPA = new Decimal(-80); + const MAX_TEMPA = new Decimal(45); + let tempa = player.mb.temperature; + if (tempa.lt(MIN_TEMPA)) tempa = MIN_TEMPA; + if (tempa.gt(MAX_TEMPA)) tempa = MAX_TEMPA; + return tempa.minus(MIN_TEMPA).div(MAX_TEMPA.minus(MIN_TEMPA)); + }, + display() { + const temp = player.mb.temperature.toFixed(2); + return ` + Temperature: ${temp} °C + `; +}, + fillStyle() { + return { backgroundColor: "#ff6600" }; + }, + borderStyle() { + return { borderColor: "#000000ff", borderWidth: "2px", borderStyle: "solid" }; + } + }, +}, + + tabFormat: { + "BASE INFORMATION": { + content: [ + ["raw-html", function () { + let dis = ` +
+ 🚀 YOUR MISSION:
+ You've been deployed to Mars to terraform the surface.
+ Start by producing energy to power machinery.
+ Don't worry about oyxgen as there is enough to sustain you for a while
+ (A day lasts exactly 500 seconds)
+ (Additional information: During the nights energy production will slow down, but begin to ramp up when the temperature rises) +
+ `; + return dis; + }], + + ["raw-html", function () { + let isNight = player.mb.night.eq(1); + let timeText = isNight ? "🌙 Night" : "☀️ Day"; //ifelse stuff + let timeColor = isNight ? "#5a7dff" : "#ffcc33"; + let dis = ` + + You have been here for: ${format(player.mb.day)} days. +
+ + The time is currently: ${timeText} + + `; + return dis; +}], +["raw-html", function() { + let dis = 'TEMPERATURE:' + return dis + }], +["bar",'temperature'] + ], + + }, + "ACHIEVEMENTS": { + content: [ + "achievements" + ] + + }, + "MAIN GENERATOR": { + content: [ + "main-display", + "prestige-button", + ["raw-html", function() { + let dis = 'You have '+ format(player.points)+' Energy.' + return dis + }], + ["raw-html", function() { + let dis = 'You have '+ format(player.mb.amps)+' Amps.' + return dis + }], + ["raw-html", function() { + let dis = 'You have '+ format(player.mb.watts)+' Watts.' + return dis + }], + ["raw-html", function() { + let dis = 'You have '+ format(player.mb.joules)+' Joules.' + return dis + }], + ["row",[["upgrade",11],["upgrade",12],["upgrade",13],["upgrade",14],["upgrade",15]]], + ["row",[["upgrade",21],["upgrade",22],["upgrade",23],["upgrade",24],["upgrade",25]]] + ] + + } + } +}), +addLayer("o", { + name: "Outside", // This is optional, only used in a few places, If absent it just uses the layer id. + symbol: "⚙️", // This appears on the layer's node. Default is the id with the first letter capitalized + position: 1, // Horizontal position within a row. By default it uses the layer id and sorts in alphabetical order + startData() { return { + unlocked: true, + points: new Decimal(0), + solarstat: new Decimal(0), + solartime: new Decimal(0), + js: new Decimal(0), + jsg: new Decimal(5), + c: new Decimal(500), + duration: new Decimal(10) + }}, + color: "#6fc97aff", + requires: new Decimal(1), // Can be a function that takes requirement increases into account + resource: "research points", // Name of prestige currency + baseResource: "energy", // Name of resource prestige is based on + baseAmount() {return player.points}, // Get the current amount of baseResource + type: "static", // normal: cost to gain currency depends on amount gained. static: cost depends on how much you already have + exponent: 0.6, // Prestige currency exponent + gainMult() { // Calculate the multiplier for main currency from bonuses + mult = new Decimal(1) + if (hasUpgrade('o', 33)) mult = mult.times(upgradeEffect('o', 33)) + return mult + }, + gainExp() { // Calculate the exponent on main currency from bonuses + return new Decimal(1) + }, + row: 0, // Row the layer is in on the tree (0 is the first row) + layerShown(){return hasUpgrade('mb',23) || hasUpgrade('mb',23)}, + branches: ["mb"], + update(diff) { + if (player.mb.points.gte(1)) { + if (hasUpgrade('mb', 25)) { + let gain = player.mb.points.div(1.5).log10().max(0).sqrt(); + if (hasUpgrade('o', 33)) gain = gain.times(upgradeEffect('o', 33)); + if (hasUpgrade('o', 34)) gain = gain.times(upgradeEffect('o', 34)); + player.o.points = player.o.points.plus(gain.times(diff)); + } +} + if (player.o.solarstat.eq(1) && player.mb.night.eq(0)) { + if (player.o.solartime.gt(0)) { + player.o.js = new Decimal(player.o.jsg); + player.mb.joules = player.mb.joules.plus(player.o.js.times(diff)); + player.o.solartime = player.o.solartime.minus(diff); + } else { + player.o.solartime = new Decimal(0); + player.o.solarstat = new Decimal(0); + player.o.js = new Decimal(0); + } + } else { + player.o.js = new Decimal(0); + } + if (player.mb.night.eq(1)) { + player.o.solartime = new Decimal(0); + player.o.solarstat = new Decimal(0); + } +}, + clickables: { + 11: { + display() { + let isOn = player.o.solarstat.eq(1); + let square = isOn ? "🟦" : "⬛"; + let panel = `${square.repeat(4)}\n`.repeat(5).trim(); + return `
${panel}
`; +}, + tooltip() { let isOn = player.o.solarstat.eq(1); + let status = isOn ? "ON" : "OFF"; + let joules = format(player.o.js); + let cost = format(player.o.c) + let time = format(player.o.solartime) + return `STATUS: ${status}.
Generating: ${joules} joules/s. Cost to start-up solar panel: ${cost} joules. Time left: ${time}`;}, + style() { + let isOn = player.o.solarstat.eq(1); + return { + "background-color": isOn ? "#3366ff" : "#111111", + "border": `2px solid ${isOn ? "#1a3d7c" : "#333333"}`, + "border-radius": "8px", + "padding": "4px", + "margin": "2px", + "color": "#ffffff" + }; + }, + canClick() { + return true; + }, + onClick() { + if (player.o.solarstat.eq(0) && player.mb.joules.gte(player.o.c) && player.mb.night.eq(0)) { + player.mb.joules = player.mb.joules.minus(player.o.c); + player.o.solarstat = new Decimal(1); + player.o.solartime = new Decimal(player.o.duration); + } +} + }, +}, + + tabFormat: { + "OUTSIDE BASE INFORMATION": { + content: [ + ["raw-html", function () { + let dis = ` +
+ 💡 OBJECTIVE:
+ Now that you have the inside of your base up and running,
+ your next goal is to get the solar panels to work and then eventually get more efficient ways to generate energy
+
+ `; + return dis; + }], + ] + }, + "ACHIEVEMENTS": { + content: [ + "achievements" + ] + }, + "SOLAR PANELS": { + content: [ + ["raw-html", function() { + let dis = 'Once solar panels are activated they will eventaully deactivate. If they deactivate you can reactivate them by using joules.
(The solar panels do not function at night.)' + return dis + }], + ["row",[["clickable",11]]] + ] + }, + "RESEARCH TREE": { + content: [ + "main-display", + ["raw-html", function () { + if (!hasUpgrade('mb', 25)) { + return 'You are currently generating 0 Research Points/s ' + + ' You generate research points based on how many volts you have: ' + + 'sqrt(log(volts/1.5))'; + } + let gain = player.mb.points.div(1.5).log10().max(0).sqrt(); + if (hasUpgrade('o', 33)) gain = gain.times(upgradeEffect('o', 33)); + if (hasUpgrade('o', 34)) gain = gain.times(upgradeEffect('o', 34)); + return 'You are currently generating ' + format(gain) + + ' Research Points/s ' + + ' You generate research points based on how many volts you have: ' + + 'sqrt(log(volts/1.5))'; +}], + ["row",[["upgrade",11]]], + ["row",[["upgrade",21],["upgrade",22]]], + ["row",[["upgrade",31],["upgrade",32],["upgrade",33],["upgrade",34]]] + ] + } + }, + upgrades: { + 11: { + title: "Low Maintenance", + description: "Cost for the startup: 500 -> 400 (Who uses these solar panels anyway?)", + cost: new Decimal(20), + onPurchase() { + player.o.c = new Decimal(400) + } + }, + 21: { + title: "Low Maintenance II", + description: "Cost for the startup: 400 -> 300", + cost: new Decimal(20), + onPurchase() { + player.o.c = new Decimal(300) + }, + unlocked() {return hasUpgrade('o',11)}, + branches: [11] + }, + 22: { + title: "Longer Duration", + description: "Duration of the solar panel: 10 -> 15", + cost: new Decimal(20), + onPurchase() { + player.o.duration = new Decimal(15) + }, + unlocked() {return hasUpgrade('o',11)}, + branches: [11] + }, + 31: { + title: "Longer Duration II", + description: "Duration of the solar panel: 15 -> 20", + cost: new Decimal(50), + onPurchase() { + player.o.duration = new Decimal(20) + }, + branches: [21,22], + unlocked() {return hasUpgrade('o',21) || hasUpgrade('o',22)}, + }, + 32: { + title: "Work Smarter Not Harder", + description: "Research Points boost the amonut of energy you get", + cost: new Decimal(50), + unlocked() {return hasUpgrade('o',21) || hasUpgrade('o',22)}, + effect() { + return player[this.layer].points.add(1).pow(0.05) + }, + effectDisplay() { return format(upgradeEffect(this.layer, this.id))+"x" }, // Add formatting to the effect + branches: [21,22] + }, + 33: { + title: "Intelligence I", + description: "Volts boosts research points", + cost: new Decimal(50), + unlocked() {return hasUpgrade('o',21) || hasUpgrade('o',22)}, + effect() { + return player.mb.points.add(1).pow(0.1) + }, + effectDisplay() { return format(upgradeEffect(this.layer, this.id))+"x" }, // Add formatting to the effect + branches: [21,22] + }, + 34: { + title: "Intelligence II", + description: "Amps boosts research points", + cost: new Decimal(100), + unlocked() {return hasUpgrade('o',21) || hasUpgrade('o',22)}, + effect() { + return player.mb.amps.add(1).pow(0.5) + }, + effectDisplay() { return format(upgradeEffect(this.layer, this.id))+"x" }, // Add formatting to the effect + branches: [21,22] + } + }, + achievements: { + 11: { + name: "Researching", + tooltip: "Have 100 Reserach Points", + done() { return player.o.points.gte(100) }, + unlocked() {return true}, + }, + } +}), +addLayer("a", { + name: "Achievements", + symbol: "🏅", + position: 0, + startData() { return { + unlocked: true, + points: new Decimal(0) + }}, + color: "#cdb900", + requires: new Decimal(0), + resource: "Achievement Points", + type: "none", + row: "side", + layerShown() { return true }, + achievements: { + 11: { + name: "The Beginning", + tooltip: "Begin your journey. Reward: 1 AP.", + done() { return hasUpgrade('mb',11) }, + unlocked() {return true}, + onComplete() { addPoints("a", 1) } + }, + 12: { + name: "The Outside", + tooltip: "Unlock the outside of the base. Reward: 1 AP.", + done() { return hasUpgrade('mb',23) }, + unlocked() {return true}, + onComplete() { addPoints("a", 1) } + }, + 13: { + name: "Solar Panels", + tooltip: "Activate your first solar panel Reward: 1 AP.", + done() { return player.o.solarstat.gte(1)}, + unlocked() {return true}, + onComplete() { addPoints("a", 1) } + }, + 14: { + name: "Scientific Research", + tooltip: "Unlock the research tree Reward: 1 AP.", + done() { return hasUpgrade('mb',25)}, + unlocked() {return true}, + onComplete() { addPoints("a", 1) } + } + }, + tabFormat: { + "Achievements": { + content: [ + "main-display", "achievements" + ] + } + } +}) \ No newline at end of file diff --git a/js/mod.js b/js/mod.js index 751e3dfff6..dfa05d9dc3 100644 --- a/js/mod.js +++ b/js/mod.js @@ -1,27 +1,30 @@ let modInfo = { - name: "The ??? Tree", - author: "nobody", - pointsName: "points", + name: "An Expedition To Mars", + author: "Idle Gaming", + pointsName: "energy", modFiles: ["layers.js", "tree.js"], discordName: "", discordLink: "", - initialStartPoints: new Decimal (10), // Used for hard resets and new players + initialStartPoints: new Decimal (1), // Used for hard resets and new players offlineLimit: 1, // In hours } // Set your version in num and name let VERSION = { - num: "0.0", - name: "Literally nothing", + num: "0.0001", + name: "Project M.E.P (Mars Expedition Program)", } let changelog = `

Changelog:


+

v0.0001


+ - Fixed the research tree... hopefully. (The upgrade effects should work now!)
+ - Along with that I added 1 new research tree upgrade

v0.0


- - Added things.
- - Added stuff.` + - You were the only one sent to mars. It gets pretty lonely out here...
+ - Enjoy your stay.` -let winText = `Congratulations! You have reached the end and beaten this game, but for now...` +let winText = `You've completed the tasks you needed to complete! Good job.` // If you add new functions anywhere inside of a layer, and those functions have an effect when called, add them here. // (The ones here are examples, all official functions are already taken care of) @@ -33,6 +36,7 @@ function getStartPoints(){ // Determines if it should show points/sec function canGenPoints(){ + if (hasUpgrade('mb',11)) return true } @@ -41,7 +45,13 @@ function getPointGen() { if(!canGenPoints()) return new Decimal(0) - let gain = new Decimal(1) + let gain = new Decimal(0.05) + gain = gain.times(Math.max(Math.log(player.mb.temperature.toNumber() + 81) / Math.log(126), 0.1)); + if (hasUpgrade('mb', 12)) gain = gain.times(upgradeEffect('mb', 12)) + if (hasUpgrade('mb', 24)) gain = gain.times(upgradeEffect('mb', 24)) + if (hasUpgrade('o', 32)) gain = gain.times(upgradeEffect('o', 32)) + if (hasUpgrade('mb', 21)) gain = gain.times(2) + if (hasUpgrade('mb', 22)) gain = gain.times(3) return gain }