<commit_before>import React from 'react';

import SPELLS from 'common/SPELLS';
import { formatNumber } from 'common/format';
import { calculateAzeriteEffects } from 'common/stats';
import Analyzer from 'parser/core/Analyzer';
import TraitStatisticBox, { STATISTIC_ORDER } from 'interface/others/TraitStatisticBox';
import StatTracker from 'parser/shared/modules/StatTracker';


const bloodyRunebladeStats = traits => Object.values(traits).reduce((obj, rank) => {
  const [haste] = calculateAzeriteEffects(SPELLS.BONES_OF_THE_DAMNED.id, rank);
  obj.haste += haste;
  return obj;
}, {
  haste: 0,
});

/**
 * Bloody Runeblade
 * When Crimson Scourge activates, you gain 0 Haste for 5 sec, and immediately gain 5 Runic Power.
 *
 * Example Report: https://www.warcraftlogs.com/reports/cC8kzR9YxnB3GMhr/#fight=12&source=14
 */
class BloddyRuneblade extends Analyzer{

  static dependencies = {
    statTracker: StatTracker,
  };

  haste = 0;
  bloddyRubebladeProcsCounter = 0;

  constructor(...args) {
    super(...args);
    this.active = this.selectedCombatant.hasTrait(SPELLS.BLOODY_RUNEBLADE.id);
    if (!this.active) {
      return;
    }

    const { haste } = bloodyRunebladeStats(this.selectedCombatant.traitsBySpellId[SPELLS.BLOODY_RUNEBLADE.id]);
    this.haste = haste;

    this.statTracker.add(SPELLS.BLOODY_RUNEBLADE_BUFF.id, {
      haste,
    });
  }

  on_byPlayer_applybuff(event) {
    const spellId = event.ability.guid;
    if (spellId !== SPELLS.BLOODY_RUNEBLADE_BUFF.id) {
      return;
    }
    this.bloddyRubebladeProcsCounter += 1;
  }

  get averageHaste() {
    return this.selectedCombatant.getBuffUptime(SPELLS.BLOODY_RUNEBLADE_BUFF.id) / this.owner.fightDuration * this.haste;
  }

  statistic(){
    return (
      <TraitStatisticBox
        position={STATISTIC_ORDER.OPTIONAL()}
        trait={SPELLS.BLOODY_RUNEBLADE.id}
        value={(
          <>
            {this.bloddyRubebladeProcsCounter} Procs <br />
            {formatNumber(this.averageHaste)} average Haste
          </>
        )}
        tooltip={`
          `}
      />
    );
  }
}

export default BloddyRuneblade;<commit_msg>removed empty tooltip<commit_after>import React from 'react';

import SPELLS from 'common/SPELLS';
import { formatNumber } from 'common/format';
import { calculateAzeriteEffects } from 'common/stats';
import Analyzer from 'parser/core/Analyzer';
import TraitStatisticBox, { STATISTIC_ORDER } from 'interface/others/TraitStatisticBox';
import StatTracker from 'parser/shared/modules/StatTracker';


const bloodyRunebladeStats = traits => Object.values(traits).reduce((obj, rank) => {
  const [haste] = calculateAzeriteEffects(SPELLS.BONES_OF_THE_DAMNED.id, rank);
  obj.haste += haste;
  return obj;
}, {
  haste: 0,
});

/**
 * Bloody Runeblade
 * When Crimson Scourge activates, you gain 0 Haste for 5 sec, and immediately gain 5 Runic Power.
 *
 * Example Report: https://www.warcraftlogs.com/reports/cC8kzR9YxnB3GMhr/#fight=12&source=14
 */
class BloddyRuneblade extends Analyzer{

  static dependencies = {
    statTracker: StatTracker,
  };

  haste = 0;
  bloddyRubebladeProcsCounter = 0;

  constructor(...args) {
    super(...args);
    this.active = this.selectedCombatant.hasTrait(SPELLS.BLOODY_RUNEBLADE.id);
    if (!this.active) {
      return;
    }

    const { haste } = bloodyRunebladeStats(this.selectedCombatant.traitsBySpellId[SPELLS.BLOODY_RUNEBLADE.id]);
    this.haste = haste;

    this.statTracker.add(SPELLS.BLOODY_RUNEBLADE_BUFF.id, {
      haste,
    });
  }

  on_byPlayer_applybuff(event) {
    const spellId = event.ability.guid;
    if (spellId !== SPELLS.BLOODY_RUNEBLADE_BUFF.id) {
      return;
    }
    this.bloddyRubebladeProcsCounter += 1;
  }

  get averageHaste() {
    return this.selectedCombatant.getBuffUptime(SPELLS.BLOODY_RUNEBLADE_BUFF.id) / this.owner.fightDuration * this.haste;
  }

  statistic(){
    return (
      <TraitStatisticBox
        position={STATISTIC_ORDER.OPTIONAL()}
        trait={SPELLS.BLOODY_RUNEBLADE.id}
        value={(
          <>
            {this.bloddyRubebladeProcsCounter} Procs <br />
            {formatNumber(this.averageHaste)} average Haste
          </>
        )}
      />
    );
  }
}

export default BloddyRuneblade;
{'fraction_non_alphanumeric': 0.11927255550307038, 'fraction_numerical': 0.006613131790269249, 'mean_word_length': 3.4345549738219896, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 15, 'https://': 2, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3837939', 'n_tokens_mistral': 1590, 'n_tokens_neox': 1506, 'n_words': 248}