If a capacitor is discharging, current exits the more positive terminal rather than entering. That's really all there is to it. When current enters the more positive terminal, power is delivered to the capacitor and, thus, the stored energy increases.