2022-10-05 04:28:30 +00:00
import { _ as e , c as s , o as n , a } from "./app.a576d425.js" ; const d = JSON . parse ( '{"title":"Challenges","description":"","frontmatter":{},"headers":[],"relativePath":"public/lit/docs/challenges.md","lastUpdated":null}' ) , l = { name : "public/lit/docs/challenges.md" } , t = a ( ` <h1 id="challenges" tabindex="-1">Challenges <a class="header-anchor" href="#challenges" aria-hidden="true">#</a></h1><p>Challenges can have fully customizable win conditions. Useful functions for dealing with Challenges and implementing their effects:</p><ul><li>inChallenge(layer, id): determine if the player is in a given challenge (or another challenge on the same layer that counts as this one).</li><li>hasChallenge(layer, id): determine if the player has completed the challenge.</li><li>challengeCompletions(layer, id): determine how many times the player completed the challenge.</li><li>challengeEffect(layer, id): Returns the current effects of the challenge, if any.</li></ul><p>Challenges are stored in the following format:</p><div class="language-js"><button class="copy"></button><span class="lang">js</span><pre><code><span class="line"><span style="color:#FFCB6B;">challenges</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 F C B 6 B ; " > r o w s < / 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 ; " > o 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 : # A 6 A C C D ; " > r o w s < / 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 : # F F C B 6 B ; " > c o l s < / 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 ; " > o 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 : # A 6 A C C D ; " > c o l u m n s < / 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 : # 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;" > name < / 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 ; " > O u c 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;" > challengeDescription < / 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 ; " > d e s c r i p t i o n o f o u c h i e < / 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;" > goal < / 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 > E a c h c h a l l e n g 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 . < / p > < p > I n d i v i d u a l C h a l l e n g 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 > n a m e : N a m e o f t h e c h a l l e n g e , c a n b e a s t r i n g o r a f u n c t i o n . C a n u s e b a s i c H T M L . < / p > < / l i > < l i > < p > c h a l l e n g e 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 w h a t m a k e s t h e c h a l l e n g e a c h a l l e n g e . < e m > Y o u w i l l n e e d t o i m p l e m e n t t h e s e e l s e w h e r e . < / 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 > g o a l 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 w i n c o n d i t i o n f o r t h e c h a l l e n g e . 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 . ( O p t i o n a l i f u s i n g t h e o l d g o a l s y s t e m ) < / p > < / l i > < l i > < p > c a n C o m p l e t e ( ) : A f u n c t i o n t h a t r e t u r n s t r u e i f y o u m e e t t h e w i n c o n d i t i o n f o r t h e c h a l l e n g e . R e t u r n i n g a n u m b e r w i l l a l l o w b u l k c o m p l e t i n g t h e c h a l l e n g e . ( O p t i o n a l i f u s i n g t h e o l d g o a l s y s t e m ) < / p > < / l i > < l i > < p > r e w a r d 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 r e w a r d & # 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 > r e w a r d 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 r e w a r d . 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 . C a n u s e b a s i c H T M L . < / p > < / l i > < l i > < p > r e w a r d 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 r e w a r d 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 . < / 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 c h a l l e n g e . C a n u s e b a s i c H T M L . < / 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 c h a l l e n g 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 C o m p l e t 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 c h a l l e n g e i s c o m p l e t e d w h e n p r e v i o u s l y i n c o m p l e t e . < / p > < / l i > < l i > < p > c o u n t s A s : < s t r o n g > o p t i o n a l < / s t r o n g > . I f a c h a l l e n g e c o m b i n e s t h e e f f e c t s o f o t h e r c h a l l e n g e s i n t h i s l a y e r , y o u c a n u s e t h i s . A n a r r a y o f c h a l l e n g e i d s . T h e p l a y e r i s e f f e c t i v e l y i n a l l o f t h o s e c h a l l e n g e s w h e n i n t h e c u r r e n t o n e . < / p > < / l i > < l i > < p > c o m p l e t i o n L i m i t : < s t r o n g > o p t i o n a l < / s t r o n g > . t h e a m o u n t o f t i m e s y o u c a n c o m p l e t e t h i s c h a l l e n g e . D e f a u l t i s 1 c o m p l e t i o n . < / 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 c h a l l e n g 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 c h a l l e n g 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 c h a l l e n g 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 > T h e o l d g o a l s y s t e m u s e s t h e s e f e a t u r e s : < / p > < u l > < l i > < p > g o a l : < s t r o n g > d e p r e c a t e d < / s t r o n g > , A D e c i m a l f o r t h e a m o u n t o f c u r r e n c y r e q u i r e d t o b e a t t h e c h a l l e n g e . B y d e f a u l t , t h e g o a l i s i n b a s i c P o i n t s . T h e g o a l c a n a l s o b e a f u n c t i o n i f i t s v a l u e c h a n g e s . < / p > < / l i > < 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 > d e p r e c a t e d < / 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 g o a l < / 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 > d e p r e c a t e d < / 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 > d e p r e c a t e d < / 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 , 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 > d e p r e c a t e d < / 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 > ` , 1 0 ) , o = [ t ] ; f u n c t i o n i ( r , p , c , h , u , y )