mirror of
https://github.com/Acamaeda/The-Modding-Tree.git
synced 2025-05-11 12:31:08 +00:00
2.3.1
This commit is contained in:
parent
139e10efa4
commit
c885114791
17 changed files with 46 additions and 3799 deletions
|
@ -195,7 +195,7 @@ addLayer("c", {
|
|||
let amount = getBuyableAmount(this.layer, this.id)
|
||||
if (amount.lte(0)) return // Only sell one if there is at least one
|
||||
setBuyableAmount(this.layer, this.id, amount.sub(1))
|
||||
player[this.layer].points = player[this.layer].points.add(this.cost())
|
||||
player[this.layer].points = player[this.layer].points.add(this.cost)
|
||||
},
|
||||
},
|
||||
},
|
||||
|
|
|
@ -11,7 +11,7 @@ let modInfo = {
|
|||
|
||||
// Set your version in num and name
|
||||
let VERSION = {
|
||||
num: "2.3",
|
||||
num: "2.3.1",
|
||||
name: "Cooler and Newer Edition",
|
||||
}
|
||||
|
||||
|
|
|
@ -25,7 +25,8 @@ addNode("g", {
|
|||
canClick() {return player.points.gte(10)},
|
||||
tooltip: "Thanos your points",
|
||||
tooltipLocked: "Thanos your points",
|
||||
onClick() {player.points = player.points.div(2)}
|
||||
onClick() {player.points = player.points.div(2)
|
||||
console.log(this.layer)}
|
||||
|
||||
},
|
||||
)
|
||||
|
|
|
@ -311,7 +311,8 @@ function loadVue() {
|
|||
Vue.component('master-button', {
|
||||
props: ['layer', 'data'],
|
||||
template: `
|
||||
<button v-if="tmp[layer].clickables && tmp[layer].clickables.masterButtonPress && !(tmp[layer].clickables.showMasterButton !== undefined && tmp[layer].clickables.showMasterButton == false)" v-on:click="tmp[layer].clickables.masterButtonPress()" v-bind:class="{ longUpg: true, can: player[layer].unlocked, locked: !player[layer].unlocked }">{{tmp[layer].clickables.masterButtonText ? tmp[layer].clickables.masterButtonText : "Click me!"}}</button>
|
||||
<button v-if="tmp[layer].clickables && tmp[layer].clickables.masterButtonPress && !(tmp[layer].clickables.showMasterButton !== undefined && tmp[layer].clickables.showMasterButton == false)"
|
||||
v-on:click="run(tmp[layer].clickables.masterButtonPress, tmp[layer].clickables)" v-bind:class="{ longUpg: true, can: player[layer].unlocked, locked: !player[layer].unlocked }">{{tmp[layer].clickables.masterButtonText ? tmp[layer].clickables.masterButtonText : "Click me!"}}</button>
|
||||
`
|
||||
})
|
||||
|
||||
|
@ -401,13 +402,15 @@ function loadVue() {
|
|||
Vue.component('sell-one', {
|
||||
props: ['layer', 'data'],
|
||||
template: `
|
||||
<button v-if="tmp[layer].buyables && tmp[layer].buyables[data].sellOne && !(tmp[layer].buyables[data].canSellOne !== undefined && tmp[layer].buyables[data].canSellOne == false)" v-on:click="tmp[layer].buyables[data].sellOne()" v-bind:class="{ longUpg: true, can: player[layer].unlocked, locked: !player[layer].unlocked }">{{tmp[layer].buyables.sellOneText ? tmp[layer].buyables.sellOneText : "Sell One"}}</button>
|
||||
<button v-if="tmp[layer].buyables && tmp[layer].buyables[data].sellOne && !(tmp[layer].buyables[data].canSellOne !== undefined && tmp[layer].buyables[data].canSellOne == false)" v-on:click="run(tmp[layer].buyables[data].sellOne, tmp[layer].buyables[data])"
|
||||
v-bind:class="{ longUpg: true, can: player[layer].unlocked, locked: !player[layer].unlocked }">{{tmp[layer].buyables.sellOneText ? tmp[layer].buyables.sellOneText : "Sell One"}}</button>
|
||||
`
|
||||
})
|
||||
Vue.component('sell-all', {
|
||||
props: ['layer', 'data'],
|
||||
template: `
|
||||
<button v-if="tmp[layer].buyables && tmp[layer].buyables[data].sellAll && !(tmp[layer].buyables[data].canSellAll !== undefined && tmp[layer].buyables[data].canSellAll == false)" v-on:click="tmp[layer].buyables[data].sellAll()" v-bind:class="{ longUpg: true, can: player[layer].unlocked, locked: !player[layer].unlocked }">{{tmp[layer].buyables.sellAllText ? tmp[layer].buyables.sellAllText : "Sell All"}}</button>
|
||||
<button v-if="tmp[layer].buyables && tmp[layer].buyables[data].sellAll && !(tmp[layer].buyables[data].canSellAll !== undefined && tmp[layer].buyables[data].canSellAll == false)" v-on:click="run(tmp[layer].buyables[data].sellAll, tmp[layer].buyables[data])"
|
||||
v-bind:class="{ longUpg: true, can: player[layer].unlocked, locked: !player[layer].unlocked }">{{tmp[layer].buyables.sellAllText ? tmp[layer].buyables.sellAllText : "Sell All"}}</button>
|
||||
`
|
||||
})
|
||||
|
||||
|
|
16
js/game.js
16
js/game.js
|
@ -4,8 +4,8 @@ var gameEnded = false;
|
|||
|
||||
// Don't change this
|
||||
const TMT_VERSION = {
|
||||
tmtNum: "2.3",
|
||||
tmtName: "Cooler and Newer"
|
||||
tmtNum: "2.3.1",
|
||||
tmtName: "Cooler and Newer Edition"
|
||||
}
|
||||
|
||||
function getResetGain(layer, useType = null) {
|
||||
|
@ -86,7 +86,7 @@ function shouldNotify(layer){
|
|||
}
|
||||
|
||||
function canReset(layer)
|
||||
{
|
||||
{
|
||||
if(tmp[layer].type == "normal")
|
||||
return tmp[layer].baseAmount.gte(tmp[layer].requires)
|
||||
else if(tmp[layer].type== "static")
|
||||
|
@ -94,7 +94,7 @@ function canReset(layer)
|
|||
if(tmp[layer].type == "none")
|
||||
return false
|
||||
else
|
||||
return layers[layer].canReset()
|
||||
return run(layers[layer].canReset, tmp[layer])
|
||||
}
|
||||
|
||||
function rowReset(row, layer) {
|
||||
|
@ -102,7 +102,7 @@ function rowReset(row, layer) {
|
|||
if(layers[lr].doReset) {
|
||||
|
||||
player[lr].activeChallenge = null // Exit challenges on any row reset on an equal or higher row
|
||||
layers[lr].doReset(layer)
|
||||
run(layers[lr].doReset, tmp[lr], layer)
|
||||
}
|
||||
else
|
||||
if(tmp[layer].row > tmp[lr].row && row !== "side" && !isNaN(row)) layerDataReset(lr)
|
||||
|
@ -164,7 +164,7 @@ function doReset(layer, force=false) {
|
|||
}
|
||||
|
||||
if (layers[layer].onPrestige)
|
||||
layers[layer].onPrestige(gain)
|
||||
run(layers[layer].onPrestige, tmp[layer], gain)
|
||||
|
||||
addPoints(layer, gain)
|
||||
updateMilestones(layer)
|
||||
|
@ -246,7 +246,7 @@ function canCompleteChallenge(layer, x)
|
|||
}
|
||||
else if (challenge.currencyLayer){
|
||||
let lr = challenge.currencyLayer
|
||||
return !(player[lr][name].lt(readData(challenge.goal)))
|
||||
return !(player[lr][name].lt(challenge.goal))
|
||||
}
|
||||
else {
|
||||
return !(player[name].lt(challenge.goal))
|
||||
|
@ -268,7 +268,7 @@ function completeChallenge(layer, x) {
|
|||
if (player[layer].challenges[x] < tmp[layer].challenges[x].completionLimit) {
|
||||
needCanvasUpdate = true
|
||||
player[layer].challenges[x] += 1
|
||||
if (layers[layer].challenges[x].onComplete) layers[layer].challenges[x].onComplete()
|
||||
if (layers[layer].challenges[x].onComplete) run(layers[layer].challenges[x].onComplete, tmp[layer].challenges[x])
|
||||
}
|
||||
player[layer].activeChallenge = null
|
||||
updateChallengeTemp(layer)
|
||||
|
|
|
@ -17,7 +17,7 @@ var systemComponents = {
|
|||
v-bind:id="layer"
|
||||
v-on:click="function() {
|
||||
if(tmp[layer].isLayer) {showTab(layer)}
|
||||
else {layers[layer].onClick()}
|
||||
else {run(layers[layer].onClick, tmp[layer])}
|
||||
}"
|
||||
|
||||
v-bind:tooltip="(tmp[layer].tooltip == '') ? false : (tmp[layer].isLayer) ? (
|
||||
|
@ -44,7 +44,7 @@ var systemComponents = {
|
|||
v-bind:style="[(tmp[layer].isLayer && layerunlocked(layer)) || (!tmp[layer].isLayer && tmp[layer].canClick) ? {
|
||||
'background-color': tmp[layer].color,
|
||||
} : {}, tmp[layer].nodeStyle]">
|
||||
{{abb}}
|
||||
{{(abb !== '' ? abb : ' ')}}
|
||||
</button>
|
||||
`
|
||||
},
|
||||
|
|
21
js/utils.js
21
js/utils.js
|
@ -454,7 +454,7 @@ function respecBuyables(layer) {
|
|||
if (!layers[layer].buyables) return
|
||||
if (!layers[layer].buyables.respec) return
|
||||
if (!confirm("Are you sure you want to respec? This will force you to do a \"" + (tmp[layer].name ? tmp[layer].name : layer) + "\" reset as well!")) return
|
||||
layers[layer].buyables.respec()
|
||||
run(layers[layer].buyables.respec, tmp[layer].buyables)
|
||||
updateBuyableTemp(layer)
|
||||
document.activeElement.blur()
|
||||
}
|
||||
|
@ -559,7 +559,7 @@ function buyUpg(layer, id) {
|
|||
if (upg.canAfford === false) return
|
||||
let pay = layers[layer].upgrades[id].pay
|
||||
if (pay !== undefined)
|
||||
pay()
|
||||
run(pay, upg)
|
||||
else
|
||||
{
|
||||
let cost = tmp[layer].upgrades[id].cost
|
||||
|
@ -587,7 +587,7 @@ function buyUpg(layer, id) {
|
|||
}
|
||||
player[layer].upgrades.push(id);
|
||||
if (upg.onPurchase != undefined)
|
||||
upg.onPurchase()
|
||||
run(upg.onPurchase, upg)
|
||||
}
|
||||
|
||||
function buyMaxBuyable(layer, id) {
|
||||
|
@ -596,7 +596,7 @@ function buyMaxBuyable(layer, id) {
|
|||
if (!tmp[layer].buyables[id].canAfford) return
|
||||
if (!layers[layer].buyables[id].buyMax) return
|
||||
|
||||
layers[layer].buyables[id].buyMax()
|
||||
run(layers[layer].buyables[id].buyMax, tmp[layer].buyables[id])
|
||||
updateBuyableTemp(layer)
|
||||
}
|
||||
|
||||
|
@ -605,7 +605,7 @@ function buyBuyable(layer, id) {
|
|||
if (!tmp[layer].buyables[id].unlocked) return
|
||||
if (!tmp[layer].buyables[id].canAfford) return
|
||||
|
||||
layers[layer].buyables[id].buy()
|
||||
run(layers[layer].buyables[id].buy, tmp[layer].buyables[id])
|
||||
updateBuyableTemp(layer)
|
||||
}
|
||||
|
||||
|
@ -614,7 +614,7 @@ function clickClickable(layer, id) {
|
|||
if (!tmp[layer].clickables[id].unlocked) return
|
||||
if (!tmp[layer].clickables[id].canClick) return
|
||||
|
||||
layers[layer].clickables[id].onClick()
|
||||
run(layers[layer].clickables[id].onClick, tmp[layer].clickables[id])
|
||||
updateClickableTemp(layer)
|
||||
}
|
||||
|
||||
|
@ -848,4 +848,13 @@ function adjustPopupTime(diff) {
|
|||
activePopups.splice(popup,1); // Remove popup when time hits 0
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function run(func, target, args=null){
|
||||
if (!!(func && func.constructor && func.call && func.apply)){
|
||||
let bound = func.bind(target)
|
||||
return bound(args)
|
||||
}
|
||||
else
|
||||
return func;
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue