YgoMaster
YgoMaster copied to clipboard
Implemented random deck selection in place of null decks
Starting a game with null decks is not naturally possible now. Instead, the default value is a random deck, which can be configured to be valid or not.
Still, games can have null decks if the user decides that the random deck must be a valid one but no valid deck is found. A message indicating that no valid decks were found will be logged to the console.
Also took the liberty to move the 'Extras' duel buttons to the 'Decks' label since they were all deck-related and the 'clear selected' button was convenient to go back to a random deck.
Preview of the duel screen with changes:
That's great. But I imagine most people's deck lists are either very messy with multiple copies of the same decks or very minimalist with not enough variation to create good random duels.
I think a better way to do it would be using a folder picker. The current Load deck from file
option could be renamed to Load deck from
and given 3 options:
- Game
- File
- Folder (random deck)
Then use a FolderBrowserDialog
to select a folder. Once you have the folder path you can use the folder name as the name of the deck. e.g. I select a folder named AI Decks
and it would be displayed as Random (AI Decks)
.
In DuelSettings.cs
you'd add an array of strings called something like RandomDeckPaths
which would be the same array size as Decks
. These would contain the folder paths for the decks. Then where you put your previous loop validating decks you'd instead simply check against RandomDeckPaths
to see if it's non-null and load a random deck from that folder if the folder still exists.
In terms of then saving the random deck paths which would occur when using the save UI option you'd want to validate the deck paths are relative sub folder paths to the game install. If they are not in a sub folder of the game install you'd want to null them out. This is to prevent leaking personal info if the file is saved / shared. When loading the settings from a file you'd also need to validate the folder exists for the given relative path, if not null it out.
No worries if you don't want to take this task on. I think random decks in general are a pretty good idea and would be a nice addition.
Has this been merged, and is the idea of Loading from a folder currently being worked on?
EDIT: Based on the code and on the state of the latest release, I'm inclined to say that this hasn't been merged.
I'll probably have a go at implementing loading from a folder at some point if this PR doesn't get those additions. No ETA though.
I would help out, but I'm not confident I can do this any faster than you would. Well, you guys can let us know when and if you start something. That way, if it hasn't been done by next year, I might find some time then.
Implemented the folder selection method in https://github.com/pixeltris/YgoMaster/commit/ab7745d7ce83f80f189b9a364af864505a6fd4df