News flash for BatBrain scripters! I have probably broken your script!
I have been increasingly dissatisfied with a few aspects of BatBrain's information. First, HP is a single integer, but player resistances should apply to all incoming elemental damage, not just from the monster. Second, the method of entering spreads into batfactors is too limiting. If something does an unequal amount of physical and hot damage, there has been no way of specifying this in batfactors.
Fixing these has been on my list for a long time, but I finally buckled down and did it. I have entirely reworked a) the way spreads are loaded from batfactors, and 2) the way BatBrain handles HP.
A. All-new Spread Notation
Spreads are now written in batfactors in a single string (rather than the previous two fields) like so:
expression[
types]|
expression[
types]|
expression[
types] [...]
Any number of expressions and associated types may be entered, separated by pipe characters. The final result will be summed.
- expression: the formula to evaluate. This was previously the entire dmg field.
- types: the type(s) of damage dealt, separated by commas with no spaces (e.g. "hot,cold"). This was previously the dmgtypes field. The result of expression will be equally divided among the types entered. If a type is entered multiple times, that type will get multiple shares of the damage. If types is omitted, the damage is assumed to be entirely physical.
Also, another change from before: the names now correspond exactly with mafia's elements, so use "none" instead of "physical".
I believe this is a highly flexible system which should allow us to have much more accurate information in batfactors for all current and future damage-dealers.
2. HP Reworked
This has been a significant overhaul of BatBrain with very minor actual functional change, but I believe the greater accuracy will be worth it in the long run.
In short, HP is now loaded as a spread rather than a float and treated as player damage ("pdmg" for short) rather than HP. This has the following repercussions:
- In place of the previous dmgtypes field, batfactors now has a pdmg field for player damage, which is a spread (same format as just described above).
- Since it now has its own field, HP information is no longer contained in the "special" field in batfactors.
- Important: pdmg is negative for healing, positive for damage to the player -- the opposite of the previous "hp" keyword.
- advevents no longer have an "hp" field.
- advevents now contain a "pdmg" field, which is a spread.
- A new function, dmg_taken(), reduces a given pdmg spread by the appropriate player resistances.
III. What This Means For You
Several important functions have changed. The declarations for
to_event() and
to_spread() are different, for one. Any reference to the
hp field of an advevent will no longer work. Since I feel that this update will likely break most of the scripts currently using BatBrain, I've decided to post this update here first, along with the reformatted batfactors. I'll leave it here for a week before updating in the first post, to give scripters using BatBrain time to prepare for when I officially update the script.
Also, during the overhaul I may have missed something -- a plus which should be a minus or somesuch -- so if you find anything like this I would appreciate your mentioning it here so those transitional bugs may all be squashed before the update goes "public". Enjoy the improved accuracy!
ETA: It has now been a week. BB removed from this post and updated in the first post.