weirdgloop / osrs-dps-calc

Web-based DPS calculator for Old School RuneScape
GNU General Public License v3.0
25 stars 25 forks source link

Blood moon set effect calcs #378

Closed DavidOStewart closed 4 weeks ago

DavidOStewart commented 4 weeks ago

What feature would you like to see?

Adding in the full blood moon set effect to the dps calc

Evidence

The blood moon set effect can be calculated as a modifier of the players attack speed, based on the players hit chance. Calculations will be shown in expanded form here and then simplified at the end with code blocks supplied:

Chance first hit lands: accuracy Chance first hit and does proc: accuracy * 1/3 Chance first hit lands and does not proc: accuracy * 2/3

For the second hit, we can only trigger the set effect if the first attack hit + did not trigger the set effect.

Chance independent second hit lands: accuracy Chance independent second hit lands and procs: accuracy / 3 Chance second hit lands and does proc = chance first hit lands and does not proc chance independent second hit lands and procs = `(accuracy 2/3) (accuracy / 3)=2 accuracy^2 / 9`

For the formulas below, I'll call this likelihood of triggering per attack as procChance to evaluate the effect of the proc on average ticks attack.

Overall attack speed is ((1 - procChance) normal aspd ) + (procChance (aspd - 1)), which simplifies down to just normal aspd - procChance.

With perfect accuracy, this drops the average ticks/attack with dual macs from 4 down to 3.444..., as we have a 55.5...% chance of landing a proc every attack.

Code to add this is as follows:

    // Blood moon set effect
    if (
      this.wearingAll(['Blood moon helm', 'Blood moon chestplate', 'Blood moon tassets', 'Dual macuahuitl'])
    ) {
      const acc = this.getHitChance();
      const procChance = (acc * acc) * 2  / 9
      attackSpeed -= procChance;
    }

inside the getAttackSpeed fn in PlayerVsNPCCalc, followed by removing blood moon gear from the unknown set effects list in BaseCalc

    // Some set effects are currently not accounted for
    if (
      this.wearingAll(['Blue moon helm', 'Blue moon chestplate', 'Blue moon tassets', 'Blue moon spear'])
      || this.wearingAll(['Eclipse moon helm', 'Eclipse moon chestplate', 'Eclipse moon tassets', 'Eclipse atlatl'])
    ) {
      this.addIssue(UserIssueType.EQUIPMENT_SET_EFFECT_UNSUPPORTED, 'The calculator currently does not account for your equipment set effect.');
    }
DavidOStewart commented 4 weeks ago

Added a PR here https://github.com/weirdgloop/osrs-dps-calc/pull/380