<commit_before>import Entities from './Entities';
import Combatant from '../../core/Combatant';

class Combatants extends Entities {
  players = {};
  get playerCount() {
    return Object.keys(this.players).length;
  }
  getEntities() {
    return this.players;
  }
  getEntity(event) {
    const targetId = event.targetID;
    const combatant = this.players[targetId];
    if (!combatant) {
      return null; // a pet or something probably, either way we don't care.
    }
    return combatant;
  }

  /** @returns Combatant */
  get selected() {
    return this.players[this.owner.playerId];
  }

  constructor(...args) {
    super(...args);
    this.owner.combatantInfoEvents.forEach(combatantInfo => {
      if (combatantInfo.error) {
        console.error(`Error retrieving combatant information for player with sourceID ${combatantInfo.sourceID}`);
        return;
      }

      this.players[combatantInfo.sourceID] = new Combatant(this.owner, combatantInfo);

      combatantInfo.auras.forEach((aura) => {
        this.applyBuff({
          ability: {
            abilityIcon: aura.icon,
            guid: aura.ability,
          },
          sourceID: aura.source,
          targetID: combatantInfo.sourceID,
          timestamp: combatantInfo.timestamp,
        });
      });
    });
  }

  on_applybuff(event) {
    if (event.__fromCombatantinfo) {
      // We already scan the `combatantinfo` auras, so adding it here would be duplicating which causes a lot of issues.
      // We need to use `combatantinfo` so that our buffs are already available when just the `combatantinfo` events are available (for display purposes).
      return;
    }
    super.on_applybuff(event);
  }
}

export default Combatants;<commit_msg>Removed duplicate pre-pull buff handling in Combatants (only ApplyBuff normalizer now takes care of that)<commit_after>import Entities from './Entities';
import Combatant from '../../core/Combatant';

class Combatants extends Entities {
  players = {};
  get playerCount() {
    return Object.keys(this.players).length;
  }
  getEntities() {
    return this.players;
  }
  getEntity(event) {
    const targetId = event.targetID;
    const combatant = this.players[targetId];
    if (!combatant) {
      return null; // a pet or something probably, either way we don't care.
    }
    return combatant;
  }

  /** @returns Combatant */
  get selected() {
    return this.players[this.owner.playerId];
  }

  constructor(...args) {
    super(...args);
    this.owner.combatantInfoEvents.forEach(combatantInfo => {
      if (combatantInfo.error) {
        console.error(`Error retrieving combatant information for player with sourceID ${combatantInfo.sourceID}`);
        return;
      }

      this.players[combatantInfo.sourceID] = new Combatant(this.owner, combatantInfo);
    });
  }
}

export default Combatants;
{'fraction_non_alphanumeric': 0.1151685393258427, 'fraction_numerical': 0.0, 'mean_word_length': 2.8656716417910446, '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': '3298904', 'n_tokens_mistral': 868, 'n_tokens_neox': 848, 'n_words': 214}