import Piece from '../../../common/Piece'


export default class King extends Piece{
 constructor(board, id, containerSvg, x, y, numCol, numRow, unitW, unitH, w, h, isRed, priority) {
	super(board, id, containerSvg, x, y, numCol, numRow, unitW, unitH, w, h, isRed, priority)
    this.isRed = isRed;
   	this.bgImage = this.isRed?"http://coolshare.com/cindyqian/BoardGames/images/red_king.png":"http://coolshare.com/cindyqian/BoardGames/images/black_king.png"
  
   		

  }
	handleButtons() {

  	if(this.x == 4 && this.y == 1 || this.x == 4 && this.y == 8){
  		this.getButton(this.x+0, this.y+1)
  		this.getButton(this.x+0, this.y-1)
  		this.getButton(this.x+1, this.y+0)
  		this.getButton(this.x-1, this.y+0)

  		
  	}
  		
  	if(this.x == 3 && this.y == 2 || this.x == 3 && this.y == 9){
  		this.getButton(this.x+0, this.y-1)
  		this.getButton(this.x+1, this.y+0)

  		
  	}
  		
  	if(this.x == 5 && this.y == 2 || this.x == 5 && this.y == 9){
  		this.getButton(this.x-1, this.y+0)
  		this.getButton(this.x+0, this.y-1)

  		
  	}
  		
  	if(this.x == 5 && this.y == 0 || this.x == 5 && this.y == 7){
  		this.getButton(this.x+0, this.y+1)
  		this.getButton(this.x-1, this.y+0)

  		
  	}
  	
  	if(this.x == 3 && this.y == 0 || this.x == 3 && this.y == 7){
  		this.getButton(this.x+0, this.y+1)
  		this.getButton(this.x+1, this.y+0)

  		
  	}
  	
  	if(this.x == 4 && this.y == 0 || this.x == 4 && this.y == 7){
  		this.getButton(this.x+1, this.y+0)
  		this.getButton(this.x-1, this.y+0)
  		this.getButton(this.x+0, this.y+1)

  	}
  	
  	if(this.x == 4 && this.y == 2 || this.x == 4 && this.y == 9){
  		this.getButton(this.x+0, this.y-1)
  		this.getButton(this.x-1, this.y+0)
  		this.getButton(this.x+1, this.y+0)

  	}
  	
  	if(this.x == 3 && this.y == 1 || this.x == 3 && this.y == 8){
  		this.getButton(this.x+0, this.y-1)
  		this.getButton(this.x+1, this.y+0)
  		this.getButton(this.x+0, this.y+1)

  	}
  		
	if(this.x == 5 && this.y == 1 || this.x == 5 && this.y == 8){
  		this.getButton(this.x+0, this.y-1)
  		this.getButton(this.x-1, this.y+0)
  		this.getButton(this.x+0, this.y+1)

  	}
  		
		//can only stay in palace / banmatui
  }
}