<commit_before>import React from 'react';

import Analyzer from 'Parser/Core/Analyzer';
import Combatants from 'Parser/Core/Modules/Combatants';
import ITEMS from 'common/ITEMS';
import SPELLS from 'common/SPELLS';
import ItemIcon from 'common/ItemIcon';
import ItemLink from 'common/ItemLink';
import { formatPercentage } from 'common/format';
import ItemDamageDone from 'Main/ItemDamageDone';

class EchoesOfTheGreatSundering extends Analyzer {
    static dependencies = {
        combatants: Combatants,
    };

    buffedEarthquakeCasts = 0;
    echoesProcsCounter = 0;
    unbuffedEarthquakeDamage = 0;
    totalEarthquakeCasts = 0;

    state=0;

    on_initialized() {
        this.active = this.combatants.selected.hasShoulder(ITEMS.ECHOES_OF_THE_GREAT_SUNDERING.id);
    }

    on_byPlayer_cast(event) {
        if (event.spellId !== SPELLS.EARTHQUAKE.id)
          return;

        if(this.player.hasBuff(SPELLS.ECHOES_OF_THE_GREAT_SUNDERING_BUFF))
          this.endtime=this.timstamp+6000;
        else
          if(this.timestamp < this.buffEndtime)
            this.state=2;
    }

    on_byPlayer_damage(event) {
      if(event.timestamp>this.endtime)
        this.state=0;
      const spellId = event.ability.guid;
      if (spellId !== SPELLS.EARTHQUAKE_DAMAGE.id)
        return;

      if(this.state===0) {
        this.unbuffedEarthquakeDamage += event.amount;
        this.unbuffedNormalizedEarthquakeDamage += event.amount/event.hitType;
      }
      if(this.state===1)
        this.buffedEarthquakeDamage += event.amount;
    }

    on_byPlayer_applybuff(event) {
        const spellId = event.ability.guid;
        if (spellId === SPELLS.ECHOES_OF_THE_GREAT_SUNDERING_BUFF.id) {
            this.echoesProcsCounter += 1;
        }
    }

    item() {
        return {
            id: `item=${ITEMS.ECHOES_OF_THE_GREAT_SUNDERING.id}`,
            icon: <ItemIcon id={ITEMS.ECHOES_OF_THE_GREAT_SUNDERING.id} />,
            title: <ItemLink id={ITEMS.ECHOES_OF_THE_GREAT_SUNDERING.id} />,
            result: (
              <dfn data-tip={``}>
                 <ItemDamageDone amount={this.buffedEarthquakeDamage} />
              </dfn>
            ),
        };
    }
}
    export default EchoesOfTheGreatSundering;<commit_msg>First working version I think it should give mostly correct numbers but yet to test properly<commit_after>import React from 'react';

import Analyzer from 'Parser/Core/Analyzer';
import Combatants from 'Parser/Core/Modules/Combatants';
import ITEMS from 'common/ITEMS';
import SPELLS from 'common/SPELLS';
import ItemIcon from 'common/ItemIcon';
import ItemLink from 'common/ItemLink';
//import { formatPercentage } from 'common/format';
import ItemDamageDone from 'Main/ItemDamageDone';

class EchoesOfTheGreatSundering extends Analyzer {
    static dependencies = {
        combatants: Combatants,
    };

    buffedEarthquakeCasts = 0;
    echoesProcsCounter = 0;
    unbuffedEarthquakeDamage = 0;
  buffedEarthquakeDamage = 0;
    totalEarthquakeCasts = 0;

    state=0;
  endtime = 0;

    on_initialized() {
        this.active = this.combatants.selected.hasShoulder(ITEMS.ECHOES_OF_THE_GREAT_SUNDERING.id);
    }

    on_byPlayer_cast(event) {
      const spellId = event.ability.guid;
      if (spellId !== SPELLS.EARTHQUAKE.id)
          return;
      if (this.combatants.selected.hasBuff(SPELLS.ECHOES_OF_THE_GREAT_SUNDERING_BUFF.id, event.timestamp)) {
        this.endtime = event.timestamp + 6100;
        this.state = 1;
      }
        else if (this.timestamp < this.endtime)
            this.state=2;
    }

    on_byPlayer_damage(event) {
      if(event.timestamp>this.endtime)
        this.state=0;
      const spellId = event.ability.guid;
      if (spellId !== SPELLS.EARTHQUAKE_DAMAGE.id)
        return;

      if(this.state===0) {
        this.unbuffedNormalizedEarthquakeDamage += event.amount/event.hitType;
      }
      if (this.state === 1) {
        this.buffedEarthquakeDamage += event.amount;
        this.buffedNormalizedEarthquakeDamage += event.amount / event.hitType;
      }
      if (this.state === 2) {
        if (this.buffedNormalizedEarthquakeDamage !== 0) {
          if (Math.abs((event.amount / event.hitType) / this.buffedNormalizedEarthquakeDamage) < 0.2) {
            this.buffedEarthquakeDamage += event.amount;
          }
        }
        else if (this.unbuffedNormalizedEarthquakeDamage !== 0) {
          if (Math.abs((event.amount / event.hitType) / this.unbuffedNormalizedEarthquakeDamage) > 0.2) {
            this.buffedEarthquakeDamage += event.amount;
          }
        }
      }
    }

    item() {
        return {
            id: `item=${ITEMS.ECHOES_OF_THE_GREAT_SUNDERING.id}`,
            icon: <ItemIcon id={ITEMS.ECHOES_OF_THE_GREAT_SUNDERING.id} />,
            title: <ItemLink id={ITEMS.ECHOES_OF_THE_GREAT_SUNDERING.id} />,
            result: (
              <dfn data-tip={``}>
                 <ItemDamageDone amount={this.buffedEarthquakeDamage} />
              </dfn>
            ),
        };
    }
}
    export default EchoesOfTheGreatSundering;
{'fraction_non_alphanumeric': 0.10925196850393701, 'fraction_numerical': 0.007283464566929134, 'mean_word_length': 2.6163701067615657, 'pattern_counts': {'":': 0, '<': 16, '<?xml version=': 0, '>': 16, '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': '6079991', 'n_tokens_mistral': 1796, 'n_tokens_neox': 1712, 'n_words': 272}