{"action":"created","issue":{"url":"https://api.github.com/repos/elysium-project/classic-bug-tracker/issues/1002","repository_url":"https://api.github.com/repos/elysium-project/classic-bug-tracker","labels_url":"https://api.github.com/repos/elysium-project/classic-bug-tracker/issues/1002/labels{/name}","comments_url":"https://api.github.com/repos/elysium-project/classic-bug-tracker/issues/1002/comments","events_url":"https://api.github.com/repos/elysium-project/classic-bug-tracker/issues/1002/events","html_url":"https://github.com/elysium-project/classic-bug-tracker/issues/1002","id":392793706,"node_id":"MDU6SXNzdWUzOTI3OTM3MDY=","number":1002,"title":"Spell resist and penetration probably not blizzlike","user":{"login":"namreeb","id":5429489,"node_id":"MDQ6VXNlcjU0Mjk0ODk=","avatar_url":"https://avatars1.githubusercontent.com/u/5429489?v=4","gravatar_id":"","url":"https://api.github.com/users/namreeb","html_url":"https://github.com/namreeb","followers_url":"https://api.github.com/users/namreeb/followers","following_url":"https://api.github.com/users/namreeb/following{/other_user}","gists_url":"https://api.github.com/users/namreeb/gists{/gist_id}","starred_url":"https://api.github.com/users/namreeb/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/namreeb/subscriptions","organizations_url":"https://api.github.com/users/namreeb/orgs","repos_url":"https://api.github.com/users/namreeb/repos","events_url":"https://api.github.com/users/namreeb/events{/privacy}","received_events_url":"https://api.github.com/users/namreeb/received_events","type":"User","site_admin":false},"labels":[{"id":893823250,"node_id":"MDU6TGFiZWw4OTM4MjMyNTA=","url":"https://api.github.com/repos/elysium-project/classic-bug-tracker/labels/High%20Priority","name":"High Priority","color":"c583db","default":false},{"id":1139538360,"node_id":"MDU6TGFiZWwxMTM5NTM4MzYw","url":"https://api.github.com/repos/elysium-project/classic-bug-tracker/labels/Investigating","name":"Investigating","color":"1b22a3","default":false}],"state":"open","locked":false,"assignee":{"login":"namreeb","id":5429489,"node_id":"MDQ6VXNlcjU0Mjk0ODk=","avatar_url":"https://avatars1.githubusercontent.com/u/5429489?v=4","gravatar_id":"","url":"https://api.github.com/users/namreeb","html_url":"https://github.com/namreeb","followers_url":"https://api.github.com/users/namreeb/followers","following_url":"https://api.github.com/users/namreeb/following{/other_user}","gists_url":"https://api.github.com/users/namreeb/gists{/gist_id}","starred_url":"https://api.github.com/users/namreeb/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/namreeb/subscriptions","organizations_url":"https://api.github.com/users/namreeb/orgs","repos_url":"https://api.github.com/users/namreeb/repos","events_url":"https://api.github.com/users/namreeb/events{/privacy}","received_events_url":"https://api.github.com/users/namreeb/received_events","type":"User","site_admin":false},"assignees":[{"login":"namreeb","id":5429489,"node_id":"MDQ6VXNlcjU0Mjk0ODk=","avatar_url":"https://avatars1.githubusercontent.com/u/5429489?v=4","gravatar_id":"","url":"https://api.github.com/users/namreeb","html_url":"https://github.com/namreeb","followers_url":"https://api.github.com/users/namreeb/followers","following_url":"https://api.github.com/users/namreeb/following{/other_user}","gists_url":"https://api.github.com/users/namreeb/gists{/gist_id}","starred_url":"https://api.github.com/users/namreeb/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/namreeb/subscriptions","organizations_url":"https://api.github.com/users/namreeb/orgs","repos_url":"https://api.github.com/users/namreeb/repos","events_url":"https://api.github.com/users/namreeb/events{/privacy}","received_events_url":"https://api.github.com/users/namreeb/received_events","type":"User","site_admin":false}],"milestone":null,"comments":5,"created_at":"2018-12-19T21:59:23Z","updated_at":"2018-12-23T21:37:57Z","closed_at":null,"author_association":"NONE","body":"# Summary\r\n\r\nThis is a bit hard to narrow down because there probably at least two bugs, one of which is mob resist levels being incorrect, but that is not covered here.  If anyone is aware of any resources describing what the blizzlike boss spell resist levels should be (i.e. \"KT should have 200 fire resist because of this evidence\") **please** share it below!\r\n\r\nI am currently using this issue as a place to store research and hopefully elicit some discussion from the community.\r\n\r\n- Last copy of the resistance information from the wow website before 2.0 was released: http://web.archive.org/web/20061128170702/http://worldofwarcraft.com/info/basics/resistances.html\r\n- Wowwiki article on magical resistance, the last revision before 2.0 was released: http://wowwiki.wikia.com/wiki/Formulas:Magical_resistance?oldid=295639\r\n- This is another interesting archived post from the elitistjerks forum, but it was made during TBC, so I'm not sure how credible it is as the resist mechanic could have changed: http://web.archive.org/web/20110810111044/http://elitistjerks.com/f15/t10712-resisting_magical_damage_its_relation_resistance_levels/p4/\r\n\r\nThe first two sites seem to agree that there are two rolls involved.  First, a \"miss chance\" which is determined by the level difference between the caster and the target as well as spell hit chance % buffs of the caster.  Second, a \"resist chance\" which is determined by the caster level and the resistance level of the target to that school.  Note that the level of the target is not a factor in the second roll.\r\n\r\n# Miss Chance\r\n\r\nAccording to the [wowwiki article](http://wowwiki.wikia.com/wiki/Formulas:Magical_resistance?oldid=295639), the percent miss chance is defined using the table below:\r\n\r\n|Level difference (target level - caster level)|PvE|PvP|\r\n|-----------------|----|----|\r\n|<= 0|4|4|\r\n|1|5|5|\r\n|2|6|6|\r\n|3|17|13|\r\n|4|28|20|\r\n|5|39|27|\r\n|>=6|50 + (levelDiff - 6)*11|34+(levelDiff - 6)*7|\r\n\r\nThe miss chance cannot fallow below 1%.  It also cannot exceed 99%.  This occurs with a level difference of 11 in PvE and 16 in PvP.  Once the miss chance is computed, hit chance of the caster is added to it.  If the miss chance roll \"wins\" (meaning the spell should miss), nothing more needs to happen.\r\n\r\nExample: Level 60 mage casting against a boss (which are considered to be level 63), the level difference is 3 and since it is PvE there is a 17% miss chance, 16% of which can be negated with hit chance from the caster.  This is why spell hit cap in end game raiding is considered to be 16%.\r\n\r\n# Resist Chance\r\n\r\nIn this context, there are two types of spells: binary and non-binary.  Binary spells cannot be partially resisted.  I'm not sure how binary spells are affected by resist chance.  For non-binary spells, there are four percentage resist possibilities: 0%, 25%, 50%, or 75%.  Resist chance is a function of the level of the caster and the \"resistance score\" of the victim.  The level of the victim is **NOT** a factor.  The victim resistance score is their resistance level minus the spell penetration level of the caster.\r\n\r\n## Average Resistance\r\n\r\nAccording to the [wowwiki article](http://wowwiki.wikia.com/wiki/Formulas:Magical_resistance?oldid=295639), the formula to determine average damage resisted is:\r\n\r\n```\r\n= averageResist / taken\r\n= (1 / (1 - damage reduction)) - 1\r\n= (1 / (1 - 0.75 * (resistScore / (5 * casterLevel)))) - 1\r\n```\r\n\r\nNote that 'taken' is how much damage is taken **AFTER** resist.  So if `resist / taken = 1`, this signifies that `resist` and `taken` are equal, or 50% resist.\r\n\r\nTo make it easier to understand, there are three examples of this formula given on the article.\r\n\r\n1. A level 60 casts a spell targeting a unit with a resist score of 200.  The ratio of damage resisted to damage taken is computed as follows:\r\n\r\n```\r\n= (1 / (1 - 0.75 * (200 / (5 * 60)))) - 1\r\n= (1 / (1 - 0.75 * (200 / 300))) - 1\r\n= (1 / (1 - 0.75 * (2/3))) - 1\r\n= (1 / (1 - (3/4)*(2/3))) - 1\r\n= (1 / (1 - (6/12))) - 1\r\n= (1 / (1 - 0.5)) - 1\r\n= (1 / 0.5) - 1\r\n= 1\r\n```\r\n\r\nThis means that `resist / taken = 1`, and since `damage = resist + taken`, it follows that `taken = damage - resist`, so we can rewrite this as `resist = damage - resist`.  ** FIX THIS **\r\n\r\nThis matches the article.\r\n\r\n2.  A level 63 unit casts a spell targeting a unit with a resist score of 15.  The ratio of damage resisted to damage taken is computed as follows:\r\n\r\n```\r\n= (1 / (1 - 0.75 * (15 / (5 * 63)))) - 1\r\n= (1 / (1 - 0.75 * (15 / 315))) - 1\r\n= (1 / (1 - (3 / 4) * (15 / 315))) - 1\r\n= (1 / (1 - (45 / 1260))) - 1\r\n= (1 / (1 - 0.0357)) - 1\r\n= (1 / 0.9642) - 1\r\n= 1.037 - 1\r\n= 0.037\r\n```\r\n\r\nTherefore, `resist / taken = 0.037`.  If the spell damage was 1000, we know that `taken = 1000 - resist`, and it follows that:\r\n\r\n```\r\nresist / (1000 - resist) = 0.037\r\nresist = 0.037 * (1000 - resist)\r\nresist = 37 - 0.037*resist\r\n1.037*resist = 37\r\nresist = 37 / 1.037 = 35.68\r\n```\r\n\r\n3.  A level 63 unit casts a spell targeting a unit with a resist score of 210.  The ratio of damage resisted to damage taken is computed as follows:\r\n\r\n```\r\n= (1 / (1 - 0.75 * (210 / (5 * 63)))) - 1\r\n= (1 / (1 - 0.75 * (210 / 315))) - 1\r\n= (1 / (1 - 0.75 * (2/33))) - 1\r\n= (1 / (1 - (3/4) * (2/3))) - 1\r\n= (1 / (1 - (6/12))) - 1\r\n= (1 / (1 - 0.5)) - 1\r\n= (1 / 0.5) - 1\r\n= 2 - 1\r\n= 1\r\n```\r\n\r\nWe can generalize our approach from example 2 like this, where `d` is the damage of the spell, and `R` is the ratio of damage resisted to damage taken, calculated just above.\r\n```\r\nresist / (d - resist) = R\r\nresist = R * (d - resist)\r\nresist = R*d - R*resist\r\nR*resist + resist = R*d\r\nresist*(R+1) = R*d\r\nresist = (R * d) / (R + 1)\r\n```\r\n\r\nFor example two, this gives us:\r\n\r\n```\r\nresist = (0.037 * 1000) / (0.037 + 1) = 37 / 1.037 = 35.68\r\n```\r\n\r\nA 35.68% reduction is consistent with the article (111 resisted and 3000 taken means 111 resisted of 3111 damage done, and 111/3111 = 35.68%).\r\n\r\nFor example three, assuming 1000 spell damage we get:\r\n\r\n```\r\nresist = (1 * 1000) / (1 + 1) = 1000 / 2 = 500\r\n```\r\n\r\nA 50% reduction is consistent with the article (3000 resisted, 3000 taken, means 3000 resisted of 6000 done, and 3000/6000 = 50%).\r\n\r\n## Individual Cast Resistance\r\n\r\nThe formulas above speak to average resistance over repeated casts, but this is not sufficient.  We know that a spell may only be resisted by 0%, 25%, 50%, or 75%.  We need an algorithm to determine when each of those possibilities is to be used.  The approach which conceptually might be the easiest at this point is to use the above formula and round it to the nearest of the possible values (0, 0.25, 0.5, or 0.75).  I believe this would guarantee averages that match what we expect.  However this is computationally intensive and the implementation of it would be fairly difficult to understand.  Fortunately, the [elitist jerks article](http://web.archive.org/web/20110810111044/http://elitistjerks.com/f15/t10712-resisting_magical_damage_its_relation_resistance_levels/p4/) gives us a piecewise linear function which is considerably simpler.  And while it is true that the data was gathered in TBC, employing piecewise linear function **does** yield the anticipated average resistance values above.  Based on that I am assuming that this did not change between 1.12 and 2.0.12 (which was the patch that was live when these forum posts were made).  The linear function is as follows:\r\n\r\nLet `r = casterLevel / 60`, `x = resistScore` (of victim), `y = % of hits taken`, the following table defines the piecewise formula:\r\n\r\n|% resist|0 <= x < 100r|100r <= x < 200r|200r <= x < 300r|300r <= x|\r\n|--------|----------------|-------------------|------------------|-----------|\r\n|0|100y = 10000 - 76x|100y = 4800 - 24x|0|0|\r\n|25|100y = 55x|100y = 9100 - 36x|100y = 4900 - 15x|4|\r\n|50|100y = 18x|100y = 37x - 1900|100y = 13300 - 39x|16|\r\n|75|100y = 3x|100y = 23x - 2000|100y = 54x - 8200|80|\r\n\r\n### Example 1\r\n\r\nFor a level 60 mage casting Fireball on a boss (level 63) with a fire resist score of 99, `r = 60 / 60 = 1`, `x = 99`.  The inequality which this matches is `0 <= x < 100r`.\r\n\r\n0% resist chance:\r\n```\r\n100*y = 10000 - 76*99\r\n100*y = 10000 - 7524 = 2476\r\ny = 2476 / 100 = 24.76\r\n```\r\n25% resist chance:\r\n```\r\n100*y = 55*99\r\n100*y = 5445\r\ny = 54.45\r\n```\r\n50% resist chance:\r\n```\r\n100*y = 18*99\r\n100*y = 1782\r\ny = 17.82\r\n```\r\n75% resist chance:\r\n```\r\n100*y = 3*99\r\n100*y = 297\r\ny = 2.97\r\n```\r\n\r\nTherefore the chance to resist 0%, 25%, 50%, and 75% of the spell damage is 24.76%, 54.45%, 17.82%, and 2.97% respectively.  Note that those four values add to 100%, which we would expect.\r\n\r\n### Example 2\r\n\r\nFor a boss (level 63) casting Fireball on a level 60 player with a fire resist score of 250, `r = 63 / 60 = 1.05`, `x = 250`.  The inequality which this matches is `200r <= x < 300r`.\r\n\r\n0% resist chance: `0`\r\n25% resist chance:\r\n```\r\n100*y = 4900 - 15*250\r\n100*y = 4900 - 3750\r\n100*y = 1150\r\ny = 11.5\r\n```\r\n50% resist chance:\r\n```\r\n100*y = 13300 - 39*250\r\n100*y = 13300 - 9750\r\n100*y = 3550\r\ny = 35.5\r\n```\r\n75% resist chance:\r\n```\r\n100*y = 54*250 - 8200\r\n100*y = 13500 - 8200\r\n100*y = 5300\r\ny = 53\r\n```\r\n\r\nTherefore the chance to resist 0%, 25%, 50%, and 75% of the spell damage is 0%, 11.5%, 35.5%, and 53% respectively.  Note that those four values add to 100%, which we would expect.\r\n\r\n### Example 3\r\n\r\nFor a level 50 mage casting Fireball on a unit with 250 fire resist score (the example from the [WoW website](http://web.archive.org/web/20061128170702/http://worldofwarcraft.com/info/basics/resistances.html)), `r = 50 / 60 = 0.8333`, `x = 250`.  The inequality which this matches is `300r <= x` since `300 * r = 300 * (5 / 6) = 250` and `250 <= 250`.\r\n\r\n0% resist chance: 0\r\n25% resist chance: 4\r\n50% resist: 16\r\n75% resist: 80\r\n\r\nThese obviously add to 100% chance, which we would expect.  Further, the website claims that the weighted average for this scenario would result in roughly 75% damage reduction.  The weighted average is calculated as:\r\n\r\n`(25 * 4 + 50 * 16 + 75 * 80) / 100 = 70%` which is not exact, but pretty close.  I have no explanation for this slight discrepancy, but I'm not sure that it matters very much.  My best guess is the WoW website page made secret assumptions about the victim's level and included miss chance in the weighted average calculation.\r\n\r\n## Binary Spells\r\n\r\nI think that for now a reasonable guess at how binary spells are affected by resist chance is that if the roll for resist chance results in a 50% or 75% resist, it will be fully resisted, otherwise not resisted at all."},"comment":{"url":"https://api.github.com/repos/elysium-project/classic-bug-tracker/issues/comments/449664723","html_url":"https://github.com/elysium-project/classic-bug-tracker/issues/1002#issuecomment-449664723","issue_url":"https://api.github.com/repos/elysium-project/classic-bug-tracker/issues/1002","id":449664723,"node_id":"MDEyOklzc3VlQ29tbWVudDQ0OTY2NDcyMw==","user":{"login":"namreeb","id":5429489,"node_id":"MDQ6VXNlcjU0Mjk0ODk=","avatar_url":"https://avatars1.githubusercontent.com/u/5429489?v=4","gravatar_id":"","url":"https://api.github.com/users/namreeb","html_url":"https://github.com/namreeb","followers_url":"https://api.github.com/users/namreeb/followers","following_url":"https://api.github.com/users/namreeb/following{/other_user}","gists_url":"https://api.github.com/users/namreeb/gists{/gist_id}","starred_url":"https://api.github.com/users/namreeb/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/namreeb/subscriptions","organizations_url":"https://api.github.com/users/namreeb/orgs","repos_url":"https://api.github.com/users/namreeb/repos","events_url":"https://api.github.com/users/namreeb/events{/privacy}","received_events_url":"https://api.github.com/users/namreeb/received_events","type":"User","site_admin":false},"created_at":"2018-12-23T21:37:57Z","updated_at":"2018-12-23T21:37:57Z","author_association":"NONE","body":"> The archive for the original posting of the official data does point out that 100% of a spell can be resisted; the chance to resist 100% of a spells direct damage even appears to be as high as 25% at (50*Attacker Level) resistance. The elitist jerks post that you reference doesn't seem to account for that, although maybe I didn't read closely enough. I figure Hydross may have been an exception rather than the rule for magical resistances (possibly).\r\n\r\nYou make a good point here.  I had been under the impression that it was spell miss chance, rather than spell resist chance, which exclusively accounted for the 100% mitigation scenario.  However, the table on the [wow site](http://web.archive.org/web/20061128170702/http://worldofwarcraft.com/info/basics/resistances.html) shows the chance of 100% mitigation increasing based on the resistance score of the victim, which is not a factor in the miss chance calculation.  I missed that before.  However that same site says:\r\n\r\n>  The higher your resistance score in relation to the level of the attacking caster, the higher your average resistance percentage, up to a maximum of 75%.\r\n\r\nI don't see how to reconcile these two statements from that page.  Do you have any thoughts on this?\r\n\r\n> I believe one should be able to take the official data and turn it into a piecewise linear function for each tier of resistance (0, 25%, 50%, 75%, 100%)\r\n\r\nThe problem with this site, and with what you propose, is that I think we do not have enough data here to generalize the piecewise function for all levels.  That is what I was leaning on the elitistjerks article for.  And the portion of my post above which works out the weighted average is only meant to show that their proposed piecewise linear function closely matches the example from the wow site.\r\n"}}
{"actor":{"display_login":"namreeb"}}