Feature - Implemented Allow integers in effect()

zarqon

Well-known member
When checking for effects using modifier_eval(), the effect() function is quite handy.

It would be much more handy, however, if it allowed us to use integers instead of the effect name, i.e. use "effect(1418)" instead of "effect(Glorious Blessing of the War Snapper)".

It would also avoid problems with strange characters in the name. For example, there are currently 9 effects with parentheses in the name.

> ash modifier_eval("effect(educated (kinda))")

Expression syntax errors for 'modifier_eval()':
Expected end, found )

In my particular case, it would also help me parse my data files more easily. Since effect() is currently the only thing introducing spaces to my damage formulae (which are written as <damage formula> <damage types>), I'd appreciate being able to eliminate the spaces from the formulae by specifying effects as integers.
 

Darzil

Developer
r15372.

Allow expression effect(effectName) to also use effect(effectId). Note that this is converted internally to name as we don't use IDs as unique identifiers in mafia at present. So you may get some unexpected results if you use effectId to specify an effect whose effectName is not unique.

We probably should use effectId internally, and list modifiers by effectId, itemId, skillId etc but that'd be a very non trivial rewrite!
 

zarqon

Well-known member
Thanks Darzil! This saves me from having to reformat the data and edit all the damage entries in batfactors. *phew*
 

Veracity

Developer
Staff member
We probably should use effectId internally, and list modifiers by effectId, itemId, skillId etc but that'd be a very non trivial rewrite!
Considering they are overlapping sets of integers and integers are completely unreadable to tell humans exactly what they are looking at (see my recent change to familiars.txt to have the hatchling item name, rather than itemId), it's not obvious that "listing modifiers by id" is a good idea - although I don't immediately have a better idea to achieve the same effect.

Perhaps the equivalent of what we do with the "A Little Bit Evil" status effect, which has 6 different effect IDs which we map in to "A Littel Bit Evil (Accordion Thief)" and so on, even though KoL itself does not so-distinguish them.

I.e., refactoring how we handle duplicate names for items, effects, skills, familiars, etc., somehow. Sort of like how the Wiki needs disambiguation pages.
 
Top