Mod monster flags

Implements John's idea from #7265 as a Lua filter instead of as monster overrides.  We're going to need this anyway for any AI code that gets implemented in Lua.