<commit_before>import SPELLS from 'common/SPELLS';
import { formatPercentage } from 'common/format';

import Analyzer from 'parser/core/Analyzer';

const PANDEMIC_THRESHOLD = 11500;//don't refresh with more than 4.5 seconds left on Flametongue buff

class FlametongueRefresh extends Analyzer {
  flametongueTimestamp = 0;
  flametongueCasts = 0;
  earlyRefresh = 0;
  refreshPercentageCast = 0;
  hasSearingAssaultTalent = this.selectedCombatant.hasTalent(SPELLS.SEARING_ASSAULT_TALENT.id);

  on_byPlayer_cast(event) {
    if(event.ability.guid === SPELLS.FLAMETONGUE.id) {
      this.flametongueCasts += 1;

      this.refreshPercentageCast = this.earlyRefresh / this.flametongueCasts;
    }
  }

  on_byPlayer_applybuff(event) {
    if(event.ability.guid === SPELLS.FLAMETONGUE_BUFF.id) {
      this.flametongueTimestamp = event.timestamp;
    }
  }

  on_byPlayer_refreshbuff(event) {
    if(!this.hasSearingAssaultTalent && event.ability.guid === SPELLS.FLAMETONGUE_BUFF.id) {
      if(this.flametongueTimestamp !== 0) {
        if(event.timestamp - this.flametongueTimestamp < PANDEMIC_THRESHOLD) {
          this.earlyRefresh += 1;
        }
      }
      this.flametongueTimestamp = event.timestamp;
    }
  }

  suggestions(when) {
    when(this.earlyRefresh).isGreaterThan(0)
      .addSuggestion((suggest, actual, recommended) => {
        return suggest(`Avoid refreshing Flametongue with more then 4.5 sec left on the buff. Some early refreshes are unavoidable.`)
          .icon(SPELLS.FLAMETONGUE_BUFF.icon)
          .actual(`${actual} of ${this.flametongueCasts} (${formatPercentage(this.refreshPercentageCast, 0)}%) early refreshes`)<commit_msg>Now disabling Flametongue refresh module when Searing Assault taken instead of checking every refresh<commit_after>import SPELLS from 'common/SPELLS';
import { formatPercentage } from 'common/format';

import Analyzer from 'parser/core/Analyzer';

const PANDEMIC_THRESHOLD = 11500;//don't refresh with more than 4.5 seconds left on Flametongue buff

class FlametongueRefresh extends Analyzer {
  flametongueTimestamp = 0;
  flametongueCasts = 0;
  earlyRefresh = 0;
  refreshPercentageCast = 0;

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

  on_byPlayer_cast(event) {
    if(event.ability.guid === SPELLS.FLAMETONGUE.id) {
      this.flametongueCasts += 1;

      this.refreshPercentageCast = this.earlyRefresh / this.flametongueCasts;
    }
  }

  on_byPlayer_applybuff(event) {
    if(event.ability.guid === SPELLS.FLAMETONGUE_BUFF.id) {
      this.flametongueTimestamp = event.timestamp;
    }
  }

  on_byPlayer_refreshbuff(event) {
    if(event.ability.guid === SPELLS.FLAMETONGUE_BUFF.id) {
      if(this.flametongueTimestamp !== 0) {
        if(event.timestamp - this.flametongueTimestamp < PANDEMIC_THRESHOLD) {
          this.earlyRefresh += 1;
        }
      }
      this.flametongueTimestamp = event.timestamp;
    }
  }

  suggestions(when) {
    when(this.earlyRefresh).isGreaterThan(0)
      .addSuggestion((suggest, actual, recommended) => {
        return suggest(`Avoid refreshing Flametongue with more then 4.5 sec left on the buff. Some early refreshes are unavoidable.`)
          .icon(SPELLS.FLAMETONGUE_BUFF.icon)
          .actual(`${actual} of ${this.flametongueCasts} (${formatPercentage(this.refreshPercentageCast, 0)}%) early refreshes`)
{'fraction_non_alphanumeric': 0.10841613091759206, 'fraction_numerical': 0.010520163646990065, 'mean_word_length': 3.774058577405858, 'pattern_counts': {'":': 0, '<': 5, '<?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': '3139697', 'n_tokens_mistral': 1241, 'n_tokens_neox': 1166, 'n_words': 205}