2022-12-01 06:29:03 +00:00
import { _ as e , c as s , o as a , d as t } from "./app.99998402.js" ; const g = JSON . parse ( '{"title":"Upgrades","description":"","frontmatter":{},"headers":[],"relativePath":"public/kronos/docs/upgrades.md","lastUpdated":null}' ) , n = { name : "public/kronos/docs/upgrades.md" } , o = t ( ` <h1 id="upgrades" tabindex="-1">Upgrades <a class="header-anchor" href="#upgrades" aria-hidden="true">#</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 <a href="/js/mod.js">mod.js</a>'s "getPointGen" function.</p><p>Upgrades are stored in the following format:</p><div class="language-js"><button title="Copy Code" class="copy"></button><span class="lang">js</span><pre class="shiki"><code><span class="line"><span style="color:#FFCB6B;">upgrades</span><span style="color:#89DDFF;">:</span><span style="color:#A6ACCD;"> </span><span style="color:#89DDFF;">{</span></span>
2022-10-05 00:48:27 +00:00
< span class = "line" > < span style = "color:#F07178;" > < / s p a n > < s p a n s t y l e = " c o l o r : # F 7 8 C 6 C ; " > 1 1 < / s p a n > < s p a n s t y l e = " c o l o r : # F 0 7 1 7 8 ; " > : < / s p a n > < s p a n s t y l e = " c o l o r : # 8 9 D D F F ; " > { < / s p a n > < / s p a n >
< span class = "line" > < span style = "color:#F07178;" > description < / s p a n > < s p a n s t y l e = " c o l o r : # 8 9 D D F F ; " > : < / s p a n > < s p a n s t y l e = " c o l o r : # F 0 7 1 7 8 ; " > < / s p a n > < s p a n s t y l e = " c o l o r : # 8 9 D D F F ; " > & q u o t ; < / s p a n > < s p a n s t y l e = " c o l o r : # C 3 E 8 8 D ; " > B l a h < / s p a n > < s p a n s t y l e = " c o l o r : # 8 9 D D F F ; " > & q u o t ; < / s p a n > < s p a n s t y l e = " c o l o r : # 8 9 D D F F ; " > , < / s p a n > < / s p a n >
< span class = "line" > < span style = "color:#F07178;" > cost < / s p a n > < s p a n s t y l e = " c o l o r : # 8 9 D D F F ; " > : < / s p a n > < s p a n s t y l e = " c o l o r : # F 0 7 1 7 8 ; " > < / s p a n > < s p a n s t y l e = " c o l o r : # 8 9 D D F F ; " > n e w < / s p a n > < s p a n s t y l e = " c o l o r : # F 0 7 1 7 8 ; " > < / s p a n > < s p a n s t y l e = " c o l o r : # 8 2 A A F F ; " > D e c i m a l < / s p a n > < s p a n s t y l e = " c o l o r : # F 0 7 1 7 8 ; " > ( < / s p a n > < s p a n s t y l e = " c o l o r : # F 7 8 C 6 C ; " > 1 0 0 < / s p a n > < s p a n s t y l e = " c o l o r : # F 0 7 1 7 8 ; " > ) < / s p a n > < s p a n s t y l e = " c o l o r : # 8 9 D D F F ; " > , < / s p a n > < / s p a n >
< span class = "line" > < span style = "color:#F07178;" > < / s p a n > < s p a n s t y l e = " c o l o r : # A 6 A C C D ; " > e t c < / s p a n > < / s p a n >
< span class = "line" > < span style = "color:#F07178;" > < / s p a n > < s p a n s t y l e = " c o l o r : # 8 9 D D F F ; " > } , < / s p a n > < / s p a n >
< span class = "line" > < span style = "color:#F07178;" > < / s p a n > < s p a n s t y l e = " c o l o r : # A 6 A C C D ; " > e t c < / s p a n > < / s p a n >
< span class = "line" > < span style = "color:#89DDFF;" > } < / s p a n > < / s p a n >
< span class = "line" > < / s p a n > < / c o d e > < / p r e > < / d i v > < p > U s u a l l y , u p g r a d e s 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 . < / p > < p > 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 d i s p l a y s n o t h i n g . C a n u s e b a s i c H T M L . < / p > < / l i > < l i > < p > f u l l D i s p l a y ( ) : < s t r o n g > O V E R R I D E < / s t r o n g > . O v e r r i d e s t h e o t h e r d i s p l a y s a n d d e s c r i p t i o n s , a n d l e t s y o u s e t t h e f u l l t e x t f o r t h e u p g r a d e . 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 > < 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 < c o d e > p l a y e r [ t h i s . l a y e r ] . p o i n t s < / c o d e > 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 > < 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 < c o d e > p l a y e r [ t h i s . l a y e r ] . b u y a b l e s < / c o d e > ) < / p > < / l i > < / u l > < p > I f y o u w a n t t o d o s o m e t h i n g m o r e c o m p l i c a t e d l i k e u p g r a d e s t h a t c o s t t w o c u r r e n c i e s , y o u c a n o v e r r i d e t h e p u r c h a s e s y s t e m w i t h t h e s e ( a n d y o u n e e d t o u s e f u l l D i s p l a y a s w e l l ) < / p > < u l > < l i > < p > c a n A f f o r d ( ) : < s t r o n g > O V E R R I D E < / s t r o n g > , a f u n c t i o n d e t e r m i n i n g i f y o u a r e a b l e t o b u y t h e u p g r a d e < / p > < / l i > < l i > < p > p a y ( ) : < s t r o n g > O V E R R I D E < / s t r o n g > , a f u n c t i o n t h a t r e d u c e s y o u r c u r r e n c i e s w h e n y o u b u y t h e u p g r a d e < / p > < / l i > < / u l > ` , 1 3 ) , l = [ o ] ; f u n c t i o n r ( i , p , c , u , d , h ) { r e t u r n a ( ) , s ( " d i v " , n u l l , l ) } c o n s t f = e ( n , [ [ " r e n d e r " , r ] ] ) ; e x p o r t { g a s _ _ p a g e D a t a , f a s d e f a u l t } ;