extends Rule

static func ready(piece: Piece):
	pass

static func select(piece: Piece, game: Game):
	
	var pos = piece.to_coord()
	var board_size = game.get_node("Board").board_size
	piece.possible_movements = []
	
	# alle felder nach links:
	for x in range(pos.x+1, board_size.x, 1):
		var move = Vector2i(x - pos.x, 0)
		var other_piece = game.get_piece_at(move+pos)
		if other_piece:
			if other_piece.is_in_group("Enemy"):
				piece.possible_movements.append(move)
			break
		piece.possible_movements.append(move)
	
	for x in range(pos.x - 1, -1, -1):
		var move = Vector2i(x - pos.x, 0)
		var other_piece = game.get_piece_at(move+pos)
		if other_piece:
			if other_piece.is_in_group("Enemy"):
				piece.possible_movements.append(move)
			break
		piece.possible_movements.append(move)
		
	for y in range(pos.y+1, board_size.y, 1):
		var move = Vector2i(0,y - pos.y)
		var other_piece = game.get_piece_at(move+pos)
		if other_piece:
			if other_piece.is_in_group("Enemy"):
				piece.possible_movements.append(move)
			break
		piece.possible_movements.append(move)
	
	for y in range(pos.y - 1, -1, -1):
		var move = Vector2i(0,y - pos.y)
		var other_piece = game.get_piece_at(move+pos)
		if other_piece:
			if other_piece.is_in_group("Enemy"):
				piece.possible_movements.append(move)
			break
		piece.possible_movements.append(move)
		
	for move in piece.possible_movements:
		pass
		
	pass

static func before_move(piece: Piece):
	pass
