<commit_before>package land.face.strife.data.effects;

import land.face.strife.StrifePlugin;
import land.face.strife.data.StrifeMob;
import land.face.strife.stats.StrifeStat;
import land.face.strife.util.DamageUtil;
import land.face.strife.util.DamageUtil.DamageScale;

public class ChangeEnergy extends Effect {

  private float amount;
  private DamageScale damageScale;
  private boolean bump;

  @Override
  public void apply(StrifeMob caster, StrifeMob target) {
    if (target.getStat(StrifeStat.ENERGY) == 0) {
      return;
    }
    float restoreAmount = amount;
    for (StrifeStat attr : getStatMults().keySet()) {
      restoreAmount += getStatMults().get(attr) * caster.getStat(attr);
    }
    switch (damageScale) {
      case FLAT:
        DamageUtil.restoreEnergy(target, restoreAmount, bump);
        return;
      case TARGET_CURRENT_ENERGY:
        DamageUtil.restoreBarrier(target, restoreAmount * getEnergy(target));
        return;
      case TARGET_MISSING_ENERGY:
        DamageUtil.restoreBarrier(target, restoreAmount * getMissingEnergy(target));
        return;
      case TARGET_MAX_ENERGY:
        DamageUtil.restoreBarrier(target, restoreAmount * target.getStat(StrifeStat.ENERGY));
        return;
      case CASTER_CURRENT_ENERGY:
        DamageUtil.restoreBarrier(target, restoreAmount * getEnergy(caster));
        return;
      case CASTER_MISSING_ENERGY:
        DamageUtil.restoreBarrier(target, restoreAmount * getMissingEnergy(caster));
        return;
      case CASTER_MAX_ENERGY:
        DamageUtil.restoreBarrier(target, restoreAmount * target.getStat(StrifeStat.ENERGY));
    }
  }

  public void setAmount(float amount) {
    this.amount = amount;
  }

  public void setDamageScale(DamageScale damageScale) {
    this.damageScale = damageScale;
  }

  public void setBump(boolean bump) {
    this.bump = bump;
  }

  private float getEnergy(StrifeMob mob) {
    return StrifePlugin.getInstance().getEnergyManager().getEnergy(mob);
  }

  private float getMissingEnergy(StrifeMob mob) {
    return 1 - getEnergy(mob) / mob.getStat(StrifeStat.ENERGY);
  }
}<commit_msg>Fixing change energy to actually change energy<commit_after>package land.face.strife.data.effects;

import land.face.strife.StrifePlugin;
import land.face.strife.data.StrifeMob;
import land.face.strife.stats.StrifeStat;
import land.face.strife.util.DamageUtil;
import land.face.strife.util.DamageUtil.DamageScale;

public class ChangeEnergy extends Effect {

  private float amount;
  private DamageScale damageScale;

  @Override
  public void apply(StrifeMob caster, StrifeMob target) {
    if (target.getStat(StrifeStat.ENERGY) == 0) {
      return;
    }
    float restoreAmount = amount;
    for (StrifeStat attr : getStatMults().keySet()) {
      restoreAmount += getStatMults().get(attr) * caster.getStat(attr);
    }
    switch (damageScale) {
      case FLAT:
        DamageUtil.restoreEnergy(target, restoreAmount);
        return;
      case TARGET_CURRENT_ENERGY:
        DamageUtil.restoreEnergy(target, restoreAmount * getEnergy(target));
        return;
      case TARGET_MISSING_ENERGY:
        DamageUtil.restoreEnergy(target, restoreAmount * getMissingEnergy(target));
        return;
      case TARGET_MAX_ENERGY:
        DamageUtil.restoreEnergy(target, restoreAmount * target.getStat(StrifeStat.ENERGY));
        return;
      case CASTER_CURRENT_ENERGY:
        DamageUtil.restoreEnergy(target, restoreAmount * getEnergy(caster));
        return;
      case CASTER_MISSING_ENERGY:
        DamageUtil.restoreEnergy(target, restoreAmount * getMissingEnergy(caster));
        return;
      case CASTER_MAX_ENERGY:
        DamageUtil.restoreEnergy(target, restoreAmount * target.getStat(StrifeStat.ENERGY));
    }
  }

  public void setAmount(float amount) {
    this.amount = amount;
  }

  public void setDamageScale(DamageScale damageScale) {
    this.damageScale = damageScale;
  }

  private float getEnergy(StrifeMob mob) {
    return StrifePlugin.getInstance().getEnergyManager().getEnergy(mob);
  }

  private float getMissingEnergy(StrifeMob mob) {
    return 1 - getEnergy(mob) / mob.getStat(StrifeStat.ENERGY);
  }
}
{'fraction_non_alphanumeric': 0.094997594997595, 'fraction_numerical': 0.000962000962000962, 'mean_word_length': 3.6730337078651685, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '6613195', 'n_tokens_mistral': 1367, 'n_tokens_neox': 1268, 'n_words': 240}