Updated card accumulation logic.

Now differentiates between cards gained for self and cards that are
gained through the play of others.

Updated goals to use the appropriate logic. Past goals will need to be
recomputed in the database.

Also cleaned up some pylint warnings/errors and added test cases for
the logic this touched.