I want to make a trading card game like Yu-Gi-Oh or Magic. I have a lot of cards in my game and even the user can make new cards. Cards are objects and they have attributes like HP and Mana ,etc but they also has special power which is another object and has different types some of them activate when a card is played into the field, some of them activate at death and etc. One way is simply hardcoding all the different cards in different classes but This way, I cannot implement a user-built card. I am going to use enums for the essential cards but I don't know what to do for user defined cards.

Is there any standard way to implement things like this?

I am very new to Java and OOP. I think maybe Databases could help but I don't know what should I use or search to find the appropriate choice for this matter.

  • \$\begingroup\$ probably a duplicate of gamedev.stackexchange.com/questions/28074/… \$\endgroup\$
    – Linaith
    Apr 19, 2019 at 10:39
  • \$\begingroup\$ We have several questions in the card-game tag discussing strategies for handling this type of modular, special-case card behaviour. Please take a look through our back catalog for some starting points, and feel free to edit your question or post a new one if you find you need something not covered by the existing Q&A. \$\endgroup\$
    – DMGregory
    Apr 19, 2019 at 12:17


Browse other questions tagged .