MSUTeam/MSU

famed Ranged Dobble hit chance [BUG]

Closed this issue · 5 comments

Versions

  • Game: [e.g. 1.5.0.13]
  • MSU: [e.g. 1.2.6]

Describe the bug
["Additional hit chance" from Famed Ranged wpn (except handgone) dobbles]

Expected behavior
Example:

  • Bro with Famed goblinbow having 10% additional hit chance, the Quick Shot skill tooltip from that weapon dobbles increased hit chance (20% instead of 10% comparing to vanilla, no MSU version).

Screenshots
If applicable, add screenshots to help explain your problem.

https://we.tl/t-S92Ea8SpLa

Darxo commented

This has probably something to do with MSU writing the AdditionalAccuracy of the weapon into every skill added by that weapon:
https://github.com/MSUTeam/MSU/blob/49177ceb4ce3dca8ece18f48d39e66c3c383896b/msu/hooks/items/weapons/weapon.nut#L42C3-L42C3

Not sure though where the bug exactly in the code lies

Not sure how we missed this, this'll be fixed and pushed ASAP

Confirmed this is legit. Looking for cause now

We previously had a bug report on Nexus about additional hit chance from famed weapons not applying. We fixed that - and therefore everything imo should be working normally now. The issue was that MSU does a soft reset of AdditionalAccuracy during onAnySkillUsed, therefore it is necessary for us to set the base value of AdditionalAccuracy of the skill to that of the item in the addSkill function in weapon.nut.

From what I have looked at the code so far, I cannot see a reason why the bonus is being applied double. I will keep looking.

Ok I found and fixed the issue. It was because we were not resetting the AdditionalAccuracy of the skill in weapon.nut before adding the AdditionalAccuracy of the item. Because an update had already happened during addSkill, the AdditionalAccuracy of Quick Shot was set to that of the item due to the vanilla onAfterUpdate function of Quick Shot. Then we added the item's accuracy to it again and then saved that as the base value.

In the fix, I now reset the AdditionalAccuracy of the skill in the addSkill function before adding the item's to it.