<commit_before>import { formatNumber } from 'common/format';
import SPELLS from 'common/SPELLS';
import Analyzer, { SELECTED_PLAYER } from 'parser/core/Analyzer';
import Events, { HealEvent } from 'parser/core/Events';
import { Options } from 'parser/core/EventSubscriber';
import ConduitSpellText from 'parser/ui/ConduitSpellText';
import ItemHealingDone from 'parser/ui/ItemHealingDone';
import Statistic from 'parser/ui/Statistic';
import STATISTIC_CATEGORY from 'parser/ui/STATISTIC_CATEGORY';
import STATISTIC_ORDER from 'parser/ui/STATISTIC_ORDER';

import { SHATTERED_RESTORATION_SCALING } from '@wowanalyzer/demonhunter';

export default class ShatteredRestoration extends Analyzer {
  heal = 0;
  factor = 0;
  rank = 0;

  constructor(options: Options) {
    super(options);
    this.active = this.selectedCombatant.hasConduitBySpellID(SPELLS.SHATTERED_RESTORATION.id);

    if (!this.active) {
      return;
    }

    this.rank = this.selectedCombatant.conduitRankBySpellID(SPELLS.SHATTERED_RESTORATION.id);
    this.factor = SHATTERED_RESTORATION_SCALING[this.rank];

    this.addEventListener(
      Events.heal.by(SELECTED_PLAYER).spell(SPELLS.CONSUME_SOUL_VDH),
      this.onHeal,
    );
  }

  onHeal(event: HealEvent) {
    this.heal += event.amount + (event.absorbed || 0);
  }

  statistic() {
    const effectiveHealing = this.heal - (this.heal * 100) / (this.factor * 100 + 100);

    return (
      <Statistic
        category={STATISTIC_CATEGORY.COVENANTS}
        position={STATISTIC_ORDER.CORE(9)}
        size="flexible"
        tooltip={
          <>
            This shows the extra hps that the conduit provides.
            <br />
            <strong>Total extra healing:</strong> {formatNumber(effectiveHealing)}
          </>
        }
      >
        <ConduitSpellText spellId={SPELLS.SHATTERED_RESTORATION.id} rank={this.rank}>
          <ItemHealingDone amount={effectiveHealing} />
        </ConduitSpellText>
      </Statistic>
    );
  }
}<commit_msg>fix: rank factor on shattered resto<commit_after>import { formatNumber } from 'common/format';
import SPELLS from 'common/SPELLS';
import Analyzer, { SELECTED_PLAYER } from 'parser/core/Analyzer';
import Events, { HealEvent } from 'parser/core/Events';
import { Options } from 'parser/core/EventSubscriber';
import ConduitSpellText from 'parser/ui/ConduitSpellText';
import ItemHealingDone from 'parser/ui/ItemHealingDone';
import Statistic from 'parser/ui/Statistic';
import STATISTIC_CATEGORY from 'parser/ui/STATISTIC_CATEGORY';
import STATISTIC_ORDER from 'parser/ui/STATISTIC_ORDER';

import { SHATTERED_RESTORATION_SCALING } from '@wowanalyzer/demonhunter';

export default class ShatteredRestoration extends Analyzer {
  heal = 0;
  factor = 0;
  rank = 0;

  constructor(options: Options) {
    super(options);
    this.active = this.selectedCombatant.hasConduitBySpellID(SPELLS.SHATTERED_RESTORATION.id);

    if (!this.active) {
      return;
    }

    this.rank = this.selectedCombatant.conduitRankBySpellID(SPELLS.SHATTERED_RESTORATION.id);

    this.addEventListener(
      Events.heal.by(SELECTED_PLAYER).spell(SPELLS.CONSUME_SOUL_VDH),
      this.onHeal,
    );
  }

  onHeal(event: HealEvent) {
    this.heal += event.amount + (event.absorbed || 0);
  }

  statistic() {
    const effectiveHealing =
      this.heal - (this.heal / (100 + SHATTERED_RESTORATION_SCALING[this.rank])) * 100;

    return (
      <Statistic
        category={STATISTIC_CATEGORY.COVENANTS}
        position={STATISTIC_ORDER.CORE(9)}
        size="flexible"
        tooltip={
          <>
            This shows the extra hps that the conduit provides.
            <br />
            <strong>Total extra healing:</strong> {formatNumber(effectiveHealing)}
          </>
        }
      >
        <ConduitSpellText spellId={SPELLS.SHATTERED_RESTORATION.id} rank={this.rank}>
          <ItemHealingDone amount={effectiveHealing} />
        </ConduitSpellText>
      </Statistic>
    );
  }
}
{'fraction_non_alphanumeric': 0.11332158146562579, 'fraction_numerical': 0.006295643414756988, 'mean_word_length': 3.4182424916573972, 'pattern_counts': {'":': 0, '<': 23, '<?xml version=': 0, '>': 23, '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': '3637878', 'n_tokens_mistral': 1375, 'n_tokens_neox': 1332, 'n_words': 232}