Is there any way to apply a quantity discount to items in the same category ?

For example:

Apply a discount if the customer buys 2 different T-shirts within the same category "clothes".

Not applicable if you buy a shirt and pants into the same category clothes.

Thank you !!