1
0
Fork 0
mirror of https://github.com/Acamaeda/The-Modding-Tree.git synced 2024-11-21 16:13:55 +00:00

More 2.2.4

This commit is contained in:
Acamaeda 2020-11-28 21:25:53 -05:00
parent 03cd7f11da
commit 33b15ac408
10 changed files with 46 additions and 22 deletions

View file

@ -1,6 +1,11 @@
# The Modding Tree changelog:
### v2.2.4 - 11/28/20
- Added softcap and softcapPower features (for Normal layers)
- Offline time limit and default max tick length were fixed (previously the limits were 1000x too large)
- Added fixOldSaves.
- You can use HTML in mainDisplay.
- Fixed a number of minor oddities.
### v2.2.3 - 11/28/20
- Layers will be highlighted if you can finish a challenge.

View file

@ -94,10 +94,15 @@ You can make almost any value dynamic by using a function in its place, includin
- roundUpCost: **optional**. a bool, which is true if the resource cost needs to be rounded up. (use if the base resource is a "static" currency.)
- canBuyMax(): **sometimes required**. required for static layers, function used to determine if buying max is permitted.
- gainMult(), gainExp(): **optional**. Functions that calculate the multiplier and exponent on resource gain from upgrades and boosts and such. Plug in any bonuses here.
- softcap, softcapPower: **optional**. For normal layers, gain beyond [softcap] points is put to the [softcapPower]th power
Default for softcap is e1e7, and for power is 0.5.
## Other prestige-related features
- canBuyMax(): **sometimes required**. required for static layers, function used to determine if buying max is permitted.
- onPrestige(gain): **optional**. A function that triggers when this layer prestiges, just before you gain the currency. Can be used to have secondary resource gain on prestige, or to recalculate things or whatnot.
- resetDesc: **optional**. Use this to replace "Reset for " on the Prestige button with something else.

View file

