iamjustagamer75 had the same idea as me so I think I can explain it:
AmmoClipSize is your MaxMagCapacity, CurrentAmmo is your AmmoInMag, CurrentMaxAmmo is your TotalAmmo, and AmmoNeededForReload is an entirely new variable composed of the difference between MaxMagCapacity and AmmoInMag. This variable is basically how many bullets you have fired from the magazine. So if your magazine size is 20 and you fire 10 bullets, then when you reload this variable would be a value of 10. Next we check if the TotalAmmo is less than or equal to AmmoNeededForReload. The reason for this check is to see if there are more bullets in the mag than there are in your ammo pool (Say you have a situation where your rifle shows 20/10). If this check is true, then we add the remaining TotalAmmo to AmmoInMag and set TotalAmmo to 0 since we used all of it (Say for our 20/10 example, if you fire all 20 bullets in your mag then you need 20 bullets to reload. Since our TotalAmmo is 10 which is less than 20, we can only add the remaining TotalAmmo to our magazine, thus leaving us with 10/0). Now back to the branch, if TotalAmmo is greater than AmmoNeededForReload we just perform a basic reload where we take how many bullets were fired (AmmoNeededForReload) and remove that amount from TotalAmmo, then set the AmmoInMag to our MaxMagCapacity (So if we have 20/80, and fire only 10 bullets, the AmmoNeededForReload is 10 and after calculations we get 20/70).
Hope this helped and thank you iamjustagamer75 for your work.