Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Incorrect calculations for attribute "+X Poison Damage Over Y Seconds" #81

Open
vinijdc opened this issue Jul 29, 2023 · 0 comments
Open

Comments

@vinijdc
Copy link

vinijdc commented Jul 29, 2023

The calculations for the attribute "+X Poison Damage Over Y Seconds" are incorrect (lines 233-235 attribute_enhancer).
The correct math should be with Math.round instead of Math.floor.

    const min = Math.round((property.values[0] * property.values[2]) / 256);
    const max = Math.round((property.values[1] * property.values[2]) / 256);
    const seconds = Math.round(property.values[2] / 25);

Examples:

  1. Unique Item "Serpent Lord Long Staff":
    prop.values[0] = 40
    prop.values[1] = 40
    prop.values[2] = 75
    40 * 75 = 3,000 / 256 = 11.71875. It is rounded down to 11 Poison Damage, whereas the game item has 12.

  2. Unique Item "Blackbog's Sharp Cinquedeas" (helps to show why Math.ceil would also be wrong, in case one had the idea):
    prop.values[0] = 500
    prop.values[1] = 500
    prop.values[2] = 250
    500 * 250 = 125,000 / 256 = 488.28125. It would be rounded up to 489 Poison Damage, while the correct is 488.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant