<commit_before>import React from 'react';

import Analyzer from 'Parser/Core/Analyzer';

import SPELLS from 'common/SPELLS';
import SpellLink from 'common/SpellLink';
import ItemDamageDone from 'Main/ItemDamageDone';
import Enemies from 'Parser/Core/Modules/Enemies';
import getDamageBonus from 'Parser/Hunter/Shared/Modules/getDamageBonus';
import StatisticBox from 'Main/StatisticBox';
import SpellIcon from 'common/SpellIcon';
import { formatPercentage } from 'common/format';

/**
 * Apply Hunter's Mark to the target, increasing all damage you deal to the marked target by 5%.
 * If the target dies while affected by Hunter's Mark, you instantly gain 20 Focus.
 * The target can always be seen and tracked by the Hunter.
 *
 * Only one Hunter's Mark can be applied at a time.
 */

const HUNTERS_MARK_MODIFIER = 0.05;
const MS_BUFFER = 100;
const FOCUS_PER_REFUND = 20;

class HuntersMark extends Analyzer {
  static dependencies = {
    enemies: Enemies,
  };

  casts = 0;
  timeOfCast = null;
  damage = 0;
  recasts = 0;
  refunds = 0;
  precastConfirmed = false;
  precast = false;
  markWindow = [];
  damageToTarget = [];

  constructor(...args) {
    super(...args);
    this.active = this.selectedCombatant.hasTalent(SPELLS.HUNTERS_MARK_TALENT.id);
  }

  on_byPlayer_cast(event) {
    const spellId = event.ability.guid;
    if (spellId !== SPELLS.HUNTERS_MARK_TALENT.id) {
      return;
    }
    this.casts++;
    this.timeOfCast = event.timestamp;
  }

  on_byPlayer_removedebuff(event){
    const spellID = event.ability.guid;
    if (spellID !== SPELLS.HUNTERS_MARK_TALENT.id){
      return;
    }
    const enemyID = event.targetID;
    if (this.precastConfirmed === false){
      this.precastConfirmed = true;
      this.precast = true;
      this.damage = this.damageToTarget[enemyID];
      return;
    }
    this.markWindow[enemyID].forEach(window => {
      if (window.status === "active"){
        window.status = "inactive";
      }
    });

  }

  on_byPlayer_applydebuff(event){
    const spellID = event.ability.guid;
    if (spellID !== SPELLS.HUNTERS_MARK_TALENT.id){
      return;
    }
    if (this.precastConfirmed === false){
      this.precastConfirmed = true;
    }<commit_msg>Implemented Hunter's Mark Damage Calculation<commit_after>import React from 'react';

import Analyzer from 'Parser/Core/Analyzer';

import SPELLS from 'common/SPELLS';
import SpellLink from 'common/SpellLink';
import ItemDamageDone from 'Main/ItemDamageDone';
import Enemies from 'Parser/Core/Modules/Enemies';
import getDamageBonus from 'Parser/Hunter/Shared/Modules/getDamageBonus';
import StatisticBox from 'Main/StatisticBox';
import SpellIcon from 'common/SpellIcon';
import { formatPercentage } from 'common/format';

/**
 * Apply Hunter's Mark to the target, increasing all damage you deal to the marked target by 5%.
 * If the target dies while affected by Hunter's Mark, you instantly gain 20 Focus.
 * The target can always be seen and tracked by the Hunter.
 *
 * Only one Hunter's Mark can be applied at a time.
 */

const HUNTERS_MARK_MODIFIER = 0.05;
const MS_BUFFER = 100;
const FOCUS_PER_REFUND = 20;

class HuntersMark extends Analyzer {
  static dependencies = {
    enemies: Enemies,
  };

  casts = 0;
  timeOfCast = null;
  damage = 0;
  recasts = 0;
  refunds = 0;
  precastConfirmed = false;
  markWindow = [];
  damageToTarget = [];

  constructor(...args) {
    super(...args);
    this.active = this.selectedCombatant.hasTalent(SPELLS.HUNTERS_MARK_TALENT.id);
  }

  on_byPlayer_cast(event) {
    const spellId = event.ability.guid;
    if (spellId !== SPELLS.HUNTERS_MARK_TALENT.id) {
      return;
    }
    this.casts++;
    this.timeOfCast = event.timestamp;
  }

  on_byPlayer_removedebuff(event){
    const spellID = event.ability.guid;
    if (spellID !== SPELLS.HUNTERS_MARK_TALENT.id){
      return;
    }
    const enemyID = event.targetID;
    if (this.precastConfirmed === false){
      this.precastConfirmed = true;
      this.damage = this.damageToTarget[enemyID];
      return;
    }
    this.markWindow[enemyID].forEach(window => {
      if (window.status === "active"){
        window.status = "inactive";
      }
    });

  }

  on_byPlayer_applydebuff(event){
    const spellID = event.ability.guid;
    if (spellID !== SPELLS.HUNTERS_MARK_TALENT.id){
      return;
    }
    if (this.precastConfirmed === false){
      this.precastConfirmed = true;
    }
{'fraction_non_alphanumeric': 0.11234428086070215, 'fraction_numerical': 0.006795016987542469, 'mean_word_length': 3.433734939759036, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, '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': '6023861', 'n_tokens_mistral': 1529, 'n_tokens_neox': 1486, 'n_words': 360}