You would probably have to add a column to your cart like: "DiscountApplicable" and set it to 0 or 1 in the add to cart depending on whether that item would be discounted or not.
Then create a calculation:
AmtDiscounted = [TotalPrice] * [DiscountApplicable]
Then you can base the discount on the AmtDiscounted total instead of the subtotal and it won't discount items when the discount isn't applicable.