SmartStasis -- a complex script for a simple CCS

It's update day -- ZLib, Registry, SS, and Batbrain all get to see updates today.

BatBrain now has its own thread. Right now, the first post is still a bit of a placeholder in some ways. You can expect an outlining of the useful functions, and (as StDoodle has campaigned for several times) a description of the data file format and its keywords, so you can add new content or fix old content yourself, if my update schedule is too slow for you (it's likely; I'm an early adopter of new ASH functions but a late adopter of new KoL content).

There were some pretty big changes to this BatBrain update. I don't believe the poisoning issue was entirely squashed, but I believe we have squashed our way past the obvious bit so that the more subtle bit will be easier to find. More excitingly, BatBrain now tricks itself into thinking your entire queue of actions has already happened, which is very useful for predicting outcomes -- particularly for deleveling actions, which have to be applied in series rather than cumulatively. Read more about it in the BatBrain thread.

I also spent some combats at high verbosity and found some repeated messages unhelpful, so I changed some of the printed output to look a little more organized at high verbosities. Also added a few more high-v print statements to help people determine what section of the script bugs might be happening in.

SmartStasis 1.3 Update

DB Combos were (yet again) refactored. This time they take advantage of BatBrain -- they use merge() to combine the advevents, and they use BB's new predictive adjustment to decide when a combo is safe to cast. It's rather lovely, I dare say.

Possible profitable combos are cast back-to-back in a single macro, not one-by-one in separate macros. For castle farmers with Rave skills, this will significantly speed things up. Again, this was enabled by BB's new predictive abilities. Rave Steal also now accounts for a definite grab from remaining unconditional drops (finally!), plus it will properly value goals as worth significant risk.

I also realized that I had meant to normalize the script settings that are lists of monsters, since the functionality for that was added to ZLib long ago. Did that; and then removed all the to_lower_case() bits from the comparisons since they were no longer needed. Everyone updating this will probably get to watch their ftf_olfact setting (if not others) get normalized the first time it runs. Fun!

And now, I really need to get to bed. Goodnight!
 
thanks for all the suggestion for autoputtying goth giants.
I'm using Slyz suggestion and that works like a charm.
 
Hmm.......seems to be a problem coping with situations where salve restores less damage than I'm taking. If it moved on to the wave/geyser part of my CCS, all would have been well.

PHP:
Encounter: Alphabet Giant
Round 0: panama joe loses initiative!
Round 1: alphabet giant takes 3 damage.
Round 1: alphabet giant takes 3 damage.
You lose 43 hit points
Round 1: panama joe executes a macro!
Round 1: panama joe casts SAUCY SALVE!
You gain 12 hit points
Round 2: panama joe executes a macro!
Round 2: panama joe casts SAUCY SALVE!
You gain 12 hit points
Round 3: panama joe executes a macro!
Round 3: panama joe casts SAUCY SALVE!
You gain 11 hit points
Round 4: panama joe executes a macro!
Round 4: panama joe casts SAUCY SALVE!
You gain 10 hit points
Round 5: alphabet giant takes 2 damage.
Round 5: alphabet giant takes 5 damage.
You lose 44 hit points
Round 5: panama joe executes a macro!
Round 5: panama joe casts SAUCY SALVE!
You gain 14 hit points
Round 6: alphabet giant takes 2 damage.
Round 6: alphabet giant takes 5 damage.
You lose 45 hit points
Round 6: panama joe executes a macro!
Round 6: panama joe casts SAUCY SALVE!
You gain 14 hit points
Round 7: alphabet giant takes 1 damage.
Round 7: alphabet giant takes 3 damage.
You lose 44 hit points
 > You've had the crap beaten out of you... attempting to find some more crap.
 
That's not enough information to even guess what's going on. Please show that happening with higher verbosity. I suggest 7 or 8.
 
For that matter, turning on all the other things (except for reversed adventure count) in the main logging section in the preferences wouldn't be amiss either... from the looks of things, you have a familiar, and it's doing things... but what it's doing? What kind is it? How heavy? Who knows... but SS cares deeply about those things, and everything else affecting your circumstances...
 
I think I can provide more info on jwylot's bug report. I'm running into what I assume is the same issue.

The executive summary is this: I'm using a Snow Angel, so SS wants to stasis. However, it is doing stasis and keeping it up in dangerous areas where stasising keeps getting me beat up. Just noodling (yes, I checked I have it trained) then moving to the attack line in my CCS would be safer but SS is being too risky. I tried increasing the threshold variable but I got the same effect at a silly value of 35.

These examples are as a level 7 PM so I'm pretty squishy. Both start with full HP of 43.

Here's some combats.

Verbosity 8 for a quick overview. As you can see, SS does stasis for two rounds with no noodles and I get promptly beat to a pulp.
Code:
[699] Defiled Nook
Encounter: toothy sklelton
Strategy: C:\Users\Eszetela\Documents\My Dropbox\KoLmafia\.kolmafia\ccs\farm.ccs [default]
Round 0: edfox wins initiative!
1 MP costs 6.451613 μ.
1 HP costs 1.9354839 μ.
loose teeth (20.0 @ +7.0): 17μ * 21.4% = 3.6379998
loose teeth (20.0 @ +7.0): 17μ * 21.4% = 3.6379998
skeleton bone (20.0 @ +7.0): 35μ * 21.4% = 7.49
bone flute (10.0 @ +7.0): 125μ * 10.7% = 13.375
loose teeth (20.0 @ +7.0): 17μ * 21.4% = 3.6379998
loose teeth (20.0 @ +7.0): 17μ * 21.4% = 3.6379998
skeleton bone (20.0 @ +7.0): 35μ * 21.4% = 7.49
bone flute (10.0 @ +7.0): 125μ * 10.7% = 13.375
Monster value: 143.14
Profit per round: ActionProfitDamageOtherbase; Snow Angel (0μ)-11.8μ0 (5.69) Actual: 5.69 (0 MPD)MP: 5.69
Round 1: edfox executes a macro!
Round 1: edfox uses the fat stacks of cash!
You lose 26 hit points
Round 2: edfox executes a macro!
Round 2: edfox uses the fat stacks of cash!
You lose 28 hit points

Requests complete.

You've had the crap beaten out of you... attempting to find some more crap.

