Closed Karol1223 closed 3 months ago
diff
is definitely taken into account, though perhaps not correctly: https://github.com/nornagon/cdda-guide/blob/e9556bc66f70aeb7a7ae65fdf8f3c7ce454311a1/src/types/Monster.svelte#L52
the algorithm there was manually translated from the C++ source a while ago and it's quite possible things have changed since. i'll take a look.
Just checked through and it looks like the algorithm was more or less correct except for the min-1 part. There might be stuff that's slightly off with damage calculations, because the Guide's damage code is pretty naive. It's definitely possible for the difficulty algorithm to produce something less than the base difficulty though. Simplified, the algorithm is something like:
( melee_skill + dodge * armor + base_diff ) * ( some_other_stuff )
in the case of the boxer puppy, some_other_stuff
turns out to be about 0.5, and the first part comes out to 5 (base_diff 3 + extra 2), which multiplied together and rounded down gets you 2. I'm not sure how to see the computed numerical difficulty in game (is it even possible to see?) but this seems fairly close.
I'm going to close this for now with b691c88c50b49743326628b92b0dc6a08cf0cd2b, let me know if I've missed something and I can reopen.
I'm not sure how to see the computed numerical difficulty in game (is it even possible to see?) but this seems fairly close.
Technically not directly, but the difficulty value is the amount of experience the monster provides upon kill when using a mod like Stats Through Kills. Using that mod, a default character will need 300 exp to level up a stat for the first time. Upon killing a boxer puppy with my pre-PR changes (so manually added diff:3
) this amount drops to 295, meaning the boxer puppy does indeed have a difficulty of 5 and something is being calculated wrong on your end.
It's also possible that it's the experience calculation that is broken instead, but according to the documentation this is how it should be working.
The displayed monster difficulty does not take several things into consideration. The two I found are:
diff
field does not seem to be added on top of the automatic difficulty calculation, as visible with the boxer puppy - displayed difficulty of 2, whereas the JSON definition has adiff
of 3