Skip to main content
deleted 6 characters in body
Source Link
Doc Brown
  • 220.7k
  • 35
  • 410
  • 625

Your initial plan using an Action class looks exactly like the command pattern to me, so if you think this is what you need here, you should try it out.

But that seems like it would be a bit confusing to use,

Why? Having just one public apply method for an action looks like a pretty simple usage scenario to me.

responsibility of applying damage, effects, handling Pokemon fainting, etc. all gets stuffed into those subclasses

Surely not. There is no need to put all that stuff into a single Action subclass. If an Action has lots of things to do, it can delegate that stuff to dozens of other classes, if that is what is required. That way, a Action subclass can also be a facade.

Is the command pattern a good fit for a turn-based game like Pokemon

It might be a good fit for your implementation of the action part of the turns in such a game. But honestly, I can not tell you if it will suit your needs, you need try it out by yourself, see if it works, and if you cannot come up with a simpler solution, then it is probable a good one.

Your initial plan using an Action class looks exactly like the command pattern to me, so if you think this is what you need here, you should try it out.

But that seems like it would be a bit confusing to use,

Why? Having just one public apply method for an action looks like a pretty simple usage scenario to me.

responsibility of applying damage, effects, handling Pokemon fainting, etc. all gets stuffed into those subclasses

Surely not. There is no need to put all that stuff into a single Action subclass. If an Action has lots of things to do, it can delegate that stuff to dozens of other classes, if that is what is required. That way, a Action subclass can also be a facade.

Is the command pattern a good fit for a turn-based game like Pokemon

It might be a good fit for your implementation of the action part of the turns in such a game. But honestly, I can not tell you if it will suit your needs, you need try it out by yourself, see if it works, and if you cannot come up with a simpler solution, then it is probable a good one.

Your initial plan using an Action class looks exactly like the command pattern to me, so if you think this is what you need here, you should try it out.

But that seems like it would be a bit confusing to use,

Why? Having just one public apply method for an action looks like a pretty simple usage scenario to me.

responsibility of applying damage, effects, handling Pokemon fainting, etc. all gets stuffed into those subclasses

Surely not. There is no need to put all that into a single Action subclass. If an Action has lots of things to do, it can delegate that stuff to dozens of other classes, if that is what is required. That way, a Action subclass can also be a facade.

Is the command pattern a good fit for a turn-based game like Pokemon

It might be a good fit for your implementation of the action part of the turns in such a game. But honestly, I can not tell you if it will suit your needs, you need try it out by yourself, see if it works, and if you cannot come up with a simpler solution, then it is probable a good one.

Source Link
Doc Brown
  • 220.7k
  • 35
  • 410
  • 625

Your initial plan using an Action class looks exactly like the command pattern to me, so if you think this is what you need here, you should try it out.

But that seems like it would be a bit confusing to use,

Why? Having just one public apply method for an action looks like a pretty simple usage scenario to me.

responsibility of applying damage, effects, handling Pokemon fainting, etc. all gets stuffed into those subclasses

Surely not. There is no need to put all that stuff into a single Action subclass. If an Action has lots of things to do, it can delegate that stuff to dozens of other classes, if that is what is required. That way, a Action subclass can also be a facade.

Is the command pattern a good fit for a turn-based game like Pokemon

It might be a good fit for your implementation of the action part of the turns in such a game. But honestly, I can not tell you if it will suit your needs, you need try it out by yourself, see if it works, and if you cannot come up with a simpler solution, then it is probable a good one.