Since all of the code is using variables named yourHand and opponentsHand, once you make a copy of each to yourOriginalHand and opponentsOriginalHand, the original arrays are left alone with the existing code running as usual against yourHand and opponentsHand. Then after the win but before the card exchange/take you can copy yourOriginalHand and opponentsOriginalHand over yourHand and opponentsHand and then the hands are correctly set up for the card exchange/take.

A couple of lines of code after card selection and a couple at game conclusion and hopefully it works.