shlomif / PySolFC

A comprehensive, feature-rich, open source, and portable, collection of Solitaire games.
http://pysolfc.sourceforge.net/
GNU General Public License v3.0
445 stars 97 forks source link

Cardset format version 7 - cardset subtype and joker deck support #330

Closed joeraz closed 10 months ago

joeraz commented 11 months ago

This is a pretty big refactor, so I'm doing this as a PR. Also, I have some plans to build off this further, so I consider this to be the point of no return for my 3.0 plans (mentioned in ticket #296).

This PR introduces cardsets version 7, which allows the option to have cardset subtypes. This allows more complex rules regarding which cardsets can be used for each game without requiring creating new main types, for cases where the differences between cardsets are minor. For this initial build, I used this to add support for French joker decks. If a game requires jokers, it must use a deck that contains jokers, but if the game does not require jokers, it doesn't matter whether the deck uses them or not. I do not want cardsets to require jokers, as this would render most of the old cardsets incompatible. This is done by making a French joker deck as a subtype.

I feel this is a little hacky in a couple places - most of this is where I was trying not to break existing options config files or cardsets.

I also changed the way Mahjongg cardsets use version 6, so version 7 cardsets aren't forced to use one set of 3D Mahjongg placement logic.

Attached is a copy of my Neo cardset updated to version 7, with jokers added. Anyone who wants to test can use this to do so. I've also found the matching jokers for many of the existing cardsets and will add them to the cardsets repo when I update those to version 7 later.

I added the game "Thieves" to help test this. Thieves is a variation of Golf from Gnome AisleRiot that implements the jokers, which are wild cards (they can be played on any card, and any card can be played on them). I may rename this game "Joker Golf" later (leaving "Thieves" as an alternate name), depending what other joker deck games we add later.

cardset-neo.zip

joeraz commented 11 months ago

I'll give this another week or so, then I'll merge if there aren't any objections by then.

joeraz commented 10 months ago

Since I haven't heard any objections, merging.