Verbosity 10 with everything turned on (thanks Theraze)
Code:
[698] Defiled Nook
Encounter: toothy sklelton
Round 0: edfox wins initiative!
 > 1 MP costs 6.451613 μ.
 > 1 HP costs 1.9354839 μ.
 > loose teeth (20.0 @ +7.0): 17μ * 21.4% = 3.6379998
 > loose teeth (20.0 @ +7.0): 17μ * 21.4% = 3.6379998
 > skeleton bone (20.0 @ +7.0): 35μ * 21.4% = 7.49
 > bone flute (10.0 @ +7.0): 125μ * 10.7% = 13.375
 > Value of stat gain: 115μ
 > loose teeth (20.0 @ +7.0): 17μ * 21.4% = 3.6379998
 > loose teeth (20.0 @ +7.0): 17μ * 21.4% = 3.6379998
 > skeleton bone (20.0 @ +7.0): 35μ * 21.4% = 7.49
 > bone flute (10.0 @ +7.0): 125μ * 10.7% = 13.375
 > Value of stat gain: 115μ
 > Monster value: 143.14
 > Evaluating '0.75*(20.0+3)'...
 > Evaluating '17.25'...
 > Evaluating '0.33'...
 > Building options...
 > Evaluating '-0.20454547'...
 > Evaluating '1'...
 > Evaluating '0'...
 > Evaluating '0.6'...
 > Evaluating '7'...
 > Evaluating '0'...
 > Evaluating '0'...
 > Evaluating '-4'...
 > Evaluating '-4'...
 > Evaluating '0.5'...
 > Evaluating '0'...
 > Evaluating '-2'...
 > Evaluating '-2'...
 > Evaluating '0.5'...
 > Evaluating '0'...
 > Evaluating '0.5'...
 > Evaluating '-5'...
 > Evaluating '-5'...
 > Evaluating '0'...
 > Evaluating '1.5*L+5'...
 > Evaluating '6'...
 > Evaluating '3'...
 > Evaluating '5'...
 > Evaluating '0'...
 > Evaluating '-2'...
 > Evaluating '-2'...
 > Evaluating '17.5'...
 > Evaluating '80'...
 > Evaluating '80'...
 > Evaluating '1.0*(5.5+min(0.07*86.0,15)+min(0.0,25)+0.8333333)'...
 > Evaluating '-4'...
 > Evaluating '0'...
 > Evaluating '-3'...
 > Evaluating '3'...
 > Evaluating '1.0*(12+min(0.15*86.0,20)+min(0.0,40)+0.8333333)'...
 > Evaluating '-6'...
 > Evaluating '0'...
 > Evaluating '-6'...
 > Evaluating '16'...
 > Evaluating '1.0*(2.5+min(0.0,5)+0.0)'...
 > Evaluating '-0'...
 > Options built! (19 actions)
 > Building custom actions...
 > Custom actions built! (0 actions)
 > Evaluating '0.75*(20.0+3)'...
 > Evaluating '17.25'...
 > Evaluating '0.33'...
 > Evaluating '0.75*(20.0+3)'...
 > Evaluating '17.25'...
 > Evaluating '0.33'...
 > Evaluating '0.75*(20.0+3)'...
 > Evaluating '17.25'...
 > Evaluating '0.33'...
 > Evaluating '0.75*(20.0+3)'...
 > Evaluating '17.25'...
 > Evaluating '0.33'...
 > Evaluating '0.75*(20.0+3)'...
 > Evaluating '17.25'...
 > Evaluating '0.33'...
 > Evaluating '0.75*(20.0+3)'...
 > Evaluating '17.25'...
 > Evaluating '0.33'...
 > Evaluating '0.75*(20.0+3)'...
 > Evaluating '17.25'...
 > Evaluating '0.33'...
 > Evaluating '0.75*(20.0+3)'...
 > Evaluating '17.25'...
 > Evaluating '0.33'...
 > Evaluating '0.75*(20.0+3)'...
 > Evaluating '17.25'...
 > Evaluating '0.33'...
 > Evaluating '0.75*(20.0+3)'...
 > Evaluating '17.25'...
 > Evaluating '0.33'...
 > Evaluating '0.75*(20.0+3)'...
 > Evaluating '17.25'...
 > Evaluating '0.33'...
 > Evaluating '0.75*(20.0+3)'...
 > Evaluating '17.25'...
 > Evaluating '0.33'...
 > Evaluating '0.75*(20.0+3)'...
 > Evaluating '17.25'...
 > Evaluating '0.33'...
 > Evaluating '0.75*(20.0+3)'...
 > Evaluating '17.25'...
 > Evaluating '0.33'...
 > Evaluating '0.75*(20.0+3)'...
 > Evaluating '17.25'...
 > Evaluating '0.33'...
 > Evaluating '0.75*(20.0+3)'...
 > Evaluating '17.25'...
 > Evaluating '0.33'...
 > Evaluating '0.75*(20.0+3)'...
 > Evaluating '17.25'...
 > Evaluating '0.33'...
 > Evaluating '0.75*(20.0+3)'...
 > Evaluating '17.25'...
 > Evaluating '0.33'...
 > Evaluating '0.75*(20.0+3)'...
 > Evaluating '17.25'...
 > Evaluating '0.33'...
 > Evaluating '0.75*(20.0+3)'...
 > Evaluating '17.25'...
 > Evaluating '0.33'...
 > Evaluating '0.75*(20.0+3)'...
 > Evaluating '17.25'...
 > Evaluating '0.33'...
 > Evaluating '0.75*(20.0+3)'...
 > Evaluating '17.25'...
 > Evaluating '0.33'...
 > Evaluating '0.75*(20.0+3)'...
 > Evaluating '17.25'...
 > Evaluating '0.33'...
 > Evaluating '0.75*(20.0+3)'...
 > Evaluating '17.25'...
 > Evaluating '0.33'...
 > Evaluating '0.75*(20.0+3)'...
 > Evaluating '17.25'...
 > Evaluating '0.33'...
 > Evaluating '0.75*(20.0+3)'...
 > Evaluating '17.25'...
 > Evaluating '0.33'...
 > Evaluating '0.75*(20.0+3)'...
 > Evaluating '17.25'...
 > Evaluating '0.33'...
 > Evaluating '0.75*(20.0+3)'...
 > Evaluating '17.25'...
 > Evaluating '0.33'...
 > Evaluating '0.75*(20.0+3)'...
 > Evaluating '17.25'...
 > Evaluating '0.33'...
 > Evaluating '0.75*(20.0+3)'...
 > Evaluating '17.25'...
 > Evaluating '0.33'...
 > Evaluating '0.75*(20.0+3)'...
 > Evaluating '17.25'...
 > Evaluating '0.33'...
 > Evaluating '0.75*(20.0+3)'...
 > Evaluating '17.25'...
 > Evaluating '0.33'...
 > Evaluating '0.75*(20.0+3)'...
 > Evaluating '17.25'...
 > Evaluating '0.33'...
 > Evaluating '0.75*(20.0+3)'...
 > Evaluating '17.25'...
 > Evaluating '0.33'...
 > Evaluating '0.75*(20.0+3)'...
 > Evaluating '17.25'...
 > Evaluating '0.33'...
 > Evaluating '0.75*(20.0+3)'...
 > Evaluating '17.25'...
 > Evaluating '0.33'...
 > Evaluating '0.75*(20.0+3)'...
 > Evaluating '17.25'...
 > Evaluating '0.33'...
 > Evaluating '0.75*(20.0+3)'...
 > Evaluating '17.25'...
 > Evaluating '0.33'...
 > Evaluating '0.75*(20.0+3)'...
 > Evaluating '17.25'...
 > Evaluating '0.33'...
 > Evaluating '0.75*(20.0+3)'...
 > Evaluating '17.25'...
 > Evaluating '0.33'...
 > Evaluating '0.75*(20.0+3)'...
 > Evaluating '17.25'...
 > Evaluating '0.33'...
 > Evaluating '0.75*(20.0+3)'...
 > Evaluating '17.25'...
 > Evaluating '0.33'...
 > Evaluating '0.75*(20.0+3)'...
 > Evaluating '17.25'...
 > Evaluating '0.33'...
 > Evaluating '0.75*(20.0+3)'...
 > Evaluating '17.25'...
 > Evaluating '0.33'...
 > Evaluating '0.75*(20.0+3)'...
 > Evaluating '17.25'...
 > Evaluating '0.33'...
 > Evaluating '0.75*(20.0+3)'...
 > Evaluating '17.25'...
 > Evaluating '0.33'...
 > Evaluating '0.75*(20.0+3)'...
 > Evaluating '17.25'...
 > Evaluating '0.33'...
 > Evaluating '0.75*(20.0+3)'...
 > Evaluating '17.25'...
 > Evaluating '0.33'...
 > Evaluating '0.75*(20.0+3)'...
 > Evaluating '17.25'...
 > Evaluating '0.33'...
 > Evaluating '0.75*(20.0+3)'...
 > Evaluating '17.25'...
 > Evaluating '0.33'...
 > Evaluating '0.75*(20.0+3)'...
 > Evaluating '17.25'...
 > Evaluating '0.33'...
 > Evaluating '0.75*(20.0+3)'...
 > Evaluating '17.25'...
 > Evaluating '0.33'...
 > Evaluating '0.75*(20.0+3)'...
 > Evaluating '17.25'...
 > Evaluating '0.33'...
 > Evaluating '0.75*(20.0+3)'...
 > Evaluating '17.25'...
 > Evaluating '0.33'...
 > Evaluating '0.75*(20.0+3)'...
 > Evaluating '17.25'...
 > Evaluating '0.33'...
 > Evaluating '0.75*(20.0+3)'...
 > Evaluating '17.25'...
 > Evaluating '0.33'...
 > Evaluating '0.75*(20.0+3)'...
 > Evaluating '17.25'...
 > Evaluating '0.33'...
 > Evaluating '0.75*(20.0+3)'...
 > Evaluating '17.25'...
 > Evaluating '0.33'...
 > Evaluating '0.75*(20.0+3)'...
 > Evaluating '17.25'...
 > Evaluating '0.33'...
 > Evaluating '0.75*(20.0+3)'...
 > Evaluating '17.25'...
 > Evaluating '0.33'...
 > Evaluating '0.75*(20.0+3)'...
 > Evaluating '17.25'...
 > Evaluating '0.33'...
 > Evaluating '0.75*(20.0+3)'...
 > Evaluating '17.25'...
 > Evaluating '0.33'...
 > Executing macro: scrollwhendone; sub batround; if haseffect 436 || haseffect 8 || haseffect 264 || haseffect 282 || haseffect 283 || haseffect 284; abort "BatBrain abort: poisoned"; endif; if hpbelow 0; abort "BatBrain abort: Danger, Will Robinson"; endif; endsub; sub batsub1; use 185; call batround; endsub; call batsub1; repeat !hpbelow 43.0 && hpbelow 44.0 && !mpbelow 97.0 && mpbelow 98.0 && !pastround 27; 
