<commit_before>import ITEMS from 'common/ITEMS';
import SPELLS from 'common/SPELLS';
import { formatNumber } from 'common/format';
import Module from 'Parser/Core/Module';
import Combatants from 'Parser/Core/Modules/Combatants';

const BLOODLUST_BUFFS = [
  SPELLS.HEROISM.id,
  SPELLS.BLOODLUST.id,
  SPELLS.TIME_WARP.id,
  SPELLS.NETHERWINDS.id,
  SPELLS.ANCIENT_HYSTERIA.id,
  SPELLS.DRUMS_OF_FURY.id,
  SPELLS.DRUMS_OF_RAGE.id,
  SPELLS.DRUMS_OF_THE_MOUNTAIN.id,
];

const TEAM_COOLDOWN = 600;
const PERSONAL_COOLDOWN = 300;
const DURATION = 40;

class ShardOfTheExodar extends Module {

  static dependencies = {
		combatants: Combatants,
	};

  actualCasts = 0;

  on_initialized() {
    this.active = this.combatants.selected.hasFinger(ITEMS.SHARD_OF_THE_EXODAR.id);
  }

  on_toPlayer_applybuff(event) {
    if (BLOODLUST_BUFFS.some(buff => event.ability.guid === buff)) {
      this.actualCasts += 1;
    }
  }

  item() {
    const fightInSeconds = this.owner.fightDuration / 1000;
    const teamCasts = 1 + Math.floor(fightInSeconds / TEAM_COOLDOWN);
    const personalCasts = 1 + Math.floor((fightInSeconds - DURATION) / PERSONAL_COOLDOWN);
    const possibleCasts = teamCasts + personalCasts;
    return {
      item: ITEMS.SHARD_OF_THE_EXODAR,
      result: `Gained Time Warp effect ${formatNumber(this.actualCasts)} Times. (${formatNumber(possibleCasts)} Possible)`,
    };
  }
}

export default ShardOfTheExodar;<commit_msg>[frost mage] Added 'refreshbuff' check when counting actual casts (to catch case when player clips buffs a bit)<commit_after>import ITEMS from 'common/ITEMS';
import SPELLS from 'common/SPELLS';
import { formatNumber } from 'common/format';
import Module from 'Parser/Core/Module';
import Combatants from 'Parser/Core/Modules/Combatants';

const BLOODLUST_BUFFS = [
  SPELLS.HEROISM.id,
  SPELLS.BLOODLUST.id,
  SPELLS.TIME_WARP.id,
  SPELLS.NETHERWINDS.id,
  SPELLS.ANCIENT_HYSTERIA.id,
  SPELLS.DRUMS_OF_FURY.id,
  SPELLS.DRUMS_OF_RAGE.id,
  SPELLS.DRUMS_OF_THE_MOUNTAIN.id,
];

const TEAM_COOLDOWN = 600;
const PERSONAL_COOLDOWN = 300;
const DURATION = 40;

class ShardOfTheExodar extends Module {

  static dependencies = {
		combatants: Combatants,
	};

  actualCasts = 0;

  on_initialized() {
    this.active = this.combatants.selected.hasFinger(ITEMS.SHARD_OF_THE_EXODAR.id);
  }

  on_toPlayer_applybuff(event) {
    if (BLOODLUST_BUFFS.some(buff => event.ability.guid === buff)) {
      this.actualCasts += 1;
    }
  }

  on_toPlayer_refreshbuff(event) {
    if (BLOODLUST_BUFFS.some(buff => event.ability.guid === buff)) {
      this.actualCasts += 1;
    }
  }

  item() {
    const fightInSeconds = this.owner.fightDuration / 1000;
    const teamCasts = 1 + Math.floor(fightInSeconds / TEAM_COOLDOWN);
    const personalCasts = 1 + Math.floor((fightInSeconds - DURATION) / PERSONAL_COOLDOWN);
    const possibleCasts = teamCasts + personalCasts;
    return {
      item: ITEMS.SHARD_OF_THE_EXODAR,
      result: `Gained Time Warp effect ${formatNumber(this.actualCasts)} Times. (${formatNumber(possibleCasts)} Possible)`,
    };
  }
}

export default ShardOfTheExodar;
{'fraction_non_alphanumeric': 0.11274823830877642, 'fraction_numerical': 0.01057014734144779, 'mean_word_length': 4.161983471074381, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 6, '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': '4888427', 'n_tokens_mistral': 1249, 'n_tokens_neox': 1182, 'n_words': 211}