Making the effect
You should already have a layer, if you don't then make one. Add an effect() function to your layer. It should look like this:effect(){
},
You’ll have to return a Decimal in the effect function. If you want to make an effect like boosters in PT you do:
effect(){
return Decimal.pow(2, player[this.layer].points)
/*
you should use this.layer instead of <layerID>
Decimal.pow(num1, num2) is an easier way to do
num1.pow(num2)
*/
},
If you want +1x point gain per layer point do:
effect(){
return player[this.layer].points
// you can also add .times(multiplier) on to it
},
You can also use exponents/logarithm.
effect(){
return player[this.layer].points.max(1).pow(5).log10().max(1)
},
Implementing the effect
If you want the effect to multiply point gain then you need to add something on to getPointGen() like this:function getPointGen() {
if(!canGenPoints())return new Decimal(0)
let gain = new Decimal(1)
...
gain = gain.times(tmp.<layer>.effect)
/*
whenever you need to use an effect, use tmp not layers
this would multiply gain by the effect
but you can use any math thing
*/
return gain
}
Multiplying another layer’s gain is also simple.
gainMult(){
let mult = new Decimal(1)
...
mult = mult.times(tmp.<layer>.effect)
/*
if it's a static layer you need to divide
(replace .times with .div)
*/
return mult
}
Making the description
Everything has been implemented but the player can't see the effect. You need to add another function into the layer.effectDescription(){
},
That’s where you put what the effect does.
If you do this:
effectDescription(){
return "multiplying point gain by " + format(tmp[this.layer].effect)
/*
use format(num) whenever displaying a number
*/
},
It will display this: “You have layerAmt layerName, multiplying point gain by layerEffect”
Once you do that, you’ll have a working layer effect the player can see!