using UnityEngine;
namespace XGame.Database
{
public static class TableUtils
{
///
/// 属性缩放倍数
///
public static readonly int Multiple = 10000;
///
/// 数据库万分比字段转真实值
///
///
///
public static float ToRealFloat(this int val)
{
return val * 0.0001f;
}
///
/// 数据库万分比字段转真实值
///
///
///
public static int ToReal(this int val)
{
return Mathf.CeilToInt(val * 0.0001f);
}
///
/// 数据库万分比字段转真实值
///
///
///
public static double ToRealDouble(this long val)
{
return val * 0.0001f;
}
///
/// 数据库万分比字段转真实值
///
///
///
public static long ToReal(this long val)
{ //四舍五入
return (val + 5000) / Multiple;
}
///
/// 检测技能或Buff的目标类型
///
///
///
///
public static bool IsContain(uint skillTargetType, ESkillTargetType targetType)
{
return (skillTargetType & (uint)targetType) != 0;
}
///
/// 是否基础属性
///
///
///
public static bool IsBasic(this EAttributeType type)
{
return type is EAttributeType.Hp or EAttributeType.Atk or EAttributeType.Def or EAttributeType.AtkSpeed;
}
///
/// 是否装备特殊属性
///
///
///
public static bool IsItemSpecial(this EAttributeType type)
{
return type is EAttributeType.Crit or EAttributeType.DoubleHit or EAttributeType.Counter or EAttributeType.Verti or
EAttributeType.Eva or EAttributeType.CritRes or EAttributeType.VertigoRes or EAttributeType.EvaRes or
EAttributeType.DoubleHitRes or EAttributeType.CounterRes;
}
}
}