mirror of
https://github.com/Acamaeda/The-Modding-Tree.git
synced 2025-02-16 09:41:41 +00:00
Added onPrestige, now displays layer currency effects, other fixes.
This commit is contained in:
parent
84a8f85c33
commit
4ac7199547
5 changed files with 17 additions and 11 deletions
|
@ -124,7 +124,7 @@
|
|||
<div v-for="layer in LAYERS">
|
||||
<div v-if="player.tab==layer" class="col right">
|
||||
<button class="back" onclick="showTab('tree')">←</button><br><br><br>
|
||||
<span v-if="player[layer].points.lt('1e1000')">You have </span><h2 v-bind:style="{'color': layers[layer].color, 'text-shadow': '0px 0px 10px' + layers[layer].color}">{{formatWhole(player[layer].points)}}</h2> {{layers[layer].resource}}<span v-if="layers[layer].effects != undefined">, {{layers[layer].effectDescription()}}</span>
|
||||
<span v-if="player[layer].points.lt('1e1000')">You have </span><h2 v-bind:style="{'color': layers[layer].color, 'text-shadow': '0px 0px 10px' + layers[layer].color}">{{formatWhole(player[layer].points)}}</h2> {{layers[layer].resource}}<span v-if="layers[layer].effectDescription">, {{layers[layer].effectDescription()}}</span>
|
||||
<br><br>
|
||||
<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': layers[layer].color}" v-on:click="doReset(layer)"><span v-if="player[layer].points.lt(1e3)">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': layers[layer].color}" v-on:click="doReset(layer)"><span v-if="player[layer].points.lt(10)">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>
|
||||
|
|
11
js/game.js
11
js/game.js
|
@ -284,9 +284,14 @@ function doReset(layer, force=false) {
|
|||
let gain = tmp.resetGain[layer]
|
||||
if (layers[layer].type=="static") {
|
||||
if (tmp.layerAmt[layer].lt(tmp.nextAt[layer])) return;
|
||||
addPoints(layer, canBuyMax(layer) ? gain : 1)
|
||||
} else addPoints(layer, gain)
|
||||
|
||||
gain =(canBuyMax(layer) ? gain : 1)
|
||||
}
|
||||
|
||||
if (layers[layer].onPrestige)
|
||||
layers[layer].onPrestige(gain)
|
||||
|
||||
addPoints(layer, gain)
|
||||
|
||||
if (!player[layer].unl) {
|
||||
player[layer].unl = true;
|
||||
needCanvasUpdate = true;
|
||||
|
|
|
@ -33,7 +33,7 @@ var layers = {
|
|||
icecreamCap: (player.c.points * 10)
|
||||
}},
|
||||
effectDescription() {
|
||||
eff = layer.c.effect();
|
||||
eff = layers.c.effect();
|
||||
return "which are boosting waffles by "+format(eff.waffleBoost)+" and increasing the Ice Cream cap by "+format(eff.icecreamCap)
|
||||
},
|
||||
milestones: {
|
||||
|
@ -107,8 +107,8 @@ var layers = {
|
|||
}},
|
||||
color: "#FE0102",
|
||||
requires() {return new Decimal(200)},
|
||||
resource: "things",
|
||||
baseResource: "points",
|
||||
resource: "farm points",
|
||||
baseResource: "candies",
|
||||
baseAmount() {return player.points},
|
||||
type: "normal",
|
||||
exponent: 0.5,
|
||||
|
@ -120,7 +120,6 @@ var layers = {
|
|||
return new Decimal(1)
|
||||
},
|
||||
row: 1,
|
||||
effect() {return},
|
||||
layerShown() {return true},
|
||||
resetsNothing() {return false},
|
||||
branches: [["c", 1]] // Each pair corresponds to a line added to the tree when this node is unlocked. The letter is the other end of the line, and the number affects the color, 1 is default
|
||||
|
|
|
@ -10,7 +10,7 @@ function updateTemp() {
|
|||
|
||||
|
||||
if (!tmp.layerEffs) tmp.layerEffs = {}
|
||||
for (layer in layers) tmp.layerEffs[layer] = layers[layer].effect()
|
||||
for (layer in layers) if (layers[layer].effect) tmp.layerEffs[layer] = layers[layer].effect()
|
||||
|
||||
if (!tmp.layerReqs) tmp.layerReqs = {}
|
||||
for (layer in layers) tmp.layerReqs[layer] = layers[layer].requires()
|
||||
|
|
|
@ -34,7 +34,7 @@ var layers = {
|
|||
icecreamCap: (player.c.points * 10)
|
||||
}},
|
||||
effectDescription() {
|
||||
eff = layer.c.effect();
|
||||
eff = layers.c.effect();
|
||||
return "which are boosting waffles by "+format(eff.waffleBoost)+" and increasing the Ice Cream cap by "+format(eff.icecreamCap)
|
||||
},
|
||||
doReset(layer){
|
||||
|
@ -112,6 +112,9 @@ var layers = {
|
|||
automate() {}, // Do any automation inherent to this layer if appropriate
|
||||
updateTemp() {}, // Do any necessary temp updating
|
||||
resetsNothing() {return false},
|
||||
onPrestige(gain) {
|
||||
return
|
||||
}, // 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.
|
||||
incr_order: [], // Array of layer names to have their order increased when this one is first unlocked
|
||||
branches: [] // Each pair corresponds to a line added to the tree when this node is unlocked. The letter is the other end of the line, and the number affects the color, 1 is default
|
||||
},
|
||||
|
@ -137,7 +140,6 @@ var layers = {
|
|||
return new Decimal(1)
|
||||
},
|
||||
row: 1,
|
||||
effect() {return},
|
||||
layerShown() {return true}, // Condition for when layer appears
|
||||
resetsNothing() {return false},
|
||||
branches: [["c", 1]] // Each pair corresponds to a line added to the tree when this node is unlocked. The letter is the other end of the line, and the number affects the color, 1 is default
|
||||
|
|
Loading…
Add table
Reference in a new issue