@ -23,6 +23,11 @@ addLayer("c", {
exponent: 0.5, // Prestige currency exponent
base: 5, // Only needed for static layers, base of the formula (b^(x^exp))
roundUpCost: false, // True if the cost needs to be rounded up (use when baseResource is static?)
// For normal layers, gain beyond [softcap] points is put to the [softcapPower]th power
softcap: new Decimal(1e100),
softcapPower: new Decimal(0.5),
canBuyMax() {}, // Only needed for static layers with buy max
gainMult() { // Calculate the multiplier for main currency from bonuses
mult = new Decimal(1)
@ -208,7 +213,7 @@ addLayer("c", {
}, // Useful for if you gain secondary resources or have other interesting things happen to this layer when you reset it. You gain the currency after this function ends.
hotkeys: [
{key: "c", description: "C: reset for lollipops or whatever", onPress(){if (canReset(this.layer)) doReset(this.layer)}},
{key: "c", description: "C: reset for lollipops or whatever", onPress(){if (canReset(this.layer)) doReset(this.layer)}, unlocked() {return player.points.gte(10)}},
{key: "ctrl+c", description: "Ctrl+c: respec things", onPress(){if (player[this.layer].unlocked) respecBuyables(this.layer)}},
],
increaseUnlockOrder: [], // Array of layer names to have their order increased when this one is first unlocked

View file

@ -12,7 +12,7 @@ let modInfo = {
// Set your version in num and name
let VERSION = {
num: "2.2.3",
num: "2.2.4",
name: "Uprooted",
}
@ -63,7 +63,7 @@ function isEndgame() {
// You can change this if you have things that can be messed up by long tick lengths
function maxTickLength() {
return(3600000) // Default is 1 hour which is just arbitrarily large
return(3600) // Default is 1 hour which is just arbitrarily large
}
// Use this if you need to undo inflation from an older version. If the version is older than the version that fixed the issue,

View file

@ -206,7 +206,7 @@ function loadVue() {
Vue.component('main-display', {
props: ['layer'],
template: `
<div><span v-if="player[layer].points.lt('1e1000')">You have </span><h2 v-bind:style="{'color': tmp[layer].color, 'text-shadow': '0px 0px 10px' + tmp[layer].color}">{{formatWhole(player[layer].points)}}</h2> {{tmp[layer].resource}}<span v-if="tmp[layer].effectDescription">, {{tmp[layer].effectDescription}}</span><br><br></div>
<div><span v-if="player[layer].points.lt('1e1000')">You have </span><h2 v-bind:style="{'color': tmp[layer].color, 'text-shadow': '0px 0px 10px' + tmp[layer].color}">{{formatWhole(player[layer].points)}}</h2> {{tmp[layer].resource}}, <span v-if="tmp[layer].effectDescription" v-html="tmp[layer].effectDescription"></span><br><br></div>
`
})
@ -310,7 +310,7 @@ function loadVue() {
},
template: `
<div v-if="tmp[layer].microtabs" :style="{'border-style': 'solid'}">
<div class="upgTable">
<div class="upgTable instant">
<tab-buttons :layer="layer" :data="tmp[layer].microtabs[data]" :name="data" v-bind:style="tmp[layer].componentStyles['tab-buttons']"></tab-buttons>
</div>
<layer-tab v-if="tmp[layer].microtabs[data][player.subtabs[layer][data]].embedLayer" :layer="tmp[layer].microtabs[data][player.subtabs[layer][data]].embedLayer" ></layer-tab>

View file

@ -4,7 +4,7 @@ var gameEnded = false;
// Don't change this
const TMT_VERSION = {
tmtNum: "2.2.2",
tmtNum: "2.2.4",
tmtName: "Uprooted"
}
@ -21,7 +21,7 @@ function getResetGain(layer, useType = null) {
} else if (type=="normal"){
if (tmp[layer].baseAmount.lt(tmp[layer].requires)) return new Decimal(0)
let gain = tmp[layer].baseAmount.div(tmp[layer].requires).pow(tmp[layer].exponent).times(tmp[layer].gainMult).pow(tmp[layer].gainExp)
if (gain.gte("e1e7")) gain = gain.sqrt().times("e5e6")
if (gain.gte(tmp[layer].softcap)) gain = gain.pow(tmp[layer].softcapPower).times(tmp[layer].softcap.pow(decimalOne.sub(tmp[layer].softcapPower)))
return gain.floor().max(0);
} else if (type=="custom"){
return layers[layer].getResetGain()
@ -49,7 +49,7 @@ function getNextAt(layer, canMax=false, useType = null) {
return cost;
} else if (type=="normal"){
let next = tmp[layer].resetGain.add(1)
if (next.gte("e1e7")) next = next.div("e5e6").pow(2)
if (next.gte(tmp[layer].softcap)) next = next.div(tmp[layer].softcap.pow(decimalOne.sub(tmp[layer].softcapPower))).pow(decimalOne.div(tmp[layer].softcapPower))
next = next.root(tmp[layer].gainExp).div(tmp[layer].gainMult).root(tmp[layer].exponent).times(tmp[layer].requires).max(tmp[layer].requires)
if (tmp[layer].roundUpCost) next = next.ceil()
return next;
@ -347,7 +347,7 @@ var interval = setInterval(function() {
let now = Date.now()
let diff = (now - player.time) / 1e3
if (player.offTime !== undefined) {
if (player.offTime.remain > modInfo.offlineLimit * 3600000) player.offTime.remain = modInfo.offlineLimit * 3600000
if (player.offTime.remain > modInfo.offlineLimit * 3600) player.offTime.remain = modInfo.offlineLimit * 3600
if (player.offTime.remain > 0) {
let offlineDiff = Math.max(player.offTime.remain / 10, diff)
player.offTime.remain -= offlineDiff

View file

@ -58,7 +58,7 @@ function isEndgame() {
// You can change this if you have things that can be messed up by long tick lengths
function maxTickLength() {
return(3600000) // Default is 1 hour which is just arbitrarily large
return(3600) // Default is 1 hour which is just arbitrarily large
}
// Use this if you need to undo inflation from an older version. If the version is older than the version that fixed the issue,

View file

@ -22,7 +22,10 @@ function updateHotkeys()
if (hk){
for (id in hk){
hotkeys[hk[id].key] = hk[id]
hotkeys[hk[id].key].layer = layer
hotkeys[hk[id].key].layer = layer
hotkeys[hk[id].key].id = id
if (hk[id].unlocked === undefined)
hk[id].unlocked = true
}
}
}
@ -138,6 +141,8 @@ function updateLayers(){
if(layers[layer].gainExp === undefined) layers[layer].gainExp = new Decimal(1)
if(layers[layer].type === undefined) layers[layer].type = "none"
if(layers[layer].base === undefined || layers[layer].base <= 1) layers[layer].base = 2
if(layers[layer].softcap === undefined) layers[layer].softcap = new Decimal("e1e7")
if(layers[layer].softcapPower === undefined) layers[layer].softcapPower = new Decimal("0.5")
let row = layers[layer].row
if(!ROW_LAYERS[row]) ROW_LAYERS[row] = {}

View file

@ -135,7 +135,7 @@ var systemComponents = {
<br><br>
Time Played: {{ formatTime(player.timePlayed) }}<br><br>
<h3>Hotkeys</h3><br>
<span v-for="key in hotkeys" v-if="player[key.layer].unlocked"><br>{{key.description}}</span></div>
<span v-for="key in hotkeys" v-if="player[key.layer].unlocked && tmp[key.layer].hotkeys[key.id].unlocked"><br>{{key.description}}</span></div>
`
},

View file

@ -149,7 +149,7 @@ function getStartBuyables(layer){
let data = {}
if (layers[layer].buyables) {
for (id in layers[layer].buyables)
if (!isNaN(id))
if (isPlainObject(layers[layer].buyables[id]))
data[id] = new Decimal(0)
}
return data
@ -158,9 +158,9 @@ function getStartBuyables(layer){
function getStartClickables(layer){
let data = {}
if (layers[layer].clickables) {
for (id in layers[layer].clickables)
if (!isNaN(id))
data[id] = ""
if (isPlainObject(layers[layer].clickables[id]))
if (isPlainObject(id))
data[id] = ""
}
return data
}
@ -169,8 +169,8 @@ function getStartChallenges(layer){
let data = {}
if (layers[layer].challenges) {
for (id in layers[layer].challenges)
if (!isNaN(id))
data[id] = 0
if (isPlainObject(layers[layer].challenges[id]))
data[id] = 0
}
return data
}
@ -698,7 +698,7 @@ function updateMilestones(layer){
function updateAchievements(layer){
for (id in layers[layer].achievements){
if (!isNaN(id) && !(player[layer].achievements.includes(id)) && layers[layer].achievements[id].done()) {
if (isPlainObject(layers[layer].achievements[id]) && !(player[layer].achievements.includes(id)) && layers[layer].achievements[id].done()) {
player[layer].achievements.push(id)
if (layers[layer].achievements[id].onComplete) layers[layer].achievements[id].onComplete()
}
@ -765,5 +765,9 @@ function prestigeButtonText(layer)
function isFunction(obj) {
return !!(obj && obj.constructor && obj.call && obj.apply);
};
function isPlainObject(obj) {
return (!!obj) && (obj.constructor === Object)
}
document.title = modInfo.name