Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
I don't know who came up with the idea to just tweak magic damage the component (mana blast, arcane guardian, and other magic damage sources would completely bypass magic resist). For now I would just leave the code in potionhandler to not have another listener running, and have it work smoothly with things like mana shield and magic shield. Oh yea, it also works on a pretty ridiculous log scale.
Current formula:
y = e^(x/0.32845873875) - 1
where x is the total level of magic resist of all equipped armor, and y is the percent reduction granted.
Example: at 20 total levels (full MR 5 armor set), y would be 1, or 100% damage reduction.
Here's a table with a few level values:
Total Magic Resist Level | Percent Reduction Granted
-----------1---------------------------22.8%
-----------3---------------------------45.6%
-----------4---------------------------53.9%
-----------5---------------------------58.9%
-----------8---------------------------72.2%
----------12---------------------------84.3%
----------16---------------------------93.1%
----------20---------------------------100.0%
Note: Dragon Breath is also affected, as it's pretty close to being magic damage in my opinion, and I put a linear scaling formula right next to the log one (5% per level) if you want to use that one instead. I also felt like that the actual code could be put in the entityhandler, but somehow I can't get that to work.