How to add a trait that seeks flags in items

Hopefully that title isn’t too herpderp, I’m trying my hand at a mod for the second time and want to actually do something.

Basically, I’m looking to create a flag that I can add to weapons and clothing to give a morale boost to the character that has the matching trait. How would I go about that? I can make my own .json files but I can’t figure out where the mutations (or almost anything) draws the flags from. Any help? I also don’t want to give too much away with what I’m doing.

Sadly a lot of the mutation properties are still hard-coded, so expanding on this would require source tweaks.

For an example, player.cpp in the source checks for mutation “WOOLALLERGY” during the code for equipping clothes.

Most of those should be hardcoded in player.cpp.

Whether you’re making an ability like Stylish or one like Gourmand, both should be implemented mostly (if not totally) in player.cpp.

EDIT: You could also try implementing it in lua, depending on what you’re trying to do.