2020-10-03 19:45:47 +00:00
addLayer ( "c" , {
layer : "c" , // This is assigned automatically, both to the layer and all upgrades, etc. Shown here so you know about it
2020-09-24 15:54:41 +00:00
startData ( ) { return {
unl : true ,
points : new Decimal ( 0 ) ,
2020-09-24 23:32:34 +00:00
best : new Decimal ( 0 ) ,
total : new Decimal ( 0 ) ,
2020-10-01 00:25:14 +00:00
buyables : { } , // You don't actually have to initialize this one
2020-09-24 21:46:57 +00:00
beep : false ,
2020-09-24 15:54:41 +00:00
} } ,
2020-10-03 21:26:14 +00:00
color : ( ) => "#4BDC13" ,
2020-10-03 19:45:47 +00:00
requires : ( ) => new Decimal ( 10 ) , // Can be a function that takes requirement increases into account
2020-09-24 15:54:41 +00:00
resource : "lollipops" , // Name of prestige currency
baseResource : "candies" , // Name of resource prestige is based on
2020-10-03 19:45:47 +00:00
baseAmount ( ) { return player . points } , // Get the current amount of baseResource
2020-09-24 15:54:41 +00:00
type : "normal" , // normal: cost to gain currency depends on amount gained. static: cost depends on how much you already have
exponent : 0.5 , // Prestige currency exponent
base : 5 , // Only needed for static layers, base of the formula (b^(x^exp))
2020-10-03 19:45:47 +00:00
resCeil : false , // True if the cost needs to be rounded up (use when baseResource is static?)
canBuyMax ( ) { } , // Only needed for static layers with buy max
gainMult ( ) { // Calculate the multiplier for main currency from bonuses
2020-09-24 15:54:41 +00:00
mult = new Decimal ( 1 )
2020-10-04 15:28:52 +00:00
if ( hasUpg ( this . layer , 166 ) ) mult = mult . times ( 2 ) // These upgrades don't exist
if ( hasUpg ( this . layer , 120 ) ) mult = mult . times ( this . upgrades [ 12 ] . effect ( ) )
2020-09-24 15:54:41 +00:00
return mult
} ,
2020-10-03 19:45:47 +00:00
gainExp ( ) { // Calculate the exponent on main currency from bonuses
2020-09-24 15:54:41 +00:00
return new Decimal ( 1 )
} ,
2020-10-03 19:45:47 +00:00
row : 0 , // Row the layer is in on the tree (0 is the first row)
effect ( ) {
return { // Formulas for any boosts inherent to resources in the layer. Can return a single value instead of an object if there is just one effect
waffleBoost : ( true == false ? 0 : Decimal . pow ( player [ this . layer ] . points , 0.2 ) ) ,
icecreamCap : ( player [ this . layer ] . points * 10 )
2020-09-24 15:54:41 +00:00
} } ,
2020-10-03 19:45:47 +00:00
effectDescription ( ) { // Optional text to describe the effects
eff = this . effect ;
2020-09-24 15:54:41 +00:00
return "which are boosting waffles by " + format ( eff . waffleBoost ) + " and increasing the Ice Cream cap by " + format ( eff . icecreamCap )
} ,
2020-09-24 21:46:57 +00:00
milestones : {
2020-10-03 19:45:47 +00:00
0 : { requirementDesc : ( ) => "3 Lollipops" ,
done ( ) { return player [ this . layer ] . best . gte ( 3 ) } , // Used to determine when to give the milestone
effectDesc : ( ) => "Makes this green" ,
2020-09-24 21:46:57 +00:00
} ,
2020-10-03 19:45:47 +00:00
1 : { requirementDesc : ( ) => "4 Lollipops" ,
done ( ) { return player [ this . layer ] . best . gte ( 4 ) } ,
effectDesc : ( ) => "You can toggle beep and boop (which do nothing)" ,
2020-09-24 21:46:57 +00:00
toggles : [
2020-10-03 20:47:56 +00:00
[ "c" , "beep" ] , // Each toggle is defined by a layer and the data toggled for that layer
2020-09-24 21:46:57 +00:00
[ "f" , "boop" ] ] ,
}
} ,
2020-10-03 19:45:47 +00:00
challs : {
rows : 1 ,
cols : 1 ,
11 : {
name : ( ) => "Fun" ,
desc : ( ) => "Makes the game 0% harder" ,
unl ( ) { return player [ this . layer ] . best . gt ( 0 ) } ,
goal : ( ) => new Decimal ( "20" ) ,
currencyDisplayName : "lollipops" , // Use if using a nonstandard currency
currencyInternalName : "points" , // Use if using a nonstandard currency
currencyLayer : this . layer , // Leave empty if not in a layer
effect ( ) {
let ret = player [ this . layer ] . points . add ( 1 ) . tetrate ( 0.02 )
return ret ;
} ,
effectDisplay ( x ) { return format ( x ) + "x" } ,
countsAs : [ 12 , 21 ] , // Use this for if a challenge includes the effects of other challenges. Being in this challenge "counts as" being in these.
reward : ( ) => "Says hi" ,
onComplete ( ) { console . log ( "hiii" ) } // Called when you complete the challenge
} ,
} ,
2020-09-24 15:54:41 +00:00
upgrades : {
rows : 1 ,
cols : 3 ,
11 : {
2020-10-03 19:45:47 +00:00
title : ( ) => "Generator of Genericness" ,
desc : ( ) => "Gain 1 Point every second." ,
cost : ( ) => new Decimal ( 1 ) ,
unl ( ) { return player [ this . layer ] . unl } , // The upgrade is only visible when this is true
2020-09-24 15:54:41 +00:00
} ,
12 : {
2020-10-03 19:45:47 +00:00
desc : ( ) => "Candy generation is faster based on your unspent Lollipops." ,
cost : ( ) => new Decimal ( 1 ) ,
2020-10-04 15:23:38 +00:00
unl ( ) { return ( hasUpg ( this . layer , 11 ) ) } ,
2020-10-03 19:45:47 +00:00
effect ( ) { // Calculate bonuses from the upgrade. Can return a single value or an object with multiple values
let ret = player [ this . layer ] . points . add ( 1 ) . pow ( player [ this . layer ] . upgrades . includes ( 24 ) ? 1.1 : ( player [ this . layer ] . upgrades . includes ( 14 ) ? 0.75 : 0.5 ) )
2020-09-24 15:54:41 +00:00
if ( ret . gte ( "1e20000000" ) ) ret = ret . sqrt ( ) . times ( "1e10000000" )
return ret ;
} ,
2020-10-03 19:45:47 +00:00
effectDisplay ( fx ) { return format ( fx ) + "x" } , // Add formatting to the effect
2020-09-24 15:54:41 +00:00
} ,
13 : {
2020-10-03 19:45:47 +00:00
desc : ( ) => "Make this layer act like you bought it first." ,
cost : ( ) => new Decimal ( 69 ) ,
2020-09-24 15:54:41 +00:00
currencyDisplayName : "candies" , // Use if using a nonstandard currency
currencyInternalName : "points" , // Use if using a nonstandard currency
currencyLayer : "" , // Leave empty if not in a layer "e.g. points"
2020-10-04 15:23:38 +00:00
unl ( ) { return ( hasUpg ( this . layer , 12 ) ) } ,
2020-10-03 19:45:47 +00:00
onPurchase ( ) { // This function triggers when the upgrade is purchased
player [ this . layer ] . order = 0
2020-09-24 15:54:41 +00:00
}
} ,
} ,
2020-10-01 00:25:14 +00:00
buyables : {
rows : 1 ,
cols : 1 ,
respec ( ) { // Optional, reset things and give back your currency. Having this function makes a respec button appear
2020-10-03 19:45:47 +00:00
player [ this . layer ] . points = player [ this . layer ] . points . add ( player [ this . layer ] . spentOnBuyables ) // A built-in thing to keep track of this but only keeps a single value
resetBuyables ( this . layer )
doReset ( this . layer , true ) // Force a reset
2020-10-01 00:25:14 +00:00
} ,
2020-10-03 19:45:47 +00:00
respecText : ( ) => "Respec Thingies" , // Text on Respec button, optional
2020-10-01 00:25:14 +00:00
11 : {
2020-10-03 19:45:47 +00:00
title : ( ) => "Exhancers" , // Optional, displayed at the top in a larger font
2020-10-01 00:25:14 +00:00
cost ( x ) { // cost for buying xth buyable, can be an object if there are multiple currencies
if ( x . gte ( 25 ) ) x = x . pow ( 2 ) . div ( 25 )
let cost = Decimal . pow ( 2 , x . pow ( 1.5 ) )
return cost . floor ( )
} ,
2020-10-01 05:30:59 +00:00
effect ( x ) { // Effects of owning x of the items, x is a decimal
2020-10-01 00:25:14 +00:00
let eff = { }
if ( x . gte ( 0 ) ) eff . first = Decimal . pow ( 25 , x . pow ( 1.1 ) )
else eff . first = Decimal . pow ( 1 / 25 , x . times ( - 1 ) . pow ( 1.1 ) )
if ( x . gte ( 0 ) ) eff . second = x . pow ( 0.8 )
else eff . second = x . times ( - 1 ) . pow ( 0.8 ) . times ( - 1 )
return eff ;
} ,
2020-10-03 19:45:47 +00:00
display ( ) { // Everything else displayed in the buyable button after the title
2020-10-03 20:47:56 +00:00
let data = tmp . buyables [ this . layer ] [ this . id ]
2020-10-01 00:25:14 +00:00
return "Cost: " + format ( data . cost ) + " lollipops \ n \
2020-10-03 20:47:56 +00:00
Amount : " + player[this.layer].buyables[this.id] + " \ n \
2020-10-03 19:45:47 +00:00
Adds + " + format(data.effect.first) + " things and multiplies stuff by " + format ( data . effect . second )
2020-10-01 00:25:14 +00:00
} ,
2020-10-03 19:45:47 +00:00
unl ( ) { return player [ this . layer ] . unl } ,
canAfford ( ) {
2020-10-03 20:47:56 +00:00
return player [ this . layer ] . points . gte ( tmp . buyables [ this . layer ] [ this . id ] . cost ) } ,
2020-10-03 19:45:47 +00:00
buy ( ) {
2020-10-03 20:47:56 +00:00
cost = tmp . buyables [ this . layer ] [ this . id ] . cost
2020-10-03 19:45:47 +00:00
player [ this . layer ] . points = player [ this . layer ] . points . sub ( cost )
2020-10-03 20:47:56 +00:00
player [ this . layer ] . buyables [ this . id ] = player [ this . layer ] . buyables [ this . id ] . add ( 1 )
2020-10-03 19:45:47 +00:00
player [ this . layer ] . spentOnBuyables = player [ this . layer ] . spentOnBuyables . add ( cost ) // This is a built-in system that you can use for respeccing but it only works with a single Decimal value
2020-10-01 00:25:14 +00:00
} ,
buyMax ( ) { } , // You'll have to handle this yourself if you want
} ,
} ,
2020-10-03 19:45:47 +00:00
doReset ( resettingLayer ) { // Triggers when this layer is being reset, along with the layer doing the resetting. Not triggered by lower layers resetting, but is by layers on the same row.
if ( layers [ resettingLayer ] . row > this . row ) fullLayerReset ( this . layer ) // This is actually the default behavior
2020-09-24 21:46:57 +00:00
} ,
2020-09-24 15:54:41 +00:00
convertToDecimal ( ) {
2020-10-03 19:45:47 +00:00
// Convert any layer-specific Decimal values (besides points, total, and best) from String to Decimal (used when loading save)
2020-09-24 15:54:41 +00:00
} ,
2020-10-03 19:45:47 +00:00
layerShown ( ) { return true } , // Condition for when layer appears on the tree
2020-09-24 15:54:41 +00:00
update ( diff ) {
2020-10-03 19:45:47 +00:00
if ( player [ this . layer ] . upgrades . includes ( 11 ) ) player . points = player . points . add ( tmp . pointGen . times ( diff ) ) . max ( 0 )
2020-09-24 15:54:41 +00:00
} , // Do any gameloop things (e.g. resource generation) inherent to this layer
automate ( ) {
} , // Do any automation inherent to this layer if appropriate
updateTemp ( ) {
2020-10-03 19:45:47 +00:00
} , // Do any necessary temp updating, not that important usually
2020-09-24 15:54:41 +00:00
resetsNothing ( ) { return false } ,
2020-10-03 19:45:47 +00:00
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.
2020-10-01 01:30:50 +00:00
hotkeys : [
2020-10-03 21:26:14 +00:00
{ key : "c" , desc : "C: reset for lollipops or whatever" , onPress ( ) { if ( player [ this . layer ] . unl ) doReset ( this . layer ) } } ,
{ key : "ctrl+c" + this . layer , desc : "Ctrl+c: respec things" , onPress ( ) { if ( player [ this . layer ] . unl ) respecBuyables ( this . layer ) } } ,
2020-10-01 01:30:50 +00:00
] ,
2020-09-24 15:54:41 +00:00
incr _order : [ ] , // Array of layer names to have their order increased when this one is first unlocked
2020-10-01 01:30:50 +00:00
2020-09-28 01:00:10 +00:00
// Optional, lets you format the tab yourself by listing components. You can create your own components in v.js.
2020-09-29 22:35:43 +00:00
tabFormat : [ "main-display" ,
2020-10-03 19:45:47 +00:00
[ "prestige-button" , function ( ) { return "Melt your points into " } ] ,
2020-10-03 23:50:03 +00:00
[ "blank" , "5px" ] , // Height
2020-09-29 22:35:43 +00:00
[ "raw-html" , function ( ) { return "<button onclick='console.log(`yeet`)'>'HI'</button>" } ] ,
[ "display-text" ,
function ( ) { return 'I have ' + format ( player . points ) + ' pointy points!' } ,
{ "color" : "red" , "font-size" : "32px" , "font-family" : "Comic Sans MS" } ] ,
2020-10-01 00:25:14 +00:00
[ "buyables" , "150px" ] ,
2020-10-03 23:50:03 +00:00
[ "row" , [
[ "toggle" , [ "c" , "beep" ] ] , [ "blank" , [ "30px" , "10px" ] ] , // Width, height
[ "display-text" , function ( ) { return "Beep" } ] , "blank" ,
[ "column" , [
[ "prestige-button" , function ( ) { return "Be redundant for " } , { 'width' : '150px' , 'height' : '30px' } ] ,
[ "prestige-button" , function ( ) { return "Be redundant for " } , { 'width' : '150px' , 'height' : '30px' } ] ,
] ] ,
] ] ,
"milestones" , "blank" , "upgrades" , "challs" ] ,
2020-10-03 19:45:47 +00:00
style ( ) { return {
2020-10-03 21:26:14 +00:00
'background-color' : '#3325CC'
2020-10-03 19:45:47 +00:00
} } ,
2020-10-04 15:23:38 +00:00
shouldNotify ( ) { // Optional, layer will be highlighted on the tree if true.
// Layer will automatically highlight if an upgrade is purchasable.
return ( player . c . buyables [ 11 ] == 1 )
}
2020-10-03 19:45:47 +00:00
} )
2020-09-24 21:46:57 +00:00
2020-10-03 19:45:47 +00:00
addLayer ( "f" , {
2020-09-24 15:54:41 +00:00
startData ( ) { return {
unl : false ,
points : new Decimal ( 0 ) ,
2020-09-24 21:46:57 +00:00
boop : false ,
2020-09-24 15:54:41 +00:00
} } ,
2020-10-03 19:45:47 +00:00
color : ( ) => "#FE0102" ,
2020-09-24 21:46:57 +00:00
requires ( ) { return new Decimal ( 200 ) } ,
2020-09-24 22:42:52 +00:00
resource : "farm points" ,
baseResource : "candies" ,
2020-09-24 15:54:41 +00:00
baseAmount ( ) { return player . points } ,
2020-09-24 21:46:57 +00:00
type : "normal" ,
exponent : 0.5 ,
2020-09-24 15:54:41 +00:00
gainMult ( ) {
2020-09-24 21:46:57 +00:00
return new Decimal ( 1 )
2020-09-24 15:54:41 +00:00
} ,
gainExp ( ) {
return new Decimal ( 1 )
} ,
row : 1 ,
2020-09-24 21:46:57 +00:00
layerShown ( ) { return true } ,
2020-09-24 15:54:41 +00:00
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
} ,
2020-10-03 19:45:47 +00:00
)
2020-09-24 15:54:41 +00:00