1
\$\begingroup\$

I'm developing a small Java digital card game project. In my game, players can perform skills when using cards. Each skill does different things, like deal damage, heal etc.. I'm looking for a way to program those skills into the game.

I saw an answer to a similar question online mentioning "Strategy Design", and thus I found out about the world of Design Patterns.

Because of the sheer amount of different design patters out there, I was hoping someone could recommend me an appropriate design pattern for achieving the above. Would Strategy Design suit my needs, or is there a better choice?

Thank you.

\$\endgroup\$
  • 1
    \$\begingroup\$ You might find past Q&A relating to buff/debuffs and TCG card abilities useful for making inroads here - I listed out a whole pile in the Meta thread at that link. There's rarely a single pattern that's objectively "most suitable" - a lot of it comes down to your personal style and choice of approach. After reading these past examples, you might get a more concrete idea you can use to focus your question on a specific problem to overcome, or a gap you need to clarify or fill in. That tight focus can help you get better answers, faster. \$\endgroup\$ – DMGregory Mar 27 at 22:09
  • \$\begingroup\$ Do you only have game mechanics where cards only do something instantaneously the moment they are played? Or does it get more complicated, like with cards which stay in play and even affect the core mechanics of the game while in play? We got a lot of questions already which deal with more complicated situations (which can be a software architecture nightmare), but after some searching I in fact think we don't have a question about the basic situation yet. \$\endgroup\$ – Philipp Mar 28 at 10:36
  • \$\begingroup\$ @Philipp They're used instantaneously, and work once before they're removed. E.x: Fireball card decreases HP by X from target. Heal card heals target +X hp.. \$\endgroup\$ – uchi23 Mar 28 at 21:46

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.