Round 1: edfox executes a macro!
Round 1: edfox uses the fat stacks of cash!
You lose 26 hit points
 > Building options...
 > Evaluating '-0.20454547'...
 > Evaluating '1'...
 > Evaluating '0'...
 > Evaluating '0.6'...
 > Evaluating '7'...
 > Evaluating '0'...
 > Evaluating '0'...
 > Evaluating '-4'...
 > Evaluating '-4'...
 > Evaluating '0.5'...
 > Evaluating '0'...
 > Evaluating '-2'...
 > Evaluating '-2'...
 > Evaluating '0.5'...
 > Evaluating '0'...
 > Evaluating '0.5'...
 > Evaluating '-5'...
 > Evaluating '-5'...
 > Evaluating '0'...
 > Evaluating '1.5*L+5'...
 > Evaluating '6'...
 > Evaluating '3'...
 > Evaluating '5'...
 > Evaluating '0'...
 > Evaluating '-2'...
 > Evaluating '-2'...
 > Evaluating '17.5'...
 > Evaluating '80'...
 > Evaluating '80'...
 > Evaluating '1.0*(5.5+min(0.07*86.0,15)+min(0.0,25)+0.8333333)'...
 > Evaluating '-4'...
 > Evaluating '0'...
 > Evaluating '-3'...
 > Evaluating '3'...
 > Evaluating '1.0*(12+min(0.15*86.0,20)+min(0.0,40)+0.8333333)'...
 > Evaluating '-6'...
 > Evaluating '0'...
 > Evaluating '-6'...
 > Evaluating '16'...
 > Evaluating '1.0*(2.5+min(0.0,5)+0.0)'...
 > Evaluating '-0'...
 > Options built! (19 actions)
 > Evaluating '0.75*(20.0+3)'...
 > Evaluating '17.25'...
 > Evaluating '0.33'...
 > Evaluating '0.75*(20.0+3)'...
 > Evaluating '17.25'...
 > Evaluating '0.33'...
 > Evaluating '0.75*(20.0+3)'...
 > Evaluating '17.25'...
 > Evaluating '0.33'...
 > Evaluating '0.75*(20.0+3)'...
 > Evaluating '17.25'...
 > Evaluating '0.33'...
 > Evaluating '0.75*(20.0+3)'...
 > Evaluating '17.25'...
 > Evaluating '0.33'...
 > Evaluating '0.75*(20.0+3)'...
 > Evaluating '17.25'...
 > Evaluating '0.33'...
 > Evaluating '0.75*(20.0+3)'...
 > Evaluating '17.25'...
 > Evaluating '0.33'...
 > Evaluating '0.75*(20.0+3)'...
 > Evaluating '17.25'...
 > Evaluating '0.33'...
 > Evaluating '0.75*(20.0+3)'...
 > Evaluating '17.25'...
 > Evaluating '0.33'...
 > Evaluating '0.75*(20.0+3)'...
 > Evaluating '17.25'...
 > Evaluating '0.33'...
 > Evaluating '0.75*(20.0+3)'...
 > Evaluating '17.25'...
 > Evaluating '0.33'...
 > Evaluating '0.75*(20.0+3)'...
 > Evaluating '17.25'...
 > Evaluating '0.33'...
 > Evaluating '0.75*(20.0+3)'...
 > Evaluating '17.25'...
 > Evaluating '0.33'...
 > Evaluating '0.75*(20.0+3)'...
 > Evaluating '17.25'...
 > Evaluating '0.33'...
 > Evaluating '0.75*(20.0+3)'...
 > Evaluating '17.25'...
 > Evaluating '0.33'...
 > Evaluating '0.75*(20.0+3)'...
 > Evaluating '17.25'...
 > Evaluating '0.33'...
 > Evaluating '0.75*(20.0+3)'...
 > Evaluating '17.25'...
 > Evaluating '0.33'...
 > Evaluating '0.75*(20.0+3)'...
 > Evaluating '17.25'...
 > Evaluating '0.33'...
 > Evaluating '0.75*(20.0+3)'...
 > Evaluating '17.25'...
 > Evaluating '0.33'...
 > Evaluating '0.75*(20.0+3)'...
 > Evaluating '17.25'...
 > Evaluating '0.33'...
 > Evaluating '0.75*(20.0+3)'...
 > Evaluating '17.25'...
 > Evaluating '0.33'...
 > Evaluating '0.75*(20.0+3)'...
 > Evaluating '17.25'...
 > Evaluating '0.33'...
 > Evaluating '0.75*(20.0+3)'...
 > Evaluating '17.25'...
 > Evaluating '0.33'...
 > Evaluating '0.75*(20.0+3)'...
 > Evaluating '17.25'...
 > Evaluating '0.33'...
 > Evaluating '0.75*(20.0+3)'...
 > Evaluating '17.25'...
 > Evaluating '0.33'...
 > Evaluating '0.75*(20.0+3)'...
 > Evaluating '17.25'...
 > Evaluating '0.33'...
 > Evaluating '0.75*(20.0+3)'...
 > Evaluating '17.25'...
 > Evaluating '0.33'...
 > Evaluating '0.75*(20.0+3)'...
 > Evaluating '17.25'...
 > Evaluating '0.33'...
 > Evaluating '0.75*(20.0+3)'...
 > Evaluating '17.25'...
 > Evaluating '0.33'...
 > Evaluating '0.75*(20.0+3)'...
 > Evaluating '17.25'...
 > Evaluating '0.33'...
 > Evaluating '0.75*(20.0+3)'...
 > Evaluating '17.25'...
 > Evaluating '0.33'...
 > Evaluating '0.75*(20.0+3)'...
 > Evaluating '17.25'...
 > Evaluating '0.33'...
 > Evaluating '0.75*(20.0+3)'...
 > Evaluating '17.25'...
 > Evaluating '0.33'...
 > Evaluating '0.75*(20.0+3)'...
 > Evaluating '17.25'...
 > Evaluating '0.33'...
 > Evaluating '0.75*(20.0+3)'...
 > Evaluating '17.25'...
 > Evaluating '0.33'...
 > Evaluating '0.75*(20.0+3)'...
 > Evaluating '17.25'...
 > Evaluating '0.33'...
 > Evaluating '0.75*(20.0+3)'...
 > Evaluating '17.25'...
 > Evaluating '0.33'...
 > Evaluating '0.75*(20.0+3)'...
 > Evaluating '17.25'...
 > Evaluating '0.33'...
 > Evaluating '0.75*(20.0+3)'...
 > Evaluating '17.25'...
 > Evaluating '0.33'...
 > Evaluating '0.75*(20.0+3)'...
 > Evaluating '17.25'...
 > Evaluating '0.33'...
 > Evaluating '0.75*(20.0+3)'...
 > Evaluating '17.25'...
 > Evaluating '0.33'...
 > Evaluating '0.75*(20.0+3)'...
 > Evaluating '17.25'...
 > Evaluating '0.33'...
 > Evaluating '0.75*(20.0+3)'...
 > Evaluating '17.25'...
 > Evaluating '0.33'...
 > Evaluating '0.75*(20.0+3)'...
 > Evaluating '17.25'...
 > Evaluating '0.33'...
 > Evaluating '0.75*(20.0+3)'...
 > Evaluating '17.25'...
 > Evaluating '0.33'...
 > Evaluating '0.75*(20.0+3)'...
 > Evaluating '17.25'...
 > Evaluating '0.33'...
 > Evaluating '0.75*(20.0+3)'...
 > Evaluating '17.25'...
 > Evaluating '0.33'...
 > Evaluating '0.75*(20.0+3)'...
 > Evaluating '17.25'...
 > Evaluating '0.33'...
 > Evaluating '0.75*(20.0+3)'...
 > Evaluating '17.25'...
 > Evaluating '0.33'...
 > Evaluating '0.75*(20.0+3)'...
 > Evaluating '17.25'...
 > Evaluating '0.33'...
 > Evaluating '0.75*(20.0+3)'...
 > Evaluating '17.25'...
 > Evaluating '0.33'...
 > Evaluating '0.75*(20.0+3)'...
 > Evaluating '17.25'...
 > Evaluating '0.33'...
 > Evaluating '0.75*(20.0+3)'...
 > Evaluating '17.25'...
 > Evaluating '0.33'...
 > Evaluating '0.75*(20.0+3)'...
 > Evaluating '17.25'...
 > Evaluating '0.33'...
 > Evaluating '0.75*(20.0+3)'...
 > Evaluating '17.25'...
 > Evaluating '0.33'...
 > Evaluating '0.75*(20.0+3)'...
 > Evaluating '17.25'...
 > Evaluating '0.33'...
 > Evaluating '0.75*(20.0+3)'...
 > Evaluating '17.25'...
 > Evaluating '0.33'...
 > Evaluating '0.75*(20.0+3)'...
 > Evaluating '17.25'...
 > Evaluating '0.33'...
 > Evaluating '0.75*(20.0+3)'...
 > Evaluating '17.25'...
 > Evaluating '0.33'...
 > Evaluating '0.75*(20.0+3)'...
 > Evaluating '17.25'...
 > Evaluating '0.33'...
 > Evaluating '0.75*(20.0+3)'...
 > Evaluating '17.25'...
 > Evaluating '0.33'...
 > Evaluating '0.75*(20.0+3)'...
 > Evaluating '17.25'...
 > Evaluating '0.33'...
 > Executing macro: scrollwhendone; sub batround; if haseffect 436 || haseffect 8 || haseffect 264 || haseffect 282 || haseffect 283 || haseffect 284; abort "BatBrain abort: poisoned"; endif; if hpbelow 0; abort "BatBrain abort: Danger, Will Robinson"; endif; endsub; sub batsub1; use 185; call batround; endsub; call batsub1; repeat !hpbelow 17.0 && hpbelow 18.0 && !mpbelow 97.0 && mpbelow 98.0 && !pastround 27; 
