Пример #1
0
  private void affect(Entity entity) {
    BendingHitEvent event = new BendingHitEvent(ability, entity);
    Bending.callEvent(event);
    if (event.isCancelled()) {
      return;
    }

    double damage = DAMAGE;
    if (bender.hasPath(BendingPath.TOUGH)) {
      damage *= 0.85;
    }

    if (bender.hasPath(BendingPath.RECKLESS)) {
      damage *= 1.15;
    }

    if (entity instanceof LivingEntity) {
      DamageTools.damageEntity(bender, entity, ability, damage);
    }

    Vector vector = direction.clone();
    vector.setY(.5);
    entity.setVelocity(vector);
  }
  @EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
  public void onBendingDamage(BendingDamageEvent event) {
    if (event.getEntity() instanceof Player) {
      Player player = (Player) event.getEntity();
      BendingPlayer bender = BendingPlayer.getBendingPlayer(player);
      if (bender == null) {
        return;
      }

      if (bender.hasPath(BendingPath.TOUGH)) {
        event.setDamage(event.getDamage() * 0.9);
      }
      if (bender.hasAffinity(BendingAffinity.SWORD) && player.isBlocking()) {
        event.setDamage(event.getDamage() * 0.60);
      }
    }
  }