What controls why monsters/players cannot go below 0 MDB? (User error, it turns out they do indeed go below 0 as expected) #620
Replies: 7 comments 10 replies
-
well that sounds like a pretty important bug o.O;; |
Beta Was this translation helpful? Give feedback.
-
Could you provide an example of MDB needing to be negative? Or something that would reduce MDB to a negative value? I need more info. |
Beta Was this translation helpful? Give feedback.
-
Shiyo, what kinda damage/task did your char do to see it do this? |
Beta Was this translation helpful? Give feedback.
-
A fun read for you! TLDR example:
The same thing happens in reverse!
Since Lua models everything as doubles behind the scene, we can be sure that the problem isn't in Lua land. More likely: It's in a binding where we're trying to stuff some negative Lua value into an unsigned C++ integer type. Where that is: no idea. EDIT: |
Beta Was this translation helpful? Give feedback.
-
So Shiyo, I tried testing this, but I could not reproduce it. I also looked arround the mess to see if I could find anywhere where it could be underflowing in such a manner. Not saying I do not believe you, by any means, but would you be so kind to provide me the exact steps you took to test this? If you, for some reason cannot disclose them publicly, you can always send me a message to discord directly, not a problem. |
Beta Was this translation helpful? Give feedback.
-
Okay I think I figured out the issue: I think the solution is to move the 100 MDB/MAB from magic.lua and attach it to all entities instead as a bandaid. The real solution is checking why it's overflowing in c++ because int16_t can go to -32k. Note: I"m using a GM command to get mdef/matt mod and to print it out in string format. It works perfectly for adding and removing MDB/MAB unless I am triyng to remove from base(0). |
Beta Was this translation helpful? Give feedback.
-
Not up to speed on all the various types... but I am guessing there is a specific reason to not use a "normal" INT type for the value that it would be able to go to a negative value? |
Beta Was this translation helpful? Give feedback.
-
Monsters and players currently cannot go below negative MDB(its supposed to be 100 but it's 0 I think). When you go below 0 MDB it rolls over to a very high number and doesn't increase magic damage taken or reduce it.
Beta Was this translation helpful? Give feedback.
All reactions