0
\$\begingroup\$

I'm working on the implementation of a turn-based board RPG (like Descent: Journeys in the Dark) to improve my C++ skills and learn something about game-dev.

I have already done with general stuff, like Heroes and Monsters, their common action (move, attack) which they can do every turn. Now I want to add some skill system, and I'm not quite sure how to do it. I'm thinking about some skills that can be used after particular action is done (e.g. 'after attack dices are rolled, add +X to damage' or 'after another hero is revived, recover X HP'), some of those skill hero can gain by leveling up or with some item, but I don't know, how to implement this kind of skills. Maybe adding a checking for a game state could be a good idea, but that leads to tens of different options and doesn't look like efficient way to implement.

Could anyone please help me?

\$\endgroup\$

closed as too broad by Philipp, Engineer, DMGregory, Gnemlock, Vaillancourt Jul 10 '17 at 10:37

Please edit the question to limit it to a specific problem with enough detail to identify an adequate answer. Avoid asking multiple distinct questions at once. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

1
\$\begingroup\$

From the question it is unclear if your using an existing engine or building your own thing so I will try to keep this generic.

I would approach this by making a system that is data driven so that it can be reused and changed as needed. This would consist of an interface that defines what the skill affects (stats, appearance, etc), when the skill should take place (before action X, after action X, etc.), and a check for the skill that returns true when the skill finishes. Then you keep a collection of all the skills that a character has. You then iterate though the collection and ask if the skill should take effect, then once it does you check when the skill finishes you remove the modifiers that the skill is responsible for.

You could extend this to trigger visual effects and all sorts of stuff.

I hope this is what your looking for or at least close enough so that you can apply the idea to your specific use case :)

\$\endgroup\$
  • \$\begingroup\$ I don't use any engine, just C++. So, your suggestion means I have to iterate through the collections after any actions is done? If yes, I allow player to use it if he wants to, is it right? \$\endgroup\$ – Misha Zelenskyy Jul 7 '17 at 12:03
  • \$\begingroup\$ Well you don't necessarily HAVE to iterate, you could have a manager class which asks a skill when it needs to be applied then you tell the manager class what has happened and it will take care of the rest. The manager could ask each skill when it needs to be called at startup and maintain a list of skills for each possible trigger then call each skill one by one once the manager has the specific condition for a set of skills to be activated. The lists are probably just a list of pointers to the skill objects of a given entity in order to conserve resources. \$\endgroup\$ – user3797758 Jul 7 '17 at 13:11
  • \$\begingroup\$ If this answer solved your issue then please select this as an answer that way we both get points on the site :) \$\endgroup\$ – user3797758 Jul 7 '17 at 15:26

Not the answer you're looking for? Browse other questions tagged or ask your own question.