I asked else where on other websites for this and never got answers, I am struggling to know how to do a design pattern for abilities that you can swap in and out that affect the given object's stats.
Lets take a weapon like a gun as an example. Of which can have a number of attachments that affect its aim, fire rate, magazine count etc. You can add/remove the attachments.
I can setup something like that pretty easily (although its very tedious) by creating each attachment and setting its data to what it affects. But then i ran into problems for putting restrictions in place, because then i need a unique one for each weapon they are restricted to. For example:
Scope A only attaches to gun A , C, D
Magazine A attaches only to gun B , C
When i have these specific restrictions - my tedious approach of hard writing it kinda falls apart. So i need a design pattern where this will work easily.
What is the correct way to design this in C# ? I can't figure out a clean system for this at all.