%%-----------------------------------------------------------------------------
%% @Module  :       data_attr
%% @Author  :       Czc
%% @Email   :       389853407@qq.com
%% @Created :       2017-08-25
%% @Description:
%%-----------------------------------------------------------------------------
-module(data_attr).
-include("attr.hrl").
-include("common.hrl").

-compile([export_all]).

%% 根据人物等级获取属性基本评分
get_attr_base_rating_by_lv(_AttrId, _Lv) ->
    1.

%% 获取铸灵属性的基础评分
get_attr_base_rating_ex(AttrId) ->
    case AttrId of
        ?ATT                    -> 10;
        ?HP                     -> 0.5;
        % ?WRECK                  -> 10;
        ?DEF                    -> 10;
        ?HIT                    -> 2;
        ?DODGE                  -> 2;
        ?CRIT                   -> 2;
        ?TEN                    -> 2;
        ?HURT_ADD_RATIO         -> 0;
        ?HURT_DEL_RATIO         -> 0;
        ?HIT_RATIO              -> 0;
        ?DODGE_RATIO            -> 0;
        ?CRIT_RATIO             -> 0;
        ?UNCRIT_RATIO           -> 0;
        ?FINAL_HURT_ADD         -> 0;
        ?FINAL_HURT_DEL         -> 0;
        ?SKILL_HURT_ADD_RATIO   -> 0;
        ?SKILL_HURT_DEL_RATIO   -> 0;
        ?ATT_ADD_RATIO          -> 0;
        ?HP_ADD_RATIO           -> 0;
        % ?WRECK_ADD_RATIO        -> 0;
        ?DEF_ADD_RATIO          -> 0;
        ?HIT_ADD_RATIO          -> 0;
        ?DODGE_ADD_RATIO        -> 0;
        ?CRIT_ADD_RATIO         -> 0;
        ?TEN_ADD_RATIO          -> 0;
        _                       -> 0
    end.

%% 成长属性转成实际增加的属性值
growth_attr2real_val(Lv, AttrBaseVal, AttrPlusInterval, AttrPlus) ->
    AttrBaseVal + util:floor(Lv / AttrPlusInterval) * AttrPlus.

%% 把装备极品属性的格式都统一成以下格式
%% {颜色, 属性类型,属性值,每X级成长一次,每次成长Y点}
unified_format_extra_attr([], Result) -> Result;
unified_format_extra_attr([{Color, AttrId, AttrVal}|ExtraAttr], Result) ->
    NewResult = Result ++ [{Color, 2, AttrId, AttrVal, 0, 0}],
    unified_format_extra_attr(ExtraAttr, NewResult);
unified_format_extra_attr([{Color, AttrId, AttrVal, AttrPlusInterval, AttrPlus}|ExtraAttr], Result) ->
    NewResult = Result ++ [{Color, 1, AttrId, AttrVal, AttrPlusInterval, AttrPlus}],
    unified_format_extra_attr(ExtraAttr, NewResult);
unified_format_extra_attr([_|ExtraAttr], Result) ->
    unified_format_extra_attr(ExtraAttr, Result).
