mirror of
https://github.com/Acamaeda/The-Modding-Tree.git
synced 2024-11-24 17:31:50 +00:00
Fixed hasMilestone and incr_order, static layers now show cost of next
This commit is contained in:
parent
091ff24b9f
commit
175fcfcc8c
5 changed files with 21 additions and 10 deletions
|
@ -57,6 +57,8 @@
|
|||
<li>Added upgEffect, buyableEffect, and challEffect functions.</li>
|
||||
<li>Added "hide completed challenges" setting.</li>
|
||||
<li>Moved old changelogs to a separate place.</li>
|
||||
<li>Fixed hasMilestone and incr_order.</li>
|
||||
<li>Static layers now show the currency amount needed for the next one if you can buy max.</li>
|
||||
<li></li>
|
||||
</ul><br>
|
||||
<a href="https://github.com/Acamaeda/The-Modding-Tree/blob/master/changelog.md" target="_blank" class="link" >Full history</a><br>
|
||||
|
|
12
js/game.js
12
js/game.js
|
@ -62,10 +62,12 @@ function getResetGain(layer) {
|
|||
}
|
||||
}
|
||||
|
||||
function getNextAt(layer) {
|
||||
function getNextAt(layer, disp=false) {
|
||||
if (tmp.gainExp[layer].eq(0)) return new Decimal(1/0)
|
||||
if (layers[layer].type=="static") {
|
||||
let amt = player[layer].points
|
||||
if (layers[layer].type=="static")
|
||||
{
|
||||
if (!layers[layer].canBuyMax()) disp = false
|
||||
let amt = player[layer].points.plus((disp&&tmp.layerAmt[layer].gte(tmp.nextAt[layer]))?tmp.resetGain[layer]:0)
|
||||
let extraCost = Decimal.pow(layers[layer].base, amt.pow(layers[layer].exponent).div(tmp.gainExp[layer])).times(tmp.gainMults[layer])
|
||||
let cost = extraCost.times(tmp.layerReqs[layer]).max(tmp.layerReqs[layer])
|
||||
if (layers[layer].resCeil) cost = cost.ceil()
|
||||
|
@ -98,8 +100,10 @@ function shouldNotify(layer){
|
|||
|
||||
function rowReset(row, layer) {
|
||||
for (lr in ROW_LAYERS[row]){
|
||||
if(layers[lr].doReset)
|
||||
if(layers[lr].doReset) {
|
||||
player[lr].active = null // Exit challenges on any row reset on an equal or higher row
|
||||
layers[lr].doReset(layer)
|
||||
}
|
||||
else
|
||||
if(layers[layer].row > layers[lr].row) fullLayerReset(lr)
|
||||
}
|
||||
|
|
|
@ -212,12 +212,15 @@ addLayer("f", {
|
|||
boop: false,
|
||||
}},
|
||||
color:() => "#FE0102",
|
||||
requires() {return new Decimal(200)},
|
||||
requires() {return new Decimal(10)},
|
||||
resource: "farm points",
|
||||
baseResource: "candies",
|
||||
baseAmount() {return player.points},
|
||||
type: "normal",
|
||||
type: "static",
|
||||
exponent: 0.5,
|
||||
base: 3,
|
||||
resCeil: true,
|
||||
canBuyMax:() => true,
|
||||
gainMult() {
|
||||
return new Decimal(1)
|
||||
},
|
||||
|
|
|
@ -45,7 +45,7 @@ function updateTemp() {
|
|||
if (!tmp.effectDescription) tmp.effectDescription = {}
|
||||
if (!tmp.style) tmp.style = {}
|
||||
if (!tmp.notify) tmp.notify = {}
|
||||
|
||||
if (!tmp.nextAtDisp) tmp.nextAtDisp = {}
|
||||
|
||||
for (layer in layers) {
|
||||
if (layers[layer].color) tmp.layerColor[layer] = layers[layer].color()
|
||||
|
@ -57,6 +57,7 @@ function updateTemp() {
|
|||
tmp.resetGain[layer] = getResetGain(layer)
|
||||
tmp.nextAt[layer] = getNextAt(layer)
|
||||
tmp.notify[layer] = shouldNotify(layer)
|
||||
tmp.nextAtDisp[layer] = getNextAt(layer, true)
|
||||
if (layers[layer].effectDescription) tmp.effectDescription[layer] = layers[layer].effectDescription()
|
||||
|
||||
}
|
||||
|
|
3
js/v.js
3
js/v.js
|
@ -209,9 +209,10 @@ function loadVue() {
|
|||
template: `
|
||||
<span>
|
||||
<button v-if="layers[layer].type=='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-bind:style="{'background-color': tmp.layerColor[layer]}" v-on:click="doReset(layer)"><span v-if="player[layer].points.lt(1e3)">{{data ? data() : "Reset for "}}</span>+<b>{{formatWhole(tmp.resetGain[layer])}}</b> {{layers[layer].resource}}<span v-if="tmp.resetGain[layer].lt(100) && player[layer].points.lt(1e3)"><br><br>Next at {{ (layers[layer].resCeil ? formatWhole(tmp.nextAt[layer]) : format(tmp.nextAt[layer])) }} {{ layers[layer].baseResource }}</span></button>
|
||||
<button v-if="layers[layer].type=='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-bind:style="{'background-color': tmp.layerColor[layer]}" v-on:click="doReset(layer)"><span v-if="player[layer].points.lt(10)">{{data ? data() : "Reset for "}}</span>+<b>{{formatWhole(tmp.resetGain[layer])}}</b> {{layers[layer].resource}}<br><br><span v-if="player[layer].points.lt(10)">Req: {{formatWhole(tmp.layerAmt[layer])}} / </span>{{(layers[layer].resCeil ? formatWhole(tmp.nextAt[layer]) : format(tmp.nextAt[layer]))}} {{ layers[layer].baseResource }}</button>
|
||||
<button v-if="layers[layer].type=='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-bind:style="{'background-color': tmp.layerColor[layer]}" v-on:click="doReset(layer)"><span v-if="player[layer].points.lt(10)">{{data ? data() : "Reset for "}}</span>+<b>{{formatWhole(tmp.resetGain[layer])}}</b> {{layers[layer].resource}}<br><br><span v-if="player[layer].points.lt(10)">{{(tmp.layerAmt[layer].gte(tmp.nextAt[layer])&&layers[layer].canBuyMax && layers[layer].canBuyMax())?"Next":"Req"}}: {{formatWhole(tmp.layerAmt[layer])}} / </span>{{(layers[layer].resCeil ? formatWhole(tmp.nextAtDisp[layer]) : format(tmp.nextAtDisp[layer]))}} {{ layers[layer].baseResource }}</button>
|
||||
</span>
|
||||
`
|
||||
|
||||
})
|
||||
|
||||
// Displays the main resource for the layer
|
||||
|
|
Loading…
Reference in a new issue