This is the state of the question: I want to make differing kinds of material apply to different kinds of items, e.g., iron, mithril, etc., apply both to weapons and armor that are generally made of metal, and leather, dragon-skin, etc., apply to "cloth" armors, and so forth.
I have in place a generic system for applying modifications to objects, but right now I'm trying to figure out what's a good way to mark item types as implementing various materials, and how to represent those materials in terms of code classes.
For example, mithril material can apply to both armor and weapons, but it has to have very different effects for each (should increase the protection value of the armor, but increase the damage potential of the weapon). I could represent this by making two classes MithrilWeaponMaterial and MithrilArmorMaterial, but then marking item types as implementing "metal" materials would become more complicated. Or I could make one class MithrilMaterial, which when called upon to modify protection or offensive values, checks the item to which it is applied to determine the proper effect. This case makes the single class more complicated, and more computationally expensive, but it simplifies the relation between the item type and material classes.
Comments? Questions? Advice?
For those who have implemented some kind of item material system in your own roguelike(s), perhaps you'd like to share a few tips?