File tree Expand file tree Collapse file tree 2 files changed +13
-4
lines changed
Expand file tree Collapse file tree 2 files changed +13
-4
lines changed Original file line number Diff line number Diff line change @@ -4,7 +4,7 @@ export default scenes => {
44 const [ BASE_SCORE , SCORE_EXPONENT ] = [ 100 , 1.5 ] ;
55 const ANIM_SPEED = 100 ;
66 const SHORTEST_CHAIN = 3 ;
7- const CONTINUE_BONUS = 5 ;
7+ const [ CONTINUE_BONUS , CONTINUE_COST ] = [ 5 , 100 ] ;
88 const MAIN_BOARD = document . getElementById ( "puz_board" ) ;
99 const DIV_PUZ_DISPLAY = document . getElementById ( "puz_display" ) ;
1010 const DIV_PUZ_INFO = document . getElementById ( "puz_info" ) ;
@@ -177,8 +177,12 @@ export default scenes => {
177177 chain_color = null ;
178178 chain_yx = [ ] ;
179179 if ( DATA . target . hand <= 0 ) {
180- if ( confirm ( `コンテニューしますか?(手数+${ CONTINUE_BONUS } )` ) ) {
180+ if (
181+ Number ( localStorage . haveCoin ) >= CONTINUE_COST &&
182+ confirm ( `コンテニューしますか?(手数+${ CONTINUE_BONUS } )` )
183+ ) {
181184 DATA . target . hand += CONTINUE_BONUS ;
185+ localStorage . haveCoin -= CONTINUE_COST ;
182186 return ;
183187 }
184188 alert ( `ゲームオーバー! スコアは${ DATA . target . score } でした!` ) ;
@@ -250,4 +254,5 @@ export default scenes => {
250254 . catch ( endscene ) ;
251255 } ;
252256 return startgame ;
253- } ;
257+ } ;
258+
Original file line number Diff line number Diff line change 11export default scenes => {
22 if ( ! localStorage . maxStage ) localStorage . maxStage = 1 ; //NEVER ZERO
3+ if ( ! localStorage . haveCoin ) localStorage . haveCoin = 0 ;
34 const DIV_STAGE_SELECT = document . getElementById ( "stage_select" ) ;
45 const INPUT_STAGE_LINK = document . getElementById ( "StageLink" ) ;
56 const START_BUTTON = document . getElementById ( "startbutton" ) ;
67 const initer = ( wasSuccess = false , stagePlayed = - 1 ) => {
7- if ( wasSuccess && stagePlayed === Number ( localStorage . maxStage ) ) localStorage . maxStage ++ ;
8+ if ( wasSuccess ) {
9+ localStorage . haveCoin -= ( - 100 ) ;
10+ if ( stagePlayed === Number ( localStorage . maxStage ) ) localStorage . maxStage ++ ;
11+ }
812 DIV_STAGE_SELECT . style . display = "block" ;
913 START_BUTTON . onclick = ( ) => {
1014 const STAGE_ID = INPUT_STAGE_LINK . value ;
You can’t perform that action at this time.
0 commit comments