Round 2: edfox executes a macro!
Round 2: edfox uses the fat stacks of cash!
You lose 26 hit points
 > Building options...
 > Evaluating '-0.20454547'...
 > Evaluating '1'...
 > Evaluating '0'...
 > Evaluating '0.6'...
 > Evaluating '7'...
 > Evaluating '0'...
 > Evaluating '0'...
 > Evaluating '-4'...
 > Evaluating '-4'...
 > Evaluating '0.5'...
 > Evaluating '0'...
 > Evaluating '-2'...
 > Evaluating '-2'...
 > Evaluating '0.5'...
 > Evaluating '0'...
 > Evaluating '0.5'...
 > Evaluating '-5'...
 > Evaluating '-5'...
 > Evaluating '0'...
 > Evaluating '1.5*L+5'...
 > Evaluating '6'...
 > Evaluating '3'...
 > Evaluating '5'...
 > Evaluating '0'...
 > Evaluating '-2'...
 > Evaluating '-2'...
 > Evaluating '17.5'...
 > Evaluating '80'...
 > Evaluating '80'...
 > Options built! (14 actions)
 > Evaluating '0.75*(20.0+3)'...
 > Evaluating '17.25'...
 > Evaluating '0.33'...
 > Evaluating '0.75*(20.0+3)'...
 > Evaluating '17.25'...
 > Evaluating '0.33'...
 > Evaluating '0.75*(20.0+3)'...
 > Evaluating '17.25'...
 > Evaluating '0.33'...
 > Evaluating '0.75*(20.0+3)'...
 > Evaluating '17.25'...
 > Evaluating '0.33'...
 > Evaluating '0.75*(20.0+3)'...
 > Evaluating '17.25'...
 > Evaluating '0.33'...
 > Evaluating '0.75*(20.0+3)'...
 > Evaluating '17.25'...
 > Evaluating '0.33'...
 > Evaluating '0.75*(20.0+3)'...
 > Evaluating '17.25'...
 > Evaluating '0.33'...
 > Evaluating '0.75*(20.0+3)'...
 > Evaluating '17.25'...
 > Evaluating '0.33'...
 > Evaluating '0.75*(20.0+3)'...
 > Evaluating '17.25'...
 > Evaluating '0.33'...
 > Evaluating '0.75*(20.0+3)'...
 > Evaluating '17.25'...
 > Evaluating '0.33'...
 > Evaluating '0.75*(20.0+3)'...
 > Evaluating '17.25'...
 > Evaluating '0.33'...
 > Evaluating '0.75*(20.0+3)'...
 > Evaluating '17.25'...
 > Evaluating '0.33'...
 > Evaluating '0.75*(20.0+3)'...
 > Evaluating '17.25'...
 > Evaluating '0.33'...
 > Evaluating '0.75*(20.0+3)'...
 > Evaluating '17.25'...
 > Evaluating '0.33'...
 > Evaluating '0.75*(20.0+3)'...
 > Evaluating '17.25'...
 > Evaluating '0.33'...
 > Evaluating '0.75*(20.0+3)'...
 > Evaluating '17.25'...
 > Evaluating '0.33'...
 > This monster is not your huckleberry.
 > You've had the crap beaten out of you... attempting to find some more crap.

