/**
   * Calculates the fall damage
   *
   * @param player
   * @param distance
   * @return True if the player is forced to his bind location.
   */
  public static boolean calculateFallDamage(Player player, float distance, boolean stoped) {
    if (player.isInvul()) {
      return false;
    }

    if (distance >= FallDamageConfig.MAXIMUM_DISTANCE_DAMAGE || !stoped) {
      player.getController().onStopMove();
      player.getFlyController().onStopGliding(false);
      player.getLifeStats().reduceHp(player.getLifeStats().getMaxHp() + 1, player);
      return true;
    } else if (distance >= FallDamageConfig.MINIMUM_DISTANCE_DAMAGE) {
      float dmgPerMeter =
          player.getLifeStats().getMaxHp() * FallDamageConfig.FALL_DAMAGE_PERCENTAGE / 100f;
      int damage = (int) (distance * dmgPerMeter);
      player.getLifeStats().reduceHp(damage, player);
      PacketSendUtility.sendPacket(
          player, new SM_ATTACK_STATUS(player, SM_ATTACK_STATUS.TYPE.FALL_DAMAGE, 0, -damage));
    }

    return false;
  }