fix energy and magic replenishing bug