This should be simple enough to code. Every time you discard/salvage, have the program multiply the incidence of each Epic card by zero (you cannot lose Epic cards), the Rare cards by 1, the Uncommon cards by 2, and the Common cards by 4.
That gives you a significantly smaller chance of losing a card you've put time and effort into obtaining, but still makes it possible. It also gives a mechanical reason to stick at least a couple of Common cards in a deck that might otherwise be loaded with Rares.
Yes, but doesn't that mean a player might have to discard cards he or she doesn't even own? I mean if you multiply the cards, couldn't you also draw multiple copies of them? Instead of multiplying, I think the probabilities would have to be weighted based on rarity. Unless that is exactly what you meant by the "multiply the incidence".
I would change the numbers a bit though. Maybe something like..
Common = 9
Uncommon = 3
Rare = 1
I think there should be a bigger gap between common and rare.