2024-06-11 02:38:24 +00:00
import { _ as e , c as s , o as t , a9 as a } from "./chunks/framework.D8PMdl4T.js" ; const f = JSON . parse ( '{"title":"Upgrades","description":"","frontmatter":{},"headers":[],"relativePath":"public/gamedevtree/docs/upgrades.md","filePath":"public/gamedevtree/docs/upgrades.md","lastUpdated":1603152353000}' ) , i = { name : "public/gamedevtree/docs/upgrades.md" } , n = a ( ` <h1 id="upgrades" tabindex="-1">Upgrades <a class="header-anchor" href="#upgrades" aria-label="Permalink to "Upgrades""> </a></h1><p>Useful functions for dealing with Upgrades and implementing their effects:</p><ul><li>hasUpgrade(layer, id): determine if the player has the upgrade</li><li>upgradeEffect(layer, id): Returns the current effects of the upgrade, if any</li><li>buyUpgrade(layer, id): Buys an upgrade directly (if affordable)</li></ul><p>Hint: Basic point gain is calculated in mod.js's "getPointGen".</p><p>Upgrades are stored in the following format:</p><div class="language-js vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang">js</span><pre class="shiki shiki-themes github-light github-dark vp-code" tabindex="0"><code><span class="line"><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;"> upgrades</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">: {</span></span>
2024-06-02 01:57:02 +00:00
< span class = "line" > < span style = "--shiki-light:#6F42C1;--shiki-dark:#B392F0;" > rows < / s p a n > < s p a n s t y l e = " - - s h i k i - l i g h t : # 2 4 2 9 2 E ; - - s h i k i - d a r k : # E 1 E 4 E 8 ; " > : # < / s p a n > < s p a n s t y l e = " - - s h i k i - l i g h t : # D 7 3 A 4 9 ; - - s h i k i - d a r k : # F 9 7 5 8 3 ; " > o f < / s p a n > < s p a n s t y l e = " - - s h i k i - l i g h t : # 2 4 2 9 2 E ; - - s h i k i - d a r k : # E 1 E 4 E 8 ; " > r o w s < / s p a n > < / s p a n >
< span class = "line" > < span style = "--shiki-light:#6F42C1;--shiki-dark:#B392F0;" > cols < / s p a n > < s p a n s t y l e = " - - s h i k i - l i g h t : # 2 4 2 9 2 E ; - - s h i k i - d a r k : # E 1 E 4 E 8 ; " > : # < / s p a n > < s p a n s t y l e = " - - s h i k i - l i g h t : # D 7 3 A 4 9 ; - - s h i k i - d a r k : # F 9 7 5 8 3 ; " > o f < / s p a n > < s p a n s t y l e = " - - s h i k i - l i g h t : # 2 4 2 9 2 E ; - - s h i k i - d a r k : # E 1 E 4 E 8 ; " > c o l u m n s < / s p a n > < / s p a n >
< span class = "line" > < span style = "--shiki-light:#005CC5;--shiki-dark:#79B8FF;" > 11 < / s p a n > < s p a n s t y l e = " - - s h i k i - l i g h t : # 2 4 2 9 2 E ; - - s h i k i - d a r k : # E 1 E 4 E 8 ; " > : { < / s p a n > < / s p a n >
< span class = "line" > < span style = "--shiki-light:#24292E;--shiki-dark:#E1E4E8;" > description : < / s p a n > < s p a n s t y l e = " - - s h i k i - l i g h t : # 0 3 2 F 6 2 ; - - s h i k i - d a r k : # 9 E C B F F ; " > & q u o t ; B l a h & q u o t ; < / s p a n > < s p a n s t y l e = " - - s h i k i - l i g h t : # 2 4 2 9 2 E ; - - s h i k i - d a r k : # E 1 E 4 E 8 ; " > , < / s p a n > < / s p a n >
< span class = "line" > < span style = "--shiki-light:#24292E;--shiki-dark:#E1E4E8;" > more features < / s p a n > < / s p a n >
< span class = "line" > < span style = "--shiki-light:#24292E;--shiki-dark:#E1E4E8;" > } < / s p a n > < / s p a n >
< span class = "line" > < span style = "--shiki-light:#24292E;--shiki-dark:#E1E4E8;" > etc < / s p a n > < / s p a n >
< span class = "line" > < span style = "--shiki-light:#24292E;--shiki-dark:#E1E4E8;" > } < / s p a n > < / s p a n > < / c o d e > < / p r e > < / d i v > < p > E a c h u p g r a d e s h o u l d h a v e a n i d w h e r e t h e f i r s t d i g i t i s t h e r o w a n d t h e s e c o n d d i g i t i s t h e c o l u m n . I n d i v i d u a l u p g r a d e s c a n h a v e t h e s e f e a t u r e s : < / p > < u l > < l i > < p > t i t l e : < s t r o n g > o p t i o n a l < / s t r o n g > , d i s p l a y e d a t t h e t o p i n a l a r g e r f o n t I t c a n a l s o b e a f u n c t i o n t h a t r e t u r n s u p d a t i n g t e x t . C a n u s e b a s i c H T M L . < / p > < / l i > < l i > < p > d e s c r i p t i o n : A d e s c r i p t i o n o f t h e u p g r a d e & # 3 9 ; s e f f e c t . < e m > Y o u w i l l a l s o h a v e t o i m p l e m e n t t h e e f f e c t w h e r e i t i s a p p l i e d . < / e m > I t c a n a l s o b e a f u n c t i o n t h a t r e t u r n s u p d a t i n g t e x t . C a n u s e b a s i c H T M L . < / p > < / l i > < l i > < p > e f f e c t ( ) : < s t r o n g > o p t i o n a l < / s t r o n g > , A f u n c t i o n t h a t c a l c u l a t e s a n d r e t u r n s t h e c u r r e n t v a l u e s o f a n y b o n u s e s f r o m t h e u p g r a d e . C a n r e t u r n a v a l u e o r a n o b j e c t c o n t a i n i n g m u l t i p l e v a l u e s . < / p > < / l i > < l i > < p > e f f e c t D i s p l a y ( ) : < s t r o n g > o p t i o n a l < / s t r o n g > , A f u n c t i o n t h a t r e t u r n s a d i s p l a y o f t h e c u r r e n t e f f e c t s o f t h e u p g r a d e w i t h f o r m a t t i n g . D e f a u l t b e h a v i o r i s t o j u s t d i s p l a y t h e a n u m b e r a p p r o p r i a t e l y f o r m a t t e d . C a n u s e b a s i c H T M L . < / p > < / l i > < l i > < p > c o s t : A D e c i m a l f o r t h e c o s t o f t h e u p g r a d e . B y d e f a u l t , u p g r a d e s c o s t t h e m a i n p r e s t i g e c u r r e n c y f o r t h e l a y e r . < / p > < / l i > < l i > < p > u n l o c k e d ( ) : < s t r o n g > o p t i o n a l < / s t r o n g > , A f u n c t i o n r e t u r n i n g a b o o l t o d e t e r m i n e i f t h e u p g r a d e i s v i s i b l e o r n o t . D e f a u l t i s u n l o c k e d . < / p > < / l i > < l i > < p > o n P u r c h a s e ( ) - < s t r o n g > o p t i o n a l < / s t r o n g > , t h i s f u n c t i o n w i l l b e c a l l e d w h e n t h e u p g r a d e i s p u r c h a s e d . G o o d f o r u p g r a d e s l i k e & q u o t ; m a k e s t h i s l a y e r a c t l i k e i t w a s u n l o c k e d f i r s t & q u o t ; . < / p > < / l i > < / u l > < p > B y d e f a u l t , u p g r a d e s u s e t h e m a i n p r e s t i g e c u r r e n c y f o r t h e l a y e r . Y o u c a n i n c l u d e t h e s e t o c h a n g e t h e m ( b u t i t n e e d s t o b e a D e c i m a l ) : < / p > < u l > < l i > < p > c u r r e n c y D i s p l a y N a m e : < s t r o n g > o p t i o n a l < / s t r o n g > , t h e n a m e t o d i s p l a y f o r t h e c u r r e n c y f o r t h e u p g r a d e < / p > < / l i > < l i > < p > c u r r e n c y I n t e r n a l N a m e : < s t r o n g > o p t i o n a l < / s t r o n g > , t h e i n t e r n a l n a m e f o r t h a t c u r r e n c y < / p > < / l i > < l i > < p > c u r r e n c y L a y e r : < s t r o n g > o p t i o n a l < / s t r o n g > , t h e i n t e r n a l n a m e o f t h e l a y e r t h a t c u r r e n c y i s s t o r e d i n . I f i t & # 3 9 ; s n o t i n a l a y e r ( l i k e P o i n t s ) , o m i t . I f i t & # 3 9 ; s n o t s t o r e d d i r e c t l y i n a l a y e r , i n s t e a d u s e t h e n e x t f e a t u r e . < / p > < / l i > < l i > < p > c u r r e n c y L o c a t i o n : < s t r o n g > o p t i o n a l < / s t r o n g > , i f y o u r c u r r e n c y i s s t o r e d i n s o m e t h i n g i n s i d e a l a y e r ( e . g . a b u y a b l e & # 3 9 ; s a m o u n t ) , y o u c a n a c c e s s i t t h i s w a y . T h i s i s a f u n c t i o n r e t u r n i n g t h e o b j e c t i n & q u o t ; p l a y e r & q u o t ; t h a t c o n t a i n s t h e v a l u e ( l i k e p l a y e r [ t h i s . l a y e r ] . b u y a b l e s ) < / p > < / l i > < l i > < p > s t y l e : < s t r o n g > O p t i o n a l < / s t r o n g > , A p p l i e s C S S t o t h i s u p g r a d e , i n t h e f o r m o f a n o b j e c t w h e r e t h e k e y s a r e C S S a t t r i b u t e s , a n d t h e v a l u e s a r e t h e v a l u e s f o r t h o s e a t t r i b u t e s ( b o t h a s s t r i n g s ) < / p > < / l i > < l i > < p > l a y e r : < s t r o n g > A s s i g n e d a u t o m a g i c a l l y < / s t r o n g > . I t & # 3 9 ; s t h e s a m e v a l u e a s t h e n a m e o f t h i s l a y e r , s o y o u c a n d o p l a y e r [ t h i s . l a y e r ] . p o i n t s o r s i m i l a r < / p > < / l i > < l i > < p > i d : < s t r o n g > A s s i g n e d a u t o m a g i c a l l y < / s t r o n g > . I t & # 3 9 ; s t h e & q u o t ; k e y & q u o t ; w h i c h t h e u p g r a d e w a s s t o r e d u n d e r , f o r c o n v e n i e n t a c c e s s . T h e u p g r a d e i n t h e e x a m p l e & # 3 9 ; s i d i s 1 1 . < / p > < / l i > < / u l > ` , 1 0 ) , r = [ n ] ; f u n c t i o n l ( o , p , h , d , u , c ) { r e t u r n t ( ) , s ( " d i v " , n u l l , r ) } c o n s t y = e ( i , [ [ " r e n d e r " , l ] ] ) ; e x p o r t { f a s _ _ p a g e D a t a , y a s d e f a u l t } ;