Skip to content

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

@vinijdc

Description

@vinijdc

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions