1.20 Update For Great Smacking!
Okay, this update to BatBrain was quite big in the number of things that changed, so it took me a while to write up the description. Technically most of these were in the 1.19 update -- the 1.20 update simply added a missing check to avoid submitting an empty queue as a macro. But since that could mean a wasted server hit per fight, I considered it important enough to merit its own update bump.
Here are the rest of the changes from the 1.19 update:
- The big one, of course, was already discussed above: enqueue() and macro() were significantly reworked to get macro information out of the queue. This keeps action id's "canonical" and allowed for two other neat changes:
- 1) A new get_macro() function which returns the current queue as a macro. You can view this as a means of collapsing the queue into a string. If called on an empty queue, returns an empty string.
- 2) Auto-funkslinging has been mostly re-implemented. Yay! Now if you enqueue two consecutive single item actions for a character with funkslinging, the second item will be merged with the previous item in the queue, without adding another round. This is imperfectly implemented at the moment: it fails to account for reduced player damage if the second item stuns or weakens the monster. That's on the to-do list, but this 90% implementation is much better than nothing.
- The Black Cat and O.A.F. sometimes convert skills into regular attacks. Additionally, the Black Cat sometimes blocks item use, and the O.A.F. sometimes converts item use into a regular attack. BB now accounts for this, assuming a 30% chance for all of them. I drew that number out of thin air, since I couldn't find any number given anywhere for this. If you know a better number, please let me know.
- Support for Sick Pythons adding +20 to-hit.
- Skip Bifurcating Blow if you have the effect Foe-Spattered.
- Clumsiness bark does extra damage vs. the Fox in Spats.
- The orange agent is not available without enough meat to fuel it.
- Auto-response added: throw clumsiness bark at the Thorax when he draws his fist.
- Auto-response added: Sing when you get Earworms.
- Streamlined code in multiple places: As cases and checks have gradually accumulated in certain areas, make those more efficient where possible by merging them all under a switch statement. Did this in at least four places, most notably in the responses sections of act() and batround().
- Another speed tweak: Added a "profit" field to advevents. BB now uses this to cache the profit of advevents when to_profit() is called on them. This means that to_profit() -- an oft-used function, especially for sorting opts -- is much less expensive. No pun intended.
- Since BB effectively tracks all actions performed during the combat, use this to detect base pairs thrown at Cyrus and set the tracking property when this is detected, rather than setting it before enqueueing the base pair.
- Only return 50 for items with neither autosell nor historical value. This should help SS with a NPZR not to continue stasising for unreasonably valuable toast, among other things.
- Fix combat completion detection for monsters with no Adventure Again link.
- Significantly improve the sort in attack_action(). I recently tried to do a telescope dive using nothing but my SimpleSmack script, and was quite disappointed by some of the actions chosen by attack_action() when the fights started getting harder. This improved version was usable longer, until I ran into the auto-funk issue. Haven't yet tested again with both this improvement and auto-funk, but excited to do so. My basementing in the early levels (where it would be quite wasteful to funksling love songs) was absolutely perfect! Even its choice of love songs was exciting to see -- sometimes it would switch songs when the monster had enough HP remaining to kill it with a cheaper but less-damage song.
- Some other changes already mentioned in this thread: Parse "perfect" damage even for non-skill actions. Allow macro inserts using global variable "batround_insert". Include an abort for acquiring Amnesia in submitted macros when fighting Protagonists.
And since Bale suggested it here rather than in SS, I'll also explain an SS change:
I didn't change the functionality of
try_custom() or
try_combos(), but I did split them into two parts. So now, for both custom and combos, there are three functions your SS-importing consult script may want to use in its
main():
build_x() -- builds a separate list of events of that type.
enqueue_x() -- according to survival or profitability criteria, enqueue actions from the previously built list, but do not submit the macro.
try_x() -- calls
enqueue_x(), then if there are any actions at all in the queue, calls
macro(). You'll generally want to use either this function
or the previous one.
SS was changed to use these as follows:
PHP:
// custom actions
build_custom();
// snip -- adding Cyrpt miniboss items removed for this post
if (queue[0].id == "pickpocket" && my_class() == $class[disco bandit]) try_custom();
else enqueue_custom();
// combos
build_combos();
try_combos();
First it builds the custom action list, then adds some more custom actions of its own. Then if you are a DB and pickpocket was one of the custom actions, it calls try_custom() which enqueues and then performs all the custom actions. This is because the profitability of Rave Steal or other +items combos may depend on the results of your pickpocketing. If you didn't get the jump or you're not a DB, it simply enqueues the custom actions but does not perform them. Next, it builds the disco combos, then calls try_combos(), which queues up any profitable combos and then calls macro() if the queue contains actions (even for non-DB's). Nice!
I think that will accomplish what you suggested nicely, Bale! Also thanks -- that was a great suggestion towards reducing server hits and speeding up combats.
I'm very happy with this latest update -- I feel that as of 1.20 this script has made leaps and bounds toward becoming the script I envisioned. Enjoy, everyone!