How could I "DRY up" this repetitive-parameter code? + am I doing something questionable
intermediateadvanced
I'm trying to use an event-based solution to implement the rules of my turn based combat game, which is also expandable as there will be items that will mix up their effects among all the baseline fundamental ones. This is exactly the reason I think events are advantageous, I would just call the correct "Occur" method on the broker from the part of the code where the event occurs (such as after a Player has finished attacking) (is this a good idea or is there a far better alternative? I'm scared of the coupling at seemingly random points throughout the code with this and local-class-based events would complicate the system a lot more). Although there are two caveats and one is order of operations, as you want fundamental rules (here called GameRules) to have to be invoked at a specific point relative the other rules from expansions; but the worst one has to be the endless repetition of these delegate parameters. Not only are they going to be repeated across "Occur" methods' signatures and calls, and not only are the values within these bodies going to get repeated across multiple event invocations (we're talking as many as 3 for each event in the near future if not more if required), I'll also have to repeat the delegate parameters on the subscribing methods' signatures once I attach them. There has to be a way to "DRY" this that I'm unaware of, right? What would you do. https://paste.ofcode.org/bZrmUYqzLADnfinZFAMFmN