(Apologies if this sort of question should instead go on Code Review.)
I'd like to know the best way to augment an enum with additional information. The specific case is that I'm working on a game where I have an enum representing a type of Infliction, which could be physical, magical, or status related.
For example:
enum InflictionTypes { Pierce, Slash, Bruise, Heat, Shock, Cold, Metal, Salt, Wet}
In some places my combat system treats these all the same (e.g., how various armors or protections work). But in other places the combat system needs to treat them differently (e.g., the actual effect they have if they get through the armor.) So I need some way of discriminating among the kinds and am running into the limitations of Enums.
If it were possible to create a hierarchy of enums, I could do that---have a "base enum" of InflictionTypes and "derive" from that to have individual kinds. But obviously this is madness.
Alternatively, if it were possible to embellish an enum with some other piece of information, that would work, but enums obviously do not hold fields.
I'm considering a few possibilities:
Possibility A: Create a decorator class
I could make a class that holds the enum as a field and holds the other information (possibly another Enum: InflictionOutcome) as a field, property, or method. I would use a static constructor to initialize a private dictionary used to provide the information.
One mild negative with this option is that in general it may difficult to find a good name capturing the meaning of this class, which essentially has the same purpose as the enum it decorates. (In this case "Infliction" is not particularly good, as that would represent the combination of this InflictionType with some other information.)
Possibility B: Create an Enum Extension Method
Another option would be to write an extension function for the enum to provide the additional information. Codewise this seems inelegant because the extension method would either be along switch statement or require generation of the lookup dictionary inside the method.
Possibility C: Don't use an Enum
Self-explanatory. Given how this information is used in other parts of the code, it would be pretty unfortunate not to be able to have an enum.
I'm wondering if there are better options; it seems there should be.