I am making a collectible card game using a command pattern for using card abilities and creating a class for each card text ability. The game is setup to work with an authoritative server structure. I have each cards stat values in a MySQL database. My question is what would be the best way to associate a cards text with the class that executes it?
For example, I have a Card class that pulls card stats from the database for the specific card. I would like to have an entry in the database for each card that determines what ability class the card has. Since, I'm limited to the basic data types in the database I'm trying to find the best way to associate a string or int to a class that executes the cards ability in my code.
My first solution is having each database entry for a card hold a string that holds the code for the class, and compiling that string on the fly. A second solution is having a giant switch statement class that associates each card name with the class of its ability. I feel like there should be a simpler way to get this accomplished though. Anyone have any insights? Thanks