Quote:
Originally Posted by Throag Seems like you are trying to hard code a lot of stuff Vinen.
What you are trying to do could be defined as behavior for each character.
This behavior could be an attribute of your Character class, and at each frame your game engine would iterate over all your Characters who would in turn process their behavior.
You could have a BasicBehavior class which would be responsible for the basic behavior of a character during battle (whatever that it is you define as "basic"). That class would be the default behavior attribute of a character. And then you can have as many class as you want inheriting from BasicBehavior to implement more specific behaviors such as the one you explained.
This way you can define as many behaviors as you want and change them whenever you want. You could also manage them through a BehaviorManager singleton class which would return an instance of a behavior class on demand.
You could also define your behaviors in a way that allows a Character to have multiple behavior and process them all at each frame. There are a lot of ways to improve that idea 
When designing game mechanics like these, you should always try to think them as evolutive as possible. It saves a lot of work for later when you are trying to change stuff. |
I'd have to agree. That sounds like the decorator pattern to me. There are a lot of design patterns that can be applied to gaming. State pattern, command pattern and factory pattern are just a few that come to mind. I highly recommend Head First Design Patterns
Amazon.com: Head First Design Patterns (Head First): Elisabeth Freeman,Eric Freeman,Bert Bates,Kathy Sierra: Books
It has a nice casual tone to it, and it is real easy to follow.