| 
						
						
							
								
							
						
						
					 | 
					 | 
					@ -664,6 +664,10 @@ class Board { | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    this.buttons.toggleFullscreen = this.addButton(x0, cfgy0+ysp2*-1.5, 'Fullscreen', 'config'); | 
					 | 
					 | 
					 | 
					    this.buttons.toggleFullscreen = this.addButton(x0, cfgy0+ysp2*-1.5, 'Fullscreen', 'config'); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    this.buttons.btnAbout = this.addButton(x0, cfgy0+ysp2*-2.5, 'Help', 'config'); | 
					 | 
					 | 
					 | 
					    this.buttons.btnAbout = this.addButton(x0, cfgy0+ysp2*-2.5, 'Help', 'config'); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					    let youWin = Svg.fromXML(`<text class="you-win" opacity="0" x="0" y="0">Good work!</text>`); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					    this.$root.appendChild(youWin); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					    this.youWin = youWin; | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					  } | 
					 | 
					 | 
					 | 
					  } | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					  updateSettingsGUI(cfg) { | 
					 | 
					 | 
					 | 
					  updateSettingsGUI(cfg) { | 
				
			
			
		
	
	
		
		
			
				
					| 
						
							
								
							
						
						
							
								
							
						
						
					 | 
					 | 
					@ -1515,6 +1519,7 @@ class Game { | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					   * @param orb | 
					 | 
					 | 
					 | 
					   * @param orb | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					   */ | 
					 | 
					 | 
					 | 
					   */ | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					  inGameBoardClick(n, orb) { | 
					 | 
					 | 
					 | 
					  inGameBoardClick(n, orb) { | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					    let removed = false; | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    this.debug(`Clicked orb ${n}: ${orb.symbol}`); | 
					 | 
					 | 
					 | 
					    this.debug(`Clicked orb ${n}: ${orb.symbol}`); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    if (!this.isAvailableAtPlaytime(n)) { | 
					 | 
					 | 
					 | 
					    if (!this.isAvailableAtPlaytime(n)) { | 
				
			
			
		
	
	
		
		
			
				
					| 
						
						
						
							
								
							
						
					 | 
					 | 
					@ -1530,11 +1535,12 @@ class Game { | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					      this.addUndoRecord([{ | 
					 | 
					 | 
					 | 
					      this.addUndoRecord([{ | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        symbol: orb.symbol, | 
					 | 
					 | 
					 | 
					        symbol: orb.symbol, | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        n: orb.n, | 
					 | 
					 | 
					 | 
					        n, | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					      }]); | 
					 | 
					 | 
					 | 
					      }]); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					      this.board.removeOrbByIndex(n); | 
					 | 
					 | 
					 | 
					      this.board.removeOrbByIndex(n); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					      this.selectedOrb = null; | 
					 | 
					 | 
					 | 
					      this.selectedOrb = null; | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					      removed = true; | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					      wantRefresh = true; | 
					 | 
					 | 
					 | 
					      wantRefresh = true; | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    } else if (this.selectedOrb === null) { | 
					 | 
					 | 
					 | 
					    } else if (this.selectedOrb === null) { | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					      this.debug(`Select orb`); | 
					 | 
					 | 
					 | 
					      this.debug(`Select orb`); | 
				
			
			
		
	
	
		
		
			
				
					| 
						
							
								
							
						
						
							
								
							
						
						
					 | 
					 | 
					@ -1571,6 +1577,8 @@ class Game { | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					          this.board.removeOrbByIndex(n); | 
					 | 
					 | 
					 | 
					          this.board.removeOrbByIndex(n); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					          this.board.removeOrbByIndex(this.selectedOrb.n); | 
					 | 
					 | 
					 | 
					          this.board.removeOrbByIndex(this.selectedOrb.n); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					          removed = true; | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					          if ([orb.symbol, otherSymbol].includes(this.nextMetal)) { | 
					 | 
					 | 
					 | 
					          if ([orb.symbol, otherSymbol].includes(this.nextMetal)) { | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            this.debug("Advance metal transmutation sequence."); | 
					 | 
					 | 
					 | 
					            this.debug("Advance metal transmutation sequence."); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            this.advanceMetal(); | 
					 | 
					 | 
					 | 
					            this.advanceMetal(); | 
				
			
			
		
	
	
		
		
			
				
					| 
						
						
						
							
								
							
						
					 | 
					 | 
					@ -1593,6 +1601,12 @@ class Game { | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    if (wantRefresh) { | 
					 | 
					 | 
					 | 
					    if (wantRefresh) { | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					      if (this.countOrbs() === 0) { | 
					 | 
					 | 
					 | 
					      if (this.countOrbs() === 0) { | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        this.info("Good work!"); | 
					 | 
					 | 
					 | 
					        this.info("Good work!"); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					        if (removed) { | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					          setTimeout(() => { | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					            this.board.youWin.classList.add('show'); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					          }, 500); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					        } | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					      } | 
					 | 
					 | 
					 | 
					      } | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					      this.updateGameGui(); | 
					 | 
					 | 
					 | 
					      this.updateGameGui(); | 
				
			
			
		
	
	
		
		
			
				
					| 
						
							
								
							
						
						
							
								
							
						
						
					 | 
					 | 
					@ -1662,8 +1676,10 @@ class Game { | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					   * Update button hiding attributes, disabled orb effects, etc | 
					 | 
					 | 
					 | 
					   * Update button hiding attributes, disabled orb effects, etc | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					   */ | 
					 | 
					 | 
					 | 
					   */ | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					  updateGameGui() { | 
					 | 
					 | 
					 | 
					  updateGameGui() { | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					    let nOrbs = this.countOrbs(); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    this.board.buttons.restart | 
					 | 
					 | 
					 | 
					    this.board.buttons.restart | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					      .classList.toggle('disabled', this.countOrbs() === 55); | 
					 | 
					 | 
					 | 
					      .classList.toggle('disabled', nOrbs === 55); | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    this.board.buttons.undo | 
					 | 
					 | 
					 | 
					    this.board.buttons.undo | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					      .classList.toggle('disabled', this.undoStack.length === 0); | 
					 | 
					 | 
					 | 
					      .classList.toggle('disabled', this.undoStack.length === 0); | 
				
			
			
		
	
	
		
		
			
				
					| 
						
						
						
							
								
							
						
					 | 
					 | 
					@ -1671,10 +1687,17 @@ class Game { | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    // Update orb disabled status
 | 
					 | 
					 | 
					 | 
					    // Update orb disabled status
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    for (let n = 0; n < BOARD_SIZE; n++) { | 
					 | 
					 | 
					 | 
					    for (let n = 0; n < BOARD_SIZE; n++) { | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					      if (this.board.grid[n]) { | 
					 | 
					 | 
					 | 
					      if (this.board.grid[n]) { | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        const ava = this.isAvailableAtPlaytime(n); | 
					 | 
					 | 
					 | 
					        const disabled = !this.isAvailableAtPlaytime(n); | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        this.board.grid[n].node.classList.toggle('disabled', !ava); | 
					 | 
					 | 
					 | 
					        let node = this.board.grid[n].node; | 
				
			
			
				
				
			
		
	
		
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					        if (node.classList.contains('disabled') !== disabled) { | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					          node.classList.toggle('disabled', disabled); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					        } | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					      } | 
					 | 
					 | 
					 | 
					      } | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    } | 
					 | 
					 | 
					 | 
					    } | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					    if (nOrbs !== 0) { | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					      this.board.youWin.classList.remove('show'); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					    } | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					  } | 
					 | 
					 | 
					 | 
					  } | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					  newGame(seed) { | 
					 | 
					 | 
					 | 
					  newGame(seed) { | 
				
			
			
		
	
	
		
		
			
				
					| 
						
							
								
							
						
						
						
					 | 
					 | 
					
  |