Skip to content

Commit

Permalink
Rewrite 0.1
Browse files Browse the repository at this point in the history
Somewhat improve crafting UI
Made levels cheaper
  • Loading branch information
medsal15 committed Jul 21, 2024
1 parent 46ef332 commit 3880018
Show file tree
Hide file tree
Showing 18 changed files with 2,350 additions and 130 deletions.
6 changes: 3 additions & 3 deletions docs/custom-tab-layouts.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,15 +45,15 @@ These are the existing components, but you can create more in [components.js](/j

- prestige-button: The button to reset for a currency in this layer.

- text-input: A text input box. The argument is the name of the variable in player[layer] that the input is for, player[layer][argument]
- text-input: A text input box. The argument is the name of the variable in `player[layer]` that the input is for, `player[layer][argument]`
(Works with strings, numbers, and Decimals!)

- slider: Lets the user input a value with a slider. The argument a 3-element array: [name, min, max].
The name is the name of the variable in player[layer] that the input is for, and min and max are the limits of the slider.
The name is the name of the variable in `player[layer]` that the input is for, and min and max are the limits of the slider.
(Does not work for Decimal values)

- drop-down: Lets the user input a value with a dropdown menu. The argument a 2-element array: [name, options].
The name is the name of the variable in player[layer] that the input is for, and options is an array of strings for options you can use.
The name is the name of the variable in `player[layer]` that the input is for, and options is an array of strings for options you can use.

- drop-down-double: Same as `drop-down`, but each option is also an array with the first entry being the value and the second being the display.

Expand Down
21 changes: 11 additions & 10 deletions docs/layer-features.md
Original file line number Diff line number Diff line change
Expand Up @@ -86,10 +86,10 @@ You can make almost any value dynamic by using a function in its place, includin
- type: **optional**. Determines which prestige formula you use. Defaults to "none".
- "normal": The amount of currency you gain is independent of its current amount (like Prestige). The formula before bonuses is based on `baseResource^exponent`
- "static": The cost is dependent on your total after reset. The formula before bonuses is based on `base^(x^exponent)`
- "custom": You can define everything, from the calculations to the text on the button, yourself. (See more at the bottom)
- "none": This layer does not prestige, and therefore does not need any of the other features in this section.
- "normal": The amount of currency you gain is independent of its current amount (like Prestige). The formula before bonuses is based on `baseResource^exponent`
- "static": The cost is dependent on your total after reset. The formula before bonuses is based on `base^(x^exponent)`
- "custom": You can define everything, from the calculations to the text on the button, yourself. (See more at the bottom)
- "none": This layer does not prestige, and therefore does not need any of the other features in this section.
- baseResource: The name of the resource that determines how much of the main currency you gain on reset.
Expand Down Expand Up @@ -147,14 +147,14 @@ You can make almost any value dynamic by using a function in its place, includin
## Other features

- doReset(resettingLayer): **optional**. Is triggered when a layer on a row greater than or equal to this one does a reset. The default behavior is to reset everything on the row, but only if it was triggered by a layer in a higher row. `doReset` is always called for side layers, but for these the default behavior is to reset nothing.

If you want to keep things, determine what to keep based on `resettingLayer`, `milestones`, and such, then call `layerDataReset(layer, keep)`, where `layer` is this layer, and `keep` is an array of the names of things to keep. It can include things like "points", "best", "total" (for this layer's prestige currency), "upgrades", any unique variables like "generatorPower", etc. If you want to only keep specific upgrades or something like that, save them in a separate variable, then call `layerDataReset`, and then set `player[this.layer].upgrades` to the saved upgrades.
- update(diff): **optional**. This function is called every game tick. Use it for any passive resource production or time-based things. `diff` is the time since the last tick.
- update(diff): **optional**. This function is called every game tick. Use it for any passive resource production or time-based things. `diff` is the time since the last tick.
- autoUpgrade: **optional**, a boolean value, if true, the game will attempt to buy this layer's upgrades every tick. Defaults to false.

- automate(): **optional**. This function is called every game tick, after production. Use it to activate automation things that aren't otherwise supported.
- automate(): **optional**. This function is called every game tick, after production. Use it to activate automation things that aren't otherwise supported.

- resetsNothing: **optional**. Returns true if this layer shouldn't trigger any resets when you prestige.

Expand All @@ -175,11 +175,12 @@ componentStyles: {
- leftTab: **optional**, if true, this layer will use the left tab instead of the right tab.
- previousTab: **optional**, a layer's id. If a layer has a previousTab, the layer will always have a back arrow and pressing the back arrow on this layer will take you to the layer with this id.
- previousTab: **optional**, a layer's id. If a layer has a previousTab, the layer will always have a back arrow and pressing the back arrow on this layer will take you to the layer with this id.
- deactivated: **optional**, if this is true, hasUpgrade, hasChallenge, hasAchievement, and hasMilestone will return false for things in the layer, and you will be unable to buy or click things, or gain achievements/milestones on the layer. You will have to disable effects of buyables, the innate layer effect, and possibly other things yourself.
## Custom Prestige type
## Custom Prestige type
(All of these can also be used by other prestige types)
- getResetGain(): **mostly for custom prestige type**. Returns how many points you should get if you reset now. You can call `getResetGain(this.layer, useType = "static")` or similar to calculate what your gain would be under another prestige type (provided you have all of the required features in the layer).
Expand All @@ -189,4 +190,4 @@ componentStyles: {
- canReset(): **mostly for custom prestige type**. Return true only if you have the resources required to do a prestige here.
- prestigeNotify(): **mostly for custom prestige types**, returns true if this layer should be subtly highlighted to indicate you
can prestige for a meaningful gain.
can prestige for a meaningful gain.
115 changes: 98 additions & 17 deletions js/dummies/dummies.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,20 +35,18 @@ type TabFormatEntries<L extends keyof Layers> = ['display-text', Computable<stri
...string[][]
]
] |
['tile', tile] | [
'dynabar',
{
direction: 0 | 1 | 2 | 3
progress(): number | Decimal
width: number
height: number
display?: Computable<string>
baseStyle?: Computable<CSSStyles>
fillStyle?: Computable<CSSStyles>
borderStyle?: Computable<CSSStyles>
textStyle?: Computable<CSSStyles>
}
];
['tile', tile] |
['dynabar', {
direction: 0 | 1 | 2 | 3
progress(): number | Decimal
width: number
height: number
display?: Computable<string>
baseStyle?: Computable<CSSStyles>
fillStyle?: Computable<CSSStyles>
borderStyle?: Computable<CSSStyles>
textStyle?: Computable<CSSStyles>
}];

type tile = {
text?: Computable<string>
Expand Down Expand Up @@ -1768,6 +1766,7 @@ declare class Item<I> {
/** Amount is reset when that row is */
row?: Layer<string>['row']
unlocked?: boolean
categories: categories[]

lore: Computable<string>

Expand All @@ -1791,9 +1790,15 @@ declare class Item<I> {
effectDescription(amount?: DecimalSource): string
}

type items = 'slime_goo' | 'slime_core_shard' | 'slime_core' | 'dense_slime_core';
type items = 'slime_goo' | 'slime_core_shard' | 'slime_core' | 'dense_slime_core' |
'slime_crystal' | 'slime_knife' | 'slime_injector' | 'slime_die';
type monsters = 'slime';

type drop_sources = `kill:${monsters}`;
type drop_types = 'kill' | 'crafting';
type categories = 'materials' | 'equipment' |
'slime';

type Layers = {
// Side
ach: Layer<'ach'> & {
Expand Down Expand Up @@ -1836,7 +1841,7 @@ type Layers = {
lore: Computable<string>
unlocked?(): boolean
} }
monster_list(): monsters[]
list(): monsters[]
kill: {
color: string
total(): Decimal
Expand All @@ -1845,7 +1850,6 @@ type Layers = {
damage: {
base(): Decimal
mult(): Decimal
total(): Decimal
}
xp: {
base(): Decimal
Expand All @@ -1861,7 +1865,59 @@ type Layers = {
}
}
// Row 1
l: Layer<'l'> & {
skill_points: {
color: string
total(): Decimal
remaining(): Decimal
}
}
c: Layer<'c'> & {
chance_multiplier(): Decimal
crafting: {
/** Max multiplier for crafting amount */
max(): Decimal
/** Total times static recipes have been crafted */
crafted(): Decimal
/** Divides crafting time */
speed(): Decimal
}
recipes: {
[id: string]: {
private _id: string | null
readonly id: string
unlocked?: Computable<boolean>

/** Items consumed for an output multiplier */
consumes(amount?: DecimalSource, all_time?: DecimalSource): [items, Decimal][]
/** Items produced with a given multiplier */
produces(amount?: DecimalSource, all_time?: DecimalSource): [items, Decimal][]
/** Duration to craft an amount of items, if 0 or absent, crafting is instant */
duration?(amount?: DecimalSource, all_time?: DecimalSource): Decimal
formulas: {
duration?: string
consumes: { [item in items]?: string }
produces: { [item in items]?: string }
}
/**
* If true, all time crafted amount will be counted for consuming and producing
*/
static?: boolean
categories: categories[]
}
}
}
// Row 2
b: Layer<'b'> & {
complete(): Decimal
challenges?: {
[id: string]: Challenge<'b'> & {
progress(): Decimal
display(): string
color: Computable<string>
}
}
}
};
type Temp = {
displayThings: (string | (() => string))[]
Expand Down Expand Up @@ -1913,7 +1969,32 @@ type Player = {
} }
}
// Row 1
l: LayerData & {}
c: LayerData & {
shown: boolean
visiblity: {
inventory: {
[cat in categories]: 'show' | 'hide' | 'ignore'
}
crafting: {
[cat in categories]: 'show' | 'hide' | 'ignore'
}
}
recipes: {
[id: string]: {
target: Decimal
making: Decimal
time: Decimal
/** Total times crafted */
crafted: Decimal
}
}
compendium: items | false
}
// Row 2
b: LayerData & {
shown: boolean
}
};

/** Adds the items in question to the player data */
Expand Down
Loading

0 comments on commit 3880018

Please sign in to comment.