<commit_before>import React from 'react';
import Analyzer, { Options, SELECTED_PLAYER } from 'parser/core/Analyzer';
import SPELLS from 'common/SPELLS';
import { formatPercentage } from 'common/format';
import Statistic from 'interface/statistics/Statistic';
import STATISTIC_ORDER from 'interface/others/STATISTIC_ORDER';
import Events, { DamageEvent } from 'parser/core/Events';
import { When, ThresholdStyle, NumberThreshold } from 'parser/core/ParseResults';
import BoringSpellValue from 'interface/statistics/components/BoringSpellValue';
import { Trans } from '@lingui/macro';

class Consecration extends Analyzer {
  _hitsTaken: number = 0;
  _hitsMitigated: number = 0;

  constructor(options: Options) {
    super(options);
    this.addEventListener(Events.damage.to(SELECTED_PLAYER), this.onPlayerDamage);
  }

  onPlayerDamage(event: DamageEvent) {
    this._hitsTaken += 1;
    if(this.selectedCombatant.hasBuff(SPELLS.CONSECRATION_BUFF.id)) {
      this._hitsMitigated += 1;
    }
  }

  get pctHitsMitigated(): number {
    return this._hitsMitigated / this._hitsTaken;
  }

  get uptimeSuggestionThresholds(): NumberThreshold {
    return {
      actual: this.pctHitsMitigated,
      isLessThan: {
        minor: 0.95,
        average: 0.9,
        major: .8,
      },
      style: ThresholdStyle.PERCENTAGE,
    };
  }

  suggestions(when: When) {
    when(this.uptimeSuggestionThresholds)
        .addSuggestion((suggest, actual, recommended) => suggest('Your Consecration usage can be improved. Maintain it to reduce all incoming damage and refresh it during rotational downtime.')
            .icon(SPELLS.CONSECRATION_CAST.icon)
            .actual(`${formatPercentage(actual)}% of hits were mitigated by Consecration `)
            .recommended(`>${formatPercentage(recommended)}% is recommended`));
  }

  statistic() {
    // return (
    //   <StatisticBox
    //     icon={<SpellIcon id={SPELLS.CONSECRATION_CAST.id} />}
    //     value={`${formatPercentage(this.pctHitsMitigated)} %`}
    //     label="Hits Mitigated w/ Consecration"
    //   />
    // );
    return (
      <Statistic
        position={STATISTIC_ORDER.CORE(2)}
        size="flexible"
        >
          <BoringSpellValue
            spell={SPELLS.CONSECRATION_CAST}<commit_msg>Remove dead code from Consecration.tsx<commit_after>import React from 'react';
import Analyzer, { Options, SELECTED_PLAYER } from 'parser/core/Analyzer';
import SPELLS from 'common/SPELLS';
import { formatPercentage } from 'common/format';
import Statistic from 'interface/statistics/Statistic';
import STATISTIC_ORDER from 'interface/others/STATISTIC_ORDER';
import Events, { DamageEvent } from 'parser/core/Events';
import { When, ThresholdStyle, NumberThreshold } from 'parser/core/ParseResults';
import BoringSpellValue from 'interface/statistics/components/BoringSpellValue';
import { Trans } from '@lingui/macro';

class Consecration extends Analyzer {
  _hitsTaken: number = 0;
  _hitsMitigated: number = 0;

  constructor(options: Options) {
    super(options);
    this.addEventListener(Events.damage.to(SELECTED_PLAYER), this.onPlayerDamage);
  }

  onPlayerDamage(event: DamageEvent) {
    this._hitsTaken += 1;
    if(this.selectedCombatant.hasBuff(SPELLS.CONSECRATION_BUFF.id)) {
      this._hitsMitigated += 1;
    }
  }

  get pctHitsMitigated(): number {
    return this._hitsMitigated / this._hitsTaken;
  }

  get uptimeSuggestionThresholds(): NumberThreshold {
    return {
      actual: this.pctHitsMitigated,
      isLessThan: {
        minor: 0.95,
        average: 0.9,
        major: .8,
      },
      style: ThresholdStyle.PERCENTAGE,
    };
  }

  suggestions(when: When) {
    when(this.uptimeSuggestionThresholds)
        .addSuggestion((suggest, actual, recommended) => suggest('Your Consecration usage can be improved. Maintain it to reduce all incoming damage and refresh it during rotational downtime.')
            .icon(SPELLS.CONSECRATION_CAST.icon)
            .actual(`${formatPercentage(actual)}% of hits were mitigated by Consecration `)
            .recommended(`>${formatPercentage(recommended)}% is recommended`));
  }

  statistic() {
    return (
      <Statistic
        position={STATISTIC_ORDER.CORE(2)}
        size="flexible"
        >
          <BoringSpellValue
            spell={SPELLS.CONSECRATION_CAST}
{'fraction_non_alphanumeric': 0.11308562197092084, 'fraction_numerical': 0.005077313639510732, 'mean_word_length': 3.509885535900104, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, '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': '1086583', 'n_tokens_mistral': 1425, 'n_tokens_neox': 1343, 'n_words': 274}