Have rewritten the nameProc function to eliminate hard-coding the affix type values. It now constructs them based on the nameOrdering field in the affix types: first two are for adjectives before the first noun, second two are for adjectives before the second noun, and everything else is ordered after that for suffixes.
Still fairly heavyweight in code, so added a cachedDescription field to item that can store the results. The name can then just be rebuilt from that plus the quantity. Need to consider how to handle mutating the 'state' adjective (modAdj1, affixTypes[0]) in a callback. Anything that goes beyond that (eg: experience for weapons changing their powers) should just clear the cachedDescription to force a recalculation.
Finally got the list working for AFFIX_TYPES. Figured out that the reason you didn't need to use the 'global' keyword in the original code was that you were just mutating collections, not setting them, whereas my list comprehension was setting the variable directly. Changed code around and now it works.
Still fairly heavyweight in code, so added a cachedDescription field to item that can store the results. The name can then just be rebuilt from that plus the quantity. Need to consider how to handle mutating the 'state' adjective (modAdj1, affixTypes[0]) in a callback. Anything that goes beyond that (eg: experience for weapons changing their powers) should just clear the cachedDescription to force a recalculation.
Finally got the list working for AFFIX_TYPES. Figured out that the reason you didn't need to use the 'global' keyword in the original code was that you were just mutating collections, not setting them, whereas my list comprehension was setting the variable directly. Changed code around and now it works.
Comment