Visiting Relaxing Hot Tub in clan VIP lounge
You lose an effect: Beaten Up
You gain 43 hit points
 
Yeah, intheclear() isn't really used very much anymore, now that smarter alternatives exist for most of the situations it was used. I'm thinking of getting rid of it entirely, but I would need to investigate its use in other scripts first.

Looks like we need another stasis repeat condition to catch cases where expected MP gain significantly outbalances expected HP loss. We need to make sure your HP can outlast the number of rounds you need to finish the monster -- if not, don't stasis. If yes, go ahead and stay in the loop since it's profitable despite your HP loss.

There's another possibility -- the monster actually has a higher attack than mafia thinks it does -- but I don't think that's what's happened here.
 
That's not enough information to even guess what's going on. Please show that happening with higher verbosity. I suggest 7 or 8.

Sorry I can't repeat that now but familiar was a fairy and I was just trying to open HITS at the time. There was no reason to stasis so the only issue is the constant use of salve which was restoring less HP than I was losing each round. I was seriously outlevelled by the castle monsters but wave/geyser made it survivable.
 
OK, it just happened again in the war. Familiar is a fairy and I do not have safe mox/mus. I did have alll the log options on (except the reverse one) and set verbosity to 8 as suggested. Hope this helps.
Code:
[1650] Battlefield (Hippy Uniform)
Encounter: War Frat 110th Infantryman
Round 0: panama joe loses initiative!
Round 1: war frat 110th infantryman takes 3 damage.
Round 1: war frat 110th infantryman takes 3 damage.
You lose 31 hit points
1 MP costs 4.347826 μ.
1 HP costs 6.6666665 μ.
beer bomb (5.0 @ +89.08099): 150μ * 9.45405% = 14.181075
beer helmet (10.0 @ +89.08099): 544μ * 18.9081% = 102.86007
bejeweled pledge pin (10.0 @ +89.08099): 533μ * 18.9081% = 100.780174
bottle opener belt buckle (10.0 @ +89.08099): 529μ * 18.9081% = 100.02385
distressed denim pants (10.0 @ +89.08099): 900μ * 18.9081% = 170.17291
giant foam finger (10.0 @ +89.08099): 565μ * 18.9081% = 106.830765
keg shield (6.0 @ +89.08099): 544μ * 11.34486% = 61.71604
beer bomb (5.0 @ +89.08099): 150μ * 9.45405% = 14.181075
beer helmet (10.0 @ +89.08099): 544μ * 18.9081% = 102.86007
bejeweled pledge pin (10.0 @ +89.08099): 533μ * 18.9081% = 100.780174
bottle opener belt buckle (10.0 @ +89.08099): 529μ * 18.9081% = 100.02385
distressed denim pants (10.0 @ +89.08099): 900μ * 18.9081% = 170.17291
giant foam finger (10.0 @ +89.08099): 565μ * 18.9081% = 106.830765
keg shield (6.0 @ +89.08099): 544μ * 11.34486% = 61.71604
Monster value: 1041.56
Profit per round: ActionProfitDamageOtherbase; Baby Gravy Fairy (0μ)-155.22μ--
CATEGORY II: skill 4014 (no stun)
Round 1: panama joe executes a macro!
Round 1: panama joe casts SAUCY SALVE!
KoLmafia thinks it is round 2 but KoL thinks it is round 1
You gain 12 hit points
Round 2: panama joe executes a macro!
Round 2: panama joe casts SAUCY SALVE!
KoLmafia thinks it is round 3 but KoL thinks it is round 1
You gain 10 hit points
Round 3: panama joe executes a macro!
Round 3: panama joe casts SAUCY SALVE!
KoLmafia thinks it is round 4 but KoL thinks it is round 2
You gain 11 hit points
Round 4: war frat 110th infantryman takes 3 damage.
Round 4: war frat 110th infantryman takes 3 damage.
You lose 25 hit points
Round 4: panama joe executes a macro!
Round 4: panama joe casts SAUCY SALVE!
KoLmafia thinks it is round 5 but KoL thinks it is round 3
You gain 12 hit points
Round 5: war frat 110th infantryman takes 2 damage.
Round 5: war frat 110th infantryman takes 4 damage.
You lose 26 hit points
Round 5: panama joe executes a macro!
Round 5: panama joe casts SAUCY SALVE!
KoLmafia thinks it is round 6 but KoL thinks it is round 3
You gain 22 hit points
Round 6: panama joe executes a macro!
Round 6: panama joe casts SAUCY SALVE!
KoLmafia thinks it is round 7 but KoL thinks it is round 4
You gain 13 hit points
Round 7: war frat 110th infantryman takes 2 damage.
Round 7: war frat 110th infantryman takes 3 damage.
You lose 24 hit points
Round 7: panama joe executes a macro!
Round 7: panama joe casts SAUCY SALVE!
KoLmafia thinks it is round 8 but KoL thinks it is round 5
You gain 11 hit points
Round 8: war frat 110th infantryman takes 2 damage.
Round 8: war frat 110th infantryman takes 5 damage.
You lose 24 hit points
Round 8: panama joe executes a macro!
Round 8: panama joe casts SAUCY SALVE!
KoLmafia thinks it is round 9 but KoL thinks it is round 6
You gain 13 hit points
Round 9: war frat 110th infantryman takes 3 damage.
Round 9: war frat 110th infantryman takes 4 damage.
You lose 26 hit points
Round 9: panama joe executes a macro!
Round 9: panama joe casts SAUCY SALVE!
KoLmafia thinks it is round 10 but KoL thinks it is round 7
You gain 10 hit points
Round 10: war frat 110th infantryman takes 1 damage.
Round 10: war frat 110th infantryman takes 5 damage.
You lose 30 hit points
Round 10: panama joe executes a macro!
Round 10: panama joe casts SAUCY SALVE!
KoLmafia thinks it is round 11 but KoL thinks it is round 8
You gain 15 hit points
Round 11: war frat 110th infantryman takes 3 damage.
Round 11: war frat 110th infantryman takes 3 damage.
You lose 24 hit points
Round 11: panama joe executes a macro!
Round 11: panama joe casts SAUCY SALVE!
KoLmafia thinks it is round 12 but KoL thinks it is round 9
You gain 13 hit points
Round 12: war frat 110th infantryman takes 1 damage.
Round 12: war frat 110th infantryman takes 3 damage.
You lose 29 hit points
Round 12: panama joe executes a macro!
Round 12: panama joe casts SAUCY SALVE!
KoLmafia thinks it is round 13 but KoL thinks it is round 10
You gain 13 hit points
Round 13: war frat 110th infantryman takes 3 damage.
Round 13: war frat 110th infantryman takes 4 damage.
You lose 30 hit points
Insufficient health to continue (auto-abort triggered).
 
