-
Notifications
You must be signed in to change notification settings - Fork 787
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Rework BatchGameEvent and subclasses to deduplicate code and logic #11985
Comments
Batch events should be as different as possible from normal events. It's important to use different logic for cards:
No needs to simulate single event methods in multiple events (example: getTargetId for events with same target) -- that's why I recommended to rename it in related PR. So:
|
I think i understand what you're saying @JayDi85 but just making sure: It sounds like you're saying this is the hierarchy we should pursue:
Though i'm not sure what your point 3 is saying--that Cause if we're just going to do that, and these classes will be similar enough, i guess we wouldn't need the specific classes at all and just use generic |
How about a boolean parameter in the abstract |
Yep. I don't like all that intermediate classes at all. But it required here to extract some shared code for single and multiple methods/checks. It's not such a big deal to find an ideal refactor -- just use it as you want. The most important thing -- remove all buggy group events and replace it by batches (looks like only ZONE_CHANGE_GROUP left). |
Currently
BatchGameEvent
is just an interface with two methods.However, the batch events that implement this interface use the same logic for the methods and also duplicate code for supplying and overriding other methods.
I propose making
BatchGameEvent
a class implementation extendingGameEvent
and including all the logic common to batch events.A separate but related problem is
DamagedBatchEvent
which currently includes both general batches (any target/source) and batches where all events are associated with the same target. Since these have different usage patterns it might be sensible to separate that out as well.That would give us something like this:
Related: #11974 , #11841, #11961, #11943 , #11943 (comment)
Comments welcome @JayDi85 @jimga150
The text was updated successfully, but these errors were encountered: