Feature - Implemented Account for The Lost Glasses in monster_defense()

zarqon

Well-known member
The Lost Glasses reduce monster defense by 15%. This causes my combat scripts to behave badly during muscle runs with the glasses equipped, because calling monster_defense() returns the nonadjusted value. Of course, Manuel (and thus also mafia) reports the glasses-reduced value if he's learned the monster, but for players without Manuel or monsters he has not yet learned, monster_defense() reporting the nonadjusted value leads BatBrain to make wasteful decisions.

That seems like something that mafia should fix. Do The Lost Glasses reduce the initial defense by 15% or the current "effective" defense? For example, if something starts with 1000 (850) defense, would reducing its defense by 100 bring it down to 750 or 765?

Although I'm in a run and couldn't test such pleasantly large/round numbers, here are some figures. A/B -> C, where A = base defense, B = A+ML, and C = glasses-adjusted defense revealed by Manuel. C sometimes has a range, due to ML variance. Ranges given or absent are based on a very limited sample size and should not be taken as definitive ranges, simply observed ranges.

Code:
creepy clown       18/28 -> 23
scary clown        17/27 -> 22
disease in-a-box   16/26 -> 22
bugbear-in-the-box 16/26 -> 22
lemon-in-the-box   15/25 -> 21
g imp              41/51 -> 43-44
demoninja          27/37 -> 31-32
l imp              39/49 -> 41-42
fallen archfiend   45/55 -> 45-47
g imp              41/51 -> 44
p imp              37/47 -> 39
hellion            46/56 -> 47
w imp              36/46 -> 38-39
ch imp             55/55 -> 45-48
pr imp             54/54 -> 45-47
bl imp             58/58 -> 49
bl imp             58/62 -> 54

So the -15% is applied after ML adjustments, but before any barrrnacle-deleveling (some of those numbers were the same with or without a barrrnacle).

I and all BatBrain-powered script users would happy if mafia could account for these glasses for non-Manuel-informed monster stats.
 

xKiv

Active member
These numbers (10 or less ML) look like you have been running MCD/radio/annoytron. Be careful around that - it has been known to work differently from other sources of ML in the past.
 

zarqon

Well-known member
Yep, that's just with the radio on. Didn't test with any ML-affecting buffs, but I can probably do that tomorrow.

ETA: with both detuned radio +10 and Fondid +15, a Knob Goblin harem guard (defense 22, thus boosted to 47) had a defense of 39. Pretty safe to say it applies to all noncombat ML modifiers which actually affect the monster.
 
Last edited:

nworbetan

Member
Just out of curiosity, has anyone that owns a pair of Chester's sunglasses checked to see if they stack with The Lost Glasses or not?
 

xKiv

Active member
cavewomun hippy (according to manuel)
- without either glasses, defense 218 (wiki lists 207, I have +10 MCD, so this is at +1 variance)
- with chester's sunglasses, defense 183 (difference: 35)
- with the lost glasses, defense 183
- with both, defense 151 (difference: 67)

This is within "stacks additively":
183~~215*0.85 (at -2 variance)
151~~216*0.7 (at -1 variance)

(it's not within "stacks multiplicatevly": 151/(0.85*0.85)=208, which would be at -10 variance, but variance is capped at +-5)
 

lostcalpolydude

Developer
Staff member
(it's not within "stacks multiplicatevly": 151/(0.85*0.85)=208, which would be at -10 variance, but variance is capped at +-5)

But 217*(.85)^2 = 156.8, and if that's rounded down then 151 is -5 variance. I hadn't even thought of it being multiplicative. I would test it myself, but I don't have 200 moxie.
 

Darzil

Developer
No 200 moxie here either. Might be worth testing against a scaling monster, as they have no variance, so should be a clearer effect.
 

xKiv

Active member
But 217*(.85)^2 = 156.8, and if that's rounded down then 151 is -5 variance. I hadn't even thought of it being multiplicative. I would test it myself, but I don't have 200 moxie.

I assume variance happens *before* player's equipment has any chance to do anything.
 

nworbetan

Member
If you want to see monster variance happen before the lost glasses effect, the easiest way I can think of is to fight monsters whose unmodified defense is 21 or 22. You should see their defense drop below 20 with glasses, yet still vary. You should also see pretty much the same thing on both sides of all of the the (def % 20 == 0) thresholds where the range of variance increases. It's just a lot easier to see the range change from +-0 to +-1 at def >= 20 though.
 

Darzil

Developer
Ok, against a scaling monster, Mutated Aliephant, I kept my Muscle constant to see the effect (using runaways).

With none of the equipment, it had 438 Defence.
With just Lost Glasses or just Chester's Sunglasses, it had 372 Defence.
With both, it had 306 Defence.

This is consistent with defence of Base * (1-.15-.15), rounded down, not defence of Base * (1-.15) * (1-.15), rounded down, which would have given 316.
 
Top