Unfortunately, a verbosity of 9 would have been more useful I think. Maybe adding more vprint()s with expected monster damage and other such info would be helpful?
 
Yeah, intheclear() isn't really used very much anymore, now that smarter alternatives exist for most of the situations it was used. I'm thinking of getting rid of it entirely, but I would need to investigate its use in other scripts first.

That could explain another effect I've been seeing. BBB has been running +ML up to 10 (or 11) in the war when that is most definitely not safe. I'm working off memory here but it really only seems to be an issue in the island war. I end up shutting off automcd for the duration. I'm nowhere near there so far but I may have more info in a bit.

This may be only a BBB issue so not belong here but if memory serves doesn't BBB get intheclear() from SS/BB? The interlacing world of Zarqon scripts has noodled my brain.

EDIT
There's another possibility -- the monster actually has a higher attack than mafia thinks it does -- but I don't think that's what's happened here.
I also doubt this. I've gotten the stuffing beat out of me in the greater-than-sign/dungeons of doom, knob treasury, various friar woods, and I can't recall where else (it's a veritable vacation of violence!) all this ascention and I believe with the latest SS. Seems too widespread to be a mafia data error.
 
Last edited:
Regarding the war, there are a LOT of those fights that mafia doesn't have properly spaded data for. What's there is either a vague guess, or the '0's of no-data-known.

That doesn't necessarily explain all of the other zones, but it might be a major factor.
 
Ah, I see. Well that would explain the MCD issues during the war. None of the other zones were MCD, just the "SS is writing checks my body can't cash" bug.
 
I'm having the same problem, but only when using certain familiars. Specifically, I get beat up when using a Rogue Program (SS keeps using Fat Stacks of Cash instead of attacking) but not when using a RoboGoose. Not too surprising, since the first generates MP during combat and the second doesn't.

I don't seem to have trouble in zones where I don't take much damage. SS will stasis right up to the last moment, then kill the monster with one blow on turn 30. The problem is when it does that against tougher monsters, such as hellseals or hobos. It doesn't seem to notice that I'm losing HP at an unsustainable rate.

Here's a log at verbosity level 9.

Code:
Validating adventure sequence...
Condition added: deadly lampshade
deadly lampshade
Condition added: Game Grid token (5)
deadly lampshade
Game Grid token (5)
Requests complete.

BBB: No need to eat a cookie given the present counters.
You don't have any spooky putty monsters.

Visit to Hobopolis: The Ancient Hobo Burial Ground in progress...

[11295] The Ancient Hobo Burial Ground
Encounter: Ghoulish Parker, Undead Detective
Strategy: /Users/dougw/Library/Application Support/KoLmafia/ccs/default.ccs [default]
Round 0: gdunge loses initiative!
1 MP costs 8.0 μ.
1 HP costs 2.057143 μ.
hobo nickel (15.0 @ +137.0): 0μ * 35.55% = 0.0
Value of stat gain: 1062.5μ
hobo nickel (15.0 @ +137.0): 0μ * 35.55% = 0.0
Value of stat gain: 1062.5μ
Monster value: 1062.5
Profit per round: ActionProfitDamageOtherbase; Rogue Program (0μ)63.68μ8.17 (0 MPD)45% stun chance MP: 8.17
Building options...
Options built! (143 actions)
Building custom actions...
Custom actions built! (0 actions)
Stasis action chosen:
ActionProfitDamageOtherThrow 185 (0μ)65.34μ--
Stasis action chosen:
ActionProfitDamageOtherThrow 185 (0μ)65.34μ--
Stasis action chosen:
ActionProfitDamageOtherThrow 185 (0μ)65.34μ--
Executing macro: scrollwhendone; sub batround; if haseffect 436 || haseffect 8 || haseffect 264 || haseffect 282 || haseffect 283 || haseffect 284; abort "BatBrain abort: poisoned"; endif; if hpbelow 0; abort "BatBrain abort: Danger, Will Robinson"; endif; endsub; sub batsub1; use 185; call batround; endsub; call batsub1; repeat !hpbelow 1347.0 && hpbelow 1348.0 && !mpbelow 425.0 && mpbelow 426.0 && !pastround 28; 
Round 1: gdunge executes a macro!
Round 1: gdunge uses the fat stacks of cash!
You gain 27 Muscularity Points
Building options...
Options built! (143 actions)
Stasis action chosen:
ActionProfitDamageOtherThrow 185 (0μ)65.34μ--
Stasis action chosen:
ActionProfitDamageOtherThrow 185 (0μ)65.34μ--
Stasis action chosen:
ActionProfitDamageOtherThrow 185 (0μ)65.34μ--
Executing macro: scrollwhendone; sub batround; if haseffect 436 || haseffect 8 || haseffect 264 || haseffect 282 || haseffect 283 || haseffect 284; abort "BatBrain abort: poisoned"; endif; if hpbelow 0; abort "BatBrain abort: Danger, Will Robinson"; endif; endsub; sub batsub1; use 185; call batround; endsub; call batsub1; repeat !hpbelow 1347.0 && hpbelow 1348.0 && !mpbelow 452.0 && mpbelow 453.0 && !pastround 28; 
Round 2: gdunge executes a macro!
Round 2: gdunge uses the fat stacks of cash!
You gain 16 Muscularity Points
Building options...
Options built! (143 actions)
Stasis action chosen:
ActionProfitDamageOtherThrow 185 (0μ)65.34μ--
Stasis action chosen:
ActionProfitDamageOtherThrow 185 (0μ)65.34μ--
Stasis action chosen:
ActionProfitDamageOtherThrow 185 (0μ)65.34μ--
Executing macro: scrollwhendone; sub batround; if haseffect 436 || haseffect 8 || haseffect 264 || haseffect 282 || haseffect 283 || haseffect 284; abort "BatBrain abort: poisoned"; endif; if hpbelow 0; abort "BatBrain abort: Danger, Will Robinson"; endif; endsub; sub batsub1; use 185; call batround; endsub; call batsub1; repeat !hpbelow 1347.0 && hpbelow 1348.0 && !mpbelow 468.0 && mpbelow 469.0 && !pastround 28; 
Round 3: gdunge executes a macro!
Round 3: gdunge uses the fat stacks of cash!
You lose 347 hit points
Building options...
Options built! (143 actions)
Stasis action chosen:
ActionProfitDamageOtherThrow 185 (0μ)65.34μ--
Stasis action chosen:
ActionProfitDamageOtherThrow 185 (0μ)65.34μ--
Stasis action chosen:
ActionProfitDamageOtherThrow 185 (0μ)65.34μ--
Executing macro: scrollwhendone; sub batround; if haseffect 436 || haseffect 8 || haseffect 264 || haseffect 282 || haseffect 283 || haseffect 284; abort "BatBrain abort: poisoned"; endif; if hpbelow 0; abort "BatBrain abort: Danger, Will Robinson"; endif; endsub; sub batsub1; use 185; call batround; endsub; call batsub1; repeat !hpbelow 1000.0 && hpbelow 1001.0 && !mpbelow 468.0 && mpbelow 469.0 && !pastround 28; 
Round 4: gdunge executes a macro!
Round 4: gdunge uses the fat stacks of cash!
Round 5: gdunge uses the fat stacks of cash!
Round 6: gdunge uses the fat stacks of cash!
Round 7: gdunge uses the fat stacks of cash!
You gain 25 Muscularity Points
Building options...
Options built! (143 actions)
Stasis action chosen:
ActionProfitDamageOtherThrow 185 (0μ)65.34μ--
Stasis action chosen:
ActionProfitDamageOtherThrow 185 (0μ)65.34μ--
Stasis action chosen:
ActionProfitDamageOtherThrow 185 (0μ)65.34μ--
Executing macro: scrollwhendone; sub batround; if haseffect 436 || haseffect 8 || haseffect 264 || haseffect 282 || haseffect 283 || haseffect 284; abort "BatBrain abort: poisoned"; endif; if hpbelow 0; abort "BatBrain abort: Danger, Will Robinson"; endif; endsub; sub batsub1; use 185; call batround; endsub; call batsub1; repeat !hpbelow 1000.0 && hpbelow 1001.0 && !mpbelow 493.0 && mpbelow 494.0 && !pastround 28; 
Round 8: gdunge executes a macro!
Round 8: gdunge uses the fat stacks of cash!
You lose 369 hit points
Building options...
Options built! (143 actions)
Stasis action chosen:
ActionProfitDamageOtherThrow 185 (0μ)65.34μ--
Stasis action chosen:
ActionProfitDamageOtherThrow 185 (0μ)65.34μ--
Stasis action chosen:
ActionProfitDamageOtherThrow 185 (0μ)65.34μ--
Executing macro: scrollwhendone; sub batround; if haseffect 436 || haseffect 8 || haseffect 264 || haseffect 282 || haseffect 283 || haseffect 284; abort "BatBrain abort: poisoned"; endif; if hpbelow 0; abort "BatBrain abort: Danger, Will Robinson"; endif; endsub; sub batsub1; use 185; call batround; endsub; call batsub1; repeat !hpbelow 631.0 && hpbelow 632.0 && !mpbelow 493.0 && mpbelow 494.0 && !pastround 28; 
Round 9: gdunge executes a macro!
Round 9: gdunge uses the fat stacks of cash!
Round 10: gdunge uses the fat stacks of cash!
Round 11: gdunge uses the fat stacks of cash!
You lose 24 hit points
Building options...
Options built! (143 actions)
Stasis action chosen:
ActionProfitDamageOtherThrow 185 (0μ)65.34μ--
Stasis action chosen:
ActionProfitDamageOtherThrow 185 (0μ)65.34μ--
Stasis action chosen:
ActionProfitDamageOtherThrow 185 (0μ)65.34μ--
Executing macro: scrollwhendone; sub batround; if haseffect 436 || haseffect 8 || haseffect 264 || haseffect 282 || haseffect 283 || haseffect 284; abort "BatBrain abort: poisoned"; endif; if hpbelow 0; abort "BatBrain abort: Danger, Will Robinson"; endif; endsub; sub batsub1; use 185; call batround; endsub; call batsub1; repeat !hpbelow 607.0 && hpbelow 608.0 && !mpbelow 493.0 && mpbelow 494.0 && !pastround 28; 
Round 12: gdunge executes a macro!
Round 12: gdunge uses the fat stacks of cash!
Round 13: gdunge uses the fat stacks of cash!
You lose 361 hit points
Building options...
Options built! (143 actions)
Stasis action chosen:
ActionProfitDamageOtherThrow 185 (0μ)65.34μ--
Stasis action chosen:
ActionProfitDamageOtherThrow 185 (0μ)65.34μ--
Stasis action chosen:
ActionProfitDamageOtherThrow 185 (0μ)65.34μ--
Executing macro: scrollwhendone; sub batround; if haseffect 436 || haseffect 8 || haseffect 264 || haseffect 282 || haseffect 283 || haseffect 284; abort "BatBrain abort: poisoned"; endif; if hpbelow 0; abort "BatBrain abort: Danger, Will Robinson"; endif; endsub; sub batsub1; use 185; call batround; endsub; call batsub1; repeat !hpbelow 246.0 && hpbelow 247.0 && !mpbelow 493.0 && mpbelow 494.0 && !pastround 28; 
Round 14: gdunge executes a macro!
Round 14: gdunge uses the fat stacks of cash!
You gain 32 Muscularity Points
Building options...
Options built! (143 actions)
Stasis action chosen:
ActionProfitDamageOtherThrow 185 (0μ)65.34μ--
Stasis action chosen:
ActionProfitDamageOtherThrow 185 (0μ)65.34μ--
Stasis action chosen:
ActionProfitDamageOtherThrow 185 (0μ)65.34μ--
Executing macro: scrollwhendone; sub batround; if haseffect 436 || haseffect 8 || haseffect 264 || haseffect 282 || haseffect 283 || haseffect 284; abort "BatBrain abort: poisoned"; endif; if hpbelow 0; abort "BatBrain abort: Danger, Will Robinson"; endif; endsub; sub batsub1; use 185; call batround; endsub; call batsub1; repeat !hpbelow 246.0 && hpbelow 247.0 && !mpbelow 525.0 && mpbelow 526.0 && !pastround 28; 
Round 15: gdunge executes a macro!
Round 15: gdunge uses the fat stacks of cash!
You lose 347 hit points
Building options...
Options built! (143 actions)
Stasis action chosen:
ActionProfitDamageOtherThrow 185 (0μ)0μ--
This monster is not your huckleberry.

Conditions not satisfied after 1 adventure.
You've had the crap beaten out of you... attempting to find some more crap.
Visiting Relaxing Hot Tub in clan VIP lounge
You lose an effect: Beaten Up
You gain 1,272 hit points
 
I think there are several things that come into play here.

1) Hobo special attacks aren't considered yet, but that only applies to Gdunge's report
2) The cost of being beaten up is way undervalued: it doesn't take into account the opportunity cost of not profiting from the fight. Perhaps adding monstervalue() to beatenup would clear that up and avoid some options that get you beaten up.

