@@ -77,12 +77,7 @@ const falling_orb = () => {
7777 for ( let j = 1 ; j < DATA . size . Width ; j ++ ) refall = fall_obj ( i - 1 , j , i , j - 1 ) || refall ; //L-shift
7878 for ( let j = 0 ; j < DATA . size . Width - 1 ; j ++ ) refall = fall_obj ( i - 1 , j , i , j + 1 ) || refall ; //R-shift
7979 }
80- for ( let i = 0 ; i < DATA . size . Width ; i ++ ) {
81- if ( DATA . board . obj [ 0 ] [ i ] [ 0 ] === 0 ) {
82- DATA . board . obj [ 0 ] [ i ] = [ ~ ~ ( Math . random ( ) * ORB_COLORS ) + 1 , 1 ] ;
83- refall = true ;
84- }
85- }
80+ DATA . board . obj [ 0 ] = DATA . board . obj [ 0 ] . map ( x => ( x [ 0 ] === 0 ) ?( refall = true , [ ~ ~ ( Math . random ( ) * ORB_COLORS ) + 1 , 1 ] ) :x ) ;
8681 if ( ! refall ) {
8782 clearInterval ( FALL_TIMER ) ;
8883 chainable = true ;
@@ -93,14 +88,12 @@ const falling_orb = () => {
9388const onmouce_cell = cell => {
9489 const [ CELL_Y , CELL_X ] = [ cell . target . parentNode . rowIndex , cell . target . cellIndex ] ;
9590 const CELL_COLOR = DATA . board . obj [ CELL_Y ] [ CELL_X ] [ 0 ] ;
96- if ( chain_now ) {
97- if ( Math . abs ( chain_yx . at ( - 1 ) . y - CELL_Y ) <= 1 && Math . abs ( chain_yx . at ( - 1 ) . x - CELL_X ) <= 1 ) /*位置チェック*/ {
98- if ( chain_info . color === CELL_COLOR && ! chain_yx . some ( e => e . x === CELL_X && e . y === CELL_Y ) ) /*条件チェック*/ {
99- cell . target . querySelector ( "img" ) . classList . add ( "chaining" ) ;
100- chain_yx . push ( { x : CELL_X , y : CELL_Y } ) ;
101- chain_info . count ++ ;
102- }
103- }
91+ if ( chain_now &&
92+ Math . abs ( chain_yx . at ( - 1 ) . y - CELL_Y ) <= 1 && Math . abs ( chain_yx . at ( - 1 ) . x - CELL_X ) <= 1 /*位置チェック*/ &&
93+ chain_info . color === CELL_COLOR && ! chain_yx . some ( e => e . x === CELL_X && e . y === CELL_Y ) ) /*条件チェック*/ {
94+ cell . target . querySelector ( "img" ) . classList . add ( "chaining" ) ;
95+ chain_yx . push ( { x : CELL_X , y : CELL_Y } ) ;
96+ chain_info . count ++ ;
10497 }
10598}
10699const chain_toggler = cell => {
@@ -173,9 +166,4 @@ const startgame = () => {
173166 import ( DATALINK )
174167 . then ( x => { DATA = object_copy ( x . default ) ; board_init ( ) } ) ;
175168} ;
176- document . querySelector ( "#startbutton" ) . onclick = startgame ;
177- //1~:オーブ
178- //0:無空間
179- //~-1:妨害ブロック
180-
181- //ADJ_BREAK
169+ document . querySelector ( "#startbutton" ) . onclick = startgame ;
0 commit comments