<commit_before>import React from 'react';
import Analyzer from 'Parser/Core/Analyzer';
import Combatants from 'Parser/Core/Modules/Combatants';
import SPELLS from 'common/SPELLS/index';
import ITEMS from 'common/ITEMS';
import ItemDamageDone from 'Main/ItemDamageDone';
import ItemHealingDone from 'Main/ItemHealingDone';
import Wrapper from 'common/Wrapper';
import calculateEffectiveDamage from 'Parser/Core/calculateEffectiveDamage';
import calculateEffectiveHealing from 'Parser/Core/calculateEffectiveHealing';

const MAX_BUFF_STACKS = 5;
const PERCENT_BUFF=0.2;

class SkullflowersHaemostasis extends Analyzer {

  static dependencies = {
    combatants: Combatants,
  };

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

  buffStack = 0;
  wastedBuff = 0;
  damage=0;
  heal=0;
  deathStrikeDamageIsDone = false;
  deathStrikeHealingIsDone = false;



  on_byPlayer_applybuff(event) {
    if (event.ability.guid === SPELLS.HAEMOSTASIS_BUFF.id) {
      this.buffStack += 1;
    }
  }

  on_byPlayer_applybuffstack(event) {
    if (event.ability.guid !== SPELLS.HAEMOSTASIS_BUFF.id) {
      return;
    }
    if (this.buffstack >= MAX_BUFF_STACKS) {
      this.wastedBuff += 1;
      this.buffStack = MAX_BUFF_STACKS;
    }
    else {
      this.buffStack += 1;
    }
  }

  on_byPlayer_heal(event) {
    if (event.ability.guid !== SPELLS.DEATH_STRIKE_HEAL.id) {
      return;
    }
    this.heal += calculateEffectiveHealing(event,PERCENT_BUFF * this.buffStack);
    this.deathStrikeHealingIsDone = true;
    if (this.deathStrikeHealingIsDone && this.deathStrikeDamageIsDone) {
      this.buffStack = 0;
      this.deathStrikeDamageIsDone = false;
      this.deathStrikeHealingIsDone = false;
    }
  }

  on_byPlayer_damage(event) {
    if (event.ability.guid !== SPELLS.DEATH_STRIKE.id) {
      return;
    }
    this.damage += calculateEffectiveDamage(event,PERCENT_BUFF * this.buffStack);
    this.deathStrikeDamageIsDone = true;
    if (this.deathStrikeHealingIsDone && this.deathStrikeDamageIsDone) {
      this.buffStack = 0;
      this.deathStrikeDamageIsDone = false;
      this.deathStrikeHealingIsDone = false;
    }
  }



  item() {
    return {
      item: ITEMS.SKULLFLOWERS_HAEMOSTASIS,
      result:(
        <Wrapper>
          <ItemDamageDone amount={this.damage} /><br />
          <ItemHealingDone amount={this.heal} /><br />
          Overcapped {this.wastedBuff} Times
        </Wrapper>
      ),
    };
  }
}

export default SkullflowersHaemostasis;<commit_msg>fix BDK shoulders on vari (no heal event) and fixed wasted stacks.<commit_after>import React from 'react';
import Analyzer from 'Parser/Core/Analyzer';
import Combatants from 'Parser/Core/Modules/Combatants';
import SPELLS from 'common/SPELLS/index';
import ITEMS from 'common/ITEMS';
import ItemDamageDone from 'Main/ItemDamageDone';
import ItemHealingDone from 'Main/ItemHealingDone';
import Wrapper from 'common/Wrapper';
import calculateEffectiveDamage from 'Parser/Core/calculateEffectiveDamage';
import calculateEffectiveHealing from 'Parser/Core/calculateEffectiveHealing';

const MAX_BUFF_STACKS = 5;
const PERCENT_BUFF=0.2;

class SkullflowersHaemostasis extends Analyzer {

  static dependencies = {
    combatants: Combatants,
  };

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

  buffStack = 0;
  wastedBuff = 0;
  damage=0;
  heal=0;

  on_byPlayer_cast(event){
    if (event.ability.guid === SPELLS.BLOOD_BOIL.id) {
      return;
    }
    if(this.combatants.selected.hasBuff(SPELLS.DANCING_RUNE_WEAPON.id) && this.buffStack + 3 > MAX_BUFF_STACKS){
      this.wastedBuff += MAX_BUFF_STACKS - (3 + this.buffStack);
    } else if(this.buffStack === MAX_BUFF_STACKS) {
      this.wastedBuff += 1;
    }
  }

  on_byPlayer_applybuff(event) {
    if (event.ability.guid === SPELLS.HAEMOSTASIS_BUFF.id) {
      this.buffStack = 1;
    }
  }

  on_byPlayer_applybuffstack(event) {
    if (event.ability.guid !== SPELLS.HAEMOSTASIS_BUFF.id) {
      return;
    }
    this.buffStack = event.stack;
  }

  on_byPlayer_heal(event) {
    if (event.ability.guid !== SPELLS.DEATH_STRIKE_HEAL.id) {
      return;
    }
    if(this.buffStack > 0){
      this.heal += calculateEffectiveHealing(event,PERCENT_BUFF * this.buffStack);
    }
  }

  on_byPlayer_damage(event) {
    if (event.ability.guid !== SPELLS.DEATH_STRIKE.id) {
      return;
    }
    if(this.buffStack > 0){
      this.damage += calculateEffectiveDamage(event,PERCENT_BUFF * this.buffStack);
      this.buffStack = 0;
    }
  }

  item() {
    return {
      item: ITEMS.SKULLFLOWERS_HAEMOSTASIS,
      result:(
        <Wrapper>
          <ItemDamageDone amount={this.damage} /><br />
          <ItemHealingDone amount={this.heal} /><br />
          Overcapped {this.wastedBuff} times
        </Wrapper>
      ),
    };
  }
}

export default SkullflowersHaemostasis;
{'fraction_non_alphanumeric': 0.11281224818694602, 'fraction_numerical': 0.005237711522965351, 'mean_word_length': 3.444941808415398, 'pattern_counts': {'":': 0, '<': 15, '<?xml version=': 0, '>': 19, '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': '4556366', 'n_tokens_mistral': 1833, 'n_tokens_neox': 1770, 'n_words': 288}