And of course, the main problem is:
3) BatBrain thinks those monsters will not do any damage to you, as lines like those show:
Profit per round: ActionProfitDamageOtherbase; Snow Angel (0μ)-11.8μ0 (5.69) Actual: 5.69 (0 MPD)MP: 5.69
Profit per round: ActionProfitDamageOtherbase; Baby Gravy Fairy (0μ)-155.22μ--
Profit per round: ActionProfitDamageOtherbase; Rogue Program (0μ)63.68μ8.17 (0 MPD)45% stun chance MP: 8.17

On those lines, there should be something like "HP: -X" before the "MP: 8.17" if BatBrain thought that the monster could remove some of your HP each round.

I'll leave it to Zarqon to try to figure out why this is happening though, but I'll try to check m_hit_chance() and m_regular() to see if I notice anything.
 
I still have a little of the war to finish so I'd be happy to add a bunch of print statements if someone could give me fairly explicit instructions on what and where to put them or, even better, post a debug version here which I can use :)
 
Ha... I found the bug. Sneaky little bugger.

The problem was in m_dpr(att_mod, stun_mod), which predicts the damage per round (dpr) the monster will do, if his current adjusted attack and defense are further modified by att_mod and stun_mod.
PHP:
float m_dpr(float att_mod, float stun_mod) {
   advevent temp = adj;
   adj.att += att_mod;
   adj.stun += stun_mod;
   float res = m_hit_chance()*m_regular();
   adj = temp;
   return res;
}
The problem here is that modifying "adj" also modifies "temp", so instead of restoring "adj" to its original values, it keeps the modified ones.

Hence, when considering various items to find one that would stun or stasis profitably, "adj" will stack all the effects of those items. This is what rapidly causes BatBrain to believe that a monster will always be stunned and do no damage.

Simply changing m_dpr() to the following should solve the issue:
PHP:
float m_dpr(float att_mod, float stun_mod) {
   adj.att += att_mod;
   adj.stun += stun_mod;
   float res = m_hit_chance()*m_regular();
   adj.att -= att_mod;
   adj.stun -= stun_mod;
   return res;
}
 
Last edited:
Back
Top