

/**
 * 属性 id
 */
export enum ABI_TYPE {
    /**生命 */
    ABI_HP = 1,
    /**物攻 */
    ABI_ATK = 2,
    /**策攻(弃用) */
    ABI_MATK = 3,
    /**物防 */
    ABI_DEF = 4,
    /**策防 */
    ABI_MDEF = 5,
    /**敏捷(弃用) */
    ABI_AGI = 6,
    /**幸运(弃用) */
    ABI_LUK = 7,
    /**移动 */
    ABI_SPEED = 8,
    //主属性 end
    /**命中 */
    ABI_HIT = 9,
    /**暴击等级 */
    ABI_CRI = 10,
    /**格挡等级 */
    ABI_FLEE = 11,
    /**抗暴等级 */
    ABI_ANT_CRI = 12,
    /**伤害加深等级(弃用) */
    ABI_DAMAGE_INCREASE = 13,
    /**伤害减免等级 (弃用)*/
    ABI_DAMAGE_DECREASE = 14,
    /**忽视防御等级 */
    ABI_DEF_IGNORE = 15,
    /**吸血等级 */
    ABI_BLOOD_SUCK = 16,
    /**怒气恢复效果 */
    ABI_AP = 17,
    /**暴击伤害 */
    ABI_CRI_DAMAGE = 18,
    /**物理伤害加深等级 */
    ABI_PHYSICAL_DAMAGE_INCREASE = 19,
    /**物理伤害减免等级 */
    ABI_PHYSICAL_DAMAGE_DECREASE = 20,

    /**策略伤害加深等级 */
    ABI_MAGIC_DAMAGE_INCREASE = 21,
    /**策略伤害减免等级 */
    ABI_MAGIC_DAMAGE_DECREASE = 22,

    /** 治疗加成 */
    ABI_TREATMENT_INCREASE = 23,
    /** 治疗降低 */
    ABI_TREATMENT_DECREASE = 24,
    /** 受治疗加成 */
    ABI_ACCEPT_TREATMENT_INCREASE = 25,
    /** 受治疗降低 */
    ABI_ACCEPT_TREATMENT_DECREASE = 26,
    /** 反弹 */
    ABI_BLOOD_REBOUND = 27,
    /** 反击伤害 */
    ABI_STRIKE_BACK = 28,
    ABI_MAX,
}

// 主属性
export const ABI_TYPE_MAIN =  [
    ABI_TYPE.ABI_HP,
    ABI_TYPE.ABI_ATK,
    ABI_TYPE.ABI_DEF,
    ABI_TYPE.ABI_MDEF
];

// 次级属性
export const ABI_TYPE_SUB = [
    ABI_TYPE.ABI_HIT,
    ABI_TYPE.ABI_CRI,
    ABI_TYPE.ABI_FLEE,
    ABI_TYPE.ABI_ANT_CRI,
    ABI_TYPE.ABI_DAMAGE_INCREASE,
    ABI_TYPE.ABI_DAMAGE_DECREASE,
    ABI_TYPE.ABI_DEF_IGNORE,
    ABI_TYPE.ABI_BLOOD_SUCK,
    ABI_TYPE.ABI_AP,
    ABI_TYPE.ABI_CRI_DAMAGE,
    ABI_TYPE.ABI_PHYSICAL_DAMAGE_INCREASE,
    ABI_TYPE.ABI_PHYSICAL_DAMAGE_DECREASE,
    ABI_TYPE.ABI_MAGIC_DAMAGE_INCREASE,
    ABI_TYPE.ABI_MAGIC_DAMAGE_DECREASE,
    ABI_TYPE.ABI_TREATMENT_INCREASE,
    ABI_TYPE.ABI_ACCEPT_TREATMENT_INCREASE,
    ABI_TYPE.ABI_ACCEPT_TREATMENT_DECREASE,
    ABI_TYPE.ABI_BLOOD_REBOUND,
    ABI_TYPE.ABI_STRIKE_BACK,
];

export enum SEID_TYPE {
    /**属性固定值加成(数值) */
    FIX = 1,
    /**基础属性加百分比，除以1000 */
    MAIN_RATIO = 2,
    /**次级属性的百分比加成 */
    SUB_RATIO = 3,
    /**基础属性加百分比，除以1000 */
    MAIN_RATIO_2 = 4,
    /**次级属性的百分比加成 */
    SUB_RATIO_2 = 5,
    /**复合属性 */
    MIX = 999,
}

export enum ABI_STAGE {
    START = 0,
    HP = 1,
    ATK = 2,
    DEF = 3,
    MDEF = 4,
    END = 4
}

export enum ABI_JOB_STAGE {
    START = 1,
    END = 6
}
export const ATTR = {}

export const HERO_ATTR = {
    1: "hp",    // 生命
    2: "atk",   // 物攻
    3: "matk",  // 策攻
    4: "def",   // 物防
    5: "mdef",  // 测防
    6: "agi",   // 敏捷
    7: "luk",   // 幸运
    8: "speed", // 移动
    9: "hit",   // 命中等级
    10: "cri",  // 暴击等级
    11: "flee", // 格挡等级
    12: "antCri",  // 抗暴等级
    13: "damageIncrease",  // 伤害加深等级
    14: "damageDecrease",  // 伤害减免等级
    15: "defIngnore",  // 忽视防御等级
    16: "bloodSuck",   // 吸血等级
    17: "ap",    // 怒气
    18: "damageCri",    // 暴击伤害
    19: "physicaldamageInc",   // 物伤加深
    20: "physicaldamageDec",   // 物伤减免
    21: "magicdamageInc",   // 法伤加深
    22: "magicdamageDec",   // 法伤减免
    23: "treatmentInc", // 治疗加成
    24: "treatmentDec", // 治疗降低
    25: "acceptTreatmentInc", // 受治疗加成
    26: "acceptTreatmentDec", // 受治疗降低
    27: "bloodRebound", // 反弹
    28: "strikeBack",   // 反击伤害
};

const abilityTypeWithStage = [
    { type: ABI_TYPE.ABI_HP, stage: ABI_STAGE.HP },
    { type: ABI_TYPE.ABI_ATK, stage: ABI_STAGE.ATK },
    { type: ABI_TYPE.ABI_DEF, stage: ABI_STAGE.DEF },
    { type: ABI_TYPE.ABI_MDEF, stage: ABI_STAGE.MDEF },
];

export const ABI_TYPE_TO_STAGE = new Map<number,  number>();
export const ABI_STAGE_TO_TYPE = new Map<number,  number>();
for(let {type, stage} of abilityTypeWithStage) {
    ABI_TYPE_TO_STAGE.set(type, stage);
    ABI_STAGE_TO_TYPE.set(stage, type);
}

export function getAtrrNameById(attrId: number):string {
    return HERO_ATTR[attrId];
};

export enum CE_CONST {
    FLEE_VALUE = 0.3, // 格挡价值
    PUT_HIT = 50000, // 投放总命中
    HIT_RATE_BASE = 0.75, // 命中率基础
    HIT_RATE_MAX = 1, // 命中率上限
    HIT_RATE_MIN = 0, // 命中率下限
    PUT_ANT_CRI = 50000, // 投放总抗暴
    CRI_RATE_BASE = 0.05, // 暴击率基础
    CRI_RATE_MAX = 0.75, // 暴击率上限
    CRI_RATE_MIN = 0.05, // 暴击率下限
    CRI_VALUE_BASE = 1.5, // 暴击价值基础
} 