BatBrain -- a central nervous system for consult scripts

Hey DestroyAllMonsters.ash just used zombo's empty eye against the naughty sorceress. :|
 
Last edited:
Hey DestroyAllMonsters.ash just used zombo's empty eye against the naughty sorceress. :|

Mine just used it repeatedly for 30 rounds (not against the NS) which is also not as useful, but at least I still got to keep it... :)
 
Seeing this as a problem in DAM, but it's due to BatBrain. When DAM checks how many rounds it will take to kill a monster using my (unarmed, but Master of the Fist) attack, it thinks it will take 9 rounds. In actuality, I one-hit them. Believe this is due to BB not adding the +20 (or whatever it is) to the muscle calculation.
 
The lack of knowing that you can hit unarmed is a known bug with BatBrain. zarqon diagnosed this some time ago when he discovered that boolean_modifier("Unarmed") doesn't mean what he thought it means. Sadly he hasn't updated BatBrain with that bugfix yet.

go to line 644 and replace the offending boolean_modifier("Unarmed") with:
equipped_item($slot[weapon]) == $item[none] && equipped_item($slot[offhand]) == $item[none]
 
I changed that long ago.

I believe you discovered the mistake only a few days after the last update (the same update where you were so happy to have just discovered the boolean modifier in question) so it was quite a while ago, but you were reluctant to release twice in such quick succession.

I guess you simply forgot that it wasn't fixed since your copy was only broken for a very short time.
 
Just spotted a new BatBrain bug. Master of the Surprising Fist improves hit chance of skills like Kneebutt, Thrust-smack, etc.

Obviously it isn't hard to fix, so please include this in the next release of BatBrain since barehanded Kneebutting and thrust-smacking is catching on as an optimal fighting style. I needed to make this change to BatBrain before DAM would start doing that.

Right now my hitchance() looks like this:

Code:
float hitchance(string id) { 
   if (id == "jiggle") return 1.0;
   if (have_equipped($item[operation patriot shield]) && happened("shieldthrown") && !happened("shieldcrit")) return 1;
  // cunctatitis blocks 50% of everything, black cat blocks 50% of items/skills
   float through = 1.0 - 0.5*to_int(have_effect($effect[cunctatitis]) > 0);
   if (id == "attack") through *= 1.0 - fumble_chance();
    else if (my_fam() == $familiar[black cat]) through *= 0.5;
   [COLOR="#FF0000"]float attack = my_stat(current_hit_stat().to_string()) + ((equipped_item($slot[weapon]) == $item[none] && equipped_item($slot[offhand]) == $item[none]&& have_skill($skill[master of the surprising fist]))? 20: 0);[/COLOR]
   matcher aid = create_matcher("(attack|use|skill) ?(\\d+)?",id);
   if (aid.find()) switch (aid.group(1)) {
      case "attack": break;
      case "use": return (contains_text(to_string(m),"Naughty Sorceress") || m == $monster[bonerdagon]) ? through*0.75 : through;
      case "skill": if (contains_text(to_string(m),"Naughty Sorceress") || m == $monster[bonerdagon])
         through *= 0.5;
         switch (to_int(aid.group(2))) {
            case 0001: case 2003: case 7097: break;  // beak, head, turtle*7 tails all have regular hitchance
            case 7010: case 7011: case 7012: case 7013: case 7014: attack = 10;  // bottle rockets are mox+10
            case 7008: attack += my_stat("Moxie"); break;             // moxman
            case 1003: if (have_skill($skill[eye of the stoat])) attack += 20;   // ts
            case 1004: case 1005: if (my_class() == $class[seal clubber] && item_type(equipped_item($slot[weapon])) == "club" &&
                        weapon_hands(equipped_item($slot[weapon])) == 2) return through;    // lts
                    if ($ints[1003,1004] contains aid.group(2).to_int()) break;
                    if (have_skill($skill[eye of the stoat])) attack *= 1.25 + 0.05*to_int(my_class() == $class[seal clubber]); break;
            case 2015: case 2103: attack = my_stat("Muscle") + 20; break;    // kneebutt & head+knee
            default: attack = 0;
         }
   }
   return attack == 0 ? through : min(critchance() + (1.0 - critchance())*max(6.0 + attack - max(monster_stat("def"),0),0)/11.0,1.0)*through;
}
 
Last edited:
Thanks Bale. That's also fixed me-side now.

I believe the familiar who wears the pants in the family is finally getting spaded enough to be added to batfactors. I'll make every effort to get to that this weekend, and post up a spangly new update.
 
Thanks Bale. That's also fixed me-side now.

It seems that slyz also reads this thread since he just made this commit:

For unarmed characters with Master of the Surprising Fist, take into account the +20 to-hit in the Location Details and in the ASH function buffed_hit_stat().

This allows players to auto-adventure with "attack" as their combat action in zones where they wouldn't be able to hit anything without Master of the Surprising Fist.

by slyz on 2011-11-21 19:52:55

Yeah, that should simplify things a lot...
 
No, because BatBrain doesn't use buffed_hit_stat() -- it uses numeric_modifier() to allow for speculation. Keep the change.
 
It seems that slyz also reads this thread since he just made this commit
I just made this commit because I couldn't autoadventure with "attack" as my combat action.

I did check if any of the scripts I downloaded used buffed_hit_stat() though (I have a folder where I download most of the scripts posted here). Only a couple did, and the change always made sense.
 
BatBrain really needs to be predictively smarter about the limited availability of actions. Are there any skills/items which are hard-limited to X per combat, where X > 1? So far I can't think of any besides Consume Burrowgrub, and that's a daily limit, not a per-combat limit.

I'm thinking to rework the happenings bit so that rather than using custom keywords for everything, canonical names will be used where possible (such as "skill 70" or what have you). This plus a new keyword in batfactors should help BatBrain be a lot smarter about knowing when actions are not available anymore to enqueue.
 
Chilled Monkey Brain will stun the first time it is used in a round, but successive uses will only damage the opponent.
 
Such as the gnomitronic demodulator, or whatever it's called... only usable once per combat, but SS keeps trying to use it to stasis since it does <7 damage.
 
Back
Top