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

class HealingPerHolyPower extends Analyzer {
  totalEffectiveHealing = 0;
  totalSpenders = 0;

  constructor(options: Options) {
    super(options);

    this.addEventListener(
      Events.cast.by(SELECTED_PLAYER).spell(SPELLS.LIGHT_OF_DAWN_CAST),
      this.castSpender,
    );
    this.addEventListener(
      Events.cast.by(SELECTED_PLAYER).spell(SPELLS.WORD_OF_GLORY),
      this.castSpender,
    );
    this.addEventListener(
      Events.heal.by(SELECTED_PLAYER).spell(SPELLS.LIGHT_OF_DAWN_HEAL),
      this.healEvent,
    );
    this.addEventListener(
      Events.heal.by(SELECTED_PLAYER).spell(SPELLS.WORD_OF_GLORY),
      this.healEvent,
    );
  }

  castSpender(event: CastEvent) {
    this.totalSpenders += 1;
  }

  healEvent(event: HealEvent) {
    this.totalEffectiveHealing += event.amount + (event.absorbed || 0); // effective healing by default does not include healing done to healing absorbs, even though that is effective healing
  }

  statistic() {
    return (
      <Statistic
        position={STATISTIC_ORDER.CORE(13)}
        size="flexible"
        category={STATISTIC_CATEGORY.GENERAL}
        tooltip={
          <>
            Total healing by spenders, divided by total number of holy power spent on those spenders
          </>
        }
      >
        <div className="pad">
          <label>Healing per Holy Power</label>
          <div className="value">
            {formatNumber(this.totalEffectiveHealing / this.totalSpenders / 3)}
          </div>
        </div>
      </Statistic>
    );
  }
}

export default HealingPerHolyPower;
<commit_msg>Better tooltip<commit_after>import { formatNumber } from 'common/format';
import SPELLS from 'common/SPELLS';
import Analyzer, { Options, SELECTED_PLAYER } from 'parser/core/Analyzer';
import Events, { CastEvent, HealEvent } from 'parser/core/Events';
import Statistic from 'parser/ui/Statistic';
import STATISTIC_CATEGORY from 'parser/ui/STATISTIC_CATEGORY';
import STATISTIC_ORDER from 'parser/ui/STATISTIC_ORDER';

class HealingPerHolyPower extends Analyzer {
  totalEffectiveHealing = 0;
  totalSpenders = 0;

  constructor(options: Options) {
    super(options);

    this.addEventListener(
      Events.cast.by(SELECTED_PLAYER).spell(SPELLS.LIGHT_OF_DAWN_CAST),
      this.castSpender,
    );
    this.addEventListener(
      Events.cast.by(SELECTED_PLAYER).spell(SPELLS.WORD_OF_GLORY),
      this.castSpender,
    );
    this.addEventListener(
      Events.heal.by(SELECTED_PLAYER).spell(SPELLS.LIGHT_OF_DAWN_HEAL),
      this.healEvent,
    );
    this.addEventListener(
      Events.heal.by(SELECTED_PLAYER).spell(SPELLS.WORD_OF_GLORY),
      this.healEvent,
    );
  }

  castSpender(event: CastEvent) {
    this.totalSpenders += 1;
  }

  healEvent(event: HealEvent) {
    this.totalEffectiveHealing += event.amount + (event.absorbed || 0); // effective healing by default does not include healing done to healing absorbs, even though that is effective healing
  }

  statistic() {
    return (
      <Statistic
        position={STATISTIC_ORDER.CORE(13)}
        size="flexible"
        category={STATISTIC_CATEGORY.GENERAL}
        tooltip={
          <>
            Total healing by spenders, divided by total number of holy power spent on those spenders{' '}
            <br></br>
            Total healing from spenders: {this.totalEffectiveHealing} <br></br>
            Total spenders: {this.totalSpenders}
          </>
        }
      >
        <div className="pad">
          <label>Healing per Holy Power</label>
          <div className="value">
            {formatNumber(this.totalEffectiveHealing / this.totalSpenders / 3)}
          </div>
        </div>
      </Statistic>
    );
  }
}

export default HealingPerHolyPower;

{'fraction_non_alphanumeric': 0.1076514602944726, 'fraction_numerical': 0.0033791938209027277, 'mean_word_length': 3.050830889540567, 'pattern_counts': {'":': 0, '<': 27, '<?xml version=': 0, '>': 27, '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': '6815962', 'n_tokens_mistral': 1346, 'n_tokens_neox': 1303, 'n_words': 255}