Fix to combat filters

Veracity

Developer
Staff member
Revision 17447 was intended to have Batfellow fixes (it did), but I accidentally committed all of my modified files, rather than all-but-one of them. As a result, there is also a fix to combat filters which I didn't mention in the commit comment.

Originally, consult scripts took three parameters:

string round_number
string monster_name
string page_text

Come OCRS, the "monster name" was not adequate: you needed access to the actual "monster" object, complete with the "random_modifers" proxy field. So, we changed the arguments that were passed to consult scripts to be:

int round_number
monster monster_name
string page_text

If you had the old-style parameter list, no problem: the int and monster objects had to_string() applied to them when your function was called and nothing was changed.

Combat filters are documented in the Wiki as "A combat filter function takes the parameters of a consult script, but returns lines like a CCS, not like a consult script." The example shows a function that takes

int round_number
string monster_name
string page_text

And, looking at the code, that is what we passed to combat filter functions. Which is to say, when we made the OCRS fix to consult scripts, we failed to do the same for combat filter functions.

Revision 17447 fixes that: your combat filter function can now be declared to have a "monster" parameter and it will get the specific monster that you are fighting. (You could have declared it as a "monster" before, but it would have applied to_monster() to the monster name, and you would have gotten the generic monster, not the specific one you are battling.) So to be clear, combat filter functions now take the identical parameters as a consult script:

int round_number
monster monster_name
string page_text
 
Top