So after a good deal of work, I have a basic SRPG style battle system up and running. I have characters and enemies (no AI yet) that take turns. They can move around and perform basic attacks. I'm reasonably happy with the way I have the system laid out behind the scenes, which I'll detail in as concise a way as possible, and then get to my question:
- I have a Battle_Controller class which handles input, both from keyboard and mouse events (in SFML), and from GUI events.
- I have a Battle_Map class which handles the map itself (tile map).
- I have a Battle_Manager class which handles the battle in different ways. It maintains an std::list with the turn order, it activates the character or enemy whose turn it is, and theoretically, it should provide the interface through which the various units on the battlefield interact. Currently, there is an attack method that takes an attacker and defender and resolves the attack.
- Finally, I have a Character class and an Enemy class, both of which derive from an interface called iUnit (which would also be used for neutral characters, AI controlled allies, etc). They are primarily collections of data and don't actually "do" anything on their own.
So with that in mind, I've started to think about how I might integrate skills and what not. The thing is, attacking is easy, since all the access I need is to two units on the battlefield. I pull statistics from those two units, perform some calculations, and assign damage as needed.
But for a game where I want to put a great deal of emphasis on a wide variety of special skills, I'm having trouble planning out how to implement a robust and extendable system. For one thing, just off the top of my head, I want to have spells that alter the terrain, so I'll need a pipeline to alter the tiles in the Battle_Map. I want buffs and debuffs that work for some number of turns, so I'll have to have a way to maintain those counters somewhere. I mean, ultimately the problem is that various skills, spells, and abilities will need to potentially have access to just about any data that relates to the battle (and, in some cases, maybe some outside battle data as well). I'm not sure how I can achieve this while still maintaining some semblence of decoupling.
For a second thing, I'm kind of wondering where and how I should specify who has access to which skills, and further, where I should define what skills do what. My tentative plan is to have characters and enemies and so on maintain a simple std::vector<bool> skills which will have as many entries as there are total skills in the game. So, say skill #5 is fireball, a character who can cast fireball would have a skills entry which evaluated as true where a character who couldn't would have skills evaluate as false. Its not exactly elegant, but I think it would work.
But then the problem is, I'll have to define what these skills actually do somewhere. Maybe a dedicated class that just has skill related methods (one method per skill in the game)? That could be huge and unweildy, but I think it would work...
Ultimately, I'm just having trouble envisioning how all these things should work together on a conceptual level. This is a technical question, but I'm not looking for very specific code advice, just a general overview of how these things are usually done.