--md5:CommonFun_10_AttrBase.txt:90eaf066d8828140059f64a4c055311c
--md5:CommonFun_11_UserAttr.txt:5481a87160713ffac30b642323b42aac
--md5:CommonFun_12_MonsterAttr.txt:a58e56d587f1c377464cb36fef7af8f0
--md5:CommonFun_20_DamageCalc.txt:84f1348349c25f7df9b31922efe82ab6
--md5:CommonFun_21_SkillDamType.txt:4039904bf4f52f8c90c491183855b808
--md5:CommonFun_22_SkillLogic.txt:fa21c3407b1522cd08d5837eb0d108e1
--md5:CommonFun_23_CalcBuff.txt:771cc9af19758b4f7f6b415ccc71189e
--md5:CommonFun_30_OtherFunc.txt:9b78b3b711bba6249fa26f3ab1b0e93a
--md5:CommonFun_31_Exchange.txt:808a92118da1fc48763436c62ee9b2ac
--md5:CommonFun_32_Making.txt:3c5385a810d16ac03ebd2f0504f157dc
--md5:CommonFun_33_Food.txt:029f6a269eb88e18475a60b678b9eef3
--md5:CommonFun_34_Auction.txt:ed78e23154aa2b891a1120e77f5d74d0
--md5:CommonFun_35_Lottery.txt:48fbec1debbd3ad2a5e8b9fddedf8cf6
--md5:CommonFun_36_Guide.txt:fe6b1f6df4d5af5a3fb2b028d6e89e2b
--md5:CommonFun_37_PetAdventure.txt:e0692b4a2685c4f3f67e5a492fa02e38
--md5:CommonFun_38_Guild.txt:0a4f12601f96c296806b531e5e4b5ecb
CommonFun = {}

CommonFun.RoleData =
{
  EATTRTYPE_STR                       = 100,
  EATTRTYPE_INT                       = 101,
  EATTRTYPE_AGI                       = 102,
  EATTRTYPE_DEX                       = 103,
  EATTRTYPE_VIT                       = 104,
  EATTRTYPE_LUK                       = 105,

  EATTRTYPE_ATK                       = 200,
  EATTRTYPE_ATKPER                    = 201,
  EATTRTYPE_DEF                       = 202,
  EATTRTYPE_DEFPER                    = 203,
  EATTRTYPE_MATK                      = 204,
  EATTRTYPE_MATKPER                   = 205,
  EATTRTYPE_MDEF                      = 206,
  EATTRTYPE_MDEFPER                   = 207,
  EATTRTYPE_MAXHP                     = 208,
  EATTRTYPE_MAXHPPER                  = 209,
  EATTRTYPE_MAXSP                     = 210,
  EATTRTYPE_MAXSPPER                  = 211,
  EATTRTYPE_HP                        = 212,
  EATTRTYPE_SP                        = 213,
  EATTRTYPE_HIT                       = 214,
  EATTRTYPE_FLEE                      = 215,
  EATTRTYPE_CRI                       = 216,
  EATTRTYPE_CRIRES                    = 217,
  EATTRTYPE_CRIDAMPER                 = 218,
  EATTRTYPE_CRIDEFPER                 = 219,
  EATTRTYPE_ATKSPD                    = 220,
  EATTRTYPE_MOVESPD                   = 221,
  EATTRTYPE_CASTSPD                   = 222,
  EATTRTYPE_RESTORESPD                = 223,
  EATTRTYPE_SPRESTORESPD              = 224,

  EATTRTYPE_RESTORESPDPER             = 227,
  EATTRTYPE_SPRESTORESPDPER           = 228,
  EATTRTYPE_CRIPER                    = 229,

  EATTRTYPE_REFINE                    = 300,
  EATTRTYPE_MREFINE                   = 301,
  EATTRTYPE_MOVESPDPER                = 302,
  EATTRTYPE_EQUIPASPD                 = 303,
  EATTRTYPE_SKILLASPD                 = 304,
  EATTRTYPE_HITPER                    = 305,
  EATTRTYPE_FLEEPER                   = 306,
  EATTRTYPE_STRPER                    = 307,
  EATTRTYPE_INTPER                    = 308,
  EATTRTYPE_AGIPER                    = 309,
  EATTRTYPE_DEXPER                    = 310,
  EATTRTYPE_VITPER                    = 311,
  EATTRTYPE_LUKPER                    = 312,


  EATTRTYPE_SHOWATK                   = 400,
  EATTRTYPE_SHOWDEF                   = 401,
  EATTRTYPE_SHOWMATK                  = 402,
  EATTRTYPE_SHOWMDEF                  = 403,
  EATTRTYPE_SHOWMAXHP                 = 404,
  EATTRTYPE_SHOWMAXSP                 = 405,
  EATTRTYPE_SHOWHIT                   = 406,
  EATTRTYPE_SHOWFLEE                  = 407,
  EATTRTYPE_SHOWCRI                   = 408,
  EATTRTYPE_SHOWCRIRES                = 409,
  EATTRTYPE_SHOWATKSPD                = 410,
  EATTRTYPE_SHOWMOVESPD               = 411,
  EATTRTYPE_SHOWCASTSPD               = 412,
  EATTRTYPE_SHOWRESTORESPD            = 413,
  EATTRTYPE_DAMREDUC                  = 414,
  EATTRTYPE_MDAMREDUC                 = 415,
  EATTRTYPE_SHORTRANGEDAMREDUC        = 427,
  EATTRTYPE_LONGRANGEDAMREDUC         = 428,
  EATTRTYPE_LONGRANGEMDAMREDUC        = 429,
  EATTRTYPE_IGNOREEQUIPDEF            = 430,
  EATTRTYPE_SHAPEATKPER               = 431,

  EATTRTYPE_WINDATK                   = 722,
  EATTRTYPE_EARTHATK                  = 723,
  EATTRTYPE_FIREATK                   = 724,
  EATTRTYPE_WATERATK                  = 725,
  EATTRTYPE_NEUTRALATK                = 726,
  EATTRTYPE_HOLYATK                   = 727,
  EATTRTYPE_DARkATK                   = 728,

}

-- 位运算工具函数
CommonFun.data32 = {}
for i = 1, 32 do
  CommonFun.data32[i] = 2 ^ (32 - i)
end

--------------------玩家属性计算公式（已经弃用）
--------------------物理职业攻击成长
local BaseLvAtkRate1={[1]=0,
    [11]=0,[12]=0,[13]=0,[14]=0,
    [72]=0,[73]=0,[74]=0,
    [21]=0,[22]=0,[23]=0,[24]=0,
    [82]=0,[83]=0,[84]=0,
    [31]=2,[32]=3,[33]=4,[34]=4,
    [92]=3,[93]=4,[94]=4,
    [41]=0,[42]=0,[43]=0,[44]=0,
    [102]=0,[103]=0,[104]=0,
    [112]=0,[113]=0,[114]=0,
    [51]=0,[52]=0,[53]=0,[54]=0,
    [122]=3,[123]=4,[124]=4,
    [61]=0,[62]=0,[63]=0,[64]=0,
    [132]=0,[133]=0,[134]=0
    }
--------------------魔法职业攻击成长（已经弃用）
local BaseLvAtkRate2={[1]=0,
    [11]=0,[12]=0,[13]=0,[14]=0,
    [72]=0,[73]=0,[74]=0,
    [21]=0,[22]=0,[23]=0,[24]=0,
    [82]=0,[83]=0,[84]=0,
    [31]=0,[32]=0,[33]=0,[34]=0,
    [92]=0,[93]=0,[94]=0,
    [41]=0,[42]=0,[43]=0,[44]=0,
    [102]=0,[103]=0,[104]=0,
    [112]=0,[113]=0,[114]=0,
    [51]=0,[52]=0,[53]=0,[54]=0,
    [122]=0,[123]=0,[124]=0,
    [61]=0,[62]=0,[63]=0,[64]=0,
    [132]=0,[133]=0,[134]=0
    }
--------------------职业物防成长（已经弃用）
local BaseLvDefRate={[1]=0,
    [11]=0,[12]=0,[13]=0,[14]=0,
    [72]=1,[73]=1,[74]=1,
    [21]=0,[22]=0,[23]=0,[24]=0,
    [82]=0,[83]=0,[84]=0,
    [31]=0,[32]=0,[33]=0,[34]=0,
    [92]=0,[93]=0,[94]=0,
    [41]=0,[42]=0,[43]=0,[44]=0,
    [102]=0,[103]=0,[104]=0,
    [112]=0,[113]=0,[114]=0,
    [51]=0,[52]=0,[53]=0,[54]=0,
    [122]=0,[123]=0,[124]=0,
    [61]=0,[62]=0,[63]=0,[64]=0,
    [132]=0,[133]=0,[134]=0
    }
--------------------职业魔防成长（已经弃用）
local BaseLvMDefRate={[1]=0,
    [11]=0,[12]=0,[13]=0,[14]=0,
    [72]=0,[73]=0,[74]=0,
    [21]=0,[22]=0,[23]=0,[24]=0,
    [82]=0,[83]=0,[84]=0,
    [31]=0,[32]=0,[33]=0,[34]=0,
    [92]=0,[93]=0,[94]=0,
    [41]=0,[42]=0,[43]=0,[44]=0,
    [102]=0,[103]=0,[104]=0,
    [112]=0,[113]=0,[114]=0,
    [51]=0,[52]=0,[53]=0,[54]=0,
    [122]=0,[123]=0,[124]=0,
    [61]=0,[62]=0,[63]=0,[64]=0,
    [132]=0,[133]=0,[134]=0
    }
local BaseLvRate={[1]=5,
    [11]=20,[12]=20,[13]=20,[14]=20,
    [72]=20,[73]=20,[74]=20,
    [21]=10,[22]=10,[23]=10,[24]=12,
    [82]=10,[83]=10,[84]=12,
    [31]=12,[32]=12,[33]=12,[34]=14,
    [92]=12,[93]=12,[94]=14,
    [41]=12,[42]=12,[43]=12,[44]=16,
    [102]=12,[103]=12,[104]=16,
    [112]=12,[113]=12,[114]=16,
    [51]=5,[52]=5,[53]=5,[54]=14,
    [122]=5,[123]=5,[124]=16,
    [61]=12,[62]=12,[63]=12,[64]=14,
    [132]=12,[133]=12,[134]=16
    }
local HpRate={[1]=0,
    [11]=1.5,[12]= 1.75,[13]= 2,[14]= 3,
    [72]=4,[73]=5,[74]=5,
    [21]=0.9,[22]=1.1,[23]=1.2,[24]=2.1,
    [82]=1.1,[83]=1.2,[84]=2.1,
    [31]=1.1,[32]= 1.3,[33]= 1.5,[34]= 2.3,
    [92]=1.3,[93]=1.5,[94]=2.4,
    [41]=1,[42]=1.2,[43]=1.3,[44]=2.1,
    [102]=1.2,[103]=1.3,[104]=2.1,
    [112]=1.2,[113]=1.3,[114]=2.1,
    [51]=0.9,[52]=1.1,[53]=1.2,[54]=2.2,
    [122]=1.2,[123]=1.4,[124]=2.1,
    [61]=1,[62]= 1.4,[63]= 1.6,[64]= 2.5,
    [132]=1.4,[133]=1.6,[134]=2.2,
    }
local BaseHp={[1]=0,
    [11] =400,[12] =400,[13] =400,[14]=1000,
    [72] =1000,[73] =1500,[74] =1500,
    [21] =  0,[22] =  0,[23] =  0,[24]=1000,
    [82] =  0,[83] =  0,[84] =  1000,
    [31] =  0,[32] =  0,[33] =  0,[34]=1000,
    [92] =  0,[93] =  0,[94] =  1000,
    [41] =  0,[42] =  0,[43] =  0,[44]=1000,
    [102]=  0,[103]=  0,[104]=  1000,
    [112]=  0,[113]=  0,[114]=  1000,
    [51] =  0,[52] =  0,[53] =  0,[54]=1500,
    [122]=300,[123]=300,[124]=1000,
    [61] =  0,[62] =  0,[63] =  0,[64]=1000,
    [132]=  0,[133]=  0,[134]=  1000,
    }
------------------------------职业空手攻速（已经弃用）
local BaseJobAtkSpd={[1]=156,
    [11]=153,[12]=156,[13]=156,[14]=156,
    [72]=156,[73]=156,[74]=156,
    [21]=146,[22]=146,[23]=151,[24]=151,
    [82]=156,[83]=156,[84]=156,
    [31]=156,[32]=156,[33]=156,[34]=156,
    [92]=156,[93]=156,[94]=156,
    [41]=156,[42]=156,[43]=156,[44]=156,
    [102]=156,[103]=156,[104]=156,
    [112]=156,[113]=156,[114]=156,
    [51]=156,[52]=156,[53]=151,[54]=151,
    [122]=156,[123]=156,[124]=156,
    [61]=156,[62]=156,[63]=156,[64]=156,
    [132]=156,[133]=156,[134]=156,
    }
-----------------长矛各职业对应攻速（已经弃用）
local SpearAtkSpd={[1]=0,
    ---------------------------------------------------这是剑士和骑士系列
    [11]=-17, [12]=-15, [13]= -8, [14]= -8,
    [72]=-13, [73]=-10, [74]=-10,
    [21]=  0, [22]=  0, [23]=  0, [24]=  0,
    [82]=  0, [83]=  0, [84]=  0,
    [31]=  0, [32]=  0, [33]=  0, [34]=  0,
    [92]=  0, [93]=  0, [94]=  0,
    [41]=  0, [42]=  0, [43]=  0, [44]=  0,
    [102]= 0, [103]= 0, [104]= 0,
    [112]= 0, [113]= 0, [114]= 0,
    [51]=  0, [52]=  0, [53]=  0, [54]=  0,
    [122]= 0, [123]= 0, [124]= 0,
    [61]=  0, [62]=  0, [63]=  0, [64]=  0,
    [132]= 0, [133]= 0, [134]= 0,
    }
-----------------长剑各职业对应攻速（已经弃用）
local SwordAtkSpd={[1]=-17,
    [11]= -7, [12]= -5, [13]=-12, [14]= -12,
    [72]= -3, [73]= -5, [74]= -5,
    [21]=  0, [22]=  0, [23]=  0, [24]=  0,
    [82]=  0, [83]=  0, [84]=  0,
    [31]=-10, [32]=-10, [33]=-25, [34]=-25,
    [92]=-10, [93]=-25, [94]=-25,
    [41]=  0, [42]=  0, [43]=  0, [44]=  0,
    [102]= 0, [103]= 0, [104]= 0,
    [112]= 0, [113]= 0, [114]= 0,
    [51]=  0, [52]=  0, [53]=  0, [54]=  0,
    [122]= 0, [123]= 0, [124]= 0,
    [61]=-12, [62]=-10, [63]=-25, [64]=-25,
    [132]=-10, [133]=-25, [134]=-25,
    }
-----------------锤子各职业对应攻速（已经弃用）
local MaceAtkSpd={[1]=-10,
    [11]=-10, [12]= -5, [13]= -5, [14]= -5,
    [72]= -5, [73]= -4, [74]= -4,
    [21]=  0, [22]=  0, [23]=  0, [24]=  0,
    [82]=  0, [83]=  0, [84]=  0,
    [31]=  0, [32]=  0, [33]=  0, [34]=  0,
    [92]=  0, [93]=  0, [94]=  0,
    [41]=  0, [42]=  0, [43]=  0, [44]=  0,
    [102]= 0, [103]= 0, [104]= 0,
    [112]= 0, [113]= 0, [114]= 0,
    [51]= -5, [52]= -3, [53]=  0, [54]=  0,
    [122]=-3, [123]=-5, [124]=-5,
    [61]=-10, [62]= -8, [63]= -8, [64]= -8,
    [132]=-8, [133]= -8, [134]= -8,
    }
-----------------拳刃各职业对应攻速（已经弃用）
local KatarAtkSpd={[1]=0,
    [11]=  0, [12]=  0, [13]=  0, [14]=  0,
    [72]=  0, [73]=  0, [74]=  0,
    [21]=  0, [22]=  0, [23]=  0, [24]=  0,
    [82]=  0, [83]=  0, [84]=  0,
    [31]=  0, [32]= -2, [33]= -2, [34]= -2,
    [92]=  0, [93]=  0, [94]=  0,
    [41]=  0, [42]=  0, [43]=  0, [44]=  0,
    [102]= 0, [103]= 0, [104]= 0,
    [112]= 0, [113]= 0, [114]= 0,
    [51]=  0, [52]=  0, [53]=  0, [54]=  0,
    [122]= 0, [123]= 0, [124]= 0,
    [61]=  0, [62]=  0, [63]=  0, [64]=  0,
    [132]= 0, [133]= 0, [134]= 0,
    }
-----------------弓各职业对应攻速（已经弃用）
local BowAtkSpd={[1]=0,
    [11]=  0, [12]=  0, [13]=  0, [14]=  0,
    [72]=  0, [73]=  0, [74]=  0,
    [21]=  0, [22]=  0, [23]=  0, [24]=  0,
    [82]=  0, [83]=  0, [84]=  0,
    [31]=  0, [32]=  0, [33]=  0, [34]=  0,
    [92]=-10, [93]=-10, [94]=-10,
    [41]=-10, [42]= -8, [43]= -9, [44]= -9,
    [102]= 0, [103]= 0, [104]= 0,
    [112]= 0, [113]= 0, [114]= 0,
    [51]=  0, [52]=  0, [53]=  0, [54]=  0,
    [122]= 0, [123]= 0, [124]= 0,
    [61]=  0, [62]=  0, [63]=  0, [64]=  0,
    [132]= 0, [133]= 0, [134]= 0,
    }
-----------------法杖各职业对应攻速（已经弃用）
local StaffAtkSpd={[1]=-25,
    [11]=  0, [12]=  0, [13]=  0, [14]=  0,
    [72]=  0, [73]=  0, [74]=  0,
    [21]= -5, [22]= -3, [23]= -5, [24]= -5,
    [82]=  0, [83]=  0, [84]=  0,
    [31]=  0, [32]=  0, [33]=  0, [34]=  0,
    [92]=  0, [93]=  0, [94]=  0,
    [41]=  0, [42]=  0, [43]=  0, [44]=  0,
    [102]= 0, [103]= 0, [104]= 0,
    [112]= 0, [113]= 0, [114]= 0,
    [51]=-20, [52]=-20, [53]=-15, [54]=-15,
    [122]=-20, [123]=-10, [124]=-10,
    [61]=-10, [62]= -8, [63]= -8, [64]= -8,
    [132]= 0, [133]= 0, [134]= 0,
    }
-----------------匕首各职业对应攻速（已经弃用）
local KnifeAtkSpd={[1]=-15,
    [11]= -7, [12]= -9, [13]=-10, [14]=-10,
    [72]= -8, [73]= -7, [74]= -7,
    [21]=  0, [22]= -4, [23]= -7, [24]= -7,
    [82]=  0, [83]=  0, [84]=  0,
    [31]= -8, [32]= -2, [33]= -2, [34]= -2,
    [92]= -2, [93]= -2, [94]= -2,
    [41]=-15, [42]=-13, [43]=-10, [44]=-10,
    [102]= 0, [103]= 0, [104]= 0,
    [112]= 0, [113]= 0, [114]= 0,
    [51]=  0, [52]=  0, [53]=  0, [54]=  0,
    [122]= 0, [123]= 0, [124]= 0,
    [61]=-12, [62]=-10, [63]=-20, [64]=-20,
    [132]=-10, [133]=-20, [134]=-20,
    }
-----------------斧头各职业对应攻速（已经弃用）
local AxeAtkSpd={[1]=-15,
    [11]= -20, [12]= -15, [13]=-12, [14]=-12,
    [72]= -20, [73]= -15, [74]=-15,
    [21]=  0, [22]=  0, [23]=  0, [24]=  0,
    [82]=  0, [83]=  0, [84]=  0,
    [31]= 0, [32]= 0, [33]= 0, [34]= 0,
    [92]=  0, [93]=  0, [94]=  0,
    [41]=  0, [42]=  0, [43]=  0, [44]= 0,
    [102]= 0, [103]= 0, [104]= 0,
    [112]= 0, [113]= 0, [114]= 0,
    [51]=  0, [52]=  0, [53]=  0, [54]=  0,
    [122]= 0, [123]= 0, [124]= 0,
    [61]=-15, [62]=-13, [63]=-10, [64]=-10,
    [132]=-13, [133]=-10, [134]=-10,
    }
 -----------------拳套各职业对应攻速（已经弃用）
local FistAtkSpd={[1] = 0,
    [11] = 0, [12] = 0, [13] = 0, [14]= 0,
    [72] = 0, [73] = 0, [74] = 0,
    [21] = 0, [22] = 0, [23] = 0, [24]= 0,
    [82] = 0, [83] = 0, [84] = 0,
    [31] = 0, [32] = 0, [33] = 0, [34]= 0,
    [92] = 0, [93] = 0, [94] = 0,
    [41] = 0, [42] = 0, [43] = 0, [44]= 0,
    [102]= 0, [103]= 0, [104]= 0,
    [112]= 0, [113]= 0, [114]= 0,
    [51] = 0, [52] =-20, [53] =-5, [54]=-5,
    [122]= 0, [123]= -1, [124]=-1,
    [61] = 0, [62] = 0, [63] = 0, [64]= 0,
    [132]= 0, [133]= 0, [134]= 0,
    }

-----------------副手各职业对应攻速(暂时修改掉副手的ASPD惩罚)（已经弃用）
local ShieldAtkSpd={[1]= 0,
    [11]=  0, [12]=  0, [13]=  0, [14]=  0,
    [72]=  0, [73]=  0, [74]=  0,
    [21]=  0, [22]=  0, [23]=  0, [24]=  0,
    [82]=  0, [83]=  0, [84]=  0,
    [31]=  0, [32]=  0, [33]=  0, [34]=  0,
    [92]=  0, [93]=  0, [94]=  0,
    [41]=  0, [42]=  0, [43]=  0, [44]=  0,
    [102]= 0, [103]= 0, [104]= 0,
    [112]= 0, [113]= 0, [114]= 0,
    [51]=  0, [52]=  0, [53]=  0, [54]=  0,
    [122]= 0, [123]= 0, [124]= 0,
    [61]=  0, [62]=  0, [63]=  0, [64]=  0,
    [132]= 0, [133]= 0, [134]= 0,
    }

------各装备类型针对不同武器的体型修正
local WeaponShapeCorrection={
    -------------------------------------170(长矛);180(剑);190(法杖);200(拳刃);210(弓);220(锤子);230(斧头);240(书);250(匕首);260(乐器);270(鞭子);280(试管);290(拳套)
    [0]  ={[1]=   1,[2]=   1,[3]=   1},
    [170]={[1]=0.75,[2]=0.75,[3]=   1},
    [180]={[1]=0.75,[2]=   1,[3]=0.75},
    [190]={[1]=   1,[2]=   1,[3]=   1},
    [200]={[1]=0.75,[2]=   1,[3]=0.75},
    [210]={[1]=   1,[2]=   1,[3]=0.75},
    [220]={[1]=0.75,[2]=   1,[3]=   1},
    [230]={[1]= 0.5,[2]=0.75,[3]=   1},
    [240]={[1]=   1,[2]=   1,[3]= 0.5},
    [250]={[1]=   1,[2]=0.75,[3]= 0.5},
    [260]={[1]=0.75,[2]=   1,[3]=0.75},
    [270]={[1]=0.75,[2]=   1,[3]=0.75},
    [280]={[1]=   1,[2]=0.75,[3]= 0.5},
    [290]={[1]=   1,[2]=0.75,[3]= 0.5},
    }


CommonFun.LaunchType = {
    CloseAttack = 1,
    LongAttack = 2
}

CommonFun.RollType = {
    Attack = 1,
    Magic = 2
}

CommonFun.Race = {
    Brute = 1,
    DemiHuman = 2,
    Demon = 3,
    Plant = 4,
    DeadLess = 5,
    Formless = 6,
    Fish = 7,
    Angel = 8,
    Insect = 9,
    Dragon = 10
}

CommonFun.RaceProps = {
    [CommonFun.Race.Brute] = {"BruteDamPer", "BruteResPer"},
    [CommonFun.Race.DemiHuman] = {"DemiHumanDamPer", "DemiHumanResPer"},
    [CommonFun.Race.Demon] = {"DemonDamPer", "DemonResPer"},
    [CommonFun.Race.Plant] = {"PlantDamPer", "PlantResPer"},
    [CommonFun.Race.DeadLess] = {"DeadLessDamPer", "DeadLessResPer"},
    [CommonFun.Race.Formless] = {"FormlessDamPer", "FormlessResPer"},
    [CommonFun.Race.Fish] = {"FishDamPer", "FishResPer"},
    [CommonFun.Race.Angel] = {"AngelDamPer", "AngelResPer"},
    [CommonFun.Race.Insect] = {"InsectDamPer", "InsectResPer"},
    [CommonFun.Race.Dragon] = {"DragonDamPer", "DragonResPer"},
}

CommonFun.Nature = {
    Wind = 1,
    Earth = 2,
    Water = 3,
    Fire = 4,
    Neutral = 5,
    Holy = 6,
    Shadow = 7,
    Ghost = 8,
    Undead = 9,
    Poison = 10
}
CommonFun.NatureProps = {
    [CommonFun.Nature.Wind] = {"WindDamPer", "BeWindDamPer","WindAtk"},
    [CommonFun.Nature.Earth] = {"EarthDamPer", "BeEarthDamPer","EarthAtk"},
    [CommonFun.Nature.Water] = {"WaterDamPer", "BeWaterDamPer","WaterAtk"},
    [CommonFun.Nature.Fire] = {"FireDamPer", "BeFireDamPer","FireAtk"},
    [CommonFun.Nature.Neutral] = {"NeutralDamPer", "BeNeutralDamPer","NeutralAtk"},
    [CommonFun.Nature.Holy] = {"HolyDamPer", "BeHolyDamPer","HolyAtk"},
    [CommonFun.Nature.Shadow] = {"ShadowDamPer", "BeShadowDamPer","DarkAtk"},
    [CommonFun.Nature.Ghost] = {"GhostDamPer", "BeGhostDamPer","GhostAtk"},
    [CommonFun.Nature.Undead] = {"UndeadDamPer", "BeUndeadDamPer","UndeadAtk"},
    [CommonFun.Nature.Poison] = {"PoisonDamPer", "BePoisonDamPer","PoisoningAtk"},
}

CommonFun.Shape = {
    S = "S",
    M = "M",
    L = "L"
}

CommonFun.ShapeProps = {
    [CommonFun.Shape.S] = {"SmallDamPer", "SmallResPer"},
    [CommonFun.Shape.M] = {"MidDamPer", "MidResPer"},
    [CommonFun.Shape.L] = {"BigDamPer", "BigResPer"},
}

CommonFun.AttrEffect = {
  NoMagicDamage           = 1, -- 魔法伤害免疫
  NoPhysicalDamage        = 2, -- 物理伤害免疫
  NoHpRecover             = 3, -- 血量无法恢复
  NoSpRecover             = 4, -- 蓝量无法恢复
  NoChantBreak            = 5, -- 吟唱不会中断
  IgnoreRaceDamage        = 6, -- 无视种族伤害
  IgnoreBodyDamage        = 7, -- 无视体型伤害
  IgnoreAttrDamage        = 8, -- 标示手推车终结技效果
  IgnoreNearNormalSkill   = 9, -- 无视近战普攻
  MustHitAndCri           = 10, -- 必定命中且暴击
  BattleInRiding          = 11, -- 骑乘战斗
  IgnoreNearPhysicalSkill = 12, -- 无视近战物理伤害
  IgnoreFarSkill          = 13, -- 无视远距离伤害
  NextAttackIncrease      = 14, -- 下次普攻伤害增加
  TriggerTrapMark         = 15, -- 引爆陷阱伤害额外增加
  BuffPriorArrow          = 16, -- 标记主动buff属性优先级高于箭矢属性
  HideStrengthEffect      = 17, -- 隐匿强化效果
  HuaShouStatus           = 18, -- 火狩状态
  BaXieZhiZhen            = 19, -- 霸邪之阵
  InGodStatus             = 20, -- 幽灵隐身时无敌
  KuangJiDam              = 21, -- 狂击技能伤害增加50%
  GuaiWuHuJiDam           = 22, -- 怪物互击技能伤害增加30%
  DuRenAndWuYingDam       = 23, -- 毒刃和无影之牙伤害增加25%
  XuShouDam               = 24, -- 驯兽术伤害增加20%
  HeiAnDam                = 25, -- 黑暗瞬间伤害增加
  NormalSkillDam          = 26, -- 弓手普通攻击增加伤害
  RangeDam                = 27, -- 法师范围型技能伤害
  MustNotCri              = 28, -- 无法被暴击
  Hualiduanjian           = 29, -- 华丽短剑的提升50%技能伤害
  Shandiyouxiazhuang      = 30, -- 山地游侠装造成的对宠物加成的地方

}

CommonFun.AttrEffect2 = {
 Shiziqumo               = 1, -- 十字驱魔攻击伤害提升
 NextPointSkillFar       = 2, -- 区域型技能释放不限释放距离
 PoisinDamNoUse          = 3, -- 中毒使用药瓶无效，治愈也无效
 NoDeath                 = 4, -- 信仰祈福一滴血不死
 MushiCrit               = 5, -- 牧师对不死属性和恶魔种族暴击
 NoSpAdd                 = 6, -- SP不能恢复（包括药水，自然恢复，所有)
 AutoDef                 = 7, -- 自动防御
 NextSkillNoReady        = 8, -- 下一次读条类技能顺发
 NoMonsterAtk            = 9, -- 不会被怪物主动攻击
 BoliBianshen            = 10,-- 波利变身
 GonghuiBianshen         = 11,-- 公会道具变身
 MDamageTo1              = 12,-- 魔法伤害变为1
 DamageTo1               = 13,-- 物理伤害变为1
 DiffZoneNoDam           = 14,-- 华丽水晶 不在自己公会线不受伤害,不受debuff
 BCatBianshen            = 15,-- B猫变身打年兽
 NoEnemySkillSelected    = 16,-- 不可以被敌方选择为技能目标
 WeaponBlock             = 17,-- 武器格挡
 isRideWolf              = 18,-- 骑狼状态
 NotCure                 = 19,-- 魔导机械无法被治愈
 BeMagicMachine          = 20,-- 处于魔导机械变身状态
 NotHide                 = 21,-- 不可进入隐匿状态
 Suspend                 = 22,-- 悬浮状态
 UltraMan                = 23,-- 奥特曼变身状态
 NoBuffAdd               = 24,-- 无法添加增益buff
 NoDeBuffAdd             = 25,-- 无法添加Debuff
 EarthField              = 26,-- 地领域,免疫所有地面效果
}


CommonFun.StateEffect = {
  Poison = 1,   -- 中毒
  Blood = 2,    -- 流血
  Burn = 3,     -- 灼烧
  Dizzy = 4,    -- 眩晕
  Freeze = 5,   -- 冰冻
  Stone = 6,    -- 石化
  Sleep = 7,    -- 睡眠
  Fear = 8,     -- 恐惧
  NoMove = 9,   -- 定身
  Silence = 10, -- 沉默
  Curse = 11,   -- 诅咒
  Dark = 12,    -- 黑暗
}

CommonFun.AttrFunction = {
  HandEnable            = 1, -- 允许牵手
  ShootGhost            = 2, -- 幽灵相机
  CameraDizzy           = 3, -- 相机可以使恶魔眩晕
  JustInViceZone        = 4, -- 刚刚切到分线, 不能对boss 和 mini 造成伤害, 不能捡拾boss/nini 掉落
}


-------------------------------------------------新增箭矢属性类型
CommonFun.ArrowAttr =
{
  {12500, 5},{12501, 4},{12502, 6},{12503,3},{12504,2},{12505,1}
}

function CommonFun.GetAtkAttrByArrow(itemid)
  if CommonFun.ArrowAttr == nil then
    return 0
  end
  for key, val in pairs(CommonFun.ArrowAttr) do
    if val[1] == itemid then
      return val[2]
    end
  end
  return 0
end


CommonFun.DamageType = {
    None = 0,
    Normal = 1,
    Crit = 2,
    Miss = 3,
    Treatment = 4,
    Block = 5,
    Barrier=6,
    ErLianJi = 7,
    Normal_Sp = 8, --------------------------------攻击扣篮表现
    Treatment_Sp = 9,------------------------------攻击吸蓝表现
    AutoBlock = 10,--------------------------------自动防御
    WeaponBlock = 11 ------------------------------武器格挡
}

-------------------------------------------冒险技能血瓶蓝瓶回复效果
CommonFun.AutoItemSkills={
    [1]={-------HP效果
      interval=0.3,
      skills={
        [1]={
          skill=50001,
          items={[1]=12117,[2]=12325,[3]=12119},
          Condition=function(cmd)
            if cmd.PVP or cmd.GVG or cmd.MiniAndMVPAroundMe(10) then
              return 0.3>cmd.GetMyRelativeHP()
            end
            return false
          end
        },
        [2]={
          skill=50000,
          items={[1]=12001,[2]=12003,[3]=12002,[4]=12023},
          Condition=function(cmd)
            return 0.5>cmd.GetMyRelativeHP()
          end
        },
      },

    },

    [2]={-------SP效果
      interval=0.3,
      skills={
        [1]={
          skill=50001,
          items={[1]=12117,[2]=12325,[3]=12119},
          Condition=function(cmd)
            if cmd.PVP or cmd.GVG or cmd.MiniAndMVPAroundMe(10) then
              return 0.3>cmd.GetMyRelativeSP()
            end
            return false
          end
        },
        [2]={
          skill=50000,
          items={[1]=12024,[2]=12310,[3]=12121},
          Condition=function(cmd)
            return 0.5>cmd.GetMyRelativeSP()
          end
        },
      },

    },
}
function CommonFun.calAttrPoint( curPoint,joblv,job,attr )
  local result={}
  if job == 0 then
        if joblv==1 then
           return curPoint+joblv
  elseif joblv==2 then
      if attr=="Str" then
           return curPoint+2
        elseif attr=="Vit" then
           return curPoint+2
        elseif attr=="Int" then
           return curPoint+1
        elseif attr=="Dex" then
           return curPoint+1
        elseif attr=="Agi" then
           return curPoint+1
        elseif attr=="Luk" then
           return curPoint+1
        end
  elseif joblv==3 then
      if attr=="Str" then
           return curPoint+2
        elseif attr=="Vit" then
           return curPoint+2
        elseif attr=="Int" then
           return curPoint+2
        elseif attr=="Dex" then
           return curPoint+2
        elseif attr=="Agi" then
           return curPoint+1
        elseif attr=="Luk" then
           return curPoint+1
        end
  elseif joblv==4 then
      if attr=="Str" then
           return curPoint+2
        elseif attr=="Vit" then
           return curPoint+2
        elseif attr=="Int" then
           return curPoint+2
        elseif attr=="Dex" then
           return curPoint+2
        elseif attr=="Agi" then
           return curPoint+2
        elseif attr=="Luk" then
           return curPoint+2
        end
  elseif joblv==5 then
      if attr=="Str" then
           return curPoint+3
        elseif attr=="Vit" then
           return curPoint+3
        elseif attr=="Int" then
           return curPoint+2
        elseif attr=="Dex" then
           return curPoint+2
        elseif attr=="Agi" then
           return curPoint+2
        elseif attr=="Luk" then
           return curPoint+2
        end
  elseif joblv==6 then
      if attr=="Str" then
           return curPoint+3
        elseif attr=="Vit" then
           return curPoint+3
        elseif attr=="Int" then
           return curPoint+3
        elseif attr=="Dex" then
           return curPoint+3
        elseif attr=="Agi" then
           return curPoint+2
        elseif attr=="Luk" then
           return curPoint+2
        end
  elseif joblv==7 then
      if attr=="Str" then
           return curPoint+3
        elseif attr=="Vit" then
           return curPoint+3
        elseif attr=="Int" then
           return curPoint+3
        elseif attr=="Dex" then
           return curPoint+3
        elseif attr=="Agi" then
           return curPoint+3
        elseif attr=="Luk" then
           return curPoint+3
        end
  elseif joblv==8 then
      if attr=="Str" then
           return curPoint+4
        elseif attr=="Vit" then
           return curPoint+4
        elseif attr=="Int" then
           return curPoint+3
        elseif attr=="Dex" then
           return curPoint+3
        elseif attr=="Agi" then
           return curPoint+3
        elseif attr=="Luk" then
           return curPoint+3
        end
  elseif joblv==9 then
      if attr=="Str" then
           return curPoint+4
        elseif attr=="Vit" then
           return curPoint+4
        elseif attr=="Int" then
           return curPoint+4
        elseif attr=="Dex" then
           return curPoint+4
        elseif attr=="Agi" then
           return curPoint+3
        elseif attr=="Luk" then
           return curPoint+3
        end
  elseif joblv==10 then
      if attr=="Str" then
           return curPoint+4
        elseif attr=="Vit" then
           return curPoint+4
        elseif attr=="Int" then
           return curPoint+4
        elseif attr=="Dex" then
           return curPoint+4
        elseif attr=="Agi" then
           return curPoint+4
        elseif attr=="Luk" then
           return curPoint+4
        end
  end
  end

    return curPoint + CommonFun.calProfessionPropValue(joblv, job, attr)

end
------------------------------------------------------------------------职业等级 素质点 加成
function CommonFun.calProfessionPropValue(joblv, job, attr)
  if(GameConfig.AttrRatio[job] == nil )then
    return 0
  end
  if(GameConfig.AttrValue[job] == nil )then
    return 0
  end

  if joblv<=170 then
    return math.floor((joblv-10)/160*(GameConfig.AttrRatio[job][attr]-0.5)+0.5)+1
  elseif joblv>170 and joblv<=200 then
    return GameConfig.AttrRatio[job][attr]+math.floor((joblv-170)/30*(GameConfig.AttrValue[job][attr]))+1
  elseif joblv>200 then
    return GameConfig.AttrRatio[job][attr]+GameConfig.AttrValue[job][attr]+math.floor((joblv-200)/20*(GameConfig.Attr220Value[job][attr]))+1
  end

end

-- 传入一个32位整数, 返回32位数组
function CommonFun.getBits(arg)
    arg = arg or 0
    local bits ={}
    for i=1,32 do
        if arg >= CommonFun.data32[i] then
            bits[33- i]=1
            arg=arg-CommonFun.data32[i]
        else
            bits[33- i]=0
        end
    end
    return bits
end


----------计算战斗力（已经弃用）
--function CommonFun.calcBattlePoint(attr, lv, profession, weapon, skillbt)
  --local total, extra = CommonFun.calcUserAttrValue(attr, lv, profession, weapon)
  --local maxhp = total[CommonFun.RoleData.EATTRTYPE_SHOWMAXHP]
  --local atk = total[CommonFun.RoleData.EATTRTYPE_SHOWATK]
  --local matk = total[CommonFun.RoleData.EATTRTYPE_SHOWMATK]
  --local def = total[CommonFun.RoleData.EATTRTYPE_SHOWDEF]
  --local mdef = total[CommonFun.RoleData.EATTRTYPE_SHOWMDEF]
  --local hit = total[CommonFun.RoleData.EATTRTYPE_SHOWHIT]
  --local flee = total[CommonFun.RoleData.EATTRTYPE_SHOWFLEE]
  --local cri = total[CommonFun.RoleData.EATTRTYPE_SHOWCRI]
  --local crires = total[CommonFun.RoleData.EATTRTYPE_SHOWCRIRES]
  --local atkspd = total[CommonFun.RoleData.EATTRTYPE_SHOWATKSPD]
  --local movespd = total[CommonFun.RoleData.EATTRTYPE_SHOWMOVESPD]
  --local castspd = total[CommonFun.RoleData.EATTRTYPE_SHOWCASTSPD]
  --local restorespd = total[CommonFun.RoleData.EATTRTYPE_SHOWRESTORESPD]

  --return maxhp*5 + (atk + matk) / 2 + (def + mdef) + hit + flee + cri*2 + crires*2 + atkspd*10 + movespd*10
  --      + castspd*10 + restorespd*10 + skillbt*5
--end

-- user attribute
function CommonFun.checkRemoteAtk( profession ,WeaponType)
  ---------------------------------------------------------------流氓穿戴弓时是远程职业
  if (profession==92 or profession==93 or profession==94) and WeaponType==210 then
    return true
  end

  for k,v in pairs(GameConfig.Atkcalculate) do
    if(v == profession) then
      return true
    end
  end
end

-----------等差数列求和（已经弃用）
function CommonFun.CalcSum(num)
   local result=0
   for i=num,0,-1 do
    result=result+i
   end
   return result
end

----------------------------（已经弃用）武器基本攻速(170--长矛;180---剑;190---法杖;200---拳刃;210---弓;220---锤子;230---斧头;240---书;250---匕首;260---乐器;270---鞭子;280---试管;290---拳套)
function CommonFun.WeaponAtkSpd(type,profession)
  if type==170 then
     return SpearAtkSpd[profession]
  elseif type==180 then
     return SwordAtkSpd[profession]
  elseif type==190 then
     return StaffAtkSpd[profession]
  elseif type==200 then
     return KatarAtkSpd[profession]
  elseif type==210 then
     return BowAtkSpd[profession]
  elseif type==220 then
     return MaceAtkSpd[profession]
  elseif type== 230 then
     return AxeAtkSpd[profession]
  elseif type==250 then
     return KnifeAtkSpd[profession]
  elseif type==290 then
     return FistAtkSpd[profession]
  elseif type==510 or type==511 or type==512 or type==513 or type==514 or type==515 then
     return ShieldAtkSpd[profession]
  end
  return 0
end

function CommonFun.calcUserShowAttr(attr,profession,lv,WeaponType)
  local showresult={}
  if CommonFun.checkRemoteAtk(profession,WeaponType) then
    showresult[CommonFun.RoleData.EATTRTYPE_ATK] = attr[CommonFun.RoleData.EATTRTYPE_DEX]*2+math.floor(attr[CommonFun.RoleData.EATTRTYPE_DEX]*attr[CommonFun.RoleData.EATTRTYPE_DEX]/100)+math.floor(attr[CommonFun.RoleData.EATTRTYPE_STR]/5)+math.floor(attr[CommonFun.RoleData.EATTRTYPE_LUK]/5)
  else
    showresult[CommonFun.RoleData.EATTRTYPE_ATK] = attr[CommonFun.RoleData.EATTRTYPE_STR]*2+math.floor(attr[CommonFun.RoleData.EATTRTYPE_STR]*attr[CommonFun.RoleData.EATTRTYPE_STR]/100)+math.floor(attr[CommonFun.RoleData.EATTRTYPE_DEX]/5)+math.floor(attr[CommonFun.RoleData.EATTRTYPE_LUK]/5)
  end
  showresult[CommonFun.RoleData.EATTRTYPE_DEF]  = attr[CommonFun.RoleData.EATTRTYPE_VIT]
  showresult[CommonFun.RoleData.EATTRTYPE_MATK] = attr[CommonFun.RoleData.EATTRTYPE_INT]*2+math.floor(attr[CommonFun.RoleData.EATTRTYPE_INT]*attr[CommonFun.RoleData.EATTRTYPE_INT]/100)
  showresult[CommonFun.RoleData.EATTRTYPE_MDEF] = attr[CommonFun.RoleData.EATTRTYPE_INT]
  showresult[CommonFun.RoleData.EATTRTYPE_HIT]  = attr[CommonFun.RoleData.EATTRTYPE_DEX]
  showresult[CommonFun.RoleData.EATTRTYPE_FLEE] = attr[CommonFun.RoleData.EATTRTYPE_AGI]
  showresult[CommonFun.RoleData.EATTRTYPE_CRI]  = math.floor(attr[CommonFun.RoleData.EATTRTYPE_LUK]/3)
  showresult[CommonFun.RoleData.EATTRTYPE_CRIRES] = math.floor(attr[CommonFun.RoleData.EATTRTYPE_LUK]/5)
  showresult[CommonFun.RoleData.EATTRTYPE_ATKSPD] = attr[CommonFun.RoleData.EATTRTYPE_AGI]/100
  showresult[CommonFun.RoleData.EATTRTYPE_CASTSPD] = attr[CommonFun.RoleData.EATTRTYPE_DEX]/30
  showresult[CommonFun.RoleData.EATTRTYPE_RESTORESPD] = math.floor(attr[CommonFun.RoleData.EATTRTYPE_VIT]/5)
  showresult[CommonFun.RoleData.EATTRTYPE_SPRESTORESPD] = math.floor(attr[CommonFun.RoleData.EATTRTYPE_INT]/6)
  return showresult

end

function CommonFun.calcUserAttrValue(attr,lv,profession,type,map)
  local result = {}
  local extra = {}

  -- protect
  if profession == 0 then
    return result, extra
  end

  if  attr[CommonFun.RoleData.EATTRTYPE_DEX] < 0 then

      attr[CommonFun.RoleData.EATTRTYPE_DEX] = 0
      result[CommonFun.RoleData.EATTRTYPE_DEX] = 0
  end

  if  attr[CommonFun.RoleData.EATTRTYPE_STR] < 0 then

      attr[CommonFun.RoleData.EATTRTYPE_STR] = 0
      result[CommonFun.RoleData.EATTRTYPE_STR] = 0
  end

  if  attr[CommonFun.RoleData.EATTRTYPE_VIT] < 0 then

      attr[CommonFun.RoleData.EATTRTYPE_VIT] = 0
      result[CommonFun.RoleData.EATTRTYPE_VIT] = 0
  end

  if  attr[CommonFun.RoleData.EATTRTYPE_INT] < 0 then

      attr[CommonFun.RoleData.EATTRTYPE_INT] = 0
      result[CommonFun.RoleData.EATTRTYPE_INT] = 0
  end

  if  attr[CommonFun.RoleData.EATTRTYPE_AGI] < 0 then

      attr[CommonFun.RoleData.EATTRTYPE_AGI] = 0
      result[CommonFun.RoleData.EATTRTYPE_AGI] = 0
  end

  if  attr[CommonFun.RoleData.EATTRTYPE_LUK] < 0 then

      attr[CommonFun.RoleData.EATTRTYPE_LUK] = 0
      result[CommonFun.RoleData.EATTRTYPE_LUK] = 0
  end




  ----------玩家素质物理攻击计算公式（已经弃用）
  if CommonFun.checkRemoteAtk(profession,type) then
    extra[CommonFun.RoleData.EATTRTYPE_ATK] = attr[CommonFun.RoleData.EATTRTYPE_DEX]*2+math.floor(attr[CommonFun.RoleData.EATTRTYPE_DEX]*attr[CommonFun.RoleData.EATTRTYPE_DEX]/100)+math.floor(attr[CommonFun.RoleData.EATTRTYPE_STR]/5)+math.floor(attr[CommonFun.RoleData.EATTRTYPE_LUK]/5) + BaseLvAtkRate1[profession]*lv
  else
    extra[CommonFun.RoleData.EATTRTYPE_ATK] = attr[CommonFun.RoleData.EATTRTYPE_STR]*2+math.floor(attr[CommonFun.RoleData.EATTRTYPE_STR]*attr[CommonFun.RoleData.EATTRTYPE_STR]/100)+math.floor(attr[CommonFun.RoleData.EATTRTYPE_DEX]/5)+math.floor(attr[CommonFun.RoleData.EATTRTYPE_LUK]/5) + BaseLvAtkRate1[profession]*lv
  end
  ----------玩家素质物理防御计算公式（已经弃用）
  extra[CommonFun.RoleData.EATTRTYPE_DEF] = attr[CommonFun.RoleData.EATTRTYPE_VIT]

  ----------玩家素质魔法攻击计算公式（已经弃用）
  extra[CommonFun.RoleData.EATTRTYPE_MATK] = attr[CommonFun.RoleData.EATTRTYPE_INT]*2+math.floor(attr[CommonFun.RoleData.EATTRTYPE_INT]*attr[CommonFun.RoleData.EATTRTYPE_INT]/100)

  ----------玩家素质魔法防御计算公式（已经弃用）
  extra[CommonFun.RoleData.EATTRTYPE_MDEF] = attr[CommonFun.RoleData.EATTRTYPE_INT]

  ----------玩家素质生命上限计算公式（已经弃用）
  extra[CommonFun.RoleData.EATTRTYPE_MAXHP] = (100+lv*BaseLvRate[profession]+CommonFun.CalcSum(lv)*HpRate[profession]+BaseHp[profession])*(1+attr[CommonFun.RoleData.EATTRTYPE_VIT]/100)

  ----------玩家素质魔法上限计算公式（已经弃用）
  extra[CommonFun.RoleData.EATTRTYPE_MAXSP]= (20+(lv*GameConfig.NewRole.recover[profession].sp))*(1+attr[CommonFun.RoleData.EATTRTYPE_INT]/100)

  ----------玩家素质命中计算公式（已经弃用）
  extra[CommonFun.RoleData.EATTRTYPE_HIT]  = lv+attr[CommonFun.RoleData.EATTRTYPE_DEX]

  ----------玩家素质闪避计算公式（已经弃用）
  extra[CommonFun.RoleData.EATTRTYPE_FLEE] = lv+attr[CommonFun.RoleData.EATTRTYPE_AGI]

  ----------玩家素质暴击计算公式（已经弃用）
  extra[CommonFun.RoleData.EATTRTYPE_CRI] = 1+math.floor(attr[CommonFun.RoleData.EATTRTYPE_LUK]/3)

  ----------玩家素质防暴计算公式（已经弃用）
  extra[CommonFun.RoleData.EATTRTYPE_CRIRES] =1+math.floor(attr[CommonFun.RoleData.EATTRTYPE_LUK]/5)

  ----------玩家素质爆伤计算公式（已经弃用）
  extra[CommonFun.RoleData.EATTRTYPE_CRIDAMPER] = 0

  ----------玩家素质爆伤防护计算公式（已经弃用）
  extra[CommonFun.RoleData.EATTRTYPE_CRIDEFPER] = 0

  ----------玩家素质移动速度计算公式（已经弃用）
  extra[CommonFun.RoleData.EATTRTYPE_MOVESPD] = 1

  ----------玩家素质吟唱速度计算公式（已经弃用）
  extra[CommonFun.RoleData.EATTRTYPE_CASTSPD] = attr[CommonFun.RoleData.EATTRTYPE_DEX]/30

  ----------玩家物理攻击百分比计算公式（已经弃用）
  extra[CommonFun.RoleData.EATTRTYPE_ATKPER] = 0

  ----------玩家物理防御百分比计算公式（已经弃用）
  extra[CommonFun.RoleData.EATTRTYPE_DEFPER] = 0

  ----------玩家魔法攻击百分比计算公式（已经弃用）
  extra[CommonFun.RoleData.EATTRTYPE_MATKPER] = 0

  ----------玩家魔法防御百分比计算公式（已经弃用）
  extra[CommonFun.RoleData.EATTRTYPE_MDEFPER] = 0

  ----------玩家素质生命上限百分比计算公式（已经弃用）
  extra[CommonFun.RoleData.EATTRTYPE_MAXHPPER] = 0

  ----------玩家素质魔法上限百分比计算公式（已经弃用）
  extra[CommonFun.RoleData.EATTRTYPE_MAXSPPER] = 0

    ----------玩家素质物理精炼计算公式（已经弃用）
  extra[CommonFun.RoleData.EATTRTYPE_REFINE] = 0

  ----------玩家素质魔法精炼计算公式（已经弃用）
  extra[CommonFun.RoleData.EATTRTYPE_MREFINE] = 0

  ----------玩家素质生命恢复计算公式（已经弃用）
  extra[CommonFun.RoleData.EATTRTYPE_RESTORESPD] = math.floor(attr[CommonFun.RoleData.EATTRTYPE_VIT]/5)

  ----------玩家素质魔法恢复计算公式（已经弃用）
  extra[CommonFun.RoleData.EATTRTYPE_SPRESTORESPD] = 1 + math.floor(attr[CommonFun.RoleData.EATTRTYPE_INT]/6)

  extra[CommonFun.RoleData.EATTRTYPE_EQUIPASPD] = 0

  extra[CommonFun.RoleData.EATTRTYPE_SKILLASPD] = 0


 -------------------------------------------------------------------------玩家最终属性（已经弃用）
  --------装备攻击速度和技能攻击速度的最终计算公式
  result[CommonFun.RoleData.EATTRTYPE_EQUIPASPD]=extra[CommonFun.RoleData.EATTRTYPE_EQUIPASPD]+attr[CommonFun.RoleData.EATTRTYPE_EQUIPASPD]
  --if result[CommonFun.RoleData.EATTRTYPE_EQUIPASPD] >= 0.3 then
     --result[CommonFun.RoleData.EATTRTYPE_EQUIPASPD] = 0.3
  --end
  result[CommonFun.RoleData.EATTRTYPE_SKILLASPD]=extra[CommonFun.RoleData.EATTRTYPE_SKILLASPD]+attr[CommonFun.RoleData.EATTRTYPE_SKILLASPD]
  --if result[CommonFun.RoleData.EATTRTYPE_SKILLASPD] >= 0.5 then
     --result[CommonFun.RoleData.EATTRTYPE_SKILLASPD] = 0.5
  --end

  ----------玩家素质攻击速度计算公式
  ----------最终ASPD=ASPD值+装备ASPD值
  ----------ASPD值=取整((200-(200-(职业基础ASPD+盾牌ASPD-ASPD校验值+开方((敏捷总和*9.999)+(灵巧总和*0.19212))*ASPD惩罚值))*(1-ASPD药水部分-技能ASPD修正)),3)
  ----------装备ASPD值=取整((195-ASPD值)*装备ASPD修正),2)
  ----------ASPD校验值=IF(敏捷总和<205,向上取整((开方(205)-开方(敏捷总和))/7.15,3),0)
  ----------ASPD惩罚值=IF(职业基础ASPD>145,1-(职业基础ASPD-144)/50,0.96)
  ----------每秒攻击次数=50/(200-取整(最终ASPD,0))
  local ASPD_CHCEKVALUE=0
    if attr[CommonFun.RoleData.EATTRTYPE_AGI]<205 then
       ASPD_CHCEKVALUE=math.floor((math.sqrt(205)-math.sqrt(attr[CommonFun.RoleData.EATTRTYPE_AGI]))*1000/7.15)/1000
    else
       ASPD_CHCEKVALUE=0
    end
  local BaseJobASPD=BaseJobAtkSpd[profession]+CommonFun.WeaponAtkSpd(type,profession)
  local ASPD_PANISHVALUE=0
    if BaseJobASPD>145 then
       ASPD_PANISHVALUE=1-(BaseJobASPD-144)/50
    else
       ASPD_PANISHVALUE=0.96
    end
  extra[CommonFun.RoleData.EATTRTYPE_ATKSPD]=math.floor((200-(200-(BaseJobASPD-ASPD_CHCEKVALUE+math.sqrt(attr[CommonFun.RoleData.EATTRTYPE_AGI]*9.999)*ASPD_PANISHVALUE))*(1-result[CommonFun.RoleData.EATTRTYPE_SKILLASPD]))*1000)/1000

  local EquipASPD=math.floor((195-extra[CommonFun.RoleData.EATTRTYPE_ATKSPD])*result[CommonFun.RoleData.EATTRTYPE_EQUIPASPD]*100)/100

  ----------玩家最终攻击速度计算公式（已经弃用）
  local BaseASPD=extra[CommonFun.RoleData.EATTRTYPE_ATKSPD]+EquipASPD

  if BaseASPD >= 2275/12 then
     BaseASPD  = 2275/12
  end

  if BaseASPD <= 50 then
     BaseASPD  = 50
  end
  ----------
  result[CommonFun.RoleData.EATTRTYPE_ATKSPD] =50/(200-BaseASPD)

  if result[CommonFun.RoleData.EATTRTYPE_ATKSPD]<=0 then
     result[CommonFun.RoleData.EATTRTYPE_ATKSPD]=0
  end

  ----------玩家最终物理攻击计算公式（已经弃用）
  result[CommonFun.RoleData.EATTRTYPE_ATK] = extra[CommonFun.RoleData.EATTRTYPE_ATK]+attr[CommonFun.RoleData.EATTRTYPE_ATK]
  if result[CommonFun.RoleData.EATTRTYPE_ATK]<=0 then
     result[CommonFun.RoleData.EATTRTYPE_ATK]=0
  end
  ----------玩家最终魔法攻击计算公式（已经弃用）
  result[CommonFun.RoleData.EATTRTYPE_MATK] = extra[CommonFun.RoleData.EATTRTYPE_MATK]+attr[CommonFun.RoleData.EATTRTYPE_MATK]
  if result[CommonFun.RoleData.EATTRTYPE_MATK]<=0 then
     result[CommonFun.RoleData.EATTRTYPE_MATK]=0
  end
  ----------玩家最终物理防御计算公式（已经弃用）
  result[CommonFun.RoleData.EATTRTYPE_DEF] = extra[CommonFun.RoleData.EATTRTYPE_DEF]+attr[CommonFun.RoleData.EATTRTYPE_DEF]
  if result[CommonFun.RoleData.EATTRTYPE_DEF]<=0 then
     result[CommonFun.RoleData.EATTRTYPE_DEF]=0
  end

  ----------玩家最终魔法防御计算公式（已经弃用）
  result[CommonFun.RoleData.EATTRTYPE_MDEF] = extra[CommonFun.RoleData.EATTRTYPE_MDEF]+attr[CommonFun.RoleData.EATTRTYPE_MDEF]
  if result[CommonFun.RoleData.EATTRTYPE_MDEF]<=0 then
     result[CommonFun.RoleData.EATTRTYPE_MDEF]=0
  end
  ----------玩家最终命中计算公式（已经弃用）
  result[CommonFun.RoleData.EATTRTYPE_HIT] = (extra[CommonFun.RoleData.EATTRTYPE_HIT]+attr[CommonFun.RoleData.EATTRTYPE_HIT])*(1+attr[CommonFun.RoleData.EATTRTYPE_HITPER])
  if result[CommonFun.RoleData.EATTRTYPE_HIT]<=0 then
     result[CommonFun.RoleData.EATTRTYPE_HIT]=0
  end
  ----------玩家最终闪避计算公式（已经弃用）
  result[CommonFun.RoleData.EATTRTYPE_FLEE] = (extra[CommonFun.RoleData.EATTRTYPE_FLEE]+attr[CommonFun.RoleData.EATTRTYPE_FLEE])*(1+attr[CommonFun.RoleData.EATTRTYPE_FLEEPER])
  if result[CommonFun.RoleData.EATTRTYPE_FLEE]<=0 then
     result[CommonFun.RoleData.EATTRTYPE_FLEE]=0
  end
    ----------玩家最终暴击百分比计算公式（已经弃用）
  result[CommonFun.RoleData.EATTRTYPE_CRIPER] = attr[CommonFun.RoleData.EATTRTYPE_CRIPER]
  if result[CommonFun.RoleData.EATTRTYPE_CRIPER]<=0 then
     result[CommonFun.RoleData.EATTRTYPE_CRIPER]=0
  end
  ----------玩家最终暴击计算公式（已经弃用）
  result[CommonFun.RoleData.EATTRTYPE_CRI] = (extra[CommonFun.RoleData.EATTRTYPE_CRI]+attr[CommonFun.RoleData.EATTRTYPE_CRI])*(1+attr[CommonFun.RoleData.EATTRTYPE_CRIPER])
  if result[CommonFun.RoleData.EATTRTYPE_CRI]<=0 then
     result[CommonFun.RoleData.EATTRTYPE_CRI]=0
  end
  ----------玩家最终防暴计算公式（已经弃用）
  result[CommonFun.RoleData.EATTRTYPE_CRIRES] =extra[CommonFun.RoleData.EATTRTYPE_CRIRES]+attr[CommonFun.RoleData.EATTRTYPE_CRIRES]
  if result[CommonFun.RoleData.EATTRTYPE_CRIRES]<=0 then
     result[CommonFun.RoleData.EATTRTYPE_CRIRES]=0
  end

  ----------玩家最终爆伤计算公式（已经弃用）
  result[CommonFun.RoleData.EATTRTYPE_CRIDAMPER] =extra[CommonFun.RoleData.EATTRTYPE_CRIDAMPER]+attr[CommonFun.RoleData.EATTRTYPE_CRIDAMPER]
  if result[CommonFun.RoleData.EATTRTYPE_CRIDAMPER]<=0 then
     result[CommonFun.RoleData.EATTRTYPE_CRIDAMPER]=0
  end

  ----------玩家最终爆伤防护计算公式（已经弃用）
  result[CommonFun.RoleData.EATTRTYPE_CRIDEFPER] = extra[CommonFun.RoleData.EATTRTYPE_CRIDEFPER]+attr[CommonFun.RoleData.EATTRTYPE_CRIDEFPER]

  if result[CommonFun.RoleData.EATTRTYPE_CRIDEFPER]<=0 then
     result[CommonFun.RoleData.EATTRTYPE_CRIDEFPER]=0
  end

  ----------玩家最终移动速度计算公式（已经弃用）
  result[CommonFun.RoleData.EATTRTYPE_MOVESPD] =(extra[CommonFun.RoleData.EATTRTYPE_MOVESPD]+attr[CommonFun.RoleData.EATTRTYPE_MOVESPD])*(1+attr[CommonFun.RoleData.EATTRTYPE_MOVESPDPER])

  if result[CommonFun.RoleData.EATTRTYPE_MOVESPD]<=0 then
     result[CommonFun.RoleData.EATTRTYPE_MOVESPD]=0
  end

  ----------玩家最终吟唱速度计算公式（已经弃用）
  result[CommonFun.RoleData.EATTRTYPE_CASTSPD] = extra[CommonFun.RoleData.EATTRTYPE_CASTSPD]+attr[CommonFun.RoleData.EATTRTYPE_CASTSPD]

  if result[CommonFun.RoleData.EATTRTYPE_CASTSPD]<=0 then
     result[CommonFun.RoleData.EATTRTYPE_CASTSPD]=0
  end

  ----------玩家最终物理攻击百分比计算公式（已经弃用）
  result[CommonFun.RoleData.EATTRTYPE_ATKPER] = extra[CommonFun.RoleData.EATTRTYPE_ATKPER]+attr[CommonFun.RoleData.EATTRTYPE_ATKPER]

  if result[CommonFun.RoleData.EATTRTYPE_ATKPER]<=-1 then
     result[CommonFun.RoleData.EATTRTYPE_ATKPER]=-1
  end

  ----------玩家最终物理防御百分比计算公式（已经弃用）
  result[CommonFun.RoleData.EATTRTYPE_DEFPER] = extra[CommonFun.RoleData.EATTRTYPE_DEFPER]+attr[CommonFun.RoleData.EATTRTYPE_DEFPER]

  if result[CommonFun.RoleData.EATTRTYPE_DEFPER] <= -1 then
     result[CommonFun.RoleData.EATTRTYPE_DEFPER]  = -1
  end

  ----------玩家最终魔法攻击百分比计算公式（已经弃用）
  result[CommonFun.RoleData.EATTRTYPE_MATKPER] = extra[CommonFun.RoleData.EATTRTYPE_MATKPER]+attr[CommonFun.RoleData.EATTRTYPE_MATKPER]

  if result[CommonFun.RoleData.EATTRTYPE_MATKPER] <= -1 then
     result[CommonFun.RoleData.EATTRTYPE_MATKPER]  = -1
  end

  ----------玩家最终魔法防御百分比计算公式（已经弃用）
  result[CommonFun.RoleData.EATTRTYPE_MDEFPER] = extra[CommonFun.RoleData.EATTRTYPE_MDEFPER]+attr[CommonFun.RoleData.EATTRTYPE_MDEFPER]

  if result[CommonFun.RoleData.EATTRTYPE_MDEFPER] <= -1 then
     result[CommonFun.RoleData.EATTRTYPE_MDEFPER]  = -1
  end

  ----------玩家最终生命上限百分比计算公式（已经弃用）
  result[CommonFun.RoleData.EATTRTYPE_MAXHPPER] = extra[CommonFun.RoleData.EATTRTYPE_MAXHPPER]+attr[CommonFun.RoleData.EATTRTYPE_MAXHPPER]

  if result[CommonFun.RoleData.EATTRTYPE_MAXHPPER] <= -1 then
     result[CommonFun.RoleData.EATTRTYPE_MAXHPPER]  = -1
  end

  ----------玩家最终生命上限计算公式（已经弃用）
  result[CommonFun.RoleData.EATTRTYPE_MAXHP] = (extra[CommonFun.RoleData.EATTRTYPE_MAXHP]+attr[CommonFun.RoleData.EATTRTYPE_MAXHP])*(1+result[CommonFun.RoleData.EATTRTYPE_MAXHPPER])
  if map==1 or map==2 then ----map=1 表示pvp,map=2 表示gvg
      result[CommonFun.RoleData.EATTRTYPE_MAXHP] = 4*(extra[CommonFun.RoleData.EATTRTYPE_MAXHP]+attr[CommonFun.RoleData.EATTRTYPE_MAXHP])*(1+result[CommonFun.RoleData.EATTRTYPE_MAXHPPER])
  end
  ----------MaxSpPer(玩家魔法上限百分比计算公式)（已经弃用）
  result[CommonFun.RoleData.EATTRTYPE_MAXSPPER] = extra[CommonFun.RoleData.EATTRTYPE_MAXSPPER]+attr[CommonFun.RoleData.EATTRTYPE_MAXSPPER]

  if result[CommonFun.RoleData.EATTRTYPE_MAXSPPER] <= -1 then
     result[CommonFun.RoleData.EATTRTYPE_MAXSPPER]  = -1
  end

  ----------玩家最终魔法上限计算公式（已经弃用）
  result[CommonFun.RoleData.EATTRTYPE_MAXSP]=(extra[CommonFun.RoleData.EATTRTYPE_MAXSP]+attr[CommonFun.RoleData.EATTRTYPE_MAXSP])*(1+result[CommonFun.RoleData.EATTRTYPE_MAXSPPER])


  ----------玩家最终物理精炼计算公式（已经弃用）
  result[CommonFun.RoleData.EATTRTYPE_REFINE] = extra[CommonFun.RoleData.EATTRTYPE_REFINE]+attr[CommonFun.RoleData.EATTRTYPE_REFINE]

  ----------玩家最终魔法精炼计算公式（已经弃用）
  result[CommonFun.RoleData.EATTRTYPE_MREFINE] = extra[CommonFun.RoleData.EATTRTYPE_MREFINE]+attr[CommonFun.RoleData.EATTRTYPE_MREFINE]

  result[CommonFun.RoleData.EATTRTYPE_DAMREDUC]  = attr[CommonFun.RoleData.EATTRTYPE_DAMREDUC]
  if result[CommonFun.RoleData.EATTRTYPE_DAMREDUC] >= 1 then
     result[CommonFun.RoleData.EATTRTYPE_DAMREDUC]  = 1
  end
  result[CommonFun.RoleData.EATTRTYPE_MDAMREDUC] = attr[CommonFun.RoleData.EATTRTYPE_MDAMREDUC]
  if result[CommonFun.RoleData.EATTRTYPE_MDAMREDUC] >= 1 then
     result[CommonFun.RoleData.EATTRTYPE_MDAMREDUC]  = 1
  end
  ----------Hp(玩家当前生命值计算公
  --result[CommonFun.RoleData.EATTRTYPE_HP] = attr[CommonFun.RoleData.EATTRTYPE_HP]

  ----------Sp(玩家当前魔法值计算公式)
  --result[CommonFun.RoleData.EATTRTYPE_SP] = attr[CommonFun.RoleData.EATTRTYPE_SP]

  ----------RestoreSpd(玩家生命恢复计算公式)
  result[CommonFun.RoleData.EATTRTYPE_RESTORESPD] = (extra[CommonFun.RoleData.EATTRTYPE_RESTORESPD]+attr[CommonFun.RoleData.EATTRTYPE_RESTORESPD]+math.floor(result[CommonFun.RoleData.EATTRTYPE_MAXHP]/200))*(1+attr[CommonFun.RoleData.EATTRTYPE_RESTORESPDPER])

  ----------SpRestoreSpd(玩家魔法恢复计算公式)
  result[CommonFun.RoleData.EATTRTYPE_SPRESTORESPD] = (extra[CommonFun.RoleData.EATTRTYPE_SPRESTORESPD]+attr[CommonFun.RoleData.EATTRTYPE_SPRESTORESPD]+math.floor(result[CommonFun.RoleData.EATTRTYPE_MAXSP]/100))*(1+attr[CommonFun.RoleData.EATTRTYPE_SPRESTORESPDPER])


  ----------玩家面板属性计算公式

  result[CommonFun.RoleData.EATTRTYPE_SHOWATK]=result[CommonFun.RoleData.EATTRTYPE_ATK]*(1+result[CommonFun.RoleData.EATTRTYPE_ATKPER])
  result[CommonFun.RoleData.EATTRTYPE_SHOWMATK]=result[CommonFun.RoleData.EATTRTYPE_MATK]*(1+result[CommonFun.RoleData.EATTRTYPE_MATKPER])
  result[CommonFun.RoleData.EATTRTYPE_SHOWMAXHP]=result[CommonFun.RoleData.EATTRTYPE_MAXHP]
  result[CommonFun.RoleData.EATTRTYPE_SHOWMAXSP]=result[CommonFun.RoleData.EATTRTYPE_MAXSP]
  result[CommonFun.RoleData.EATTRTYPE_SHOWDEF]=extra[CommonFun.RoleData.EATTRTYPE_DEF]+(attr[CommonFun.RoleData.EATTRTYPE_DEF])*(1+result[CommonFun.RoleData.EATTRTYPE_DEFPER])
  result[CommonFun.RoleData.EATTRTYPE_SHOWMDEF]=extra[CommonFun.RoleData.EATTRTYPE_MDEF]+(attr[CommonFun.RoleData.EATTRTYPE_MDEF])*(1+result[CommonFun.RoleData.EATTRTYPE_MDEFPER])
  result[CommonFun.RoleData.EATTRTYPE_SHOWHIT]=result[CommonFun.RoleData.EATTRTYPE_HIT]
  result[CommonFun.RoleData.EATTRTYPE_SHOWFLEE]=result[CommonFun.RoleData.EATTRTYPE_FLEE]
  result[CommonFun.RoleData.EATTRTYPE_SHOWCRI]=result[CommonFun.RoleData.EATTRTYPE_CRI]
  result[CommonFun.RoleData.EATTRTYPE_SHOWCRIRES]=result[CommonFun.RoleData.EATTRTYPE_CRIRES]
  result[CommonFun.RoleData.EATTRTYPE_SHOWATKSPD]=result[CommonFun.RoleData.EATTRTYPE_ATKSPD]
  result[CommonFun.RoleData.EATTRTYPE_SHOWMOVESPD]=result[CommonFun.RoleData.EATTRTYPE_MOVESPD]
  result[CommonFun.RoleData.EATTRTYPE_SHOWCASTSPD]=result[CommonFun.RoleData.EATTRTYPE_CASTSPD]
  result[CommonFun.RoleData.EATTRTYPE_SHOWRESTORESPD]=result[CommonFun.RoleData.EATTRTYPE_RESTORESPD]

  for k,v in pairs(result) do
    if v ~= 0 then
      result[k] = math.floor(v * 1000 + 0.5) / 1000
    else
      result[k] = v
    end
  end
  for k,v in pairs(extra) do
    if v ~= 0 then
      extra[k] = math.floor(v*1000 + 0.5)/1000
    else
      extra[k] = 0
    end
  end
  return result, extra
end

function CommonFun.calcUserShowAttrValue(attr, profession, oldlv, newlv,WeaponType)---（已经弃用）
  local result = {}

 ------------生命值的等级提升效果展示
  local oldvalue = 50+oldlv*BaseLvRate[profession]+CommonFun.CalcSum(oldlv)*HpRate[profession]+BaseHp[profession]
  local newvalue = 50+newlv*BaseLvRate[profession]+CommonFun.CalcSum(newlv)*HpRate[profession]+BaseHp[profession]
  if newvalue > oldvalue + 1 then
    result[CommonFun.RoleData.EATTRTYPE_MAXHP] = newvalue - oldvalue
  end

 ------------物理攻击的等级提升效果展示
  if CommonFun.checkRemoteAtk(profession,WeaponType) then
      oldvalue = attr[CommonFun.RoleData.EATTRTYPE_DEX] * 3 + attr[CommonFun.RoleData.EATTRTYPE_DEX] * attr[CommonFun.RoleData.EATTRTYPE_DEX] / 100 + attr[CommonFun.RoleData.EATTRTYPE_STR] / 5 + attr[CommonFun.RoleData.EATTRTYPE_LUK] / 5 + oldlv*BaseLvAtkRate1[profession]
  else
      oldvalue = attr[CommonFun.RoleData.EATTRTYPE_STR] * 5 + attr[CommonFun.RoleData.EATTRTYPE_STR] * attr[CommonFun.RoleData.EATTRTYPE_STR] / 100 + attr[CommonFun.RoleData.EATTRTYPE_DEX] / 5 + attr[CommonFun.RoleData.EATTRTYPE_LUK] / 5 + oldlv*BaseLvAtkRate1[profession]
  end

  if CommonFun.checkRemoteAtk(profession,WeaponType) then
      newvalue = attr[CommonFun.RoleData.EATTRTYPE_DEX] * 3 + attr[CommonFun.RoleData.EATTRTYPE_DEX] * attr[CommonFun.RoleData.EATTRTYPE_DEX] / 100 + attr[CommonFun.RoleData.EATTRTYPE_STR] / 5 + attr[CommonFun.RoleData.EATTRTYPE_LUK] / 5 + newlv*BaseLvAtkRate1[profession]
  else
      newvalue = attr[CommonFun.RoleData.EATTRTYPE_STR] * 3 + attr[CommonFun.RoleData.EATTRTYPE_STR] * attr[CommonFun.RoleData.EATTRTYPE_STR] / 100 + attr[CommonFun.RoleData.EATTRTYPE_DEX] / 5 + attr[CommonFun.RoleData.EATTRTYPE_LUK] / 5 + newlv*BaseLvAtkRate1[profession]
  end
  if newvalue > oldvalue + 1 then
   result[CommonFun.RoleData.EATTRTYPE_ATK] = newvalue - oldvalue
  end


 ------------魔法攻击的等级提升效果展示
  oldvalue = attr[CommonFun.RoleData.EATTRTYPE_INT] * 3 + attr[CommonFun.RoleData.EATTRTYPE_INT] * attr[CommonFun.RoleData.EATTRTYPE_INT] / 100 + oldlv*BaseLvAtkRate2[profession]
  newvalue = attr[CommonFun.RoleData.EATTRTYPE_INT] * 3 + attr[CommonFun.RoleData.EATTRTYPE_INT] * attr[CommonFun.RoleData.EATTRTYPE_INT] / 100 + newlv*BaseLvAtkRate2[profession]
  if newvalue > oldvalue + 1 then
   result[CommonFun.RoleData.EATTRTYPE_MATK] = newvalue - oldvalue
  end

 ------------物理防御的等级提升效果展示

  oldvalue= attr[CommonFun.RoleData.EATTRTYPE_VIT] * 2 + attr[CommonFun.RoleData.EATTRTYPE_VIT] * attr[CommonFun.RoleData.EATTRTYPE_VIT] / 100+oldlv*BaseLvDefRate[profession]
  newvalue= attr[CommonFun.RoleData.EATTRTYPE_VIT] * 2 + attr[CommonFun.RoleData.EATTRTYPE_VIT] * attr[CommonFun.RoleData.EATTRTYPE_VIT] / 100+newlv*BaseLvDefRate[profession]
  if newvalue > oldvalue + 1 then
   result[CommonFun.RoleData.EATTRTYPE_DEF] = newvalue - oldvalue
  end

 ------------魔法防御的等级提升效果展示

  oldvalue = attr[CommonFun.RoleData.EATTRTYPE_INT] * 2 + attr[CommonFun.RoleData.EATTRTYPE_INT] * attr[CommonFun.RoleData.EATTRTYPE_INT] / 100+oldlv*BaseLvMDefRate[profession]
  newvalue = attr[CommonFun.RoleData.EATTRTYPE_INT] * 2 + attr[CommonFun.RoleData.EATTRTYPE_INT] * attr[CommonFun.RoleData.EATTRTYPE_INT] / 100+newlv*BaseLvMDefRate[profession]
  if newvalue > oldvalue + 1 then
   result[CommonFun.RoleData.EATTRTYPE_MDEF] = newvalue - oldvalue
  end


 ------------魔法恢复的等级提升效果展示
  oldvalue = 20+(oldlv*GameConfig.NewRole.recover[profession].sp)+attr[CommonFun.RoleData.EATTRTYPE_INT]*2
  newvalue = 20+(newlv*GameConfig.NewRole.recover[profession].sp)+attr[CommonFun.RoleData.EATTRTYPE_INT]*2
  if newvalue > oldvalue + 1 then
    result[CommonFun.RoleData.EATTRTYPE_MAXSP] = newvalue - oldvalue
  end


 ------------命中的等级提升效果展示
  oldvalue = oldlv + attr[CommonFun.RoleData.EATTRTYPE_DEX]
  newvalue = newlv + attr[CommonFun.RoleData.EATTRTYPE_DEX]
  if newvalue > oldvalue + 1 then
    result[CommonFun.RoleData.EATTRTYPE_HIT] = newvalue - oldvalue
  end

 ------------闪避的等级提升效果展示
  oldvalue = oldlv + attr[CommonFun.RoleData.EATTRTYPE_AGI]
  newvalue = newlv + attr[CommonFun.RoleData.EATTRTYPE_AGI]
  if newvalue > oldvalue + 1 then
    result[CommonFun.RoleData.EATTRTYPE_FLEE] = newvalue - oldvalue
  end

  return result
end

function CommonFun.calcUserShowAttrValuePro(attr, lv, oldpro, newpro,WeaponType)
  local result = {}

  local oldvalue = 50+lv*BaseLvRate[oldpro]+CommonFun.CalcSum(lv)*HpRate[oldpro]*(1+attr[CommonFun.RoleData.EATTRTYPE_VIT]/100)+attr[CommonFun.RoleData.EATTRTYPE_VIT]*20
  local newvalue = 50+lv*BaseLvRate[newpro]+CommonFun.CalcSum(lv)*HpRate[newpro]*(1+attr[CommonFun.RoleData.EATTRTYPE_VIT]/100)+attr[CommonFun.RoleData.EATTRTYPE_VIT]*20
  if newvalue > oldvalue + 1 then
    result[CommonFun.RoleData.EATTRTYPE_MAXHP] = newvalue - oldvalue
  end

  if CommonFun.checkRemoteAtk(oldpro,WeaponType) then
      oldvalue = attr[CommonFun.RoleData.EATTRTYPE_DEX] * 3 + attr[CommonFun.RoleData.EATTRTYPE_DEX] * attr[CommonFun.RoleData.EATTRTYPE_DEX] / 100 + attr[CommonFun.RoleData.EATTRTYPE_STR] / 5 + attr[CommonFun.RoleData.EATTRTYPE_LUK] / 5 + lv*2
  else
      oldvalue = attr[CommonFun.RoleData.EATTRTYPE_STR] * 3 + attr[CommonFun.RoleData.EATTRTYPE_STR] * attr[CommonFun.RoleData.EATTRTYPE_STR] / 100 + attr[CommonFun.RoleData.EATTRTYPE_DEX] / 5 + attr[CommonFun.RoleData.EATTRTYPE_LUK] / 5 + lv*2
  end

  if CommonFun.checkRemoteAtk(newpro,WeaponType) then
      newvalue = attr[CommonFun.RoleData.EATTRTYPE_DEX] * 3 + attr[CommonFun.RoleData.EATTRTYPE_DEX] * attr[CommonFun.RoleData.EATTRTYPE_DEX] / 100 + attr[CommonFun.RoleData.EATTRTYPE_STR] / 5 + attr[CommonFun.RoleData.EATTRTYPE_LUK] / 5 + lv*2
  else
      newvalue = attr[CommonFun.RoleData.EATTRTYPE_STR] * 3 + attr[CommonFun.RoleData.EATTRTYPE_STR] * attr[CommonFun.RoleData.EATTRTYPE_STR] / 100 + attr[CommonFun.RoleData.EATTRTYPE_DEX] / 5 + attr[CommonFun.RoleData.EATTRTYPE_LUK] / 5 + lv*2
  end
  if newvalue > oldvalue + 1 then
   result[CommonFun.RoleData.EATTRTYPE_ATK] = newvalue - oldvalue
  end

  oldvalue = 20+(lv*GameConfig.NewRole.recover[oldpro].sp)*(1+attr[CommonFun.RoleData.EATTRTYPE_INT]/100)+attr[CommonFun.RoleData.EATTRTYPE_INT]*2
  newvalue = 20+(lv*GameConfig.NewRole.recover[newpro].sp)*(1+attr[CommonFun.RoleData.EATTRTYPE_INT]/100)+attr[CommonFun.RoleData.EATTRTYPE_INT]*2
  if newvalue > oldvalue + 1 then
    result[CommonFun.RoleData.EATTRTYPE_MAXSP] = newvalue - oldvalue
  end

  return result
end
---------------------------------------------------------------------------------此处计算值若和副本强度计算有重复,以副本值为最终值.否则以此处值为最终值
function CommonFun.calcNpcAttrValue(extra,attr,profession)
  local NpcResult={}
  NpcResult[CommonFun.RoleData.EATTRTYPE_VIT]         = (extra[CommonFun.RoleData.EATTRTYPE_VIT]+attr[CommonFun.RoleData.EATTRTYPE_VIT])*(1+attr[CommonFun.RoleData.EATTRTYPE_VITPER])
  NpcResult[CommonFun.RoleData.EATTRTYPE_INT]         = (extra[CommonFun.RoleData.EATTRTYPE_INT]+attr[CommonFun.RoleData.EATTRTYPE_INT])*(1+attr[CommonFun.RoleData.EATTRTYPE_INTPER])
  NpcResult[CommonFun.RoleData.EATTRTYPE_DEX]         = extra[CommonFun.RoleData.EATTRTYPE_DEX]+attr[CommonFun.RoleData.EATTRTYPE_DEX]
  NpcResult[CommonFun.RoleData.EATTRTYPE_AGI]         = extra[CommonFun.RoleData.EATTRTYPE_AGI]+attr[CommonFun.RoleData.EATTRTYPE_AGI]
  NpcResult[CommonFun.RoleData.EATTRTYPE_STR]         = extra[CommonFun.RoleData.EATTRTYPE_STR]+attr[CommonFun.RoleData.EATTRTYPE_STR]
  NpcResult[CommonFun.RoleData.EATTRTYPE_LUK]         = extra[CommonFun.RoleData.EATTRTYPE_LUK]+attr[CommonFun.RoleData.EATTRTYPE_LUK]
  NpcResult[CommonFun.RoleData.EATTRTYPE_CRI]         = 1+math.floor(NpcResult[CommonFun.RoleData.EATTRTYPE_LUK]/3) --+ extra[CommonFun.RoleData.EATTRTYPE_CRI]+attr[CommonFun.RoleData.EATTRTYPE_CRI]
  NpcResult[CommonFun.RoleData.EATTRTYPE_CRIRES]      = 1+math.floor(NpcResult[CommonFun.RoleData.EATTRTYPE_LUK]/5) --+ extra[CommonFun.RoleData.EATTRTYPE_CRIRES]+attr[CommonFun.RoleData.EATTRTYPE_CRIRES]

  for key, value in pairs(NpcResult) do
    if value < 0 then
       NpcResult[key] = 0
    end
  end

  NpcResult[CommonFun.RoleData.EATTRTYPE_DEFPER]      = attr[CommonFun.RoleData.EATTRTYPE_DEFPER]
  if  NpcResult[CommonFun.RoleData.EATTRTYPE_DEFPER]  <=-1 then
      NpcResult[CommonFun.RoleData.EATTRTYPE_DEFPER]  =-1
  end

  NpcResult[CommonFun.RoleData.EATTRTYPE_MDEFPER]     = attr[CommonFun.RoleData.EATTRTYPE_MDEFPER]
  if  NpcResult[CommonFun.RoleData.EATTRTYPE_MDEFPER]  <=-1 then
      NpcResult[CommonFun.RoleData.EATTRTYPE_MDEFPER]   =-1
  end


  return NpcResult

end


-- 无限塔普通怪计算公式
function CommonFun.calcTowerMonsterNpcAttrValue(attr, Type, classtype, Layer)
  local result = {}

  result[CommonFun.RoleData.EATTRTYPE_ATK]    = (0.0304*Layer*Layer*Layer-1.6383*Layer*Layer+50.113*Layer+59.574)*0.4
  result[CommonFun.RoleData.EATTRTYPE_MATK]   = (0.0304*Layer*Layer*Layer-1.6383*Layer*Layer+50.113*Layer+59.574)*0.4
  result[CommonFun.RoleData.EATTRTYPE_DEF]    = 0.0008*Layer*Layer*Layer-0.0494*Layer*Layer+4.5061*Layer+1
  result[CommonFun.RoleData.EATTRTYPE_MDEF]   = 2*Layer
  result[CommonFun.RoleData.EATTRTYPE_MAXHP]  = (0.2746*Layer*Layer*Layer-5.8627*Layer*Layer+404.87*Layer+84.291)*3
  result[CommonFun.RoleData.EATTRTYPE_HIT]    = 2*Layer+50
  result[CommonFun.RoleData.EATTRTYPE_FLEE]   = Layer
  result[CommonFun.RoleData.EATTRTYPE_CRI]    = Layer*0.3
  result[CommonFun.RoleData.EATTRTYPE_CRIRES] = Layer*0.3

  return result
end

--------------------------无限塔SmallBoss怪计算公式(这种怪物类型是怪物表中不曾定义的,程序直接传过来计算的一种小首领怪)
function CommonFun.calcTowerSmallMiniNpcAttrValue(attr, Type, classtype, Layer)
  local result = {}

  result[CommonFun.RoleData.EATTRTYPE_ATK]    = (0.0304*Layer*Layer*Layer-1.6383*Layer*Layer+50.113*Layer+59.574)*0.6
  result[CommonFun.RoleData.EATTRTYPE_MATK]   = (0.0304*Layer*Layer*Layer-1.6383*Layer*Layer+50.113*Layer+59.574)*0.6
  result[CommonFun.RoleData.EATTRTYPE_DEF]    = 0.0008*Layer*Layer*Layer-0.0494*Layer*Layer+4.5061*Layer+1
  result[CommonFun.RoleData.EATTRTYPE_MDEF]   = 2*Layer
  result[CommonFun.RoleData.EATTRTYPE_MAXHP]  = (0.2746*Layer*Layer*Layer-5.8627*Layer*Layer+404.87*Layer+84.291)*1.25*3
  result[CommonFun.RoleData.EATTRTYPE_HIT]    = 2*Layer+50
  result[CommonFun.RoleData.EATTRTYPE_FLEE]   = Layer
  result[CommonFun.RoleData.EATTRTYPE_CRI]    = Layer*0.3
  result[CommonFun.RoleData.EATTRTYPE_CRIRES] = Layer*0.3

  return result
end


--------------------------无限塔Mini怪计算公式
function CommonFun.calcTowerMiniNpcAttrValue(attr, Type, classtype, Layer)
  local result = {}

  result[CommonFun.RoleData.EATTRTYPE_ATK]    = (0.0304*Layer*Layer*Layer-1.6383*Layer*Layer+50.113*Layer+59.574)*0.8
  result[CommonFun.RoleData.EATTRTYPE_MATK]   = (0.0304*Layer*Layer*Layer-1.6383*Layer*Layer+50.113*Layer+59.574)*0.8
  result[CommonFun.RoleData.EATTRTYPE_DEF]    = 0.0008*Layer*Layer*Layer-0.0494*Layer*Layer+4.5061*Layer+1
  result[CommonFun.RoleData.EATTRTYPE_MDEF]   = 2*Layer
  result[CommonFun.RoleData.EATTRTYPE_MAXHP]  = (0.2746*Layer*Layer*Layer-5.8627*Layer*Layer+404.87*Layer+84.291)*2*3
  result[CommonFun.RoleData.EATTRTYPE_HIT]    = 2*Layer+50
  result[CommonFun.RoleData.EATTRTYPE_FLEE]   = Layer
  result[CommonFun.RoleData.EATTRTYPE_CRI]    = Layer*0.3
  result[CommonFun.RoleData.EATTRTYPE_CRIRES] = Layer*0.3

  return result
end

-------------------------无限塔Mvp怪计算公式
function CommonFun.calcTowerMvpNpcAttrValue(attr, Type, classtype, Layer)
  local result = {}

  if Layer >= 80 then
      result[CommonFun.RoleData.EATTRTYPE_ATK]    = (0.0304*Layer*Layer*Layer-1.6383*Layer*Layer+50.113*Layer+59.574)*0.6
      result[CommonFun.RoleData.EATTRTYPE_MATK]   = (0.0304*Layer*Layer*Layer-1.6383*Layer*Layer+50.113*Layer+59.574)*0.6
      result[CommonFun.RoleData.EATTRTYPE_DEF]    = 0.0008*Layer*Layer*Layer-0.0494*Layer*Layer+4.5061*Layer+1
      result[CommonFun.RoleData.EATTRTYPE_MDEF]   = 2*Layer
      result[CommonFun.RoleData.EATTRTYPE_MAXHP]  = ((0.2746*Layer*Layer*Layer-5.8627*Layer*Layer+404.87*Layer+84.291)*6*5)*0.6
      result[CommonFun.RoleData.EATTRTYPE_HIT]    = 2*Layer+50
      result[CommonFun.RoleData.EATTRTYPE_FLEE]   = Layer
      result[CommonFun.RoleData.EATTRTYPE_CRI]    = Layer*0.3
      result[CommonFun.RoleData.EATTRTYPE_CRIRES] = Layer*0.3
  else
      result[CommonFun.RoleData.EATTRTYPE_ATK]    = (0.0304*Layer*Layer*Layer-1.6383*Layer*Layer+50.113*Layer+59.574)
      result[CommonFun.RoleData.EATTRTYPE_MATK]   = (0.0304*Layer*Layer*Layer-1.6383*Layer*Layer+50.113*Layer+59.574)
      result[CommonFun.RoleData.EATTRTYPE_DEF]    = 0.0008*Layer*Layer*Layer-0.0494*Layer*Layer+4.5061*Layer+1
      result[CommonFun.RoleData.EATTRTYPE_MDEF]   = 2*Layer
      result[CommonFun.RoleData.EATTRTYPE_MAXHP]  = ((0.2746*Layer*Layer*Layer-5.8627*Layer*Layer+404.87*Layer+84.291)*6*5)
      result[CommonFun.RoleData.EATTRTYPE_HIT]    = 2*Layer+50
      result[CommonFun.RoleData.EATTRTYPE_FLEE]   = Layer
      result[CommonFun.RoleData.EATTRTYPE_CRI]    = Layer*0.3
      result[CommonFun.RoleData.EATTRTYPE_CRIRES] = Layer*0.3
  end


  return result
end
------------------------------- 亡者boss属性计算
function calcDeadNpcAttrValue(attr, type, pro, lv)
  local result = {}
      result[CommonFun.RoleData.EATTRTYPE_HIT]    = attr[CommonFun.RoleData.EATTRTYPE_HIT] *(1+0.05*lv)
      result[CommonFun.RoleData.EATTRTYPE_FLEE]   = attr[CommonFun.RoleData.EATTRTYPE_Flee] *(1+0.05*lv)
      result[CommonFun.RoleData.EATTRTYPE_ATK]    = attr[CommonFun.RoleData.EATTRTYPE_ATK] *(1+0.05*lv+math.floor(lv/4)*0.3)
      result[CommonFun.RoleData.EATTRTYPE_MATK]   = attr[CommonFun.RoleData.EATTRTYPE_MATK] *(1+0.05*lv+math.floor(lv/4)*0.3)
      result[CommonFun.RoleData.EATTRTYPE_DEF]    = attr[CommonFun.RoleData.EATTRTYPE_DEF] *(1+0.05*lv+math.floor(lv/4)*0.2)
      result[CommonFun.RoleData.EATTRTYPE_MDEF]   = attr[CommonFun.RoleData.EATTRTYPE_MDEF] *(1+0.05*lv+math.floor(lv/4)*0.2)
      result[CommonFun.RoleData.EATTRTYPE_MAXHP]  = attr[CommonFun.RoleData.EATTRTYPE_MAXHP] *(0.6+0.05*lv+lv*lv/50)
      result[CommonFun.RoleData.EATTRTYPE_ATKSPD] = attr[CommonFun.RoleData.EATTRTYPE_ATKSPD] *(1+math.floor(lv/4)*0.1)
  return result
end
-------------------------无限塔各类型怪强度返回值
function CommonFun.calcEndlessTowerNpcAttrValue(attr, Type, classtype, Layer)
  local result = {}

  -- Type 类型
  -- Type == 1  ENPCTYPE_NPC
  -- Type == 2  ENPCTYPE_GATHER
  -- Type == 3  ENPCTYPE_MONSTER
  -- Type == 4  ENPCTYPE_MINIBOSS
  -- Type == 5  ENPCTYPE_MVP
  -- Type == 6  ENPCTYPE_SMALLMINIBOSS

  -- ENPCTYPE_MONSTER 类型
  if Type == 3 then
    result = CommonFun.calcTowerMonsterNpcAttrValue(attr, Type, classtype,  Layer)

  -- ENPCTYPE_MINIBOSS 类型
  elseif Type == 4 then
    result = CommonFun.calcTowerMiniNpcAttrValue(attr, Type, classtype, Layer)

  -- ENPCTYPE_MVP 类型
  elseif Type == 5 then
    result = CommonFun.calcTowerMvpNpcAttrValue(attr, Type, classtype, Layer)

  -- ENPCTYPE_SMALLMINIBOSS 类型
  elseif Type == 6 then
    result = CommonFun.calcTowerSmallMiniNpcAttrValue(attr, Type, classtype, Layer)
  end

  for k,v in pairs(result) do
    result.k = math.floor(v*1000)/1000
  end

  return result
end

-- 研究所怪物属性计算(不包含性格属性)
function CommonFun.calcLaboratoryNpcAttrValue(attr, level, classtype, roundid)
  -- classtype 类型
  -- 11 - 战士
  -- 12 - 骑士
  -- 21 - 法师
  -- 31 - 盗贼
  -- 41 - 弓手
  -- 51 - 牧师
  local result = {}
  if calsstype==11 then
        result[CommonFun.RoleData.EATTRTYPE_ATK]    =  (0.34*level*level-8.26*level+72)*0.4
        result[CommonFun.RoleData.EATTRTYPE_MATK]   =  (0.34*level*level-8.26*level+72)*0.4
        result[CommonFun.RoleData.EATTRTYPE_DEF]    =  0.0008*level*level*level-0.0494*level*level+4.5061*level+1
        result[CommonFun.RoleData.EATTRTYPE_MDEF]   =  2*level
        result[CommonFun.RoleData.EATTRTYPE_MAXHP]  =  (0.1373*level*level*level-2.9336*level*level+202.51*level+40.727)*2*3
        result[CommonFun.RoleData.EATTRTYPE_HIT]    =  2*level+50
        result[CommonFun.RoleData.EATTRTYPE_FLEE]   =  level
        result[CommonFun.RoleData.EATTRTYPE_CRI]    =  level*0.3
        result[CommonFun.RoleData.EATTRTYPE_CRIRES] =  level*0.3

  elseif calsstype==12 then
        result[CommonFun.RoleData.EATTRTYPE_ATK]    =  (0.34*level*level-8.26*level+72)*0.4
        result[CommonFun.RoleData.EATTRTYPE_MATK]   =  (0.34*level*level-8.26*level+72)*0.4
        result[CommonFun.RoleData.EATTRTYPE_DEF]    =  0.0008*level*level*level-0.0494*level*level+4.5061*level+1
        result[CommonFun.RoleData.EATTRTYPE_MDEF]   =  2*level
        result[CommonFun.RoleData.EATTRTYPE_MAXHP]  =  (0.1373*level*level*level-2.9336*level*level+202.51*level+40.727)*2*3
        result[CommonFun.RoleData.EATTRTYPE_HIT]    =  2*level+50
        result[CommonFun.RoleData.EATTRTYPE_FLEE]   =  level
        result[CommonFun.RoleData.EATTRTYPE_CRI]    =  level*0.3
        result[CommonFun.RoleData.EATTRTYPE_CRIRES] =  level*0.3
  elseif calsstype==21 then
        result[CommonFun.RoleData.EATTRTYPE_ATK]    =  (0.34*level*level-8.26*level+72)*0.4
        result[CommonFun.RoleData.EATTRTYPE_MATK]   =  (0.34*level*level-8.26*level+72)*0.4
        result[CommonFun.RoleData.EATTRTYPE_DEF]    =  0.0008*level*level*level-0.0494*level*level+4.5061*level+1
        result[CommonFun.RoleData.EATTRTYPE_MDEF]   =  2*level
        result[CommonFun.RoleData.EATTRTYPE_MAXHP]  =  (0.1373*level*level*level-2.9336*level*level+202.51*level+40.727)*3
        result[CommonFun.RoleData.EATTRTYPE_HIT]    =  2*level+50
        result[CommonFun.RoleData.EATTRTYPE_FLEE]   =  level
        result[CommonFun.RoleData.EATTRTYPE_CRI]    =  level*0.3
        result[CommonFun.RoleData.EATTRTYPE_CRIRES] =  level*0.3
  elseif calsstype==31 then
        result[CommonFun.RoleData.EATTRTYPE_ATK]    =  (0.34*level*level-8.26*level+72)*0.75
        result[CommonFun.RoleData.EATTRTYPE_MATK]   =  (0.34*level*level-8.26*level+72)*0.75
        result[CommonFun.RoleData.EATTRTYPE_DEF]    =  0.0008*level*level*level-0.0494*level*level+4.5061*level+1
        result[CommonFun.RoleData.EATTRTYPE_MDEF]   =  2*level
        result[CommonFun.RoleData.EATTRTYPE_MAXHP]  =  (0.1373*level*level*level-2.9336*level*level+202.51*level+40.727)*3
        result[CommonFun.RoleData.EATTRTYPE_HIT]    =  2*level+50
        result[CommonFun.RoleData.EATTRTYPE_FLEE]   =  level
        result[CommonFun.RoleData.EATTRTYPE_CRI]    =  level*0.3
        result[CommonFun.RoleData.EATTRTYPE_CRIRES] =  level*0.3
  elseif calsstype==41 then
        result[CommonFun.RoleData.EATTRTYPE_ATK]    =  (0.34*level*level-8.26*level+72)*0.75
        result[CommonFun.RoleData.EATTRTYPE_MATK]   =  (0.34*level*level-8.26*level+72)*0.75
        result[CommonFun.RoleData.EATTRTYPE_DEF]    =  0.0008*level*level*level-0.0494*level*level+4.5061*level+1
        result[CommonFun.RoleData.EATTRTYPE_MDEF]   =  2*level
        result[CommonFun.RoleData.EATTRTYPE_MAXHP]  =  (0.1373*level*level*level-2.9336*level*level+202.51*level+40.727)*3
        result[CommonFun.RoleData.EATTRTYPE_HIT]    =  2*level+50
        result[CommonFun.RoleData.EATTRTYPE_FLEE]   =  level
        result[CommonFun.RoleData.EATTRTYPE_CRI]    =  level*0.3
        result[CommonFun.RoleData.EATTRTYPE_CRIRES] =  level*0.3
  elseif calsstype==51 then
        result[CommonFun.RoleData.EATTRTYPE_ATK]    =  (0.34*level*level-8.26*level+72)*0.5
        result[CommonFun.RoleData.EATTRTYPE_MATK]   =  (0.34*level*level-8.26*level+72)*0.5
        result[CommonFun.RoleData.EATTRTYPE_DEF]    =  0.0008*level*level*level-0.0494*level*level+4.5061*level+1
        result[CommonFun.RoleData.EATTRTYPE_MDEF]   =  2*level
        result[CommonFun.RoleData.EATTRTYPE_MAXHP]  =  (0.1373*level*level*level-2.9336*level*level+202.51*level+40.727)*2
        result[CommonFun.RoleData.EATTRTYPE_HIT]    =  2*level+50
        result[CommonFun.RoleData.EATTRTYPE_FLEE]   =  level
        result[CommonFun.RoleData.EATTRTYPE_CRI]    =  level*0.3
        result[CommonFun.RoleData.EATTRTYPE_CRIRES] =  level*0.3
  else
        result[CommonFun.RoleData.EATTRTYPE_ATK]    =  (0.34*level*level-8.26*level+72)*0.5
        result[CommonFun.RoleData.EATTRTYPE_MATK]   =  (0.34*level*level-8.26*level+72)*0.5
        result[CommonFun.RoleData.EATTRTYPE_DEF]    =  0.0008*level*level*level-0.0494*level*level+4.5061*level+1
        result[CommonFun.RoleData.EATTRTYPE_MDEF]   =  2*level
        result[CommonFun.RoleData.EATTRTYPE_MAXHP]  =  (0.1373*level*level*level-2.9336*level*level+202.51*level+40.727)*2
        result[CommonFun.RoleData.EATTRTYPE_HIT]    =  2*level+50
        result[CommonFun.RoleData.EATTRTYPE_FLEE]   =  level
        result[CommonFun.RoleData.EATTRTYPE_CRI]    =  level*0.3
        result[CommonFun.RoleData.EATTRTYPE_CRIRES] =  level*0.3
  end

  return result
end

-- 封印怪物属性计算
function CommonFun.calcSealNpcAttrValue(attr, classtype, sealtype, mapid)

-- sealtype
-- 1 : 组队
-- 2 : 个人
-- 3 : 活动
local result = {}
local A=GameConfig.Seal.npclv[mapid]
if A == nil then
  ---print("------------------")
  A = 65
end
--print("A = "..A)
--print("mapid = "..mapid)

  if  sealtype==1 then
        result[CommonFun.RoleData.EATTRTYPE_ATK]    =  (0.34*A*A-8.26*A+72)*0.4
        result[CommonFun.RoleData.EATTRTYPE_MATK]   =  (0.34*A*A-8.26*A+72)*0.23
        result[CommonFun.RoleData.EATTRTYPE_DEF]    =  0.0008*A*A*A-0.0494*A*A+4.5061*A+1
        result[CommonFun.RoleData.EATTRTYPE_MDEF]   =  2*A
        result[CommonFun.RoleData.EATTRTYPE_MAXHP]  =  (0.1373*A*A*A-2.9336*A*A+202.51*A+40.727)
        result[CommonFun.RoleData.EATTRTYPE_HIT]    =  2*A+50
        result[CommonFun.RoleData.EATTRTYPE_FLEE]   =  A+50
        result[CommonFun.RoleData.EATTRTYPE_CRI]    =  A*0.3
        result[CommonFun.RoleData.EATTRTYPE_CRIRES] =  A*0.3
  else
        if A<20 then
        result[CommonFun.RoleData.EATTRTYPE_ATK]    =  4
        result[CommonFun.RoleData.EATTRTYPE_MATK]   =  4
        result[CommonFun.RoleData.EATTRTYPE_DEF]    =  0.0008*A*A*A-0.0494*A*A+4.5061*A+1
        result[CommonFun.RoleData.EATTRTYPE_MDEF]   =  2*A
        result[CommonFun.RoleData.EATTRTYPE_MAXHP]  =  (0.1373*A*A*A-2.9336*A*A+202.51*A+40.727)*0.1
        result[CommonFun.RoleData.EATTRTYPE_HIT]    =  2*A
        result[CommonFun.RoleData.EATTRTYPE_FLEE]   =  A
        result[CommonFun.RoleData.EATTRTYPE_CRI]    =  A*0.3
        result[CommonFun.RoleData.EATTRTYPE_CRIRES] =  A*0.3
        elseif A<30 and A>=20 then
        result[CommonFun.RoleData.EATTRTYPE_ATK]    =  (2*(A-19) + 8)*0.5
        result[CommonFun.RoleData.EATTRTYPE_MATK]   =  (2*(A-19) + 8)*0.2
        result[CommonFun.RoleData.EATTRTYPE_DEF]    =  0.0008*A*A*A-0.0494*A*A+4.5061*A+1
        result[CommonFun.RoleData.EATTRTYPE_MDEF]   =  2*A
        result[CommonFun.RoleData.EATTRTYPE_MAXHP]  =  (0.1373*A*A*A-2.9336*A*A+202.51*A+40.727)*0.1
        result[CommonFun.RoleData.EATTRTYPE_HIT]    =  2*A
        result[CommonFun.RoleData.EATTRTYPE_FLEE]   =  A
        result[CommonFun.RoleData.EATTRTYPE_CRI]    =  A*0.3
        result[CommonFun.RoleData.EATTRTYPE_CRIRES] =  A*0.3
        elseif A<40 and A>=30 then
        result[CommonFun.RoleData.EATTRTYPE_ATK]    =  (3*(A-29) + 25)*0.5
        result[CommonFun.RoleData.EATTRTYPE_MATK]   =  (3*(A-29) + 25)*0.2
        result[CommonFun.RoleData.EATTRTYPE_DEF]    =  0.0008*A*A*A-0.0494*A*A+4.5061*A+1
        result[CommonFun.RoleData.EATTRTYPE_MDEF]   =  2*A
        result[CommonFun.RoleData.EATTRTYPE_MAXHP]  =  (0.1373*A*A*A-2.9336*A*A+202.51*A+40.727)*0.15
        result[CommonFun.RoleData.EATTRTYPE_HIT]    =  2*A
        result[CommonFun.RoleData.EATTRTYPE_FLEE]   =  A
        result[CommonFun.RoleData.EATTRTYPE_CRI]    =  A*0.3
        result[CommonFun.RoleData.EATTRTYPE_CRIRES] =  A*0.3
        elseif A<50 and A>=40 then
        result[CommonFun.RoleData.EATTRTYPE_ATK]    =  ((A-39) + 57)*0.5
        result[CommonFun.RoleData.EATTRTYPE_MATK]   =  ((A-39) + 57)*0.2
        result[CommonFun.RoleData.EATTRTYPE_DEF]    =  0.0008*A*A*A-0.0494*A*A+4.5061*A+1
        result[CommonFun.RoleData.EATTRTYPE_MDEF]   =  2*A
        result[CommonFun.RoleData.EATTRTYPE_MAXHP]  =  (0.1373*A*A*A-2.9336*A*A+202.51*A+40.727)*0.15
        result[CommonFun.RoleData.EATTRTYPE_HIT]    =  2*A
        result[CommonFun.RoleData.EATTRTYPE_FLEE]   =  A
        result[CommonFun.RoleData.EATTRTYPE_CRI]    =  A*0.3
        result[CommonFun.RoleData.EATTRTYPE_CRIRES] =  A*0.3
        elseif A<60 and A>=50 then
        result[CommonFun.RoleData.EATTRTYPE_ATK]    =  (2*(A-49) + 69)*0.5
        result[CommonFun.RoleData.EATTRTYPE_MATK]   =  (2*(A-49) + 69)*0.2
        result[CommonFun.RoleData.EATTRTYPE_DEF]    =  0.0008*A*A*A-0.0494*A*A+4.5061*A+1
        result[CommonFun.RoleData.EATTRTYPE_MDEF]   =  2*A
        result[CommonFun.RoleData.EATTRTYPE_MAXHP]  =  (0.1373*A*A*A-2.9336*A*A+202.51*A+40.727)*0.2
        result[CommonFun.RoleData.EATTRTYPE_HIT]    =  2*A
        result[CommonFun.RoleData.EATTRTYPE_FLEE]   =  A
        result[CommonFun.RoleData.EATTRTYPE_CRI]    =  A*0.3
        result[CommonFun.RoleData.EATTRTYPE_CRIRES] =  A*0.3
        elseif A<70 and A>=60 then
        result[CommonFun.RoleData.EATTRTYPE_ATK]    =  (3*(A-59) + 94)*0.5
        result[CommonFun.RoleData.EATTRTYPE_MATK]   =  (3*(A-59) + 94)*0.2
        result[CommonFun.RoleData.EATTRTYPE_DEF]    =  0.0008*A*A*A-0.0494*A*A+4.5061*A+1
        result[CommonFun.RoleData.EATTRTYPE_MDEF]   =  2*A
        result[CommonFun.RoleData.EATTRTYPE_MAXHP]  =  (0.1373*A*A*A-2.9336*A*A+202.51*A+40.727)*0.2
        result[CommonFun.RoleData.EATTRTYPE_HIT]    =  2*A
        result[CommonFun.RoleData.EATTRTYPE_FLEE]   =  A
        result[CommonFun.RoleData.EATTRTYPE_CRI]    =  A*0.3
        result[CommonFun.RoleData.EATTRTYPE_CRIRES] =  A*0.3
        elseif A<80 and A>=70 then
        result[CommonFun.RoleData.EATTRTYPE_ATK]    =  13*(A-69) + 114
        result[CommonFun.RoleData.EATTRTYPE_MATK]   =  (13*(A-69) + 114)*0.5
        result[CommonFun.RoleData.EATTRTYPE_DEF]    =  0.0008*A*A*A-0.0494*A*A+4.5061*A+1
        result[CommonFun.RoleData.EATTRTYPE_MDEF]   =  2*A
        result[CommonFun.RoleData.EATTRTYPE_MAXHP]  =  (0.1373*A*A*A-2.9336*A*A+202.51*A+40.727)*0.2
        result[CommonFun.RoleData.EATTRTYPE_HIT]    =  2*A
        result[CommonFun.RoleData.EATTRTYPE_FLEE]   =  A
        result[CommonFun.RoleData.EATTRTYPE_CRI]    =  A*0.3
        result[CommonFun.RoleData.EATTRTYPE_CRIRES] =  A*0.3
        elseif A<90 and A>=80 then
        result[CommonFun.RoleData.EATTRTYPE_ATK]    =  7*(A-79) + 242
        result[CommonFun.RoleData.EATTRTYPE_MATK]   =  (7*(A-79) + 242)*0.5
        result[CommonFun.RoleData.EATTRTYPE_DEF]    =  0.0008*A*A*A-0.0494*A*A+4.5061*A+1
        result[CommonFun.RoleData.EATTRTYPE_MDEF]   =  2*A
        result[CommonFun.RoleData.EATTRTYPE_MAXHP]  =  (0.1373*A*A*A-2.9336*A*A+202.51*A+40.727)*0.2
        result[CommonFun.RoleData.EATTRTYPE_HIT]    =  2*A
        result[CommonFun.RoleData.EATTRTYPE_FLEE]   =  A
        result[CommonFun.RoleData.EATTRTYPE_CRI]    =  A*0.3
        result[CommonFun.RoleData.EATTRTYPE_CRIRES] =  A*0.3

        elseif A<100 and A>=90 then
        result[CommonFun.RoleData.EATTRTYPE_ATK]    =  8*(A-89) + 309
        result[CommonFun.RoleData.EATTRTYPE_MATK]   =  (8*(A-89) + 309)*0.5
        result[CommonFun.RoleData.EATTRTYPE_DEF]    =  0.0008*A*A*A-0.0494*A*A+4.5061*A+1
        result[CommonFun.RoleData.EATTRTYPE_MDEF]   =  2*A
        result[CommonFun.RoleData.EATTRTYPE_MAXHP]  =  (0.1373*A*A*A-2.9336*A*A+202.51*A+40.727)*0.2
        result[CommonFun.RoleData.EATTRTYPE_HIT]    =  2*A
        result[CommonFun.RoleData.EATTRTYPE_FLEE]   =  A
        result[CommonFun.RoleData.EATTRTYPE_CRI]    =  A*0.3
        result[CommonFun.RoleData.EATTRTYPE_CRIRES] =  A*0.3
        end
  end

  return result
end


-------------------------道场各类型怪属性计算
function CommonFun.calcDojoNpcAttrValue(attr, Type, classtype, DojoLevel)

  local result = {}
  local A = DojoLevel*DojoLevel/150

  if A<= 1 then
     A = 1
  end

  if Type==ENPCTYPE_MONSTER then
          result[CommonFun.RoleData.EATTRTYPE_ATK]    = (0.0057*DojoLevel*DojoLevel*DojoLevel-0.3728*DojoLevel*DojoLevel+15.339*DojoLevel-10)*0.2
          result[CommonFun.RoleData.EATTRTYPE_MATK]   = (0.0057*DojoLevel*DojoLevel*DojoLevel-0.3728*DojoLevel*DojoLevel+15.339*DojoLevel-10)*0.2
          result[CommonFun.RoleData.EATTRTYPE_DEF]    = (0.0008*DojoLevel*DojoLevel*DojoLevel-0.0494*DojoLevel*DojoLevel+4.5061*DojoLevel+1)
          result[CommonFun.RoleData.EATTRTYPE_MDEF]   = 2*DojoLevel
          result[CommonFun.RoleData.EATTRTYPE_MAXHP]  = (0.1373*DojoLevel*DojoLevel*DojoLevel-2.9336*DojoLevel*DojoLevel+202.51*DojoLevel+40.727)*0.3
          result[CommonFun.RoleData.EATTRTYPE_HIT]    = 2*DojoLevel+50
          result[CommonFun.RoleData.EATTRTYPE_FLEE]   = DojoLevel
          result[CommonFun.RoleData.EATTRTYPE_CRI]    = DojoLevel*0.3
          result[CommonFun.RoleData.EATTRTYPE_CRIRES] = DojoLevel*0.3
  elseif Type==ENPCTYPE_MINIBOSS then
          result[CommonFun.RoleData.EATTRTYPE_ATK]    = (0.0057*DojoLevel*DojoLevel*DojoLevel-0.3728*DojoLevel*DojoLevel+15.339*DojoLevel-10)*0.5
          result[CommonFun.RoleData.EATTRTYPE_MATK]   = (0.0057*DojoLevel*DojoLevel*DojoLevel-0.3728*DojoLevel*DojoLevel+15.339*DojoLevel-10)*0.5
          result[CommonFun.RoleData.EATTRTYPE_DEF]    = (0.0008*DojoLevel*DojoLevel*DojoLevel-0.0494*DojoLevel*DojoLevel+4.5061*DojoLevel+1)
          result[CommonFun.RoleData.EATTRTYPE_MDEF]   = 2*DojoLevel
          result[CommonFun.RoleData.EATTRTYPE_MAXHP]  = (0.1373*DojoLevel*DojoLevel*DojoLevel-2.9336*DojoLevel*DojoLevel+202.51*DojoLevel+40.727)*0.75
          result[CommonFun.RoleData.EATTRTYPE_HIT]    = 2*DojoLevel+50
          result[CommonFun.RoleData.EATTRTYPE_FLEE]   = DojoLevel
          result[CommonFun.RoleData.EATTRTYPE_CRI]    = DojoLevel*0.3
          result[CommonFun.RoleData.EATTRTYPE_CRIRES] = DojoLevel*0.3
  elseif  Type==ENPCTYPE_MVP   then
          result[CommonFun.RoleData.EATTRTYPE_ATK]    = (0.0057*DojoLevel*DojoLevel*DojoLevel-0.3728*DojoLevel*DojoLevel+15.339*DojoLevel-10)*0.75
          result[CommonFun.RoleData.EATTRTYPE_MATK]   = (0.0057*DojoLevel*DojoLevel*DojoLevel-0.3728*DojoLevel*DojoLevel+15.339*DojoLevel-10)*0.75
          result[CommonFun.RoleData.EATTRTYPE_DEF]    = (0.0008*DojoLevel*DojoLevel*DojoLevel-0.0494*DojoLevel*DojoLevel+4.5061*DojoLevel+1)
          result[CommonFun.RoleData.EATTRTYPE_MDEF]   = 2*DojoLevel
          result[CommonFun.RoleData.EATTRTYPE_MAXHP]  = (0.1373*DojoLevel*DojoLevel*DojoLevel-2.9336*DojoLevel*DojoLevel+202.51*DojoLevel+40.727)*A
          result[CommonFun.RoleData.EATTRTYPE_HIT]    = 2*DojoLevel+50
          result[CommonFun.RoleData.EATTRTYPE_FLEE]   = DojoLevel
          result[CommonFun.RoleData.EATTRTYPE_CRI]    = DojoLevel*0.3
          result[CommonFun.RoleData.EATTRTYPE_CRIRES] = DojoLevel*0.3
  else
          result[CommonFun.RoleData.EATTRTYPE_ATK]    = (0.0057*DojoLevel*DojoLevel*DojoLevel-0.3728*DojoLevel*DojoLevel+15.339*DojoLevel-10)*0.3
          result[CommonFun.RoleData.EATTRTYPE_MATK]   = (0.0057*DojoLevel*DojoLevel*DojoLevel-0.3728*DojoLevel*DojoLevel+15.339*DojoLevel-10)*0.3
          result[CommonFun.RoleData.EATTRTYPE_DEF]    = (0.0008*DojoLevel*DojoLevel*DojoLevel-0.0494*DojoLevel*DojoLevel+4.5061*DojoLevel+1)
          result[CommonFun.RoleData.EATTRTYPE_MDEF]   = 2*DojoLevel
          result[CommonFun.RoleData.EATTRTYPE_MAXHP]  = (0.1373*DojoLevel*DojoLevel*DojoLevel-2.9336*DojoLevel*DojoLevel+202.51*DojoLevel+40.727)*0.6
          result[CommonFun.RoleData.EATTRTYPE_HIT]    = 2*DojoLevel+50
          result[CommonFun.RoleData.EATTRTYPE_FLEE]   = DojoLevel
          result[CommonFun.RoleData.EATTRTYPE_CRI]    = DojoLevel*0.3
          result[CommonFun.RoleData.EATTRTYPE_CRIRES] = DojoLevel*0.3
  end
    return result

end

function CommonFun.calcWeaponPetNpcAttrValue(attr, classtype, level, srcUser)
  local result = {}

  local a=1
  if srcUser ~= nil and srcUser:HasBuffID(30000) == true then
     a=1.1
  end

  if classtype==51 then
  result[CommonFun.RoleData.EATTRTYPE_ATK]    =  (0.15*level*level-3*level+70) + attr[CommonFun.RoleData.EATTRTYPE_ATK]
  result[CommonFun.RoleData.EATTRTYPE_MATK]   =  (0.1*level*level-3*level+70) + attr[CommonFun.RoleData.EATTRTYPE_MATK]
  result[CommonFun.RoleData.EATTRTYPE_DEF]    =  level*6 + attr[CommonFun.RoleData.EATTRTYPE_DEF]
  result[CommonFun.RoleData.EATTRTYPE_MDEF]   =  level*2 + attr[CommonFun.RoleData.EATTRTYPE_MDEF]
  result[CommonFun.RoleData.EATTRTYPE_MAXHP]  =  (1.5*level*level-10*level+1000) + attr[CommonFun.RoleData.EATTRTYPE_MAXHP]
  result[CommonFun.RoleData.EATTRTYPE_HIT]    =  3*level+50 + attr[CommonFun.RoleData.EATTRTYPE_HIT]
  result[CommonFun.RoleData.EATTRTYPE_FLEE]   =  level + attr[CommonFun.RoleData.EATTRTYPE_FLEE]
  result[CommonFun.RoleData.EATTRTYPE_CRI]    =  level*0.3 + attr[CommonFun.RoleData.EATTRTYPE_CRI]
  result[CommonFun.RoleData.EATTRTYPE_CRIRES] =  level*0.3 + attr[CommonFun.RoleData.EATTRTYPE_CRIRES]
 elseif classtype==41 then
  result[CommonFun.RoleData.EATTRTYPE_ATK]    =  ((0.25*level*level-2*level+70) + attr[CommonFun.RoleData.EATTRTYPE_ATK])*a
  result[CommonFun.RoleData.EATTRTYPE_MATK]   =  (0.1*level*level-3*level+70) + attr[CommonFun.RoleData.EATTRTYPE_MATK]
  result[CommonFun.RoleData.EATTRTYPE_DEF]    =  level*6 + attr[CommonFun.RoleData.EATTRTYPE_DEF]
  result[CommonFun.RoleData.EATTRTYPE_MDEF]   =  level*2 + attr[CommonFun.RoleData.EATTRTYPE_MDEF]
  result[CommonFun.RoleData.EATTRTYPE_MAXHP]  =  (3*level*level-10*level+1000) + attr[CommonFun.RoleData.EATTRTYPE_MAXHP]
  result[CommonFun.RoleData.EATTRTYPE_HIT]    =  3*level+50 + attr[CommonFun.RoleData.EATTRTYPE_HIT]
  result[CommonFun.RoleData.EATTRTYPE_FLEE]   =  level + attr[CommonFun.RoleData.EATTRTYPE_FLEE]
  result[CommonFun.RoleData.EATTRTYPE_CRI]    =  level*0.3 + attr[CommonFun.RoleData.EATTRTYPE_CRI]
  result[CommonFun.RoleData.EATTRTYPE_CRIRES] =  level*0.3 + attr[CommonFun.RoleData.EATTRTYPE_CRIRES]
  elseif classtype==11 then
  result[CommonFun.RoleData.EATTRTYPE_ATK]    =  (0.15*level*level-3*level+70) + attr[CommonFun.RoleData.EATTRTYPE_ATK]
  result[CommonFun.RoleData.EATTRTYPE_MATK]   =  (0.1*level*level-3*level+70) + attr[CommonFun.RoleData.EATTRTYPE_MATK]
  result[CommonFun.RoleData.EATTRTYPE_DEF]    =  level*12 + attr[CommonFun.RoleData.EATTRTYPE_DEF]
  result[CommonFun.RoleData.EATTRTYPE_MDEF]   =  level*4   + attr[CommonFun.RoleData.EATTRTYPE_MDEF]
  result[CommonFun.RoleData.EATTRTYPE_MAXHP]  =  ((4.5*level*level-10*level+1000) + attr[CommonFun.RoleData.EATTRTYPE_MAXHP])*a
  result[CommonFun.RoleData.EATTRTYPE_HIT]    =  3*level+50 + attr[CommonFun.RoleData.EATTRTYPE_HIT]
  result[CommonFun.RoleData.EATTRTYPE_FLEE]   =  level + attr[CommonFun.RoleData.EATTRTYPE_FLEE]
  result[CommonFun.RoleData.EATTRTYPE_CRI]    =  level*0.3 + attr[CommonFun.RoleData.EATTRTYPE_CRI]
  result[CommonFun.RoleData.EATTRTYPE_CRIRES] =  level*0.3 + attr[CommonFun.RoleData.EATTRTYPE_CRIRES]
  elseif classtype==21 then
  result[CommonFun.RoleData.EATTRTYPE_ATK]    =  (0.1*level*level-3*level+70) + attr[CommonFun.RoleData.EATTRTYPE_ATK]
  result[CommonFun.RoleData.EATTRTYPE_MATK]   =  ((0.4*level*level-2*level+70) + attr[CommonFun.RoleData.EATTRTYPE_MATK])*a
  result[CommonFun.RoleData.EATTRTYPE_DEF]    =  level*6 + attr[CommonFun.RoleData.EATTRTYPE_DEF]
  result[CommonFun.RoleData.EATTRTYPE_MDEF]   =  level*2 + attr[CommonFun.RoleData.EATTRTYPE_MDEF]
  result[CommonFun.RoleData.EATTRTYPE_MAXHP]  =  (3*level*level-10*level+1000) + attr[CommonFun.RoleData.EATTRTYPE_MAXHP]
  result[CommonFun.RoleData.EATTRTYPE_HIT]    =  3*level+50 + attr[CommonFun.RoleData.EATTRTYPE_HIT]
  result[CommonFun.RoleData.EATTRTYPE_FLEE]   =  level + attr[CommonFun.RoleData.EATTRTYPE_FLEE]
  result[CommonFun.RoleData.EATTRTYPE_CRI]    =  level*0.3 + attr[CommonFun.RoleData.EATTRTYPE_CRI]
  result[CommonFun.RoleData.EATTRTYPE_CRIRES] =  level*0.3 + attr[CommonFun.RoleData.EATTRTYPE_CRIRES]
  else
  result[CommonFun.RoleData.EATTRTYPE_ATK]    =  (0.15*level*level-3*level+70) + attr[CommonFun.RoleData.EATTRTYPE_ATK]
  result[CommonFun.RoleData.EATTRTYPE_MATK]   =  (0.1*level*level-3*level+70) + attr[CommonFun.RoleData.EATTRTYPE_MATK]
  result[CommonFun.RoleData.EATTRTYPE_DEF]    =  level*6 + attr[CommonFun.RoleData.EATTRTYPE_DEF]
  result[CommonFun.RoleData.EATTRTYPE_MDEF]   =  level*2 + attr[CommonFun.RoleData.EATTRTYPE_MDEF]
  result[CommonFun.RoleData.EATTRTYPE_MAXHP]  =  (1.5*level*level-10*level+1000) + attr[CommonFun.RoleData.EATTRTYPE_MAXHP]
  result[CommonFun.RoleData.EATTRTYPE_HIT]    =  3*level+50 + attr[CommonFun.RoleData.EATTRTYPE_HIT]
  result[CommonFun.RoleData.EATTRTYPE_FLEE]   =  level + attr[CommonFun.RoleData.EATTRTYPE_FLEE]
  result[CommonFun.RoleData.EATTRTYPE_CRI]    =  level*0.3 + attr[CommonFun.RoleData.EATTRTYPE_CRI]
  result[CommonFun.RoleData.EATTRTYPE_CRIRES] =  level*0.3 + attr[CommonFun.RoleData.EATTRTYPE_CRIRES]
  end

  result[CommonFun.RoleData.EATTRTYPE_MOVESPD] =  2.1
  return result
end

-- 新增宠物属性计算
function CommonFun.calcPetNpcAttrValue(attr, petlv, classtype)
  local result = {}
  -----------1   品质为D
  -----------11  战士系相关职业  坦克
  -----------21  法师系相关职业  法攻
  -----------31  刺客系相关职业  物攻-近
  -----------41  弓手系相关职业  物攻-远
  -----------51  牧师系相关职业  辅助
  -----------61  商人系相关职业  均衡
  -----------1-C 2-B 3-A 4-S
  --品质系数
  local QualityRatio = 0

  --各品质对应的品质系数判断
  if classtype == 11 or classtype == 21 or classtype == 31 or classtype == 41 or classtype == 51 or classtype == 61 then
  QualityRatio = 1.4
  elseif classtype == 12 or classtype == 22 or classtype == 32 or classtype == 42 or classtype == 52 or classtype == 62 then
  QualityRatio = 1.8
  elseif classtype == 13 or classtype == 23 or classtype == 33 or classtype == 43 or classtype == 53 or classtype == 63 then
  QualityRatio = 2.3
  elseif classtype == 14 or classtype == 24 or classtype == 34 or classtype == 44 or classtype == 54 or classtype == 64 then
  QualityRatio = 3
  else
  QualityRatio = 1
  end

  --各职业倾向的六维成长率
  if classtype==11 or classtype==12 or classtype==13 or classtype==14  then
  result[CommonFun.RoleData.EATTRTYPE_STR] = (3 + (petlv-1) * 0.216) * QualityRatio + attr[CommonFun.RoleData.EATTRTYPE_STR]
  result[CommonFun.RoleData.EATTRTYPE_AGI] = (0.5 + (petlv-1) * 0.036) * QualityRatio + attr[CommonFun.RoleData.EATTRTYPE_AGI]
  result[CommonFun.RoleData.EATTRTYPE_VIT] = (4 + (petlv-1) * 0.288) * QualityRatio + attr[CommonFun.RoleData.EATTRTYPE_VIT]
  result[CommonFun.RoleData.EATTRTYPE_INT] = (0.5 + (petlv-1) * 0.036) * QualityRatio + attr[CommonFun.RoleData.EATTRTYPE_INT]
  result[CommonFun.RoleData.EATTRTYPE_DEX] = (1.5 + (petlv-1) * 0.108) * QualityRatio + attr[CommonFun.RoleData.EATTRTYPE_DEX]
  result[CommonFun.RoleData.EATTRTYPE_LUK] = (0.5 + (petlv-1) * 0.036) * QualityRatio + attr[CommonFun.RoleData.EATTRTYPE_LUK]
  elseif  classtype==21 or classtype==22 or classtype==23 or classtype==24  then
  result[CommonFun.RoleData.EATTRTYPE_STR] = (0.5 + (petlv-1) * 0.036) * QualityRatio + attr[CommonFun.RoleData.EATTRTYPE_STR]
  result[CommonFun.RoleData.EATTRTYPE_AGI] = (0.5 + (petlv-1) * 0.036) * QualityRatio + attr[CommonFun.RoleData.EATTRTYPE_AGI]
  result[CommonFun.RoleData.EATTRTYPE_VIT] = (0.5 + (petlv-1) * 0.036) * QualityRatio + attr[CommonFun.RoleData.EATTRTYPE_VIT]
  result[CommonFun.RoleData.EATTRTYPE_INT] = (4 + (petlv-1) * 0.288) * QualityRatio + attr[CommonFun.RoleData.EATTRTYPE_INT]
  result[CommonFun.RoleData.EATTRTYPE_DEX] = (4 + (petlv-1) * 0.288) * QualityRatio + attr[CommonFun.RoleData.EATTRTYPE_DEX]
  result[CommonFun.RoleData.EATTRTYPE_LUK] = (0.5 + (petlv-1) * 0.036) * QualityRatio + attr[CommonFun.RoleData.EATTRTYPE_LUK]
  elseif  classtype==31 or classtype==32 or classtype==33 or classtype==34  then
  result[CommonFun.RoleData.EATTRTYPE_STR] = (4 + (petlv-1) * 0.288) * QualityRatio + attr[CommonFun.RoleData.EATTRTYPE_STR]
  result[CommonFun.RoleData.EATTRTYPE_AGI] = (3 + (petlv-1) * 0.216) * QualityRatio + attr[CommonFun.RoleData.EATTRTYPE_AGI]
  result[CommonFun.RoleData.EATTRTYPE_VIT] = (0.5 + (petlv-1) * 0.036) * QualityRatio + attr[CommonFun.RoleData.EATTRTYPE_VIT]
  result[CommonFun.RoleData.EATTRTYPE_INT] = (0.5 + (petlv-1) * 0.036) * QualityRatio + attr[CommonFun.RoleData.EATTRTYPE_INT]
  result[CommonFun.RoleData.EATTRTYPE_LUK] = (1 + (petlv-1) * 0.072) * QualityRatio + attr[CommonFun.RoleData.EATTRTYPE_DEX]
  result[CommonFun.RoleData.EATTRTYPE_DEX] = (1 + (petlv-1) * 0.072) * QualityRatio + attr[CommonFun.RoleData.EATTRTYPE_LUK]
  elseif  classtype==41 or classtype==42 or classtype==43 or classtype==44  then
  result[CommonFun.RoleData.EATTRTYPE_STR] = (0.5 + (petlv-1) * 0.036) * QualityRatio + attr[CommonFun.RoleData.EATTRTYPE_STR]
  result[CommonFun.RoleData.EATTRTYPE_AGI] = (3 + (petlv-1) * 0.216) * QualityRatio + attr[CommonFun.RoleData.EATTRTYPE_AGI]
  result[CommonFun.RoleData.EATTRTYPE_VIT] = (0.5 + (petlv-1) * 0.036) * QualityRatio + attr[CommonFun.RoleData.EATTRTYPE_VIT]
  result[CommonFun.RoleData.EATTRTYPE_INT] = (0.5 + (petlv-1) * 0.036) * QualityRatio + attr[CommonFun.RoleData.EATTRTYPE_INT]
  result[CommonFun.RoleData.EATTRTYPE_DEX] = (4 + (petlv-1) * 0.288) * QualityRatio + attr[CommonFun.RoleData.EATTRTYPE_DEX]
  result[CommonFun.RoleData.EATTRTYPE_LUK] = (1.5 + (petlv-1) * 0.108) * QualityRatio + attr[CommonFun.RoleData.EATTRTYPE_LUK]
  elseif  classtype==51 or classtype==52 or classtype==53 or classtype==54  then
  result[CommonFun.RoleData.EATTRTYPE_STR] = (0.5 + (petlv-1) * 0.036) * QualityRatio + attr[CommonFun.RoleData.EATTRTYPE_STR]
  result[CommonFun.RoleData.EATTRTYPE_AGI] = (0.5 + (petlv-1) * 0.036) * QualityRatio + attr[CommonFun.RoleData.EATTRTYPE_AGI]
  result[CommonFun.RoleData.EATTRTYPE_VIT] = (3 + (petlv-1) * 0.216) * QualityRatio + attr[CommonFun.RoleData.EATTRTYPE_VIT]
  result[CommonFun.RoleData.EATTRTYPE_INT] = (4 + (petlv-1) * 0.288) * QualityRatio + attr[CommonFun.RoleData.EATTRTYPE_INT]
  result[CommonFun.RoleData.EATTRTYPE_DEX] = (1.5 + (petlv-1) * 0.108) * QualityRatio + attr[CommonFun.RoleData.EATTRTYPE_DEX]
  result[CommonFun.RoleData.EATTRTYPE_LUK] = (0.5 + (petlv-1) * 0.036) * QualityRatio + attr[CommonFun.RoleData.EATTRTYPE_LUK]
  elseif  classtype==61 or classtype==62 or classtype==63 or classtype==64  then
  result[CommonFun.RoleData.EATTRTYPE_STR] = (2 + (petlv-1) * 0.144) * QualityRatio + attr[CommonFun.RoleData.EATTRTYPE_STR]
  result[CommonFun.RoleData.EATTRTYPE_AGI] = (2 + (petlv-1) * 0.144) * QualityRatio + attr[CommonFun.RoleData.EATTRTYPE_AGI]
  result[CommonFun.RoleData.EATTRTYPE_VIT] = (0.7 + (petlv-1) * 0.0504) * QualityRatio + attr[CommonFun.RoleData.EATTRTYPE_VIT]
  result[CommonFun.RoleData.EATTRTYPE_INT] = (0.5 + (petlv-1) * 0.036) * QualityRatio + attr[CommonFun.RoleData.EATTRTYPE_INT]
  result[CommonFun.RoleData.EATTRTYPE_DEX] = (2.5 + (petlv-1) * 0.18) * QualityRatio + attr[CommonFun.RoleData.EATTRTYPE_DEX]
  result[CommonFun.RoleData.EATTRTYPE_LUK] = (2.3 + (petlv-1) * 0.1656) * QualityRatio + attr[CommonFun.RoleData.EATTRTYPE_LUK]
  else
  result[CommonFun.RoleData.EATTRTYPE_STR] = (2 + (petlv-1) * 0.144) * QualityRatio + attr[CommonFun.RoleData.EATTRTYPE_STR]
  result[CommonFun.RoleData.EATTRTYPE_AGI] = (2 + (petlv-1) * 0.144) * QualityRatio + attr[CommonFun.RoleData.EATTRTYPE_AGI]
  result[CommonFun.RoleData.EATTRTYPE_VIT] = (2 + (petlv-1) * 0.144) * QualityRatio + attr[CommonFun.RoleData.EATTRTYPE_VIT]
  result[CommonFun.RoleData.EATTRTYPE_INT] = (1 + (petlv-1) * 0.072) * QualityRatio + attr[CommonFun.RoleData.EATTRTYPE_INT]
  result[CommonFun.RoleData.EATTRTYPE_DEX] = (2 + (petlv-1) * 0.144) * QualityRatio + attr[CommonFun.RoleData.EATTRTYPE_DEX]
  result[CommonFun.RoleData.EATTRTYPE_LUK] = (1 + (petlv-1) * 0.072) * QualityRatio + attr[CommonFun.RoleData.EATTRTYPE_LUK]
  end

  --各职业属性换算
  if  classtype==1 then
  result[CommonFun.RoleData.EATTRTYPE_ATK]    = 78 + (petlv-1) * 6.12 + attr[CommonFun.RoleData.EATTRTYPE_ATK] + attr[CommonFun.RoleData.EATTRTYPE_STR] * 6.464 + attr[CommonFun.RoleData.EATTRTYPE_LUK] * 0.4 + attr[CommonFun.RoleData.EATTRTYPE_DEX] *0.4
  result[CommonFun.RoleData.EATTRTYPE_MATK]   = 24 + (petlv-1) * 1.91 + attr[CommonFun.RoleData.EATTRTYPE_MATK] + attr[CommonFun.RoleData.EATTRTYPE_INT] * 4.444
  result[CommonFun.RoleData.EATTRTYPE_DEF]    = 34 + (petlv-1) * 1.72 + attr[CommonFun.RoleData.EATTRTYPE_DEF] + attr[CommonFun.RoleData.EATTRTYPE_VIT] * 2
  result[CommonFun.RoleData.EATTRTYPE_MDEF]   = 34 + (petlv-1) * 1.72 + attr[CommonFun.RoleData.EATTRTYPE_MDEF] + attr[CommonFun.RoleData.EATTRTYPE_INT] * 6 + attr[CommonFun.RoleData.EATTRTYPE_VIT] * 1
  result[CommonFun.RoleData.EATTRTYPE_MAXHP]  = (126 + (petlv-1) * 126.81 + attr[CommonFun.RoleData.EATTRTYPE_MAXHP]) * (1 + attr[CommonFun.RoleData.EATTRTYPE_VIT] / 50)
  result[CommonFun.RoleData.EATTRTYPE_HIT]    = 44 + (petlv-1) * 1.72 + attr[CommonFun.RoleData.EATTRTYPE_HIT] + attr[CommonFun.RoleData.EATTRTYPE_DEX] * 2
  result[CommonFun.RoleData.EATTRTYPE_FLEE]   = 44 + (petlv-1) * 1.72 + attr[CommonFun.RoleData.EATTRTYPE_FLEE] + attr[CommonFun.RoleData.EATTRTYPE_AGI] * 2
  result[CommonFun.RoleData.EATTRTYPE_CRI]    = 14 + (petlv-1) * 0.28 + attr[CommonFun.RoleData.EATTRTYPE_CRI] + attr[CommonFun.RoleData.EATTRTYPE_LUK] * 0.67
  result[CommonFun.RoleData.EATTRTYPE_CRIRES] = 12.4 + (petlv-1) * 0.17 + attr[CommonFun.RoleData.EATTRTYPE_CRIRES] + attr[CommonFun.RoleData.EATTRTYPE_LUK] * 0.4
  elseif  classtype==11 then
  result[CommonFun.RoleData.EATTRTYPE_ATK]    = 168 + (petlv-1) * 12.19 + attr[CommonFun.RoleData.EATTRTYPE_ATK] + attr[CommonFun.RoleData.EATTRTYPE_STR] * 6.464 + attr[CommonFun.RoleData.EATTRTYPE_LUK] * 0.4 + attr[CommonFun.RoleData.EATTRTYPE_DEX] *0.4
  result[CommonFun.RoleData.EATTRTYPE_MATK]   = 18 + (petlv-1) * 1.34 + attr[CommonFun.RoleData.EATTRTYPE_MATK] + attr[CommonFun.RoleData.EATTRTYPE_INT] * 4.444
  result[CommonFun.RoleData.EATTRTYPE_DEF]    = 76 + (petlv-1) * 4.85 + attr[CommonFun.RoleData.EATTRTYPE_DEF] + attr[CommonFun.RoleData.EATTRTYPE_VIT] * 2
  result[CommonFun.RoleData.EATTRTYPE_MDEF]   = 52 + (petlv-1) *3 + attr[CommonFun.RoleData.EATTRTYPE_MDEF] + attr[CommonFun.RoleData.EATTRTYPE_INT] * 6 + attr[CommonFun.RoleData.EATTRTYPE_VIT] * 1
  result[CommonFun.RoleData.EATTRTYPE_MAXHP]  = (170 + (petlv-1) * 276.5 + attr[CommonFun.RoleData.EATTRTYPE_MAXHP]) * (1 + attr[CommonFun.RoleData.EATTRTYPE_VIT] / 50)
  result[CommonFun.RoleData.EATTRTYPE_HIT]    = 44 + (petlv-1) * 1.78 + attr[CommonFun.RoleData.EATTRTYPE_HIT] + attr[CommonFun.RoleData.EATTRTYPE_DEX] * 2
  result[CommonFun.RoleData.EATTRTYPE_FLEE]   = 126 + (petlv-1) * 0.57 + attr[CommonFun.RoleData.EATTRTYPE_FLEE] + attr[CommonFun.RoleData.EATTRTYPE_AGI] * 2
  result[CommonFun.RoleData.EATTRTYPE_CRI]    = 12.8 + (petlv-1) * 0.2 + attr[CommonFun.RoleData.EATTRTYPE_CRI] + attr[CommonFun.RoleData.EATTRTYPE_LUK] * 0.67
  result[CommonFun.RoleData.EATTRTYPE_CRIRES] = 11.7 + (petlv-1) * 0.12 + attr[CommonFun.RoleData.EATTRTYPE_CRIRES] + attr[CommonFun.RoleData.EATTRTYPE_LUK] * 0.4
  elseif classtype==12 then
  result[CommonFun.RoleData.EATTRTYPE_ATK]    = 216 + (petlv-1) * 15.7 + attr[CommonFun.RoleData.EATTRTYPE_ATK] + attr[CommonFun.RoleData.EATTRTYPE_STR] * 6.464 + attr[CommonFun.RoleData.EATTRTYPE_LUK] * 0.4 + attr[CommonFun.RoleData.EATTRTYPE_DEX] *0.4
  result[CommonFun.RoleData.EATTRTYPE_MATK]   = 18 + (petlv-1) * 1.78 + attr[CommonFun.RoleData.EATTRTYPE_MATK] + attr[CommonFun.RoleData.EATTRTYPE_INT] * 4.444
  result[CommonFun.RoleData.EATTRTYPE_DEF]    = 94 + (petlv-1) * 6.19 + attr[CommonFun.RoleData.EATTRTYPE_DEF] + attr[CommonFun.RoleData.EATTRTYPE_VIT] * 2
  result[CommonFun.RoleData.EATTRTYPE_MDEF]   = 64 + (petlv-1) * 3.82+ attr[CommonFun.RoleData.EATTRTYPE_MDEF] + attr[CommonFun.RoleData.EATTRTYPE_INT] * 6 + attr[CommonFun.RoleData.EATTRTYPE_VIT] * 1
  result[CommonFun.RoleData.EATTRTYPE_MAXHP]  = (190 + (petlv-1) * 343.02 + attr[CommonFun.RoleData.EATTRTYPE_MAXHP]) * (1 + attr[CommonFun.RoleData.EATTRTYPE_VIT] / 50)
  result[CommonFun.RoleData.EATTRTYPE_HIT]    = 50 + (petlv-1) * 2.29 + attr[CommonFun.RoleData.EATTRTYPE_HIT] + attr[CommonFun.RoleData.EATTRTYPE_DEX] * 2
  result[CommonFun.RoleData.EATTRTYPE_FLEE]   = 26 + (petlv-1) * 0.76 + attr[CommonFun.RoleData.EATTRTYPE_FLEE] + attr[CommonFun.RoleData.EATTRTYPE_AGI] * 2
  result[CommonFun.RoleData.EATTRTYPE_CRI]    = 13.6 + (petlv-1) * 0.26 + attr[CommonFun.RoleData.EATTRTYPE_CRI] + attr[CommonFun.RoleData.EATTRTYPE_LUK] * 0.67
  result[CommonFun.RoleData.EATTRTYPE_CRIRES] = 12.2 + (petlv-1) * 0.15 + attr[CommonFun.RoleData.EATTRTYPE_CRIRES] + attr[CommonFun.RoleData.EATTRTYPE_LUK] * 0.4
  elseif classtype==13 then
  result[CommonFun.RoleData.EATTRTYPE_ATK]    = 276 + (petlv-1) * 20.04 + attr[CommonFun.RoleData.EATTRTYPE_ATK] + attr[CommonFun.RoleData.EATTRTYPE_STR] * 6.464 + attr[CommonFun.RoleData.EATTRTYPE_LUK] * 0.4 + attr[CommonFun.RoleData.EATTRTYPE_DEX] *0.4
  result[CommonFun.RoleData.EATTRTYPE_MATK]   = 30 + (petlv-1) * 2.17 + attr[CommonFun.RoleData.EATTRTYPE_MATK] + attr[CommonFun.RoleData.EATTRTYPE_INT] * 4.444
  result[CommonFun.RoleData.EATTRTYPE_DEF]    = 118 + (petlv-1) * 7.91 + attr[CommonFun.RoleData.EATTRTYPE_DEF] + attr[CommonFun.RoleData.EATTRTYPE_VIT] * 2
  result[CommonFun.RoleData.EATTRTYPE_MDEF]   = 76 + (petlv-1) * 4.97 + attr[CommonFun.RoleData.EATTRTYPE_MDEF] + attr[CommonFun.RoleData.EATTRTYPE_INT] * 6 + attr[CommonFun.RoleData.EATTRTYPE_VIT] * 1
  result[CommonFun.RoleData.EATTRTYPE_MAXHP]  = (214 + (petlv-1) * 426.19 + attr[CommonFun.RoleData.EATTRTYPE_MAXHP]) * (1 + attr[CommonFun.RoleData.EATTRTYPE_VIT] / 50)
  result[CommonFun.RoleData.EATTRTYPE_HIT]    = 56 + (petlv-1) * 3 + attr[CommonFun.RoleData.EATTRTYPE_HIT] + attr[CommonFun.RoleData.EATTRTYPE_DEX] * 2
  result[CommonFun.RoleData.EATTRTYPE_FLEE]   = 32 + (petlv-1) * 0.95 + attr[CommonFun.RoleData.EATTRTYPE_FLEE] + attr[CommonFun.RoleData.EATTRTYPE_AGI] * 2
  result[CommonFun.RoleData.EATTRTYPE_CRI]    = 14.6 + (petlv-1) * 0.33 + attr[CommonFun.RoleData.EATTRTYPE_CRI] + attr[CommonFun.RoleData.EATTRTYPE_LUK] * 0.67
  result[CommonFun.RoleData.EATTRTYPE_CRIRES] = 12.8 + (petlv-1) * 0.19 + attr[CommonFun.RoleData.EATTRTYPE_CRIRES] + attr[CommonFun.RoleData.EATTRTYPE_LUK] * 0.4
  elseif classtype==14 then
  result[CommonFun.RoleData.EATTRTYPE_ATK]    = 360 + (petlv-1) * 26.17 + attr[CommonFun.RoleData.EATTRTYPE_ATK] + attr[CommonFun.RoleData.EATTRTYPE_STR] * 6.464 + attr[CommonFun.RoleData.EATTRTYPE_LUK] * 0.4 + attr[CommonFun.RoleData.EATTRTYPE_DEX] *0.4
  result[CommonFun.RoleData.EATTRTYPE_MATK]   = 36 + (petlv-1) * 2.87 + attr[CommonFun.RoleData.EATTRTYPE_MATK] + attr[CommonFun.RoleData.EATTRTYPE_INT] * 4.444
  result[CommonFun.RoleData.EATTRTYPE_DEF]    = 154 + (petlv-1) * 10.34 + attr[CommonFun.RoleData.EATTRTYPE_DEF] + attr[CommonFun.RoleData.EATTRTYPE_VIT] * 2
  result[CommonFun.RoleData.EATTRTYPE_MDEF]   = 100 + (petlv-1) * 6.44 + attr[CommonFun.RoleData.EATTRTYPE_MDEF] + attr[CommonFun.RoleData.EATTRTYPE_INT] * 6 + attr[CommonFun.RoleData.EATTRTYPE_VIT] * 1
  result[CommonFun.RoleData.EATTRTYPE_MAXHP]  = (248 + (petlv-1) * 542.6 + attr[CommonFun.RoleData.EATTRTYPE_MAXHP]) * (1 + attr[CommonFun.RoleData.EATTRTYPE_VIT] / 50)
  result[CommonFun.RoleData.EATTRTYPE_HIT]    = 74 + (petlv-1) * 3.82 + attr[CommonFun.RoleData.EATTRTYPE_HIT] + attr[CommonFun.RoleData.EATTRTYPE_DEX] * 2
  result[CommonFun.RoleData.EATTRTYPE_FLEE]   = 38 + (petlv-1) * 1.27 + attr[CommonFun.RoleData.EATTRTYPE_FLEE] + attr[CommonFun.RoleData.EATTRTYPE_AGI] * 2
  result[CommonFun.RoleData.EATTRTYPE_CRI]    = 16.1 + (petlv-1) * 0.43 + attr[CommonFun.RoleData.EATTRTYPE_CRI] + attr[CommonFun.RoleData.EATTRTYPE_LUK] * 0.67
  result[CommonFun.RoleData.EATTRTYPE_CRIRES] = 13.6 + (petlv-1) * 0.25 + attr[CommonFun.RoleData.EATTRTYPE_CRIRES] + attr[CommonFun.RoleData.EATTRTYPE_LUK] * 0.4
  elseif classtype==21 then
  result[CommonFun.RoleData.EATTRTYPE_ATK]    = 42 + (petlv-1) * 3 + attr[CommonFun.RoleData.EATTRTYPE_ATK] + attr[CommonFun.RoleData.EATTRTYPE_STR] * 6.464 + attr[CommonFun.RoleData.EATTRTYPE_LUK] * 0.4 + attr[CommonFun.RoleData.EATTRTYPE_DEX] *0.4
  result[CommonFun.RoleData.EATTRTYPE_MATK]   = 144 + (petlv-1) * 10.78 + attr[CommonFun.RoleData.EATTRTYPE_MATK] + attr[CommonFun.RoleData.EATTRTYPE_INT] * 4.444
  result[CommonFun.RoleData.EATTRTYPE_DEF]    = 16 + (petlv-1) * 0.57 + attr[CommonFun.RoleData.EATTRTYPE_DEF] + attr[CommonFun.RoleData.EATTRTYPE_VIT] * 2
  result[CommonFun.RoleData.EATTRTYPE_MDEF]   = 76 + (petlv-1) * 5.17 + attr[CommonFun.RoleData.EATTRTYPE_MDEF] + attr[CommonFun.RoleData.EATTRTYPE_INT] * 6 + attr[CommonFun.RoleData.EATTRTYPE_VIT] * 1
  result[CommonFun.RoleData.EATTRTYPE_MAXHP]  = (110 + (petlv-1) * 72.76 + attr[CommonFun.RoleData.EATTRTYPE_MAXHP]) * (1 + attr[CommonFun.RoleData.EATTRTYPE_VIT] / 50)
  result[CommonFun.RoleData.EATTRTYPE_HIT]    = 86 + (petlv-1) * 4.85 + attr[CommonFun.RoleData.EATTRTYPE_HIT] + attr[CommonFun.RoleData.EATTRTYPE_DEX] * 2
  result[CommonFun.RoleData.EATTRTYPE_FLEE]   = 26 + (petlv-1) * 0.57 + attr[CommonFun.RoleData.EATTRTYPE_FLEE] + attr[CommonFun.RoleData.EATTRTYPE_AGI] * 2
  result[CommonFun.RoleData.EATTRTYPE_CRI]    = 12.8 + (petlv-1) * 0.2 + attr[CommonFun.RoleData.EATTRTYPE_CRI] + attr[CommonFun.RoleData.EATTRTYPE_LUK] * 0.67
  result[CommonFun.RoleData.EATTRTYPE_CRIRES] = 11.7 + (petlv-1) * 0.12 + attr[CommonFun.RoleData.EATTRTYPE_CRIRES] + attr[CommonFun.RoleData.EATTRTYPE_LUK] * 0.4
  elseif classtype==22 then
  result[CommonFun.RoleData.EATTRTYPE_ATK]    = 54 + (petlv-1) * 3.89 + attr[CommonFun.RoleData.EATTRTYPE_ATK] + attr[CommonFun.RoleData.EATTRTYPE_STR] * 6.464 + attr[CommonFun.RoleData.EATTRTYPE_LUK] * 0.4 + attr[CommonFun.RoleData.EATTRTYPE_DEX] *0.4
  result[CommonFun.RoleData.EATTRTYPE_MATK]   = 186 + (petlv-1) * 13.85 + attr[CommonFun.RoleData.EATTRTYPE_MATK] + attr[CommonFun.RoleData.EATTRTYPE_INT] * 4.444
  result[CommonFun.RoleData.EATTRTYPE_DEF]    = 16 + (petlv-1) * 0.76 + attr[CommonFun.RoleData.EATTRTYPE_DEF] + attr[CommonFun.RoleData.EATTRTYPE_VIT] * 2
  result[CommonFun.RoleData.EATTRTYPE_MDEF]   = 100 + (petlv-1) * 6.57 + attr[CommonFun.RoleData.EATTRTYPE_MDEF] + attr[CommonFun.RoleData.EATTRTYPE_INT] * 6 + attr[CommonFun.RoleData.EATTRTYPE_VIT] * 1
  result[CommonFun.RoleData.EATTRTYPE_MAXHP]  = (113 + (petlv-1) * 81.07 + attr[CommonFun.RoleData.EATTRTYPE_MAXHP]) * (1 + attr[CommonFun.RoleData.EATTRTYPE_VIT] / 50)
  result[CommonFun.RoleData.EATTRTYPE_HIT]    = 104 + (petlv-1) * 6.19 + attr[CommonFun.RoleData.EATTRTYPE_HIT] + attr[CommonFun.RoleData.EATTRTYPE_DEX] * 2
  result[CommonFun.RoleData.EATTRTYPE_FLEE]   = 26 + (petlv-1) * 0.76 + attr[CommonFun.RoleData.EATTRTYPE_FLEE] + attr[CommonFun.RoleData.EATTRTYPE_AGI] * 2
  result[CommonFun.RoleData.EATTRTYPE_CRI]    = 13.6 + (petlv-1) * 0.26 + attr[CommonFun.RoleData.EATTRTYPE_CRI] + attr[CommonFun.RoleData.EATTRTYPE_LUK] * 0.67
  result[CommonFun.RoleData.EATTRTYPE_CRIRES] = 12.2 + (petlv-1) * 0.15 + attr[CommonFun.RoleData.EATTRTYPE_CRIRES] + attr[CommonFun.RoleData.EATTRTYPE_LUK] * 0.4
  elseif classtype==23 then
  result[CommonFun.RoleData.EATTRTYPE_ATK]    = 66 + (petlv-1) * 4.97 + attr[CommonFun.RoleData.EATTRTYPE_ATK] + attr[CommonFun.RoleData.EATTRTYPE_STR] * 6.464 + attr[CommonFun.RoleData.EATTRTYPE_LUK] * 0.4 + attr[CommonFun.RoleData.EATTRTYPE_DEX] *0.4
  result[CommonFun.RoleData.EATTRTYPE_MATK]   = 240 + (petlv-1) * 17.68 + attr[CommonFun.RoleData.EATTRTYPE_MATK] + attr[CommonFun.RoleData.EATTRTYPE_INT] * 4.444
  result[CommonFun.RoleData.EATTRTYPE_DEF]    = 22 + (petlv-1) * 0.95 + attr[CommonFun.RoleData.EATTRTYPE_DEF] + attr[CommonFun.RoleData.EATTRTYPE_VIT] * 2
  result[CommonFun.RoleData.EATTRTYPE_MDEF]   = 124 + (petlv-1) * 8.42 + attr[CommonFun.RoleData.EATTRTYPE_MDEF] + attr[CommonFun.RoleData.EATTRTYPE_INT] * 6 + attr[CommonFun.RoleData.EATTRTYPE_VIT] * 1
  result[CommonFun.RoleData.EATTRTYPE_MAXHP]  = (116 + (petlv-1) * 91.46 + attr[CommonFun.RoleData.EATTRTYPE_MAXHP]) * (1 + attr[CommonFun.RoleData.EATTRTYPE_VIT] / 50)
  result[CommonFun.RoleData.EATTRTYPE_HIT]    = 128 + (petlv-1) * 7.91 + attr[CommonFun.RoleData.EATTRTYPE_HIT] + attr[CommonFun.RoleData.EATTRTYPE_DEX] * 2
  result[CommonFun.RoleData.EATTRTYPE_FLEE]   = 32 + (petlv-1) * 0.95 + attr[CommonFun.RoleData.EATTRTYPE_FLEE] + attr[CommonFun.RoleData.EATTRTYPE_AGI] * 2
  result[CommonFun.RoleData.EATTRTYPE_CRI]    = 14.6 + (petlv-1) * 0.33 + attr[CommonFun.RoleData.EATTRTYPE_CRI] + attr[CommonFun.RoleData.EATTRTYPE_LUK] * 0.67
  result[CommonFun.RoleData.EATTRTYPE_CRIRES] = 12.8 + (petlv-1) * 0.19 + attr[CommonFun.RoleData.EATTRTYPE_CRIRES] + attr[CommonFun.RoleData.EATTRTYPE_LUK] * 0.4
  elseif classtype==24 then
  result[CommonFun.RoleData.EATTRTYPE_ATK]    = 90 + (petlv-1) * 6.51 + attr[CommonFun.RoleData.EATTRTYPE_ATK] + attr[CommonFun.RoleData.EATTRTYPE_STR] * 6.464 + attr[CommonFun.RoleData.EATTRTYPE_LUK] * 0.4 + attr[CommonFun.RoleData.EATTRTYPE_DEX] *0.4
  result[CommonFun.RoleData.EATTRTYPE_MATK]   = 318 + (petlv-1) * 23.04 + attr[CommonFun.RoleData.EATTRTYPE_MATK] + attr[CommonFun.RoleData.EATTRTYPE_INT] * 4.444
  result[CommonFun.RoleData.EATTRTYPE_DEF]    = 28 + (petlv-1) * 1.27 + attr[CommonFun.RoleData.EATTRTYPE_DEF] + attr[CommonFun.RoleData.EATTRTYPE_VIT] * 2
  result[CommonFun.RoleData.EATTRTYPE_MDEF]   = 160 + (petlv-1) * 11.04 + attr[CommonFun.RoleData.EATTRTYPE_MDEF] + attr[CommonFun.RoleData.EATTRTYPE_INT] * 6 + attr[CommonFun.RoleData.EATTRTYPE_VIT] * 1
  result[CommonFun.RoleData.EATTRTYPE_MAXHP]  = (120 + (petlv-1) * 106.02 + attr[CommonFun.RoleData.EATTRTYPE_MAXHP]) * (1 + attr[CommonFun.RoleData.EATTRTYPE_VIT] / 50)
  result[CommonFun.RoleData.EATTRTYPE_HIT]    = 164 + (petlv-1) * 10.34+ attr[CommonFun.RoleData.EATTRTYPE_HIT] + attr[CommonFun.RoleData.EATTRTYPE_DEX] * 2
  result[CommonFun.RoleData.EATTRTYPE_FLEE]   = 38 + (petlv-1) * 1.27 + attr[CommonFun.RoleData.EATTRTYPE_FLEE] + attr[CommonFun.RoleData.EATTRTYPE_AGI] * 2
  result[CommonFun.RoleData.EATTRTYPE_CRI]    = 16.1 + (petlv-1) * 0.43 + attr[CommonFun.RoleData.EATTRTYPE_CRI] + attr[CommonFun.RoleData.EATTRTYPE_LUK] * 0.67
  result[CommonFun.RoleData.EATTRTYPE_CRIRES] = 13.6 + (petlv-1) * 0.25 + attr[CommonFun.RoleData.EATTRTYPE_CRIRES] + attr[CommonFun.RoleData.EATTRTYPE_LUK] * 0.4
  elseif classtype==31 then
  result[CommonFun.RoleData.EATTRTYPE_ATK]    = 222 + (petlv-1) * 16.08 + attr[CommonFun.RoleData.EATTRTYPE_ATK] + attr[CommonFun.RoleData.EATTRTYPE_STR] * 6.464 + attr[CommonFun.RoleData.EATTRTYPE_LUK] * 0.4 + attr[CommonFun.RoleData.EATTRTYPE_DEX] *0.4
  result[CommonFun.RoleData.EATTRTYPE_MATK]   = 18 + (petlv-1) * 1.34 + attr[CommonFun.RoleData.EATTRTYPE_MATK] + attr[CommonFun.RoleData.EATTRTYPE_INT] * 4.444
  result[CommonFun.RoleData.EATTRTYPE_DEF]    = 16 + (petlv-1) * 0.57 + attr[CommonFun.RoleData.EATTRTYPE_DEF] + attr[CommonFun.RoleData.EATTRTYPE_VIT] * 2
  result[CommonFun.RoleData.EATTRTYPE_MDEF]   = 22 + (petlv-1) * 0.89 + attr[CommonFun.RoleData.EATTRTYPE_MDEF] + attr[CommonFun.RoleData.EATTRTYPE_INT] * 6 + attr[CommonFun.RoleData.EATTRTYPE_VIT] * 1
  result[CommonFun.RoleData.EATTRTYPE_MAXHP]  = (110 + (petlv-1) * 72.76 + attr[CommonFun.RoleData.EATTRTYPE_MAXHP]) * (1 + attr[CommonFun.RoleData.EATTRTYPE_VIT] / 50)
  result[CommonFun.RoleData.EATTRTYPE_HIT]    = 32 + (petlv-1) * 1.21 + attr[CommonFun.RoleData.EATTRTYPE_HIT] + attr[CommonFun.RoleData.EATTRTYPE_DEX] * 2
  result[CommonFun.RoleData.EATTRTYPE_FLEE]   = 68 + (petlv-1) * 3.63 + attr[CommonFun.RoleData.EATTRTYPE_FLEE] + attr[CommonFun.RoleData.EATTRTYPE_AGI] * 2
  result[CommonFun.RoleData.EATTRTYPE_CRI]    = 15.64 + (petlv-1) * 0.4 + attr[CommonFun.RoleData.EATTRTYPE_CRI] + attr[CommonFun.RoleData.EATTRTYPE_LUK] * 0.67
  result[CommonFun.RoleData.EATTRTYPE_CRIRES] = 13.36 + (petlv-1) * 0.24 + attr[CommonFun.RoleData.EATTRTYPE_CRIRES] + attr[CommonFun.RoleData.EATTRTYPE_LUK] * 0.4
  elseif classtype==32 then
  result[CommonFun.RoleData.EATTRTYPE_ATK]    = 282 + (petlv-1) * 20.74 + attr[CommonFun.RoleData.EATTRTYPE_ATK] + attr[CommonFun.RoleData.EATTRTYPE_STR] * 6.464 + attr[CommonFun.RoleData.EATTRTYPE_LUK] * 0.4 + attr[CommonFun.RoleData.EATTRTYPE_DEX] *0.4
  result[CommonFun.RoleData.EATTRTYPE_MATK]   = 18 + (petlv-1) * 1.78 + attr[CommonFun.RoleData.EATTRTYPE_MATK] + attr[CommonFun.RoleData.EATTRTYPE_INT] * 4.444
  result[CommonFun.RoleData.EATTRTYPE_DEF]    = 16 + (petlv-1) * 0.76 + attr[CommonFun.RoleData.EATTRTYPE_DEF] + attr[CommonFun.RoleData.EATTRTYPE_VIT] * 2
  result[CommonFun.RoleData.EATTRTYPE_MDEF]   = 22 + (petlv-1) * 1.14 + attr[CommonFun.RoleData.EATTRTYPE_MDEF] + attr[CommonFun.RoleData.EATTRTYPE_INT] * 6 + attr[CommonFun.RoleData.EATTRTYPE_VIT] * 1
  result[CommonFun.RoleData.EATTRTYPE_MAXHP]  = (113 + (petlv-1) * 81.07 + attr[CommonFun.RoleData.EATTRTYPE_MAXHP]) * (1 + attr[CommonFun.RoleData.EATTRTYPE_VIT] / 50)
  result[CommonFun.RoleData.EATTRTYPE_HIT]    = 38 + (petlv-1) * 1.53 + attr[CommonFun.RoleData.EATTRTYPE_HIT] + attr[CommonFun.RoleData.EATTRTYPE_DEX] * 2
  result[CommonFun.RoleData.EATTRTYPE_FLEE]   = 80 + (petlv-1) * 4.65 + attr[CommonFun.RoleData.EATTRTYPE_FLEE] + attr[CommonFun.RoleData.EATTRTYPE_AGI] * 2
  result[CommonFun.RoleData.EATTRTYPE_CRI]    = 17.26 + (petlv-1) * 0.52 + attr[CommonFun.RoleData.EATTRTYPE_CRI] + attr[CommonFun.RoleData.EATTRTYPE_LUK] * 0.67
  result[CommonFun.RoleData.EATTRTYPE_CRIRES] = 14.32 + (petlv-1) * 0.31 + attr[CommonFun.RoleData.EATTRTYPE_CRIRES] + attr[CommonFun.RoleData.EATTRTYPE_LUK] * 0.4
  elseif classtype==33 then
  result[CommonFun.RoleData.EATTRTYPE_ATK]    = 366 + (petlv-1) * 26.48 + attr[CommonFun.RoleData.EATTRTYPE_ATK] + attr[CommonFun.RoleData.EATTRTYPE_STR] * 6.464 + attr[CommonFun.RoleData.EATTRTYPE_LUK] * 0.4 + attr[CommonFun.RoleData.EATTRTYPE_DEX] *0.4
  result[CommonFun.RoleData.EATTRTYPE_MATK]   = 30 + (petlv-1) * 2.17 + attr[CommonFun.RoleData.EATTRTYPE_MATK] + attr[CommonFun.RoleData.EATTRTYPE_INT] * 4.444
  result[CommonFun.RoleData.EATTRTYPE_DEF]    = 22 + (petlv-1) * 0.95 + attr[CommonFun.RoleData.EATTRTYPE_DEF] + attr[CommonFun.RoleData.EATTRTYPE_VIT] * 2
  result[CommonFun.RoleData.EATTRTYPE_MDEF]   = 28 + (petlv-1) * 1.46 + attr[CommonFun.RoleData.EATTRTYPE_MDEF] + attr[CommonFun.RoleData.EATTRTYPE_INT] * 6 + attr[CommonFun.RoleData.EATTRTYPE_VIT] * 1
  result[CommonFun.RoleData.EATTRTYPE_MAXHP]  = (116 + (petlv-1) * 91.46 + attr[CommonFun.RoleData.EATTRTYPE_MAXHP]) * (1 + attr[CommonFun.RoleData.EATTRTYPE_VIT] / 50)
  result[CommonFun.RoleData.EATTRTYPE_HIT]    = 44 + (petlv-1) * 1.97 + attr[CommonFun.RoleData.EATTRTYPE_HIT] + attr[CommonFun.RoleData.EATTRTYPE_DEX] * 2
  result[CommonFun.RoleData.EATTRTYPE_FLEE]   = 98 + (petlv-1) * 6 + attr[CommonFun.RoleData.EATTRTYPE_FLEE] + attr[CommonFun.RoleData.EATTRTYPE_AGI] * 2
  result[CommonFun.RoleData.EATTRTYPE_CRI]    = 19.24 + (petlv-1) * 0.66 + attr[CommonFun.RoleData.EATTRTYPE_CRI] + attr[CommonFun.RoleData.EATTRTYPE_LUK] * 0.67
  result[CommonFun.RoleData.EATTRTYPE_CRIRES] = 15.52 + (petlv-1) * 0.39 + attr[CommonFun.RoleData.EATTRTYPE_CRIRES] + attr[CommonFun.RoleData.EATTRTYPE_LUK] * 0.4
  elseif classtype==34 then
  result[CommonFun.RoleData.EATTRTYPE_ATK]    = 474 + (petlv-1) * 34.59 + attr[CommonFun.RoleData.EATTRTYPE_ATK] + attr[CommonFun.RoleData.EATTRTYPE_STR] * 6.464 + attr[CommonFun.RoleData.EATTRTYPE_LUK] * 0.4 + attr[CommonFun.RoleData.EATTRTYPE_DEX] *0.4
  result[CommonFun.RoleData.EATTRTYPE_MATK]   = 36 + (petlv-1) * 2.87 + attr[CommonFun.RoleData.EATTRTYPE_MATK] + attr[CommonFun.RoleData.EATTRTYPE_INT] * 4.444
  result[CommonFun.RoleData.EATTRTYPE_DEF]    = 28 + (petlv-1) * 1.27 + attr[CommonFun.RoleData.EATTRTYPE_DEF] + attr[CommonFun.RoleData.EATTRTYPE_VIT] * 2
  result[CommonFun.RoleData.EATTRTYPE_MDEF]   = 34 + (petlv-1) * 1.91 + attr[CommonFun.RoleData.EATTRTYPE_MDEF] + attr[CommonFun.RoleData.EATTRTYPE_INT] * 6 + attr[CommonFun.RoleData.EATTRTYPE_VIT] * 1
  result[CommonFun.RoleData.EATTRTYPE_MAXHP]  = (120 + (petlv-1) * 106.02 + attr[CommonFun.RoleData.EATTRTYPE_MAXHP]) * (1 + attr[CommonFun.RoleData.EATTRTYPE_VIT] / 50)
  result[CommonFun.RoleData.EATTRTYPE_HIT]    = 56 + (petlv-1) * 2.55 + attr[CommonFun.RoleData.EATTRTYPE_HIT] + attr[CommonFun.RoleData.EATTRTYPE_DEX] * 2
  result[CommonFun.RoleData.EATTRTYPE_FLEE]   = 128 + (petlv-1) * 7.72 + attr[CommonFun.RoleData.EATTRTYPE_FLEE] + attr[CommonFun.RoleData.EATTRTYPE_AGI] * 2
  result[CommonFun.RoleData.EATTRTYPE_CRI]    = 22.06 + (petlv-1) * 0.86 + attr[CommonFun.RoleData.EATTRTYPE_CRI] + attr[CommonFun.RoleData.EATTRTYPE_LUK] * 0.67
  result[CommonFun.RoleData.EATTRTYPE_CRIRES] = 17.2 + (petlv-1) * 0.51 + attr[CommonFun.RoleData.EATTRTYPE_CRIRES] + attr[CommonFun.RoleData.EATTRTYPE_LUK] * 0.4
  elseif classtype==41 then
  result[CommonFun.RoleData.EATTRTYPE_ATK]    = 156 + (petlv-1) * 11.23 + attr[CommonFun.RoleData.EATTRTYPE_ATK] + attr[CommonFun.RoleData.EATTRTYPE_DEX] * 4.04 + attr[CommonFun.RoleData.EATTRTYPE_LUK] * 0.4 + attr[CommonFun.RoleData.EATTRTYPE_STR] * 0.4
  result[CommonFun.RoleData.EATTRTYPE_MATK]   = 18 + (petlv-1) * 1.34 + attr[CommonFun.RoleData.EATTRTYPE_MATK] + attr[CommonFun.RoleData.EATTRTYPE_INT] * 4.444
  result[CommonFun.RoleData.EATTRTYPE_DEF]    = 16 + (petlv-1) * 0.57 + attr[CommonFun.RoleData.EATTRTYPE_DEF] + attr[CommonFun.RoleData.EATTRTYPE_VIT] * 2
  result[CommonFun.RoleData.EATTRTYPE_MDEF]   = 22 + (petlv-1) * 0.89 + attr[CommonFun.RoleData.EATTRTYPE_MDEF] + attr[CommonFun.RoleData.EATTRTYPE_INT] * 6 + attr[CommonFun.RoleData.EATTRTYPE_VIT] * 1
  result[CommonFun.RoleData.EATTRTYPE_MAXHP]  = (110 + (petlv-1) * 72.76 + attr[CommonFun.RoleData.EATTRTYPE_MAXHP]) * (1 + attr[CommonFun.RoleData.EATTRTYPE_VIT] / 50)
  result[CommonFun.RoleData.EATTRTYPE_HIT]    = 86 + (petlv-1) * 4.85 + attr[CommonFun.RoleData.EATTRTYPE_HIT] + attr[CommonFun.RoleData.EATTRTYPE_DEX] * 2
  result[CommonFun.RoleData.EATTRTYPE_FLEE]   = 68 + (petlv-1) * 3.63 + attr[CommonFun.RoleData.EATTRTYPE_FLEE] + attr[CommonFun.RoleData.EATTRTYPE_AGI] * 2
  result[CommonFun.RoleData.EATTRTYPE_CRI]    = 18.46 + (petlv-1) * 0.6 + attr[CommonFun.RoleData.EATTRTYPE_CRI] + attr[CommonFun.RoleData.EATTRTYPE_LUK] * 0.67
  result[CommonFun.RoleData.EATTRTYPE_CRIRES] = 15.04 + (petlv-1) * 0.36 + attr[CommonFun.RoleData.EATTRTYPE_CRIRES] + attr[CommonFun.RoleData.EATTRTYPE_LUK] * 0.4
  elseif classtype==42 then
  result[CommonFun.RoleData.EATTRTYPE_ATK]    = 198 + (petlv-1) * 14.42 + attr[CommonFun.RoleData.EATTRTYPE_ATK] + attr[CommonFun.RoleData.EATTRTYPE_DEX] * 4.444 + attr[CommonFun.RoleData.EATTRTYPE_LUK] * 0.4 + attr[CommonFun.RoleData.EATTRTYPE_STR] * 0.4
  result[CommonFun.RoleData.EATTRTYPE_MATK]   = 18 + (petlv-1) * 1.78 + attr[CommonFun.RoleData.EATTRTYPE_MATK] + attr[CommonFun.RoleData.EATTRTYPE_INT] * 4.444
  result[CommonFun.RoleData.EATTRTYPE_DEF]    = 16 + (petlv-1) * 0.76 + attr[CommonFun.RoleData.EATTRTYPE_DEF] + attr[CommonFun.RoleData.EATTRTYPE_VIT] * 2
  result[CommonFun.RoleData.EATTRTYPE_MDEF]   = 22 + (petlv-1) * 1.14 + attr[CommonFun.RoleData.EATTRTYPE_MDEF] + attr[CommonFun.RoleData.EATTRTYPE_INT] * 6 + attr[CommonFun.RoleData.EATTRTYPE_VIT] * 1
  result[CommonFun.RoleData.EATTRTYPE_MAXHP]  = (113 + (petlv-1) * 81.07 + attr[CommonFun.RoleData.EATTRTYPE_MAXHP]) * (1 + attr[CommonFun.RoleData.EATTRTYPE_VIT] / 50)
  result[CommonFun.RoleData.EATTRTYPE_HIT]    = 104 + (petlv-1) * 6.19 + attr[CommonFun.RoleData.EATTRTYPE_HIT] + attr[CommonFun.RoleData.EATTRTYPE_DEX] * 2
  result[CommonFun.RoleData.EATTRTYPE_FLEE]   = 80 + (petlv-1) * 4.65 + attr[CommonFun.RoleData.EATTRTYPE_FLEE] + attr[CommonFun.RoleData.EATTRTYPE_AGI] * 2
  result[CommonFun.RoleData.EATTRTYPE_CRI]    = 20.86 + (petlv-1) * 0.78 + attr[CommonFun.RoleData.EATTRTYPE_CRI] + attr[CommonFun.RoleData.EATTRTYPE_LUK] * 0.67
  result[CommonFun.RoleData.EATTRTYPE_CRIRES] = 16.48 + (petlv-1) * 0.46 + attr[CommonFun.RoleData.EATTRTYPE_CRIRES] + attr[CommonFun.RoleData.EATTRTYPE_LUK] * 0.4
  elseif classtype==43 then
  result[CommonFun.RoleData.EATTRTYPE_ATK]    = 252 + (petlv-1) * 18.44 + attr[CommonFun.RoleData.EATTRTYPE_ATK] + attr[CommonFun.RoleData.EATTRTYPE_DEX] * 4.444 + attr[CommonFun.RoleData.EATTRTYPE_LUK] * 0.4 + attr[CommonFun.RoleData.EATTRTYPE_STR] * 0.4
  result[CommonFun.RoleData.EATTRTYPE_MATK]   = 30 + (petlv-1) * 2.17 + attr[CommonFun.RoleData.EATTRTYPE_MATK] + attr[CommonFun.RoleData.EATTRTYPE_INT] * 4.444
  result[CommonFun.RoleData.EATTRTYPE_DEF]    = 22 + (petlv-1) * 0.95 + attr[CommonFun.RoleData.EATTRTYPE_DEF] + attr[CommonFun.RoleData.EATTRTYPE_VIT] * 2
  result[CommonFun.RoleData.EATTRTYPE_MDEF]   = 28 + (petlv-1) *1.46 + attr[CommonFun.RoleData.EATTRTYPE_MDEF] + attr[CommonFun.RoleData.EATTRTYPE_INT] * 6 + attr[CommonFun.RoleData.EATTRTYPE_VIT] * 1
  result[CommonFun.RoleData.EATTRTYPE_MAXHP]  = (116 + (petlv-1) * 91.46 + attr[CommonFun.RoleData.EATTRTYPE_MAXHP]) * (1 + attr[CommonFun.RoleData.EATTRTYPE_VIT] / 50)
  result[CommonFun.RoleData.EATTRTYPE_HIT]    = 128 + (petlv-1) * 7.91 + attr[CommonFun.RoleData.EATTRTYPE_HIT] + attr[CommonFun.RoleData.EATTRTYPE_DEX] * 2
  result[CommonFun.RoleData.EATTRTYPE_FLEE]   = 98 + (petlv-1) * 6 + attr[CommonFun.RoleData.EATTRTYPE_FLEE] + attr[CommonFun.RoleData.EATTRTYPE_AGI] * 2
  result[CommonFun.RoleData.EATTRTYPE_CRI]    = 23.86 + (petlv-1) * 0.99 + attr[CommonFun.RoleData.EATTRTYPE_CRI] + attr[CommonFun.RoleData.EATTRTYPE_LUK] * 0.67
  result[CommonFun.RoleData.EATTRTYPE_CRIRES] = 18.28 + (petlv-1) * 0.59 + attr[CommonFun.RoleData.EATTRTYPE_CRIRES] + attr[CommonFun.RoleData.EATTRTYPE_LUK] * 0.4
  elseif classtype==44 then
  result[CommonFun.RoleData.EATTRTYPE_ATK]    = 330 + (petlv-1) * 24.06 + attr[CommonFun.RoleData.EATTRTYPE_ATK] + attr[CommonFun.RoleData.EATTRTYPE_DEX] * 4.444 + attr[CommonFun.RoleData.EATTRTYPE_LUK] * 0.4 + attr[CommonFun.RoleData.EATTRTYPE_STR] * 0.4
  result[CommonFun.RoleData.EATTRTYPE_MATK]   = 36 + (petlv-1) * 2.87 + attr[CommonFun.RoleData.EATTRTYPE_MATK] + attr[CommonFun.RoleData.EATTRTYPE_INT] * 4.444
  result[CommonFun.RoleData.EATTRTYPE_DEF]    = 28 + (petlv-1) * 1.27 + attr[CommonFun.RoleData.EATTRTYPE_DEF] + attr[CommonFun.RoleData.EATTRTYPE_VIT] * 2
  result[CommonFun.RoleData.EATTRTYPE_MDEF]   = 34 + (petlv-1) * 1.91 + attr[CommonFun.RoleData.EATTRTYPE_MDEF] + attr[CommonFun.RoleData.EATTRTYPE_INT] * 6 + attr[CommonFun.RoleData.EATTRTYPE_VIT] * 1
  result[CommonFun.RoleData.EATTRTYPE_MAXHP]  = (120 + (petlv-1) * 106.02 + attr[CommonFun.RoleData.EATTRTYPE_MAXHP]) * (1 + attr[CommonFun.RoleData.EATTRTYPE_VIT] / 50)
  result[CommonFun.RoleData.EATTRTYPE_HIT]    = 164 + (petlv-1) * 10.34 + attr[CommonFun.RoleData.EATTRTYPE_HIT] + attr[CommonFun.RoleData.EATTRTYPE_DEX] * 2
  result[CommonFun.RoleData.EATTRTYPE_FLEE]   = 128 + (petlv-1) * 7.72 + attr[CommonFun.RoleData.EATTRTYPE_FLEE] + attr[CommonFun.RoleData.EATTRTYPE_AGI] * 2
  result[CommonFun.RoleData.EATTRTYPE_CRI]    = 28.12 + (petlv-1) * 1.3 + attr[CommonFun.RoleData.EATTRTYPE_CRI] + attr[CommonFun.RoleData.EATTRTYPE_LUK] * 0.67
  result[CommonFun.RoleData.EATTRTYPE_CRIRES] = 20.8 + (petlv-1) * 0.77 + attr[CommonFun.RoleData.EATTRTYPE_CRIRES] + attr[CommonFun.RoleData.EATTRTYPE_LUK] * 0.4
  elseif classtype==51 then
  result[CommonFun.RoleData.EATTRTYPE_ATK]    = 30 + (petlv-1) * 2.42 + attr[CommonFun.RoleData.EATTRTYPE_ATK] + attr[CommonFun.RoleData.EATTRTYPE_STR] * 6.464 + attr[CommonFun.RoleData.EATTRTYPE_LUK] * 0.4 + attr[CommonFun.RoleData.EATTRTYPE_DEX] *0.4
  result[CommonFun.RoleData.EATTRTYPE_MATK]   = 144 + (petlv-1) * 10.78 + attr[CommonFun.RoleData.EATTRTYPE_MATK] + attr[CommonFun.RoleData.EATTRTYPE_INT] * 4.444
  result[CommonFun.RoleData.EATTRTYPE_DEF]    = 58 + (petlv-1) * 3.63 + attr[CommonFun.RoleData.EATTRTYPE_DEF] + attr[CommonFun.RoleData.EATTRTYPE_VIT] * 2
  result[CommonFun.RoleData.EATTRTYPE_MDEF]   = 100 + (petlv-1) * 6.63 + attr[CommonFun.RoleData.EATTRTYPE_MDEF] + attr[CommonFun.RoleData.EATTRTYPE_INT] * 6 + attr[CommonFun.RoleData.EATTRTYPE_VIT] * 1
  result[CommonFun.RoleData.EATTRTYPE_MAXHP]  = (153 + (petlv-1) * 218.28 + attr[CommonFun.RoleData.EATTRTYPE_MAXHP]) * (1 + attr[CommonFun.RoleData.EATTRTYPE_VIT] / 50)
  result[CommonFun.RoleData.EATTRTYPE_HIT]    = 44 + (petlv-1) * 1.78 + attr[CommonFun.RoleData.EATTRTYPE_HIT] + attr[CommonFun.RoleData.EATTRTYPE_DEX] * 2
  result[CommonFun.RoleData.EATTRTYPE_FLEE]   = 26 + (petlv-1) * 0.57 + attr[CommonFun.RoleData.EATTRTYPE_FLEE] + attr[CommonFun.RoleData.EATTRTYPE_AGI] * 2
  result[CommonFun.RoleData.EATTRTYPE_CRI]    = 12.8 + (petlv-1) * 0.2 + attr[CommonFun.RoleData.EATTRTYPE_CRI] + attr[CommonFun.RoleData.EATTRTYPE_LUK] * 0.67
  result[CommonFun.RoleData.EATTRTYPE_CRIRES] = 11.7 + (petlv-1) * 0.12 + attr[CommonFun.RoleData.EATTRTYPE_CRIRES] + attr[CommonFun.RoleData.EATTRTYPE_LUK] * 0.4
  elseif classtype==52 then
  result[CommonFun.RoleData.EATTRTYPE_ATK]    = 42 + (petlv-1) * 3.12 + attr[CommonFun.RoleData.EATTRTYPE_ATK] + attr[CommonFun.RoleData.EATTRTYPE_STR] * 6.464 + attr[CommonFun.RoleData.EATTRTYPE_LUK] * 0.4 + attr[CommonFun.RoleData.EATTRTYPE_DEX] *0.4
  result[CommonFun.RoleData.EATTRTYPE_MATK]   = 186 + (petlv-1) * 13.85 + attr[CommonFun.RoleData.EATTRTYPE_MATK] + attr[CommonFun.RoleData.EATTRTYPE_INT] * 4.444
  result[CommonFun.RoleData.EATTRTYPE_DEF]    = 70 + (petlv-1) * 4.65 + attr[CommonFun.RoleData.EATTRTYPE_DEF] + attr[CommonFun.RoleData.EATTRTYPE_VIT] * 2
  result[CommonFun.RoleData.EATTRTYPE_MDEF]   = 124 + (petlv-1) *8.55 + attr[CommonFun.RoleData.EATTRTYPE_MDEF] + attr[CommonFun.RoleData.EATTRTYPE_INT] * 6 + attr[CommonFun.RoleData.EATTRTYPE_VIT] * 1
  result[CommonFun.RoleData.EATTRTYPE_MAXHP]  = (168 + (petlv-1) * 268.18 + attr[CommonFun.RoleData.EATTRTYPE_MAXHP]) * (1 + attr[CommonFun.RoleData.EATTRTYPE_VIT] / 50)
  result[CommonFun.RoleData.EATTRTYPE_HIT]    = 50 + (petlv-1) * 2.29 + attr[CommonFun.RoleData.EATTRTYPE_HIT] + attr[CommonFun.RoleData.EATTRTYPE_DEX] * 2
  result[CommonFun.RoleData.EATTRTYPE_FLEE]   = 26 + (petlv-1) * 0.76 + attr[CommonFun.RoleData.EATTRTYPE_FLEE] + attr[CommonFun.RoleData.EATTRTYPE_AGI] * 2
  result[CommonFun.RoleData.EATTRTYPE_CRI]    = 13.6 + (petlv-1) * 0.26 + attr[CommonFun.RoleData.EATTRTYPE_CRI] + attr[CommonFun.RoleData.EATTRTYPE_LUK] * 0.67
  result[CommonFun.RoleData.EATTRTYPE_CRIRES] = 12.2 + (petlv-1) * 0.15 + attr[CommonFun.RoleData.EATTRTYPE_CRIRES] + attr[CommonFun.RoleData.EATTRTYPE_LUK] * 0.4
  elseif classtype==53 then
  result[CommonFun.RoleData.EATTRTYPE_ATK]    = 54 + (petlv-1) * 4.02 + attr[CommonFun.RoleData.EATTRTYPE_ATK] + attr[CommonFun.RoleData.EATTRTYPE_STR] * 6.464 + attr[CommonFun.RoleData.EATTRTYPE_LUK] * 0.4 + attr[CommonFun.RoleData.EATTRTYPE_DEX] *0.4
  result[CommonFun.RoleData.EATTRTYPE_MATK]   = 240 + (petlv-1) * 17.68 + attr[CommonFun.RoleData.EATTRTYPE_MATK] + attr[CommonFun.RoleData.EATTRTYPE_INT] * 4.444
  result[CommonFun.RoleData.EATTRTYPE_DEF]    = 88 + (petlv-1) * 6 + attr[CommonFun.RoleData.EATTRTYPE_DEF] + attr[CommonFun.RoleData.EATTRTYPE_VIT] * 2
  result[CommonFun.RoleData.EATTRTYPE_MDEF]   = 160 + (petlv-1) * 10.91 + attr[CommonFun.RoleData.EATTRTYPE_MDEF] + attr[CommonFun.RoleData.EATTRTYPE_INT] * 6 + attr[CommonFun.RoleData.EATTRTYPE_VIT] * 1
  result[CommonFun.RoleData.EATTRTYPE_MAXHP]  = (186 + (petlv-1) * 330.55 + attr[CommonFun.RoleData.EATTRTYPE_MAXHP]) * (1 + attr[CommonFun.RoleData.EATTRTYPE_VIT] / 50)
  result[CommonFun.RoleData.EATTRTYPE_HIT]    = 56 + (petlv-1) * 3 + attr[CommonFun.RoleData.EATTRTYPE_HIT] + attr[CommonFun.RoleData.EATTRTYPE_DEX] * 2
  result[CommonFun.RoleData.EATTRTYPE_FLEE]   = 32 + (petlv-1) * 0.95 + attr[CommonFun.RoleData.EATTRTYPE_FLEE] + attr[CommonFun.RoleData.EATTRTYPE_AGI] * 2
  result[CommonFun.RoleData.EATTRTYPE_CRI]    = 14.6 + (petlv-1) * 0.33 + attr[CommonFun.RoleData.EATTRTYPE_CRI] + attr[CommonFun.RoleData.EATTRTYPE_LUK] * 0.67
  result[CommonFun.RoleData.EATTRTYPE_CRIRES] = 12.8 + (petlv-1) * 0.19 + attr[CommonFun.RoleData.EATTRTYPE_CRIRES] + attr[CommonFun.RoleData.EATTRTYPE_LUK] * 0.4
  elseif classtype==54 then
  result[CommonFun.RoleData.EATTRTYPE_ATK]    = 72 + (petlv-1) * 5.17 + attr[CommonFun.RoleData.EATTRTYPE_ATK] + attr[CommonFun.RoleData.EATTRTYPE_STR] * 6.464 + attr[CommonFun.RoleData.EATTRTYPE_LUK] * 0.4 + attr[CommonFun.RoleData.EATTRTYPE_DEX] *0.4
  result[CommonFun.RoleData.EATTRTYPE_MATK]   = 318 + (petlv-1) * 23.04 + attr[CommonFun.RoleData.EATTRTYPE_MATK] + attr[CommonFun.RoleData.EATTRTYPE_INT] * 4.444
  result[CommonFun.RoleData.EATTRTYPE_DEF]    = 118 + (petlv-1) *7.72 + attr[CommonFun.RoleData.EATTRTYPE_DEF] + attr[CommonFun.RoleData.EATTRTYPE_VIT] * 2
  result[CommonFun.RoleData.EATTRTYPE_MDEF]   = 208 + (petlv-1) * 14.23 + attr[CommonFun.RoleData.EATTRTYPE_MDEF] + attr[CommonFun.RoleData.EATTRTYPE_INT] * 6 + attr[CommonFun.RoleData.EATTRTYPE_VIT] * 1
  result[CommonFun.RoleData.EATTRTYPE_MAXHP]  = (212 + (petlv-1) * 417.86 + attr[CommonFun.RoleData.EATTRTYPE_MAXHP]) * (1 + attr[CommonFun.RoleData.EATTRTYPE_VIT] / 50)
  result[CommonFun.RoleData.EATTRTYPE_HIT]    = 74 + (petlv-1) *3.82 + attr[CommonFun.RoleData.EATTRTYPE_HIT] + attr[CommonFun.RoleData.EATTRTYPE_DEX] * 2
  result[CommonFun.RoleData.EATTRTYPE_FLEE]   = 38 + (petlv-1) * 1.27 + attr[CommonFun.RoleData.EATTRTYPE_FLEE] + attr[CommonFun.RoleData.EATTRTYPE_AGI] * 2
  result[CommonFun.RoleData.EATTRTYPE_CRI]    = 16.1 + (petlv-1) * 0.43 + attr[CommonFun.RoleData.EATTRTYPE_CRI] + attr[CommonFun.RoleData.EATTRTYPE_LUK] * 0.67
  result[CommonFun.RoleData.EATTRTYPE_CRIRES] = 13.6 + (petlv-1) * 0.25 + attr[CommonFun.RoleData.EATTRTYPE_CRIRES] + attr[CommonFun.RoleData.EATTRTYPE_LUK] * 0.4
  elseif classtype==61 then
  result[CommonFun.RoleData.EATTRTYPE_ATK]    = 120 + (petlv-1) * 9 + attr[CommonFun.RoleData.EATTRTYPE_ATK] + attr[CommonFun.RoleData.EATTRTYPE_STR] * 6.464 + attr[CommonFun.RoleData.EATTRTYPE_LUK] * 0.4 + attr[CommonFun.RoleData.EATTRTYPE_DEX] *0.4
  result[CommonFun.RoleData.EATTRTYPE_MATK]   = 18 + (petlv-1) * 1.34 + attr[CommonFun.RoleData.EATTRTYPE_MATK] + attr[CommonFun.RoleData.EATTRTYPE_INT] * 4.444
  result[CommonFun.RoleData.EATTRTYPE_DEF]    = 16 + (petlv-1) * 0.89+ attr[CommonFun.RoleData.EATTRTYPE_DEF] + attr[CommonFun.RoleData.EATTRTYPE_VIT] * 2
  result[CommonFun.RoleData.EATTRTYPE_MDEF]   = 22 + (petlv-1) * 1.02 + attr[CommonFun.RoleData.EATTRTYPE_MDEF] + attr[CommonFun.RoleData.EATTRTYPE_INT] * 6 + attr[CommonFun.RoleData.EATTRTYPE_VIT] * 1
  result[CommonFun.RoleData.EATTRTYPE_MAXHP]  = (113 + (petlv-1) * 86.11+ attr[CommonFun.RoleData.EATTRTYPE_MAXHP]) * (1 + attr[CommonFun.RoleData.EATTRTYPE_VIT] / 50)
  result[CommonFun.RoleData.EATTRTYPE_HIT]    = 62 + (petlv-1) * 3 + attr[CommonFun.RoleData.EATTRTYPE_HIT] + attr[CommonFun.RoleData.EATTRTYPE_DEX] * 2
  result[CommonFun.RoleData.EATTRTYPE_FLEE]   = 50 + (petlv-1) * 2.42 + attr[CommonFun.RoleData.EATTRTYPE_FLEE] + attr[CommonFun.RoleData.EATTRTYPE_AGI] * 2
  result[CommonFun.RoleData.EATTRTYPE_CRI]    = 23 + (petlv-1) * 0.93 + attr[CommonFun.RoleData.EATTRTYPE_CRI] + attr[CommonFun.RoleData.EATTRTYPE_LUK] * 0.67
  result[CommonFun.RoleData.EATTRTYPE_CRIRES] = 17.7 + (petlv-1) * 0.55 + attr[CommonFun.RoleData.EATTRTYPE_CRIRES] + attr[CommonFun.RoleData.EATTRTYPE_LUK] * 0.4
  elseif classtype==62 then
  result[CommonFun.RoleData.EATTRTYPE_ATK]    = 156 + (petlv-1) * 11.55 + attr[CommonFun.RoleData.EATTRTYPE_ATK] + attr[CommonFun.RoleData.EATTRTYPE_STR] * 6.464 + attr[CommonFun.RoleData.EATTRTYPE_LUK] * 0.4 + attr[CommonFun.RoleData.EATTRTYPE_DEX] *0.4
  result[CommonFun.RoleData.EATTRTYPE_MATK]   = 18 + (petlv-1) * 1.78 + attr[CommonFun.RoleData.EATTRTYPE_MATK] + attr[CommonFun.RoleData.EATTRTYPE_INT] * 4.444
  result[CommonFun.RoleData.EATTRTYPE_DEF]    = 22 + (petlv-1) * 1.08+ attr[CommonFun.RoleData.EATTRTYPE_DEF] + attr[CommonFun.RoleData.EATTRTYPE_VIT] * 2
  result[CommonFun.RoleData.EATTRTYPE_MDEF]   = 28 + (petlv-1) * 1.27+ attr[CommonFun.RoleData.EATTRTYPE_MDEF] + attr[CommonFun.RoleData.EATTRTYPE_INT] * 6 + attr[CommonFun.RoleData.EATTRTYPE_VIT] * 1
  result[CommonFun.RoleData.EATTRTYPE_MAXHP]  = (117 + (petlv-1) * 97.98+ attr[CommonFun.RoleData.EATTRTYPE_MAXHP]) * (1 + attr[CommonFun.RoleData.EATTRTYPE_VIT] / 50)
  result[CommonFun.RoleData.EATTRTYPE_HIT]    = 74 + (petlv-1) * 3.82 + attr[CommonFun.RoleData.EATTRTYPE_HIT] + attr[CommonFun.RoleData.EATTRTYPE_DEX] * 2
  result[CommonFun.RoleData.EATTRTYPE_FLEE]   = 62 + (petlv-1) * 3.06 + attr[CommonFun.RoleData.EATTRTYPE_FLEE] + attr[CommonFun.RoleData.EATTRTYPE_AGI] * 2
  result[CommonFun.RoleData.EATTRTYPE_CRI]    = 26.6 + (petlv-1) *1.19 + attr[CommonFun.RoleData.EATTRTYPE_CRI] + attr[CommonFun.RoleData.EATTRTYPE_LUK] * 0.67
  result[CommonFun.RoleData.EATTRTYPE_CRIRES] = 20 + (petlv-1) * 0.71 + attr[CommonFun.RoleData.EATTRTYPE_CRIRES] + attr[CommonFun.RoleData.EATTRTYPE_LUK] * 0.4
  elseif classtype==63 then
  result[CommonFun.RoleData.EATTRTYPE_ATK]    = 204 + (petlv-1) * 14.74 + attr[CommonFun.RoleData.EATTRTYPE_ATK] + attr[CommonFun.RoleData.EATTRTYPE_STR] * 6.464 + attr[CommonFun.RoleData.EATTRTYPE_LUK] * 0.4 + attr[CommonFun.RoleData.EATTRTYPE_DEX] *0.4
  result[CommonFun.RoleData.EATTRTYPE_MATK]   = 30 + (petlv-1) * 2.17 + attr[CommonFun.RoleData.EATTRTYPE_MATK] + attr[CommonFun.RoleData.EATTRTYPE_INT] * 4.444
  result[CommonFun.RoleData.EATTRTYPE_DEF]    = 28 + (petlv-1) * 1.4+ attr[CommonFun.RoleData.EATTRTYPE_DEF] + attr[CommonFun.RoleData.EATTRTYPE_VIT] * 2
  result[CommonFun.RoleData.EATTRTYPE_MDEF]   = 28 + (petlv-1) * 1.72 + attr[CommonFun.RoleData.EATTRTYPE_MDEF] + attr[CommonFun.RoleData.EATTRTYPE_INT] * 6 + attr[CommonFun.RoleData.EATTRTYPE_VIT] * 1
  result[CommonFun.RoleData.EATTRTYPE_MAXHP]  = (121 + (petlv-1) * 112.84 + attr[CommonFun.RoleData.EATTRTYPE_MAXHP]) * (1 + attr[CommonFun.RoleData.EATTRTYPE_VIT] / 50)
  result[CommonFun.RoleData.EATTRTYPE_HIT]    = 86 + (petlv-1) * 4.97 + attr[CommonFun.RoleData.EATTRTYPE_HIT] + attr[CommonFun.RoleData.EATTRTYPE_DEX] * 2
  result[CommonFun.RoleData.EATTRTYPE_FLEE]   = 74 + (petlv-1) * 3.95 + attr[CommonFun.RoleData.EATTRTYPE_FLEE] + attr[CommonFun.RoleData.EATTRTYPE_AGI] * 2
  result[CommonFun.RoleData.EATTRTYPE_CRI]    = 31.2 + (petlv-1) * 1.53 + attr[CommonFun.RoleData.EATTRTYPE_CRI] + attr[CommonFun.RoleData.EATTRTYPE_LUK] * 0.67
  result[CommonFun.RoleData.EATTRTYPE_CRIRES] = 22.7 + (petlv-1) * 0.91 + attr[CommonFun.RoleData.EATTRTYPE_CRIRES] + attr[CommonFun.RoleData.EATTRTYPE_LUK] * 0.4
  else
  result[CommonFun.RoleData.EATTRTYPE_ATK]    = 264 + (petlv-1) * 19.27 + attr[CommonFun.RoleData.EATTRTYPE_ATK] + attr[CommonFun.RoleData.EATTRTYPE_STR] * 6.464 + attr[CommonFun.RoleData.EATTRTYPE_LUK] * 0.4 + attr[CommonFun.RoleData.EATTRTYPE_DEX] *0.4
  result[CommonFun.RoleData.EATTRTYPE_MATK]   = 36 + (petlv-1) * 2.87 + attr[CommonFun.RoleData.EATTRTYPE_MATK] + attr[CommonFun.RoleData.EATTRTYPE_INT] * 4.444
  result[CommonFun.RoleData.EATTRTYPE_DEF]    = 34 + (petlv-1) * 1.78+ attr[CommonFun.RoleData.EATTRTYPE_DEF] + attr[CommonFun.RoleData.EATTRTYPE_VIT] * 2
  result[CommonFun.RoleData.EATTRTYPE_MDEF]   = 40 + (petlv-1) * 2.17 + attr[CommonFun.RoleData.EATTRTYPE_MDEF] + attr[CommonFun.RoleData.EATTRTYPE_INT] * 6 + attr[CommonFun.RoleData.EATTRTYPE_VIT] * 1
  result[CommonFun.RoleData.EATTRTYPE_MAXHP]  = (127 + (petlv-1) * 133.61 + attr[CommonFun.RoleData.EATTRTYPE_MAXHP]) * (1 + attr[CommonFun.RoleData.EATTRTYPE_VIT] / 50)
  result[CommonFun.RoleData.EATTRTYPE_HIT]    = 110 + (petlv-1) * 6.44 + attr[CommonFun.RoleData.EATTRTYPE_HIT] + attr[CommonFun.RoleData.EATTRTYPE_DEX] * 2
  result[CommonFun.RoleData.EATTRTYPE_FLEE]   = 92 + (petlv-1) * 5.17 + attr[CommonFun.RoleData.EATTRTYPE_FLEE] + attr[CommonFun.RoleData.EATTRTYPE_AGI] * 2
  result[CommonFun.RoleData.EATTRTYPE_CRI]    = 37.7 + (petlv-1) * 1.99 + attr[CommonFun.RoleData.EATTRTYPE_CRI] + attr[CommonFun.RoleData.EATTRTYPE_LUK] * 0.67
  result[CommonFun.RoleData.EATTRTYPE_CRIRES] = 26.6 + (petlv-1) * 1.19 + attr[CommonFun.RoleData.EATTRTYPE_CRIRES] + attr[CommonFun.RoleData.EATTRTYPE_LUK] * 0.4
  end

  result[CommonFun.RoleData.EATTRTYPE_MOVESPD] =  2.1
  return result
end

  -- 新增宠物面板显示属性
function CommonFun.PetAttrShow(PetLv, classtype)
  local result = {}
  -----------1   品质为D
  -----------11  战士系相关职业  坦克
  -----------21  法师系相关职业  法攻
  -----------31  刺客系相关职业  物攻-近
  -----------41  弓手系相关职业  物攻-远
  -----------51  牧师系相关职业  辅助
  -----------61  商人系相关职业  均衡
  -----------1-C 2-B 3-A 4-S
  --品质系数
  local QualityRatio = 0

  --各品质对应的品质系数判断
  if classtype == 11 or classtype == 21 or classtype == 31 or classtype == 41 or classtype == 51 or classtype == 61 then
  QualityRatio = 1.4
  elseif classtype == 12 or classtype == 22 or classtype == 32 or classtype == 42 or classtype == 52 or classtype == 62 then
  QualityRatio = 1.8
  elseif classtype == 13 or classtype == 23 or classtype == 33 or classtype == 43 or classtype == 53 or classtype == 63 then
  QualityRatio = 2.3
  elseif classtype == 14 or classtype == 24 or classtype == 34 or classtype == 44 or classtype == 54 or classtype == 64 then
  QualityRatio = 3
  else
  QualityRatio = 1
  end
  PetLv = PetLv or 0

  --各职业倾向的六维成长率
  if classtype==11 or classtype==12 or classtype==13 or classtype==14  then
  result[CommonFun.RoleData.EATTRTYPE_STR] = (3 + PetLv * 0.216) * QualityRatio
  result[CommonFun.RoleData.EATTRTYPE_AGI] = (0.5 + PetLv * 0.036) * QualityRatio
  result[CommonFun.RoleData.EATTRTYPE_VIT] = (4 + PetLv * 0.288) * QualityRatio
  result[CommonFun.RoleData.EATTRTYPE_INT] = (0.5 + PetLv * 0.036) * QualityRatio
  result[CommonFun.RoleData.EATTRTYPE_DEX] = (1.5 + PetLv * 0.108) * QualityRatio
  result[CommonFun.RoleData.EATTRTYPE_LUK] = (0.5 + PetLv * 0.036) * QualityRatio
  elseif  classtype==21 or classtype==22 or classtype==23 or classtype==24  then
  result[CommonFun.RoleData.EATTRTYPE_STR] = (0.5 + PetLv * 0.036) * QualityRatio
  result[CommonFun.RoleData.EATTRTYPE_AGI] = (0.5 + PetLv * 0.036) * QualityRatio
  result[CommonFun.RoleData.EATTRTYPE_VIT] = (0.5 + PetLv * 0.036) * QualityRatio
  result[CommonFun.RoleData.EATTRTYPE_INT] = (4 + PetLv * 0.288) * QualityRatio
  result[CommonFun.RoleData.EATTRTYPE_DEX] = (4 + PetLv * 0.288) * QualityRatio
  result[CommonFun.RoleData.EATTRTYPE_LUK] = (0.5 + PetLv * 0.036) * QualityRatio
  elseif  classtype==31 or classtype==32 or classtype==33 or classtype==34  then
  result[CommonFun.RoleData.EATTRTYPE_STR] = (4 + PetLv * 0.288) * QualityRatio
  result[CommonFun.RoleData.EATTRTYPE_AGI] = (3 + PetLv * 0.216) * QualityRatio
  result[CommonFun.RoleData.EATTRTYPE_VIT] = (0.5 + PetLv * 0.036) * QualityRatio
  result[CommonFun.RoleData.EATTRTYPE_INT] = (0.5 + PetLv * 0.036) * QualityRatio
  result[CommonFun.RoleData.EATTRTYPE_LUK] = (1 + PetLv * 0.072) * QualityRatio
  result[CommonFun.RoleData.EATTRTYPE_DEX] = (1 + PetLv * 0.072) * QualityRatio
  elseif  classtype==41 or classtype==42 or classtype==43 or classtype==44  then
  result[CommonFun.RoleData.EATTRTYPE_STR] = (0.5 + PetLv * 0.036) * QualityRatio
  result[CommonFun.RoleData.EATTRTYPE_AGI] = (3 + PetLv * 0.216) * QualityRatio
  result[CommonFun.RoleData.EATTRTYPE_VIT] = (0.5 + PetLv * 0.036) * QualityRatio
  result[CommonFun.RoleData.EATTRTYPE_INT] = (0.5 + PetLv * 0.036) * QualityRatio
  result[CommonFun.RoleData.EATTRTYPE_DEX] = (4 + PetLv * 0.288) * QualityRatio
  result[CommonFun.RoleData.EATTRTYPE_LUK] = (1.5 + PetLv * 0.108) * QualityRatio
  elseif  classtype==51 or classtype==52 or classtype==53 or classtype==54  then
  result[CommonFun.RoleData.EATTRTYPE_STR] = (0.5 + PetLv * 0.036) * QualityRatio
  result[CommonFun.RoleData.EATTRTYPE_AGI] = (0.5 + PetLv * 0.036) * QualityRatio
  result[CommonFun.RoleData.EATTRTYPE_VIT] = (3 + PetLv * 0.216) * QualityRatio
  result[CommonFun.RoleData.EATTRTYPE_INT] = (4 + PetLv * 0.288) * QualityRatio
  result[CommonFun.RoleData.EATTRTYPE_DEX] = (1.5 + PetLv * 0.108) * QualityRatio
  result[CommonFun.RoleData.EATTRTYPE_LUK] = (0.5 + PetLv * 0.036) * QualityRatio
  elseif  classtype==61 or classtype==62 or classtype==63 or classtype==64  then
  result[CommonFun.RoleData.EATTRTYPE_STR] = (2 + PetLv * 0.144) * QualityRatio
  result[CommonFun.RoleData.EATTRTYPE_AGI] = (2 + PetLv * 0.144) * QualityRatio
  result[CommonFun.RoleData.EATTRTYPE_VIT] = (0.7 + PetLv * 0.0504) * QualityRatio
  result[CommonFun.RoleData.EATTRTYPE_INT] = (0.5 + PetLv * 0.036) * QualityRatio
  result[CommonFun.RoleData.EATTRTYPE_DEX] = (2.5 + PetLv * 0.18) * QualityRatio
  result[CommonFun.RoleData.EATTRTYPE_LUK] = (2.3 + PetLv * 0.1656) * QualityRatio
  else
  result[CommonFun.RoleData.EATTRTYPE_STR] = (2 + PetLv * 0.144) * QualityRatio
  result[CommonFun.RoleData.EATTRTYPE_AGI] = (2 + PetLv * 0.144) * QualityRatio
  result[CommonFun.RoleData.EATTRTYPE_VIT] = (2 + PetLv * 0.144) * QualityRatio
  result[CommonFun.RoleData.EATTRTYPE_INT] = (1 + PetLv * 0.072) * QualityRatio
  result[CommonFun.RoleData.EATTRTYPE_DEX] = (2 + PetLv * 0.144) * QualityRatio
  result[CommonFun.RoleData.EATTRTYPE_LUK] = (1 + PetLv * 0.072) * QualityRatio
  end

   --各职业属性换算
  if  classtype==1 then
  result[CommonFun.RoleData.EATTRTYPE_ATK]    = 78 + PetLv * 6.12
  result[CommonFun.RoleData.EATTRTYPE_MATK]   = 24 + PetLv * 1.91
  result[CommonFun.RoleData.EATTRTYPE_DEF]    = 34 + PetLv * 1.72
  result[CommonFun.RoleData.EATTRTYPE_MDEF]   = 34 + PetLv * 1.72
  result[CommonFun.RoleData.EATTRTYPE_MAXHP]  = 126 + PetLv * 126.81
  result[CommonFun.RoleData.EATTRTYPE_HIT]    = 44 + PetLv * 1.72
  result[CommonFun.RoleData.EATTRTYPE_FLEE]   = 44 + PetLv * 1.72
  result[CommonFun.RoleData.EATTRTYPE_CRI]    = 14 + PetLv * 0.28
  result[CommonFun.RoleData.EATTRTYPE_CRIRES] = 12.4 + PetLv * 0.17
  elseif  classtype==11 then
  result[CommonFun.RoleData.EATTRTYPE_ATK]    = 168 + PetLv * 12.19
  result[CommonFun.RoleData.EATTRTYPE_MATK]   = 18 + PetLv * 1.34
  result[CommonFun.RoleData.EATTRTYPE_DEF]    = 76 + PetLv * 4.85
  result[CommonFun.RoleData.EATTRTYPE_MDEF]   = 52 + PetLv *3
  result[CommonFun.RoleData.EATTRTYPE_MAXHP]  = 170 + PetLv * 276.5
  result[CommonFun.RoleData.EATTRTYPE_HIT]    = 44 + PetLv * 1.78
  result[CommonFun.RoleData.EATTRTYPE_FLEE]   = 126 + PetLv * 0.57
  result[CommonFun.RoleData.EATTRTYPE_CRI]    = 12.8 + PetLv * 0.2
  result[CommonFun.RoleData.EATTRTYPE_CRIRES] = 11.7 + PetLv * 0.12
  elseif classtype==12 then
  result[CommonFun.RoleData.EATTRTYPE_ATK]    = 216 + PetLv * 15.7
  result[CommonFun.RoleData.EATTRTYPE_MATK]   = 18 + PetLv * 1.78
  result[CommonFun.RoleData.EATTRTYPE_DEF]    = 94 + PetLv * 6.19
  result[CommonFun.RoleData.EATTRTYPE_MDEF]   = 64 + PetLv * 3.82
  result[CommonFun.RoleData.EATTRTYPE_MAXHP]  = 190 + PetLv * 343.02
  result[CommonFun.RoleData.EATTRTYPE_HIT]    = 50 + PetLv * 2.29
  result[CommonFun.RoleData.EATTRTYPE_FLEE]   = 26 + PetLv * 0.76
  result[CommonFun.RoleData.EATTRTYPE_CRI]    = 13.6 + PetLv * 0.26
  result[CommonFun.RoleData.EATTRTYPE_CRIRES] = 12.2 + PetLv * 0.15
  elseif classtype==13 then
  result[CommonFun.RoleData.EATTRTYPE_ATK]    = 276 + PetLv * 20.04
  result[CommonFun.RoleData.EATTRTYPE_MATK]   = 30 + PetLv * 2.17
  result[CommonFun.RoleData.EATTRTYPE_DEF]    = 118 + PetLv * 7.91
  result[CommonFun.RoleData.EATTRTYPE_MDEF]   = 76 + PetLv * 4.97
  result[CommonFun.RoleData.EATTRTYPE_MAXHP]  = 214 + PetLv * 426.19
  result[CommonFun.RoleData.EATTRTYPE_HIT]    = 56 + PetLv * 3
  result[CommonFun.RoleData.EATTRTYPE_FLEE]   = 32 + PetLv * 0.95
  result[CommonFun.RoleData.EATTRTYPE_CRI]    = 14.6 + PetLv * 0.33
  result[CommonFun.RoleData.EATTRTYPE_CRIRES] = 12.8 + PetLv * 0.19
  elseif classtype==14 then
  result[CommonFun.RoleData.EATTRTYPE_ATK]    = 360 + PetLv * 26.17
  result[CommonFun.RoleData.EATTRTYPE_MATK]   = 36 + PetLv * 2.87
  result[CommonFun.RoleData.EATTRTYPE_DEF]    = 154 + PetLv * 10.34
  result[CommonFun.RoleData.EATTRTYPE_MDEF]   = 100 + PetLv * 6.44
  result[CommonFun.RoleData.EATTRTYPE_MAXHP]  = 248 + PetLv * 542.6
  result[CommonFun.RoleData.EATTRTYPE_HIT]    = 74 + PetLv * 3.82
  result[CommonFun.RoleData.EATTRTYPE_FLEE]   = 38 + PetLv * 1.27
  result[CommonFun.RoleData.EATTRTYPE_CRI]    = 16.1 + PetLv * 0.43
  result[CommonFun.RoleData.EATTRTYPE_CRIRES] = 13.6 + PetLv * 0.25
  elseif classtype==21 then
  result[CommonFun.RoleData.EATTRTYPE_ATK]    = 42 + PetLv * 3
  result[CommonFun.RoleData.EATTRTYPE_MATK]   = 144 + PetLv * 10.78
  result[CommonFun.RoleData.EATTRTYPE_DEF]    = 16 + PetLv * 0.57
  result[CommonFun.RoleData.EATTRTYPE_MDEF]   = 76 + PetLv * 5.17
  result[CommonFun.RoleData.EATTRTYPE_MAXHP]  = 110 + PetLv * 72.76
  result[CommonFun.RoleData.EATTRTYPE_HIT]    = 86 + PetLv * 4.85
  result[CommonFun.RoleData.EATTRTYPE_FLEE]   = 26 + PetLv * 0.57
  result[CommonFun.RoleData.EATTRTYPE_CRI]    = 12.8 + PetLv * 0.2
  result[CommonFun.RoleData.EATTRTYPE_CRIRES] = 11.7 + PetLv * 0.12
  elseif classtype==22 then
  result[CommonFun.RoleData.EATTRTYPE_ATK]    = 54 + PetLv * 3.89
  result[CommonFun.RoleData.EATTRTYPE_MATK]   = 186 + PetLv * 13.85
  result[CommonFun.RoleData.EATTRTYPE_DEF]    = 16 + PetLv * 0.76
  result[CommonFun.RoleData.EATTRTYPE_MDEF]   = 100 + PetLv * 6.57
  result[CommonFun.RoleData.EATTRTYPE_MAXHP]  = 113 + PetLv * 81.07
  result[CommonFun.RoleData.EATTRTYPE_HIT]    = 104 + PetLv * 6.19
  result[CommonFun.RoleData.EATTRTYPE_FLEE]   = 26 + PetLv * 0.76
  result[CommonFun.RoleData.EATTRTYPE_CRI]    = 13.6 + PetLv * 0.26
  result[CommonFun.RoleData.EATTRTYPE_CRIRES] = 12.2 + PetLv * 0.15
  elseif classtype==23 then
  result[CommonFun.RoleData.EATTRTYPE_ATK]    = 66 + PetLv * 4.97
  result[CommonFun.RoleData.EATTRTYPE_MATK]   = 240 + PetLv * 17.68
  result[CommonFun.RoleData.EATTRTYPE_DEF]    = 22 + PetLv * 0.95
  result[CommonFun.RoleData.EATTRTYPE_MDEF]   = 124 + PetLv * 8.42
  result[CommonFun.RoleData.EATTRTYPE_MAXHP]  = 116 + PetLv * 91.46
  result[CommonFun.RoleData.EATTRTYPE_HIT]    = 128 + PetLv * 7.91
  result[CommonFun.RoleData.EATTRTYPE_FLEE]   = 32 + PetLv * 0.95
  result[CommonFun.RoleData.EATTRTYPE_CRI]    = 14.6 + PetLv * 0.33
  result[CommonFun.RoleData.EATTRTYPE_CRIRES] = 12.8 + PetLv * 0.19
  elseif classtype==24 then
  result[CommonFun.RoleData.EATTRTYPE_ATK]    = 90 + PetLv * 6.51
  result[CommonFun.RoleData.EATTRTYPE_MATK]   = 318 + PetLv * 23.04
  result[CommonFun.RoleData.EATTRTYPE_DEF]    = 28 + PetLv * 1.27
  result[CommonFun.RoleData.EATTRTYPE_MDEF]   = 160 + PetLv * 11.04
  result[CommonFun.RoleData.EATTRTYPE_MAXHP]  = 120 + PetLv * 106.02
  result[CommonFun.RoleData.EATTRTYPE_HIT]    = 164 + PetLv * 10.34
  result[CommonFun.RoleData.EATTRTYPE_FLEE]   = 38 + PetLv * 1.27
  result[CommonFun.RoleData.EATTRTYPE_CRI]    = 16.1 + PetLv * 0.43
  result[CommonFun.RoleData.EATTRTYPE_CRIRES] = 13.6 + PetLv * 0.25
  elseif classtype==31 then
  result[CommonFun.RoleData.EATTRTYPE_ATK]    = 222 + PetLv * 16.08
  result[CommonFun.RoleData.EATTRTYPE_MATK]   = 18 + PetLv * 1.34
  result[CommonFun.RoleData.EATTRTYPE_DEF]    = 16 + PetLv * 0.57
  result[CommonFun.RoleData.EATTRTYPE_MDEF]   = 22 + PetLv * 0.89
  result[CommonFun.RoleData.EATTRTYPE_MAXHP]  = 110 + PetLv * 72.76
  result[CommonFun.RoleData.EATTRTYPE_HIT]    = 32 + PetLv * 1.21
  result[CommonFun.RoleData.EATTRTYPE_FLEE]   = 68 + PetLv * 3.63
  result[CommonFun.RoleData.EATTRTYPE_CRI]    = 15.64 + PetLv * 0.4
  result[CommonFun.RoleData.EATTRTYPE_CRIRES] = 13.36 + PetLv * 0.24
  elseif classtype==32 then
  result[CommonFun.RoleData.EATTRTYPE_ATK]    = 282 + PetLv * 20.74
  result[CommonFun.RoleData.EATTRTYPE_MATK]   = 18 + PetLv * 1.78
  result[CommonFun.RoleData.EATTRTYPE_DEF]    = 16 + PetLv * 0.76
  result[CommonFun.RoleData.EATTRTYPE_MDEF]   = 22 + PetLv * 1.14
  result[CommonFun.RoleData.EATTRTYPE_MAXHP]  = 113 + PetLv * 81.07
  result[CommonFun.RoleData.EATTRTYPE_HIT]    = 38 + PetLv * 1.53
  result[CommonFun.RoleData.EATTRTYPE_FLEE]   = 80 + PetLv * 4.65
  result[CommonFun.RoleData.EATTRTYPE_CRI]    = 17.26 + PetLv * 0.52
  result[CommonFun.RoleData.EATTRTYPE_CRIRES] = 14.32 + PetLv * 0.31
  elseif classtype==33 then
  result[CommonFun.RoleData.EATTRTYPE_ATK]    = 366 + PetLv * 26.48
  result[CommonFun.RoleData.EATTRTYPE_MATK]   = 30 + PetLv * 2.17
  result[CommonFun.RoleData.EATTRTYPE_DEF]    = 22 + PetLv * 0.95
  result[CommonFun.RoleData.EATTRTYPE_MDEF]   = 28 + PetLv * 1.46
  result[CommonFun.RoleData.EATTRTYPE_MAXHP]  = 116 + PetLv * 91.46
  result[CommonFun.RoleData.EATTRTYPE_HIT]    = 44 + PetLv * 1.97
  result[CommonFun.RoleData.EATTRTYPE_FLEE]   = 98 + PetLv * 6
  result[CommonFun.RoleData.EATTRTYPE_CRI]    = 19.24 + PetLv * 0.66
  result[CommonFun.RoleData.EATTRTYPE_CRIRES] = 15.52 + PetLv * 0.39
  elseif classtype==34 then
  result[CommonFun.RoleData.EATTRTYPE_ATK]    = 474 + PetLv * 34.59
  result[CommonFun.RoleData.EATTRTYPE_MATK]   = 36 + PetLv * 2.87
  result[CommonFun.RoleData.EATTRTYPE_DEF]    = 28 + PetLv * 1.27
  result[CommonFun.RoleData.EATTRTYPE_MDEF]   = 34 + PetLv * 1.91
  result[CommonFun.RoleData.EATTRTYPE_MAXHP]  = 120 + PetLv * 106.02
  result[CommonFun.RoleData.EATTRTYPE_HIT]    = 56 + PetLv * 2.55
  result[CommonFun.RoleData.EATTRTYPE_FLEE]   = 128 + PetLv * 7.72
  result[CommonFun.RoleData.EATTRTYPE_CRI]    = 22.06 + PetLv * 0.86
  result[CommonFun.RoleData.EATTRTYPE_CRIRES] = 17.2 + PetLv * 0.51
  elseif classtype==41 then
  result[CommonFun.RoleData.EATTRTYPE_ATK]    = 156 + PetLv * 11.23
  result[CommonFun.RoleData.EATTRTYPE_MATK]   = 18 + PetLv * 1.34
  result[CommonFun.RoleData.EATTRTYPE_DEF]    = 16 + PetLv * 0.57
  result[CommonFun.RoleData.EATTRTYPE_MDEF]   = 22 + PetLv * 0.89
  result[CommonFun.RoleData.EATTRTYPE_MAXHP]  = 110 + PetLv * 72.76
  result[CommonFun.RoleData.EATTRTYPE_HIT]    = 86 + PetLv * 4.85
  result[CommonFun.RoleData.EATTRTYPE_FLEE]   = 68 + PetLv * 3.63
  result[CommonFun.RoleData.EATTRTYPE_CRI]    = 18.46 + PetLv * 0.6
  result[CommonFun.RoleData.EATTRTYPE_CRIRES] = 15.04 + PetLv * 0.36
  elseif classtype==42 then
  result[CommonFun.RoleData.EATTRTYPE_ATK]    = 198 + PetLv * 14.42
  result[CommonFun.RoleData.EATTRTYPE_MATK]   = 18 + PetLv * 1.78
  result[CommonFun.RoleData.EATTRTYPE_DEF]    = 16 + PetLv * 0.76
  result[CommonFun.RoleData.EATTRTYPE_MDEF]   = 22 + PetLv * 1.14
  result[CommonFun.RoleData.EATTRTYPE_MAXHP]  = 113 + PetLv * 81.07
  result[CommonFun.RoleData.EATTRTYPE_HIT]    = 104 + PetLv * 6.19
  result[CommonFun.RoleData.EATTRTYPE_FLEE]   = 80 + PetLv * 4.65
  result[CommonFun.RoleData.EATTRTYPE_CRI]    = 20.86 + PetLv * 0.78
  result[CommonFun.RoleData.EATTRTYPE_CRIRES] = 16.48 + PetLv * 0.46
  elseif classtype==43 then
  result[CommonFun.RoleData.EATTRTYPE_ATK]    = 252 + PetLv * 18.44
  result[CommonFun.RoleData.EATTRTYPE_MATK]   = 30 + PetLv * 2.17
  result[CommonFun.RoleData.EATTRTYPE_DEF]    = 22 + PetLv * 0.95
  result[CommonFun.RoleData.EATTRTYPE_MDEF]   = 28 + PetLv *1.46
  result[CommonFun.RoleData.EATTRTYPE_MAXHP]  = 116 + PetLv * 91.46
  result[CommonFun.RoleData.EATTRTYPE_HIT]    = 128 + PetLv * 7.91
  result[CommonFun.RoleData.EATTRTYPE_FLEE]   = 98 + PetLv * 6
  result[CommonFun.RoleData.EATTRTYPE_CRI]    = 23.86 + PetLv * 0.99
  result[CommonFun.RoleData.EATTRTYPE_CRIRES] = 18.28 + PetLv * 0.59
  elseif classtype==44 then
  result[CommonFun.RoleData.EATTRTYPE_ATK]    = 330 + PetLv * 24.06
  result[CommonFun.RoleData.EATTRTYPE_MATK]   = 36 + PetLv * 2.87
  result[CommonFun.RoleData.EATTRTYPE_DEF]    = 28 + PetLv * 1.27
  result[CommonFun.RoleData.EATTRTYPE_MDEF]   = 34 + PetLv * 1.91
  result[CommonFun.RoleData.EATTRTYPE_MAXHP]  = 120 + PetLv * 106.02
  result[CommonFun.RoleData.EATTRTYPE_HIT]    = 164 + PetLv * 10.34
  result[CommonFun.RoleData.EATTRTYPE_FLEE]   = 128 + PetLv * 7.72
  result[CommonFun.RoleData.EATTRTYPE_CRI]    = 28.12 + PetLv * 1.3
  result[CommonFun.RoleData.EATTRTYPE_CRIRES] = 20.8 + PetLv * 0.77
  elseif classtype==51 then
  result[CommonFun.RoleData.EATTRTYPE_ATK]    = 30 + PetLv * 2.42
  result[CommonFun.RoleData.EATTRTYPE_MATK]   = 144 + PetLv * 10.78
  result[CommonFun.RoleData.EATTRTYPE_DEF]    = 58 + PetLv * 3.63
  result[CommonFun.RoleData.EATTRTYPE_MDEF]   = 100 + PetLv * 6.63
  result[CommonFun.RoleData.EATTRTYPE_MAXHP]  = 153 + PetLv * 218.28
  result[CommonFun.RoleData.EATTRTYPE_HIT]    = 44 + PetLv * 1.78
  result[CommonFun.RoleData.EATTRTYPE_FLEE]   = 26 + PetLv * 0.57
  result[CommonFun.RoleData.EATTRTYPE_CRI]    = 12.8 + PetLv * 0.2
  result[CommonFun.RoleData.EATTRTYPE_CRIRES] = 11.7 + PetLv * 0.12
  elseif classtype==52 then
  result[CommonFun.RoleData.EATTRTYPE_ATK]    = 42 + PetLv * 3.12
  result[CommonFun.RoleData.EATTRTYPE_MATK]   = 186 + PetLv * 13.85
  result[CommonFun.RoleData.EATTRTYPE_DEF]    = 70 + PetLv * 4.65
  result[CommonFun.RoleData.EATTRTYPE_MDEF]   = 124 + PetLv *8.55
  result[CommonFun.RoleData.EATTRTYPE_MAXHP]  = 168 + PetLv * 268.18
  result[CommonFun.RoleData.EATTRTYPE_HIT]    = 50 + PetLv * 2.29
  result[CommonFun.RoleData.EATTRTYPE_FLEE]   = 26 + PetLv * 0.76
  result[CommonFun.RoleData.EATTRTYPE_CRI]    = 13.6 + PetLv * 0.26
  result[CommonFun.RoleData.EATTRTYPE_CRIRES] = 12.2 + PetLv * 0.15
  elseif classtype==53 then
  result[CommonFun.RoleData.EATTRTYPE_ATK]    = 54 + PetLv * 4.02
  result[CommonFun.RoleData.EATTRTYPE_MATK]   = 240 + PetLv * 17.68
  result[CommonFun.RoleData.EATTRTYPE_DEF]    = 88 + PetLv * 6
  result[CommonFun.RoleData.EATTRTYPE_MDEF]   = 160 + PetLv * 10.91
  result[CommonFun.RoleData.EATTRTYPE_MAXHP]  = 186 + PetLv * 330.55
  result[CommonFun.RoleData.EATTRTYPE_HIT]    = 56 + PetLv * 3
  result[CommonFun.RoleData.EATTRTYPE_FLEE]   = 32 + PetLv * 0.95
  result[CommonFun.RoleData.EATTRTYPE_CRI]    = 14.6 + PetLv * 0.33
  result[CommonFun.RoleData.EATTRTYPE_CRIRES] = 12.8 + PetLv * 0.19
  elseif classtype==54 then
  result[CommonFun.RoleData.EATTRTYPE_ATK]    = 72 + PetLv * 5.17
  result[CommonFun.RoleData.EATTRTYPE_MATK]   = 318 + PetLv * 23.04
  result[CommonFun.RoleData.EATTRTYPE_DEF]    = 118 + PetLv *7.72
  result[CommonFun.RoleData.EATTRTYPE_MDEF]   = 208 + PetLv * 14.23
  result[CommonFun.RoleData.EATTRTYPE_MAXHP]  = 212 + PetLv * 417.86
  result[CommonFun.RoleData.EATTRTYPE_HIT]    = 74 + PetLv *3.82
  result[CommonFun.RoleData.EATTRTYPE_FLEE]   = 38 + PetLv * 1.27
  result[CommonFun.RoleData.EATTRTYPE_CRI]    = 16.1 + PetLv * 0.43
  result[CommonFun.RoleData.EATTRTYPE_CRIRES] = 13.6 + PetLv * 0.25
  elseif classtype==61 then
  result[CommonFun.RoleData.EATTRTYPE_ATK]    = 120 + PetLv * 9
  result[CommonFun.RoleData.EATTRTYPE_MATK]   = 18 + PetLv * 1.34
  result[CommonFun.RoleData.EATTRTYPE_DEF]    = 16 + PetLv * 0.89
  result[CommonFun.RoleData.EATTRTYPE_MDEF]   = 22 + PetLv * 1.02
  result[CommonFun.RoleData.EATTRTYPE_MAXHP]  = 113 + PetLv * 86.11
  result[CommonFun.RoleData.EATTRTYPE_HIT]    = 62 + PetLv * 3
  result[CommonFun.RoleData.EATTRTYPE_FLEE]   = 50 + PetLv * 2.42
  result[CommonFun.RoleData.EATTRTYPE_CRI]    = 23 + PetLv * 0.93
  result[CommonFun.RoleData.EATTRTYPE_CRIRES] = 17.7 + PetLv * 0.55
  elseif classtype==62 then
  result[CommonFun.RoleData.EATTRTYPE_ATK]    = 156 + PetLv * 11.55
  result[CommonFun.RoleData.EATTRTYPE_MATK]   = 18 + PetLv * 1.78
  result[CommonFun.RoleData.EATTRTYPE_DEF]    = 22 + PetLv * 1.08
  result[CommonFun.RoleData.EATTRTYPE_MDEF]   = 28 + PetLv * 1.27
  result[CommonFun.RoleData.EATTRTYPE_MAXHP]  = 117 + PetLv * 97.98
  result[CommonFun.RoleData.EATTRTYPE_HIT]    = 74 + PetLv * 3.82
  result[CommonFun.RoleData.EATTRTYPE_FLEE]   = 62 + PetLv * 3.06
  result[CommonFun.RoleData.EATTRTYPE_CRI]    = 26.6 + PetLv *1.19
  result[CommonFun.RoleData.EATTRTYPE_CRIRES] = 20 + PetLv * 0.71
  elseif classtype==63 then
  result[CommonFun.RoleData.EATTRTYPE_ATK]    = 204 + PetLv * 14.74
  result[CommonFun.RoleData.EATTRTYPE_MATK]   = 30 + PetLv * 2.17
  result[CommonFun.RoleData.EATTRTYPE_DEF]    = 28 + PetLv * 1.4
  result[CommonFun.RoleData.EATTRTYPE_MDEF]   = 28 + PetLv * 1.72
  result[CommonFun.RoleData.EATTRTYPE_MAXHP]  = 121 + PetLv * 112.84
  result[CommonFun.RoleData.EATTRTYPE_HIT]    = 86 + PetLv * 4.97
  result[CommonFun.RoleData.EATTRTYPE_FLEE]   = 74 + PetLv * 3.95
  result[CommonFun.RoleData.EATTRTYPE_CRI]    = 31.2 + PetLv * 1.53
  result[CommonFun.RoleData.EATTRTYPE_CRIRES] = 22.7 + PetLv * 0.91
  else
  result[CommonFun.RoleData.EATTRTYPE_ATK]    = 264 + PetLv * 19.27
  result[CommonFun.RoleData.EATTRTYPE_MATK]   = 36 + PetLv * 2.87
  result[CommonFun.RoleData.EATTRTYPE_DEF]    = 34 + PetLv * 1.78
  result[CommonFun.RoleData.EATTRTYPE_MDEF]   = 40 + PetLv * 2.17
  result[CommonFun.RoleData.EATTRTYPE_MAXHP]  = 127 + PetLv * 133.61
  result[CommonFun.RoleData.EATTRTYPE_HIT]    = 110 + PetLv * 6.44
  result[CommonFun.RoleData.EATTRTYPE_FLEE]   = 92 + PetLv * 5.17
  result[CommonFun.RoleData.EATTRTYPE_CRI]    = 37.7 + PetLv * 1.99
  result[CommonFun.RoleData.EATTRTYPE_CRIRES] = 26.6 + PetLv * 1.19
  end

  return result
end


-- 炼金生命体属性计算
function CommonFun.calcBeingNpcAttrValue(attr, npcid, npclevel, srcUser)
  local result = {}
  if srcUser == nil then
    return result
  end

  local Vit = srcUser:GetProperty("Vit")
  local Str = srcUser:GetProperty("Str")
  local Int = srcUser:GetProperty("Int")

  local MaxHp = srcUser:GetProperty("MaxHp")

  local mapid,maptype = srcUser:GetMapInfo()-----------------获取所在地图
  if maptype==2 or maptype==4 then
      MaxHp = MaxHp/4
  end

  local Atk = srcUser:GetProperty("Atk")
  local MAtk = srcUser:GetProperty("MAtk")

  local Def = srcUser:GetProperty("Def")
  local MDef = srcUser:GetProperty("MDef")


  local Refine = srcUser:GetProperty("Refine")
  local MRefine = srcUser:GetProperty("MRefine")

  local Hit = srcUser:GetProperty("Hit")
  local Flee =srcUser:GetProperty("Flee")
  local Cri =srcUser:GetProperty("Cri")
  local CriRes =srcUser:GetProperty("CriRes")

  local npcSkillId_1 = srcUser:GetLernedSkillLevel(416) --生命体强化Ⅰ
  local npcSkillId_2 = srcUser:GetLernedSkillLevel(428) --生命体强化Ⅱ
  local npcSkillId_3 = srcUser:GetLernedSkillLevel(1127) -- 生命链接

  local QualityRatio = 2
  local lianjie=0
  if srcUser:HasBuffID(116310) then
       lianjie= 0.05*npcSkillId_3-0.25
  end
 --------------------------------------强袭双刃斧精炼强袭双刃斧[第七档]90001586
  local RefineLv7=srcUser:GetEquipedRefineLv(7)
  local Atk_7=0
  if  srcUser:HasBuffID(90001586)  and  RefineLv7 > 5 then
    Atk_7 = (RefineLv7-5)*10
  end

  --------------------------------------破灭战斧
  if  srcUser:HasBuffID(42010)  and  RefineLv7 > 5 then
    Atk_7 = (RefineLv7-5)*10
  end


 --------------------------------------强袭双刃斧精炼强袭双刃斧[第八档]90001587
  local AtkPer_7=0
  if  srcUser:HasBuffID(90001587)  and  RefineLv7 > 10 then
     AtkPer_7 = (RefineLv7-10)*0.01
  end
   --------------------------------------破灭战斧
  if  srcUser:HasBuffID(42010)  and  RefineLv7 > 10 then
     AtkPer_7 = (RefineLv7-10)*0.01
  end



  if npcid == 600010 then-----------------------丽芙
    result[CommonFun.RoleData.EATTRTYPE_STR] = (1 + (npclevel-1) * 0.05) * QualityRatio + attr[CommonFun.RoleData.EATTRTYPE_STR]
    result[CommonFun.RoleData.EATTRTYPE_AGI] = (1+ (npclevel-1) * 0.05) * QualityRatio + attr[CommonFun.RoleData.EATTRTYPE_AGI]
    result[CommonFun.RoleData.EATTRTYPE_VIT] = (7 + (npclevel-1) * 0.04) * QualityRatio + attr[CommonFun.RoleData.EATTRTYPE_VIT]
    result[CommonFun.RoleData.EATTRTYPE_INT] = (7 + (npclevel-1) * 0.35) * QualityRatio + attr[CommonFun.RoleData.EATTRTYPE_INT]
    result[CommonFun.RoleData.EATTRTYPE_DEX] = (3 + (npclevel-1) * 0.1) * QualityRatio + attr[CommonFun.RoleData.EATTRTYPE_DEX]
    result[CommonFun.RoleData.EATTRTYPE_LUK] = (1 + (npclevel-1) * 0.05) * QualityRatio + attr[CommonFun.RoleData.EATTRTYPE_LUK]

    ----生命体基础属性
    local BeingBase_ATK = 28 + (npclevel-1) * 0.96
    local BeingBase_MATK = 66 + (npclevel-1) * 2.81
    local BeingBase_DEF = 28 + (npclevel-1) * 1.38
    local BeingBase_MDEF =  42 + (npclevel-1) * 2.09
    local BeingBase_MAXHP = 130 + (npclevel-1) * 129.93
    local BeingBase_HIT = 62 + (npclevel-1) * 0.6
    local BeingBase_FLEE = 54 + (npclevel-1) * 0.19
    local BeingBase_CRI = 51.32 + (npclevel-1) * 0.07
    local BeingBase_CRIRES =50.8 + (npclevel-1) * 0.04

    ----来自人物属性
    local BeingToUser_ATK = Str * 0.5 + Atk * 0.02 + Refine * 0.3
    local BeingToUser_MATK = Int * 3 + MAtk * 0.02 + MRefine * 0.3
    local BeingToUser_DEF = Vit * 2 + Def * 0.3
    local BeingToUser_MDEF =  Int * 2 + MDef * 0.3
    local BeingToUser_MAXHP = Vit * 300 + MaxHp * 0.3
    local BeingToUser_HIT = 0
    local BeingToUser_FLEE = Flee * 0.5
    local BeingToUser_CRI = 0
    local BeingToUser_CRIRES = CriRes * 0.5


    result[CommonFun.RoleData.EATTRTYPE_ATK]    = (BeingBase_ATK + BeingToUser_ATK +Atk_7 + attr[CommonFun.RoleData.EATTRTYPE_ATK] + attr[CommonFun.RoleData.EATTRTYPE_STR] * 4.02 + attr[CommonFun.RoleData.EATTRTYPE_LUK] * 0.2 + attr[CommonFun.RoleData.EATTRTYPE_DEX] *0.2)* (1+attr[CommonFun.RoleData.EATTRTYPE_ATKPER])* (1+AtkPer_7)
    result[CommonFun.RoleData.EATTRTYPE_MATK]   = (BeingBase_MATK + BeingToUser_MATK +Atk_7 + attr[CommonFun.RoleData.EATTRTYPE_MATK] + attr[CommonFun.RoleData.EATTRTYPE_INT] * 2.01 + npcSkillId_1 * 100) *  (1+ npcSkillId_2 * 0.01) * (1+attr[CommonFun.RoleData.EATTRTYPE_MATKPER])* (1+AtkPer_7)
    result[CommonFun.RoleData.EATTRTYPE_DEF]    = BeingBase_DEF + BeingToUser_DEF + attr[CommonFun.RoleData.EATTRTYPE_DEF] + attr[CommonFun.RoleData.EATTRTYPE_VIT] * 1
    result[CommonFun.RoleData.EATTRTYPE_MDEF]   = BeingBase_MDEF + BeingToUser_MDEF + attr[CommonFun.RoleData.EATTRTYPE_MDEF] + attr[CommonFun.RoleData.EATTRTYPE_INT] * 1 + attr[CommonFun.RoleData.EATTRTYPE_VIT] * 0.5
    result[CommonFun.RoleData.EATTRTYPE_MAXHP]  = (BeingBase_MAXHP + BeingToUser_MAXHP + attr[CommonFun.RoleData.EATTRTYPE_MAXHP] +  npcSkillId_1 * 2000) * (1 + attr[CommonFun.RoleData.EATTRTYPE_VIT] / 100) * (1 + attr[CommonFun.RoleData.EATTRTYPE_MAXHPPER])
    if maptype==2 or maptype==4 then
      result[CommonFun.RoleData.EATTRTYPE_MAXHP] = result[CommonFun.RoleData.EATTRTYPE_MAXHP]*4
    end
    result[CommonFun.RoleData.EATTRTYPE_HIT]    = BeingToUser_HIT + BeingToUser_HIT +  attr[CommonFun.RoleData.EATTRTYPE_HIT] + attr[CommonFun.RoleData.EATTRTYPE_DEX] * 1
    result[CommonFun.RoleData.EATTRTYPE_FLEE]   = BeingBase_FLEE + BeingToUser_FLEE + attr[CommonFun.RoleData.EATTRTYPE_FLEE] + attr[CommonFun.RoleData.EATTRTYPE_AGI] * 1
    result[CommonFun.RoleData.EATTRTYPE_CRI]    = BeingBase_CRI + BeingToUser_CRI + attr[CommonFun.RoleData.EATTRTYPE_CRI] + attr[CommonFun.RoleData.EATTRTYPE_LUK] * 0.33
    result[CommonFun.RoleData.EATTRTYPE_CRIRES] = BeingBase_CRIRES + BeingToUser_CRIRES + attr[CommonFun.RoleData.EATTRTYPE_CRIRES] + attr[CommonFun.RoleData.EATTRTYPE_LUK] * 0.2
    result[CommonFun.RoleData.EATTRTYPE_ATKSPD] = 1.5
    result[CommonFun.RoleData.EATTRTYPE_DAMREDUC] = npcSkillId_2 * 0.02+lianjie

  elseif npcid==600020 then-----------------------艾米斯可魯
    result[CommonFun.RoleData.EATTRTYPE_STR] = (6 + (npclevel-1) * 0.3) * QualityRatio + attr[CommonFun.RoleData.EATTRTYPE_STR]
    result[CommonFun.RoleData.EATTRTYPE_AGI] = (1 + (npclevel-1) * 0.05) * QualityRatio + attr[CommonFun.RoleData.EATTRTYPE_AGI]
    result[CommonFun.RoleData.EATTRTYPE_VIT] = (8 + (npclevel-1) * 0.4) * QualityRatio + attr[CommonFun.RoleData.EATTRTYPE_VIT]
    result[CommonFun.RoleData.EATTRTYPE_INT] = (2 + (npclevel-1) * 0.1) * QualityRatio + attr[CommonFun.RoleData.EATTRTYPE_INT]
    result[CommonFun.RoleData.EATTRTYPE_DEX] = (2 + (npclevel-1) * 0.1) * QualityRatio + attr[CommonFun.RoleData.EATTRTYPE_DEX]
    result[CommonFun.RoleData.EATTRTYPE_LUK] = (1 + (npclevel-1) * 0.05) * QualityRatio + attr[CommonFun.RoleData.EATTRTYPE_LUK]

    ----生命体基础属性
    local BeingBase_ATK = 108 + (npclevel-1) * 4.94
    local BeingBase_MATK = 26 + (npclevel-1) * 0.79
    local BeingBase_DEF = 32 + (npclevel-1) * 1.6
    local BeingBase_MDEF =  24 + (npclevel-1) * 1.19
    local BeingBase_MAXHP = 134 + (npclevel-1) * 141.43
    local BeingBase_HIT = 58 + (npclevel-1) * 0.38
    local BeingBase_FLEE = 54 + (npclevel-1) * 0.19
    local BeingBase_CRI = 51.32 + (npclevel-1) * 0.07
    local BeingBase_CRIRES =50.8 + (npclevel-1) * 0.04

    ----来自人物属性
    local BeingToUser_ATK = Str * 5 + Atk * 0.02 + Refine * 0.3
    local BeingToUser_MATK = Int * 0.5 + MAtk * 0.02 + MRefine * 0.3
    local BeingToUser_DEF = Vit * 4 + Def * 0.6
    local BeingToUser_MDEF =  Int * 4+ MDef * 0.6
    local BeingToUser_MAXHP = Vit * 500 + MaxHp * 0.3
    local BeingToUser_HIT = Hit * 0.5
    local BeingToUser_FLEE = Flee * 0.5
    local BeingToUser_CRI = Cri * 0.5
    local BeingToUser_CRIRES = CriRes * 0.5

  ----------------------------------------------------------------炼金铠甲 + 强袭战斧或者合金炼金装甲 + 强袭战斧（炼金铠甲 + 强袭双刃斧或者合金炼金装甲 + 强袭双刃斧)
   -------------------------------------- 破灭战斧
    local Num1 = srcUser:GetBuffLayer(91000141)
    local Num2 = srcUser:GetBuffLayer(91000721)

    local AtkPer_1 = 0.03
    local AtkPer_2 = 0

    if srcUser:HasBuffID(91000141) or srcUser:HasBuffID(91000721) then
        AtkPer_2 =( Num1 + Num2 )* AtkPer_1
    end
  --------------------------------------强袭双刃斧精炼+15 或 破灭战斧

   local WeaponRefineLv=srcUser:GetEquipedRefineLv(7)
   if srcUser:HasBuffID(90001583) or  srcUser:HasBuffID(42010)  then
    if WeaponRefineLv ==15 then
       AtkPer_2 = AtkPer_2+0.1
    end
  end






    result[CommonFun.RoleData.EATTRTYPE_ATK]    = (BeingBase_ATK + BeingToUser_ATK +Atk_7  + attr[CommonFun.RoleData.EATTRTYPE_ATK] + attr[CommonFun.RoleData.EATTRTYPE_STR] * 4.02 + attr[CommonFun.RoleData.EATTRTYPE_LUK] * 0.2 + attr[CommonFun.RoleData.EATTRTYPE_DEX] *0.2 + npcSkillId_1 * 100) * (1+AtkPer_2+AtkPer_7) * (1+attr[CommonFun.RoleData.EATTRTYPE_ATKPER])
    result[CommonFun.RoleData.EATTRTYPE_MATK]   = (BeingBase_MATK + BeingToUser_MATK +Atk_7 + attr[CommonFun.RoleData.EATTRTYPE_MATK] + attr[CommonFun.RoleData.EATTRTYPE_INT] * 2.01) * (1+attr[CommonFun.RoleData.EATTRTYPE_MATKPER])* (1+AtkPer_7)
    result[CommonFun.RoleData.EATTRTYPE_DEF]    = BeingBase_DEF + BeingToUser_DEF + attr[CommonFun.RoleData.EATTRTYPE_DEF] + attr[CommonFun.RoleData.EATTRTYPE_VIT] * 1
    result[CommonFun.RoleData.EATTRTYPE_MDEF]   = BeingBase_MDEF + BeingToUser_MDEF + attr[CommonFun.RoleData.EATTRTYPE_MDEF] + attr[CommonFun.RoleData.EATTRTYPE_INT] * 1 + attr[CommonFun.RoleData.EATTRTYPE_VIT] * 0.5
    result[CommonFun.RoleData.EATTRTYPE_MAXHP]  = (BeingBase_MAXHP + BeingToUser_MAXHP + attr[CommonFun.RoleData.EATTRTYPE_MAXHP] ) * (1 + attr[CommonFun.RoleData.EATTRTYPE_VIT] / 100) *  (1+ npcSkillId_2 * 0.01) * (1 + attr[CommonFun.RoleData.EATTRTYPE_MAXHPPER])
    if maptype==2 or maptype==4 then
      result[CommonFun.RoleData.EATTRTYPE_MAXHP] = result[CommonFun.RoleData.EATTRTYPE_MAXHP]*4
    end
    result[CommonFun.RoleData.EATTRTYPE_HIT]    = BeingToUser_HIT + BeingToUser_HIT +  attr[CommonFun.RoleData.EATTRTYPE_HIT] + attr[CommonFun.RoleData.EATTRTYPE_DEX] * 1
    result[CommonFun.RoleData.EATTRTYPE_FLEE]   = BeingBase_FLEE + BeingToUser_FLEE + attr[CommonFun.RoleData.EATTRTYPE_FLEE] + attr[CommonFun.RoleData.EATTRTYPE_AGI] * 1
    result[CommonFun.RoleData.EATTRTYPE_CRI]    = BeingBase_CRI + BeingToUser_CRI + attr[CommonFun.RoleData.EATTRTYPE_CRI] + attr[CommonFun.RoleData.EATTRTYPE_LUK] * 0.33
    result[CommonFun.RoleData.EATTRTYPE_CRIRES] = BeingBase_CRIRES + BeingToUser_CRIRES + attr[CommonFun.RoleData.EATTRTYPE_CRIRES] + attr[CommonFun.RoleData.EATTRTYPE_LUK] * 0.2
    result[CommonFun.RoleData.EATTRTYPE_ATKSPD] = 1 + npcSkillId_1 * 0.05  + npcSkillId_2 * 0.05

  elseif npcid==600030 then-----------------------巴尼米乐斯
    result[CommonFun.RoleData.EATTRTYPE_STR] = (1 + (npclevel-1) * 0.05) * QualityRatio + attr[CommonFun.RoleData.EATTRTYPE_STR]
    result[CommonFun.RoleData.EATTRTYPE_AGI] = (1+ (npclevel-1) * 0.05) * QualityRatio + attr[CommonFun.RoleData.EATTRTYPE_AGI]
    result[CommonFun.RoleData.EATTRTYPE_VIT] = (6 + (npclevel-1) * 0.35) * QualityRatio + attr[CommonFun.RoleData.EATTRTYPE_VIT]
    result[CommonFun.RoleData.EATTRTYPE_INT] = (8 + (npclevel-1) * 0.4) * QualityRatio + attr[CommonFun.RoleData.EATTRTYPE_INT]
    result[CommonFun.RoleData.EATTRTYPE_DEX] = (3 + (npclevel-1) * 0.1) * QualityRatio + attr[CommonFun.RoleData.EATTRTYPE_DEX]
    result[CommonFun.RoleData.EATTRTYPE_LUK] = (1 + (npclevel-1) * 0.05) * QualityRatio + attr[CommonFun.RoleData.EATTRTYPE_LUK]

    ----生命体基础属性
    local BeingBase_ATK = 28 + (npclevel-1) * 0.96
    local BeingBase_MATK = 74 + (npclevel-1) * 3.21
    local BeingBase_DEF = 24 + (npclevel-1) * 1.19
    local BeingBase_MDEF =  44 + (npclevel-1) * 2.19
    local BeingBase_MAXHP = 126 + (npclevel-1) * 118.44
    local BeingBase_HIT = 62 + (npclevel-1) * 0.6
    local BeingBase_FLEE = 54 + (npclevel-1) * 0.19
    local BeingBase_CRI = 51.32 + (npclevel-1) * 0.07
    local BeingBase_CRIRES =50.8 + (npclevel-1) * 0.04

    ----来自人物属性
    local BeingToUser_ATK = Str * 1 + Atk * 0.02 + Refine * 0.3
    local BeingToUser_MATK = Int * 4.5 + MAtk * 0.02 + MRefine * 0.3
    local BeingToUser_DEF = Vit * 1 + Def * 0.3
    local BeingToUser_MDEF =  Int * 1 + MDef * 0.3
    local BeingToUser_MAXHP = Vit * 300 + MaxHp * 0.3
    local BeingToUser_HIT = 0
    local BeingToUser_FLEE = Flee * 0.5
    local BeingToUser_CRI = 0
    local BeingToUser_CRIRES = CriRes * 0.5




    result[CommonFun.RoleData.EATTRTYPE_ATK]    = (BeingBase_ATK + BeingToUser_ATK +Atk_7  + attr[CommonFun.RoleData.EATTRTYPE_ATK] + attr[CommonFun.RoleData.EATTRTYPE_STR] * 4.02 + attr[CommonFun.RoleData.EATTRTYPE_LUK] * 0.2 + attr[CommonFun.RoleData.EATTRTYPE_DEX] *0.2 )* (1+attr[CommonFun.RoleData.EATTRTYPE_ATKPER])* (1+AtkPer_7)
    result[CommonFun.RoleData.EATTRTYPE_MATK]   = (BeingBase_MATK + BeingToUser_MATK +Atk_7 + attr[CommonFun.RoleData.EATTRTYPE_MATK] + attr[CommonFun.RoleData.EATTRTYPE_INT] * 2.01 + npcSkillId_1 * 100) * (1+ npcSkillId_2 * 0.01) * (1+attr[CommonFun.RoleData.EATTRTYPE_MATKPER])* (1+AtkPer_7)
    result[CommonFun.RoleData.EATTRTYPE_DEF]    = BeingBase_DEF + BeingToUser_DEF + attr[CommonFun.RoleData.EATTRTYPE_DEF] + attr[CommonFun.RoleData.EATTRTYPE_VIT] * 1 + npcSkillId_1 * 40
    result[CommonFun.RoleData.EATTRTYPE_MDEF]   = BeingBase_MDEF + BeingToUser_MDEF + attr[CommonFun.RoleData.EATTRTYPE_MDEF] + attr[CommonFun.RoleData.EATTRTYPE_INT] * 1 + attr[CommonFun.RoleData.EATTRTYPE_VIT] * 0.5
    result[CommonFun.RoleData.EATTRTYPE_MAXHP]  = (BeingBase_MAXHP + BeingToUser_MAXHP + attr[CommonFun.RoleData.EATTRTYPE_MAXHP] ) * (1 + attr[CommonFun.RoleData.EATTRTYPE_VIT] / 100) * (1 + attr[CommonFun.RoleData.EATTRTYPE_MAXHPPER])
    if maptype==2 or maptype==4 then
      result[CommonFun.RoleData.EATTRTYPE_MAXHP] = result[CommonFun.RoleData.EATTRTYPE_MAXHP]*4
    end
    result[CommonFun.RoleData.EATTRTYPE_HIT]    = BeingToUser_HIT + BeingToUser_HIT +  attr[CommonFun.RoleData.EATTRTYPE_HIT] + attr[CommonFun.RoleData.EATTRTYPE_DEX] * 1
    result[CommonFun.RoleData.EATTRTYPE_FLEE]   = BeingBase_FLEE + BeingToUser_FLEE + attr[CommonFun.RoleData.EATTRTYPE_FLEE] + attr[CommonFun.RoleData.EATTRTYPE_AGI] * 1
    result[CommonFun.RoleData.EATTRTYPE_CRI]    = BeingBase_CRI + BeingToUser_CRI + attr[CommonFun.RoleData.EATTRTYPE_CRI] + attr[CommonFun.RoleData.EATTRTYPE_LUK] * 0.33
    result[CommonFun.RoleData.EATTRTYPE_CRIRES] = BeingBase_CRIRES + BeingToUser_CRIRES + attr[CommonFun.RoleData.EATTRTYPE_CRIRES] + attr[CommonFun.RoleData.EATTRTYPE_LUK] * 0.2
    result[CommonFun.RoleData.EATTRTYPE_ATKSPD] = 1.5
    result[CommonFun.RoleData.EATTRTYPE_DAMREDUC] = npcSkillId_2 * 0.02+lianjie
  end

  return result

end
function CommonFun.ShapeCorrection(srcUser,targetUser)
  local value=2
  local WeaponType =srcUser:GetEquipedWeaponType()
  local ShapeAtkPer = srcUser:GetProperty("ShapeAtkPer")
  local AttrEffect = srcUser:GetProperty("AttrEffect")
  local bits=CommonFun.getBits(AttrEffect)

  if nil ~= CommonFun.Shape then
    if CommonFun.Shape.S == targetUser.shape then
        value = 1
    elseif CommonFun.Shape.M == targetUser.shape then
        value = 2
    elseif CommonFun.Shape.L == targetUser.shape then
        value = 3
    end
 end

 --------------------------------------------------------------------无视体型伤害卡片带来的效果加成
  if bits[CommonFun.AttrEffect.IgnoreBodyDamage]==1 then
     return 1
  end

  local A = WeaponShapeCorrection[WeaponType][value]*(1+ShapeAtkPer)
  if A>=1 then
     return 1
  end


  return WeaponShapeCorrection[WeaponType]~=nil and A or 1

end




-------------物防属性调用公式(物防成长属性变动时这里也要做相应修改)
function CommonFun.CalcDef(Def,Vit,srcUser,targetUser)
 local Buff = srcUser:HasBuffID(24700)
 local targetRace = targetUser.race
 local Def2 = targetUser:GetProperty("Def")
 local Vit2 = targetUser:GetProperty("Vit")
 local DefPer2 = targetUser:GetProperty("DefPer")
 local RealDef = Def2 - Vit2

 if Def2<= 0 then
    Def2 = 0
 end
 --------------------------------------无视动物系防御
 if Buff==true and targetRace ==1 then
    RealDef = 0
 end

 if RealDef <= 0 then
    RealDef  = 0
 end
 ----------------------------------------乘算防御忽视
  local IgnoreDef  = 0
  local IgnoreDef1 = srcUser:GetProperty("IgnoreDef")
  local IgnoreDef2 = srcUser:GetProperty("IgnoreEquipDef")
  if targetUser.boss or targetUser.mini then
     IgnoreDef=IgnoreDef1
  else
     IgnoreDef=(IgnoreDef1+IgnoreDef2)
  end
------------------------------------------------------------------------竞技场额外增加物理防御%
    local mapid,maptype = srcUser:GetMapInfo()-----------------获取所在地图
    ------------------------maptype 1 :野外 2：pvp 3:其他普通副本 4:gvg
    if maptype==2 or maptype==4 then

      DefPer2 = DefPer2 < -1 and -1 or DefPer2 > 1 and 1 or DefPer2
      DefPer2 = math.floor(DefPer2*1000)/1000
      DefPer2 = DefPer2 + 0.3*(1-math.sin(DefPer2*3.14/2))
    end

  local DefFinal = RealDef*(1+DefPer2-IgnoreDef)

    if DefFinal < 0 then
       DefFinal = 0
    end

 local div      = (4000+DefFinal*10)
       div      = (div ~= 0 and div or 1)

 local DefReduc1 = (4000+DefFinal)/div
 -----------------------------------------------新的物理防御计算公式
 local Atk = srcUser:GetProperty("Atk")
 local AtkPer = srcUser:GetProperty("AtkPer")
 local AtkFinal = Atk*(1+AtkPer)

 local DefReduc2 = 1/(1+6*DefFinal/AtkFinal)

 local DefReduc = math.max(DefReduc1,DefReduc2)

 return DefReduc
end


-------------法防属性调用公式(法防成长属性变动时这里也要做相应修改)
function CommonFun.CalcMDef(MDef,Int,Vit,srcUser,targetUser)
  local MDef2 = targetUser:GetProperty("MDef")
  local Int2 = targetUser:GetProperty("Int")
  local RealMDef = MDef2 - Int2

 if MDef2 <= 0 then
    MDef2  = 0
 end

 if RealMDef <= 0 then
    RealMDef   = 0
 end

  local IgnoreMDef = srcUser:GetProperty("IgnoreMDef")

  local MDefPer2 = targetUser:GetProperty("MDefPer")

  ------------------------------------------------------------------------竞技场额外增加物理防御%
    local mapid,maptype = srcUser:GetMapInfo()-----------------获取所在地图
    ------------------------maptype 1 :野外 2：pvp 3:其他普通副本 4:gvg
    if maptype==2 or maptype==4 then
      MDefPer2 = MDefPer2 < -1 and -1 or MDefPer2 > 1 and 1 or MDefPer2
      MDefPer2 = math.floor(MDefPer2*1000)/1000
      MDefPer2 = MDefPer2 + 0.3*(1-math.sin(MDefPer2*3.14/2))
    end


  local MDefFinal= RealMDef*(1+MDefPer2-IgnoreMDef)
  if MDefFinal < 0 then
      MDefFinal = 0
  end

  local div = (1000+MDefFinal*10)
        div = (div ~= 0 and div or 1)

  local MDefReduc1 = (1000+MDefFinal)/div
  ---------------------------------------------新的魔法防御计算公式
  local MAtk = srcUser:GetProperty("MAtk")
  local MAtkPer = srcUser:GetProperty("MAtkPer")
  local MAtkFinal= MAtk*(1+MAtkPer)

  local MDefReduc2 = 1/(1+13*MDefFinal/MAtkFinal)

  local MDefReduc = math.max(MDefReduc1,MDefReduc2)

 return MDefReduc
end

function CommonFun.ParseRace(str)
    if "Brute" == str then
        return CommonFun.Race.Brute
    elseif "DemiHuman" == str then
        return CommonFun.Race.DemiHuman
    elseif "Demon" == str then
        return CommonFun.Race.Demon
    elseif "Plant" == str then
        return CommonFun.Race.Plant
    elseif "Undead" == str then -- Table_Monster is Undead
        return CommonFun.Race.DeadLess
    elseif "Formless" == str then
        return CommonFun.Race.Formless
    elseif "Fish" == str then
        return CommonFun.Race.Fish
    elseif "Angel" == str then
        return CommonFun.Race.Angel
    elseif "Insect" == str then
        return CommonFun.Race.Insect
    elseif "Dragon" == str then
        return CommonFun.Race.Dragon
    end
end

function CommonFun.ParseNature(str)
    if "Wind" == str then
        return CommonFun.Nature.Wind
    elseif "Earth" == str then
        return CommonFun.Nature.Earth
    elseif "Water" == str then
        return CommonFun.Nature.Water
    elseif "Fire" == str then
        return CommonFun.Nature.Fire
    elseif "Neutral" == str then
        return CommonFun.Nature.Neutral
    elseif "Holy" == str then
        return CommonFun.Nature.Holy
    elseif "Shadow" == str then
        return CommonFun.Nature.Shadow
    elseif "Ghost" == str then
        return CommonFun.Nature.Ghost
    elseif "Undead" == str then
        return CommonFun.Nature.Undead
    elseif "Poison" == str then
        return CommonFun.Nature.Poison
    end
end
-------------------------------------------------------------------------------------------------武器ATK上的种族加伤效果
function CommonFun.CalcRaceParam(srcUser, targetUser, params, damageParam, logger)
    local raceInc = 0
    local raceRed = 0

    local srcRace = srcUser.race
    local targetRace = targetUser.race

    if nil == CommonFun.RaceProps[targetRace] then
        return 1
    end
    if nil == CommonFun.RaceProps[srcRace] then
        return 1
    end
    raceInc = srcUser:GetProperty(CommonFun.RaceProps[targetRace][1])
    raceRed = targetUser:GetProperty(CommonFun.RaceProps[srcRace][2])

    ---------------------------------------------------------------------阿修罗霸皇拳 忽视部分减伤
    local skilllv = srcUser:GetLernedSkillLevel(306)
    local skillID, skillLevel = CommonFun.UnmergeSkillID(params.skillIDAndLevel)
    if skilllv>5 and skillID==306 then
        raceRed = math.max(raceRed-0.06*(skilllv-5),0)
    end

    local A =  (1+raceInc-raceRed)

    --print("A1="..A)
    ------------------------------------------------------------------------竞技场额外增加30%种族减免
    local mapid,maptype = srcUser:GetMapInfo()-----------------获取所在地图
    ------------------------maptype 1 :野外 2：pvp 3:其他普通副本 4:gvg
    if maptype==2 or maptype==4 then
      local B = raceRed - raceInc  ---------------种族伤害减免
      B = B < -1 and -1 or B > 1 and 1 or B
      B = math.floor(B*1000)/1000
      B = B + 0.3*(1-math.sin(B*3.14/2))
      --print("B2="..B)
      A = 1 - B
    end
    --print("A2="..A)

    if A <= 0.1 then
       A  = 0.1
    end

    return A
end
-------------------------------------------------------------------------------------------------最终伤害的种族减伤效果
function CommonFun.CalcRaceParam2(srcUser, targetUser, params, damageParam, logger)
    local raceInc = 0
    local raceRed = 0

    local srcRace = srcUser.race
    local targetRace = targetUser.race

    if nil == CommonFun.RaceProps[targetRace] then
        return 1
    end
    if nil == CommonFun.RaceProps[srcRace] then
        return 1
    end
    raceInc = srcUser:GetProperty(CommonFun.RaceProps[targetRace][1])
    raceRed = targetUser:GetProperty(CommonFun.RaceProps[srcRace][2])

    return (1-raceRed)
end
--------------------------------------------------------------------------------------------武器ATK上的体型加伤效果
function CommonFun.CalcBodyParam(srcUser, targetUser, params, damageParam, logger)
    local bodyInc = 0
    local bodyRed = 0

    local srcShape = srcUser.shape
    local targetShape = targetUser.shape

    bodyInc = srcUser:GetProperty(CommonFun.ShapeProps[targetShape][1])
    bodyRed = targetUser:GetProperty(CommonFun.ShapeProps[srcShape][2])

    local A = (1+bodyInc-bodyRed)
    if A <= 0.1 then
       A  = 0.1
    end

    return A
end
--------------------------------------------------------------------------------------------最终伤害的体型减伤效果
function CommonFun.CalcBodyParam2(srcUser, targetUser, params, damageParam, logger)
    local bodyInc = 0
    local bodyRed = 0

    local srcShape = srcUser.shape
    local targetShape = targetUser.shape

    bodyInc = srcUser:GetProperty(CommonFun.ShapeProps[targetShape][1])
    bodyRed = targetUser:GetProperty(CommonFun.ShapeProps[srcShape][2])

    local result = (1-bodyRed)

    if result <= 0.1 then
       result = 0.1
    end

    return result
end

------------------------------------------------------------------------------------------武器ATK上的BOSS加伤效果
function CommonFun.CalcBossParam(srcUser, targetUser, params, damageParam, logger)
    local bossInc = 0
    local NpcDamPer = 0
    local MonsterDamPer = 0
    local NpcResPer = 0

    if  targetUser:GetNpcID() == 0 then
        NpcDamPer = srcUser:GetProperty("NpcDamPer")
        NpcResPer = targetUser:GetProperty("NpcResPer")
    end

    if targetUser.boss or targetUser.mini then
        bossInc = srcUser:GetProperty("BossDamPer")
    end

    if targetUser.boss == false and targetUser.mini == false and targetUser:GetNpcID() ~= 0 then
       MonsterDamPer = srcUser:GetProperty("MonsterDamPer")
    end

    local A = (1 + bossInc) * (1 + NpcDamPer-NpcResPer) * (1 + MonsterDamPer)

    if A <= 0.1 then
       A  = 0.1
    end

    return A
end

------------------------------------------------------------------------------------------最终伤害的BOSS减伤效果
function CommonFun.CalcBossParam2(srcUser, targetUser, params, damageParam, logger)
    local bossRed = 0

    if srcUser.boss or srcUser.mini then
        bossRed = targetUser:GetProperty("BossResPer")
    end
    local result = 1 - bossRed

    if result <= 0.1 then
       result = 0.1
    end

    return result
end

--获取目标攻击属性
-----------------------------------------
function  CommonFun.GetUserAtkAttrByList(srcUser, params, damageParamList)
    if damageParamList == nil or damageParamList[1] == nil then
  return 5
    end
    return CommonFun.GetUserAtkAttr(srcUser, params, damageParamList[1])
end
-------------------------------------------------------------------------------------------------------------获取目标的攻击属性
function CommonFun.GetUserAtkAttr(srcUser, params, damageParam)
    local skillParams = Table_Skill[params.skillIDAndLevel]
    if skillParams == nil then
      return 0
    end

    if damageParam == nil then
      return 0
    end

    -- check 是否消耗箭矢
    local hasArrow = false
    local arrowNum = 0
    if skillParams.StrengthenCost ~= nil then
      for key, val in pairs(skillParams.StrengthenCost) do
        if val.type == 1 and val.num ~= nil then
          hasArrow = true
          arrowNum = val.num
        end
      end
    end
    -- get 攻击属性
    local srcAtkElement = 0

    if damageParam.elementparam ~= nil and damageParam.elementparam ~= 0 then
      -- 优先技能自身攻击属性
      srcAtkElement = damageParam.elementparam

    elseif hasArrow == false then
      -- 无箭矢技能 直接取attr攻击属性
      srcAtkElement = srcUser:GetProperty("AtkAttr")
    else
      -- 有箭矢技能 优先选取主动buff带来的攻击属性
      local AttrEffect = srcUser:GetProperty("AttrEffect")
      local bits = CommonFun.getBits(AttrEffect)

      -- Buff 优先箭矢
      if bits[CommonFun.AttrEffect.BuffPriorArrow] == 1 then
        srcAtkElement = srcUser:GetProperty("AtkAttr")

      -- 服务端箭矢
      elseif srcUser.arrow_server ~= nil then
        if srcUser.arrow_server ~= 0 then
          srcAtkElement = CommonFun.GetAtkAttrByArrow(srcUser.arrow_server)
        else
          srcAtkElement = srcUser:GetProperty("AtkAttr")
        end

      -- 客户端箭矢
      elseif srcUser:GetArrowID() == 0 then
        srcAtkElement = srcUser:GetProperty("AtkAttr")
      else
        local arrowid = srcUser:GetArrowID()
        local hasNum = srcUser:GetPackageItemNum(arrowid)
        if hasNum >= arrowNum then
          srcAtkElement = CommonFun.GetAtkAttrByArrow(arrowid)
        else
          srcAtkElement = srcUser:GetProperty("AtkAttr")
        end
      end
    end

    return srcAtkElement;
end

function CommonFun.calcElementRate(srcUser, targetUser, params, damageParam, logger)
  local srcAtkElement = CommonFun.GetUserAtkAttr(srcUser, params, damageParam)
  local targetDefElement = targetUser:GetProperty("DefAttr")
  local ElementRate = GameConfig.ElementRestrain[srcAtkElement][targetDefElement]
  -----------------------------------------------------------------------------------------星盘加成的毒属性对其他属性克制系数
  local Num1 = srcUser:GetRunePoint(31019)
  local Num2 = srcUser:GetRunePoint(31020)
  local RuneRate = (Num1 + Num2)*0.1

  if srcAtkElement == 10 then
     return ElementRate + RuneRate
  end

    if nil == srcAtkElement then
        logger.error(string.format("%s srcAtkElement is nil", srcUser.name))
        return 0
    end
    if nil == targetDefElement then
        logger.error(string.format("%s targetDefElement is nil", targetUser.name))
        return 0
    end
    if nil == GameConfig.ElementRestrain[srcAtkElement] then
        logger.error(string.format("%s GameConfig.ElementRestrain[%s] is nil", srcUser.name, tostring(srcAtkElement)))
        return 0
    end

    if nil == CommonFun.NatureProps[srcAtkElement] then
        logger.error(string.format("CommonFun.NatureProps[%s] is nil", tostring(srcAtkElement)))
        return 0
    end

    return ElementRate

end
--------------------------------------------------------------------------------------------------------武器ATK上的属性加伤效果
function CommonFun.CalcElementParam(srcUser, targetUser, params, damageParam, logger)
    local elementInc = 0
    local elementRed = 0

    local srcAtkElement = CommonFun.GetUserAtkAttr(srcUser, params, damageParam)
    local targetDefElement = targetUser:GetProperty("DefAttr")


    if nil == srcAtkElement then
        logger.error(string.format("%s srcAtkElement is nil", srcUser.name))
        return 0
    end
    if nil == targetDefElement then
        logger.error(string.format("%s targetDefElement is nil", targetUser.name))
        return 0
    end
    if nil == CommonFun.NatureProps[targetDefElement] then
        logger.error(string.format("%s CommonFun.NatureProps[][%s] is nil", srcUser.name, tostring(targetDefElement)))
        return 0
    end

    if nil == CommonFun.NatureProps[srcAtkElement] then
        logger.error(string.format("CommonFun.NatureProps[%s] is nil", tostring(srcAtkElement)))
        return 0
    end

    elementInc = srcUser:GetProperty(CommonFun.NatureProps[targetDefElement][1])
    elementRed = targetUser:GetProperty(CommonFun.NatureProps[srcAtkElement][2])

    return (1+elementInc)*CommonFun.calcElementRate(srcUser, targetUser, params, damageParam, logger)
end

--------------------------------------------------------------------------------------------------------最终伤害的属性减伤效果
function CommonFun.CalcElementParam2(srcUser, targetUser, params, damageParam, logger)
    local elementInc = 0
    local elementRed = 0

    local srcAtkElement = CommonFun.GetUserAtkAttr(srcUser, params, damageParam)
    local targetDefElement = targetUser:GetProperty("DefAttr")

    if nil == srcAtkElement then
        logger.error(string.format("%s srcAtkElement is nil", srcUser.name))
        return 0
    end
    if nil == targetDefElement then
        logger.error(string.format("%s targetDefElement is nil", targetUser.name))
        return 0
    end
    if nil == CommonFun.NatureProps[targetDefElement] then
        logger.error(string.format("%s CommonFun.NatureProps[%s] is nil", srcUser.name, tostring(targetDefElement)))
        return 0
    end

    if nil == CommonFun.NatureProps[srcAtkElement] then
        logger.error(string.format("CommonFun.NatureProps[%s] is nil", tostring(srcAtkElement)))
        return 0
    end

    elementInc = srcUser:GetProperty(CommonFun.NatureProps[targetDefElement][1])
    elementRed = targetUser:GetProperty(CommonFun.NatureProps[srcAtkElement][2])
    elementAtk = srcUser:GetProperty(CommonFun.NatureProps[srcAtkElement][3])

    if nil==elementAtk then
        elementAtk = 0
    end
    ---------------------------------------------------------------------阿修罗霸皇拳 忽视部分减伤
    local skilllv = srcUser:GetLernedSkillLevel(306)
    local skillID, skillLevel = CommonFun.UnmergeSkillID(params.skillIDAndLevel)
    if skilllv>5 and skillID==306 then
        elementRed = math.max(elementRed-0.06*(skilllv-5),0)
    end

    local result = 1+elementAtk-elementRed

    ------------------------------------------------------------------------竞技场额外增加30%元素减免
    local mapid,maptype = srcUser:GetMapInfo()-----------------获取所在地图
    ------------------------maptype 1 :野外 2：pvp 3:其他普通副本 4:gvg
    if maptype==2 or maptype==4 then
      local B = elementRed - elementAtk  ---------------元素伤害减免
      B = B < -1 and -1 or B > 1 and 1 or B
      B = math.floor(B*1000)/1000
      B = B + 0.3*(1-math.sin(B*3.14/2))
      --print("B2="..B)
      result = 1 - B
    end


    if result <= 0.1 then
        result = 0.1
    end

    return result
end


function CommonFun.MergeSkillID(skillID, skillLevel)
    return skillID*1000 + skillLevel
end
function CommonFun.UnmergeSkillID(skillIDAndLevel)
    return math.floor(skillIDAndLevel/1000), skillIDAndLevel%1000
end

function CommonFun.IsInRate(rate, random)
  if rate == nil or random == nil then
    return false
  end
  return rate > random
end

function CommonFun.RandomRange(min, max, random)
    if random == nil then
      return 0
    end
    local p = random / 100
    p = min+p*(max-min)
    return p
end

function CommonFun.Clamp( value, min, max )
    if min > value then
        return min
    end
    if max < value then
        return max
    end
    return value
end
-----------------------------------------------用数字获取RoleData里的属性
function CommonFun.GetAttrName(attrid)
  if Table_RoleData then
    local attr = Table_RoleData[attrid]
    if attr then
      return attr.VarName
    end
  end
  return ""
end
------------------------------------------------------------------------------------------------计算完自己命中对敌方闪避后的真实命中值
function CommonFun.CalcHitRate(srcUser, targetUser, skillParams)
    local Hit = srcUser:GetProperty("Hit")
    local Flee2 = targetUser:GetProperty("Flee")
    local StateEffect2 = targetUser:GetProperty("StateEffect")
    local bits2=CommonFun.getBits(StateEffect2)
    --------------------------------------------------------------------------------星盘增加的音速投掷命中修正效果
    local skilllv_1 = skillParams.id
    local Num1 = srcUser:GetRunePoint(32011)
    local Num2 = srcUser:GetRunePoint(32012)
    local RuneHit = Num1*0.1 + Num2*0.05
    --------------------------------------------------------------------------------星盘增加盾击命中修正效果
    local Num3 = srcUser:GetRunePoint(70130)
    local RuneHit2 = Num3*0.2

    local SkillHit = skillParams.SkillHit or 0

    if  skilllv_1==nil then
        RuneHit = 0
    end

    if math.floor(skilllv_1/1000)==181 or math.floor(skilllv_1/1000)==1111 then
       SkillHit =  (skillParams.SkillHit or 0) +  RuneHit
    end

    if math.floor(skilllv_1/1000)==355 then
       SkillHit =  (skillParams.SkillHit or 0) +  RuneHit2
    end
    ---------------------------------------------------------------------------------分割线

    local rate = (Hit+80)*(1+SkillHit)-Flee2
    ---------------------------------------------------------------------------眩晕/睡眠/冰冻/石化情况下必定会被命中
    if bits2[CommonFun.StateEffect.Dizzy]==1 or bits2[CommonFun.StateEffect.Freeze]==1 or bits2[CommonFun.StateEffect.Stone]==1 or bits2[CommonFun.StateEffect.Sleep]==1 then
       rate=100
    end
    ----------------------------------------------------------------------------------------必定命中的技能
    if math.floor(skilllv_1/1000)==319 or math.floor(skilllv_1/1000)==306 or math.floor(skilllv_1/1000)==310 or math.floor(skilllv_1/1000)==411 or math.floor(skilllv_1/1000)==422 or math.floor(skilllv_1/1000)==91001 or math.floor(skilllv_1/1000)==410 then
       rate=100
    end
    if math.floor(skilllv_1/1000)==1284 or math.floor(skilllv_1/1000)==1288 or math.floor(skilllv_1/1000)==1122 then
        rate=100
    end
    --------------------------舍命攻击必定命中
    if srcUser:HasBuffID(115090) then
      local Hp = srcUser:GetProperty("Hp")
      local MaxHp = srcUser:GetProperty("MaxHp")

      if Hp>MaxHp*0.09 and math.floor(skilllv_1/1000)==372 then ------只有普攻必定命中
          rate=100
      end
    end

    rate = CommonFun.Clamp(rate, 5, 100)
    return rate
end
------------------------------------------------------------------------------------------------计算完敌方命中和自己闪避后的真实闪避值
function CommonFun.CalcFleeRate(srcUser, targetUser, skillParams)
    local Hit = srcUser:GetProperty("Hit")
    local Flee2 = targetUser:GetProperty("Flee")

    local rate = 0
    rate = CommonFun.Clamp(rate, 0, 100)

    return rate
end
-------------------------------------------------------------------------------------------------计算完自己暴击和敌方暴击抵抗后的真实暴击值
function CommonFun.CalcCritRate(srcUser, targetUser, skillParams)
    local Cri        =  srcUser:GetProperty("Cri")
    local CriRes2    =  targetUser:GetProperty("CriRes")
    local Hp         =  targetUser:GetProperty("Hp")
    local MaxHp      =  targetUser:GetProperty("MaxHp")
    local targetRace =  targetUser.race
    local DefAttr2   =  targetUser:GetProperty("DefAttr")
    local AttrEffect =  srcUser:GetProperty("AttrEffect2")
    local bits       =  CommonFun.getBits(AttrEffect)
    -------------------------------------------野性觉醒的计算效果
    local skillLevel = srcUser:GetLernedSkillLevel(250)
    local rate = Cri-CriRes2
    local Card1 = srcUser:GetEquipCardNum(7,20097)-------------获取武器部位犬妖弓箭手卡片数量
    local Card2 = srcUser:GetEquipCardNum(7,20030)-------------获取武器部位弓箭哥布灵卡片数量
    local Card3 = srcUser:GetEquipCardNum(7,20031)-------------获取武器部位喷射哥布灵卡片数量
    local Card4 = srcUser:GetEquipCardNum(7,24016)-------------获取武器部位海豹宝宝卡片数量
    local Card5 = srcUser:GetEquipCardNum(7,20114)-------------获取武器部位玩具士兵卡片数量
    local a=0
    local b=0
    local c=0
    local d=0
    local e=0
    if targetRace == 4 then
      a=Card1*20
    end
    if targetRace == 5 then
      b=Card2*20
    end
    if targetRace == 6 then
      c=Card3*20
    end
    if bits[CommonFun.AttrEffect2.MushiCrit]==1 and (targetRace== 3 or DefAttr2 == 9) then
      d=Card4*9
    end
    if targetRace == 1 then
      e=Card5*10
    end
    -------------------------------------------野性觉醒等级大于5级时目标血量变化
    local Hp_rate= 0.3
    if skillLevel > 5 then
      Hp_rate = Hp_rate + (skillLevel-5)*0.04
    end

    if Hp <= MaxHp*Hp_rate then
         rate = Cri-CriRes2+math.min(skillLevel*6,30)+a+b+c+d+e
    else
         rate = Cri-CriRes2+a+b+c+d+e
    end

    --------------------------舍命攻击必定不暴击
    if srcUser:HasBuffID(115090) then
      local Hp = srcUser:GetProperty("Hp")
      local MaxHp = srcUser:GetProperty("MaxHp")

      if Hp>MaxHp*0.09 then
          rate=0
      end
    end
    ------------------------------------------攻击年兽不暴击
    if targetUser:GetNpcID() == 30043 then
        rate = 0
    end
    if targetUser:GetNpcID() == 56008 or targetUser:GetNpcID() == 56009 or targetUser:GetNpcID() == 56010 or targetUser:GetNpcID() == 56011 or targetUser:GetNpcID() == 56012 or targetUser:GetNpcID() == 56013 then
        rate = 0
    end
    rate = CommonFun.Clamp(rate, 0, 100)
    return rate
end
---------------------------------------------------------------------------------------------------------------先判定是否命中，如果命中走暴击，否则走闪避
---------------------------------------------------------------------------------------------------------------调整为先判断是否暴击，如果暴击走暴击，否则判断命中和闪避
function CommonFun.IsMiss(srcUser, targetUser, skillParams)
    -- 必定命中且暴击
    local AttrEffect = srcUser:GetProperty("AttrEffect")
    local StateEffect2 = targetUser:GetProperty("StateEffect")
    local bits=CommonFun.getBits(AttrEffect)
    local bits2=CommonFun.getBits(StateEffect2)

    --------------------------------------------------------------------------------------------------------并定名中且暴击，或者睡眠情况下 是不会闪避的
    if bits[CommonFun.AttrEffect.MustHitAndCri] == 1 or bits2[CommonFun.StateEffect.Sleep]==1 then
      return false
    end

    -- 1----------------------------------------------------------------------------------------------------判断自己对敌方的命中是否成立，不成立则返回闪避
    local hitRate = CommonFun.CalcHitRate(srcUser, targetUser, skillParams)

        if CommonFun.IsInRate(hitRate, srcUser:GetRandom()) == false then
           return true
        end
    -- 2----------------------------------------------------------------------------------------------------判断自己对敌方的闪避是否成立，成立则返回闪避
    --local fleeRate = CommonFun.CalcFleeRate(srcUser, targetUser, skillParams)
    --local random = srcUser:GetRandom()
    --if CommonFun.IsInRate(fleeRate, random) then
      --return true
    --end

    return false
end

function CommonFun.IsCrit(srcUser, targetUser, skillParams)
    -- 必定命中且暴击
    local AttrEffect = srcUser:GetProperty("AttrEffect")
    local AttrEffect2 = targetUser:GetProperty("AttrEffect")
    local StateEffect2 = targetUser:GetProperty("StateEffect")
    local bits=CommonFun.getBits(AttrEffect)
    local bits1=CommonFun.getBits(AttrEffect2)
    local bits2=CommonFun.getBits(StateEffect2)
    local skillID = skillParams.id
    if math.floor(skillID/1000)== 91001 then-----------------------波利乱斗技能撞击判断不会暴击
      return false
    end

    -----------------------------------------------------------------------------------------------------并定名中且暴击属性和睡眠属性都会导致必定被暴击
    if bits[CommonFun.AttrEffect.MustHitAndCri] == 1 or bits2[CommonFun.StateEffect.Sleep]==1 then
      return true
    end
    -----------------------------------------------------------------------------------------------------必定无法被暴击属性导致不会受到暴击
    if bits1[CommonFun.AttrEffect.MustNotCri] == 1 then
       return false
    end

    local critRate = CommonFun.CalcCritRate(srcUser, targetUser, skillParams)

    -----------------------------------------------------------------------------------------------------判断自己对敌方暴击是否成立，成立返回暴击值
    if CommonFun.IsInRate(critRate, srcUser:GetRandom()) then
      return true
    end
    return false
end

function CommonFun.CalcCrit(srcUser, targetUser, skillParams)
    local Cri        =  srcUser:GetProperty("Cri")
    local CriRes    =  targetUser:GetProperty("CriRes")
    local CriDamPer  =  srcUser:GetProperty("CriDamPer")
    local CriDefPer2 =  targetUser:GetProperty("CriDefPer")
    local targetRace =  targetUser.race
    local Weapon =  srcUser:GetEquipedID(7)

    local diff = CriDamPer-CriDefPer2;

    if srcUser:HasBuffID(810006) then ------------------灵魂刺杀符文
      diff = diff + (Cri-CriRes) * 0.05
    end

    local scale = 1.5+diff
    ---------------------------------------------------------------------------------暗灵之斧对恶魔种族暴击伤害加成
    if targetRace==3 and (Weapon==41815 or Weapon==141815) then
          scale = 1.75+diff
    end
    ---------------------------------------------------------------------------------弓箭手哥布灵卡片存储
    local Buff = srcUser:HasBuffID(80000300)
    if targetRace==5 and Buff==true then
          scale = 1.55+diff
    end
    ---------------------------------------------------------------------------------喷射哥布灵卡片存储
    local Buff = srcUser:HasBuffID(80000310)
    if targetRace==6 and Buff==true then
          scale = 1.55+diff
    end

    ----------------------print(scale,CriDamPer,CriDefPer2)
    scale = CommonFun.Clamp(scale, 1, 10)
    return scale
end

function CommonFun.TableHasValue(t, v)
    for key,value in pairs(t) do
        if v == value then
            return true
        end
    end
    return false
end

function CommonFun.IsLongSkill(launch_range)
  if launch_range == nil then
    return false
  end
  return launch_range >= 3
end

function CommonFun.CalcDamage(srcUser, targetUser, params, logger)
  -- 基础伤害计算
  local damage, damagetype = CommonFun.CalcBaseDamage(srcUser, targetUser, params, logger)
  local sharedam = nil

  -- 承担伤害计算
  if damage > 0 then
    if targetUser.isServerCall then -- 服务端调用
      if targetUser.have_sharedam_server ~= nil and targetUser.have_sharedam_server == true then
        damage, sharedam, damagetype = CommonFun.CalcShareDamage(srcUser, targetUser, damage, damagetype)
      end
    else -- 客户端调用
      damage, sharedam, damagetype = CommonFun.CalcShareDamage(srcUser, targetUser, damage, damagetype)
    end
  end

  return damage, damagetype, sharedam
end

function CommonFun.CalcBaseDamage(srcUser, targetUser, params, logger)

    -- 参数检查
    if nil == srcUser then
        logger.error(string.format("srcUser is nil"))
        return 0, CommonFun.DamageType.None
    end
    if nil == targetUser then
        logger.error(string.format("targetUser is nil"))
        return 0, CommonFun.DamageType.None
    end

    if nil == Table_Skill then
        logger.error("Table_Skill is nil")
        return 0, CommonFun.DamageType.None
    end

    local skillParams = Table_Skill[params.skillIDAndLevel]
    if nil == skillParams then
        logger.error(string.format("Table_Skill[%d] is nil", params.skillIDAndLevel))
        return 0, CommonFun.DamageType.None
    end

    local paramList = skillParams.Damage
    if nil == paramList or 0 >= #paramList then
        return 0, CommonFun.DamageType.None
    end

    local mapid,maptype = srcUser:GetMapInfo()-----------------获取所在地图
    local AttrFunction = srcUser:GetProperty("AttrFunction")
    local bitfunc = CommonFun.getBits(AttrFunction)
    if (targetUser.boss or targetUser.mini or targetUser.changelinepunish) and targetUser.zoneType == 1  then
      if bitfunc[CommonFun.AttrFunction.JustInViceZone] == 1 then
        return 0, CommonFun.DamageType.Miss
      end
    end


    --  普攻和物理类技能 考虑命中
    --  or params.skillIDAndLevel == srcUser:GetAttackSkillIDAndLevel()
    --  只有物理类技能才会考虑命中
    local  iscrit = CommonFun.IsCrit(srcUser, targetUser, skillParams)
    local  isNormal = srcUser:GetAttackSkillIDAndLevel()---------------------------判断普通攻击

    if CommonFun.RollType.Attack == skillParams.RollType  then  --------------物理类型攻击
      if isNormal == params.skillIDAndLevel then         ---------------------普攻
        if  iscrit == false and CommonFun.IsMiss(srcUser, targetUser, skillParams) == true then
            return 0, CommonFun.DamageType.Miss
        end
      elseif isNormal ~= params.skillIDAndLevel then  ------------技能
        if CommonFun.IsMiss(srcUser, targetUser, skillParams) == true then
            return 0, CommonFun.DamageType.Miss
        end
      end
    end

    local skillID, skillLevel = CommonFun.UnmergeSkillID(params.skillIDAndLevel)
    local enemy = srcUser:IsEnemy(targetUser)
    local DefAttr2=targetUser:GetProperty("DefAttr")
    local AttrEffect2 = targetUser:GetProperty("AttrEffect")
    local bits2=CommonFun.getBits(AttrEffect2)
    local AttrEffect3 = targetUser:GetProperty("AttrEffect2")
    local bits3=CommonFun.getBits(AttrEffect3)

    if enemy then
      -- 免疫某些技能id
      if targetUser:IsImmuneSkill(skillID) then
        return 0, CommonFun.DamageType.Miss
      end

      -- 特殊技能伤害计算(ex. 转生术概率必杀不死系)

      if skillID == 160 and DefAttr2 == CommonFun.Nature.Undead and targetUser.boss == false and targetUser.mini == false and targetUser:GetNpcID() ~= 18143 and targetUser:GetNpcID() ~= 18144 and targetUser:GetNpcID() ~= 18145 and targetUser:HasBuffID(160000)== false then
        local Luk=srcUser:GetProperty("Luk")
        local Int=srcUser:GetProperty("Int")
        local BaseLv = srcUser.BaseLv
        local Hp=targetUser:GetProperty("Hp")
        local MaxHp=targetUser:GetProperty("MaxHp")
        local rate = ((20*skillLevel+Luk+Int+BaseLv+(1-Hp/MaxHp)*200)/10)
        ---------------------------------------------------------------------------------------------------星盘加成获得没有一击必杀不死属性怪时的回复量

        if rate >=70 then
            rate=70
        end

        if CommonFun.IsInRate(rate, srcUser:GetRandom()) then
            return targetUser:GetProperty("MaxHp"), CommonFun.DamageType.Normal
        end
      end

      -- 无视魔法伤害的判定
      if bits2[CommonFun.AttrEffect.NoMagicDamage]==1 and CommonFun.RollType.Magic == skillParams.RollType then
        return 0, CommonFun.DamageType.Miss
      end

      -- 无视物理伤害的判定
      if bits2[CommonFun.AttrEffect.NoPhysicalDamage]==1 and CommonFun.RollType.Attack == skillParams.RollType then
        return 0, CommonFun.DamageType.Miss
      end

      -- 魔法伤害变为1点
      if bits3[CommonFun.AttrEffect2.MDamageTo1]==1 and CommonFun.RollType.Magic == skillParams.RollType then
        return 1, CommonFun.DamageType.Normal
      end

      -- 物理伤害变为1点
      if bits3[CommonFun.AttrEffect2.DamageTo1]==1 and CommonFun.RollType.Attack == skillParams.RollType then
        return 1, CommonFun.DamageType.Normal
      end

      -- 无视近战普攻的判定
      if bits2[CommonFun.AttrEffect.IgnoreNearNormalSkill]==1 and nil ~= skillParams.Launch_Type and CommonFun.LaunchType.CloseAttack == skillParams.Launch_Type then
          return 0, CommonFun.DamageType.Miss
      end

      -- 无视近战物理的判定(暗之屏障)
      if bits2[CommonFun.AttrEffect.IgnoreNearPhysicalSkill]==1 and skillParams.Launch_Range ~= nil and CommonFun.IsLongSkill(skillParams.Launch_Range) == false and skillParams.RollType==1 and skillID~=319 then
        return 0, CommonFun.DamageType.Barrier
      end

      -- 无视远战物理的判定(光之壁障)
      if bits2[CommonFun.AttrEffect.IgnoreFarSkill]==1 and skillParams.Launch_Range ~= nil and CommonFun.IsLongSkill(skillParams.Launch_Range) == true and skillParams.RollType==1 then
        return 0, CommonFun.DamageType.Barrier
      end
      --闪避远程物理锁定单体(薄雾墙)
      if targetUser:HasBuffID(118172) and skillParams.Launch_Range ~= nil and CommonFun.IsLongSkill(skillParams.Launch_Range) == true and skillParams.RollType==1 and skillParams.Logic == 'SkillLockedTarget' then
        local Bufflv = targetUser:GetBuffLevel(118172)

        if CommonFun.IsInRate(Bufflv*10+20, srcUser:GetRandom()) then
            return 0,CommonFun.DamageType.Miss
        end
      end
      -- 闪避魔法伤害
      if CommonFun.RollType.Magic == skillParams.RollType then    ------魔法伤害
            local Flee = targetUser:GetProperty("Flee")
            local Rate = 0
            --------------------------------------扭蛋装备
            if targetUser:HasBuffID(32980) then
                Rate = Rate + 5 + math.min(Flee/50,15)
            end
            --------------------------------------魔法惩罚
            if targetUser:HasBuffID(118250) then
                local skilllv_mof = targetUser:GetLernedSkillLevel(1321)
                local RuneNum = targetUser:GetRunePoint(82022)
                Rate = Rate + skilllv_mof*3 + 12 + RuneNum*2
            end

            if CommonFun.IsInRate(Rate, srcUser:GetRandom()) then
                return 0,CommonFun.DamageType.Miss
            end
      end
      -- 免疫所有伤害的判定 (ex:双剑格挡)
      local HarmImmune = targetUser:GetProperty("HarmImmune")
      if nil ~= HarmImmune and 0 < HarmImmune then
          local harmImmuneInfo = Table_BuffStateOdds[HarmImmune]
          -----------------------------------------------------------------双剑格挡 概率在pvp地图里受双方的敏捷和灵巧影响(阿修罗霸皇拳不会受到双剑格挡的效果)
          if nil ~= harmImmuneInfo then
              local rate = harmImmuneInfo.Odds*100
                       if params.pvpMap then
                             local Dex=srcUser:GetProperty("Dex")
                             local Agi=targetUser:GetProperty("Agi")
                             local rate1 = math.min(Dex *0.1-Agi*0.1,20)
                             if rate1 < 0 then
                                  rate1 = 0
                             end
                             rate = rate - rate1
                             if rate < 0 then
                                rate = 0
                             end
                       end
              if CommonFun.IsInRate(rate, srcUser:GetRandom()) and math.floor(params.skillIDAndLevel/1000) ~= 306 and math.floor(params.skillIDAndLevel/1000) ~=422 and math.floor(params.skillIDAndLevel/1000) ~=1122 then
                  return 0, CommonFun.DamageType.Block
              end
          end
      end
      -- 自动防御 免疫物理伤害判定(阿修罗霸皇拳,强酸攻击等 会导致自动防御无效)
      if bits3[CommonFun.AttrEffect2.AutoDef]==1 then
        local skilllv_1 = targetUser:GetLernedSkillLevel(356)
        local rate = skilllv_1*4 + 10
              if CommonFun.IsInRate(rate, srcUser:GetRandom()) and math.floor(params.skillIDAndLevel/1000) ~= 306 and math.floor(params.skillIDAndLevel/1000) ~=411 and math.floor(params.skillIDAndLevel/1000) ~=422 and math.floor(params.skillIDAndLevel/1000) ~=1122 then
                      local skilllv_weiw = targetUser:GetLernedSkillLevel(1190)----获取对方 威望 等级
                      if skilllv_weiw > 0 then
                          ------------------------------只服务端调用
                          if srcUser.isServerCall then
                              targetUser:AddBuff(116700, srcUser:GetGuid())
                          end
                      end
                  return 0, CommonFun.DamageType.AutoBlock
              end
      end
      --武器格挡  免疫近战物理伤害
      if bits3[CommonFun.AttrEffect2.WeaponBlock]==1 then
          local skilllv_1 = targetUser:GetLernedSkillLevel(1107)
          local rate = math.min(skilllv_1*7,35)
          if CommonFun.IsInRate(rate, srcUser:GetRandom()) and skillParams.Launch_Range ~= nil and CommonFun.IsLongSkill(skillParams.Launch_Range) == false and skillParams.RollType==1 and math.floor(params.skillIDAndLevel/1000) ~= 306 then
                      local RuneNum = targetUser:GetRunePoint(34030)----获取对方 星盘 反击斩 点数
                      if RuneNum > 0 then
                          ------------------------------只服务端调用
                          if srcUser.isServerCall and CommonFun.IsInRate(RuneNum*15, srcUser:GetRandom()) then
                              targetUser:AddBuff(116041, srcUser:GetGuid())
                          end
                      end
              return 0, CommonFun.DamageType.WeaponBlock
          end
      end
      -- 飞行特性怪物免疫特定技能
      if targetUser:IsFly() then
          if CommonFun.TableHasValue(NpcFeatures.Flight.ImmuneSkill, skillID) then
              return 0, CommonFun.DamageType.Miss
          end
      end
    end

    local damageType = CommonFun.DamageType.Normal
    local damage, forceDamageType = CommonFun.DoCalcDamage(srcUser, targetUser, params, logger)

    if nil ~= forceDamageType then
        damageType = forceDamageType
        if CommonFun.DamageType.None == damageType
            or CommonFun.DamageType.Miss == damageType
            or CommonFun.DamageType.Block == damageType then
            return damage,damageType
        end
    else
        if 0 == damage then
            return 0, CommonFun.DamageType.Miss
        elseif 0 > damage then
            damageType = CommonFun.DamageType.Treatment
        end
    end

    -- buff begin

    -- change skill begin
    -- local skillIDAndLevel_0 = CommonFun.MergeSkillID(skillID, 0)
    -- local buffParams = srcUser:SelfBuffChangeSkill(skillIDAndLevel_0)
    -- if nil ~= buffParams then
    --    damage = damage * (buffParams.damChangePer or 1) + (buffParams.damChange or 0)
    -- end
    -- change skill end

    -- buff end

    -- random begin
    if CommonFun.DamageType.Normal == damageType
        or CommonFun.DamageType.Crit == damageType or CommonFun.DamageType.ErLianJi == damageType then

        local profressionID = srcUser:GetProfressionID()
        if 0 < profressionID then
            local randomRange = Table_Class[profressionID].DamRandom
            if nil ~= randomRange then
                damage = damage * CommonFun.RandomRange(randomRange[1], randomRange[2], srcUser:GetRandom())
            end
        end
    end

    -- 暴击判断, (特殊:二刀连击触发时暴击不生效)
    if damageType == nil or damageType == CommonFun.DamageType.Normal or damageType == CommonFun.DamageType.Crit then
      if CommonFun.RollType.Attack == skillParams.RollType then
          local attackSkillIDAndLevel = srcUser:GetAttackSkillIDAndLevel()
          if attackSkillIDAndLevel == params.skillIDAndLevel and iscrit then
              damageType = CommonFun.DamageType.Crit
              -------------------------------------------------------------------------------------------判断暴击时无视防御
              local damageParam   = skillParams.Damage
              if damageparam ~= nil and damageParam[1] ~= nil then
                 damageParam = damageParam[1]
              end
              local raceparam     = CommonFun.CalcRaceParam(srcUser, targetUser, params, damageParam, logger)
              local bodyparam     = CommonFun.CalcBodyParam(srcUser, targetUser, params, damageParam, logger)
              local elementparam  = CommonFun.CalcElementParam(srcUser, targetUser, params, damageParam, logger)
              local bossparam     = CommonFun.CalcBossParam(srcUser, targetUser, params, damageParam, logger)

                ----------------------------------------------------------------------------------------------------------------种族，体型，属性，BOSS减伤效果
              local raceparam2    = CommonFun.CalcRaceParam2(srcUser, targetUser, params, damageParam, logger)
              local bodyparam2    = CommonFun.CalcBodyParam2(srcUser, targetUser, params, damageParam, logger)
              local elementparam2 = CommonFun.CalcElementParam2(srcUser, targetUser, params, damageParam, logger)
              local bossparam2    = CommonFun.CalcBossParam2(srcUser, targetUser, params, damageParam, logger)


              local Str1 = srcUser:GetProperty("Str")
              --------------------------------------------------------------------------------------------------------商人,牧师,炼金星盘加成的力量转换的普攻加成率提升百分比
              local Num1 = srcUser:GetRunePoint(62080)
              local Num2 = srcUser:GetRunePoint(51013)
              local Num3 = srcUser:GetRunePoint(120010)
              local Numlianj = srcUser:GetRunePoint(130110)
              local RuneDamage = Num1*0.01 + Num2*0.05 + Num3*0.05 + Numlianj*0.03 + 1
              local Str = Str1*RuneDamage
              ---------------------------------------
              local Dex = srcUser:GetProperty("Dex")
              local Luk = srcUser:GetProperty("Luk")
              local Int = srcUser:GetProperty("Int")
              local Agi = srcUser:GetProperty("Agi")
              local DamIncrease = srcUser:GetProperty("DamIncrease")
              local MDamIncrease = CommonFun.calcMDamIncrease(srcUser, targetUser)


              local race2 = targetUser.race
              local DefAttr2=targetUser:GetProperty("DefAttr")
              local skillLevel = srcUser:GetLernedSkillLevel(29)

              local skillLevel2 = 0
              if race2==3 or DefAttr2==9 then
                 skillLevel2=srcUser:GetLernedSkillLevel(234)
                 if skillLevel2>10 then
                    skillLevel2=10
                 end
              end
              ----------------------------------------灵气剑
              local SkillRealDamage=0
              if skillLevel<=5 then
                  SkillRealDamage=skillLevel*20
              elseif skillLevel>5 and skillLevel<=10 then
                  SkillRealDamage=100+math.floor(Agi/5)*((skillLevel-5)*0.5+0.5)
              else
                  SkillRealDamage=100+(skillLevel-10)*20+math.floor(Agi/5)*3+Luk*2
              end
              ---print(skillLevel)
              ---print(SkillRealDamage)

              local BaseAtk  = 0
              local BaseMAtk = Int*2 + math.floor(Int*Int/100)
              local BaseAtk1 = Str1*2 + math.floor(Str1*Str1/100) + math.floor(Dex/5) + math.floor(Luk/5)
              local BaseAtk2 = Dex*2 + math.floor(Dex*Dex/100) + math.floor(Str/5) + math.floor(Luk/5)
              local BaseAtk3 = Str*2 + math.floor(Str*Str/100) + math.floor(Dex/5) + math.floor(Luk/5)

              local NoramlAtkAdd = 5*Str
              ------------------------------------------------------------------------------------------基础攻击力  Dex Str 远程判断
              local profressionID = srcUser:GetProfressionID()
              local WeaponType =srcUser:GetEquipedWeaponType()
              if (profressionID==92 or profressionID==93 or profressionID==94) and WeaponType==210 then
                  BaseAtk1=BaseAtk2
                  BaseAtk3=BaseAtk2
                  NoramlAtkAdd = 3*Dex
              end

              for k,v in pairs(GameConfig.Atkcalculate) do
                if(v == profressionID) then
                  BaseAtk1=BaseAtk2
                  BaseAtk3=BaseAtk2
                  NoramlAtkAdd = 3*Dex
                end
              end
              -------------------------------------------------------------------------------------------------------星盘加成的牧师普攻会受到魔法攻击影响
              local Num4 = srcUser:GetRunePoint(52013)
              local Num5 = srcUser:GetRunePoint(52014)
              local Num6 = srcUser:GetRunePoint(52015)
              local Num7 = srcUser:GetRunePoint(52016)
              local Num8 = srcUser:GetRunePoint(52017)
              local Num9 = srcUser:GetRunePoint(52018)
              local RuneDamage1 = (Num4 + Num5 + Num6 + Num7 + Num8 + Num9)*0.07
              local Atk1 = srcUser:GetProperty("Atk")
              local MAtk = srcUser:GetProperty("MAtk")
              local MAtkPer = srcUser:GetProperty("MAtkPer")
              local MonkAtk = 0
              --------------------------------------------武僧爆气
              if srcUser:HasBuffID(100510) then
                  MonkAtk = 5*Int
              end
              ---------------------------剑速增加
              local AtkSpdAdd = 0
              local skilllv_SpdAdd = srcUser:GetLernedSkillLevel(22)
              if srcUser:HasBuffID(80082) and skilllv_SpdAdd>10 then
                    AtkSpdAdd = (skilllv_SpdAdd-10)*120
              end

              ----------------------------------------------------------------------------------------------------------------元素箭额外增加物理伤害
              local skilllv_element = srcUser:GetLernedSkillLevel(127)
              local atk_element = 0
              if skilllv_element >10 then
                atk_element = Dex * ((skilllv_element-10) * 0.5)
              end
              -------------------------------------------------------普攻攻击力
              local NormalAtk = srcUser:GetProperty("NormalAtk")
                    NormalAtk = NormalAtk + NoramlAtkAdd
              local Atk  = Atk1 + RuneDamage1*MAtk*(1+MAtkPer) + MonkAtk + AtkSpdAdd + atk_element + NormalAtk
              ----------------------------------------------------------------------------------------------------------------------------普攻-强效
              local Num10 = srcUser:GetRunePoint(11022)
              local Num11 = srcUser:GetRunePoint(11023)
              local Num12 = srcUser:GetRunePoint(11024)
              local Num13 = srcUser:GetRunePoint(12004)
              local Num14 = srcUser:GetRunePoint(12011)
              local Num16 = srcUser:GetRunePoint(70010)
              local RuneDamage2 = (Num10 + Num11 + Num12 + Num13 + Num14 + Num16)*0.03

              local Num15 = srcUser:GetRunePoint(120020)
              local RuneDamage3 = Num15*0.03
              local AtkPer1 = srcUser:GetProperty("AtkPer")
              local AtkPer  = AtkPer1 + RuneDamage2 + RuneDamage3
              ------------------------------------------------------------------------------------------------------------------------------分割线
              local MAtkPer = srcUser:GetProperty("MAtkPer")
              local Refine = srcUser:GetProperty("Refine")
              local MRefine = srcUser:GetProperty("MRefine")

              local Vit2 = targetUser:GetProperty("Vit")
              local VitPer2 = targetUser:GetProperty("VitPer")
              local DamReduc2 = CommonFun.calcDamReDuc(srcUser, targetUser)--------------------------------------------------------------------------替换成穿刺函数
              local RefineDamReduc = targetUser:GetProperty("RefineDamReduc")

              local RealDamage = targetUser:GetProperty("RealDamage")
              ---------------------------------------------------------------------神之威压不受天怒影响
              if targetUser:HasBuffID(96050) and RealDamage>=1 then
                     local skillID, skillLevel = CommonFun.UnmergeSkillID(params.skillIDAndLevel)
                      if skillID==359 then
                      RealDamage=RealDamage-1
                      end
              end
              local AttrEffect = srcUser:GetProperty("AttrEffect")
              local bits=CommonFun.getBits(AttrEffect)
              local AttrEffect2 = targetUser:GetProperty("AttrEffect")
              local bits2=CommonFun.getBits(AttrEffect2)

              local StateEffect = targetUser:GetProperty("StateEffect")
              local bits3=CommonFun.getBits(StateEffect)
              local Weapon=srcUser:GetEquipedID(7)


              if skillParams.RollType==1  then
                  if bits[CommonFun.AttrEffect.NextAttackIncrease]==1 then
                     damage = (((Atk-BaseAtk1)*(1+AtkPer)*CommonFun.ShapeCorrection(srcUser,targetUser)*bodyparam*elementparam*bodyparam2*elementparam2+BaseAtk3)*raceparam*bossparam*raceparam2*bossparam2*(1-DamReduc2) + Refine+SkillRealDamage - Vit2*(1+VitPer2) )*CommonFun.CalcCrit(srcUser, targetUser, skillParams)*(1-RefineDamReduc)*(1+DamIncrease)*2*(1+RealDamage)*(1+skillLevel2*0.05)
                     if damage<=0 then
                        damage = 0
                     end
                  elseif  bits2[CommonFun.AttrEffect.NormalSkillDam]==1 and (profressionID == 42 or profressionID == 43 or profressionID == 44 or profressionID==102 or profressionID==103 or profressionID==104 or profressionID==112 or profressionID==113 or profressionID==114)  then
                       local targetid = targetUser:GetGuid()
                       local distance = srcUser:GetDistance(targetid)
                       local skilllv_1 = srcUser:GetLernedSkillLevel(133)
                       local DisDam= 1
                       if skilllv_1>10 then
                          DisDam = 1 + distance/7.5*(skilllv_1-10)*0.06
                       end
                     damage = (((Atk-BaseAtk1)*(1+AtkPer)*CommonFun.ShapeCorrection(srcUser,targetUser)*bodyparam*elementparam*bodyparam2*elementparam2+BaseAtk3)*raceparam*bossparam*raceparam2*bossparam2*(1-DamReduc2) + Refine+SkillRealDamage - Vit2*(1+VitPer2) )*CommonFun.CalcCrit(srcUser, targetUser, skillParams)*(1-RefineDamReduc)*(1+DamIncrease)*1.3*(1+RealDamage)*(1+skillLevel2*0.05)*DisDam
                     if damage<=0 then
                        damage = 0
                     end
                  elseif bits3[CommonFun.StateEffect.Dizzy]==1 and (Weapon == 40322 or Weapon == 140322) then
                     damage = (((Atk-BaseAtk1)*(1+AtkPer)*CommonFun.ShapeCorrection(srcUser,targetUser)*bodyparam*elementparam*bodyparam2*elementparam2+BaseAtk3)*raceparam*bossparam*raceparam2*bossparam2*(1-DamReduc2) + Refine+SkillRealDamage - Vit2*(1+VitPer2) )*CommonFun.CalcCrit(srcUser, targetUser, skillParams)*(1-RefineDamReduc)*(1+DamIncrease)*(1+RealDamage)*(1+skillLevel2*0.05)*1.5
                     if damage<=0 then
                        damage = 0
                     end
                  elseif skillID == 300 or skillID == 469 or skillID==1397 or skillID==1446 then
                       local targetid = targetUser:GetGuid()
                       local distance = srcUser:GetDistance(targetid)
                       local skilllv_1 = srcUser:GetLernedSkillLevel(133)
                       local skilllv_2 = srcUser:GetLernedSkillLevel(478)
                       local DisDam= 1
                       if skilllv_1>10 then
                          DisDam = 1 + distance/7.5*(skilllv_1-10)*0.06
                       elseif skilllv_2>10 then
                          DisDam = 1 + distance/7.5*(skilllv_2-10)*0.06
                       end
                       ------------------------------------------死亡标记
                       local fromid = targetUser:GetBuffFromID(116470)
                       local guid = srcUser:GetGuid()
                       local BUffDam = 1
                       local skilllv_biaoji = srcUser:GetLernedSkillLevel(1147)
                      ---------------------------------星盘
                       local Numxp= srcUser:GetRunePoint(94080)------------星盘点

                       if fromid==guid then
                          BUffDam = 1+skilllv_biaoji*0.02+Numxp*0.02
                       end

                     damage = (((Atk-BaseAtk1)*(1+AtkPer)*CommonFun.ShapeCorrection(srcUser,targetUser)*bodyparam*elementparam*bodyparam2*elementparam2+BaseAtk3)*raceparam*bossparam*raceparam2*bossparam2*(1-DamReduc2) + Refine+SkillRealDamage - Vit2*(1+VitPer2) )*CommonFun.CalcCrit(srcUser, targetUser, skillParams)*(1-RefineDamReduc)*(1+DamIncrease)*(1+RealDamage)*(1+skillLevel2*0.05)*DisDam*BUffDam
                  else
                     damage = (((Atk-BaseAtk1)*(1+AtkPer)*CommonFun.ShapeCorrection(srcUser,targetUser)*bodyparam*elementparam*bodyparam2*elementparam2+BaseAtk3)*raceparam*bossparam*raceparam2*bossparam2*(1-DamReduc2) + Refine+SkillRealDamage - Vit2*(1+VitPer2) )*CommonFun.CalcCrit(srcUser, targetUser, skillParams)*(1-RefineDamReduc)*(1+DamIncrease)*(1+RealDamage)*(1+skillLevel2*0.05)
                     if damage<=0 then
                        damage = 0
                     end
                  end
              else
                  if bits[CommonFun.AttrEffect.NextAttackIncrease]==1 then
                     damage = (((MAtk-BaseMAtk)*(1+MAtkPer) + BaseMAtk)+MRefine) * CommonFun.CalcCrit(srcUser, targetUser, skillParams)*(1+MDamIncrease)*2*(1+RealDamage)
                  elseif bits2[CommonFun.AttrEffect.NormalSkillDam]==1 and (profressionID == 42 or profressionID == 43 or profressionID == 44 or profressionID==102 or profressionID==103 or profressionID==104 or profressionID==112 or profressionID==113 or profressionID==114) then
                       local targetid = targetUser:GetGuid()
                       local distance = srcUser:GetDistance(targetid)
                       local skilllv_1 = srcUser:GetLernedSkillLevel(133)
                       local DisDam= 1
                       if skilllv_1>10 then
                          DisDam = 1 + distance/7.5*(skilllv_1-10)*0.06
                       end
                     damage = (((MAtk-BaseMAtk)*(1+MAtkPer) + BaseMAtk)+MRefine) * CommonFun.CalcCrit(srcUser, targetUser, skillParams)*(1+MDamIncrease)*1.3*(1+RealDamage)*DisDam
                  else
                     damage = (((MAtk-BaseMAtk)*(1+MAtkPer) + BaseMAtk)+MRefine) * CommonFun.CalcCrit(srcUser, targetUser, skillParams)*(1+MDamIncrease)*(1+RealDamage)
                  end
              end
              if targetUser:GetNpcID() == 30028 then
                 damage = 1
              end

              local elementDam = CommonFun.DoCalcElementDam(srcUser, targetUser, params, damageParam)
              local stateDam = CommonFun.DoCalcStateEffectDam(srcUser, targetUser)
              --------------------------------------------------------------------------------------------------星盘忏悔
                local fromid = targetUser:GetBuffFromID(45000120)
                local guid = srcUser:GetGuid()
                local BUffDam = 1

                if fromid==guid then
                  BUffDam = 1.3
                end
                -------------------------------------------------------------------神圣复仇者
                local RefineLv=srcUser:GetEquipedRefineLv(7)
                local HolyEquip = 1
                if (Weapon==40319 or Weapon==140319) and (profressionID==11 or profressionID==12 or profressionID==13 or profressionID ==14 or profressionID==72 or profressionID==73 or profressionID==74) then
                    HolyEquip = 1+0.05*RefineLv
                end
                -------------------------------------------------------------------天谴
                if (Weapon==40360 or Weapon==140360) and (profressionID==11 or profressionID==12 or profressionID==13 or profressionID ==14 or profressionID==72 or profressionID==73 or profressionID==74) then
                    HolyEquip = 1+0.05*RefineLv
                end

              damage = damage * elementDam * stateDam * BUffDam * HolyEquip
          end
      end
    end

    ---------------------------------------------斯佩夏尔 分析弱点
     if damage > 0 and targetUser:GetNpcID() == 30034 and srcUser:HasBuffID(121) then
        local Atk = srcUser:GetProperty("Atk")
        local MAtk = srcUser:GetProperty("MAtk")
            damage = damage + (Atk + MAtk)*2.5
     end
    ----------------------------------------------------------------------------真实伤害
    local NormalRealDam = srcUser:GetProperty("NormalRealDam")
    local NormalMRealDam = srcUser:GetProperty("NormalMRealDam")
    local SkillRealDam = srcUser:GetProperty("SkillRealDam")
    local SkillMRealDam = srcUser:GetProperty("SkillMRealDam")
    local RefineDamReduc = targetUser:GetProperty("RefineDamReduc")
    local RefineMDamReduc = targetUser:GetProperty("RefineMDamReduc")

    local NormalAtkDam = srcUser:GetProperty("NormalAtkDam")
    local NormalAtkRes = targetUser:GetProperty("NormalAtkRes")
    local SkillDam = srcUser:GetProperty("SkillDam")
    local SkillRes = targetUser:GetProperty("SkillRes")

    local isNormalAtk = srcUser:GetAttackSkillIDAndLevel()---------------------------判断普通攻击

    if CommonFun.RollType.Magic == skillParams.RollType then    ------魔法伤害
        if isNormalAtk == params.skillIDAndLevel then             ------魔法普攻
          damage = (damage + NormalMRealDam*(1-RefineMDamReduc))*(1+NormalAtkDam-NormalAtkRes)
        elseif isNormalAtk ~= params.skillIDAndLevel then         ------魔法技能
          damage = (damage + SkillMRealDam*(1-RefineMDamReduc))*(1+SkillDam-SkillRes)
        end
    end

    if CommonFun.RollType.Attack == skillParams.RollType then
        if isNormalAtk == params.skillIDAndLevel then             ------物理普攻
          damage = (damage + NormalRealDam*(1-RefineDamReduc))*(1+NormalAtkDam-NormalAtkRes)
        elseif isNormalAtk ~= params.skillIDAndLevel then         ------物理技能
          damage = (damage + SkillRealDam*(1-RefineDamReduc))*(1+SkillDam-SkillRes)
        end
    end
    ----------------------------------------------------------------华丽水晶 只受 普攻伤害
    if targetUser:GetNpcID() == 40021 then
        if (isNormalAtk ~= params.skillIDAndLevel and skillID~= 151) or srcUser:InGuildZone()==false or srcUser:InSuperGvg()==true then
            return 0, CommonFun.DamageType.Miss
        end
    end
    ----------------------------------------------------------------GVG2.0 华丽水晶 只受 普攻伤害
    if targetUser:GetNpcID() == 40022 then
        if isNormalAtk ~= params.skillIDAndLevel and skillID~= 151 then
            return 0, CommonFun.DamageType.Miss
        end
    end

    if CommonFun.DamageType.Normal == damageType
        or CommonFun.DamageType.Crit == damageType or CommonFun.DamageType.ErLianJi == damageType then
        -- pvp begin
        --if params.pvpMap then
        --    damage = damage * 0.3
        --end
        -- pvp end

        -- damage always 1 begin
        if targetUser:DamageAlways1() then
            damageType = CommonFun.DamageType.Normal
            damage = 1
        end
        -- damage always 1 end
    end

    -- 霸邪之阵
    if bits2[CommonFun.AttrEffect.BaXieZhiZhen] == 1 and  CommonFun.RollType.Attack == skillParams.RollType and damage > 0 and skillID~=411 and skillID~=306 then
      if targetUser.AddBuffDamage ~= nil then
        targetUser:AddBuffDamage(damage)
      end
      ------------------------------只服务端调用
      if srcUser.isServerCall then
          srcUser:SetMissStillBuff() ---即使miss也添加buff
      end
      return 0,CommonFun.DamageType.Miss
    end
    ------------------------------------------------------------------金刚不坏减免效果
    local JGBH = 1
    if targetUser:HasBuffID(840009,100660)==true and damage>0 then  ------------------不坏之身符文
       JGBH = 0.05
       damage = math.floor(damage*JGBH)
    elseif targetUser:HasBuffID(100660)==true and damage>0 then
       JGBH = 0.15
       damage = math.floor(damage*JGBH)
    end
        ------------------------------------------------------------------咒缚阵减免效果
    local ZFZ = 1
    if targetUser:HasBuffID(117105)==true and damage>0 then
      local skilllv_zfz= targetUser:GetBuffLevel(117105)       -------咒缚阵等级
      ZFZ=1-0.15*(skilllv_zfz-5)
       damage = math.floor(damage*ZFZ)
    end
    ------------------------------------------------------------------守护爱的女神 受伤增加效果
    if targetUser:HasBuffID(31790) and damage>0 then
        damage = damage *1.2
    end
    ---------------------------------------------------------------------------------霸王魂 伤害减免
    local WeaponType =targetUser:GetEquipedWeaponType()
    local WeaponType2 =srcUser:GetEquipedWeaponType()
    local skilllv_baw = targetUser:GetBuffLevel(116490)------霸王魂等级
    if WeaponType == 250 and (WeaponType2==180 or WeaponType2==250) and damage>0 then
        damage = damage*(1-skilllv_baw*0.02)
    end
    ------------------------------------------------------------------光之盾减免
    local targetid = targetUser:GetGuid()

    if CommonFun.LaunchType.LongAttack == skillParams.Launch_Type then
        if targetUser:HasBuffID(115004) or targetUser:HasBuffID(115080) then
            local distance = srcUser:GetDistance(targetid)
            if (distance >=2) then
              local BuffNum = targetUser:GetBuffLevel(115080)
              if BuffNum ==0 then
                BuffNum = targetUser:GetBuffLevel(115004)
              end
              damage = math.floor(damage*(1-(0.15*BuffNum-0.05)))
            end
        end
    end

    local FinalDam = CommonFun.calcFinalDam(srcUser, targetUser, params, logger)-----------最终伤害提高

    if damage > 0 then
        damage = damage * FinalDam
    end
    ----------------------------------------------------------副本伤害计算
    if damage>0 and (targetUser:GetNpcID() == 81000 or targetUser:GetNpcID() == 81001 or targetUser:GetNpcID() == 81002 or targetUser:GetNpcID() == 81003 or targetUser:GetNpcID() == 81004 or targetUser:GetNpcID() == 81005) then
          damage = CommonFun.calcATMDam(srcUser, targetUser, params, logger)
          return damage, damageType
    end
    ----------------------------------------------------------------------------冰墓受到伤害为0
    if bits2[CommonFun.AttrEffect.InGodStatus]==1 and damage>0 then
      return 0,CommonFun.DamageType.Miss
    end
    ------------------------------------------------- 白色监狱不受念属性以外
    if (targetUser:HasBuffID(116810) or targetUser:HasBuffID(116814)) and damage>0 then
        local srcAtkElement = CommonFun.GetUserAtkAttrByList(srcUser, params, skillParams.Damage)

        if srcAtkElement~=8 then
          return  0,CommonFun.DamageType.Miss
        end

    end

    -------------------------------------飞行椅子   优先损耗sp
    if targetUser:HasBuffID(32290) and damage>0 then
        local mapid,maptype = srcUser:GetMapInfo()-----------------获取所在地图
        local pvpRatio = 5
        if maptype==2 or maptype==4 then
            pvpRatio = 20
        end
        local Sp = targetUser:GetProperty("Sp")
        if Sp > damage/pvpRatio then
            damage = damage/pvpRatio
            return damage,CommonFun.DamageType.Normal_Sp  ------------扣除魔法
        elseif Sp>0 and Sp < damage/pvpRatio then
            damage = damage - Sp *pvpRatio

            local Hp = targetUser:GetProperty("Hp")
            ------------------------------------------------致死不添加扣除魔法buff
            if Hp <= damage then
                return damage, damageType
            end
            -----------------------------------------只在后端调用  给对方添加buff
            if srcUser.isServerCall then
                srcUser:AddBuff(32291, targetUser:GetGuid())
            end
        end
    end

    damage = math.floor(damage)

    local count = params.hitedCount  --当前技能锁定的目标数量；>100时是非正常选择目标，用阿里做标记使用，双重愈合会用到
    local index = params.hitedIndex  --第几个目标 =1 锁定 ！=1 溅射


    -----------------------------==nil or -----==1 then  or----------------------------------------------对溅射的目标造成伤害有一定削减

    if skillParams.Logic_Param.spotter~=nil and index~=1 then
      return   damage*skillParams.Logic_Param.spotter,damageType
    end


    damage = CommonFun.CalcSkillDamageByRune(srcUser, targetUser, params, damage)

    damage, damageType = CommonFun.CalcMagicCriDamage(srcUser, targetUser, params, skillParams, damage, damageType)

    return damage, damageType
end

function CommonFun.CalcSkillDamageByRune(srcUser, targetUser, params, damage)

  local skillID, skillLevel = CommonFun.UnmergeSkillID(params.skillIDAndLevel)
  local runeRate = 1
  -- local Cri = srcUser:GetProperty("Cri")
  -- local CriRes2 = targetUser:GetProperty("CriRes")
  -- local CriDamPer = srcUser:GetProperty("CriDamPer")
  -- local CriDefPer2 = targetUser:GetProperty("CriDefPer")

  --弓箭手符文---------------------------------------------------------------------------------
  if skillID == 1253 or skillID == 1255 or skillID == 1257 then -------- 狼突击, 群狼出击
    if srcUser:HasBuffID(800005) then  -----------------野兽疾走符文
      runeRate = 1.2
      damage = damage * runeRate
    end
  end

  if skillID == 1246 then ------------------------------箭矢风暴
    if srcUser:HasBuffID(800006) then ------------------利箭风暴符文
      runeRate = 1.3
      damage = damage * runeRate
    end
  end

  if skillID == 1384 then ------------------------------狂风暴雨
    if srcUser:HasBuffID(800007) then ------------------狂烈风暴符文
      runeRate = 1.3
      damage = damage * runeRate
    end
  end

  if skillID == 1384 then ------------------------------狂风暴雨
    if srcUser:HasBuffID(800016) then ------------------疾风骤雨符文
      runeRate = 1.5
      damage = damage * runeRate
    end
  end

  if skillID == 1248 then ------------------------------器械专家
    if srcUser:HasBuffID(800009) then ------------------陷阱专精符文
      runeRate = 1.3
      damage = damage * runeRate
    end
  end

  if skillID == 1423 then ------------------------------奥义箭乱舞
    if srcUser:HasBuffID(800012) then ------------------乱箭狂舞符文
      runeRate = 1.2
      damage = damage * runeRate
    end
  end

  if skillID == 1398 then ------------------------------振动回响
    if srcUser:HasBuffID(800014) then ------------------战粟回响符文
      runeRate = 1.5
      damage = damage * runeRate
    end
  end


  --盗贼系符文---------------------------------------------------------------------------------
  if srcUser:HasBuffID(810001) then ------------------暴烈破甲符文
    local weaponType =srcUser:GetEquipedWeaponType()
    if(weaponType == 250 or weaponType == 200) then
      local atk = srcUser:GetProperty("Atk")
      local refine = srcUser:GetProperty("Refine")
      damage = damage + atk*0.3 + refine*6
    end
  end

  if skillID == 1111 or skillID == 181 then -------------十字斩, 音速投掷
    if srcUser:HasBuffID(810002) then  ------------------毁灭十字符文
      runeRate = 1.15
      damage = damage * runeRate
    end
  end

  if skillID == 1105 then -------------------------------回旋十字斩
    if srcUser:HasBuffID(810005) then  ------------------彻骨十字符文
      runeRate = 1.2
      damage = damage * runeRate
    end
  end

  if skillID == 188 then -------------------------------心灵震波斩
    if srcUser:HasBuffID(810007) then  ------------------狂怒震波符文
      runeRate = 1.3
      damage = damage * runeRate
    end
  end

  if skillID == 183 then -------------------------------无影之牙
    if srcUser:HasBuffID(810010) then  ------------------破空无影符文
      runeRate = 1.3
      damage = damage * runeRate
    end
  end

  if skillID == 480 then -------------------------------背刺
    if srcUser:HasBuffID(810011) then  ------------------暗影突刺符文
      runeRate = 1.3
      damage = damage * runeRate
    end
  end

  if skillID == 468 then -------------------------------二连矢
    if srcUser:HasBuffID(810013) then  ------------------迅疾连发符文
      runeRate = 1.2
      damage = damage * runeRate
    end
  end

  if skillID == 476 then -------------------------------三连矢
    if srcUser:HasBuffID(810014) then  ------------------箭矢连击符文
      runeRate = 1.2
      damage = damage * runeRate
    end
  end


  --剑士系符文------------------------------------------------------------------------------------
  if skillID == 15 then ---------------------------------狂击
    if srcUser:HasBuffID(820004) then  ------------------狂裂强击符文
      runeRate = 1.3
      if CommonFun.Shape.M == targetUser.shape then
        runeRate=1.3*runeRate
      end
      damage = damage * runeRate
    end
  end

  if skillID == 30 then ---------------------------------巧打
    if srcUser:HasBuffID(820002) then  ------------------破风巧打符文
      runeRate = 2
      damage = damage * runeRate
    end
  end

  if skillID == 1261 or skillID == 1272  then ---------------龙之吐息，龙之吐息-水
   if srcUser:HasBuffID(820003) then --------------------狂暴吐息符文
      runeRate = 1.3
      damage = damage * runeRate
   end
  end

  if skillID == 28 or skillID == 1266 then ---------------------------------螺旋击刺，急速戳刺
    if srcUser:HasBuffID(820011) then  ------------------急速螺旋符文
      runeRate = 1.2
      damage = damage * runeRate
    end
  end

  if skillID == 21 then  -- 连刺攻击
    if srcUser:HasBuffID(820012) then  -- 疾风连刺符文
        runeRate = 1
        if CommonFun.Shape == targetUser.shape then  -- 比较形状（假设这里是正确的比较方式）
            runeRate = 1.3 * runeRate  -- 提升伤害
        end
        damage = damage * runeRate  -- 计算最终伤害
    end
  end

  if skillID == 361 then ---------------------------------舍命攻击
    if srcUser:HasBuffID(820014) then  ------------------血之献祭符文
        elementparam =8
	        -- 保存原始的移动速度和攻击速度
        local originalMoveSpeed = srcUser:GetAttribute(CommonFun.RoleData.EATTRTYPE_MOVESPD)
        local originalAttackSpeed = srcUser:GetAttribute(CommonFun.RoleData.EATTRTYPE_ATKSPD)

        -- 增加移动速度和攻击速度各15%
        local moveSpeedBonus = originalMoveSpeed * 0.15
        srcUser:IncreaseMoveSpeed(moveSpeedBonus)

        local attackSpeedBonus = originalAttackSpeed * 0.15
        srcUser:IncreaseAttackSpeed(attackSpeedBonus)

        -- 设置一个计时器，在一定时间后恢复移动速度和攻击速度
        SetTimer(function()
            srcUser:SetAttribute(CommonFun.RoleData.EATTRTYPE_MOVESPD, originalMoveSpeed)
            srcUser:SetAttribute(CommonFun.RoleData.EATTRTYPE_ATKSPD, originalAttackSpeed)
        end, 90000)  -- 设置计时器持续时间为90秒
    end
  end

  --魔法师系符文------------------------------------------------------------------------------------
  if skillID == 1165 then ---------------------------------连锁闪电
    if srcUser:HasBuffID(830002) then  ------------------雷霆电光符文
      runeRate = 1.15
      damage = damage * runeRate
    end
  end

  if skillID == 1167 then ---------------------------------灵魂爆发
    if srcUser:HasBuffID(830003) then  ------------------魂之挽歌符文
      runeRate = 1.15
      damage = damage * runeRate
    end
  end

  if skillID == 79 or skillID == 74 or skillID == 107 then --火箭术,冰箭术,雷击术
    if srcUser:HasBuffID(830005) then  ------------------元素魔箭符文
      runeRate = 1.15
      damage = damage * runeRate
    end
  end

  if skillID == 81 then ---------------------------------暴风雪
    if srcUser:HasBuffID(830004) then  ------------------无尽风雪符文
      runeRate = 1.3
      damage = damage * runeRate
    end
  end

  if skillID == 1160 then ---------------------------------大地扭曲
    if srcUser:HasBuffID(830007) then  ------------------终焉之地符文
      runeRate = 1.3
      damage = damage * runeRate
    end
  end

  if skillID == 82 then ---------------------------------怒雷强击
    if srcUser:HasBuffID(830008) then  ------------------雷霆狂击符文
      runeRate = 1.3
      damage = damage * runeRate
    end
  end

  if skillID == 93 then ---------------------------------崩裂术
    if srcUser:HasBuffID(830009) then  ------------------灵魂崩裂符文
      runeRate = 1.3
      damage = damage * runeRate
    end
  end

  if skillID == 1301 then ---------------------------------火元素领域
    if srcUser:HasBuffID(830011) then  ------------------领域之主符文
      runeRate = 1.2
      damage = damage * runeRate
    end
  end

  if skillID == 1302 then ---------------------------------风元素领域
    if srcUser:HasBuffID(830011) then  ------------------领域之主符文
      runeRate = 1.2
      damage = damage * runeRate
    end
  end

  if skillID == 1304 then ---------------------------------水元素领域
    if srcUser:HasBuffID(830011) then  ------------------领域之主符文
      runeRate = 1.2
      damage = damage * runeRate
    end
  end

  if skillID == 1328 then ---------------------------------钻石星尘
    if srcUser:HasBuffID(830012) then  ------------------辰星闪耀符文
      runeRate = 1.3
      damage = damage * runeRate
    end
  end

  if skillID == 1329 then ---------------------------------闪电之枪
    if srcUser:HasBuffID(830013) then  ------------------疾风电光符文
      runeRate = 1.3
      damage = damage * runeRate
    end
  end

  if skillID == 1329 then ---------------------------------闪电之枪
    if srcUser:HasBuffID(820013) then  ------------------疾风电光符文
      runeRate = 1
      if CommonFun.StateEffect.Freeze == targetUser.StateEffect then
        runeRate=1.3*runeRate
      end
      damage = damage * runeRate
    end
  end

  if skillID == 1329 then ---------------------------------闪电之枪
    if srcUser:HasBuffID(830013) then  ------------------疾风电光符文
      runeRate = 1.3
      damage = damage * runeRate
    end
  end

  if skillID == 1328 then ---------------------------------钻石星尘
    if srcUser:HasBuffID(830014) then  ------------------星光之钻符文
      runeRate = 1.2
      damage = damage * runeRate
    end
  end

  --服事系符文------------------------------------------------------------------------------------
  if skillID == 1227 then ---------------------------------赞歌
    if srcUser:HasBuffID(840001) then  ------------------祈愿赞歌符文
      runeRate = 1.15
      damage = damage * runeRate
    end
  end

  if skillID == 1224 then -------------------------------治愈之光
  if srcUser:HasBuffID(840004) then --------------------神圣治愈符文
      runeRate = 1.3
      damage = damage * runeRate
  end
  end

  if skillID == 159 then ---------------------------------十字驱魔攻击
    if srcUser:HasBuffID(840007) then  ------------------驱魔使者符文
      runeRate = 1.1
      damage = damage * runeRate
    end
  end

  if skillID == 321 then ---------------------------------弹指神通
    if srcUser:HasBuffID(840010) then  ------------------迅捷一瞬符文
      runeRate = 1.3
      damage = damage * runeRate
    end
  end


  --商人系符文------------------------------------------------------------------------------------
  if skillID == 1288 then ---------------------------------加农炮
    if srcUser:HasBuffID(850001) then  ------------------弹道改装符文
      runeRate = 1.3
      damage = damage * runeRate
    end
  end

  if skillID == 1287 then ---------------------------------喷射飞拳
    if srcUser:HasBuffID(850007) then  ------------------铁拳之击符文
      runeRate = 1.2
      damage = damage * runeRate
    end
  end

  if skillID == 1124 then ---------------------------------疯狂野草
    if srcUser:HasBuffID(850008) then  ------------------野蛮荆棘符文
      runeRate = 1.3
      damage = damage * runeRate
    end
  end

  if skillID == 426 then ---------------------------------地狱植物
    if srcUser:HasBuffID(850009) then  ------------------藤曼炼狱符文
      runeRate = 1.3
      damage = damage * runeRate
    end
  end

  if skillID == 1130 then ---------------------------------手推车加农炮
    if srcUser:HasBuffID(850010) then  ------------------火炮改装符文
      runeRate = 1.3
      damage = damage * runeRate
    end
  end

  if skillID == 414 then ---------------------------------气泡虫召唤
    if srcUser:HasBuffID(850011) then  ------------------噬魂气泡符文
      runeRate = 1.3
      damage = damage * runeRate
    end
  end

  if skillID == 415 then ---------------------------------气泡虫寄生
    if srcUser:HasBuffID(850011) then  ------------------噬魂气泡符文
      runeRate = 1.3
      damage = damage * runeRate
    end
  end

  if skillID == 1120 then ---------------------------------疯狂火焰
    if srcUser:HasBuffID(850011) then  ------------------地狱烈焰符文
      runeRate = 1.3
      damage = damage * runeRate
    end
  end

  if skillID == 204 then -------------------------------金钱攻击
  if srcUser:HasBuffID(850002) then --------------------贪婪重击符文
      runeRate = 1.3
      damage = damage * runeRate
  end
  end

  return damage
end

function CommonFun.CalcMagicCriDamage(srcUser, targetUser, params, skillParams, damage, damageType)
  local skillID    =  skillParams.id
  if srcUser:HasBuffID(100018002) then  -----------------法术暴击
    local rate = 1.5

    local luk = srcUser:GetProperty(CommonFun.GetAttrName(105))

    local rate = math.floor(luk/600) + rate

    damage = damage * rate
    return damage,CommonFun.DamageType.Crit
  end

  -------------------------------------------狂暴魔力符文
  if srcUser:HasBuffID(830015) then
    if skillID == 1312001 then -------贤者普通攻击
      if CommonFun.IsInRate(30, srcUser:GetRandom()) then
        damage = damage * 1.3
        return damage,CommonFun.DamageType.Crit
      else
        return damage,damageType
      end
    end
  end


  return damage, damageType
end






--------------------------------------------------------------------------------------计算风地水火属性技能加伤公式
function CommonFun.DoCalcElementDam(srcUser, targetUser, params, damageParam)

  local srcAtkElement = CommonFun.GetUserAtkAttr(srcUser, params, damageParam)

  -- 仅服务端使用, 记录当前技能最终攻击属性
  if srcUser.SetTempAtkAttr ~= nil then
    srcUser:SetTempAtkAttr(srcAtkElement)
  end

  local WindAtk       = srcUser:GetProperty("WindAtk")
  local EarthAtk      = srcUser:GetProperty("EarthAtk")
  local WaterAtk      = srcUser:GetProperty("WaterAtk")
  local FireAtk       = srcUser:GetProperty("FireAtk")
  local NeutralAtk    = srcUser:GetProperty("NeutralAtk")
  local HolyAtk       = srcUser:GetProperty("HolyAtk")
  local DarkAtk       = srcUser:GetProperty("DarkAtk")
  local skillParams   = Table_Skill[params.skillIDAndLevel]

  --if srcAtkElement ==1 then  -------------------------------------------------------------风属性伤害加伤
    -- return 1+WindAtk
  --elseif srcAtkElement ==2 then -------------------------------------------------------------地属性伤害加伤
    -- return 1+EarthAtk
  --elseif srcAtkElement ==3 then  -------------------------------------------------------------水属性伤害加伤
    -- return 1+WaterAtk
  --elseif srcAtkElement ==4 then  -------------------------------------------------------------火属性伤害加伤
   --  return 1+FireAtk
  --elseif srcAtkElement ==5 then  -------------------------------------------------------------无属性伤害加伤
    -- return 1+NeutralAtk
  --elseif srcAtkElement ==6 then -------------------------------------------------------------圣属性伤害加伤
    -- return 1+HolyAtk
  --elseif srcAtkElement ==7 then
    -- return 1+DarkAtk
 -- else
     return 1
  --end

end
--------------------------------------------------------------------------------------计算中毒加伤，眩晕加伤，石化加伤等加伤公式
function CommonFun.DoCalcStateEffectDam(srcUser, targetUser, params)
  local StateEffect = targetUser:GetProperty("StateEffect")
  local bits=CommonFun.getBits(StateEffect)
  local Weapon=srcUser:GetEquipedID(7)
  local RefineLv=srcUser:GetEquipedRefineLv(7)
  local Profession=srcUser:GetProfressionID()
  -----------------------------------------------星盘属性
  local Num1=srcUser:GetRunePoint(31011)
  local Num2=srcUser:GetRunePoint(31012)
  local Num3=srcUser:GetRunePoint(31013)
  local Num4=srcUser:GetRunePoint(31014)
  local Num5=srcUser:GetRunePoint(31015)
  local RuneDamage1=Num1*0.1+Num2*0.05+Num3*0.1+Num4*0.05+Num5*0.05

  local Num6=srcUser:GetRunePoint(41011)
  local Num7=srcUser:GetRunePoint(41012)
  local Num8=srcUser:GetRunePoint(41013)
  local RuneDamage2=Num6*0.15+Num7*0.1+Num8*0.15

  local Num9=srcUser:GetRunePoint(62001)
  local Num10=srcUser:GetRunePoint(62002)
  local Num11=srcUser:GetRunePoint(62003)
  local Num12=srcUser:GetRunePoint(62004)
  local Num13=srcUser:GetRunePoint(62005)
  local RuneDamage3=Num9*0.02+Num10*0.04+Num11*0.04+Num12*0.02+Num13*0.02
  ------------------------------------------------------------------------------------武僧星盘
  local Num14=srcUser:GetRunePoint(120180)
  local RuneDamage4=Num14*0.03
  --local Num15=srcUser:GetRunePoint(120190)
  --local RuneDamage5=Num15*0.05
  local Num16=srcUser:GetRunePoint(120210)
  local RuneDamage6=Num16*0.1
  ----------------------print(RefineLv)
  ------------------------------------------------------------------------------------流氓星盘 眩晕追击
  local Num17=srcUser:GetRunePoint(90210)
  local RuneDamage7=Num17*0.05
  ------------------------------------------------------------------------------------流氓星盘  定身 擒拿追击
  local Num18=srcUser:GetRunePoint(90200)
  local RuneDamage8=Num18*0.03
  ------------------------------------------------------------------------------------流氓 胁持 加成
  local Snatch = 0
  local fromid = targetUser:GetBuffFromID(106131)
  local guid = srcUser:GetGuid()
  local Num19 = srcUser:GetRunePoint(90110)
  if fromid==guid then
      Snatch = 0.05*Num19
  end
  --兽人英雄卡存储
  local DizzyRatio = 0
  if srcUser:HasBuffID(80001480) and srcUser:HasBuffID(51230) then
     DizzyRatio = 0.15
  end
  --------------流氓状态追击
  local skilllv_Rogue = srcUser:GetLernedSkillLevel(484) --状态追击
  local Rogue = 0
  if skilllv_Rogue<=5 then
     Rogue = 0.015*skilllv_Rogue
  elseif skilllv_Rogue>5 then
     Rogue = 0.075 + (skilllv_Rogue-5)*0.005
  end
  --------------------------------------------------------------血之泪[1][第九档]
  local bloodrain = 0
  local RefineLv7=srcUser:GetEquipedRefineLv(7)
  if ( srcUser:HasBuffID(90001048) and RefineLv7 >= 10 ) then
      bloodrain = 0.15
  end
  --------------------------------------------------------------暗杀者拳刃
  if ( srcUser:HasBuffID(41870) and RefineLv7 >= 5 ) then
      bloodrain = 0.2
  end
  --------------------------------------------------------------大法师状态易伤
  local skilllv_Zhuangtai = srcUser:GetLernedSkillLevel(1166)
  local Numfs = srcUser:GetRunePoint(24080)
  local Yishang = skilllv_Zhuangtai*0.05 + Numfs*0.03
  ---------------------------------------------------------------------------------------------------------血之泪增伤
  if bits[CommonFun.StateEffect.Poison] ==1 and (Weapon == 40909 or Weapon == 140909) then
      return 1 + bloodrain
  end
  ---------------------------------------------------------------------------------------------------------暗杀者拳刃增伤
  if bits[CommonFun.StateEffect.Poison] ==1 and (Weapon == 40945 or Weapon == 140945) then
      return 1 + bloodrain
  end
  ---------------------------------------------------------------------------------------------------------流氓胁持增伤
  if targetUser:GetBuffFromID(106131) and fromid==guid and (Profession==92 or Profession==93 or Profession==94) then
      return 1 + Snatch
  end
  ---------------------------------------------------------------------------------------------------------流氓眩晕追击
  if bits[CommonFun.StateEffect.Dizzy] ==1 and (Profession==92 or Profession==93 or Profession==94) then
      return 1 + Rogue + RuneDamage7 + Snatch
  end
  ---------------------------------------------------------------------------------------------------------流氓眩晕追击
  if (bits[CommonFun.StateEffect.NoMove] ==1 or targetUser:HasBuffID(106151)) and (Profession==92 or Profession==93 or Profession==94) then
      return 1 + Rogue + RuneDamage8 + Snatch
  end
  ---------------------------------------------------------------------------------------------------------流氓对 眩晕，定身，黑暗,被擒拿  状态加伤
  if (bits[CommonFun.StateEffect.Dizzy] ==1 or bits[CommonFun.StateEffect.NoMove] ==1 or bits[CommonFun.StateEffect.Dark] ==1 or targetUser:HasBuffID(106151)) and (Profession==92 or Profession==93 or Profession==94) then
      return 1 + Rogue + Snatch
  end
  ---------------------------------------------------------------------------------------------------------装备希尔之斧时触发眩晕对目标造成的伤害
  if bits[CommonFun.StateEffect.Dizzy] ==1 and (Weapon == 41813 or Weapon == 141813) then
     return 1.15 + RuneDamage1 + RuneDamage3 + RuneDamage6 + DizzyRatio + Rogue
  end
  ---------------------------------------------------------------------------------------------------------斩首之斧每级精炼对眩晕目标伤害加成
  if bits[CommonFun.StateEffect.Dizzy] ==1 and (Weapon == 41811 or Weapon == 141811) then
     return 1 + 0.05*RefineLv + RuneDamage1 + RuneDamage3 + RuneDamage6 + DizzyRatio + Rogue
  end
  ----------------------------------------------------------------------------------------------------------商人星盘对眩晕目标伤害加成
  if bits[CommonFun.StateEffect.Dizzy] ==1  and (Profession==61 or Profession==62 or Profession==63 or Profession==64 or Profession==31 or Profession==32 or Profession==33 or Profession==34) then
      return 1+RuneDamage1+RuneDamage3+DizzyRatio
  end

  ---------------------------------------------------------------------------------------------------------水母卡片存储+装备对冰冻目标伤害加成
  local Card1 = srcUser:GetEquipCardNum(7,20025)
  if bits[CommonFun.StateEffect.Freeze] ==1 and Card1>0 and srcUser:HasBuffID(80000250) then
    return 1.25 +Yishang
  end
  ----------------------------------------------------------------------------------------------------------卡仑卡片存储+装备 对冰冻目标伤害加成
   if bits[CommonFun.StateEffect.Freeze] ==1 and srcUser:HasBuffID(52180) and srcUser:HasBuffID(81000050) then
    return 1.5 +Yishang
  end
  ----------------------------------------------------------------------------------------------------------弓手/诗人/舞娘星盘对定身目标伤害加成
  if bits[CommonFun.StateEffect.NoMove] ==1 then
      return 1+RuneDamage2
  end
  -----------------------------------------------------------------------------------------------------------武僧星盘沉默伤害加成
  if bits[CommonFun.StateEffect.Silence] == 1 and (Profession==122 or Profession==123 or Profession==124)  then
      return 1+RuneDamage4
  end
  -----------------------------------------------------------------------------------------------------------武僧星盘定身伤害加成
  --if bits[CommonFun.StateEffect.NoMove] == 1 and (Profession==122 or Profession==123 or Profession==124)  then
      --return 1+RuneDamage5
  --end
  -----------------------------------------------------------------------------------------------------------武僧星盘眩晕伤害加成
  if bits[CommonFun.StateEffect.Dizzy] == 1 and (Profession==122 or Profession==123 or Profession==124)  then
      return 1+RuneDamage6+DizzyRatio
  end
  --------------------------------------------------------------------------------------------------------骑士伤害增压对出血目标伤害加成
  if srcUser:HasBuffID(80113) and bits[CommonFun.StateEffect.Blood] == 1 then
      local skilllv_1 = srcUser:GetLernedSkillLevel(25)
      if skilllv_1>10 then
            return 1 + (skilllv_1-10)*0.05
      end
  end
  --------------------------------------------------------------------------------------------------------大法师对眩晕灼烧冰冻流血状态加伤
  if (bits[CommonFun.StateEffect.Dizzy] ==1 or bits[CommonFun.StateEffect.Freeze] ==1 or bits[CommonFun.StateEffect.Blood] ==1 or bits[CommonFun.StateEffect.Burn] ==1) and (Profession==24) then
      return 1+Yishang
  end
  --只存在眩晕时增加伤害
  if bits[CommonFun.StateEffect.Dizzy] == 1 then
      return 1+DizzyRatio
  end

  return 1

end

-------------------------------------------------------------------------------------计算能量外套的属性减免效果
function CommonFun.calcMDamIncrease(srcUser, targetUser)
  local MDamIncrease = srcUser:GetProperty("MDamIncrease")
  local DamReduc = srcUser:GetProperty("DamReduc")
  local Buff = srcUser:HasBuffID(85060)
  local MDamIncrease1 = MDamIncrease

  if Buff==true and DamReduc >=0.7 then
        MDamIncrease1 = (DamReduc-0.7)/3 + MDamIncrease
  end

  if MDamIncrease1<=0 then
     MDamIncrease1 = 0
  end
  return MDamIncrease1
end

--------------------------------------------------------------------------------技能物理伤害减免
function CommonFun.calcSkillDamReduc(srcUser, targetUser)
    if srcUser == nil or targetUser == nil then
      return 0
    end
    local EnergyDamReduc = targetUser:GetProperty("EnergyDamReduc")   ---能量外套
    local SteelDamReduc = targetUser:GetProperty("SteelDamReduc")     ---钢铁之心
    local ProtectDamReduc = targetUser:GetProperty("ProtectDamReduc") ---舍命庇护
    local HideDamReduc = targetUser:GetProperty("HideDamReduc")       ---销声匿迹
    local DragonDamReduc = targetUser:GetProperty("DragonDamReduc")   ---龙鳞饼减免
    local DeadDamReduc = targetUser:GetProperty("DeadDamReduc")       ---濒死减免

    local SkillDamReduc = (1-EnergyDamReduc)*(1-SteelDamReduc)*(1-ProtectDamReduc)*(1-HideDamReduc)*(1-DragonDamReduc)*(1-DeadDamReduc)

    if SkillDamReduc<=0.1 then
        SkillDamReduc = 0.1
    end

    return SkillDamReduc
end
--------------------------------------------------------------------------------技能魔法伤害减免
function CommonFun.calcSkillMDamReduc(srcUser, targetUser)
    if srcUser == nil or targetUser == nil then
      return 0
    end
    local SteelMDamReduc = targetUser:GetProperty("SteelMDamReduc")       ---钢铁之心
    local ProtectMDamReduc = targetUser:GetProperty("ProtectMDamReduc")   ---舍命庇护
    local HideMDamReduc = targetUser:GetProperty("HideMDamReduc")         ---销声匿迹
    local DragonMDamReduc = targetUser:GetProperty("DragonMDamReduc")     ---龙鳞饼减免
    local WindMDamReduc = targetUser:GetProperty("WindMDamReduc")         ---疾风步减免
    local DeadMDamReduc = targetUser:GetProperty("DeadMDamReduc")         ---濒死减免

    local SkillMDamReduc = (1-SteelMDamReduc)*(1-ProtectMDamReduc)*(1-HideMDamReduc)*(1-DragonMDamReduc)*(1-WindMDamReduc)*(1-DeadMDamReduc)
    if SkillMDamReduc<=0.1 then
        SkillMDamReduc = 0.1
    end

    return SkillMDamReduc
end
--------------------------------------------------------------------------------穿刺等级函数
function CommonFun.calcSpikeLv(srcUser, targetUser)
    if srcUser == nil or targetUser == nil then
      return 0
    end
    local RefineLv1=srcUser:GetEquipedRefineLv(5)-----------------------获取装备的精炼等级
    local RefineLv2=srcUser:GetEquipedRefineLv(6)
    local RefineLv3=srcUser:GetEquipedRefineLv(7)
    local ReduceLv1= 0
    local ReduceLv2= 0
    local ReduceLv3= 0
    local ReduceLv = 0 --------------------------------------------穿刺等级

    if RefineLv1<5 then
        ReduceLv1=0
    elseif RefineLv1>=5 and RefineLv1<10 then
        ReduceLv1=1
    elseif RefineLv1>=10 and RefineLv1<15 then
        ReduceLv1=2
    else
        ReduceLv1=4
    end

    if RefineLv2<5 then
        ReduceLv2=0
    elseif RefineLv2>=5 and RefineLv2<10 then
        ReduceLv2=1
    elseif RefineLv2>=10 and RefineLv2<15 then
        ReduceLv2=2
    else
        ReduceLv2=4
    end

    if RefineLv3<5 then
        ReduceLv3=0
    elseif RefineLv3>=5 and RefineLv3<10 then
        ReduceLv3=1
    elseif RefineLv3>=10 and RefineLv3<15 then
        ReduceLv3=2
    else
        ReduceLv3=4
    end

    ReduceLv=ReduceLv1+ReduceLv2+ReduceLv3

    return ReduceLv
end
--------------------------------------------------------------------------------物理穿刺函数
function CommonFun.calcDamReDuc(srcUser, targetUser)
    if srcUser == nil or targetUser == nil then
      return 0
    end

    local DamSpike = srcUser:GetProperty("DamSpike")

    local DamReduc2 = targetUser:GetProperty("DamReduc")

    ReduceLv = CommonFun.calcSpikeLv(srcUser, targetUser) -----穿刺等级

    local SkillDamReduc = CommonFun.calcSkillDamReduc(srcUser, targetUser)----技能物理伤害减免

    local A =1- (1 + 0.009*ReduceLv + DamSpike - DamReduc2)*SkillDamReduc
    --print("A1="..A)
    ------------------------------------------------------------------------竞技场额外增加30%伤害减免
    local mapid,maptype = srcUser:GetMapInfo()-----------------获取所在地图
    ------------------------maptype 1 :野外 2：pvp 3:其他普通副本 4:gvg
    if maptype==2 or maptype==4 then
      A = A < -1 and -1 or A > 1 and 1 or A
      A = math.floor(A*1000)/1000
      A = A + 0.3*(1-math.sin(A*3.14/2))
    end
    --print("A2="..A)

    if A >= 0.9 then  -----减免率最大到90%
       A = 0.9
    end

    return A
end

--------------------------------------------------------------------------------魔法穿刺函数
function CommonFun.calcMDamReDuc(srcUser, targetUser)
    if srcUser == nil or targetUser == nil then
      return 0
    end

    local MDamSpike = srcUser:GetProperty("MDamSpike")

    local MDamReduc2 = targetUser:GetProperty("MDamReduc")

    ReduceLv = CommonFun.calcSpikeLv(srcUser, targetUser) -----穿刺等级

    local SkillMDamReduc = CommonFun.calcSkillMDamReduc(srcUser, targetUser)----技能魔法伤害减免

    local A =1- (1 + 0.009*ReduceLv + MDamSpike - MDamReduc2)*SkillMDamReduc

    ------------------------------------------------------------------------竞技场额外增加30%伤害减免
    local mapid,maptype = srcUser:GetMapInfo()-----------------获取所在地图
    ------------------------maptype 1 :野外 2：pvp 3:其他普通副本 4:gvg
    if maptype==2 or maptype==4 then
      A = A < -1 and -1 or A > 1 and 1 or A
      A = math.floor(A*1000)/1000
      A = A + 0.3*(1-math.sin(A*3.14/2))
    end

    if A >= 0.9 then----减免率最大到90%
       A = 0.9
    end

    return A
end

--------------------------------------------------------------------------------最终伤害提高
function CommonFun.calcFinalDam(srcUser, targetUser, params, logger)

    local Weapon_Id = srcUser:GetEquipedID(7)
    local Damage_Per = 0
    ------巫杖魂咬[1][第五档][第六档]计算判断
    if Weapon_Id ==40610 or Weapon_Id==140610 then
        local target_Hp=targetUser:GetProperty("Hp")
        local target_MaxHp=targetUser:GetProperty("MaxHp")
        local target_hpper = target_Hp / target_MaxHp

        if srcUser:HasBuffID(90000924) and target_hpper<=0.3 then
            Damage_Per = Damage_Per + 0.15
        end

        if srcUser:HasBuffID(90000925) and target_hpper<=0.1 then
            Damage_Per = Damage_Per + 0.3
        end
    ------巫杖魂咬[1][第九档][第十档]计算判断
        if srcUser:HasBuffID(90000928) and target_hpper<=0.45 then
            Damage_Per = Damage_Per + 0.05
        end
        local RefineLv1 = srcUser:GetEquipedRefineLv(7)
        if srcUser:HasBuffID(90000929)  then
            if  RefineLv1==15  then
            Damage_Per = Damage_Per + 0.1
            end
        end

    end

     --------------------------------------裁决之锤
      if Weapon_Id ==41565 or Weapon_Id==141565 then
        local target_Hp8=targetUser:GetProperty("Hp")
        local target_MaxHp8=targetUser:GetProperty("MaxHp")
        local target_hpper8 = target_Hp8 / target_MaxHp8

        if srcUser:HasBuffID(41970) and target_hpper8<=0.3 then
            Damage_Per = Damage_Per + 0.15
        end
      end

    ----------------------------------------------神器 势如破竹
    local shenqi = 0
    if srcUser:HasBuffID(107030) then
        shenqi = 0.3
    elseif srcUser:HasBuffID(107031) then
        shenqi = 0.5
    end
    ----------------------------------------------守护爱的女神
    local Godness = 0
    if srcUser:HasBuffID(31790) then
        Godness = 0.1
    end
    ----------------------------------------------虚空隐匿
    local Hide = 0
    if srcUser:HasBuffID(107098) then
        Hide = 0.3
    elseif srcUser:HasBuffID(107099) then
        Hide = 0.6
    end
    ----------------------------------------------霸王魂
    local WeaponType =srcUser:GetEquipedWeaponType()
    local WeaponType2 =targetUser:GetEquipedWeaponType()
    local skilllv_1 = srcUser:GetLernedSkillLevel(1146)
    local Overlord = 0
    if WeaponType == 250 and (WeaponType2==180 or WeaponType2==250) then
        Overlord = skilllv_1*0.02
    end

    ----------------------------------------------风栖幼龙
    local dragon = 0
    local Dtarget_Hp=targetUser:GetProperty("Hp")
    local Dtarget_MaxHp=targetUser:GetProperty("MaxHp")
    local Dtarget_hpper = Dtarget_Hp / Dtarget_MaxHp

    if srcUser:HasBuffID(33410) and Dtarget_hpper>=0.5  then
        dragon = 0.05
    end

    ----------------------------------------------海神头饰[1]
    local atls = 0
    local RefineLv9=srcUser:GetEquipedRefineLv(8)
    if srcUser:HasBuffID(33980) and Dtarget_hpper<=0.4  then
        atls = 0.04 + RefineLv9*0.01
    end


   ----------------------------------------------死灵骑士卡片
    local StateEffect = targetUser:GetProperty("StateEffect")
    local bits=CommonFun.getBits(StateEffect)
    local CardNum = srcUser:GetEquipCardNum(7,23035)-------------获取武器部位死灵骑士卡片数量
    local CardDie = 0
    local CardS = 0
    if ( bits[CommonFun.StateEffect.Dizzy] ==1 or bits[CommonFun.StateEffect.Curse] == 1 or bits[CommonFun.StateEffect.Silence] == 1 or  bits[CommonFun.StateEffect.Blood] == 1  or  bits[CommonFun.StateEffect.Poison]==1 )  and  srcUser:HasBuffID(81000700) and  CardNum > 0  then
        CardS = 0.05
    end

    if ( bits[CommonFun.StateEffect.Dizzy] ==1 or bits[CommonFun.StateEffect.Curse] == 1 or bits[CommonFun.StateEffect.Silence] == 1 or  bits[CommonFun.StateEffect.Blood] == 1  or  bits[CommonFun.StateEffect.Poison]==1 ) and CardNum > 0  then
        CardDie = 0.2*CardNum + CardS
    end
    ----------------------------------------------凯美拉★卡片
   local  kaimeila = 0
    if srcUser:HasBuffID(53020) and  bits[CommonFun.StateEffect.Poison]==1   then
        kaimeila = kaimeila + 0.2
    end
    if srcUser:HasBuffID(80001710) and  bits[CommonFun.StateEffect.Poison]==1   then
        kaimeila = kaimeila + 0.05
    end
   -----------------------------------------无影无踪
    local Profession=srcUser:GetProfressionID()
    if srcUser:HasBuffID(53130) and  bits[CommonFun.StateEffect.Poison]==1 and (Profession==32 or Profession==33 or Profession==34)   then
        kaimeila = kaimeila + 0.1
    end



    ----------------------------------------------亡者-虎王卡片
    local HpM = srcUser:GetProperty("Hp")
    local MaxHpM = srcUser:GetProperty("MaxHp")
    local hpperM = HpM / MaxHpM
    local tiger = 0
    if   srcUser:HasBuffID(52980) then
        tiger = math.floor((1-hpperM) * 10) * 0.02
    end


    --------------------------------------------组队竞技场  持球易伤buff
    local Ball = 0
    local Num_ball = targetUser:GetBuffLayer(210011)

    if Num_ball>0 and srcUser:HasBuffID(210030) then
        Ball = Num_ball*Num_ball/200 + 0.5
    elseif Num_ball>0 then
        Ball = Num_ball*Num_ball/200
    end


    local Final = 1 + Damage_Per + shenqi + Godness + Hide + Overlord + dragon + CardDie + tiger + kaimeila + atls + Ball


    ------------------------------------------圣天使波利buff  要有爱  伤害为0
    if srcUser:HasBuffID(161350) or srcUser:HasBuffID(33571) then
        Final = 0
    end

    return Final

end
--------------------------------------------------------------------------------能量之拳伤害计算
function CommonFun.calcATMDam(srcUser, targetUser, params, logger)
    local A = 111111
    local base = 1
    if targetUser:GetNpcID() == 81000 and srcUser:HasBuffID(120350) then
        base =2
    end
    if targetUser:GetNpcID() == 81001 and srcUser:HasBuffID(120360) then
        base =2
    end
    if targetUser:GetNpcID() == 81002 and srcUser:HasBuffID(120370) then
        base =2
    end
    if targetUser:GetNpcID() == 81003 and srcUser:HasBuffID(120380) then
        base =2
    end
    if targetUser:GetNpcID() == 81004 and srcUser:HasBuffID(120390) then
        base =2
    end
    if targetUser:GetNpcID() == 81005 and srcUser:HasBuffID(120400) then
        base =2
    end

    return A*base
end

function CommonFun.DoCalcDamage(srcUser, targetUser, params, logger)
    local damage = 0
    local damageType = nil
    local RealDamage = targetUser:GetProperty("RealDamage")
    ---------------------------------------------------------------------神之威压不受天怒影响
    if targetUser:HasBuffID(96050) and RealDamage>=1 then
        local skillID, skillLevel = CommonFun.UnmergeSkillID(params.skillIDAndLevel)
        if skillID==359 then
           RealDamage=RealDamage-1
        end
    end
    local MaxHp = targetUser:GetProperty("MaxHp")
    local BaseLv = targetUser.BaseLv
    local BaseLv1 = srcUser.BaseLv
    local TransformID = srcUser:GetProperty("TransformID")
    local MRefine = srcUser:GetProperty("MRefine")

    local skillParams = Table_Skill[params.skillIDAndLevel]
    local damageParamList = skillParams.Damage

    for i = 1, #damageParamList do
        local damageParam = damageParamList[i]
        local func = CommonFun.CalcDamageFuncs[damageParam.type]
        if nil ~= func then
            local partDamage, partDamageType = func(srcUser, targetUser, params, damageParam, logger)
            local elementDam = CommonFun.DoCalcElementDam(srcUser, targetUser, params, damageParam)
            local stateDam = CommonFun.DoCalcStateEffectDam(srcUser, targetUser)

            partDamage  = partDamage* elementDam * stateDam


            damage = damage + partDamage

            if nil ~= partDamageType then
                damageType = partDamageType
            end
        else
            logger.error(string.format("CommonFun.CalcDamageFuncs[%s] is nil", tostring(damageParam.type)))
        end
    end

    damage =  math.floor(damage)
    -- 年兽mvp, 除指定技能类型正常计算伤害外, 其他技能类型 若有伤害 则返回1
   if damage > 0 and targetUser:GetNpcID() == 30043 then
      local damageParam = damageParamList[1]
      if damageParam ~= nil and damageParam.type ~= 8002 then
        return 1, CommonFun.DamageType.Normal
      end
   end
       -- 奥特曼活动怪兽, 除指定技能类型正常计算伤害外, 其他技能类型 若有伤害 则返回1
     if damage>0 and (targetUser:GetNpcID() == 56008 or targetUser:GetNpcID() == 56009 or targetUser:GetNpcID() == 56010 or targetUser:GetNpcID() == 56011 or targetUser:GetNpcID() == 56012 or targetUser:GetNpcID() == 56013) then
      local damageParam = damageParamList[1]
      if damageParam ~= nil and damageParam.type ~= 8020 and damageParam.type ~= 8021 then
        return 1, CommonFun.DamageType.Normal
      end
   end


   if srcUser.boss then
          if BaseLv1>= BaseLv and BaseLv1>= 70 then
            return math.floor(damage*(1+RealDamage)) + (math.floor(BaseLv1*math.random(10,25) + MRefine*5 + MaxHp*math.random(1,5)/100))*(1+(BaseLv1-BaseLv)/100),damageType
          else
            return math.floor(damage*(1+RealDamage)) + (math.floor(BaseLv1*math.random(10,25) + MRefine*5 + MaxHp*math.random(1,5)/100))*(1-(BaseLv-BaseLv1)/100),damageType
          end
   end


  if targetUser.boss then
        if BaseLv1 <= BaseLv then
          return math.floor(damage*(1+RealDamage))*(1-(BaseLv-BaseLv1)/100),damageType
        end
  end


  if TransformID~=0 then
    local AttrEffect= srcUser:GetProperty("AttrEffect2")
    local bits=CommonFun.getBits(AttrEffect)

    local temp = false
    if bits[CommonFun.AttrEffect2.BoliBianshen]==1 or bits[CommonFun.AttrEffect2.GonghuiBianshen]==1 then   -------------------波利变身  公会变身不会使伤害变成6
      temp = true
    end
    --------------------------------------------------------------B猫变身打年兽 伤害不为6
    if bits[CommonFun.AttrEffect2.BCatBianshen]==1 and targetUser:GetNpcID() == 30043 then
          temp = true
    end
    if bits[CommonFun.AttrEffect2.UltraMan]==1 and (targetUser:GetNpcID() == 56008 or targetUser:GetNpcID() == 56009 or targetUser:GetNpcID() == 56010 or targetUser:GetNpcID() == 56011 or targetUser:GetNpcID() == 56012 or targetUser:GetNpcID() == 56013) then
          temp = true
    end

    if temp ==false then
     return 6
    end
  end

    local index = params.hitedIndex  --第几个目标 =1 锁定 ！=1 溅射；index；>100时是非正常选择目标，用阿里做标记使用，双重愈合会用到
    ------------------------------------------------------------------------------星盘带来的双重愈合溅射治疗加成


    if  index>=100  and math.floor(params.skillIDAndLevel/1000)==144 then
      local Buff1 = srcUser:HasBuffID(45000130)
      local Num0  = srcUser:GetRunePoint(52001)
      local Num1  = srcUser:GetRunePoint(52040)
      local Num2  = srcUser:GetRunePoint(52041)
      local Num3  = srcUser:GetRunePoint(52042)
      local Num4  = srcUser:GetRunePoint(52003)
      local RuneDamage = (Num0 + Num1 + Num2 + Num3)*0.1 + Num4*0.03
      local BuffRate = 0
          if Buff1 ==true then
             BuffRate = RuneDamage
          end
      return   damage*(BuffRate),damageType
    end

   if damage<0 then
      RealDamage=0
   end

   if index~=1 and (math.floor(params.skillIDAndLevel/1000)==74 or math.floor(params.skillIDAndLevel/1000)==79 or math.floor(params.skillIDAndLevel/1000)==107) then
      local Num1  = srcUser:GetRunePoint(22070)
      local Num2  = srcUser:GetRunePoint(22033)
      local Num3  = srcUser:GetRunePoint(22080)
      local RuneDamage = (Num1 + Num2)*0.02 + Num3*0.05
      return math.floor(damage*RuneDamage*(1+RealDamage)),damageType
   end

    return math.floor(damage*(1+RealDamage)), damageType
end


local share_temp_result = {}
-- 承担伤害计算
function CommonFun.CalcShareDamage(srcUser, tUser, damage, damagetype)

  if Table_Buffer == nil then
    return damage, nil
  end

  -- return example : newdamage, {{charid=1, damage=100, type=1}, {charid=2, damage=200, type=2}}
  local result = nil -- table of oneresult
  local newdamage = damage
  local buffs = {70047011, 115001, 115002,116260,116261,116262,116263,116264,116265,116266,116267,116268,116269}

  if buffs == nil or #buffs == 0 then
    return damage, nil
  end

  local findok = false
  local buffID,oneresult
  for i = 1, #buffs do
    buffID = buffs[i]
    local buff = Table_Buffer[buffID]
    if tUser:HasBuffID(buffID) and buff ~= nil and buff.BuffEffect ~= nil and buff.BuffEffect.shareper ~= nil then
      local shareTargetID = tUser:GetBuffFromID(buffID) -- 获取Buff来源guid
      if buff.BuffEffect.share_to_being == 1 then
         shareTargetID = tUser:GetBeingGUID()
      end

      if shareTargetID ~= 0 and (buff.BuffEffect.checkbuff == nil or CommonFunHelper.HasBuffID(shareTargetID, buff.BuffEffect.checkbuff) == true) and
         (buff.BuffEffect.range == nil or tUser:GetDistance(shareTargetID) <= buff.BuffEffect.range)
      then
        local perdam = buff.BuffEffect.shareper * damage -- 计算该buff承担伤害百分比
        local decPerdam = perdam -- newdamage上应减少的伤害值, 默认和承担的伤害一致
        local damtype = damagetype
        -- 牺牲受到的伤害降低
        -----------------------------------------------------------------------星盘减少牺牲伤害
        local Rune = CommonFunHelper.GetBuffLayer(shareTargetID,41100060)
        -----------------------------------------------------------------------坚固盾牌减少牺牲伤害
            local dunpai = 0
            if CommonFunHelper.HasBuffID(shareTargetID, 40490) == true then
              dunpai = 0.05
            end
        -----------------------------------------------------------------------坚固盾牌升级减少牺牲伤害

            if CommonFunHelper.HasBuffID(shareTargetID, 90001803) == true then
               dunpai = 0.05+0.05
            end
          -----------------------------------------【皇家之矛】＋【皇家战甲】
        local huangjia = 0
         if CommonFunHelper.HasBuffID(shareTargetID, 91000400) == true then
          huangjia = 0.1
         end


       perdam = perdam*(1-Rune*0.02-dunpai-huangjia)

        -- 自动防御
        if buff.BuffEffect.autoblock == 1 then
          local bits3 = CommonFun.getBits(CommonFunHelper.GetProperty(shareTargetID, "AttrEffect2"))
          if bits3 ~= nil and bits3[CommonFun.AttrEffect2.AutoDef] == 1 then
            local skilllv_1 = 0
            if tUser.isServerCall then
              skilllv_1 = CommonFunHelper.GetLernedSkillLevel(shareTargetID, 356)
            else
              local sklvbuffeff = CommonFunHelper.GetBuffEffectByType(shareTargetID, "SkillLevel")
              if sklvbuffeff and sklvbuffeff.level then
                skilllv_1 = sklvbuffeff.level
              else
                skilllv_1 = 1
              end
            end
            local rate = skilllv_1*4 + 10
            if CommonFun.IsInRate(rate, srcUser:GetRandom()) then
               perdam = 0
               damtype = CommonFun.DamageType.AutoBlock
            end
          end
        end

        -- 承担伤害致死, 溢出伤害不承担, 转移回去
        if buff.BuffEffect.overflow == 1 then
          local hp = CommonFunHelper.GetUserHP(shareTargetID)
          if perdam > hp then
            if decPerdam >= perdam then
              decPerdam = decPerdam - perdam + hp
            else
              decPerdam = hp
            end
            perdam = hp
          end
        end

        findok = true
        newdamage = newdamage - decPerdam
        oneresult = share_temp_result[shareTargetID]
        if oneresult == nil then
          local oneresult = {} -- {charid=xx,damage=xx, type=xx}
          oneresult.damage = perdam
          oneresult.type = damtype -- 类型
          oneresult.charid = shareTargetID
          share_temp_result[shareTargetID] = oneresult
        else
          oneresult.damage = oneresult.damage + perdam
        end
      end
    end
  end

  if findok == true then
    result = {}
    for k, v in pairs(share_temp_result) do
      if v.damage ~= 0 or v.type == CommonFun.DamageType.AutoBlock then
        table.insert(result, v)
        share_temp_result[k] = nil
      end
    end
  end

  -- 避免伤害变为加血
  if damage > 0 and newdamage < 0 then
    newdamage = 0
  end

  if newdamage == 0 then
     damagetype = CommonFun.DamageType.None
  end

  return newdamage, result, damagetype
end

-- 反击是否成功判断(返回0~100), skillid:敌方释放技能
function CommonFun.CalcBeatBackRate(tUser, skillid)
  return 0
end
----------------------------------------------------------------------------------------------------------------近战怪物普攻技能的伤害计算公式
function CommonFun.calcDamage_17(srcUser, targetUser, params, damageParam, logger)
  local Str = srcUser:GetProperty("Str")
  local Dex = srcUser:GetProperty("Dex")
  local Luk = srcUser:GetProperty("Luk")
  local Atk = srcUser:GetProperty("Atk")
  ---------------------------------------------------------------------------------------------------------------普攻-强效
  local Num1 = srcUser:GetRunePoint(11022)
  local Num2 = srcUser:GetRunePoint(11023)
  local Num3 = srcUser:GetRunePoint(11024)
  local Num4 = srcUser:GetRunePoint(12004)
  local Num5 = srcUser:GetRunePoint(12011)
  local RuneDamage = (Num1 + Num2 + Num3 + Num4 + Num5)*0.03
  local AtkPer1 = srcUser:GetProperty("AtkPer")
  local AtkPer  = AtkPer1 + RuneDamage

  local DamIncrease = srcUser:GetProperty("DamIncrease")
  local IgnoreDef  = 0
  local IgnoreDef1 = srcUser:GetProperty("IgnoreDef")
  local IgnoreDef2 = srcUser:GetProperty("IgnoreEquipDef")
  if targetUser.boss or targetUser.mini then
     IgnoreDef=IgnoreDef1
  else
     IgnoreDef=(IgnoreDef1+IgnoreDef2)
  end

  if IgnoreDef >= 1 then
     IgnoreDef=1
  end

  local Agi = srcUser:GetProperty("Agi")
  local WeaponType =srcUser:GetEquipedWeaponType()
  local skilllv_1 = srcUser:GetLernedSkillLevel(damageParam.skill1_id)
  local skilllv_2 = srcUser:GetLernedSkillLevel(damageParam.skill2_id)
    ------------------------------------------------------------------------------------将原来的物伤加成改成精炼物理攻击
  local Refine = srcUser:GetProperty("Refine")

  local StateEffect = targetUser:GetProperty("StateEffect")
  local bits=CommonFun.getBits(StateEffect)
  local Weapon=srcUser:GetEquipedID(7)

  local Def2 = targetUser:GetProperty("Def")
  local DefPer2 = targetUser:GetProperty("DefPer")
  local Vit2 = targetUser:GetProperty("Vit")
  local VitPer2 = targetUser:GetProperty("VitPer")
  local DamReduc2 = CommonFun.calcDamReDuc(srcUser, targetUser)
  local RefineDamReduc = targetUser:GetProperty("RefineDamReduc")
  ----------------------------------------------------------------------------------------------------------------种族，体型，属性，BOSS加伤效果
  local raceparam     = CommonFun.CalcRaceParam(srcUser, targetUser, params, damageParam, logger)
  local bodyparam     = CommonFun.CalcBodyParam(srcUser, targetUser, params, damageParam, logger)
  local elementparam  = CommonFun.CalcElementParam(srcUser, targetUser, params, damageParam, logger)
  local bossparam     = CommonFun.CalcBossParam(srcUser, targetUser, params, damageParam, logger)

  ----------------------------------------------------------------------------------------------------------------种族，体型，属性，BOSS减伤效果
  local raceparam2    = CommonFun.CalcRaceParam2(srcUser, targetUser, params, damageParam, logger)
  local bodyparam2    = CommonFun.CalcBodyParam2(srcUser, targetUser, params, damageParam, logger)
  local elementparam2 = CommonFun.CalcElementParam2(srcUser, targetUser, params, damageParam, logger)
  local bossparam2    = CommonFun.CalcBossParam2(srcUser, targetUser, params, damageParam, logger)

  local SkillRealDam=0
  if skilllv_1<=5 then
     SkillRealDam=skilllv_1*20
  else
     SkillRealDam=100+math.floor(Agi/5)*((skilllv_1-5)*0.5+0.5)
  end


  local BaseAtk  = Str*2 + math.floor(Str*Str/100) + math.floor(Dex/5) + math.floor(Luk/5)
  local AtkFinal = ((Atk-BaseAtk)*(1+AtkPer)*CommonFun.ShapeCorrection(srcUser,targetUser)*bodyparam*elementparam*elementparam2+BaseAtk)*raceparam*bossparam*bossparam2

  ----------------------------物理防御减免
  local DefReduc= CommonFun.CalcDef(Def,Vit,srcUser,targetUser)

  local A = (AtkFinal*DefReduc*(1-DamReduc2)+Refine)*(1-RefineDamReduc)*(1+DamIncrease)+SkillRealDam-Vit2*(1+VitPer2)

  ---------------------------------------------------------------------------------------------------------------------------------------------------------------判断二刀连击触发成功造成双倍伤害
  local gemChance = 0
  local gemDamage = 1
  if srcUser:HasBuffID(810009) then  ------------------梦魇连击符文
    gemChance = 10
    gemDamage = 1.3
  end
  
  if  CommonFun.IsInRate(skilllv_2*5 + gemChance, srcUser:GetRandom())  then
        return A*2*gemDamage, CommonFun.DamageType.ErLianJi
  end
 --------------------------------------------------------------------------------------------------------装备名刀不知火并且触发目标眩晕时额外造成50%伤害
  if bits[CommonFun.StateEffect.Dizzy]==1 and (Weapon == 40322 or Weapon == 140322) then
        return A*1.5
  end

  if 1 >= A then
      return 1
  end

  return A

end

-- refactory end
------------------------------------------------------------------------------------------------------------技能公式重构
-----------------------------------------------------------------------------------------------------------------近战战士系普攻及技能伤害计算公式(已改)
function CommonFun.calcDamage_18(srcUser, targetUser, params, damageParam, logger)
  local Str1 = srcUser:GetProperty("Str")
  --------------------------------------------------------------------------------------------------------商人星盘加成的力量转换的普攻加成率提升百分比
  local Num1 = srcUser:GetRunePoint(62080)
  local RuneDamage = Num1*0.01 + 1
  local Str = Str1*RuneDamage
  ---------------------------------------
  local Dex = srcUser:GetProperty("Dex")
  local Luk = srcUser:GetProperty("Luk")
  local Atk = srcUser:GetProperty("Atk")
  ------------------------------------------------------普通攻击力
  local NormalAtk = srcUser:GetProperty("NormalAtk")
        NormalAtk = NormalAtk + 5*Str
  -------------------------------------------
  local AtkPer = srcUser:GetProperty("AtkPer")
  local DamIncrease = srcUser:GetProperty("DamIncrease")
  local WeaponType =srcUser:GetEquipedWeaponType()
  local IgnoreDef  = 0
  local IgnoreDef1 = srcUser:GetProperty("IgnoreDef")
  local IgnoreDef2 = srcUser:GetProperty("IgnoreEquipDef")
  if targetUser.boss or targetUser.mini then
     IgnoreDef=IgnoreDef1
  else
     IgnoreDef=(IgnoreDef1+IgnoreDef2)
  end

  if IgnoreDef >= 1 then
     IgnoreDef=1
  end
    ------------------------------------------------------------------------------------将原来的物伤加成改成精炼物理攻击
  local Refine = srcUser:GetProperty("Refine")

  local Def2 = targetUser:GetProperty("Def")
  local DefPer2 = targetUser:GetProperty("DefPer")
  local Vit2 = targetUser:GetProperty("Vit")
  local VitPer2 = targetUser:GetProperty("VitPer")
  local DamReduc2 = CommonFun.calcDamReDuc(srcUser, targetUser)
  local RefineDamReduc = targetUser:GetProperty("RefineDamReduc")
  local damChangePer = damageParam.damChangePer

  ----------------------------------------------------------------------------------------------------------------种族，体型，属性，BOSS加伤效果
  local raceparam     = CommonFun.CalcRaceParam(srcUser, targetUser, params, damageParam, logger)
  local bodyparam     = CommonFun.CalcBodyParam(srcUser, targetUser, params, damageParam, logger)
  local elementparam  = CommonFun.CalcElementParam(srcUser, targetUser, params, damageParam, logger)
  local bossparam     = CommonFun.CalcBossParam(srcUser, targetUser, params, damageParam, logger)

  ----------------------------------------------------------------------------------------------------------------种族，体型，属性，BOSS减伤效果
  local raceparam2    = CommonFun.CalcRaceParam2(srcUser, targetUser, params, damageParam, logger)
  local bodyparam2    = CommonFun.CalcBodyParam2(srcUser, targetUser, params, damageParam, logger)
  local elementparam2 = CommonFun.CalcElementParam2(srcUser, targetUser, params, damageParam, logger)
  local bossparam2    = CommonFun.CalcBossParam2(srcUser, targetUser, params, damageParam, logger)

  local BaseAtk   = Str1*2 + math.floor(Str1*Str1/100) + math.floor(Dex/5) + math.floor(Luk/5)
  local BaseAtk1  = Str*2 + math.floor(Str*Str/100) + math.floor(Dex/5) + math.floor(Luk/5)

  local AtkFinal = ((Atk-BaseAtk+NormalAtk)*(1+AtkPer)*CommonFun.ShapeCorrection(srcUser,targetUser)*bodyparam*elementparam*elementparam2+BaseAtk1)*raceparam*bossparam*bossparam2
  --print("NormalAtk="..NormalAtk,"AtkFinal="..AtkFinal)
  ----------------------------物理防御减免
  local DefReduc= CommonFun.CalcDef(Def,Vit,srcUser,targetUser)

  local A = ((AtkFinal*DefReduc*(1-DamReduc2)+Refine)*damChangePer)*(1-RefineDamReduc)*(1+DamIncrease)-Vit2*(1+VitPer2)
  ---------------------------------------------------------------------------------------------------------------------------------------------------------------判断二刀连击触发成功造成双倍伤害
  ------------------------------------------------------------------------------------------------------------二刀连击
  local skilllv_1 = srcUser:GetLernedSkillLevel(179)

  local gemChance = 0
  local gemDamage = 1
  if srcUser:HasBuffID(810009) then  ------------------梦魇连击符文
    gemChance = 10
    gemDamage = 1.3
  end

  if WeaponType==250 and CommonFun.IsInRate((skilllv_1*5 + gemChance), srcUser:GetRandom())  then
        return (A*2*gemDamage), CommonFun.DamageType.ErLianJi
  end


   if 1 >= A then
         return 1
   end

   return A
end



----------------------------------------------------------------------------------------------------------------近战战士系普攻技能的伤害计算公式
function CommonFun.calcDamage_19(srcUser, targetUser, params, damageParam, logger)
  local Str = srcUser:GetProperty("Str")
  local Dex = srcUser:GetProperty("Dex")
  local Luk = srcUser:GetProperty("Luk")
  local Atk = srcUser:GetProperty("Atk")
  ---------------------------------------------------------------------------------------------------------------普攻-强效
  local Num1 = srcUser:GetRunePoint(11022)
  local Num2 = srcUser:GetRunePoint(11023)
  local Num3 = srcUser:GetRunePoint(11024)
  local Num4 = srcUser:GetRunePoint(12004)
  local Num5 = srcUser:GetRunePoint(12011)
  local RuneDamage = (Num1 + Num2 + Num3 + Num4 + Num5)*0.03
  local AtkPer1 = srcUser:GetProperty("AtkPer")
  local AtkPer  = AtkPer1 + RuneDamage
  ------------------------------------------------------普通攻击力
  local NormalAtk = srcUser:GetProperty("NormalAtk")
        NormalAtk = NormalAtk + 5*Str
  -------------------------------------------
  local DamIncrease = srcUser:GetProperty("DamIncrease")
  local IgnoreDef  = 0
  local IgnoreDef1 = srcUser:GetProperty("IgnoreDef")
  local IgnoreDef2 = srcUser:GetProperty("IgnoreEquipDef")
  if targetUser.boss or targetUser.mini then
     IgnoreDef=IgnoreDef1
  else
     IgnoreDef=(IgnoreDef1+IgnoreDef2)
  end

  if IgnoreDef >= 1 then
     IgnoreDef=1
  end

  local Agi = srcUser:GetProperty("Agi")
  local WeaponType =srcUser:GetEquipedWeaponType()
  local skilllv_1 = srcUser:GetLernedSkillLevel(damageParam.skill1_id)
  local skilllv_2 = srcUser:GetLernedSkillLevel(damageParam.skill2_id)
    ------------------------------------------------------------------------------------将原来的物伤加成改成精炼物理攻击
  local Refine = srcUser:GetProperty("Refine")

  local StateEffect = targetUser:GetProperty("StateEffect")
  local bits=CommonFun.getBits(StateEffect)
  local Weapon=srcUser:GetEquipedID(7)

  local Def2 = targetUser:GetProperty("Def")
  local DefPer2 = targetUser:GetProperty("DefPer")
  local Vit2 = targetUser:GetProperty("Vit")
  local VitPer2 = targetUser:GetProperty("VitPer")
  local DamReduc2 = CommonFun.calcDamReDuc(srcUser, targetUser)
  local RefineDamReduc = targetUser:GetProperty("RefineDamReduc")
  ----------------------------------------------------------------------------------------------------------------种族，体型，属性，BOSS加伤效果
  local raceparam     = CommonFun.CalcRaceParam(srcUser, targetUser, params, damageParam, logger)
  local bodyparam     = CommonFun.CalcBodyParam(srcUser, targetUser, params, damageParam, logger)
  local elementparam  = CommonFun.CalcElementParam(srcUser, targetUser, params, damageParam, logger)
  local bossparam     = CommonFun.CalcBossParam(srcUser, targetUser, params, damageParam, logger)

  ----------------------------------------------------------------------------------------------------------------种族，体型，属性，BOSS减伤效果
  local raceparam2    = CommonFun.CalcRaceParam2(srcUser, targetUser, params, damageParam, logger)
  local bodyparam2    = CommonFun.CalcBodyParam2(srcUser, targetUser, params, damageParam, logger)
  local elementparam2 = CommonFun.CalcElementParam2(srcUser, targetUser, params, damageParam, logger)
  local bossparam2    = CommonFun.CalcBossParam2(srcUser, targetUser, params, damageParam, logger)
  ---------------------------------灵气剑
  local SkillRealDam=0
  if skilllv_1<=5 then
      SkillRealDam=skilllv_1*20
  elseif skilllv_1>5 and skilllv_1<=10 then
      SkillRealDam=100+math.floor(Agi/5)*((skilllv_1-5)*0.5+0.5)
  else
      SkillRealDam=100+(skilllv_1-10)*20+math.floor(Agi/5)*3+Luk*2
  end
  ---------------------------剑速增加
  local AtkSpdAdd = 0
  local skilllv_3 = srcUser:GetLernedSkillLevel(22)
  if srcUser:HasBuffID(80082) and skilllv_3>10 then
        AtkSpdAdd = (skilllv_3-10)*120
  end

  local BaseAtk  = Str*2 + math.floor(Str*Str/100) + math.floor(Dex/5) + math.floor(Luk/5)
  local AtkFinal = ((Atk+AtkSpdAdd+NormalAtk-BaseAtk)*(1+AtkPer)*CommonFun.ShapeCorrection(srcUser,targetUser)*bodyparam*elementparam*elementparam2+BaseAtk)*raceparam*bossparam*bossparam2

  ----------------------------物理防御减免
  local DefReduc= CommonFun.CalcDef(Def,Vit,srcUser,targetUser)

  -------------------------------------------------------------------神圣复仇者
  local Weapon=srcUser:GetEquipedID(7)
  local RefineLv=srcUser:GetEquipedRefineLv(7)
  local HolyEquip = 1
  if Weapon==40319 or Weapon==140319 then
      HolyEquip = 1+0.05*RefineLv
  end
  -------------------------------------------------------------------天谴
  if (Weapon==40360 or Weapon==140360) then
      HolyEquip = 1+0.05*RefineLv
  end

  local A = ((AtkFinal*DefReduc*(1-DamReduc2)+Refine+SkillRealDam)*(1-RefineDamReduc)*(1+DamIncrease)-Vit2*(1+VitPer2))*HolyEquip

  ---------------------------------------------------------------------------------------------------------------------------------------------------------------判断二刀连击触发成功造成双倍伤害
  local gemChance = 0
  local gemDamage = 1
  if srcUser:HasBuffID(810009) then  ------------------梦魇连击符文
    gemChance = 10
    gemDamage = 1.3
  end
  
  if WeaponType==250 and CommonFun.IsInRate(skilllv_2*5 + gemChance, srcUser:GetRandom())  then
        return A*2*gemDamage, CommonFun.DamageType.ErLianJi
  end
 --------------------------------------------------------------------------------------------------------装备名刀不知火并且触发目标眩晕时额外造成50%伤害
  if bits[CommonFun.StateEffect.Dizzy]==1 and (Weapon == 40322 or Weapon == 140322) then
        return A*1.5
  end

  if 1 >= A then
      return 1
  end

  return A

end

-----------------------------------------------------------------------------------------------------------------近战战士系普攻及技能伤害计算公式(已改)
function CommonFun.calcDamage_20(srcUser, targetUser, params, damageParam, logger)
  local Str = srcUser:GetProperty("Str")
  local Dex = srcUser:GetProperty("Dex")
  local Luk = srcUser:GetProperty("Luk")
  local Atk = srcUser:GetProperty("Atk")
  local AtkPer = srcUser:GetProperty("AtkPer")
  local DamIncrease = srcUser:GetProperty("DamIncrease")
  local IgnoreDef  = 0
  local IgnoreDef1 = srcUser:GetProperty("IgnoreDef")
  local IgnoreDef2 = srcUser:GetProperty("IgnoreEquipDef")
  if targetUser.boss or targetUser.mini then
     IgnoreDef=IgnoreDef1
  else
     IgnoreDef=(IgnoreDef1+IgnoreDef2)
  end

  if IgnoreDef >= 1 then
     IgnoreDef=1
  end
    ------------------------------------------------------------------------------------将原来的物伤加成改成精炼物理攻击
  local Refine = srcUser:GetProperty("Refine")

  local Def2 = targetUser:GetProperty("Def")
  local DefPer2 = targetUser:GetProperty("DefPer")
  local Vit2 = targetUser:GetProperty("Vit")
  local VitPer2 = targetUser:GetProperty("VitPer")
  local DamReduc2 = CommonFun.calcDamReDuc(srcUser, targetUser)
  local RefineDamReduc = targetUser:GetProperty("RefineDamReduc")

  local damChangePer = damageParam.damChangePer

  ----------------------------------------------------------------------------------------------------------------种族，体型，属性，BOSS加伤效果
  local raceparam     = CommonFun.CalcRaceParam(srcUser, targetUser, params, damageParam, logger)
  local bodyparam     = CommonFun.CalcBodyParam(srcUser, targetUser, params, damageParam, logger)
  local elementparam  = CommonFun.CalcElementParam(srcUser, targetUser, params, damageParam, logger)
  local bossparam     = CommonFun.CalcBossParam(srcUser, targetUser, params, damageParam, logger)

  ----------------------------------------------------------------------------------------------------------------种族，体型，属性，BOSS减伤效果
  local raceparam2    = CommonFun.CalcRaceParam2(srcUser, targetUser, params, damageParam, logger)
  local bodyparam2    = CommonFun.CalcBodyParam2(srcUser, targetUser, params, damageParam, logger)
  local elementparam2 = CommonFun.CalcElementParam2(srcUser, targetUser, params, damageParam, logger)
  local bossparam2    = CommonFun.CalcBossParam2(srcUser, targetUser, params, damageParam, logger)



  local BaseAtk  = Str*2 + math.floor(Str*Str/100) + math.floor(Dex/5) + math.floor(Luk/5)
  local AtkFinal = ((Atk-BaseAtk)*(1+AtkPer)*CommonFun.ShapeCorrection(srcUser,targetUser)*bodyparam*elementparam*elementparam2+BaseAtk)*raceparam*bossparam*bossparam2
  ----------------------------物理防御减免
  local DefReduc= CommonFun.CalcDef(Def,Vit,srcUser,targetUser)

  local A = ((AtkFinal*DefReduc*(1-DamReduc2)+Refine)*damChangePer)*(1-RefineDamReduc)*(1+DamIncrease)-Vit2*(1+VitPer2)

   if 1 >= A then
         return 1
   end

   return A
end


------------------------------------------------------------------------------------------------------------------远程物理伤害计算公式(已改)
function CommonFun.calcDamage_21(srcUser, targetUser, params, damageParam, logger)
  local Str = srcUser:GetProperty("Str")
  local Dex = srcUser:GetProperty("Dex")
  local Luk = srcUser:GetProperty("Luk")
  local Atk = srcUser:GetProperty("Atk")
  local AtkPer = srcUser:GetProperty("AtkPer")
  local DamIncrease = srcUser:GetProperty("DamIncrease")
  local IgnoreDef  = 0
  local IgnoreDef1 = srcUser:GetProperty("IgnoreDef")
  local IgnoreDef2 = srcUser:GetProperty("IgnoreEquipDef")
  if targetUser.boss or targetUser.mini then
     IgnoreDef=IgnoreDef1
  else
     IgnoreDef=(IgnoreDef1+IgnoreDef2)
  end

  if IgnoreDef >= 1 then
     IgnoreDef=1
  end
   ------------------------------------------------------------------------------------将原来的物伤加成改成精炼物理攻击
  local Refine = srcUser:GetProperty("Refine")

  local AttrEffect = targetUser:GetProperty("AttrEffect")
  local bits=CommonFun.getBits(AttrEffect)

  local Def2 = targetUser:GetProperty("Def")
  local DefPer2 = targetUser:GetProperty("DefPer")
  local Vit2 = targetUser:GetProperty("Vit")
  local VitPer2 = targetUser:GetProperty("VitPer")
  local DamReduc2 = CommonFun.calcDamReDuc(srcUser, targetUser)
  local LongRangeDamReduc2 = targetUser:GetProperty("LongRangeDamReduc")
  local RefineDamReduc = targetUser:GetProperty("RefineDamReduc")

  local damChangePer = damageParam.damChangePer

  ----------------------------------------------------------------------------------------------------------------种族，体型，属性，BOSS加伤效果
  local raceparam     = CommonFun.CalcRaceParam(srcUser, targetUser, params, damageParam, logger)
  local bodyparam     = CommonFun.CalcBodyParam(srcUser, targetUser, params, damageParam, logger)
  local elementparam  = CommonFun.CalcElementParam(srcUser, targetUser, params, damageParam, logger)
  local bossparam     = CommonFun.CalcBossParam(srcUser, targetUser, params, damageParam, logger)

  ----------------------------------------------------------------------------------------------------------------种族，体型，属性，BOSS减伤效果
  local raceparam2    = CommonFun.CalcRaceParam2(srcUser, targetUser, params, damageParam, logger)
  local bodyparam2    = CommonFun.CalcBodyParam2(srcUser, targetUser, params, damageParam, logger)
  local elementparam2 = CommonFun.CalcElementParam2(srcUser, targetUser, params, damageParam, logger)
  local bossparam2    = CommonFun.CalcBossParam2(srcUser, targetUser, params, damageParam, logger)

  ----------------------------------------------------------------------------------------------------------------元素箭额外增加物理伤害
  local skillID, skillLevel = CommonFun.UnmergeSkillID(params.skillIDAndLevel)
  local skilllv_1 = srcUser:GetLernedSkillLevel(127)
  local atk_add = 0
  if skilllv_1 >10 and (skillID == 300 or skillID==113) then
    atk_add = Dex * ((skilllv_1-10) * 0.5)
  end
  ------------------------------------------普攻攻击力
  local NormalAtk = 0
  if skillID == 300 or skillID==113 then
      local NormalAtkAttr = srcUser:GetProperty("NormalAtk")
      NormalAtk = NormalAtkAttr + 3*Dex
  end

  local BaseAtk  = Dex*2 + math.floor(Dex*Dex/100) + math.floor(Str/5) + math.floor(Luk/5)
  local AtkFinal = ((Atk-BaseAtk+NormalAtk+atk_add)*(1+AtkPer)*CommonFun.ShapeCorrection(srcUser,targetUser)*bodyparam*elementparam*elementparam2+BaseAtk)*raceparam*bossparam*bossparam2
  -----------------------------------------物理防御减免
  local DefReduc= CommonFun.CalcDef(Def,Vit,srcUser,targetUser)
  ------------------------------------------------------------------------巅峰等级 苍鹰之眼
  local targetid = targetUser:GetGuid()
  local distance = srcUser:GetDistance(targetid)
  local skilllv_1 = srcUser:GetLernedSkillLevel(133)
  local DisDam= 1
  if skilllv_1>10 then
      DisDam = 1 + distance/7.5*(skilllv_1-10)*0.06
  end
  ---------------------------重伤箭
  local Injured = 1
  if bits[CommonFun.AttrEffect.NormalSkillDam]==1 then
      Injured = 1.3
  end
  local Num1 = srcUser:GetRunePoint(43030)
  local RuneDamage = Num1*0.01+1

  local A = ((AtkFinal*DefReduc*(1-DamReduc2)+Refine)*damChangePer)*(1-RefineDamReduc)*(1+DamIncrease-LongRangeDamReduc2)-Vit2*(1+VitPer2)

  if skillID == 300 or skillID==113 then
        A = (((AtkFinal*DefReduc*(1-DamReduc2)+Refine)*damChangePer)*(1-RefineDamReduc)*(1+DamIncrease-LongRangeDamReduc2)-Vit2*(1+VitPer2))*DisDam*Injured*RuneDamage
  end

   if 1 >= A then
         return 1
   end
   --print("DisDam="..DisDam,"Injured="..Injured,"NormalAtk="..NormalAtk,"A="..A)
   return A

end

------------------------------------------------------------------------------------------------------------------远程物理老鹰技能伤害计算公式(已改)
function CommonFun.calcDamage_22(srcUser, targetUser, params, damageParam, logger)
  local Dex = srcUser:GetProperty("Dex")
  local Int = srcUser:GetProperty("Int")
  local skilllv_1 = srcUser:GetLernedSkillLevel(damageParam.skill1_id)
  local skilllv_2 = srcUser:GetLernedSkillLevel(damageParam.skill2_id)
  local count=params.hitedCount
  local Atk = srcUser:GetProperty("Atk")
  local AtkPer = srcUser:GetProperty("AtkPer")

  local srcAtkElement    = CommonFun.GetUserAtkAttr(srcUser, params, damageParam)
  local targetDefElement = targetUser:GetProperty("DefAttr")
  local DamReduc2 = CommonFun.calcDamReDuc(srcUser, targetUser)
  local RefineDamReduc = targetUser:GetProperty("RefineDamReduc")---老鹰伤害受精炼减伤

  local AttrEffect = srcUser:GetProperty("AttrEffect")
  local bits=CommonFun.getBits(AttrEffect)

  local AttrEffect2 = srcUser:GetProperty("AttrEffect")
  local bits2=CommonFun.getBits(AttrEffect2)

  local damChangePer = damageParam.damChangePer
  local damChangePer1 = damageParam.damChangePer1
  local damChangePer2 = damageParam.damChangePer2
  local damChangePer3 = damageParam.damChangePer3

  ----------------------------------------------------------------------------------------------------------------种族，体型，属性，BOSS减伤效果
  local elementparam2 = CommonFun.CalcElementParam2(srcUser, targetUser, params, damageParam, logger)

  ---------------------------------------------------------------------技能闪电冲击部分伤害
  local skilllv_1_value1 = 0
  local skilllv_1_value2 = 0
  ---------------------------------------------------------------------该部分为闪电冲击技能基础数值增伤部分,当技能未学习时没有对应伤害
  if skilllv_1<=0 then
     skilllv_1_value1=0
  else
     skilllv_1_value1=(skilllv_1*damChangePer+damChangePer1)
  end

  ---------------------------------------------------------------------该部分为闪电冲击连击数增加的倍率,考虑到可能有玩家二转没有学习闪电冲击,但三转学习猎杀突击,不做判断会出现伤害为0的情况
  if skilllv_1<=0 then
     skilllv_1_value2 = 1
  elseif skilllv_1>0 and skilllv_1<=10 then
     skilllv_1_value2 = (skilllv_1*0.5+0.5)
  elseif skilllv_1>10 then
     skilllv_1_value2 = 5.5
  end
  if srcUser:HasBuffID(100018101) then
    skilllv_1_value2=skilllv_1_value2*25
  end
  ----------------------------------------------------------------------驯兽术10级的时候驯兽术伤害增加20%
  ---------------------------------------------------------------------猎鹰的范围技能当出现范围数小于1的时候按1个处理
  if count<=1 then
     count=1
  end
  ---------------------------------------------------------------------星盘驯兽术
  local Num1=srcUser:GetRunePoint(42006)
  local Num2=srcUser:GetRunePoint(42007)
  local Num3=srcUser:GetRunePoint(42008)
  local Num4=srcUser:GetRunePoint(42009)
  local Num5=srcUser:GetRunePoint(42010)
  local RuneDamage=Num1*0.05+Num2*0.1+Num3*0.1+Num4*0.05+Num5*0.05+1
  local XuShouShuDam = skilllv_2*damChangePer2*RuneDamage
  ---------------------------------------------------------------------星盘精炼物攻影响猎鹰伤害,星盘闪电冲击
  local Refine = srcUser:GetProperty("Refine")
  local RefineLv=srcUser:GetEquipedRefineLv(7)
  local Num6=srcUser:GetRunePoint(42011)
  local Num7=srcUser:GetRunePoint(42012)
  local RuneDamage2=Num6*Refine
  local RuneDamage3=Num7*RefineLv*0.01+1
  ---------------------------------------------------------------------星盘闪电冲击连击概率
  local Num8=srcUser:GetRunePoint(42013)
  local Num9=srcUser:GetRunePoint(42014)
  local Num10=srcUser:GetRunePoint(42015)
  local RuneRate=Num8*10+Num9*10+Num10*30
  local RuneDamage4=1
  if CommonFun.IsInRate(RuneRate, srcUser:GetRandom()) then
        RuneDamage4=2
  end
  ---------------------------------------------------------------------星盘猎鹰对眩晕目标伤害加成
  local StateEffect = targetUser:GetProperty("StateEffect")
  local bits3=CommonFun.getBits(StateEffect)
  local Num11 = srcUser:GetRunePoint(42080)
  local RuneDamage5=1
  if bits3[CommonFun.StateEffect.Dizzy] ==1 then
        RuneDamage5=1+Num11*0.02
  end
  ---------------------------------------------------------------------诅咒之弓IV+山地游侠装IV
  local  taozhuang=1
  if srcUser:HasBuffID(90001463) and srcUser:HasBuffID(90001473)  then
      taozhuang=1.15
  end
  ---------------------------------------------------------------------山地游侠装[第八档]
  local IntSD = srcUser:GetProperty("Int")
  if IntSD >= 180 then
      taozhuang = taozhuang + 0.15
  end
  ---------------------------------------------------------------------痛苦折磨
  if srcUser:HasBuffID(41800)  then
      taozhuang=taozhuang + 0.2
  end



  local A=((((skilllv_1_value1+XuShouShuDam+math.floor(Int/2)*2+math.floor(Dex/10)*2)*skilllv_1_value2)*damChangePer3*GameConfig.ElementRestrain[srcAtkElement][targetDefElement]*elementparam2+RuneDamage2)*RuneDamage3*RuneDamage4*RuneDamage5+(Atk*(1+AtkPer)+Refine)*taozhuang*skilllv_1*0.05)*(1-RefineDamReduc)
  -------------------------------------------------------------------------------------------------------------诅咒之弓 或 痛苦折磨
  local Weapon=srcUser:GetEquipedID(7)
  local B = 1

  if (Weapon==41233 or Weapon==141233 or Weapon==41256 or Weapon==141256) then
     B = 2
  end

  -------------------------------------------------------------------------诅咒之弓[第六档]
  if srcUser:HasBuffID(90001465) then
     B = B +0.3
  end

  ------------------------------------------------------------------------痛苦折磨
  if srcUser:HasBuffID(41800) then
     B = B +0.3
  end



  if      bits[CommonFun.AttrEffect.XuShouDam]==1 and skilllv_2==10 and bits2[CommonFun.AttrEffect.Shandiyouxiazhuang]==1 then
               A=(((((skilllv_1_value1+XuShouShuDam*1.2) + math.floor(Int/2)*2*4 + math.floor(Dex/10)*2)*skilllv_1_value2)*damChangePer3*GameConfig.ElementRestrain[srcAtkElement][targetDefElement]*elementparam2+RuneDamage2)*RuneDamage3*RuneDamage4*RuneDamage5+(Atk*(1+AtkPer)+Refine)*taozhuang*skilllv_1*0.05)*(1-RefineDamReduc)
  elseif  bits[CommonFun.AttrEffect.XuShouDam]==1 and skilllv_2==10 then
               A=(((((skilllv_1_value1+XuShouShuDam*1.2) + math.floor(Int/2)*2 + math.floor(Dex/10)*2)*skilllv_1_value2)*damChangePer3*GameConfig.ElementRestrain[srcAtkElement][targetDefElement]*elementparam2+RuneDamage2)*RuneDamage3*RuneDamage4*RuneDamage5+(Atk*(1+AtkPer)+Refine)*taozhuang*skilllv_1*0.05)*(1-RefineDamReduc)
  elseif  bits2[CommonFun.AttrEffect.Shandiyouxiazhuang]==1 then
               A=(((((skilllv_1_value1+XuShouShuDam)*B + math.floor(Int/2)*2*4+math.floor(Dex/10)*2)*skilllv_1_value2)*damChangePer3*GameConfig.ElementRestrain[srcAtkElement][targetDefElement]*elementparam2+RuneDamage2)*RuneDamage3*RuneDamage4*RuneDamage5+(Atk*(1+AtkPer)+Refine)*taozhuang*skilllv_1*0.05)*(1-RefineDamReduc)
  elseif  skilllv_2==10 then
               A=(((((skilllv_1_value1+XuShouShuDam)*B + math.floor(Int/2)*2 + math.floor(Dex/10)*2)*skilllv_1_value2)*damChangePer3*GameConfig.ElementRestrain[srcAtkElement][targetDefElement]*elementparam2+RuneDamage2)*RuneDamage3*RuneDamage4*RuneDamage5+(Atk*(1+AtkPer)+Refine)*taozhuang*skilllv_1*0.05)*(1-RefineDamReduc)
  end
 -- print("A="..A,"RuneDamage="..RuneDamage,"RuneDamage3="..RuneDamage3,"RuneDamage4="..RuneDamage4)
  ----------------------------------------------------------------------------------狼突击
  local skillID, skillLevel = CommonFun.UnmergeSkillID(params.skillIDAndLevel)
  if skillID == 1253 or skillID == 1255 then
      local skilllv_wolf = srcUser:GetLernedSkillLevel(1242)-------狼牙
      ------------------------------------------------星盘
      local Num_wolf = srcUser:GetRunePoint(44020)
      local Num_all = srcUser:GetRunePoint(44030)
      local skilllv_1 = srcUser:GetLernedSkillLevel(128)---猎杀突击
      local skilllv_2 = srcUser:GetLernedSkillLevel(135)---猎鹰突击

      A = A * (1+skilllv_wolf*0.015)*(1+Num_wolf*0.04)*(1+(skilllv_1+skilllv_2)*Num_all*0.005)
     -- print("A="..A,"skilllv_wolf="..skilllv_wolf,"Num_wolf="..Num_wolf,"skilllv_1="..skilllv_1,"skilllv_2="..skilllv_2,"Num_all="..Num_all)
  end

  local skilllv_hezou= srcUser:GetBuffLevel(118830) ---------------与狼共舞合奏

      A = A*(skilllv_hezou*0.06+1)

  if 1 >= A then
    return 1
  end

    return A
end

------------------------------------------------------------------------------------------------------------------远程物理陷阱技能（冰霜，爆散）伤害计算公式(已改)
function CommonFun.calcDamage_23(srcUser, targetUser, params, damageParam, logger)
  local BaseLv = srcUser.BaseLv
  local Dex = srcUser:GetProperty("Dex")
  local Int = srcUser:GetProperty("Int")
  local MDamIncrease = CommonFun.calcMDamIncrease(srcUser, targetUser)
  local RefineMDamReduc = targetUser:GetProperty("RefineMDamReduc")
  local IgnoreDef  = 0
  local IgnoreDef1 = srcUser:GetProperty("IgnoreDef")
  local IgnoreDef2 = srcUser:GetProperty("IgnoreEquipDef")
  if targetUser.boss or targetUser.mini then
     IgnoreDef=IgnoreDef1
  else
     IgnoreDef=(IgnoreDef1+IgnoreDef2)
  end

  if IgnoreDef >= 1 then
     IgnoreDef  = 1
  end

  local Def2 = targetUser:GetProperty("Def")
  local DefPer2 = targetUser:GetProperty("DefPer")
  local Vit2 = targetUser:GetProperty("Vit")
  local VitPer2 = targetUser:GetProperty("VitPer")
  local srcAtkElement    = CommonFun.GetUserAtkAttr(srcUser, params, damageParam)
  local targetDefElement = targetUser:GetProperty("DefAttr")
   ----------------------------------------------------------------------------------------------------------------种族，体型，属性，BOSS减伤效果
  local raceparam     = CommonFun.CalcRaceParam(srcUser, targetUser, params, damageParam, logger)
  local elementparam2 = CommonFun.CalcElementParam2(srcUser, targetUser, params, damageParam, logger)
  local bossparam     = CommonFun.CalcBossParam(srcUser, targetUser, params, damageParam, logger)

  local skilllv_1 = srcUser:GetLernedSkillLevel(damageParam.skill1_id)
  local skilllv_2 = srcUser:GetLernedSkillLevel(damageParam.skill2_id)

  local AttrEffect = srcUser:GetProperty("AttrEffect")
  local bits=CommonFun.getBits(AttrEffect)
  local MDamReduc2 = CommonFun.calcMDamReDuc(srcUser, targetUser)

  local damChangePer = damageParam.damChangePer

  ----------------------------物理防御减免
  local DefReduc= CommonFun.CalcDef(Def,Vit,srcUser,targetUser)
  -------------------------------------------------------------------------------------------------------------------星盘冰霜爆散
  local StateEffect = targetUser:GetProperty("StateEffect")
  local bits2=CommonFun.getBits(StateEffect)
  local Num6 = srcUser:GetRunePoint(42070)
  local RuneDamage2=1
  if bits2[CommonFun.StateEffect.Sleep] ==1 then
        RuneDamage2=1+Num6*0.05
  end
  -------------------------------------------装备升级  星尘外套+月亮胸针
  local suit = 1
  if srcUser:HasBuffID(90000773) and srcUser:HasBuffID(90001005) then
      suit = 1.1
  end

    -------------------------------------------星尘外套[第八档]
  local RefineLv2=srcUser:GetEquipedRefineLv(2)
  if srcUser:HasBuffID(90000777) then
        if (RefineLv2>=10 and RefineLv2<15) then
        suit =suit+(RefineLv2-10)* 0.02
         elseif RefineLv2 ==15 then
         suit =suit+(RefineLv2-10)* 0.02 + 0.05
        end
    end
  -------------------------------------------露娜弓[第八档]
  local RefineLv7=srcUser:GetEquipedRefineLv(7)
    if srcUser:HasBuffID(90000999) then
        if (RefineLv7>=10 and RefineLv7<15) then
        suit =suit+0.08
        elseif RefineLv7 ==15 then
         suit =suit+0.08+0.12
        end
    end
  -------------------------------------------月光女神
    if srcUser:HasBuffID(41812) then
      if (RefineLv7>=5 and RefineLv7<10) then
           suit =suit+0.05
      elseif(RefineLv7>=10 and RefineLv7<15) then
           suit =suit+0.05+0.1
      elseif RefineLv7 ==15 then
           suit =suit+0.05+0.1+0.15
      end
    end
----------------------------------------------------------------月亮胸针[第十档]

  local RefineLv5=srcUser:GetEquipedRefineLv(5)
  local RefineLv6=srcUser:GetEquipedRefineLv(6)
  local Ring1=srcUser:GetEquipedID(5)
  local Ring2=srcUser:GetEquipedID(6)

  local a = 0
  local b = 0
  if srcUser:HasBuffID(90001009) and (Ring1==44006 or Ring1==144006)  then
      a = RefineLv5*0.01
  end
  if srcUser:HasBuffID(90001009) and (Ring1==44006 or Ring1==144006)  then
      b = RefineLv6*0.01
  end
  suit = suit + a + b


  -------------------------------------------炽天使精炼
  local Angel = 1
  if srcUser:HasBuffID(90001014) then
      local RefineLv=srcUser:GetEquipedRefineLv(7)
      Angel = 1 + 0.02*RefineLv
  end
  -------------------------------------------------------------------------------------------------------------------星盘陷阱研究
  local Num7 = srcUser:GetRunePoint(42060)
  local RuneDamage3 = 1+Num7*0.03*skilllv_1
  ------------------------------------------------------三转器械专家
  local skilllv_trap = srcUser:GetLernedSkillLevel(1248)
  local trap = 1 + skilllv_trap*0.02

  local A = (Dex*(3+BaseLv/100)*(1+Int/35)*damChangePer+skilllv_1*20*RuneDamage3)*DefReduc*(1+MDamIncrease)*(1-MDamReduc2)*(1-RefineMDamReduc)*GameConfig.ElementRestrain[srcAtkElement][targetDefElement]*elementparam2*raceparam*bossparam*RuneDamage2*suit*Angel*trap

  if 1 >= A then
    return 1
  end
  ------------------------------------------------------------------------------------手动引爆时伤害额外增加
  local Num1 = srcUser:GetRunePoint(42031)--------------------------------------------星盘引爆伤害
  local Num2 = srcUser:GetRunePoint(42032)
  local Num3 = srcUser:GetRunePoint(42033)
  local Num4 = srcUser:GetRunePoint(42034)
  local Num5 = srcUser:GetRunePoint(42035)
  local RuneDamage = Num1*0.1+Num2*0.05+Num3*0.05+Num4*0.1+Num5*0.05+1

  if bits[CommonFun.AttrEffect.TriggerTrapMark]==1 then
      return A*(1+skilllv_2*0.1)*RuneDamage
  end

      return A
end

-----------------------------------------------------------------------------------------------------------------乘胜追击技能伤害计算公式(已改)
function CommonFun.calcDamage_24(srcUser, targetUser, params, damageParam, logger)
  local Str = srcUser:GetProperty("Str")
  local Dex = srcUser:GetProperty("Dex")
  local Luk = srcUser:GetProperty("Luk")
  local Atk = srcUser:GetProperty("Atk")
  local AtkPer = srcUser:GetProperty("AtkPer")
  local DamIncrease = srcUser:GetProperty("DamIncrease")
  local IgnoreDef  = 0
  local IgnoreDef1 = srcUser:GetProperty("IgnoreDef")
  local IgnoreDef2 = srcUser:GetProperty("IgnoreEquipDef")
  if targetUser.boss or targetUser.mini then
     IgnoreDef=IgnoreDef1
  else
     IgnoreDef=(IgnoreDef1+IgnoreDef2)
  end

  if IgnoreDef >= 1 then
     IgnoreDef=1
  end
    ------------------------------------------------------------------------------------将原来的物伤加成改成精炼物理攻击
  local Refine = srcUser:GetProperty("Refine")

  local Def2 = targetUser:GetProperty("Def")
  local DefPer2 = targetUser:GetProperty("DefPer")
  local Vit2 = targetUser:GetProperty("Vit")
  local VitPer2 = targetUser:GetProperty("VitPer")
  local DamReduc2 = CommonFun.calcDamReDuc(srcUser, targetUser)
  local RefineDamReduc = targetUser:GetProperty("RefineDamReduc")

  local damChangePer = damageParam.damChangePer

  ----------------------------------------------------------------------------------------------------------------种族，体型，属性，BOSS加伤效果
  local raceparam     = CommonFun.CalcRaceParam(srcUser, targetUser, params, damageParam, logger)
  local bodyparam     = CommonFun.CalcBodyParam(srcUser, targetUser, params, damageParam, logger)
  local elementparam  = CommonFun.CalcElementParam(srcUser, targetUser, params, damageParam, logger)
  local bossparam     = CommonFun.CalcBossParam(srcUser, targetUser, params, damageParam, logger)

  ----------------------------------------------------------------------------------------------------------------种族，体型，属性，BOSS减伤效果
  local raceparam2    = CommonFun.CalcRaceParam2(srcUser, targetUser, params, damageParam, logger)
  local bodyparam2    = CommonFun.CalcBodyParam2(srcUser, targetUser, params, damageParam, logger)
  local elementparam2 = CommonFun.CalcElementParam2(srcUser, targetUser, params, damageParam, logger)
  local bossparam2    = CommonFun.CalcBossParam2(srcUser, targetUser, params, damageParam, logger)



  local BaseAtk  = Str*2 + math.floor(Str*Str/100) + math.floor(Dex/5) + math.floor(Luk/5)
  local AtkFinal = ((Atk-BaseAtk)*(1+AtkPer)*CommonFun.ShapeCorrection(srcUser,targetUser)*bodyparam*elementparam*elementparam2+BaseAtk)*raceparam*bossparam*bossparam2

  ----------------------------物理防御减免
  local DefReduc= CommonFun.CalcDef(Def,Vit,srcUser,targetUser)

  local A = (AtkFinal*DefReduc*(1-DamReduc2) + Luk*5 + math.floor(Luk*Luk/100)*5 + Refine)*damChangePer*(1-RefineDamReduc)*(1+DamIncrease)-Vit2*(1+VitPer2)

   if 1 >= A then
         return 1
   end

   return A
end

-----------------------------------------------------------------------------------------------------------------近战十字军系普攻伤害计算公式(已改)
function CommonFun.calcDamage_25(srcUser, targetUser, params, damageParam, logger)
  local Str = srcUser:GetProperty("Str")
  local Dex = srcUser:GetProperty("Dex")
  local Luk = srcUser:GetProperty("Luk")
  local Atk = srcUser:GetProperty("Atk")
  ------------------------------------------------------普通攻击力
  local NormalAtk = srcUser:GetProperty("NormalAtk")
        NormalAtk = NormalAtk + 5*Str
  ---------------------------------------------------------------------------------------------------------------普攻-强效
  local Num1 = srcUser:GetRunePoint(70010)
  local RuneDamage = Num1*0.03
  local AtkPer1 = srcUser:GetProperty("AtkPer")
  local AtkPer  = AtkPer1 + RuneDamage

  local DamIncrease = srcUser:GetProperty("DamIncrease")
  local IgnoreDef  = 0
  local IgnoreDef1 = srcUser:GetProperty("IgnoreDef")
  local IgnoreDef2 = srcUser:GetProperty("IgnoreEquipDef")
  if targetUser.boss or targetUser.mini then
     IgnoreDef=IgnoreDef1
  else
     IgnoreDef=(IgnoreDef1+IgnoreDef2)
  end

  if IgnoreDef >= 1 then
     IgnoreDef=1
  end
    ------------------------------------------------------------------------------------将原来的物伤加成改成精炼物理攻击
  local Refine = srcUser:GetProperty("Refine")

  local Def2 = targetUser:GetProperty("Def")
  local DefPer2 = targetUser:GetProperty("DefPer")
  local Vit2 = targetUser:GetProperty("Vit")
  local VitPer2 = targetUser:GetProperty("VitPer")
  local DamReduc2 = CommonFun.calcDamReDuc(srcUser, targetUser)
  local RefineDamReduc = targetUser:GetProperty("RefineDamReduc")

  local damChangePer = damageParam.damChangePer

  ----------------------------------------------------------------------------------------------------------------种族，体型，属性，BOSS加伤效果
  local raceparam     = CommonFun.CalcRaceParam(srcUser, targetUser, params, damageParam, logger)
  local bodyparam     = CommonFun.CalcBodyParam(srcUser, targetUser, params, damageParam, logger)
  local elementparam  = CommonFun.CalcElementParam(srcUser, targetUser, params, damageParam, logger)
  local bossparam     = CommonFun.CalcBossParam(srcUser, targetUser, params, damageParam, logger)

  ----------------------------------------------------------------------------------------------------------------种族，体型，属性，BOSS减伤效果
  local raceparam2    = CommonFun.CalcRaceParam2(srcUser, targetUser, params, damageParam, logger)
  local bodyparam2    = CommonFun.CalcBodyParam2(srcUser, targetUser, params, damageParam, logger)
  local elementparam2 = CommonFun.CalcElementParam2(srcUser, targetUser, params, damageParam, logger)
  local bossparam2    = CommonFun.CalcBossParam2(srcUser, targetUser, params, damageParam, logger)



  local BaseAtk  = Str*2 + math.floor(Str*Str/100) + math.floor(Dex/5) + math.floor(Luk/5)
  local AtkFinal = ((Atk-BaseAtk+NormalAtk)*(1+AtkPer)*CommonFun.ShapeCorrection(srcUser,targetUser)*bodyparam*elementparam*elementparam2+BaseAtk)*raceparam*bossparam*bossparam2

  ----------------------------物理防御减免
  local DefReduc= CommonFun.CalcDef(Def,Vit,srcUser,targetUser)
  -------------------------------------------------------------------神圣复仇者
  local Weapon=srcUser:GetEquipedID(7)
  local RefineLv=srcUser:GetEquipedRefineLv(7)
  local HolyEquip = 1
  if Weapon==40319 or Weapon==140319 then
      HolyEquip = 1+0.05*RefineLv
  end
  -------------------------------------------------------------------天谴
  if (Weapon==40360 or Weapon==140360) then
      HolyEquip = 1+0.05*RefineLv
  end


  local A = ((AtkFinal*DefReduc*(1-DamReduc2)+Refine)*damChangePer*(1-RefineDamReduc)*(1+DamIncrease)-Vit2*(1+VitPer2))*HolyEquip
   -----------------------------------------------------舍命攻击
   if srcUser:HasBuffID(115090) or srcUser:HasBuffID(115091) then
      elementparam =5
    local Hp = srcUser:GetProperty("Hp")
    local MaxHp = srcUser:GetProperty("MaxHp")
    local skilllv_1 = srcUser:GetLernedSkillLevel(361)

    local mapid,maptype = srcUser:GetMapInfo()-----------------获取所在地图
    local pvpRatio = 1
    ------------------------maptype 1 :野外 2：pvp 3:其他普通副本 4:gvg
    if maptype==2 or maptype==4 then
        pvpRatio = 0.25
    end
    ----------------舍命攻击 巅峰等级
    local dam = 0
    if skilllv_1>5 then
      dam = ((AtkFinal*DefReduc*(1-DamReduc2)+Refine)*(skilllv_1-5)*0.3*(1-RefineDamReduc)*(1+DamIncrease)-Vit2*(1+VitPer2))*HolyEquip
    end

    if Hp>MaxHp*0.09 then
        A = MaxHp*0.09*(1+math.max((skilllv_1-1)*0.1,0.4))*pvpRatio*(1-RefineDamReduc) + dam
    end
   end

  -----------------------------------------------------------------------------------------------------------二刀连击
  local skilllv_1 = srcUser:GetLernedSkillLevel(179)
  local WeaponType =srcUser:GetEquipedWeaponType()

  local gemChance = 0
  local gemDamage = 1
  if srcUser:HasBuffID(810009) then  ------------------梦魇连击符文
    gemChance = 10
    gemDamage = 1.3
  end

  if WeaponType==250 and CommonFun.IsInRate(skilllv_1*5 + gemChance, srcUser:GetRandom())  then
        return A*2*gemDamage, CommonFun.DamageType.ErLianJi
  end


   if 1 >= A then
         return 1
   end

   return A
end

-----------------------------------------------------------------------------------------------------------------近战十字军系技能伤害计算公式(已改)
function CommonFun.calcDamage_26(srcUser, targetUser, params, damageParam, logger)
  local Str = srcUser:GetProperty("Str")
  local Dex = srcUser:GetProperty("Dex")
  local Luk = srcUser:GetProperty("Luk")
  local Atk = srcUser:GetProperty("Atk")
  local AtkPer = srcUser:GetProperty("AtkPer")
  local DamIncrease = srcUser:GetProperty("DamIncrease")
  local IgnoreDef  = 0
  local IgnoreDef1 = srcUser:GetProperty("IgnoreDef")
  local IgnoreDef2 = srcUser:GetProperty("IgnoreEquipDef")
  if targetUser.boss or targetUser.mini then
     IgnoreDef=IgnoreDef1
  else
     IgnoreDef=(IgnoreDef1+IgnoreDef2)
  end

  if IgnoreDef >= 1 then
     IgnoreDef=1
  end
    ------------------------------------------------------------------------------------将原来的物伤加成改成精炼物理攻击
  local Refine = srcUser:GetProperty("Refine")

  local Def2 = targetUser:GetProperty("Def")
  local DefPer2 = targetUser:GetProperty("DefPer")
  local Vit2 = targetUser:GetProperty("Vit")
  local VitPer2 = targetUser:GetProperty("VitPer")
  local DamReduc2 = CommonFun.calcDamReDuc(srcUser, targetUser)
  local RefineDamReduc = targetUser:GetProperty("RefineDamReduc")

  local damChangePer = damageParam.damChangePer

  ----------------------------------------------------------------------------------------------------------------种族，体型，属性，BOSS加伤效果
  local raceparam     = CommonFun.CalcRaceParam(srcUser, targetUser, params, damageParam, logger)
  local bodyparam     = CommonFun.CalcBodyParam(srcUser, targetUser, params, damageParam, logger)
  local elementparam  = CommonFun.CalcElementParam(srcUser, targetUser, params, damageParam, logger)
  local bossparam     = CommonFun.CalcBossParam(srcUser, targetUser, params, damageParam, logger)

  ----------------------------------------------------------------------------------------------------------------种族，体型，属性，BOSS减伤效果
  local raceparam2    = CommonFun.CalcRaceParam2(srcUser, targetUser, params, damageParam, logger)
  local bodyparam2    = CommonFun.CalcBodyParam2(srcUser, targetUser, params, damageParam, logger)
  local elementparam2 = CommonFun.CalcElementParam2(srcUser, targetUser, params, damageParam, logger)
  local bossparam2    = CommonFun.CalcBossParam2(srcUser, targetUser, params, damageParam, logger)



  local BaseAtk  = Str*2 + math.floor(Str*Str/100) + math.floor(Dex/5) + math.floor(Luk/5)
  local AtkFinal = ((Atk-BaseAtk)*(1+AtkPer)*CommonFun.ShapeCorrection(srcUser,targetUser)*bodyparam*elementparam*elementparam2+BaseAtk)*raceparam*bossparam*bossparam2

  ----------------------------物理防御减免
  local DefReduc= CommonFun.CalcDef(Def,Vit,srcUser,targetUser)

  local A = (AtkFinal*DefReduc*(1-DamReduc2)+Refine)*damChangePer*(1-RefineDamReduc)*(1+DamIncrease)-Vit2*(1+VitPer2)

   if 1 >= A then
         return 1
   end

   return A
end

-----------------------------------------------------------------------------------------------------------------武僧普攻伤害计算公式
function CommonFun.calcDamage_27(srcUser, targetUser, params, damageParam, logger)
  local Str1 = srcUser:GetProperty("Str")
  --------------------------------------------------------------------------------------------------------星盘加成的力量转换的普攻加成率提升百分比
  local Num1 = srcUser:GetRunePoint(120010)
  local RuneDamage = Num1*0.05 + 1
  local Str = Str1*RuneDamage
  --------------------------------
  local Dex = srcUser:GetProperty("Dex")
  local Luk = srcUser:GetProperty("Luk")
  local Atk = srcUser:GetProperty("Atk")
  local Int = srcUser:GetProperty("Int")
  if srcUser:HasBuffID(100510) then
      Atk = Atk + 5*Int
  end
  local AtkPer1 = srcUser:GetProperty("AtkPer")
  -------------------------------------------------------------------------------------星盘物理攻击转换加成
  local Num2 = srcUser:GetRunePoint(120020)
  local RuneDamage2 = Num2*0.03
  local AtkPer = AtkPer1 + RuneDamage2
  ------------------------------------------------------普通攻击力
  local NormalAtk = srcUser:GetProperty("NormalAtk")
        NormalAtk = NormalAtk + 5*Str
  ------------------------------------
  local DamIncrease = srcUser:GetProperty("DamIncrease")
  local IgnoreDef  = 0
  local IgnoreDef1 = srcUser:GetProperty("IgnoreDef")
  local IgnoreDef2 = srcUser:GetProperty("IgnoreEquipDef")
  if targetUser.boss or targetUser.mini then
     IgnoreDef=IgnoreDef1
  else
     IgnoreDef=(IgnoreDef1+IgnoreDef2)
  end

  if IgnoreDef >= 1 then
     IgnoreDef=1
  end
    ------------------------------------------------------------------------------------将原来的物伤加成改成精炼物理攻击
  local Refine = srcUser:GetProperty("Refine")

  local Def2 = targetUser:GetProperty("Def")
  local DefPer2 = targetUser:GetProperty("DefPer")
  local Vit2 = targetUser:GetProperty("Vit")
  local VitPer2 = targetUser:GetProperty("VitPer")
  local DamReduc2 = CommonFun.calcDamReDuc(srcUser, targetUser)
  local RefineDamReduc = targetUser:GetProperty("RefineDamReduc")

  local damChangePer = damageParam.damChangePer

  ----------------------------------------------------------------------------------------------------------------种族，体型，属性，BOSS加伤效果
  local raceparam     = CommonFun.CalcRaceParam(srcUser, targetUser, params, damageParam, logger)
  local bodyparam     = CommonFun.CalcBodyParam(srcUser, targetUser, params, damageParam, logger)
  local elementparam  = CommonFun.CalcElementParam(srcUser, targetUser, params, damageParam, logger)
  local bossparam     = CommonFun.CalcBossParam(srcUser, targetUser, params, damageParam, logger)

  ----------------------------------------------------------------------------------------------------------------种族，体型，属性，BOSS减伤效果
  local raceparam2    = CommonFun.CalcRaceParam2(srcUser, targetUser, params, damageParam, logger)
  local bodyparam2    = CommonFun.CalcBodyParam2(srcUser, targetUser, params, damageParam, logger)
  local elementparam2 = CommonFun.CalcElementParam2(srcUser, targetUser, params, damageParam, logger)
  local bossparam2    = CommonFun.CalcBossParam2(srcUser, targetUser, params, damageParam, logger)



  local BaseAtk  = Str1*2 + math.floor(Str1*Str1/100) + math.floor(Dex/5) + math.floor(Luk/5)
  local BaseAtk1 = Str*2 + math.floor(Str*Str/100) + math.floor(Dex/5) + math.floor(Luk/5)
  local AtkFinal = ((Atk-BaseAtk+NormalAtk)*(1+AtkPer)*CommonFun.ShapeCorrection(srcUser,targetUser)*bodyparam*elementparam*elementparam2+BaseAtk1)*raceparam*bossparam*bossparam2
  ----------------------------物理防御减免
  local DefReduc= CommonFun.CalcDef(Def,Vit,srcUser,targetUser)

  local A = (AtkFinal*DefReduc*(1-DamReduc2)+Refine)*damChangePer*(1-RefineDamReduc)*(1+DamIncrease)-Vit2*(1+VitPer2)

  -----------------------------------------------------------------------------------------------------------二刀连击
  local WeaponType =srcUser:GetEquipedWeaponType()
  local skilllv_1 = srcUser:GetLernedSkillLevel(179)

  local gemChance = 0
  local gemDamage = 1
  if srcUser:HasBuffID(810009) then  ------------------梦魇连击符文
    gemChance = 10
    gemDamage = 1.3
  end

  if WeaponType==250 and CommonFun.IsInRate(skilllv_1*5 + gemChance, srcUser:GetRandom())  then
        return A*2*gemDamage, CommonFun.DamageType.ErLianJi
  end

   if 1 >= A then
         return 1
   end

   return A
end

-----------------------------------------------------------------------------------------------------------------武僧技能伤害计算公式
function CommonFun.calcDamage_28(srcUser, targetUser, params, damageParam, logger)
  local Str = srcUser:GetProperty("Str")
  local Dex = srcUser:GetProperty("Dex")
  local Luk = srcUser:GetProperty("Luk")
  local Atk = srcUser:GetProperty("Atk")
  local AtkPer = srcUser:GetProperty("AtkPer")
  local DamIncrease = srcUser:GetProperty("DamIncrease")
  local IgnoreDef  = 0
  local IgnoreDef1 = srcUser:GetProperty("IgnoreDef")
  local IgnoreDef2 = srcUser:GetProperty("IgnoreEquipDef")
  if targetUser.boss or targetUser.mini then
     IgnoreDef=IgnoreDef1
  else
     IgnoreDef=(IgnoreDef1+IgnoreDef2)
  end

  if IgnoreDef >= 1 then
     IgnoreDef=1
  end
    ------------------------------------------------------------------------------------将原来的物伤加成改成精炼物理攻击
  local Refine = srcUser:GetProperty("Refine")

  local Def2 = targetUser:GetProperty("Def")
  local DefPer2 = targetUser:GetProperty("DefPer")
  local Vit2 = targetUser:GetProperty("Vit")
  local VitPer2 = targetUser:GetProperty("VitPer")
  local DamReduc2 = CommonFun.calcDamReDuc(srcUser, targetUser)
  local RefineDamReduc = targetUser:GetProperty("RefineDamReduc")

  local damChangePer = damageParam.damChangePer

  ----------------------------------------------------------------------------------------------------------------种族，体型，属性，BOSS加伤效果
  local raceparam     = CommonFun.CalcRaceParam(srcUser, targetUser, params, damageParam, logger)
  local bodyparam     = CommonFun.CalcBodyParam(srcUser, targetUser, params, damageParam, logger)
  local elementparam  = CommonFun.CalcElementParam(srcUser, targetUser, params, damageParam, logger)
  local bossparam     = CommonFun.CalcBossParam(srcUser, targetUser, params, damageParam, logger)

  ----------------------------------------------------------------------------------------------------------------种族，体型，属性，BOSS减伤效果
  local raceparam2    = CommonFun.CalcRaceParam2(srcUser, targetUser, params, damageParam, logger)
  local bodyparam2    = CommonFun.CalcBodyParam2(srcUser, targetUser, params, damageParam, logger)
  local elementparam2 = CommonFun.CalcElementParam2(srcUser, targetUser, params, damageParam, logger)
  local bossparam2    = CommonFun.CalcBossParam2(srcUser, targetUser, params, damageParam, logger)



  local BaseAtk  = Str*2 + math.floor(Str*Str/100) + math.floor(Dex/5) + math.floor(Luk/5)
  local AtkFinal = ((Atk-BaseAtk)*(1+AtkPer)*CommonFun.ShapeCorrection(srcUser,targetUser)*bodyparam*elementparam*elementparam2+BaseAtk)*raceparam*bossparam*bossparam2

  ----------------------------物理防御减免
  local DefReduc= CommonFun.CalcDef(Def,Vit,srcUser,targetUser)

-------------------------------------------------------------------------升龙拳套
  local Num2=1
  if srcUser:HasBuffID(90001513) then
     Num2=1.3
   end

  local A = ((AtkFinal*DefReduc*(1-DamReduc2)+Refine)*damChangePer*(1-RefineDamReduc)*(1+DamIncrease)-Vit2*(1+VitPer2))*Num2


   if 1 >= A then
         return 1
   end

   return A
end
--------------------------------------------------------------------------------------------------------------------------法师魔法伤害计算公式(已改)
function CommonFun.calcDamage_30(srcUser, targetUser, params, damageParam, logger)
  local Luk = srcUser:GetProperty("Luk")
  local Int = srcUser:GetProperty("Int")
  local Vit = srcUser:GetProperty("Vit")
  local MAtk = srcUser:GetProperty("MAtk")
  local MAtkPer = srcUser:GetProperty("MAtkPer")

  -----------------------------------------------------------------------------------分割线
  local MDamIncrease = CommonFun.calcMDamIncrease(srcUser, targetUser)
  local IgnoreMDef = srcUser:GetProperty("IgnoreMDef")
  if IgnoreMDef >= 1 then
     IgnoreMDef  = 1
  end

  ------------------------------------------------------------------------------------将原来的物伤加成改成精炼物理攻击
  local MRefine = srcUser:GetProperty("MRefine")

  local srcAtkElement    = CommonFun.GetUserAtkAttr(srcUser, params, damageParam)
  local targetDefElement = targetUser:GetProperty("DefAttr")
  ----------------------------------------------------------------------------------------------------------------种族，体型，属性，BOSS减伤效果
  local elementparam2 = CommonFun.CalcElementParam2(srcUser, targetUser, params, damageParam, logger)

  ----------------------------------------------------------------------------------------------------------------法系职业伤害会受到种族加伤减伤影响
  local raceparam     = CommonFun.CalcRaceParam(srcUser, targetUser, params, damageParam, logger)
  local raceparam2    = CommonFun.CalcRaceParam2(srcUser, targetUser, params, damageParam, logger)
  local bossparam     = CommonFun.CalcBossParam(srcUser, targetUser, params, damageParam, logger)
  local bossparam2    = CommonFun.CalcBossParam2(srcUser, targetUser, params, damageParam, logger)

  local MDef2 = targetUser:GetProperty("MDef")
  local MDefPer2 = targetUser:GetProperty("MDefPer")
  local Vit2 = targetUser:GetProperty("Vit")
  local VitPer2 = targetUser:GetProperty("VitPer")
  local Int2 = targetUser:GetProperty("Int")
  local IntPer2 = targetUser:GetProperty("IntPer")
  local MDamReduc2 = CommonFun.calcMDamReDuc(srcUser, targetUser)
  local RefineMDamReduc = targetUser:GetProperty("RefineMDamReduc")

  local damChangePer = damageParam.damChangePer

  local BaseMAtk = Int+math.floor(Int*Int/100)
  local MAtkFinal= ((MAtk-BaseMAtk)*(1+MAtkPer)+BaseMAtk)*raceparam*bossparam*bossparam2
  ----------------------------魔法防御减免
  local MDefReduc = CommonFun.CalcMDef(MDef,Int,Vit,srcUser,targetUser)

  local A = ((MAtkFinal*MDefReduc*(1-MDamReduc2)+MRefine)*damChangePer*(1-RefineMDamReduc)*(1+MDamIncrease)*GameConfig.ElementRestrain[srcAtkElement][targetDefElement]*elementparam2-Vit2/2*(1+VitPer2)-Int2*(1+IntPer2))

  if 1 >= A then
    return 1
  end

  return A

end

--------------------------------------------------------------------------------------------------------------------------法师魔法伤害计算公式((为了冰箭术火箭术，神圣之击前期技能专用)
function CommonFun.calcDamage_31(srcUser, targetUser, params, damageParam, logger)
  local Int = srcUser:GetProperty("Int")
  local Vit = srcUser:GetProperty("Vit")
  local MAtk = srcUser:GetProperty("MAtk")
  local MAtkPer = srcUser:GetProperty("MAtkPer")
  local MDamIncrease = CommonFun.calcMDamIncrease(srcUser, targetUser)
  local IgnoreMDef = srcUser:GetProperty("IgnoreMDef")
  if IgnoreMDef >= 1 then
     IgnoreMDef  = 1
  end
  ------------------------------------------------------------------------------------将原来的物伤加成改成精炼物理攻击
  local MRefine = srcUser:GetProperty("MRefine")

  local srcAtkElement    = CommonFun.GetUserAtkAttr(srcUser, params, damageParam)
  local targetDefElement = targetUser:GetProperty("DefAttr")
  ----------------------------------------------------------------------------------------------------------------种族，体型，属性，BOSS减伤效果
  local elementparam2 = CommonFun.CalcElementParam2(srcUser, targetUser, params, damageParam, logger)

  ----------------------------------------------------------------------------------------------------------------法系职业伤害会受到种族加伤减伤影响
  local raceparam     = CommonFun.CalcRaceParam(srcUser, targetUser, params, damageParam, logger)
  local raceparam2    = CommonFun.CalcRaceParam2(srcUser, targetUser, params, damageParam, logger)
  local bossparam     = CommonFun.CalcBossParam(srcUser, targetUser, params, damageParam, logger)
  local bossparam2    = CommonFun.CalcBossParam2(srcUser, targetUser, params, damageParam, logger)

  local MDef2 = targetUser:GetProperty("MDef")
  local MDefPer2 = targetUser:GetProperty("MDefPer")
  local Vit2 = targetUser:GetProperty("Vit")
  local VitPer2 = targetUser:GetProperty("VitPer")
  local Int2 = targetUser:GetProperty("Int")
  local IntPer2 = targetUser:GetProperty("IntPer")
  local MDamReduc2 = CommonFun.calcMDamReDuc(srcUser, targetUser)
  local RefineMDamReduc = targetUser:GetProperty("RefineMDamReduc")

  local damChangePer  = damageParam.damChangePer
  local damChangePer1 = damageParam.damChangePer1

  local BaseMAtk = Int+math.floor(Int*Int/100)
  local MAtkFinal= ((MAtk-BaseMAtk)*(1+MAtkPer)+BaseMAtk)*raceparam*bossparam*bossparam2

  ----------------------------魔法防御减免
  local MDefReduc = CommonFun.CalcMDef(MDef,Int,Vit,srcUser,targetUser)
  ---------------------------------------------星盘
  local Num1 = srcUser:GetRunePoint(22160)
  local Num2 = srcUser:GetRunePoint(22161)
  local RuneDamage = (Num1+Num2)*0.1+1
---------------------------------------------贤者之书＋灵犀宝珠
  local taozhuang1 = 1
  if srcUser:HasBuffID(91000470) then
    taozhuang1 = 1.15
  end

  local A = (((MAtkFinal*MDefReduc*(1-MDamReduc2)+MRefine)*damChangePer*(1-RefineMDamReduc)*(1+MDamIncrease)*GameConfig.ElementRestrain[srcAtkElement][targetDefElement]*elementparam2-Vit2/2*(1+VitPer2)-Int2*(1+IntPer2))+damChangePer1)*RuneDamage * taozhuang1

  if 1 >= A then
    return 1
  end

  return A

end

--------------------------------------------------------------------------------------------------------------------------法师范围技能魔法伤害计算公式(已改)
function CommonFun.calcDamage_32(srcUser, targetUser, params, damageParam, logger)
  local Int = srcUser:GetProperty("Int")
  local Vit = srcUser:GetProperty("Vit")
  local MAtk = srcUser:GetProperty("MAtk")
  local MAtkPer = srcUser:GetProperty("MAtkPer")
  local MDamIncrease = CommonFun.calcMDamIncrease(srcUser, targetUser)
  local IgnoreMDef = srcUser:GetProperty("IgnoreMDef")
  if IgnoreMDef >= 1 then
     IgnoreMDef  = 1
  end
  ------------------------------------------------------------------------------------将原来的物伤加成改成精炼物理攻击
  local MRefine  = srcUser:GetProperty("MRefine")
  local RangeDam = srcUser:GetProperty("RangeDam")

  local srcAtkElement    = CommonFun.GetUserAtkAttr(srcUser, params, damageParam)
  local targetDefElement = targetUser:GetProperty("DefAttr")
  ----------------------------------------------------------------------------------------------------------------种族，体型，属性，BOSS减伤效果
  local elementparam2 = CommonFun.CalcElementParam2(srcUser, targetUser, params, damageParam, logger)

  ----------------------------------------------------------------------------------------------------------------法系职业伤害会受到种族加伤减伤影响
  local raceparam     = CommonFun.CalcRaceParam(srcUser, targetUser, params, damageParam, logger)
  local raceparam2    = CommonFun.CalcRaceParam2(srcUser, targetUser, params, damageParam, logger)
  local bossparam     = CommonFun.CalcBossParam(srcUser, targetUser, params, damageParam, logger)
  local bossparam2    = CommonFun.CalcBossParam2(srcUser, targetUser, params, damageParam, logger)

  local MDef2 = targetUser:GetProperty("MDef")
  local MDefPer2 = targetUser:GetProperty("MDefPer")
  local Vit2 = targetUser:GetProperty("Vit")
  local VitPer2 = targetUser:GetProperty("VitPer")
  local Int2 = targetUser:GetProperty("Int")
  local IntPer2 = targetUser:GetProperty("IntPer")
  local MDamReduc2 = CommonFun.calcMDamReDuc(srcUser, targetUser)
  local RefineMDamReduc = targetUser:GetProperty("RefineMDamReduc")

  local damChangePer = damageParam.damChangePer

  local BaseMAtk = Int+math.floor(Int*Int/100)
  local MAtkFinal= ((MAtk-BaseMAtk)*(1+MAtkPer)+BaseMAtk)*raceparam*bossparam*bossparam2

  ----------------------------魔法防御减免
  local MDefReduc = CommonFun.CalcMDef(MDef,Int,Vit,srcUser,targetUser)

  local A = ((MAtkFinal*MDefReduc*(1-MDamReduc2)+MRefine)*(1-RefineMDamReduc)*damChangePer*(1+MDamIncrease)*GameConfig.ElementRestrain[srcAtkElement][targetDefElement]*elementparam2-Vit2/2*(1+VitPer2)-Int2*(1+IntPer2))*(1 + RangeDam)

  local skillID, skillLevel = CommonFun.UnmergeSkillID(params.skillIDAndLevel)
  ----------------------------------------------------------暴风雪
  if skillID==81 then
        if srcUser:HasBuffID(52170) and srcUser:HasBuffID(81000040) then --------------冰暴骑士卡片增加暴风雪伤害
          A =A *1.2
        end
  end

  if 1 >= A then
    return 1
  end

     return A

end

--------------------------------------------------------------------------------------------------------------------------神圣之击技能专用((为了冰箭术火箭术，神圣之击前期技能专用)
function CommonFun.calcDamage_33(srcUser, targetUser, params, damageParam, logger)
  local Int = srcUser:GetProperty("Int")
  local Vit = srcUser:GetProperty("Vit")
  local Luk = srcUser:GetProperty("Luk")
  local MAtk = srcUser:GetProperty("MAtk")
  local MAtkPer = srcUser:GetProperty("MAtkPer")
  local MDamIncrease = CommonFun.calcMDamIncrease(srcUser, targetUser)
  local IgnoreMDef = srcUser:GetProperty("IgnoreMDef")
  if IgnoreMDef >= 1 then
     IgnoreMDef  = 1
  end
  ------------------------------------------------------------------------------------将原来的物伤加成改成精炼物理攻击
  local MRefine = srcUser:GetProperty("MRefine")
  local skilllv_1 = srcUser:GetLernedSkillLevel(235)

  local srcAtkElement    = CommonFun.GetUserAtkAttr(srcUser, params, damageParam)
  local targetDefElement = targetUser:GetProperty("DefAttr")
  ----------------------------------------------------------------------------------------------------------------种族，体型，属性，BOSS减伤效果
  local elementparam2 = CommonFun.CalcElementParam2(srcUser, targetUser, params, damageParam, logger)

  ----------------------------------------------------------------------------------------------------------------法系职业伤害会受到种族加伤减伤影响
  local raceparam     = CommonFun.CalcRaceParam(srcUser, targetUser, params, damageParam, logger)
  local raceparam2    = CommonFun.CalcRaceParam2(srcUser, targetUser, params, damageParam, logger)
  local bossparam     = CommonFun.CalcBossParam(srcUser, targetUser, params, damageParam, logger)
  local bossparam2    = CommonFun.CalcBossParam2(srcUser, targetUser, params, damageParam, logger)


  local MDef2 = targetUser:GetProperty("MDef")
  local MDefPer2 = targetUser:GetProperty("MDefPer")
  local Vit2 = targetUser:GetProperty("Vit")
  local VitPer2 = targetUser:GetProperty("VitPer")
  local Int2 = targetUser:GetProperty("Int")
  local IntPer2 = targetUser:GetProperty("IntPer")
  local MDamReduc2 = CommonFun.calcMDamReDuc(srcUser, targetUser)
  local RefineMDamReduc = targetUser:GetProperty("RefineMDamReduc")

  local damChangePer  = damageParam.damChangePer
  local damChangePer1 = damageParam.damChangePer1

  local BaseMAtk = Int+math.floor(Int*Int/100)
  local MAtkFinal= ((MAtk-BaseMAtk)*(1+MAtkPer)+BaseMAtk)*raceparam*bossparam*bossparam2

  ----------------------------魔法防御减免
  local MDefReduc = CommonFun.CalcMDef(MDef,Int,Vit,srcUser,targetUser)
  -------------------------------------------------------------------------------------------------------------复仇女神效果
  local Weapon=srcUser:GetEquipedID(7)
  local B = 0
 ------------------------------------------------------------------------厄利尼厄斯之杖
  if (Weapon==41521 or Weapon==141521 or Weapon==41568 or Weapon==141568) then
     B = Luk*50
  end

  local WeaponRefineLv=srcUser:GetEquipedRefineLv(7)
  if srcUser:HasBuffID(90001413) or  srcUser:HasBuffID(41980) then
    if WeaponRefineLv >=10 then
      B = B*2
    end
  end

  local A = ((((MAtkFinal*MDefReduc*(1-MDamReduc2)+MRefine)*(1-RefineMDamReduc)*damChangePer+ B*MDefReduc*(1-MDamReduc2)*(1-RefineMDamReduc))*(1+MDamIncrease)*GameConfig.ElementRestrain[srcAtkElement][targetDefElement]*elementparam2-Vit2/2*(1+VitPer2)-Int2*(1+IntPer2))+damChangePer1)*(1+skilllv_1*0.1)

  if 1 >= A then
    return 1
  end

  return A

end

--------------------------------------------------------------------------------------------------------------------------火球术技能伤害计算公式单独修改
function CommonFun.calcDamage_34(srcUser, targetUser, params, damageParam, logger)
  local Int = srcUser:GetProperty("Int")
  local Vit = srcUser:GetProperty("Vit")
  local MAtk = srcUser:GetProperty("MAtk")
  local MAtkPer1 = srcUser:GetProperty("MAtkPer")
  ------------------------------------------------------------------------------------------星盘额外加成
  local Num1 = srcUser:GetRunePoint(21007)
  local Num2 = srcUser:GetRunePoint(22001)
  local Num3 = srcUser:GetRunePoint(22002)
  local Num4 = srcUser:GetRunePoint(22005)
  local RuneDamage = (Num1 + Num2 + Num3 + Num4)*0.05
  local MAtkPer  =  MAtkPer1 + RuneDamage
  -------------------------------------------------------------------------------------------分割线
  local MDamIncrease = CommonFun.calcMDamIncrease(srcUser, targetUser)
  local IgnoreMDef = srcUser:GetProperty("IgnoreMDef")
  if IgnoreMDef >= 1 then
     IgnoreMDef  = 1
  end
  ------------------------------------------------------------------------------------将原来的物伤加成改成精炼物理攻击
  local MRefine  = srcUser:GetProperty("MRefine")
  local RangeDam = srcUser:GetProperty("RangeDam")

  local srcAtkElement    = CommonFun.GetUserAtkAttr(srcUser, params, damageParam)
  local targetDefElement = targetUser:GetProperty("DefAttr")
  ----------------------------------------------------------------------------------------------------------------种族，体型，属性，BOSS减伤效果
  local elementparam2 = CommonFun.CalcElementParam2(srcUser, targetUser, params, damageParam, logger)

  ----------------------------------------------------------------------------------------------------------------法系职业伤害会受到种族加伤减伤影响
  local raceparam     = CommonFun.CalcRaceParam(srcUser, targetUser, params, damageParam, logger)
  local raceparam2    = CommonFun.CalcRaceParam2(srcUser, targetUser, params, damageParam, logger)
  local bossparam     = CommonFun.CalcBossParam(srcUser, targetUser, params, damageParam, logger)
  local bossparam2    = CommonFun.CalcBossParam2(srcUser, targetUser, params, damageParam, logger)

  local MDef2 = targetUser:GetProperty("MDef")
  local MDefPer2 = targetUser:GetProperty("MDefPer")
  local Vit2 = targetUser:GetProperty("Vit")
  local VitPer2 = targetUser:GetProperty("VitPer")
  local Int2 = targetUser:GetProperty("Int")
  local IntPer2 = targetUser:GetProperty("IntPer")
  local MDamReduc2 = CommonFun.calcMDamReDuc(srcUser, targetUser)
  local RefineMDamReduc = targetUser:GetProperty("RefineMDamReduc")

  local damChangePer = damageParam.damChangePer

  local BaseMAtk = Int+math.floor(Int*Int/100)
  local MAtkFinal= ((MAtk-BaseMAtk)*(1+MAtkPer)+BaseMAtk)*raceparam*bossparam*bossparam2


  --迪塔勒泰晤勒斯卡片[存储]
  local DamageRatio = 1
  if srcUser:HasBuffID(80001450) then
    DamageRatio = 1.15
  end

  ----------------------------魔法防御减免
  local MDefReduc = CommonFun.CalcMDef(MDef,Int,Vit,srcUser,targetUser)

  local A = ((MAtkFinal*MDefReduc*(1-MDamReduc2)+MRefine)*(1-RefineMDamReduc)*damChangePer*(1+MDamIncrease)*GameConfig.ElementRestrain[srcAtkElement][targetDefElement]*elementparam2-Vit2/2*(1+VitPer2)-Int2*(1+IntPer2))*(1 + RangeDam)*DamageRatio

  if 1 >= A then
    return 1
  end

     return A

end
--------------------------------------------------------------------------------------------------------------------------火箭术单独计算公式
function CommonFun.calcDamage_35(srcUser, targetUser, params, damageParam, logger)
  local Int = srcUser:GetProperty("Int")
  local Vit = srcUser:GetProperty("Vit")
  local MAtk = srcUser:GetProperty("MAtk")
  local MAtkPer = srcUser:GetProperty("MAtkPer")
  local MDamIncrease = CommonFun.calcMDamIncrease(srcUser, targetUser)
  local IgnoreMDef = srcUser:GetProperty("IgnoreMDef")
  if IgnoreMDef >= 1 then
     IgnoreMDef  = 1
  end

  local Num1 = srcUser:GetRunePoint(22006)
  local RuneRate = 0

  if Num1 > 0 then
    RuneRate = 8
  end

  local RuneDamage = Num1*0.1 +1

  local Num2 = srcUser:GetRunePoint(22160)
  local Num3 = srcUser:GetRunePoint(22161)
  local RuneDamage1 = (Num2+Num3)*0.1+1
  ------------------------------------------------------------------------------------将原来的物伤加成改成精炼物理攻击
  local MRefine = srcUser:GetProperty("MRefine")

  local srcAtkElement    = CommonFun.GetUserAtkAttr(srcUser, params, damageParam)
  local targetDefElement = targetUser:GetProperty("DefAttr")
  ----------------------------------------------------------------------------------------------------------------种族，体型，属性，BOSS减伤效果
  local elementparam2 = CommonFun.CalcElementParam2(srcUser, targetUser, params, damageParam, logger)

  ----------------------------------------------------------------------------------------------------------------法系职业伤害会受到种族加伤减伤影响
  local raceparam     = CommonFun.CalcRaceParam(srcUser, targetUser, params, damageParam, logger)
  local raceparam2    = CommonFun.CalcRaceParam2(srcUser, targetUser, params, damageParam, logger)
  local bossparam     = CommonFun.CalcBossParam(srcUser, targetUser, params, damageParam, logger)
  local bossparam2    = CommonFun.CalcBossParam2(srcUser, targetUser, params, damageParam, logger)

  local MDef2 = targetUser:GetProperty("MDef")
  local MDefPer2 = targetUser:GetProperty("MDefPer")
  local Vit2 = targetUser:GetProperty("Vit")
  local VitPer2 = targetUser:GetProperty("VitPer")
  local Int2 = targetUser:GetProperty("Int")
  local IntPer2 = targetUser:GetProperty("IntPer")
  local MDamReduc2 = CommonFun.calcMDamReDuc(srcUser, targetUser)
  local RefineMDamReduc = targetUser:GetProperty("RefineMDamReduc")

  local damChangePer  = damageParam.damChangePer
  local damChangePer1 = damageParam.damChangePer1

  local BaseMAtk = Int+math.floor(Int*Int/100)
  local MAtkFinal= ((MAtk-BaseMAtk)*(1+MAtkPer)+BaseMAtk)*raceparam*bossparam*bossparam2

  ----------------------------魔法防御减免
  local MDefReduc = CommonFun.CalcMDef(MDef,Int,Vit,srcUser,targetUser)
 ---------------------------------------------贤者之书＋灵犀宝珠
  local taozhuang1 = 1
  if srcUser:HasBuffID(91000470) then
    taozhuang1 = 1.15
  end

  local A = (((MAtkFinal*MDefReduc*(1-MDamReduc2)+MRefine)*(1-RefineMDamReduc)*damChangePer*(1+MDamIncrease)*GameConfig.ElementRestrain[srcAtkElement][targetDefElement]*elementparam2-Vit2/2*(1+VitPer2)-Int2*(1+IntPer2))+damChangePer1)*RuneDamage1*taozhuang1

  if CommonFun.IsInRate(RuneRate, srcUser:GetRandom()) then
     return A*RuneDamage
  end

  if 1 >= A then
    return 1
  end

  return A

end


--------------------------------------------------------------------------------------------------------------------------只有法师普攻才会使用的伤害公式
function CommonFun.calcDamage_36(srcUser, targetUser, params, damageParam, logger)
  local Luk = srcUser:GetProperty("Luk")
  local Int = srcUser:GetProperty("Int")
  local Vit = srcUser:GetProperty("Vit")
  local MAtk = srcUser:GetProperty("MAtk")
  ------------------------------------------------------普通攻击力
  local NormalAtk = srcUser:GetProperty("NormalAtk")
        NormalAtk = NormalAtk + 3*Int
  ------------------------------------
  local MAtkPer1 = srcUser:GetProperty("MAtkPer")
  ---------------------------------------------------------------------------------星盘额外增加的法师普攻享受额外攻击加成
  local Num1 = srcUser:GetRunePoint(22017)
  local Num2 = srcUser:GetRunePoint(22022)
  local Num3 = srcUser:GetRunePoint(22023)
  local RuneDamage3 = (Num1 + Num2 + Num3)*0.05
  local MAtkPer = MAtkPer1 + RuneDamage3
  -----------------------------------------------------------------------------------分割线
  local MDamIncrease = CommonFun.calcMDamIncrease(srcUser, targetUser)
  local IgnoreMDef = srcUser:GetProperty("IgnoreMDef")
  if IgnoreMDef >= 1 then
     IgnoreMDef  = 1
  end

 ------------------------------------------------------------------------------------星盘额外增加法师普攻暴击效果
  local Num11 = srcUser:GetRunePoint(21005)
  local Num12 = srcUser:GetRunePoint(21008)
  local Num13 = srcUser:GetRunePoint(21009)
  local Num14 = srcUser:GetRunePoint(21011)
  local Num15 = srcUser:GetRunePoint(21017)
  local Num16 = srcUser:GetRunePoint(22011)
  local Num17 = srcUser:GetRunePoint(22026)
  local Num18 = srcUser:GetRunePoint(22029)
  ----------------------------------------------------------------升级装备 丝质外袍 暴击伤害
  local Num19 = srcUser:GetBuffLayer(90000952)
  local Num20 = srcUser:GetBuffLayer(90000953)
  local Num21 = srcUser:GetBuffLayer(90000954)
  ----------------------------------------------------------------升级装备 防水靴 暴击概率
  local Num22 = srcUser:GetBuffLayer(90000942)
  local Num23 = srcUser:GetBuffLayer(90000944)

  local RuneDamage  = (Num11 + Num12 + Num13 + Num14 + Num15 + Num16 + Num17 + Num18)*0.1 + 1 + 0.03*Num19 + 0.03*Num20 + 0.04*Num21
  local RuneDamage1 =  0
  if (Num11 + Num12 + Num13 + Num14 + Num15 + Num16 + Num17 + Num18 + Num22 + Num23)>0 then
     RuneDamage1 = 5 + Luk/3 + Num22*5 + Num23*5
  end

  ------------------------------------------------------------------------------------将原来的物伤加成改成精炼物理攻击
  local MRefine = srcUser:GetProperty("MRefine")

  local srcAtkElement    = CommonFun.GetUserAtkAttr(srcUser, params, damageParam)
  local targetDefElement = targetUser:GetProperty("DefAttr")
  ----------------------------------------------------------------------------------------------------------------种族，体型，属性，BOSS减伤效果
  local elementparam2 = CommonFun.CalcElementParam2(srcUser, targetUser, params, damageParam, logger)

  ----------------------------------------------------------------------------------------------------------------法系职业伤害会受到种族加伤减伤影响
  local raceparam     = CommonFun.CalcRaceParam(srcUser, targetUser, params, damageParam, logger)
  local raceparam2    = CommonFun.CalcRaceParam2(srcUser, targetUser, params, damageParam, logger)
  local bossparam     = CommonFun.CalcBossParam(srcUser, targetUser, params, damageParam, logger)
  local bossparam2    = CommonFun.CalcBossParam2(srcUser, targetUser, params, damageParam, logger)

  local MDef2 = targetUser:GetProperty("MDef")
  local MDefPer2 = targetUser:GetProperty("MDefPer")
  local Vit2 = targetUser:GetProperty("Vit")
  local VitPer2 = targetUser:GetProperty("VitPer")
  local Int2 = targetUser:GetProperty("Int")
  local IntPer2 = targetUser:GetProperty("IntPer")
  local MDamReduc2 = CommonFun.calcMDamReDuc(srcUser, targetUser)
  local RefineMDamReduc = targetUser:GetProperty("RefineMDamReduc")

  local damChangePer = damageParam.damChangePer

  local BaseMAtk = Int+math.floor(Int*Int/100)
  local MAtkFinal= ((MAtk-BaseMAtk+NormalAtk)*(1+MAtkPer)+BaseMAtk)*raceparam*bossparam*bossparam2

  ----------------------------魔法防御减免
  local MDefReduc = CommonFun.CalcMDef(MDef,Int,Vit,srcUser,targetUser)
    -------------------------------------------------四种元素伤害分别判断
  local srcAtkElement1  = 1
    local elementInc1 = 0
    local elementRed1 = 0

    local targetDefElement = targetUser:GetProperty("DefAttr")


    if nil == targetDefElement then
        logger.error(string.format("%s targetDefElement is nil", targetUser.name))
        return 0
    end
    if nil == CommonFun.NatureProps[targetDefElement] then
        logger.error(string.format("%s CommonFun.NatureProps[%s] is nil", srcUser.name, tostring(targetDefElement)))
        return 0
    end

    if nil == CommonFun.NatureProps[srcAtkElement1] then
        logger.error(string.format("CommonFun.NatureProps[%s] is nil", tostring(srcAtkElement1)))
        return 0
    end

    elementInc1 = srcUser:GetProperty(CommonFun.NatureProps[targetDefElement][1])
    elementRed1 = targetUser:GetProperty(CommonFun.NatureProps[srcAtkElement1][2])
    elementAtk1 = srcUser:GetProperty(CommonFun.NatureProps[srcAtkElement1][3])

    if nil==elementAtk1 then
        elementAtk1 = 0
    end
    local result1 = 1+elementAtk1-elementRed1

    if result1 <= 0.1 then
        result1 = 0.1
    end

    local srcAtkElement2   = 2
    local elementInc2 = 0
    local elementRed2 = 0

    local targetDefElement = targetUser:GetProperty("DefAttr")


    if nil == targetDefElement then
        logger.error(string.format("%s targetDefElement is nil", targetUser.name))
        return 0
    end
    if nil == CommonFun.NatureProps[targetDefElement] then
        logger.error(string.format("%s CommonFun.NatureProps[%s] is nil", srcUser.name, tostring(targetDefElement)))
        return 0
    end

    if nil == CommonFun.NatureProps[srcAtkElement2] then
        logger.error(string.format("CommonFun.NatureProps[%s] is nil", tostring(srcAtkElement2)))
        return 0
    end

    elementInc2 = srcUser:GetProperty(CommonFun.NatureProps[targetDefElement][1])
    elementRed2 = targetUser:GetProperty(CommonFun.NatureProps[srcAtkElement2][2])
    elementAtk2 = srcUser:GetProperty(CommonFun.NatureProps[srcAtkElement2][3])

    if nil==elementAtk2 then
        elementAtk2 = 0
    end
    local result2 = 1+elementAtk2-elementRed2

    if result2 <= 0.1 then
        result2 = 0.1
    end

  local srcAtkElement3   = 3
    local elementInc3 = 0
    local elementRed3 = 0

    local targetDefElement = targetUser:GetProperty("DefAttr")


    if nil == targetDefElement then
        logger.error(string.format("%s targetDefElement is nil", targetUser.name))
        return 0
    end
    if nil == CommonFun.NatureProps[targetDefElement] then
        logger.error(string.format("%s CommonFun.NatureProps[%s] is nil", srcUser.name, tostring(targetDefElement)))
        return 0
    end

    if nil == CommonFun.NatureProps[srcAtkElement3] then
        logger.error(string.format("CommonFun.NatureProps[%s] is nil", tostring(srcAtkElement3)))
        return 0
    end

    elementInc3 = srcUser:GetProperty(CommonFun.NatureProps[targetDefElement][1])
    elementRed3 = targetUser:GetProperty(CommonFun.NatureProps[srcAtkElement3][2])
    elementAtk3 = srcUser:GetProperty(CommonFun.NatureProps[srcAtkElement3][3])

    if nil==elementAtk3 then
        elementAtk3 = 0
    end
    local result3 = 1+elementAtk3-elementRed3

    if result3 <= 0.1 then
        result3 = 0.1
    end

  local srcAtkElement4   = 4
    local elementInc4 = 0
    local elementRed4 = 0

    local targetDefElement = targetUser:GetProperty("DefAttr")


    if nil == targetDefElement then
        logger.error(string.format("%s targetDefElement is nil", targetUser.name))
        return 0
    end
    if nil == CommonFun.NatureProps[targetDefElement] then
        logger.error(string.format("%s CommonFun.NatureProps[%s] is nil", srcUser.name, tostring(targetDefElement)))
        return 0
    end

    if nil == CommonFun.NatureProps[srcAtkElement4] then
        logger.error(string.format("CommonFun.NatureProps[%s] is nil", tostring(srcAtkElement4)))
        return 0
    end

    elementInc4 = srcUser:GetProperty(CommonFun.NatureProps[targetDefElement][1])
    elementRed4 = targetUser:GetProperty(CommonFun.NatureProps[srcAtkElement4][2])
    elementAtk4 = srcUser:GetProperty(CommonFun.NatureProps[srcAtkElement4][3])

    if nil==elementAtk4 then
        elementAtk4 = 0
    end
    local result4 = 1+elementAtk4-elementRed4

    if result4 <= 0.1 then
        result4 = 0.1
    end
  ----------------------------------------------------------------------------------------------------------------种族，体型，属性，BOSS减伤效果

  local elementparam21 = result1
  local elementparam22 = result2
  local elementparam23 = result3
  local elementparam24 = result4


  local A1 = ((MAtkFinal*MDefReduc*(1-MDamReduc2)+MRefine)*damChangePer*(1-RefineMDamReduc)*(1+MDamIncrease)*GameConfig.ElementRestrain[srcAtkElement1][targetDefElement]*elementparam21-Vit2/2*(1+VitPer2)-Int2*(1+IntPer2))
  local A2 = ((MAtkFinal*MDefReduc*(1-MDamReduc2)+MRefine)*damChangePer*(1-RefineMDamReduc)*(1+MDamIncrease)*GameConfig.ElementRestrain[srcAtkElement2][targetDefElement]*elementparam22-Vit2/2*(1+VitPer2)-Int2*(1+IntPer2))
  local A3 = ((MAtkFinal*MDefReduc*(1-MDamReduc2)+MRefine)*damChangePer*(1-RefineMDamReduc)*(1+MDamIncrease)*GameConfig.ElementRestrain[srcAtkElement3][targetDefElement]*elementparam23-Vit2/2*(1+VitPer2)-Int2*(1+IntPer2))
  local A4 = ((MAtkFinal*MDefReduc*(1-MDamReduc2)+MRefine)*damChangePer*(1-RefineMDamReduc)*(1+MDamIncrease)*GameConfig.ElementRestrain[srcAtkElement4][targetDefElement]*elementparam24-Vit2/2*(1+VitPer2)-Int2*(1+IntPer2))

    ----------------------------------------------------------------------------元素强化
  local skilllv_1 = srcUser:GetLernedSkillLevel(1163)
  local A5=0
  if skilllv_1 >=6 then
    local fireball=0
    local waterball=0
    local windball=0
    local earthball=0
    if srcUser:HasBuffID(116830) then
      fireball=1
    end
     if srcUser:HasBuffID(116831) then
      waterball=1
    end
     if srcUser:HasBuffID(116832) then
      windball=1
    end
     if srcUser:HasBuffID(116833) then
      earthball=1
    end
   A5=(A1*windball+A2*earthball+A3*waterball+A4*fireball)*(skilllv_1-5)*0.02
  end

  local A = ((MAtkFinal*MDefReduc*(1-MDamReduc2)+MRefine)*(1-RefineMDamReduc)*damChangePer*(1+MDamIncrease)*GameConfig.ElementRestrain[srcAtkElement][targetDefElement]*elementparam2-Vit2/2*(1+VitPer2)-Int2*(1+IntPer2))+A5

  if 1 >= A then
    return 1
  end

  if CommonFun.IsInRate(RuneDamage1, srcUser:GetRandom()) then
     return (A-A5)*RuneDamage+A5,CommonFun.DamageType.Crit
  end

  return A

end


--------------------------------------------------------------------------------------------------------------------------念力连击暴击伤害计算公式
function CommonFun.calcDamage_37(srcUser, targetUser, params, damageParam, logger)
  local Luk = srcUser:GetProperty("Luk")
  local Int = srcUser:GetProperty("Int")
  local Vit = srcUser:GetProperty("Vit")
  local MAtk = srcUser:GetProperty("MAtk")
  local MAtkPer = srcUser:GetProperty("MAtkPer")
  -----------------------------------------------------------------------------------分割线
  local MDamIncrease = CommonFun.calcMDamIncrease(srcUser, targetUser)
  local IgnoreMDef = srcUser:GetProperty("IgnoreMDef")
  if IgnoreMDef >= 1 then
     IgnoreMDef  = 1
  end

 ------------------------------------------------------------------------------------星盘额外增加法师普攻暴击效果
  local Num1 = srcUser:GetRunePoint(22050)

  local RuneDamage  = Num1*0.1 + 1
  local RuneRate =  0
  if Num1>0 then
     RuneRate = Luk/3
  end

  ------------------------------------------------------------------------------------将原来的物伤加成改成精炼物理攻击
  local MRefine = srcUser:GetProperty("MRefine")

  local srcAtkElement    = CommonFun.GetUserAtkAttr(srcUser, params, damageParam)
  local targetDefElement = targetUser:GetProperty("DefAttr")
  ----------------------------------------------------------------------------------------------------------------种族，体型，属性，BOSS减伤效果
  local elementparam2 = CommonFun.CalcElementParam2(srcUser, targetUser, params, damageParam, logger)

  ----------------------------------------------------------------------------------------------------------------法系职业伤害会受到种族加伤减伤影响
  local raceparam     = CommonFun.CalcRaceParam(srcUser, targetUser, params, damageParam, logger)
  local raceparam2    = CommonFun.CalcRaceParam2(srcUser, targetUser, params, damageParam, logger)
  local bossparam     = CommonFun.CalcBossParam(srcUser, targetUser, params, damageParam, logger)
  local bossparam2    = CommonFun.CalcBossParam2(srcUser, targetUser, params, damageParam, logger)

  local MDef2 = targetUser:GetProperty("MDef")
  local MDefPer2 = targetUser:GetProperty("MDefPer")
  local Vit2 = targetUser:GetProperty("Vit")
  local VitPer2 = targetUser:GetProperty("VitPer")
  local Int2 = targetUser:GetProperty("Int")
  local IntPer2 = targetUser:GetProperty("IntPer")
  local MDamReduc2 = CommonFun.calcMDamReDuc(srcUser, targetUser)
  local RefineMDamReduc = targetUser:GetProperty("RefineMDamReduc")

  local damChangePer = damageParam.damChangePer

  local BaseMAtk = Int+math.floor(Int*Int/100)
  local MAtkFinal= ((MAtk-BaseMAtk)*(1+MAtkPer)+BaseMAtk)*raceparam*bossparam*bossparam2

  ----------------------------魔法防御减免
  local MDefReduc = CommonFun.CalcMDef(MDef,Int,Vit,srcUser,targetUser)

  --傀儡娃娃卡片[存储]
  local DamageRatio = 1
  if srcUser:HasBuffID(80001090) then
    DamageRatio = 1.1
  end
  local Num1= srcUser:GetRunePoint(23030)------------星盘点
  local RuneDamage2= Num1*0.05+1
  local A = ((MAtkFinal*MDefReduc*(1-MDamReduc2)+MRefine)*(1-RefineMDamReduc)*damChangePer*(1+MDamIncrease)*GameConfig.ElementRestrain[srcAtkElement][targetDefElement]*elementparam2-Vit2/2*(1+VitPer2)-Int2*(1+IntPer2))*DamageRatio*RuneDamage2

  if 1 >= A then
    return 1
  end

  if CommonFun.IsInRate(RuneRate, srcUser:GetRandom()) then
     return A*RuneDamage,CommonFun.DamageType.Crit
  end

  return A

end


--------------------------------------------------------------------------------------------------------------------------冰箭术专用伤害技能
function CommonFun.calcDamage_38(srcUser, targetUser, params, damageParam, logger)
  local Int = srcUser:GetProperty("Int")
  local Vit = srcUser:GetProperty("Vit")
  local MAtk = srcUser:GetProperty("MAtk")
  local MAtkPer = srcUser:GetProperty("MAtkPer")
  local MDamIncrease = CommonFun.calcMDamIncrease(srcUser, targetUser)
  local IgnoreMDef = srcUser:GetProperty("IgnoreMDef")
  if IgnoreMDef >= 1 then
     IgnoreMDef  = 1
  end

  ------------------------------------------------------------------------------------冰箭术星盘增加效果
  local Num1 = srcUser:GetRunePoint(22120)
  local RuneRate = 0

  if Num1 > 0 then
    RuneRate = 8
  end

  local RuneDamage = Num1*0.1 + 1

  local Num2 = srcUser:GetRunePoint(22160)
  local Num3 = srcUser:GetRunePoint(22161)
  local RuneDamage1 = (Num2+Num3)*0.1+1
  ------------------------------------------------------------------------------------将原来的物伤加成改成精炼物理攻击
  local MRefine = srcUser:GetProperty("MRefine")

  local srcAtkElement    = CommonFun.GetUserAtkAttr(srcUser, params, damageParam)
  local targetDefElement = targetUser:GetProperty("DefAttr")
  ----------------------------------------------------------------------------------------------------------------种族，体型，属性，BOSS减伤效果
  local elementparam2 = CommonFun.CalcElementParam2(srcUser, targetUser, params, damageParam, logger)

  ----------------------------------------------------------------------------------------------------------------法系职业伤害会受到种族加伤减伤影响
  local raceparam     = CommonFun.CalcRaceParam(srcUser, targetUser, params, damageParam, logger)
  local raceparam2    = CommonFun.CalcRaceParam2(srcUser, targetUser, params, damageParam, logger)
  local bossparam     = CommonFun.CalcBossParam(srcUser, targetUser, params, damageParam, logger)
  local bossparam2    = CommonFun.CalcBossParam2(srcUser, targetUser, params, damageParam, logger)

  local MDef2 = targetUser:GetProperty("MDef")
  local MDefPer2 = targetUser:GetProperty("MDefPer")
  local Vit2 = targetUser:GetProperty("Vit")
  local VitPer2 = targetUser:GetProperty("VitPer")
  local Int2 = targetUser:GetProperty("Int")
  local IntPer2 = targetUser:GetProperty("IntPer")
  local MDamReduc2 = CommonFun.calcMDamReDuc(srcUser, targetUser)
  local RefineMDamReduc = targetUser:GetProperty("RefineMDamReduc")

  local damChangePer  = damageParam.damChangePer
  local damChangePer1 = damageParam.damChangePer1

  local BaseMAtk = Int+math.floor(Int*Int/100)
  local MAtkFinal= ((MAtk-BaseMAtk)*(1+MAtkPer)+BaseMAtk)*raceparam*bossparam*bossparam2

  ----------------------------魔法防御减免
  local MDefReduc = CommonFun.CalcMDef(MDef,Int,Vit,srcUser,targetUser)

  ---------------------------------------------贤者之书＋灵犀宝珠
  local taozhuang1 = 1
  if srcUser:HasBuffID(91000470) then
    taozhuang1 = 1.15
  end

  local A = (((MAtkFinal*MDefReduc*(1-MDamReduc2)+MRefine)*(1-RefineMDamReduc)*damChangePer*(1+MDamIncrease)*GameConfig.ElementRestrain[srcAtkElement][targetDefElement]*elementparam2-Vit2/2*(1+VitPer2)-Int2*(1+IntPer2))+damChangePer1)*RuneDamage1*taozhuang1

  if 1 >= A then
    return 1
  end

  if CommonFun.IsInRate(RuneRate, srcUser:GetRandom()) then
     return A*RuneDamage,CommonFun.DamageType.Crit
  end

  return A

end

--------------------------------------------------------------------------------------------------------------------------火柱伤害计算
function CommonFun.calcDamage_39(srcUser, targetUser, params, damageParam, logger)
  local Luk = srcUser:GetProperty("Luk")
  local Int = srcUser:GetProperty("Int")
  local Vit = srcUser:GetProperty("Vit")
  local MAtk = srcUser:GetProperty("MAtk")
  local MAtkPer = srcUser:GetProperty("MAtkPer")
  ---------------------------------------------------------------------------------星盘额外增加的法师普攻享受额外攻击加成
  local Num1 = srcUser:GetRunePoint(22041)
  local Num2 = srcUser:GetRunePoint(22042)
  local Num3 = srcUser:GetRunePoint(22043)


  local RuneDamage = (Num1 + Num2 + Num3)*0.5
  -----------------------------------------------------------------------------------分割线
  local MDamIncrease = CommonFun.calcMDamIncrease(srcUser, targetUser)
  local IgnoreMDef = srcUser:GetProperty("IgnoreMDef")
  if IgnoreMDef >= 1 then
     IgnoreMDef  = 1
  end

  ------------------------------------------------------------------------------------将原来的物伤加成改成精炼物理攻击
  local MRefine = srcUser:GetProperty("MRefine")

  local srcAtkElement    = CommonFun.GetUserAtkAttr(srcUser, params, damageParam)
  local targetDefElement = targetUser:GetProperty("DefAttr")
  ----------------------------------------------------------------------------------------------------------------种族，体型，属性，BOSS减伤效果
  local elementparam2 = CommonFun.CalcElementParam2(srcUser, targetUser, params, damageParam, logger)

  ----------------------------------------------------------------------------------------------------------------法系职业伤害会受到种族加伤减伤影响
  local raceparam     = CommonFun.CalcRaceParam(srcUser, targetUser, params, damageParam, logger)
  local raceparam2    = CommonFun.CalcRaceParam2(srcUser, targetUser, params, damageParam, logger)
  local bossparam     = CommonFun.CalcBossParam(srcUser, targetUser, params, damageParam, logger)
  local bossparam2    = CommonFun.CalcBossParam2(srcUser, targetUser, params, damageParam, logger)

  local MDef2 = targetUser:GetProperty("MDef")
  local MDefPer2 = targetUser:GetProperty("MDefPer")
  local Vit2 = targetUser:GetProperty("Vit")
  local VitPer2 = targetUser:GetProperty("VitPer")
  local Int2 = targetUser:GetProperty("Int")
  local IntPer2 = targetUser:GetProperty("IntPer")
  local MDamReduc2 = CommonFun.calcMDamReDuc(srcUser, targetUser)
  local RefineMDamReduc = targetUser:GetProperty("RefineMDamReduc")

  local BaseMAtk = Int+math.floor(Int*Int/100)
  local MAtkFinal= ((MAtk-BaseMAtk)*(1+MAtkPer)+BaseMAtk)*raceparam*bossparam*bossparam2

  ----------------------------魔法防御减免
  local MDefReduc = CommonFun.CalcMDef(MDef,Int,Vit,srcUser,targetUser)

  local A = ((MAtkFinal*MDefReduc*(1-MDamReduc2)+MRefine)*(1-RefineMDamReduc)*RuneDamage*(1+MDamIncrease)*GameConfig.ElementRestrain[srcAtkElement][targetDefElement]*elementparam2-Vit2/2*(1+VitPer2)-Int2*(1+IntPer2))

  if 1 >= A then
    return 1
  end

  return A

end
-----------------------------------------------------------------------------------------------------------------------近战刺客系普通攻击伤害计算公式(已改)
function CommonFun.calcDamage_40(srcUser, targetUser, params, damageParam, logger)
  local Str = srcUser:GetProperty("Str")
  local Dex = srcUser:GetProperty("Dex")
  local Luk = srcUser:GetProperty("Luk")
  local Atk = srcUser:GetProperty("Atk")
  local AtkPer = srcUser:GetProperty("AtkPer")
  ------------------------------------------------------普通攻击力
  local NormalAtk = srcUser:GetProperty("NormalAtk")
        NormalAtk = NormalAtk + 5*Str
  ------------------------------------
  local DamIncrease = srcUser:GetProperty("DamIncrease")
  local IgnoreDef  = 0
  local IgnoreDef1 = srcUser:GetProperty("IgnoreDef")
  local IgnoreDef2 = srcUser:GetProperty("IgnoreEquipDef")
  if targetUser.boss or targetUser.mini then
     IgnoreDef=IgnoreDef1
  else
     IgnoreDef=(IgnoreDef1+IgnoreDef2)
  end

  if IgnoreDef >= 1 then
     IgnoreDef  = 1
  end

  local WeaponType =srcUser:GetEquipedWeaponType()
  local skilllv_1 = srcUser:GetLernedSkillLevel(damageParam.skill1_id)
  ------------------------------------------------------------------------------------将原来的物伤加成改成精炼物理攻击
  local Refine = srcUser:GetProperty("Refine")

  local Def2 = targetUser:GetProperty("Def")
  local DefPer2 = targetUser:GetProperty("DefPer")
  local Vit2 = targetUser:GetProperty("Vit")
  local VitPer2 = targetUser:GetProperty("VitPer")
  local DamReduc2 = CommonFun.calcDamReDuc(srcUser, targetUser)
  local RefineDamReduc = targetUser:GetProperty("RefineDamReduc")

  local AttrEffect2 = srcUser:GetProperty("AttrEffect")
  local bits2=CommonFun.getBits(AttrEffect2)

  ----------------------------------------------------------------------------------------------------------------种族，体型，属性，BOSS加伤效果
  local raceparam     = CommonFun.CalcRaceParam(srcUser, targetUser, params, damageParam, logger)
  local bodyparam     = CommonFun.CalcBodyParam(srcUser, targetUser, params, damageParam, logger)
  local elementparam  = CommonFun.CalcElementParam(srcUser, targetUser, params, damageParam, logger)
  local bossparam     = CommonFun.CalcBossParam(srcUser, targetUser, params, damageParam, logger)

  ----------------------------------------------------------------------------------------------------------------种族，体型，属性，BOSS减伤效果
  local raceparam2    = CommonFun.CalcRaceParam2(srcUser, targetUser, params, damageParam, logger)
  local bodyparam2    = CommonFun.CalcBodyParam2(srcUser, targetUser, params, damageParam, logger)
  local elementparam2 = CommonFun.CalcElementParam2(srcUser, targetUser, params, damageParam, logger)
  local bossparam2    = CommonFun.CalcBossParam2(srcUser, targetUser, params, damageParam, logger)

  local BaseAtk  = Str*2 + math.floor(Str*Str/100) + math.floor(Dex/5) + math.floor(Luk/5)
  local AtkFinal = ((Atk-BaseAtk+NormalAtk)*(1+AtkPer)*CommonFun.ShapeCorrection(srcUser,targetUser)*bodyparam*elementparam*elementparam2+BaseAtk)*raceparam*bossparam*bossparam2

  ----------------------------物理防御减免
  local DefReduc= CommonFun.CalcDef(Def,Vit,srcUser,targetUser)

  local A = (AtkFinal*DefReduc*(1-DamReduc2)+Refine)*(1-RefineDamReduc)*(1+DamIncrease)-Vit2*(1+VitPer2)
  ------------------------------------------------------------------------------------------------------------星盘二刀连击
  local Num1=srcUser:GetRunePoint(31006)
  local Num2=srcUser:GetRunePoint(31007)
  local Num3=srcUser:GetRunePoint(31008)
  local Num4=srcUser:GetRunePoint(31009)
  local Num5=srcUser:GetRunePoint(31010)

  local RuneDamage=Num1*0.05+Num2*0.1+Num3*0.1+Num4*0.05+Num5*0.1+1
  ------------------------------------------------------------------------------------------------------------华丽短剑buff状态下刺客普通攻击伤害提升
  local Buff=srcUser:HasBuffID(24441)
  local huali=1

     --------------------------------------------华丽短剑[第四档]
  if (Buff==true and srcUser:HasBuffID(90001903)) then
      huali=1.25
      elseif  Buff==true then
      huali=1.1
  end

  -------------------------------------------------------------------------------------------------星盘触发双刀破甲
  local Num6=srcUser:GetRunePoint(32001)
  local Num7=srcUser:GetRunePoint(32002)
  local RuneDamage2=1
  if targetUser:HasBuffID(95491) then
      RuneDamage2=Num6*0.1+Num7*0.05+1
  end

   if 1 >= A then
         return 1
   end
   -----------------------------------------------巅峰等级 二刀
  local ErDaoDam = 0
  if skilllv_1>10 then
      ErDaoDam = (skilllv_1-10)*0.05
      skilllv_1 = 10
  end
  ---------------------------------------------------斩击带来的下次普通攻击伤害会额外增加100%
  local NextAtk = 1
  if bits2[CommonFun.AttrEffect.NextAttackIncrease]==1 then
      NextAtk = 2
  end
  ---------------------------------------------伤口恶化
  local skilllv_eh = srcUser:GetLernedSkillLevel(1106)

  local gemChance = 0
  local gemDamage = 1
  if srcUser:HasBuffID(810009) then  ------------------梦魇连击符文
    gemChance = 10
    gemDamage = 1.3
  end

   -----------------------------------------------------------------------------------------------------------判断二刀连击触发成功造成双倍伤害
  if WeaponType==250 and CommonFun.IsInRate(skilllv_1*5 + gemChance, srcUser:GetRandom()) then
    -------------------------------------------------------------------------------二刀连击伤口恶化
    if CommonFun.IsInRate(skilllv_eh*12, srcUser:GetRandom()) then
      -----------------------------------------只在后端调用  给对方添加buff
        if srcUser.isServerCall then
            srcUser:AddBuff(116051, targetUser:GetGuid())
        end
    end

    return A*(2+ErDaoDam)*NextAtk*huali*RuneDamage*RuneDamage2*gemDamage, CommonFun.DamageType.ErLianJi
  end

  return A*huali*RuneDamage2*NextAtk
end

---------------------------------------------------------------------------------------------------------------------------近战刺客系技能攻击伤害倍率伤害计算公式（已改）
function CommonFun.calcDamage_41(srcUser, targetUser, params, damageParam, logger)
  local Str = srcUser:GetProperty("Str")
  local Dex = srcUser:GetProperty("Dex")
  local Luk = srcUser:GetProperty("Luk")
  local Atk = srcUser:GetProperty("Atk")
  local AtkPer = srcUser:GetProperty("AtkPer")
  local DamIncrease = srcUser:GetProperty("DamIncrease")
  local IgnoreDef  = 0
  local IgnoreDef1 = srcUser:GetProperty("IgnoreDef")
  local IgnoreDef2 = srcUser:GetProperty("IgnoreEquipDef")
  if targetUser.boss or targetUser.mini then
     IgnoreDef=IgnoreDef1
  else
     IgnoreDef=(IgnoreDef1+IgnoreDef2)
  end

  if IgnoreDef >= 1 then
     IgnoreDef  = 1
  end
  ------------------------------------------------------------------------------------将原来的物伤加成改成精炼物理攻击
  local Refine = srcUser:GetProperty("Refine")

  local Def2 = targetUser:GetProperty("Def")
  local DefPer2 = targetUser:GetProperty("DefPer")
  local Vit2 = targetUser:GetProperty("Vit")
  local VitPer2 = targetUser:GetProperty("VitPer")
  local DamReduc2 = CommonFun.calcDamReDuc(srcUser, targetUser)
  local RefineDamReduc = targetUser:GetProperty("RefineDamReduc")
  local damChangePer  = damageParam.damChangePer
  local damChangePer1 = damageParam.damChangePer1

  local AttrEffect2 = srcUser:GetProperty("AttrEffect")
  local bits2=CommonFun.getBits(AttrEffect2)


  ----------------------------------------------------------------------------------------------------------------种族，体型，属性，BOSS加伤效果
  local raceparam     = CommonFun.CalcRaceParam(srcUser, targetUser, params, damageParam, logger)
  local bodyparam     = CommonFun.CalcBodyParam(srcUser, targetUser, params, damageParam, logger)
  local elementparam  = CommonFun.CalcElementParam(srcUser, targetUser, params, damageParam, logger)
  local bossparam     = CommonFun.CalcBossParam(srcUser, targetUser, params, damageParam, logger)

  ----------------------------------------------------------------------------------------------------------------种族，体型，属性，BOSS减伤效果
  local raceparam2    = CommonFun.CalcRaceParam2(srcUser, targetUser, params, damageParam, logger)
  local bodyparam2    = CommonFun.CalcBodyParam2(srcUser, targetUser, params, damageParam, logger)
  local elementparam2 = CommonFun.CalcElementParam2(srcUser, targetUser, params, damageParam, logger)
  local bossparam2    = CommonFun.CalcBossParam2(srcUser, targetUser, params, damageParam, logger)

  local BaseAtk  = Str*2 + math.floor(Str*Str/100) + math.floor(Dex/5) + math.floor(Luk/5)
  local AtkFinal = ((Atk-BaseAtk)*(1+AtkPer)*CommonFun.ShapeCorrection(srcUser,targetUser)*bodyparam*elementparam*elementparam2+BaseAtk)*raceparam*bossparam*bossparam2

  ----------------------------物理防御减免
  local DefReduc= CommonFun.CalcDef(Def,Vit,srcUser,targetUser)

  local A = (AtkFinal*DefReduc*(1-DamReduc2)+Refine)*damChangePer*(1-RefineDamReduc)*(1+DamIncrease) + damChangePer1-Vit2*(1+VitPer2)
      if 1 >= A then
         return 1
      end

  if bits2[CommonFun.AttrEffect.Hualiduanjian]==1 then
     return A*1.5
  end

  return A
end

---------------------------------------------------------------------------------------------------------------------------病毒散播伤害计算公式（已改）
function CommonFun.calcDamage_42(srcUser, targetUser, params, damageParam, logger)
  local Str = srcUser:GetProperty("Str")
  local Dex = srcUser:GetProperty("Dex")
  local Luk = srcUser:GetProperty("Luk")
  local Atk = srcUser:GetProperty("Atk")
  local AtkPer = srcUser:GetProperty("AtkPer")
  local DamIncrease = srcUser:GetProperty("DamIncrease")
  local IgnoreDef  = 0
  local IgnoreDef1 = srcUser:GetProperty("IgnoreDef")
  local IgnoreDef2 = srcUser:GetProperty("IgnoreEquipDef")
  if targetUser.boss or targetUser.mini then
     IgnoreDef=IgnoreDef1
  else
     IgnoreDef=(IgnoreDef1+IgnoreDef2)
  end

  if IgnoreDef >= 1 then
     IgnoreDef  = 1
  end
  ------------------------------------------------------------------------------------将原来的物伤加成改成精炼物理攻击
  local Refine = srcUser:GetProperty("Refine")

  local Def2 = targetUser:GetProperty("Def")
  local DefPer2 = targetUser:GetProperty("DefPer")
  local Vit2 = targetUser:GetProperty("Vit")
  local VitPer2 = targetUser:GetProperty("VitPer")
  local DamReduc2 = CommonFun.calcDamReDuc(srcUser, targetUser)
  local RefineDamReduc = targetUser:GetProperty("RefineDamReduc")
  local damChangePer  = damageParam.damChangePer
  local damChangePer1 = damageParam.damChangePer1

  local AttrEffect2 = srcUser:GetProperty("AttrEffect")
  local bits2=CommonFun.getBits(AttrEffect2)


  ----------------------------------------------------------------------------------------------------------------种族，体型，属性，BOSS加伤效果
  local raceparam     = CommonFun.CalcRaceParam(srcUser, targetUser, params, damageParam, logger)
  local bodyparam     = CommonFun.CalcBodyParam(srcUser, targetUser, params, damageParam, logger)
  local elementparam  = CommonFun.CalcElementParam(srcUser, targetUser, params, damageParam, logger)
  local bossparam     = CommonFun.CalcBossParam(srcUser, targetUser, params, damageParam, logger)

  ----------------------------------------------------------------------------------------------------------------种族，体型，属性，BOSS减伤效果
  local raceparam2    = CommonFun.CalcRaceParam2(srcUser, targetUser, params, damageParam, logger)
  local bodyparam2    = CommonFun.CalcBodyParam2(srcUser, targetUser, params, damageParam, logger)
  local elementparam2 = CommonFun.CalcElementParam2(srcUser, targetUser, params, damageParam, logger)
  local bossparam2    = CommonFun.CalcBossParam2(srcUser, targetUser, params, damageParam, logger)

  local BaseAtk  = Str*2 + math.floor(Str*Str/100) + math.floor(Dex/5) + math.floor(Luk/5)
  local AtkFinal = ((Atk-BaseAtk)*(1+AtkPer)*CommonFun.ShapeCorrection(srcUser,targetUser)*bodyparam*elementparam*elementparam2+BaseAtk)*raceparam*bossparam*bossparam2

  ----------------------------物理防御减免
  local DefReduc= CommonFun.CalcDef(Def,Vit,srcUser,targetUser)

  -------------------------------------------------------------------------------------------------------------紫毒短剑效果
  local Weapon=srcUser:GetEquipedID(7)
  local B = 1

  if (Weapon==40738 or Weapon==140738) then
     B = 2
  end

  -------------------------------------------------------------------------------------------------------------紫毒短剑效果 (第四档)
  local weaponRefineLv_2=srcUser:GetEquipedRefineLv(7)
  local zidu = 0

  if srcUser:HasBuffID(90001313)  then
     zidu = weaponRefineLv_2*0.05
  end


  -------------------------------------------------------------------------------------------------------------星盘病毒散播
  local Num1=srcUser:GetRunePoint(32014)
  local Num2=srcUser:GetRunePoint(32015)
  local Num3=srcUser:GetRunePoint(32016)
  local Num4=srcUser:GetRunePoint(32017)
  local Num5=srcUser:GetRunePoint(32018)
  local RuneDamage=Num1*0.05+Num2*0.05+Num3*0.05+Num4*0.05+Num5*0.05+1

  local A = (((AtkFinal*DefReduc*(1-DamReduc2)+Refine)*(damChangePer+zidu))*(1-RefineDamReduc)*(1+DamIncrease) + damChangePer1 - Vit2*(1+VitPer2))*B*RuneDamage
      if 1 >= A then
         return 1
      end

  if bits2[CommonFun.AttrEffect.Hualiduanjian]==1 then
     return A*1.5
  end

  return A
end
-----------------------------------------------------------------------------------------------------------------无视对方物理防御攻击
function CommonFun.calcDamage_43(srcUser, targetUser, params, damageParam, logger)
  local Str = srcUser:GetProperty("Str")
  local Dex = srcUser:GetProperty("Dex")
  local Luk = srcUser:GetProperty("Luk")
  local Atk = srcUser:GetProperty("Atk")
  local AtkPer = srcUser:GetProperty("AtkPer")
  local DamIncrease = srcUser:GetProperty("DamIncrease")
  local IgnoreDef  = 0
  local IgnoreDef1 = srcUser:GetProperty("IgnoreDef")
  local IgnoreDef2 = srcUser:GetProperty("IgnoreEquipDef")
  if targetUser.boss or targetUser.mini then
     IgnoreDef=IgnoreDef1
  else
     IgnoreDef=(IgnoreDef1+IgnoreDef2)
  end

  if IgnoreDef >= 1 then
     IgnoreDef=1
  end
    ------------------------------------------------------------------------------------将原来的物伤加成改成精炼物理攻击
  local Refine = srcUser:GetProperty("Refine")

  local Def2 = targetUser:GetProperty("Def")
  local DefPer2 = targetUser:GetProperty("DefPer")
  local Vit2 = targetUser:GetProperty("Vit")
  local VitPer2 = targetUser:GetProperty("VitPer")
  local DamReduc2 = CommonFun.calcDamReDuc(srcUser, targetUser)
  local RefineDamReduc = targetUser:GetProperty("RefineDamReduc")

  local damChangePer = damageParam.damChangePer

  ----------------------------------------------------------------------------------------------------------------种族，体型，属性，BOSS加伤效果
  local raceparam     = CommonFun.CalcRaceParam(srcUser, targetUser, params, damageParam, logger)
  local bodyparam     = CommonFun.CalcBodyParam(srcUser, targetUser, params, damageParam, logger)
  local elementparam  = CommonFun.CalcElementParam(srcUser, targetUser, params, damageParam, logger)
  local bossparam     = CommonFun.CalcBossParam(srcUser, targetUser, params, damageParam, logger)

  ----------------------------------------------------------------------------------------------------------------种族，体型，属性，BOSS减伤效果
  local raceparam2    = CommonFun.CalcRaceParam2(srcUser, targetUser, params, damageParam, logger)
  local bodyparam2    = CommonFun.CalcBodyParam2(srcUser, targetUser, params, damageParam, logger)
  local elementparam2 = CommonFun.CalcElementParam2(srcUser, targetUser, params, damageParam, logger)
  local bossparam2    = CommonFun.CalcBossParam2(srcUser, targetUser, params, damageParam, logger)



  local BaseAtk  = Str*2 + math.floor(Str*Str/100) + math.floor(Dex/5) + math.floor(Luk/5)
  local AtkFinal = ((Atk-BaseAtk)*(1+AtkPer)*CommonFun.ShapeCorrection(srcUser,targetUser)*bodyparam*elementparam*elementparam2+BaseAtk)*raceparam*bossparam*bossparam2
  ----------------------------物理防御减免


  local A = ((AtkFinal*(1-DamReduc2)+Refine)*damChangePer)*(1-RefineDamReduc)*(1+DamIncrease)-Vit2*(1+VitPer2)

   if 1 >= A then
         return 1
   end

   return A
end
--------------------------------------------------------------------------------------------------------------牧师普攻伤害计算公式
function CommonFun.calcDamage_50(srcUser, targetUser, params, damageParam, logger)
  local Str1 = srcUser:GetProperty("Str")
  --------------------------------------------------------------------------------------------------------星盘加成的力量转换的普攻加成率提升百分比
  local Num1 = srcUser:GetRunePoint(51013)
  local RuneDamage = Num1*0.05 + 1
  local Str = Str1*RuneDamage
  --------------------------------------------------------------------------------------------------------分割线
  local Dex = srcUser:GetProperty("Dex")
  local Luk = srcUser:GetProperty("Luk")
  local Atk1 = srcUser:GetProperty("Atk")
  local MAtk = srcUser:GetProperty("MAtk")
  local MAtkPer = srcUser:GetProperty("MAtkPer")
  -------------------------------------------------------------------------------------------------------星盘加成的牧师普攻会受到魔法攻击影响
  local Num1 = srcUser:GetRunePoint(52013)
  local Num2 = srcUser:GetRunePoint(52014)
  local Num3 = srcUser:GetRunePoint(52015)
  local Num4 = srcUser:GetRunePoint(52016)
  local Num5 = srcUser:GetRunePoint(52017)
  local Num6 = srcUser:GetRunePoint(52018)
  local RuneDamage1 = (Num1 + Num2 + Num3 + Num4 + Num5 + Num6)*0.07
  local Atk  = Atk1 + RuneDamage1*MAtk*(1+MAtkPer)
  --------------------------------------------------------------------------------------------------------分割线2
  local AtkPer = srcUser:GetProperty("AtkPer")
  ------------------------------------------------------普通攻击力
  local NormalAtk = srcUser:GetProperty("NormalAtk")
        NormalAtk = NormalAtk + 5*Str
  ------------------------------------
  local DamIncrease = srcUser:GetProperty("DamIncrease")
  local IgnoreDef  = 0
  local IgnoreDef1 = srcUser:GetProperty("IgnoreDef")
  local IgnoreDef2 = srcUser:GetProperty("IgnoreEquipDef")
  if targetUser.boss or targetUser.mini then
     IgnoreDef=IgnoreDef1
  else
     IgnoreDef=(IgnoreDef1+IgnoreDef2)
  end

  if IgnoreDef >= 1 then
     IgnoreDef  = 1
  end

  local skilllv_1 = srcUser:GetLernedSkillLevel(damageParam.skill1_id)
   ------------------------------------------------------------------------------------将原来的物伤加成改成精炼物理攻击
  local Refine = srcUser:GetProperty("Refine")


  local fromid = targetUser:GetBuffFromID(45000120)
  local guid = srcUser:GetGuid()
  local BUffDam = 1

  if fromid==guid then
    BUffDam = 1.3
  end


  local Def2 = targetUser:GetProperty("Def")
  local DefPer2 = targetUser:GetProperty("DefPer")
  local Vit2 = targetUser:GetProperty("Vit")
  local VitPer2 = targetUser:GetProperty("VitPer")
  local DamReduc2 = CommonFun.calcDamReDuc(srcUser, targetUser)
  local RefineDamReduc = targetUser:GetProperty("RefineDamReduc")
  local race2 = targetUser.race
  local DefAttr2=targetUser:GetProperty("DefAttr")

  local damChangePer = damageParam.damChangePer

  ----------------------------------------------------------------------------------------------------------------种族，体型，属性，BOSS加伤效果
  local raceparam     = CommonFun.CalcRaceParam(srcUser, targetUser, params, damageParam, logger)
  local bodyparam     = CommonFun.CalcBodyParam(srcUser, targetUser, params, damageParam, logger)
  local elementparam  = CommonFun.CalcElementParam(srcUser, targetUser, params, damageParam, logger)
  local bossparam     = CommonFun.CalcBossParam(srcUser, targetUser, params, damageParam, logger)
  ----------------------------------------------------------------------------------------------------------------种族，体型，属性，BOSS减伤效果
  local raceparam2    = CommonFun.CalcRaceParam2(srcUser, targetUser, params, damageParam, logger)
  local bodyparam2    = CommonFun.CalcBodyParam2(srcUser, targetUser, params, damageParam, logger)
  local elementparam2 = CommonFun.CalcElementParam2(srcUser, targetUser, params, damageParam, logger)
  local bossparam2    = CommonFun.CalcBossParam2(srcUser, targetUser, params, damageParam, logger)

  local BaseAtk   = Str1*2 + math.floor(Str1*Str1/100) + math.floor(Dex/5) + math.floor(Luk/5)
  local BaseAtk1  = Str*2 + math.floor(Str*Str/100) + math.floor(Dex/5) + math.floor(Luk/5)

  local AtkFinal = ((Atk-BaseAtk+NormalAtk)*(1+AtkPer)*CommonFun.ShapeCorrection(srcUser,targetUser)*bodyparam*elementparam*elementparam2+BaseAtk1)*raceparam*bossparam*bossparam2

  ----------------------------物理防御减免
  local DefReduc= CommonFun.CalcDef(Def,Vit,srcUser,targetUser)

  local A = (((AtkFinal*DefReduc*(1-DamReduc2)+Refine)*damChangePer)*(1-RefineDamReduc)*(1+DamIncrease)-Vit2*(1+VitPer2))*BUffDam
   if 1 >= A then
         return 1
   end
  --------------------------------------------------------------------------------------------------------天使之击带来的伤害加成效果
  if race2==3 or DefAttr2==9 then
     return A*(1+skilllv_1*0.05)
  end

  return A

end

-----------------------------------------------------------------------------------------------------------------商人普攻及技能伤害计算公式(已改)
function CommonFun.calcDamage_60(srcUser, targetUser, params, damageParam, logger)
  local Str = srcUser:GetProperty("Str")
  local Dex = srcUser:GetProperty("Dex")
  local Luk = srcUser:GetProperty("Luk")
  local Atk = srcUser:GetProperty("Atk")
  local AtkPer = srcUser:GetProperty("AtkPer")
  local DamIncrease = srcUser:GetProperty("DamIncrease")
  local IgnoreDef  = 0
  local IgnoreDef1 = srcUser:GetProperty("IgnoreDef")
  local IgnoreDef2 = srcUser:GetProperty("IgnoreEquipDef")
  if targetUser.boss or targetUser.mini then
     IgnoreDef=IgnoreDef1
  else
     IgnoreDef=(IgnoreDef1+IgnoreDef2)
  end

  if IgnoreDef >= 1 then
     IgnoreDef=1
  end
    ------------------------------------------------------------------------------------将原来的物伤加成改成精炼物理攻击
  local Refine = srcUser:GetProperty("Refine")

  local Def2 = targetUser:GetProperty("Def")
  local DefPer2 = targetUser:GetProperty("DefPer")
  local Vit2 = targetUser:GetProperty("Vit")
  local VitPer2 = targetUser:GetProperty("VitPer")
  local DamReduc2 = CommonFun.calcDamReDuc(srcUser, targetUser)
  local RefineDamReduc = targetUser:GetProperty("RefineDamReduc")

  local damChangePer = damageParam.damChangePer
  local skilllv_1 = srcUser:GetLernedSkillLevel(266)

  ----------------------------------------------------------------------------------------------------------------种族，体型，属性，BOSS加伤效果
  local raceparam     = CommonFun.CalcRaceParam(srcUser, targetUser, params, damageParam, logger)
  local bodyparam     = CommonFun.CalcBodyParam(srcUser, targetUser, params, damageParam, logger)
  local elementparam  = CommonFun.CalcElementParam(srcUser, targetUser, params, damageParam, logger)
  local bossparam     = CommonFun.CalcBossParam(srcUser, targetUser, params, damageParam, logger)

  ----------------------------------------------------------------------------------------------------------------种族，体型，属性，BOSS减伤效果
  local raceparam2    = CommonFun.CalcRaceParam2(srcUser, targetUser, params, damageParam, logger)
  local bodyparam2    = CommonFun.CalcBodyParam2(srcUser, targetUser, params, damageParam, logger)
  local elementparam2 = CommonFun.CalcElementParam2(srcUser, targetUser, params, damageParam, logger)
  local bossparam2    = CommonFun.CalcBossParam2(srcUser, targetUser, params, damageParam, logger)

  local BaseAtk  = Str*2 + math.floor(Str*Str/100) + math.floor(Dex/5) + math.floor(Luk/5)
  local AtkFinal = ((Atk-BaseAtk+skilllv_1*15)*(1+AtkPer)*CommonFun.ShapeCorrection(srcUser,targetUser)*bodyparam*elementparam*elementparam2+BaseAtk)*raceparam*bossparam*bossparam2

  ----------------------------物理防御减免
  local DefReduc= CommonFun.CalcDef(Def,Vit,srcUser,targetUser)

  local A = (AtkFinal*DefReduc*(1-DamReduc2)+Refine)*damChangePer*(1-RefineDamReduc)*(1+DamIncrease)-Vit2*(1+VitPer2)

   if 1 >= A then
         return 1
   end

   return A
end
--------------------------------------------------------------------------------------------------------------------------贤者 普攻 伤害公式
function CommonFun.calcDamage_80(srcUser, targetUser, params, damageParam, logger)
  local Luk = srcUser:GetProperty("Luk")
  local Int = srcUser:GetProperty("Int")
  local Vit = srcUser:GetProperty("Vit")
  local MAtk = srcUser:GetProperty("MAtk")
  ------------------------------------------------------普通攻击力
  local Numxp= srcUser:GetRunePoint(82001)-----------------------------星盘
  local NormalAtk = srcUser:GetProperty("NormalAtk")
        NormalAtk = NormalAtk + (3+0.3*Numxp)*Int
  ------------------------------------
  local MAtkPer = srcUser:GetProperty("MAtkPer")
  -----------------------------------------------------------------------------------分割线
  local MDamIncrease = CommonFun.calcMDamIncrease(srcUser, targetUser)
  local IgnoreMDef = srcUser:GetProperty("IgnoreMDef")
  if IgnoreMDef >= 1 then
     IgnoreMDef  = 1
  end

  ----------------------------------------------------------------升级装备 丝质外袍 暴击伤害
  local Num1 = srcUser:GetBuffLayer(90000952)
  local Num2 = srcUser:GetBuffLayer(90000953)
  local Num3 = srcUser:GetBuffLayer(90000954)
  ----------------------------------------------------------------升级装备 防水靴 暴击概率
  local Num4 = srcUser:GetBuffLayer(90000942)
  local Num5 = srcUser:GetBuffLayer(90000944)

  local skilllv_1 = srcUser:GetLernedSkillLevel(1324)-----锐化武器
  local CriDam = 0

  if skilllv_1>0 then
      CriDam = 0.1
  elseif skilllv_1>5 then
      CriDam = 0.1 + (skilllv_1-5)*0.05
  end

  local Num_bs = srcUser:GetRunePoint(82024)
  local RuneDamage  =  1 + CriDam + 0.03*Num1 + 0.03*Num2 + 0.04*Num3 + 0.05*Num_bs -----------暴击伤害

  local RuneDamage1 =  0 --------------------------------------------------暴击概率

  if (Num4 + Num5 + skilllv_1)>0 then
     RuneDamage1 = skilllv_1 + Luk/3 + Num4*5 + Num5*5
  end
  ------------------------------------------------------------------------------------将原来的物伤加成改成精炼物理攻击
  local MRefine = srcUser:GetProperty("MRefine")

  local srcAtkElement    = CommonFun.GetUserAtkAttr(srcUser, params, damageParam)
  local targetDefElement = targetUser:GetProperty("DefAttr")
  ----------------------------------------------------------------------------------------------------------------种族，体型，属性，BOSS减伤效果
  local elementparam2 = CommonFun.CalcElementParam2(srcUser, targetUser, params, damageParam, logger)

  ----------------------------------------------------------------------------------------------------------------法系职业伤害会受到种族加伤减伤影响
  local raceparam     = CommonFun.CalcRaceParam(srcUser, targetUser, params, damageParam, logger)
  local raceparam2    = CommonFun.CalcRaceParam2(srcUser, targetUser, params, damageParam, logger)
  local bossparam     = CommonFun.CalcBossParam(srcUser, targetUser, params, damageParam, logger)
  local bossparam2    = CommonFun.CalcBossParam2(srcUser, targetUser, params, damageParam, logger)

  local MDef2 = targetUser:GetProperty("MDef")
  local MDefPer2 = targetUser:GetProperty("MDefPer")
  local Vit2 = targetUser:GetProperty("Vit")
  local VitPer2 = targetUser:GetProperty("VitPer")
  local Int2 = targetUser:GetProperty("Int")
  local IntPer2 = targetUser:GetProperty("IntPer")
  local MDamReduc2 = CommonFun.calcMDamReDuc(srcUser, targetUser)
  local RefineMDamReduc = targetUser:GetProperty("RefineMDamReduc")

  local damChangePer = damageParam.damChangePer

  local BaseMAtk = Int+math.floor(Int*Int/100)
  local MAtkFinal= ((MAtk-BaseMAtk+NormalAtk)*(1+MAtkPer)+BaseMAtk)*raceparam*bossparam*bossparam2

  ----------------------------魔法防御减免
  local MDefReduc = CommonFun.CalcMDef(MDef,Int,Vit,srcUser,targetUser)

  local A = ((MAtkFinal*MDefReduc*(1-MDamReduc2)+MRefine)*(1-RefineMDamReduc)*damChangePer*(1+MDamIncrease)*GameConfig.ElementRestrain[srcAtkElement][targetDefElement]*elementparam2-Vit2/2*(1+VitPer2)-Int2*(1+IntPer2))

  if 1 >= A then
    return 1
  end

  if CommonFun.IsInRate(RuneDamage1, srcUser:GetRandom()) then
     return A*RuneDamage,CommonFun.DamageType.Crit
  end

  return A

end
  ------------------------------------------------------------------------------------宠物真实伤害计算
function CommonFun.calcDamage_100(srcUser, targetUser, params, damageParam, logger)
  local Atk = srcUser:GetProperty("Atk")
  local damChangePer = damageParam.damChangePer

  local A = Atk * damChangePer

  if 1 >= A then
    return 1
  end

  return A
end

-----------------------------------------------------------------------------------------------------------------神圣复仇者伤害
function CommonFun.calcDamage_101(srcUser, targetUser, params, damageParam, logger)
  local Str = srcUser:GetProperty("Str")
  local Dex = srcUser:GetProperty("Dex")
  local Luk = srcUser:GetProperty("Luk")
  local Atk = srcUser:GetProperty("Atk")
  local AtkPer = srcUser:GetProperty("AtkPer")
  local DamIncrease = srcUser:GetProperty("DamIncrease")
  local IgnoreDef  = 0
  local IgnoreDef1 = srcUser:GetProperty("IgnoreDef")
  local IgnoreDef2 = srcUser:GetProperty("IgnoreEquipDef")
  if targetUser.boss or targetUser.mini then
     IgnoreDef=IgnoreDef1
  else
     IgnoreDef=(IgnoreDef1+IgnoreDef2)
  end

  if IgnoreDef >= 1 then
     IgnoreDef=1
  end
    ------------------------------------------------------------------------------------将原来的物伤加成改成精炼物理攻击
  local Refine = srcUser:GetProperty("Refine")

  local Def2 = targetUser:GetProperty("Def")
  local DefPer2 = targetUser:GetProperty("DefPer")
  local Vit2 = targetUser:GetProperty("Vit")
  local VitPer2 = targetUser:GetProperty("VitPer")
  local DamReduc2 = CommonFun.calcDamReDuc(srcUser, targetUser)
  local RefineDamReduc = targetUser:GetProperty("RefineDamReduc")

  local damChangePer = damageParam.damChangePer

  ----------------------------------------------------------------------------------------------------------------种族，体型，属性，BOSS加伤效果
  local raceparam     = CommonFun.CalcRaceParam(srcUser, targetUser, params, damageParam, logger)
  local bodyparam     = CommonFun.CalcBodyParam(srcUser, targetUser, params, damageParam, logger)
  local elementparam  = CommonFun.CalcElementParam(srcUser, targetUser, params, damageParam, logger)
  local bossparam     = CommonFun.CalcBossParam(srcUser, targetUser, params, damageParam, logger)

  ----------------------------------------------------------------------------------------------------------------种族，体型，属性，BOSS减伤效果
  local raceparam2    = CommonFun.CalcRaceParam2(srcUser, targetUser, params, damageParam, logger)
  local bodyparam2    = CommonFun.CalcBodyParam2(srcUser, targetUser, params, damageParam, logger)
  local elementparam2 = CommonFun.CalcElementParam2(srcUser, targetUser, params, damageParam, logger)
  local bossparam2    = CommonFun.CalcBossParam2(srcUser, targetUser, params, damageParam, logger)



  local BaseAtk  = Str*2 + math.floor(Str*Str/100) + math.floor(Dex/5) + math.floor(Luk/5)
  local AtkFinal = ((Atk-BaseAtk)*(1+AtkPer)*CommonFun.ShapeCorrection(srcUser,targetUser)*bodyparam*elementparam*elementparam2+BaseAtk)*raceparam*bossparam*bossparam2

  ----------------------------物理防御减免
  local DefReduc= CommonFun.CalcDef(Def,Vit,srcUser,targetUser)

  local RefineLv=srcUser:GetEquipedRefineLv(7)

  local A = ((AtkFinal*DefReduc*(1-DamReduc2)+Refine)*damChangePer*(1+DamIncrease)*(1-RefineDamReduc)-Vit2*(1+VitPer2))*(1+RefineLv*0.05)

   if 1 >= A then
         return 1
   end

   return A
end
-----------------------------------------------------------------------------------------------------------------商人手推车技能伤害计算公式(已改)
function CommonFun.calcDamage_6101(srcUser, targetUser, params, damageParam, logger)
  local Str = srcUser:GetProperty("Str")
  local Dex = srcUser:GetProperty("Dex")
  local Luk = srcUser:GetProperty("Luk")
  local Atk = srcUser:GetProperty("Atk")
  local AtkPer = srcUser:GetProperty("AtkPer")
  local DamIncrease = srcUser:GetProperty("DamIncrease")
  local IgnoreDef  = 0
  local IgnoreDef1 = srcUser:GetProperty("IgnoreDef")
  local IgnoreDef2 = srcUser:GetProperty("IgnoreEquipDef")
  if targetUser.boss or targetUser.mini then
     IgnoreDef=IgnoreDef1
  else
     IgnoreDef=(IgnoreDef1+IgnoreDef2)
  end

  if IgnoreDef >= 1 then
     IgnoreDef=1
  end
    ------------------------------------------------------------------------------------将原来的物伤加成改成精炼物理攻击
  local Refine = srcUser:GetProperty("Refine")

  local Def2 = targetUser:GetProperty("Def")
  local DefPer2 = targetUser:GetProperty("DefPer")
  local Vit2 = targetUser:GetProperty("Vit")
  local VitPer2 = targetUser:GetProperty("VitPer")
  local DamReduc2 = CommonFun.calcDamReDuc(srcUser, targetUser)
  local RefineDamReduc = targetUser:GetProperty("RefineDamReduc")

  local damChangePer = damageParam.damChangePer
  local skilllv_1 = srcUser:GetLernedSkillLevel(266)

  ----------------------------------------------------------------------------------------------------------------种族，体型，属性，BOSS加伤效果
  local raceparam     = CommonFun.CalcRaceParam(srcUser, targetUser, params, damageParam, logger)
  local bodyparam     = CommonFun.CalcBodyParam(srcUser, targetUser, params, damageParam, logger)
  local elementparam  = CommonFun.CalcElementParam(srcUser, targetUser, params, damageParam, logger)
  local bossparam     = CommonFun.CalcBossParam(srcUser, targetUser, params, damageParam, logger)

  ----------------------------------------------------------------------------------------------------------------种族，体型，属性，BOSS减伤效果
  local raceparam2    = CommonFun.CalcRaceParam2(srcUser, targetUser, params, damageParam, logger)
  local bodyparam2    = CommonFun.CalcBodyParam2(srcUser, targetUser, params, damageParam, logger)
  local elementparam2 = CommonFun.CalcElementParam2(srcUser, targetUser, params, damageParam, logger)
  local bossparam2    = CommonFun.CalcBossParam2(srcUser, targetUser, params, damageParam, logger)



  local BaseAtk  = Str*2 + math.floor(Str*Str/100) + math.floor(Dex/5) + math.floor(Luk/5)
  local AtkFinal = ((Atk-BaseAtk+skilllv_1*15)*(1+AtkPer)*CommonFun.ShapeCorrection(srcUser,targetUser)*bodyparam*elementparam*elementparam2+BaseAtk)*raceparam*bossparam*bossparam2

  ----------------------------物理防御减免
  local DefReduc= CommonFun.CalcDef(Def,Vit,srcUser,targetUser)
  -----------------------------------------------------------------------------------------------------------------星盘手推车攻击
  local num,numMax=srcUser:GetCartNums()
  local Num1  = srcUser:GetRunePoint(61006)
  local Num2  = srcUser:GetRunePoint(61007)
  local Num3  = srcUser:GetRunePoint(61008)
  local Num4  = srcUser:GetRunePoint(61009)
  local Num5  = srcUser:GetRunePoint(61010)
  local RuneDamage=(Num1*0.005+Num2*0.01+Num3*0.01+Num4*0.005+Num5*0.01)*numMax+1
  ----------------------------------------------------------------------------------------炼金 星盘 手推车攻击
  local Num6  = srcUser:GetRunePoint(130010)
  local RuneDamage2 = Num6*0.1+1

  local A = ((AtkFinal*DefReduc*(1-DamReduc2)+Refine)*damChangePer*(1-RefineDamReduc)*(1+DamIncrease)-Vit2*(1+VitPer2))*RuneDamage*RuneDamage2
  local Weapon=srcUser:GetEquipedID(7)

   ---------------------------------------------------------------------------贝克之斧[第八档]
  local RefineLv7=srcUser:GetEquipedRefineLv(7)
  local beike = 0
  if srcUser:HasBuffID(90000677) then
        if (RefineLv7>=10 and RefineLv7<15) then
        beike =(RefineLv7-10)* 0.02
         elseif RefineLv7 ==15 then
         beike =(RefineLv7-10)* 0.02 + 0.05
        end
    end
  ---------------------------------------------------------------------------破坏者战斧
    if srcUser:HasBuffID(41920) then
      if (RefineLv7>=5 and RefineLv7<15) then
        beike =(RefineLv7-5)* 0.02
      end
    end

   if srcUser:HasBuffID(850003) then --------------------飞驰撞击符文
     A = A * 1.25
   end

   if Weapon==41835 or Weapon==141835 or Weapon==41867 or Weapon==141867 then
         return A*(1.15+beike)
   end

   if 1 >= A then
         return 1
   end

   return A
end

-----------------------------------------------------------------------------------------------------------------商人金钱攻击伤害公式(已改)
function CommonFun.calcDamage_6102(srcUser, targetUser, params, damageParam, logger)
  local Str = srcUser:GetProperty("Str")
  local Dex = srcUser:GetProperty("Dex")
  local Luk = srcUser:GetProperty("Luk")
  local Atk = srcUser:GetProperty("Atk")
  local AtkPer = srcUser:GetProperty("AtkPer")
  local DamIncrease = srcUser:GetProperty("DamIncrease")
  local IgnoreDef  = 0
  local IgnoreDef1 = srcUser:GetProperty("IgnoreDef")
  local IgnoreDef2 = srcUser:GetProperty("IgnoreEquipDef")
  if targetUser.boss or targetUser.mini then
     IgnoreDef=IgnoreDef1
  else
     IgnoreDef=(IgnoreDef1+IgnoreDef2)
  end

  if IgnoreDef >= 1 then
     IgnoreDef=1
  end
    ------------------------------------------------------------------------------------将原来的物伤加成改成精炼物理攻击
  local Refine = srcUser:GetProperty("Refine")

  local Def2 = targetUser:GetProperty("Def")
  local DefPer2 = targetUser:GetProperty("DefPer")
  local Vit2 = targetUser:GetProperty("Vit")
  local VitPer2 = targetUser:GetProperty("VitPer")
  local DamReduc2 = CommonFun.calcDamReDuc(srcUser, targetUser)
  local RefineDamReduc = targetUser:GetProperty("RefineDamReduc")

  local damChangePer = damageParam.damChangePer
  local Weapon=srcUser:GetEquipedID(7)
  local RefineLv=srcUser:GetEquipedRefineLv(7)
  ----------------------------------------------------------------------------------------------------------------种族，体型，属性，BOSS加伤效果
  local raceparam     = CommonFun.CalcRaceParam(srcUser, targetUser, params, damageParam, logger)
  local bodyparam     = CommonFun.CalcBodyParam(srcUser, targetUser, params, damageParam, logger)
  local elementparam  = CommonFun.CalcElementParam(srcUser, targetUser, params, damageParam, logger)
  local bossparam     = CommonFun.CalcBossParam(srcUser, targetUser, params, damageParam, logger)

  ----------------------------------------------------------------------------------------------------------------种族，体型，属性，BOSS减伤效果
  local raceparam2    = CommonFun.CalcRaceParam2(srcUser, targetUser, params, damageParam, logger)
  local bodyparam2    = CommonFun.CalcBodyParam2(srcUser, targetUser, params, damageParam, logger)
  local elementparam2 = CommonFun.CalcElementParam2(srcUser, targetUser, params, damageParam, logger)
  local bossparam2    = CommonFun.CalcBossParam2(srcUser, targetUser, params, damageParam, logger)



  local BaseAtk  = Str*2 + math.floor(Str*Str/100) + math.floor(Dex/5) + math.floor(Luk/5)
  local AtkFinal = ((Atk-BaseAtk)*(1+AtkPer)*CommonFun.ShapeCorrection(srcUser,targetUser)*bodyparam*elementparam*elementparam2+BaseAtk)*raceparam*bossparam*bossparam2

  ----------------------------物理防御减免
  local DefReduc= CommonFun.CalcDef(Def,Vit,srcUser,targetUser)
  ----------------------------------------------------------------------------------------------------------------星盘金钱攻击
  local Num1  = srcUser:GetRunePoint(62050)
  local RuneDamage1 = Num1*0.05+1
  --------------------------------------------------不正当手段
  local skilllv_1 = srcUser:GetLernedSkillLevel(272)

  local A = ((AtkFinal*DefReduc*(1-DamReduc2)+Refine)*(damChangePer+skilllv_1*0.3)*(1-RefineDamReduc)*(1+DamIncrease)-Vit2*(1+VitPer2))*RuneDamage1

  ----------------print(Weapon,Dex)
  --血斧或鲜血斧效果
  if (Weapon==41814 or Weapon==141814 or Weapon==41848 or Weapon==141848 or Weapon==41870 or Weapon==141870 ) then
    local CriRandom = 10
    local DexRatio = 0
    local CriRatio = 1
    local RefineRatio = 1

    --灵巧判断
    -----------------------------寻血猎犬
    if Dex>=90 and (Weapon==41814 or Weapon==141814) then
      DexRatio=0.4
    elseif Dex>=90 and (Weapon==41848 or Weapon==141848) then
      DexRatio=0.5
    elseif Dex>=90 and (Weapon==41870 or Weapon==141870) then
      DexRatio=0.5
    end
     -----------------------------力量判断（鲜血斧[第四档]）

    if srcUser:HasBuffID(90001873) and Str>=240 then
       DexRatio=DexRatio+0.3
    end
    -----------------------------寻血猎犬
    if srcUser:HasBuffID(41950) and Str>=240 then
       DexRatio=DexRatio+0.3
    end


    --精炼判断
    if RefineLv>=5 and RefineLv<10 then
      RefineRatio = 1.1
    elseif RefineLv>=10 and RefineLv<15 then
      RefineRatio = 1.3
    elseif RefineLv>=15 then
      RefineRatio = 1.6
    end
    -----------------------------寻血猎犬暴击
    if srcUser:HasBuffID(41950) then
       CriRandom=CriRandom+10
    end

    --暴击判断
    if CommonFun.IsInRate(CriRandom, srcUser:GetRandom()) and (Weapon==41848 or Weapon==141848 or Weapon==41870 or Weapon==141870 ) then
      CriRatio=1.5
    end

    --效果显示
    if CriRatio == 1 then
      return A*(RefineRatio + DexRatio) * CriRatio
    else
      return A*(RefineRatio + DexRatio) * CriRatio,CommonFun.DamageType.Crit
    end
  end


  if 1 >= A then
    return 1
  end

  return A
end
-----------------------------------------------------------------------------------------------------------------商人手推车撞击技能伤害计算公式(已改)
function CommonFun.calcDamage_6103(srcUser, targetUser, params, damageParam, logger)
  local Str = srcUser:GetProperty("Str")
  local Dex = srcUser:GetProperty("Dex")
  local Luk = srcUser:GetProperty("Luk")
  local Atk = srcUser:GetProperty("Atk")
  local AtkPer = srcUser:GetProperty("AtkPer")
  local DamIncrease = srcUser:GetProperty("DamIncrease")
  local IgnoreDef  = 0
  local IgnoreDef1 = srcUser:GetProperty("IgnoreDef")
  local IgnoreDef2 = srcUser:GetProperty("IgnoreEquipDef")
  if targetUser.boss or targetUser.mini then
     IgnoreDef=IgnoreDef1
  else
     IgnoreDef=(IgnoreDef1+IgnoreDef2)
  end

  if IgnoreDef >= 1 then
     IgnoreDef=1
  end
    ------------------------------------------------------------------------------------将原来的物伤加成改成精炼物理攻击
  local Refine = srcUser:GetProperty("Refine")

  local Def2 = targetUser:GetProperty("Def")
  local DefPer2 = targetUser:GetProperty("DefPer")
  local Vit2 = targetUser:GetProperty("Vit")
  local VitPer2 = targetUser:GetProperty("VitPer")
  local DamReduc2 = CommonFun.calcDamReDuc(srcUser, targetUser)
  local RefineDamReduc = targetUser:GetProperty("RefineDamReduc")
  local damChangePer = damageParam.damChangePer
  local skilllv_1 = srcUser:GetLernedSkillLevel(266)

  ----------------------------------------------------------------------------------------------------------------种族，体型，属性，BOSS加伤效果
  local raceparam     = CommonFun.CalcRaceParam(srcUser, targetUser, params, damageParam, logger)
  local bodyparam     = CommonFun.CalcBodyParam(srcUser, targetUser, params, damageParam, logger)
  local elementparam  = CommonFun.CalcElementParam(srcUser, targetUser, params, damageParam, logger)
  local bossparam     = CommonFun.CalcBossParam(srcUser, targetUser, params, damageParam, logger)
  ----------------------------------------------------------------------------------------------------------------种族，体型，属性，BOSS减伤效果
  local raceparam2    = CommonFun.CalcRaceParam2(srcUser, targetUser, params, damageParam, logger)
  local bodyparam2    = CommonFun.CalcBodyParam2(srcUser, targetUser, params, damageParam, logger)
  local elementparam2 = CommonFun.CalcElementParam2(srcUser, targetUser, params, damageParam, logger)
  local bossparam2    = CommonFun.CalcBossParam2(srcUser, targetUser, params, damageParam, logger)

  local BaseAtk  = Str*2 + math.floor(Str*Str/100) + math.floor(Dex/5) + math.floor(Luk/5)
  local AtkFinal = ((Atk-BaseAtk+skilllv_1*15)*(1+AtkPer)*CommonFun.ShapeCorrection(srcUser,targetUser)*bodyparam*elementparam*elementparam2+BaseAtk)*raceparam*bossparam*bossparam2

  ----------------------------物理防御减免
  local DefReduc= CommonFun.CalcDef(Def,Vit,srcUser,targetUser)
  -----------------------------------------------------------------------------------------------------------------星盘手推车撞击
  local num,numMax=srcUser:GetCartNums()
  local Num1  = srcUser:GetRunePoint(62008)
  local Num2  = srcUser:GetRunePoint(62009)
  local Num3  = srcUser:GetRunePoint(62010)
  local Num4  = srcUser:GetRunePoint(62011)
  local Num5  = srcUser:GetRunePoint(62012)
  local RuneDamage=(Num1*0.01+Num2*0.005+Num3*0.005+Num4*0.005+Num5*0.005)*numMax+1

 -----------------------------------------------------------------------------------------------------------------天崩地裂手推车撞击
 local tianben = 1
 if srcUser:HasBuffID(41940) then
  tianben  = 1.1
 end

 local runeRate = 1
 if srcUser:HasBuffID(850003) then --------------------飞驰撞击符文
  runeRate = 1.25
end

  local A = ((AtkFinal*DefReduc*(1-DamReduc2)+Refine)*damChangePer*(1-RefineDamReduc)*(1+DamIncrease)-Vit2*(1+VitPer2))*RuneDamage*tianben*runeRate

   if 1 >= A then
         return 1
   end

   return A
end


------------------------------------------------------------------------------------------------炼金 治愈之手
function CommonFun.calcDamage_6104(srcUser, targetUser, params, damageParam, logger)
  local BaseLv = srcUser.BaseLv
  local HealEncPer = srcUser:GetProperty("HealEncPer")
  local MAtk = srcUser:GetProperty("MAtk")
  local enemy=srcUser:IsEnemy(targetUser)
  local MDamIncrease = CommonFun.calcMDamIncrease(srcUser, targetUser)

  ------------------------------------------------------------------------------------------------星盘
  local Master = srcUser:GetMasterUser()
  local RuneDamage = 1
  if Master~=nil then
      local Num1  = Master:GetRunePoint(130050)
      RuneDamage = 1+0.15*Num1
  end

  local srcAtkElement    = CommonFun.GetUserAtkAttr(srcUser, params, damageParam)
  local targetDefElement = targetUser:GetProperty("DefAttr")

  local BeHealEncPer2 = targetUser:GetProperty("BeHealEncPer")
  local race2 = targetUser.race
  local DefAttr2=targetUser:GetProperty("DefAttr")


  local AttrEffect = targetUser:GetProperty("AttrEffect2")
  local bits=CommonFun.getBits(AttrEffect)

  local damChangePer  = damageParam.damChangePer
  local damChangePer1 = damageParam.damChangePer1
   ----------------------------------------------------------------------------------------------------------------种族，体型，属性，BOSS减伤效果
  local elementparam2 = CommonFun.CalcElementParam2(srcUser, targetUser, params, damageParam, logger)
  --------------------------------------------------------------------------------------治愈术基本治疗量公式

  local A=((math.floor(BaseLv+MAtk/100)*damChangePer+100)*(1+HealEncPer)*(1+BeHealEncPer2) + damChangePer1)*(-1)*RuneDamage

  --------------------------------------------------------------------------------------对不死属性和不死种族怪物造成治疗量/2的圣属性伤害
  --------------------------------------------------------------------------------------这里的正值代表是伤害效果,负值是治疗效果
  if enemy then
        if DefAttr2==9 then
            return A/2*GameConfig.ElementRestrain[srcAtkElement][targetDefElement]*elementparam2*(-1)*(1+MDamIncrease)
        else
            return 0,0
        end
  else
        if DefAttr2==9 or bits[CommonFun.AttrEffect.PoisinDamNoUse]==1 then
            return -1
        else
            return A
        end
  end

end

--------------------------------------------------------------------------------------------------------------------------善变（生命体)
function CommonFun.calcDamage_6105(srcUser, targetUser, params, damageParam, logger)
  local MAtk = srcUser:GetProperty("MAtk")
  local MAtkPer = srcUser:GetProperty("MAtkPer")
  local MDamIncrease = CommonFun.calcMDamIncrease(srcUser, targetUser)
  local IgnoreMDef = srcUser:GetProperty("IgnoreMDef")
  if IgnoreMDef >= 1 then
     IgnoreMDef  = 1
  end
  local skilllv = srcUser:GetLernedSkillLevel(445)

  MAtk = MAtk * (1+MAtkPer)

  local srcAtkElement    = CommonFun.GetUserAtkAttr(srcUser, params, damageParam)
  local targetDefElement = targetUser:GetProperty("DefAttr")
  ----------------------------------------------------------------------------------------------------------------种族，体型，属性，BOSS减伤效果
  local elementparam2 = CommonFun.CalcElementParam2(srcUser, targetUser, params, damageParam, logger)

  ----------------------------------------------------------------------------------------------------------------法系职业伤害会受到种族加伤减伤影响
  local raceparam     = CommonFun.CalcRaceParam(srcUser, targetUser, params, damageParam, logger)
  local raceparam2    = CommonFun.CalcRaceParam2(srcUser, targetUser, params, damageParam, logger)


  local MDef2 = targetUser:GetProperty("MDef")
  local MDefPer2 = targetUser:GetProperty("MDefPer")
  local Vit2 = targetUser:GetProperty("Vit")
  local VitPer2 = targetUser:GetProperty("VitPer")
  local Int2 = targetUser:GetProperty("Int")
  local IntPer2 = targetUser:GetProperty("IntPer")
  local MDamReduc2 = CommonFun.calcMDamReDuc(srcUser, targetUser)
  local RefineMDamReduc = targetUser:GetProperty("RefineMDamReduc")
  local damChangePer  = damageParam.damChangePer
  local damChangePer1 = damageParam.damChangePer1

  local MAtkFinal=MAtk*raceparam

  ----------------------------魔法防御减免
  local MDefReduc = CommonFun.CalcMDef(MDef,Int,Vit,srcUser,targetUser)
  -------------------------------------------------星盘 善变-强效
  local Num1  = srcUser:GetRunePoint(130100)
  local RuneDamage=Num1*0.1 + 1

  -------------------------------------------------熟练者之锤或精炼值之锤
  local Master = srcUser:GetMasterUser()
  local Num2 =0
  local Weapon_1=Master:GetEquipedID(7)
  if (Weapon_1==41543 or Weapon_1==141543 or Weapon_1==41544 or Weapon_1==141544) then
    Num2=0.75
  end
  -------------------------------------------------------------熟练者之锤精炼
  local WeaponRefineLv=Master:GetEquipedRefineLv(7)
  if (Weapon_1==41543 or Weapon_1==141543 or Weapon_1==41544 or Weapon_1==141544) then
    Num2=Num2+WeaponRefineLv*0.35
  end
  -------------------------------------------------------------熟练者之锤套装
  if Master~=nil then
    if Master:HasBuffID(91000150) then
      Num2=Num2+1.5
    end
  end
 -------------------------------------------------------------羽翼权杖[第二档]
  local Num3 = 1
  if Master~=nil then
    if Master:HasBuffID(90002181) then
      Num3=Num3+0.15
    end
  end
  -------------------------------------------------------------预言者披风
  if Master~=nil then
    if Master:HasBuffID(90002193) then
      Num3=Num3+0.15
    end
  end



  local A = ((MAtkFinal*MDefReduc*(1-MDamReduc2)*(1-RefineMDamReduc)*(damChangePer+Num2)*(1+MDamIncrease)*GameConfig.ElementRestrain[srcAtkElement][targetDefElement]*elementparam2-Vit2/2*(1+VitPer2)-Int2*(1+IntPer2))+damChangePer1)*RuneDamage*Num3



  if 1 >= A then
    return 1
  end

  return A

end
--------------------------------------------------------------------------------------------------------------------------生命体技能
function CommonFun.calcDamage_6106(srcUser, targetUser, params, damageParam, logger)
  local MAtk = srcUser:GetProperty("MAtk")
  local MAtkPer = srcUser:GetProperty("MAtkPer")
  local MDamIncrease = CommonFun.calcMDamIncrease(srcUser, targetUser)
  local IgnoreMDef = srcUser:GetProperty("IgnoreMDef")
  if IgnoreMDef >= 1 then
     IgnoreMDef  = 1
  end
  local skilllv = srcUser:GetLernedSkillLevel(445)

  MAtk = MAtk * (1+MAtkPer)

  local srcAtkElement    = CommonFun.GetUserAtkAttr(srcUser, params, damageParam)
  local targetDefElement = targetUser:GetProperty("DefAttr")
  ----------------------------------------------------------------------------------------------------------------种族，体型，属性，BOSS减伤效果
  local elementparam2 = CommonFun.CalcElementParam2(srcUser, targetUser, params, damageParam, logger)

  ----------------------------------------------------------------------------------------------------------------法系职业伤害会受到种族加伤减伤影响
  local raceparam     = CommonFun.CalcRaceParam(srcUser, targetUser, params, damageParam, logger)
  local raceparam2    = CommonFun.CalcRaceParam2(srcUser, targetUser, params, damageParam, logger)


  local MDef2 = targetUser:GetProperty("MDef")
  local MDefPer2 = targetUser:GetProperty("MDefPer")
  local Vit2 = targetUser:GetProperty("Vit")
  local VitPer2 = targetUser:GetProperty("VitPer")
  local Int2 = targetUser:GetProperty("Int")
  local IntPer2 = targetUser:GetProperty("IntPer")
  local MDamReduc2 = CommonFun.calcMDamReDuc(srcUser, targetUser)
  local RefineMDamReduc = targetUser:GetProperty("RefineMDamReduc")
  local damChangePer  = damageParam.damChangePer

  local MAtkFinal=MAtk*raceparam

  ----------------------------魔法防御减免
  local MDefReduc = CommonFun.CalcMDef(MDef,Int,Vit,srcUser,targetUser)


  local A = (MAtkFinal*MDefReduc*(1-MDamReduc2)*(1-RefineMDamReduc)*damChangePer*(1+MDamIncrease)*GameConfig.ElementRestrain[srcAtkElement][targetDefElement]*elementparam2-Vit2/2*(1+VitPer2)-Int2*(1+IntPer2))


  if 1 >= A then
    return 1
  end

  return A

end

-----------------------------------------------------------------------------------------------------------------旋风斧技能伤害计算公式(已改)
function CommonFun.calcDamage_6301(srcUser, targetUser, params, damageParam, logger)
  local Str = srcUser:GetProperty("Str")
  local Dex = srcUser:GetProperty("Dex")
  local Luk = srcUser:GetProperty("Luk")
  local Atk = srcUser:GetProperty("Atk")
  local AtkPer = srcUser:GetProperty("AtkPer")
  local DamIncrease = srcUser:GetProperty("DamIncrease")
  local WeaponType =srcUser:GetEquipedWeaponType()
  local IgnoreDef  = 0
  local IgnoreDef1 = srcUser:GetProperty("IgnoreDef")
  local IgnoreDef2 = srcUser:GetProperty("IgnoreEquipDef")
  if targetUser.boss or targetUser.mini then
     IgnoreDef=IgnoreDef1
  else
     IgnoreDef=(IgnoreDef1+IgnoreDef2)
  end

  if IgnoreDef >= 1 then
     IgnoreDef=1
  end
    ------------------------------------------------------------------------------------将原来的物伤加成改成精炼物理攻击
  local Refine = srcUser:GetProperty("Refine")

  local Def2 = targetUser:GetProperty("Def")
  local DefPer2 = targetUser:GetProperty("DefPer")
  local Vit2 = targetUser:GetProperty("Vit")
  local VitPer2 = targetUser:GetProperty("VitPer")
  local DamReduc2 = CommonFun.calcDamReDuc(srcUser, targetUser)
  local RefineDamReduc = targetUser:GetProperty("RefineDamReduc")

  local damChangePer = damageParam.damChangePer

  ----------------------------------------------------------------------------------------------------------------种族，体型，属性，BOSS加伤效果
  local raceparam     = CommonFun.CalcRaceParam(srcUser, targetUser, params, damageParam, logger)
  local bodyparam     = CommonFun.CalcBodyParam(srcUser, targetUser, params, damageParam, logger)
  local elementparam  = CommonFun.CalcElementParam(srcUser, targetUser, params, damageParam, logger)
  local bossparam     = CommonFun.CalcBossParam(srcUser, targetUser, params, damageParam, logger)

  ----------------------------------------------------------------------------------------------------------------种族，体型，属性，BOSS减伤效果
  local raceparam2    = CommonFun.CalcRaceParam2(srcUser, targetUser, params, damageParam, logger)
  local bodyparam2    = CommonFun.CalcBodyParam2(srcUser, targetUser, params, damageParam, logger)
  local elementparam2 = CommonFun.CalcElementParam2(srcUser, targetUser, params, damageParam, logger)
  local bossparam2    = CommonFun.CalcBossParam2(srcUser, targetUser, params, damageParam, logger)


  local BaseAtk  = Str*2 + math.floor(Str*Str/100) + math.floor(Dex/5) + math.floor(Luk/5)
  local AtkFinal = ((Atk-BaseAtk)*(1+AtkPer)*CommonFun.ShapeCorrection(srcUser,targetUser)*bodyparam*elementparam*elementparam2+BaseAtk)*raceparam*bossparam*bossparam2

  ----------------------------物理防御减免
  local DefReduc= CommonFun.CalcDef(Def,Vit,srcUser,targetUser)
  ----------------------------------------------------------------------------------------------------------------旋风斧星盘伤害
  local Num1 = srcUser:GetRunePoint(62060)
  local Num2 = srcUser:GetRunePoint(62061)
  local Num3 = srcUser:GetRunePoint(62062)
  local Num4 = srcUser:GetRunePoint(62063)
  local Num5 = srcUser:GetRunePoint(62064)
  local Num6 = srcUser:GetRunePoint(62070)

  local RuneDamage = 0.4*(Num1+Num2+Num3+Num4+Num5)+0.05*Num6

  local A = ((AtkFinal*DefReduc*(1-DamReduc2)+Refine)*damChangePer*(1-RefineDamReduc)*(1+DamIncrease)-Vit2*(1+VitPer2))*RuneDamage

   if 1 >= A then
         return 1
   end

   return A
end

-----------------------------------------------------------------------------------------------------------------分裂斧普攻及技能伤害计算公式(已改)
function CommonFun.calcDamage_6302(srcUser, targetUser, params, damageParam, logger)
  local Str1 = srcUser:GetProperty("Str")
  --------------------------------------------------------------------------------------------------------商人星盘加成的力量转换的普攻加成率提升百分比
  local Num1 = srcUser:GetRunePoint(62080)
  local RuneDamage = Num1*0.01 + 1
  local Str = Str1*RuneDamage
  ---------------------------------------
  local Dex = srcUser:GetProperty("Dex")
  local Luk = srcUser:GetProperty("Luk")
  local Atk = srcUser:GetProperty("Atk")
  local AtkPer = srcUser:GetProperty("AtkPer")
  local DamIncrease = srcUser:GetProperty("DamIncrease")
  local WeaponType =srcUser:GetEquipedWeaponType()
  local IgnoreDef  = 0
  local IgnoreDef1 = srcUser:GetProperty("IgnoreDef")
  local IgnoreDef2 = srcUser:GetProperty("IgnoreEquipDef")
  if targetUser.boss or targetUser.mini then
     IgnoreDef=IgnoreDef1
  else
     IgnoreDef=(IgnoreDef1+IgnoreDef2)
  end

  if IgnoreDef >= 1 then
     IgnoreDef=1
  end
  ------------------------------------------------------------------------------------将原来的物伤加成改成精炼物理攻击
  local Refine = srcUser:GetProperty("Refine")

  local Def2 = targetUser:GetProperty("Def")
  local DefPer2 = targetUser:GetProperty("DefPer")
  local Vit2 = targetUser:GetProperty("Vit")
  local VitPer2 = targetUser:GetProperty("VitPer")
  local DamReduc2 = CommonFun.calcDamReDuc(srcUser, targetUser)
  local RefineDamReduc = targetUser:GetProperty("RefineDamReduc")
  local damChangePer = damageParam.damChangePer

  ----------------------------------------------------------------------------------------------------------------种族，体型，属性，BOSS加伤效果
  local raceparam     = CommonFun.CalcRaceParam(srcUser, targetUser, params, damageParam, logger)
  local bodyparam     = CommonFun.CalcBodyParam(srcUser, targetUser, params, damageParam, logger)
  local elementparam  = CommonFun.CalcElementParam(srcUser, targetUser, params, damageParam, logger)
  local bossparam     = CommonFun.CalcBossParam(srcUser, targetUser, params, damageParam, logger)

  ----------------------------------------------------------------------------------------------------------------种族，体型，属性，BOSS减伤效果
  local raceparam2    = CommonFun.CalcRaceParam2(srcUser, targetUser, params, damageParam, logger)
  local bodyparam2    = CommonFun.CalcBodyParam2(srcUser, targetUser, params, damageParam, logger)
  local elementparam2 = CommonFun.CalcElementParam2(srcUser, targetUser, params, damageParam, logger)
  local bossparam2    = CommonFun.CalcBossParam2(srcUser, targetUser, params, damageParam, logger)



  local BaseAtk  = Str*2 + math.floor(Str*Str/100) + math.floor(Dex/5) + math.floor(Luk/5)
  local AtkFinal = ((Atk-BaseAtk)*(1+AtkPer)*CommonFun.ShapeCorrection(srcUser,targetUser)*bodyparam*elementparam*elementparam2+BaseAtk)*raceparam*bossparam*bossparam2

  ----------------------------物理防御减免
  local DefReduc= CommonFun.CalcDef(Def,Vit,srcUser,targetUser)
  ------------------------------------------------------------------------------------------------------------------星盘分裂斧溅射伤害
  local Num1 = srcUser:GetRunePoint(62090)
  local Num2 = srcUser:GetRunePoint(62091)
  local Num3 = srcUser:GetRunePoint(62092)
  local Num4 = srcUser:GetRunePoint(62100)

  local RuneDamage = (Num1+Num2+Num3)*0.05+Num4*0.03

  local A = ((AtkFinal*DefReduc*(1-DamReduc2)+Refine)*damChangePer*(1-RefineDamReduc)*(1+DamIncrease)-Vit2*(1+VitPer2))*RuneDamage

   if 1 >= A then
         return 1
   end

   return A
end
-------------------------------------------------------------------------------------------------------------------------------------机械维修
function CommonFun.calcDamage_6401(srcUser, targetUser, params, damageParam, logger)
  local Int = srcUser:GetProperty("Int")
  local MaxHp = targetUser:GetProperty("MaxHp")

  local damChangePer = damageParam.damChangePer
  local Num = srcUser:GetRunePoint(64020)

    local mapid,maptype = srcUser:GetMapInfo()-----------------获取所在地图
    local pvpRatio = 1
    ------------------------maptype 1 :野外 2：pvp 3:其他普通副本 4:gvg
    if maptype==2 or maptype==4 then
        pvpRatio = 0.25
    end

    local rune = 1

    if srcUser:HasBuffID(850004) then --------------------精准维修符文
      rune = 2
    end

  local A = -MaxHp*((damChangePer)*(1+Int/100)*(1+0.05*Num)*pvpRatio)*rune

  return A
end
-----------------------------------------------------------------------------------------------------------------自爆 伤害公式(已改)
function CommonFun.calcDamage_6402(srcUser, targetUser, params, damageParam, logger)
  local Str = srcUser:GetProperty("Str")
  local Dex = srcUser:GetProperty("Dex")
  local Luk = srcUser:GetProperty("Luk")
  local Atk = srcUser:GetProperty("Atk")
  local AtkPer = srcUser:GetProperty("AtkPer")
  local DamIncrease = srcUser:GetProperty("DamIncrease")
  local IgnoreDef  = 0
  local IgnoreDef1 = srcUser:GetProperty("IgnoreDef")
  local IgnoreDef2 = srcUser:GetProperty("IgnoreEquipDef")
  if targetUser.boss or targetUser.mini then
     IgnoreDef=IgnoreDef1
  else
     IgnoreDef=(IgnoreDef1+IgnoreDef2)
  end

  if IgnoreDef >= 1 then
     IgnoreDef=1
  end
    ------------------------------------------------------------------------------------将原来的物伤加成改成精炼物理攻击
  local Refine = srcUser:GetProperty("Refine")

  local Def2 = targetUser:GetProperty("Def")
  local DefPer2 = targetUser:GetProperty("DefPer")
  local Vit2 = targetUser:GetProperty("Vit")
  local VitPer2 = targetUser:GetProperty("VitPer")
  local DamReduc2 = CommonFun.calcDamReDuc(srcUser, targetUser)
  local RefineDamReduc = targetUser:GetProperty("RefineDamReduc")

  local damChangePer = damageParam.damChangePer
  local Weapon=srcUser:GetEquipedID(7)
  local RefineLv=srcUser:GetEquipedRefineLv(7)
  ----------------------------------------------------------------------------------------------------------------种族，体型，属性，BOSS加伤效果
  local raceparam     = CommonFun.CalcRaceParam(srcUser, targetUser, params, damageParam, logger)
  local bodyparam     = CommonFun.CalcBodyParam(srcUser, targetUser, params, damageParam, logger)
  local elementparam  = CommonFun.CalcElementParam(srcUser, targetUser, params, damageParam, logger)
  local bossparam     = CommonFun.CalcBossParam(srcUser, targetUser, params, damageParam, logger)

  ----------------------------------------------------------------------------------------------------------------种族，体型，属性，BOSS减伤效果
  local raceparam2    = CommonFun.CalcRaceParam2(srcUser, targetUser, params, damageParam, logger)
  local bodyparam2    = CommonFun.CalcBodyParam2(srcUser, targetUser, params, damageParam, logger)
  local elementparam2 = CommonFun.CalcElementParam2(srcUser, targetUser, params, damageParam, logger)
  local bossparam2    = CommonFun.CalcBossParam2(srcUser, targetUser, params, damageParam, logger)



  local BaseAtk  = Str*2 + math.floor(Str*Str/100) + math.floor(Dex/5) + math.floor(Luk/5)
  local AtkFinal = ((Atk-BaseAtk)*(1+AtkPer)*CommonFun.ShapeCorrection(srcUser,targetUser)*bodyparam*elementparam*elementparam2+BaseAtk)*raceparam*bossparam*bossparam2

  ----------------------------物理防御减免
  local DefReduc= CommonFun.CalcDef(Def,Vit,srcUser,targetUser)

  local Sp = srcUser:GetProperty("Sp")
  local Hp = srcUser:GetProperty("Hp")
  local Vit = srcUser:GetProperty("Vit")

    local mapid,maptype = srcUser:GetMapInfo()-----------------获取所在地图
    local pvpRatio = 1
    ------------------------maptype 1 :野外 2：pvp 3:其他普通副本 4:gvg
    if maptype==2 or maptype==4 then
        pvpRatio = 0.25
    end
   -------------------------------------------------------工程扳手
  local  Wrench = 1
  local Ring7=srcUser:GetEquipedID(7)
  local RefineLv7=srcUser:GetEquipedRefineLv(7)
  if ( Ring7==41556 or Ring7==141556 )  then
       Wrench=Wrench+RefineLv7*0.02
  end
  ------------------------------------------------星盘
  local Num = srcUser:GetRunePoint(64040)
  local RuneDamage = 1 + Num*0.05

  local A = ((AtkFinal*DefReduc*(1-DamReduc2)+Refine)*damChangePer*(Sp/100 + Hp/5000*pvpRatio + Vit/10)*(1-RefineDamReduc)*(1+DamIncrease)-Vit2*(1+VitPer2))*Wrench*RuneDamage


  if 1 >= A then
    return 1
  end

  return A
end
-----------------------------------------------------------------------------------------------------------------喷射飞拳 伤害公式(已改)
function CommonFun.calcDamage_6403(srcUser, targetUser, params, damageParam, logger)
  local Str = srcUser:GetProperty("Str")
  local Dex = srcUser:GetProperty("Dex")
  local Luk = srcUser:GetProperty("Luk")
  local Atk = srcUser:GetProperty("Atk")
  local AtkPer = srcUser:GetProperty("AtkPer")
  local DamIncrease = srcUser:GetProperty("DamIncrease")
  local IgnoreDef  = 0
  local IgnoreDef1 = srcUser:GetProperty("IgnoreDef")
  local IgnoreDef2 = srcUser:GetProperty("IgnoreEquipDef")
  if targetUser.boss or targetUser.mini then
     IgnoreDef=IgnoreDef1
  else
     IgnoreDef=(IgnoreDef1+IgnoreDef2)
  end

  if IgnoreDef >= 1 then
     IgnoreDef=1
  end
    ------------------------------------------------------------------------------------将原来的物伤加成改成精炼物理攻击
  local Refine = srcUser:GetProperty("Refine")

  local Def2 = targetUser:GetProperty("Def")
  local DefPer2 = targetUser:GetProperty("DefPer")
  local Vit2 = targetUser:GetProperty("Vit")
  local VitPer2 = targetUser:GetProperty("VitPer")
  local DamReduc2 = CommonFun.calcDamReDuc(srcUser, targetUser)
  local RefineDamReduc = targetUser:GetProperty("RefineDamReduc")

  local damChangePer = damageParam.damChangePer
  local Weapon=srcUser:GetEquipedID(7)
  local RefineLv=srcUser:GetEquipedRefineLv(7)
  ----------------------------------------------------------------------------------------------------------------种族，体型，属性，BOSS加伤效果
  local raceparam     = CommonFun.CalcRaceParam(srcUser, targetUser, params, damageParam, logger)
  local bodyparam     = CommonFun.CalcBodyParam(srcUser, targetUser, params, damageParam, logger)
  local elementparam  = CommonFun.CalcElementParam(srcUser, targetUser, params, damageParam, logger)
  local bossparam     = CommonFun.CalcBossParam(srcUser, targetUser, params, damageParam, logger)

  ----------------------------------------------------------------------------------------------------------------种族，体型，属性，BOSS减伤效果
  local raceparam2    = CommonFun.CalcRaceParam2(srcUser, targetUser, params, damageParam, logger)
  local bodyparam2    = CommonFun.CalcBodyParam2(srcUser, targetUser, params, damageParam, logger)
  local elementparam2 = CommonFun.CalcElementParam2(srcUser, targetUser, params, damageParam, logger)
  local bossparam2    = CommonFun.CalcBossParam2(srcUser, targetUser, params, damageParam, logger)



  local BaseAtk  = Str*2 + math.floor(Str*Str/100) + math.floor(Dex/5) + math.floor(Luk/5)
  local AtkFinal = ((Atk-BaseAtk)*(1+AtkPer)*CommonFun.ShapeCorrection(srcUser,targetUser)*bodyparam*elementparam*elementparam2+BaseAtk)*raceparam*bossparam*bossparam2

  ----------------------------物理防御减免
  local DefReduc= CommonFun.CalcDef(Def,Vit,srcUser,targetUser)
  ------------------------------------------------星盘
  local Num = srcUser:GetRunePoint(64090)
  local RuneDamage = 1 + Num*0.1

  local A = ((AtkFinal*DefReduc*(1-DamReduc2)+Refine)*(damChangePer+Dex/30)*(1-RefineDamReduc)*(1+DamIncrease)-Vit2*(1+VitPer2))*RuneDamage


  if 1 >= A then
    return 1
  end

  return A
end
-----------------------------------------------------------------------------------------------------------------加农炮 伤害公式(已改)
function CommonFun.calcDamage_6404(srcUser, targetUser, params, damageParam, logger)
  local Str = srcUser:GetProperty("Str")
  local Dex = srcUser:GetProperty("Dex")
  local Luk = srcUser:GetProperty("Luk")
  local Atk = srcUser:GetProperty("Atk")
  local AtkPer = srcUser:GetProperty("AtkPer")
  local DamIncrease = srcUser:GetProperty("DamIncrease")
  local IgnoreDef  = 0
  local IgnoreDef1 = srcUser:GetProperty("IgnoreDef")
  local IgnoreDef2 = srcUser:GetProperty("IgnoreEquipDef")
  if targetUser.boss or targetUser.mini then
     IgnoreDef=IgnoreDef1
  else
     IgnoreDef=(IgnoreDef1+IgnoreDef2)
  end

  if IgnoreDef >= 1 then
     IgnoreDef=1
  end
    ------------------------------------------------------------------------------------将原来的物伤加成改成精炼物理攻击
  local Refine = srcUser:GetProperty("Refine")

  local Def2 = targetUser:GetProperty("Def")
  local DefPer2 = targetUser:GetProperty("DefPer")
  local Vit2 = targetUser:GetProperty("Vit")
  local VitPer2 = targetUser:GetProperty("VitPer")
  local DamReduc2 = CommonFun.calcDamReDuc(srcUser, targetUser)
  local RefineDamReduc = targetUser:GetProperty("RefineDamReduc")

  local damChangePer = damageParam.damChangePer
  local Weapon=srcUser:GetEquipedID(7)
  local RefineLv=srcUser:GetEquipedRefineLv(7)
  ----------------------------------------------------------------------------------------------------------------种族，体型，属性，BOSS加伤效果
  local raceparam     = CommonFun.CalcRaceParam(srcUser, targetUser, params, damageParam, logger)
  local bodyparam     = CommonFun.CalcBodyParam(srcUser, targetUser, params, damageParam, logger)
  local elementparam  = CommonFun.CalcElementParam(srcUser, targetUser, params, damageParam, logger)
  local bossparam     = CommonFun.CalcBossParam(srcUser, targetUser, params, damageParam, logger)

  ----------------------------------------------------------------------------------------------------------------种族，体型，属性，BOSS减伤效果
  local raceparam2    = CommonFun.CalcRaceParam2(srcUser, targetUser, params, damageParam, logger)
  local bodyparam2    = CommonFun.CalcBodyParam2(srcUser, targetUser, params, damageParam, logger)
  local elementparam2 = CommonFun.CalcElementParam2(srcUser, targetUser, params, damageParam, logger)
  local bossparam2    = CommonFun.CalcBossParam2(srcUser, targetUser, params, damageParam, logger)



  local BaseAtk  = Str*2 + math.floor(Str*Str/100) + math.floor(Dex/5) + math.floor(Luk/5)
  local AtkFinal = ((Atk-BaseAtk)*(1+AtkPer)*CommonFun.ShapeCorrection(srcUser,targetUser)*bodyparam*elementparam*elementparam2+BaseAtk)*raceparam*bossparam*bossparam2

  ----------------------------物理防御减免
  local DefReduc= CommonFun.CalcDef(Def,Vit,srcUser,targetUser)

  local sizeCorrection=1
  if nil ~= CommonFun.Shape then
    if CommonFun.Shape.S == targetUser.shape then
        sizeCorrection = 1.5
    elseif CommonFun.Shape.M == targetUser.shape then
        sizeCorrection = 1
    elseif CommonFun.Shape.L == targetUser.shape then
        sizeCorrection = 0.75
    end
  end

  ------------------------------------------------------------毁灭手斧
  local huimie=1
  local RefineLv7=srcUser:GetEquipedRefineLv(7)
  if srcUser:HasBuffID(90000647) then
    if (RefineLv7<15) then
        huimie=RefineLv7*0.01+1+0.05
    elseif RefineLv7 ==15 then
        huimie=RefineLv7*0.01+1+0.05+0.1
    end
  end
  ------------------------------------------------------------天崩地裂
  if srcUser:HasBuffID(41940) then
    if (RefineLv7<15) then
        huimie=RefineLv7*0.01+1+0.05
    elseif RefineLv7 ==15 then
        huimie=RefineLv7*0.01+1+0.05+0.1
    end
  end
  ------------------------------------------------星盘
  local Num = srcUser:GetRunePoint(64070)
  local RuneDamage = 1 + Num*0.1

  local A = ((AtkFinal*DefReduc*(1-DamReduc2)+Refine)*damChangePer*(1-RefineDamReduc)*(1+DamIncrease)-Vit2*(1+VitPer2))*sizeCorrection*huimie*RuneDamage




  if 1 >= A then
    return 1
  end

  return A
end
-- -- -----------------------------------------------------------------------------------------------------新剑士系普通攻击技能伤害公式(暂时未使用该技能)
function CommonFun.calcDamage_1101(srcUser, targetUser, params, damageParam, logger)

  local Int = srcUser:GetProperty("Int")
  local Atk = srcUser:GetProperty("Atk")
  local AtkPer = srcUser:GetProperty("AtkPer")
  local DamIncrease = srcUser:GetProperty("DamIncrease")
  local IgnoreDef  = 0
  local IgnoreDef1 = srcUser:GetProperty("IgnoreDef")
  local IgnoreDef2 = srcUser:GetProperty("IgnoreEquipDef")
  if targetUser.boss or targetUser.mini then
     IgnoreDef=IgnoreDef1
  else
     IgnoreDef=(IgnoreDef1+IgnoreDef2)
  end

  if IgnoreDef >= 1 then
     IgnoreDef  = 1
  end

  local Def2 = targetUser:GetProperty("Def")
  local DefPer2 = targetUser:GetProperty("DefPer")
  local MDef2 = targetUser:GetProperty("MDef")
  local MDefPer2 = targetUser:GetProperty("MDefPer")
  local Vit2 = targetUser:GetProperty("Vit")
  local VitPer2 = targetUser:GetProperty("VitPer")
  local DamReduc2 = CommonFun.calcDamReDuc(srcUser, targetUser)
  local RefineDamReduc = targetUser:GetProperty("RefineDamReduc")
  local skilllv_1 = srcUser:GetLernedSkillLevel(damageParam.skill1_id)
  local skilllv_3 = srcUser:GetLernedSkillLevel(damageParam.skill3_id)

  local damChangePer2 = damageParam.damChangePer2
  local damChangePer3 = damageParam.damChangePer3
  local damChangePer4 = damageParam.damChangePer4

  local raceparam = CommonFun.CalcRaceParam(srcUser, targetUser, params, damageParam, logger)
  local bodyparam = CommonFun.CalcBodyParam(srcUser, targetUser, params, damageParam, logger)
  local bossparam = CommonFun.CalcBossParam(srcUser, targetUser, params, damageParam, logger)
  local elementparam = CommonFun.CalcElementParam(srcUser, targetUser, params, damageParam, logger)

  local AtkFinal =Atk*(1+AtkPer)
  local DefFinal =CommonFun.CalcDef(Def2,Vit2,srcUser,targetUser)*(1+DefPer2)
  local div = AtkFinal+DefFinal*(1-IgnoreDef)
  div = (div ~= 0 and div or 1)
  local skilllv_3_dam=0
  if skilllv_3<=5 then
     skilllv_3_dam=skilllv_3*20
  else
     skilllv_3_dam=(skilllv_3-5)*Int+100
  end

  local A=(AtkFinal*AtkFinal/div)*(1-DamReduc2)*damChangePer2*(1+DamIncrease)*(1-RefineDamReduc)+skilllv_1*damChangePer3+damChangePer4+skilllv_3_dam

  return A*raceparam*bodyparam*bossparam*elementparam

end



-------------------------------------------------------------------------------------------------------------------------------------布点符文开发


-----------------------------------------------------------------------------------------------------------------战士系狂击技能伤害计算公式(已改)
function CommonFun.calcDamage_1102(srcUser, targetUser, params, damageParam, logger)
  local Str = srcUser:GetProperty("Str")
  local Dex = srcUser:GetProperty("Dex")
  local Luk = srcUser:GetProperty("Luk")
  local Atk = srcUser:GetProperty("Atk")
  local AtkPer = srcUser:GetProperty("AtkPer")
  local DamIncrease = srcUser:GetProperty("DamIncrease")
  local IgnoreDef  = 0
  local IgnoreDef1 = srcUser:GetProperty("IgnoreDef")
  local IgnoreDef2 = srcUser:GetProperty("IgnoreEquipDef")
  if targetUser.boss or targetUser.mini then
     IgnoreDef=IgnoreDef1
  else
     IgnoreDef=(IgnoreDef1+IgnoreDef2)
  end

  if IgnoreDef >= 1 then
     IgnoreDef  = 1
  end

  local AttrEffect= srcUser:GetProperty("AttrEffect")
  local bits=CommonFun.getBits(AttrEffect)
    ------------------------------------------------------------------------------------将原来的物伤加成改成精炼物理攻击
  local Refine = srcUser:GetProperty("Refine")

  local Def2 = targetUser:GetProperty("Def")
  local DefPer2 = targetUser:GetProperty("DefPer")
  local Vit2 = targetUser:GetProperty("Vit")
  local VitPer2 = targetUser:GetProperty("VitPer")
  local DamReduc2 = CommonFun.calcDamReDuc(srcUser, targetUser)
  local RefineDamReduc = targetUser:GetProperty("RefineDamReduc")
  local skilllv_1 = srcUser:GetLernedSkillLevel(damageParam.skill1_id)

  local damChangePer  = damageParam.damChangePer
  local damChangePer1 = damageParam.damChangePer1
  ----------------------------------------------------------------------------------------------------------------种族，体型，属性，BOSS加伤效果
  local raceparam     = CommonFun.CalcRaceParam(srcUser, targetUser, params, damageParam, logger)
  local bodyparam     = CommonFun.CalcBodyParam(srcUser, targetUser, params, damageParam, logger)
  local elementparam  = CommonFun.CalcElementParam(srcUser, targetUser, params, damageParam, logger)
  local bossparam     = CommonFun.CalcBossParam(srcUser, targetUser, params, damageParam, logger)

  ----------------------------------------------------------------------------------------------------------------种族，体型，属性，BOSS减伤效果
  local raceparam2    = CommonFun.CalcRaceParam2(srcUser, targetUser, params, damageParam, logger)
  local bodyparam2    = CommonFun.CalcBodyParam2(srcUser, targetUser, params, damageParam, logger)
  local elementparam2 = CommonFun.CalcElementParam2(srcUser, targetUser, params, damageParam, logger)
  local bossparam2    = CommonFun.CalcBossParam2(srcUser, targetUser, params, damageParam, logger)
  ----------------------------------------------------------------------附魔之刃
  local skilllv_fumo = srcUser:GetLernedSkillLevel(1263)-------附魔
  local MAtk = srcUser:GetProperty("MAtk")
  local MAtkPer = srcUser:GetProperty("MAtkPer")
  local Num = srcUser:GetRunePoint(14060)
  local MAtk_fumo = 0
  if srcUser:HasBuffID(117630) then
      MAtk_fumo = MAtk*(1+MAtkPer)*skilllv_fumo*0.1*(1+Num/20)
  end

  local BaseAtk  = Str*2 + math.floor(Str*Str/100) + math.floor(Dex/5) + math.floor(Luk/5)
  local AtkFinal = ((Atk-BaseAtk)*(1+AtkPer)*CommonFun.ShapeCorrection(srcUser,targetUser)*bodyparam*elementparam*elementparam2+BaseAtk+MAtk_fumo)*raceparam*bossparam*bossparam2

  ----------------------------物理防御减免
  local DefReduc= CommonFun.CalcDef(Def,Vit,srcUser,targetUser)

  local A = (AtkFinal*DefReduc*(1-DamReduc2)+Refine)*damChangePer*(1+DamIncrease)+damChangePer1-Vit2*(1+VitPer2)

   if 1 >= A then
         return 1
   end

  local Buff = srcUser:HasBuffID(80000550)
  local Weapon=srcUser:GetEquipedID(7)
  local B = 1
  if CommonFun.Shape.M == targetUser.shape and (Weapon==40308 or Weapon==140308) then
     B=1.5
  end
  ------------------------------------------狂怒之刃[1]
  if CommonFun.Shape.M == targetUser.shape and (Weapon==40359 or Weapon==140359) then
     B=1.5
  end

  local Num1  = srcUser:GetRunePoint(11001)
  local Num2  = srcUser:GetRunePoint(11004)
  local Num3  = srcUser:GetRunePoint(11005)
  local Num4  = srcUser:GetRunePoint(11006)
  local Num5  = srcUser:GetRunePoint(11012)
  local Num6  = srcUser:GetRunePoint(11014)
  local Num7  = srcUser:GetRunePoint(11015)
  local Num8  = srcUser:GetRunePoint(11018)
  local Num9  = srcUser:GetRunePoint(11019)
  local Num10 = srcUser:GetRunePoint(11025)
  local RuneDamage = (Num1 + Num2 + Num3 + Num4 + Num5 + Num6 + Num7 + Num8 + Num9 + Num10)*(0.1) + 1
  -----------------------------------------------------------------------------------------------------------------------狂击效果[装备狂击之剑]     + 狂击等级>=10 + 妖道卡片BUFF
  -----------------------------------------------------------------------------------------------------------------------装备尖刃多刺刀             + 狂击等级>=10 + 妖道卡片BUFF
  -----------------------------------------------------------------------------------------------------------------------有狂击效果[装备狂击之剑]   + 狂击等级>=10
  -----------------------------------------------------------------------------------------------------------------------装备尖刃多刺刀             + 狂击等级>=10
  -----------------------------------------------------------------------------------------------------------------------妖道卡片BUFF
   -----------------------------------------------------------------------------------------------------------------------狂怒之刃[1]
  if      bits[CommonFun.AttrEffect.KuangJiDam]==1 and skilllv_1>=10 and Buff==true  then
             return (A + Str*20)*(1 + 0.5 ) * RuneDamage * (1-RefineDamReduc)
  elseif  (Weapon==40308 or Weapon==140308) and skilllv_1>=10 and Buff==true  then
             return (A + Str*20)*(1 + 1) * B * RuneDamage *(1-RefineDamReduc)
  elseif  (Weapon==40359 or Weapon==140359) and skilllv_1>=10 and Buff==true  then
             return (A + Str*20)*(1 + 1) * B * RuneDamage *(1-RefineDamReduc)
  elseif  bits[CommonFun.AttrEffect.KuangJiDam]==1 and skilllv_1>=10  then
             return A*(1 + 0.5 ) * RuneDamage * (1-RefineDamReduc)
  elseif  (Weapon==40308 or Weapon==140308) and skilllv_1>=10   then
             return A*(1 + 1) * B * RuneDamage * (1-RefineDamReduc)
  elseif  (Weapon==40359 or Weapon==140359) and skilllv_1>=10   then
             return A*(1 + 1) * B * RuneDamage * (1-RefineDamReduc)
  elseif  Buff==true then
             return (A + Str*20) * RuneDamage * (1-RefineDamReduc)
  end

   return A * RuneDamage * (1-RefineDamReduc)
end

-------------------------------------------------------------------------------------------------------------------------剑士系怒爆伤害公式
function CommonFun.calcDamage_1103(srcUser, targetUser, params, damageParam, logger)
  local Str = srcUser:GetProperty("Str")
  local Dex = srcUser:GetProperty("Dex")
  local Luk = srcUser:GetProperty("Luk")
  local Atk = srcUser:GetProperty("Atk")
  local AtkPer = srcUser:GetProperty("AtkPer")
  local DamIncrease = srcUser:GetProperty("DamIncrease")
  local IgnoreDef  = 0
  local IgnoreDef1 = srcUser:GetProperty("IgnoreDef")
  local IgnoreDef2 = srcUser:GetProperty("IgnoreEquipDef")
  if targetUser.boss or targetUser.mini then
     IgnoreDef=IgnoreDef1
  else
     IgnoreDef=(IgnoreDef1+IgnoreDef2)
  end

  if IgnoreDef >= 1 then
     IgnoreDef=1
  end
    ------------------------------------------------------------------------------------将原来的物伤加成改成精炼物理攻击
  local Refine = srcUser:GetProperty("Refine")

  local Def2 = targetUser:GetProperty("Def")
  local DefPer2 = targetUser:GetProperty("DefPer")
  local Vit2 = targetUser:GetProperty("Vit")
  local VitPer2 = targetUser:GetProperty("VitPer")
  local DamReduc2 = CommonFun.calcDamReDuc(srcUser, targetUser)
  local RefineDamReduc = targetUser:GetProperty("RefineDamReduc")

  local damChangePer = damageParam.damChangePer

  ----------------------------------------------------------------------------------------------------------------种族，体型，属性，BOSS加伤效果
  local raceparam     = CommonFun.CalcRaceParam(srcUser, targetUser, params, damageParam, logger)
  local bodyparam     = CommonFun.CalcBodyParam(srcUser, targetUser, params, damageParam, logger)
  local elementparam  = CommonFun.CalcElementParam(srcUser, targetUser, params, damageParam, logger)
  local bossparam     = CommonFun.CalcBossParam(srcUser, targetUser, params, damageParam, logger)

  ----------------------------------------------------------------------------------------------------------------种族，体型，属性，BOSS减伤效果
  local raceparam2    = CommonFun.CalcRaceParam2(srcUser, targetUser, params, damageParam, logger)
  local bodyparam2    = CommonFun.CalcBodyParam2(srcUser, targetUser, params, damageParam, logger)
  local elementparam2 = CommonFun.CalcElementParam2(srcUser, targetUser, params, damageParam, logger)
  local bossparam2    = CommonFun.CalcBossParam2(srcUser, targetUser, params, damageParam, logger)



  local BaseAtk  = Str*2 + math.floor(Str*Str/100) + math.floor(Dex/5) + math.floor(Luk/5)
  local AtkFinal = ((Atk-BaseAtk)*(1+AtkPer)*CommonFun.ShapeCorrection(srcUser,targetUser)*bodyparam*elementparam*elementparam2+BaseAtk)*raceparam*bossparam*bossparam2

  ----------------------------物理防御减免
  local DefReduc= CommonFun.CalcDef(Def,Vit,srcUser,targetUser)

  local A = (AtkFinal*DefReduc*(1-DamReduc2)+Refine)*damChangePer*(1-RefineDamReduc)*(1+DamIncrease)-Vit2*(1+VitPer2)
   -----------------------------------------------------------------------------------------------------------------气泡虫怒爆伤害增加
   local Buff = srcUser:HasBuffID(80001190)
   if Buff==true then
      return A*1.5
   end

   if 1 >= A then
         return 1
   end

   return A
end

-----------------------------------------------------------------------------------新连刺攻击技能伤害计算公式
-----------------------------------------------------------------------------------技能公式调整,技能PD伤害值考虑伤害减免效果
function CommonFun.calcDamage_1201(srcUser, targetUser, params, damageParam, logger)
  -----------------sizeCorrection这个参数和之前的公式中参数定义一样,也是小体型1倍,中体型2倍,大体型3倍伤害(已改)
  local Str = srcUser:GetProperty("Str")
  local Dex = srcUser:GetProperty("Dex")
  local Luk = srcUser:GetProperty("Luk")
  local Atk = srcUser:GetProperty("Atk")
  local AtkPer = srcUser:GetProperty("AtkPer")
  local DamIncrease = srcUser:GetProperty("DamIncrease")
  local IgnoreDef  = 0
  local IgnoreDef1 = srcUser:GetProperty("IgnoreDef")
  local IgnoreDef2 = srcUser:GetProperty("IgnoreEquipDef")
  if targetUser.boss or targetUser.mini then
     IgnoreDef=IgnoreDef1
  else
     IgnoreDef=(IgnoreDef1+IgnoreDef2)
  end

  if IgnoreDef >= 1 then
     IgnoreDef  = 1
  end

  local Refine = srcUser:GetProperty("Refine")


  local Def2 = targetUser:GetProperty("Def")
  local DefPer2 = targetUser:GetProperty("DefPer")
  local Vit2 = targetUser:GetProperty("Vit")
  local VitPer2 = targetUser:GetProperty("VitPer")
  local DamReduc2 = CommonFun.calcDamReDuc(srcUser, targetUser)
  local RefineDamReduc = targetUser:GetProperty("RefineDamReduc")
  local damChangePer = damageParam.damChangePer

  ----------------------------------------------------------------------------------------------------------------种族，体型，属性，BOSS加伤效果
  local raceparam     = CommonFun.CalcRaceParam(srcUser, targetUser, params, damageParam, logger)
  local bodyparam     = CommonFun.CalcBodyParam(srcUser, targetUser, params, damageParam, logger)
  local elementparam  = CommonFun.CalcElementParam(srcUser, targetUser, params, damageParam, logger)
  local bossparam     = CommonFun.CalcBossParam(srcUser, targetUser, params, damageParam, logger)

  ----------------------------------------------------------------------------------------------------------------种族，体型，属性，BOSS减伤效果
  local raceparam2    = CommonFun.CalcRaceParam2(srcUser, targetUser, params, damageParam, logger)
  local bodyparam2    = CommonFun.CalcBodyParam2(srcUser, targetUser, params, damageParam, logger)
  local elementparam2 = CommonFun.CalcElementParam2(srcUser, targetUser, params, damageParam, logger)
  local bossparam2    = CommonFun.CalcBossParam2(srcUser, targetUser, params, damageParam, logger)

  -------------------------------------------------------------------------------死神之镰
  -------------------------------------------------------------------------------斧锤长矛
  -------------------------------------------------------------------------------戮魂长矛

 local sizeCorrection=1
  if nil ~= CommonFun.Shape then
    if CommonFun.Shape.S == targetUser.shape then
        sizeCorrection = 1
    elseif CommonFun.Shape.M == targetUser.shape then
     if srcUser:HasBuffID(91000170) or srcUser:HasBuffID(91000540) then
        sizeCorrection = 2*1.1
      elseif srcUser:HasBuffID(90001983) then
        sizeCorrection = 2*1.3
      else sizeCorrection = 2
        end
    elseif CommonFun.Shape.L == targetUser.shape then
      if srcUser:HasBuffID(41721) then
        sizeCorrection = 3*1.7
      elseif srcUser:HasBuffID(90001173) then
        sizeCorrection = 3*1.7
      elseif srcUser:HasBuffID(90001172) then
        sizeCorrection = 3*1.45
      elseif srcUser:HasBuffID(90001171) then
        sizeCorrection = 3*1.25
      elseif srcUser:HasBuffID(90001170) then
        sizeCorrection = 3*1.1
      else sizeCorrection = 3
      end

    end
  end
  ---------------------------------------------------------------------伤害加深 印记
  local Sign = 1
  local Num1 = targetUser:GetBuffLayer(117660)--------------------------印记
  local fromid = targetUser:GetBuffFromID(117660)
  local guid = srcUser:GetGuid()

  local skilllv_1 = srcUser:GetLernedSkillLevel(1267)----伤害加深

  if fromid==guid then
    local fuwen = 0
    if srcUser:HasBuffID(820006) then
      fuwen=0.05
    end
    Sign = 1+(skilllv_1*0.01+0.02+fuwen)*Num1
  end
  ------------------------------------------------------------------------
  local BaseAtk  = Str*2 + math.floor(Str*Str/100) + math.floor(Dex/5) + math.floor(Luk/5)
  local AtkFinal = ((Atk-BaseAtk)*(1+AtkPer)*CommonFun.ShapeCorrection(srcUser,targetUser)*bodyparam*elementparam*elementparam2+BaseAtk)*raceparam*bossparam*bossparam2

  ----------------------------物理防御减免
  local DefReduc= CommonFun.CalcDef(Def,Vit,srcUser,targetUser)

  local A = ((AtkFinal*DefReduc*(1-DamReduc2)+Refine)*damChangePer*(1-RefineDamReduc)*(1+DamIncrease)-Vit2*(1+VitPer2))*sizeCorrection*Sign

  if 1 >= A then
    return 1
  end

  return A

end

------------------------------------------------------------------------------新怪物互击技能伤害公式（已改）
function CommonFun.calcDamage_1202(srcUser, targetUser, params, damageParam, logger)
  local Str = srcUser:GetProperty("Str")
  local Dex = srcUser:GetProperty("Dex")
  local Luk = srcUser:GetProperty("Luk")
  local Atk = srcUser:GetProperty("Atk")
  local AtkPer = srcUser:GetProperty("AtkPer")
  local DamIncrease = srcUser:GetProperty("DamIncrease")
  local IgnoreDef  = 0
  local IgnoreDef1 = srcUser:GetProperty("IgnoreDef")
  local IgnoreDef2 = srcUser:GetProperty("IgnoreEquipDef")
  if targetUser.boss or targetUser.mini then
     IgnoreDef=IgnoreDef1
  else
     IgnoreDef=(IgnoreDef1+IgnoreDef2)
  end

  if IgnoreDef >= 1 then
     IgnoreDef  = 1
  end

  local Refine = srcUser:GetProperty("Refine")
  local skilllv_1 = srcUser:GetLernedSkillLevel(damageParam.skill1_id)


  local AttrEffect= srcUser:GetProperty("AttrEffect")
  local bits=CommonFun.getBits(AttrEffect)

  local Def2 = targetUser:GetProperty("Def")
  local DefPer2 = targetUser:GetProperty("DefPer")
  local Vit2 = targetUser:GetProperty("Vit")
  local VitPer2 = targetUser:GetProperty("VitPer")
  local DamReduc2 = CommonFun.calcDamReDuc(srcUser, targetUser)
  local RefineDamReduc = targetUser:GetProperty("RefineDamReduc")

  local HumanRes = targetUser:GetProperty("DemiHumanResPer")
  local count=params.hitedCount


  local damChangePer = damageParam.damChangePer
  local damChangePer1 = damageParam.damChangePer1

  ----------------------------------------------------------------------------------------------------------------种族，体型，属性，BOSS加伤效果
  local raceparam     = CommonFun.CalcRaceParam(srcUser, targetUser, params, damageParam, logger)
  local bodyparam     = CommonFun.CalcBodyParam(srcUser, targetUser, params, damageParam, logger)
  local elementparam  = CommonFun.CalcElementParam(srcUser, targetUser, params, damageParam, logger)
  local bossparam     = CommonFun.CalcBossParam(srcUser, targetUser, params, damageParam, logger)

  ----------------------------------------------------------------------------------------------------------------种族，体型，属性，BOSS减伤效果
  local raceparam2    = CommonFun.CalcRaceParam2(srcUser, targetUser, params, damageParam, logger)
  local bodyparam2    = CommonFun.CalcBodyParam2(srcUser, targetUser, params, damageParam, logger)
  local elementparam2 = CommonFun.CalcElementParam2(srcUser, targetUser, params, damageParam, logger)
  local bossparam2    = CommonFun.CalcBossParam2(srcUser, targetUser, params, damageParam, logger)

  local BaseAtk  = Str*2 + math.floor(Str*Str/100) + math.floor(Dex/5) + math.floor(Luk/5)
  local AtkFinal = ((Atk-BaseAtk)*(1+AtkPer)*CommonFun.ShapeCorrection(srcUser,targetUser)*bodyparam*elementparam*elementparam2+BaseAtk)*raceparam*bossparam*bossparam2

  ----------------------------物理防御减免
  local DefReduc= CommonFun.CalcDef(Def,Vit,srcUser,targetUser)

  local countDam = 0.1
  if skilllv_1>10 then
      countDam = 0.3
  end

  local A = (AtkFinal*DefReduc*(1-DamReduc2)+Refine)*(damChangePer+countDam*count)*(1-RefineDamReduc)*(1+DamIncrease)-Vit2*(1+VitPer2)

  ----------------------------------------------------------------------------------------------------------------达拉蛙存储减少怪物互击伤害
  local B = 0
  local Buff = targetUser:HasBuffID(80000240)
  local Weapon=srcUser:GetEquipedID(7)

  if Buff==true then
        B = HumanRes*100*20
  end

  if 1 >= (A-B) then
         return 1
  end

----------------------------------------------------------------------------多刃尖刺刀第4档（怪物互击对中型魔物额外增加伤害10%）
  local guaiwuhujiM = 1
  if CommonFun.Shape.M == targetUser.shape and srcUser:HasBuffID(90001163) then
     guaiwuhujiM=1.1
   end

----------------------------------------------------------------------------狂怒之刃（怪物互击对中型魔物额外增加伤害10%）
   if CommonFun.Shape.M == targetUser.shape and (Weapon==40359 or Weapon==140359)  then
     guaiwuhujiM=1.1
   end




  ---------------------------------------------------------------------------------------------------------------------装备或卡片上有怪物互击加伤百分比的效果
  ---------------------------------------------------------------------------------------------------------------------装备尖刃多刺刀 +技能等级>=10
  ---------------------------------------------------------------------------------------------------------------------狂怒之刃[1]
  if      bits[CommonFun.AttrEffect.GuaiWuHuJiDam]==1 and skilllv_1>=10 then
             return (A-B)*(1 + 0.3)*guaiwuhujiM
  elseif  (Weapon==40308 or Weapon== 140308) and skilllv_1 >=10 then
             return (A-B)*(1 + 1)*guaiwuhujiM
  elseif  (Weapon==40359 or Weapon== 140359) and skilllv_1 >=10 then
             return (A-B)*(1 + 1)*guaiwuhujiM
  end


   return (A-B)*guaiwuhujiM

end
-----------------------------------------------------------------------------------------------------------------近战战士系骑乘攻击技能伤害计算公式(已改)
function CommonFun.calcDamage_1203(srcUser, targetUser, params, damageParam, logger)
  local Str = srcUser:GetProperty("Str")
  local Dex = srcUser:GetProperty("Dex")
  local Luk = srcUser:GetProperty("Luk")
  local Atk = srcUser:GetProperty("Atk")
  local AtkPer = srcUser:GetProperty("AtkPer")
  local DamIncrease = srcUser:GetProperty("DamIncrease")
  local IgnoreDef  = 0
  local IgnoreDef1 = srcUser:GetProperty("IgnoreDef")
  local IgnoreDef2 = srcUser:GetProperty("IgnoreEquipDef")
  if targetUser.boss or targetUser.mini then
     IgnoreDef=IgnoreDef1
  else
     IgnoreDef=(IgnoreDef1+IgnoreDef2)
  end

  if IgnoreDef >= 1 then
     IgnoreDef=1
  end
    ------------------------------------------------------------------------------------将原来的物伤加成改成精炼物理攻击
  local Refine = srcUser:GetProperty("Refine")

  local Def2 = targetUser:GetProperty("Def")
  local DefPer2 = targetUser:GetProperty("DefPer")
  local Vit2 = targetUser:GetProperty("Vit")
  local VitPer2 = targetUser:GetProperty("VitPer")
  local DamReduc2 = CommonFun.calcDamReDuc(srcUser, targetUser)
  local RefineDamReduc = targetUser:GetProperty("RefineDamReduc")

  local damChangePer = damageParam.damChangePer

  ----------------------------------------------------------------------------------------------------------------种族，体型，属性，BOSS加伤效果
  local raceparam     = CommonFun.CalcRaceParam(srcUser, targetUser, params, damageParam, logger)
  local bodyparam     = CommonFun.CalcBodyParam(srcUser, targetUser, params, damageParam, logger)
  local elementparam  = CommonFun.CalcElementParam(srcUser, targetUser, params, damageParam, logger)
  local bossparam     = CommonFun.CalcBossParam(srcUser, targetUser, params, damageParam, logger)

  ----------------------------------------------------------------------------------------------------------------种族，体型，属性，BOSS减伤效果
  local raceparam2    = CommonFun.CalcRaceParam2(srcUser, targetUser, params, damageParam, logger)
  local bodyparam2    = CommonFun.CalcBodyParam2(srcUser, targetUser, params, damageParam, logger)
  local elementparam2 = CommonFun.CalcElementParam2(srcUser, targetUser, params, damageParam, logger)
  local bossparam2    = CommonFun.CalcBossParam2(srcUser, targetUser, params, damageParam, logger)



  local BaseAtk  = Str*2 + math.floor(Str*Str/100) + math.floor(Dex/5) + math.floor(Luk/5)
  local AtkFinal = ((Atk-BaseAtk)*(1+AtkPer)*CommonFun.ShapeCorrection(srcUser,targetUser)*bodyparam*elementparam*elementparam2+BaseAtk)*raceparam*bossparam*bossparam2

  ----------------------------物理防御减免
  local DefReduc= CommonFun.CalcDef(Def,Vit,srcUser,targetUser)
  -------------------------------------------------------------------------------------------------------------------------------星盘骑乘攻击
  local Num1 = srcUser:GetRunePoint(11021)
  local RuneDamage = 1
  if CommonFun.Shape.M == targetUser.shape then
      RuneDamage = 0.03*Num1+1
  end

  local A = ((AtkFinal*DefReduc*(1-DamReduc2)+Refine)*damChangePer*(1-RefineDamReduc)*(1+DamIncrease)-Vit2*(1+VitPer2))*RuneDamage

   if 1 >= A then
         return 1
   end

   return A
end

-----------------------------------------------------------------------------------------------------------------近战战士系 巧打 技能伤害计算公式(已改)
function CommonFun.calcDamage_1204(srcUser, targetUser, params, damageParam, logger)
  local Str = srcUser:GetProperty("Str")
  local Dex = srcUser:GetProperty("Dex")
  local Luk = srcUser:GetProperty("Luk")
  local Atk = srcUser:GetProperty("Atk")
  local AtkPer = srcUser:GetProperty("AtkPer")
  local DamIncrease = srcUser:GetProperty("DamIncrease")
  local IgnoreDef  = 0
  local IgnoreDef1 = srcUser:GetProperty("IgnoreDef")
  local IgnoreDef2 = srcUser:GetProperty("IgnoreEquipDef")
  if targetUser.boss or targetUser.mini then
     IgnoreDef=IgnoreDef1
  else
     IgnoreDef=(IgnoreDef1+IgnoreDef2)
  end

  if IgnoreDef >= 1 then
     IgnoreDef=1
  end
    ------------------------------------------------------------------------------------将原来的物伤加成改成精炼物理攻击
  local Refine = srcUser:GetProperty("Refine")

  local Def2 = targetUser:GetProperty("Def")
  local DefPer2 = targetUser:GetProperty("DefPer")
  local Vit2 = targetUser:GetProperty("Vit")
  local VitPer2 = targetUser:GetProperty("VitPer")
  local DamReduc2 = CommonFun.calcDamReDuc(srcUser, targetUser)
  local RefineDamReduc = targetUser:GetProperty("RefineDamReduc")

  local damChangePer = damageParam.damChangePer

  ----------------------------------------------------------------------------------------------------------------种族，体型，属性，BOSS加伤效果
  local raceparam     = CommonFun.CalcRaceParam(srcUser, targetUser, params, damageParam, logger)
  local bodyparam     = CommonFun.CalcBodyParam(srcUser, targetUser, params, damageParam, logger)
  local elementparam  = CommonFun.CalcElementParam(srcUser, targetUser, params, damageParam, logger)
  local bossparam     = CommonFun.CalcBossParam(srcUser, targetUser, params, damageParam, logger)

  ----------------------------------------------------------------------------------------------------------------种族，体型，属性，BOSS减伤效果
  local raceparam2    = CommonFun.CalcRaceParam2(srcUser, targetUser, params, damageParam, logger)
  local bodyparam2    = CommonFun.CalcBodyParam2(srcUser, targetUser, params, damageParam, logger)
  local elementparam2 = CommonFun.CalcElementParam2(srcUser, targetUser, params, damageParam, logger)
  local bossparam2    = CommonFun.CalcBossParam2(srcUser, targetUser, params, damageParam, logger)

  local BaseAtk  = Str*2 + math.floor(Str*Str/100) + math.floor(Dex/5) + math.floor(Luk/5)
  local AtkFinal = ((Atk-BaseAtk)*(1+AtkPer)*CommonFun.ShapeCorrection(srcUser,targetUser)*bodyparam*elementparam*elementparam2+BaseAtk)*raceparam*bossparam*bossparam2

  ----------------------------物理防御减免
  local DefReduc= CommonFun.CalcDef(Def,Vit,srcUser,targetUser)
  --------------------------------------------------------------------------------------------------------------------星盘巧打
  local Num1=srcUser:GetRunePoint(12100)
  local RuneDamage = Num1*0.15+1

  local A = ((AtkFinal*DefReduc*(1-DamReduc2)+Refine)*damChangePer*(1-RefineDamReduc)*(1+DamIncrease)-Vit2*(1+VitPer2))*RuneDamage

   if 1 >= A then
         return 1
   end

   return A
end


-----------------------------------------------------------------------------------------------------------------圣十字审判技能伤害计算公式(已改)
function CommonFun.calcDamage_1205(srcUser, targetUser, params, damageParam, logger)
  local Str = srcUser:GetProperty("Str")
  local Dex = srcUser:GetProperty("Dex")
  local Luk = srcUser:GetProperty("Luk")
  local Atk = srcUser:GetProperty("Atk")
  local AtkPer = srcUser:GetProperty("AtkPer")
  local DamIncrease = srcUser:GetProperty("DamIncrease")
  local Luk = srcUser:GetProperty("Luk")
  local Int = srcUser:GetProperty("Int")
  local Vit = srcUser:GetProperty("Vit")
  local MAtk = srcUser:GetProperty("MAtk")
  local MAtkPer = srcUser:GetProperty("MAtkPer")

  ----------------------------------------------------------------------------------分割线
  local IgnoreDef  = 0
  local IgnoreDef1 = srcUser:GetProperty("IgnoreDef")
  local IgnoreDef2 = srcUser:GetProperty("IgnoreEquipDef")
  if targetUser.boss or targetUser.mini then
     IgnoreDef=IgnoreDef1
  else
     IgnoreDef=(IgnoreDef1+IgnoreDef2)
  end

  if IgnoreDef >= 1 then
     IgnoreDef=1
  end

  -----------------------------------------------------------------------------------分割线
  local MDamIncrease = CommonFun.calcMDamIncrease(srcUser, targetUser)
  local IgnoreMDef = srcUser:GetProperty("IgnoreMDef")
  if IgnoreMDef >= 1 then
     IgnoreMDef  = 1
  end

    ------------------------------------------------------------------------------------将原来的物伤加成改成精炼物理攻击
  local Refine = srcUser:GetProperty("Refine")
    ------------------------------------------------------------------------------------将原来的物伤加成改成精炼物理攻击
  local MRefine = srcUser:GetProperty("MRefine")
   --------------------------------------------------------------------------------------------------------物理防御减免
  local Def2 = targetUser:GetProperty("Def")
  local DefPer2 = targetUser:GetProperty("DefPer")
  local Vit2 = targetUser:GetProperty("Vit")
  local VitPer2 = targetUser:GetProperty("VitPer")
  local DamReduc2 = CommonFun.calcDamReDuc(srcUser, targetUser)
  local RefineDamReduc = targetUser:GetProperty("RefineDamReduc")
   --------------------------------------------------------------------------------------------------------魔法防御减免
  local MDef2 = targetUser:GetProperty("MDef")
  local MDefPer2 = targetUser:GetProperty("MDefPer")
  local Vit2 = targetUser:GetProperty("Vit")
  local VitPer2 = targetUser:GetProperty("VitPer")
  local Int2 = targetUser:GetProperty("Int")
  local IntPer2 = targetUser:GetProperty("IntPer")
  local MDamReduc2 = CommonFun.calcMDamReDuc(srcUser, targetUser)
  local RefineMDamReduc = targetUser:GetProperty("RefineMDamReduc")

  local damChangePer = damageParam.damChangePer

  ----------------------------------------------------------------------------------------------------------------种族，体型，属性，BOSS加伤效果
  local raceparam     = CommonFun.CalcRaceParam(srcUser, targetUser, params, damageParam, logger)
  local bodyparam     = CommonFun.CalcBodyParam(srcUser, targetUser, params, damageParam, logger)
  local elementparam  = CommonFun.CalcElementParam(srcUser, targetUser, params, damageParam, logger)
  local bossparam     = CommonFun.CalcBossParam(srcUser, targetUser, params, damageParam, logger)

  ----------------------------------------------------------------------------------------------------------------种族，体型，属性，BOSS减伤效果
  local raceparam2    = CommonFun.CalcRaceParam2(srcUser, targetUser, params, damageParam, logger)
  local bodyparam2    = CommonFun.CalcBodyParam2(srcUser, targetUser, params, damageParam, logger)
  local elementparam2 = CommonFun.CalcElementParam2(srcUser, targetUser, params, damageParam, logger)
  local bossparam2    = CommonFun.CalcBossParam2(srcUser, targetUser, params, damageParam, logger)



  local BaseAtk  = Str*2 + math.floor(Str*Str/100) + math.floor(Dex/5) + math.floor(Luk/5)
  local AtkFinal = ((Atk-BaseAtk)*(1+AtkPer)*CommonFun.ShapeCorrection(srcUser,targetUser)*bodyparam*elementparam*elementparam2+BaseAtk)*raceparam*bossparam*bossparam2

  ----------------------------物理防御减免
  local DefReduc= CommonFun.CalcDef(Def,Vit,srcUser,targetUser)

  -------------------------------------------------------------神佑之光伤害加成
  local skilllv_1 = srcUser:GetLernedSkillLevel(362)
  local Skilldamage = skilllv_1*0.3
  -------------------------------------------------------------娜迦鳞盾
  local EquipDamage = 0
  local RefineDamage =0
  local RefineLv=srcUser:GetEquipedRefineLv(1)
  if srcUser:HasBuffID(40400) then
      EquipDamage = 2
      RefineDamage = 0.3*RefineLv
  end


  local A = (AtkFinal*DefReduc*(1-DamReduc2)+Refine)*(damChangePer + Skilldamage + EquipDamage + RefineDamage)*(1-RefineDamReduc)*(1+DamIncrease)-Vit2*(1+VitPer2)

  ----------------------------------------------------------------------坚定战甲增加物理部分伤害
  if srcUser:HasBuffID(90000965) then
      A = A*1.1
  end

  if 1 >= A then
     A = 1
  end


  local srcAtkElement    = 6
  local targetDefElement = targetUser:GetProperty("DefAttr")

  local BaseMAtk = Int+math.floor(Int*Int/100)
  local MAtkFinal= ((MAtk-BaseMAtk)*(1+MAtkPer)+BaseMAtk)*raceparam

  ----------------------------魔法防御减免
  local MDefReduc = CommonFun.CalcMDef(MDef,Int,Vit,srcUser,targetUser)

  local B = ((MAtkFinal*MDefReduc*(1-MDamReduc2)+MRefine)*(damChangePer + Skilldamage + EquipDamage + RefineDamage)*(1-RefineMDamReduc)*(1+MDamIncrease)*GameConfig.ElementRestrain[srcAtkElement][targetDefElement]*elementparam2-Vit2/2*(1+VitPer2)-Int2*(1+IntPer2))

  ----------------------------------------------------------------------坚定战甲增加魔法部分伤害
  if srcUser:HasBuffID(90000969) then
      B = B*1.1
  end


  if 1 >= B then
     B = 1
  end
  -------------------------------------------------------------星盘圣十字审判
  local Num1 = srcUser:GetRunePoint(70140)
  local RuneDamage = 1 + 0.1*Num1

  local C = (A + B)*RuneDamage
  ----------------------------------------------------------------------娜迦鳞盾 + 旗鱼枪
  if srcUser:HasBuffID(40380) and srcUser:HasBuffID(40400) then
      C = (A + B)*RuneDamage*1.5
  end
  ----------------------------------------------------------------------娜迦鳞盾 + 深海恐惧
  if srcUser:HasBuffID(41770) and srcUser:HasBuffID(40400) then
      C = (A + B)*RuneDamage*1.5
  end

   return C
end
-----------------------------------------------------------------------------------------------------------------投掷长矛 技能伤害计算公式(已改)
function CommonFun.calcDamage_1206(srcUser, targetUser, params, damageParam, logger)
  local Str = srcUser:GetProperty("Str")
  local Dex = srcUser:GetProperty("Dex")
  local Luk = srcUser:GetProperty("Luk")
  local Atk = srcUser:GetProperty("Atk")
  local AtkPer = srcUser:GetProperty("AtkPer")
  local DamIncrease = srcUser:GetProperty("DamIncrease")
  local IgnoreDef  = 0
  local IgnoreDef1 = srcUser:GetProperty("IgnoreDef")
  local IgnoreDef2 = srcUser:GetProperty("IgnoreEquipDef")
  if targetUser.boss or targetUser.mini then
     IgnoreDef=IgnoreDef1
  else
     IgnoreDef=(IgnoreDef1+IgnoreDef2)
  end

  if IgnoreDef >= 1 then
     IgnoreDef=1
  end
    ------------------------------------------------------------------------------------将原来的物伤加成改成精炼物理攻击
  local Refine = srcUser:GetProperty("Refine")

  local Def2 = targetUser:GetProperty("Def")
  local DefPer2 = targetUser:GetProperty("DefPer")
  local Vit2 = targetUser:GetProperty("Vit")
  local VitPer2 = targetUser:GetProperty("VitPer")
  local DamReduc2 = CommonFun.calcDamReDuc(srcUser, targetUser)
  local RefineDamReduc = targetUser:GetProperty("RefineDamReduc")

  local damChangePer = damageParam.damChangePer

  ----------------------------------------------------------------------------------------------------------------种族，体型，属性，BOSS加伤效果
  local raceparam     = CommonFun.CalcRaceParam(srcUser, targetUser, params, damageParam, logger)
  local bodyparam     = CommonFun.CalcBodyParam(srcUser, targetUser, params, damageParam, logger)
  local elementparam  = CommonFun.CalcElementParam(srcUser, targetUser, params, damageParam, logger)
  local bossparam     = CommonFun.CalcBossParam(srcUser, targetUser, params, damageParam, logger)

  ----------------------------------------------------------------------------------------------------------------种族，体型，属性，BOSS减伤效果
  local raceparam2    = CommonFun.CalcRaceParam2(srcUser, targetUser, params, damageParam, logger)
  local bodyparam2    = CommonFun.CalcBodyParam2(srcUser, targetUser, params, damageParam, logger)
  local elementparam2 = CommonFun.CalcElementParam2(srcUser, targetUser, params, damageParam, logger)
  local bossparam2    = CommonFun.CalcBossParam2(srcUser, targetUser, params, damageParam, logger)

  local BaseAtk  = Str*2 + math.floor(Str*Str/100) + math.floor(Dex/5) + math.floor(Luk/5)
  local AtkFinal = ((Atk-BaseAtk)*(1+AtkPer)*CommonFun.ShapeCorrection(srcUser,targetUser)*bodyparam*elementparam*elementparam2+BaseAtk)*raceparam*bossparam*bossparam2
  ----------------------------物理防御减免
  local DefReduc= CommonFun.CalcDef(Def,Vit,srcUser,targetUser)
  ---------------------------------------------------------------------伤害加深 印记
  local Sign = 1
  local Num1 = targetUser:GetBuffLayer(117660)--------------------------印记
  local fromid = targetUser:GetBuffFromID(117660)
  local guid = srcUser:GetGuid()

  local skilllv_1 = srcUser:GetLernedSkillLevel(1267)----伤害加深

  if fromid==guid then
    local fuwen = 0
    if srcUser:HasBuffID(820006) then
      fuwen=0.05
    end
    Sign = 1+(skilllv_1*0.01+0.02+fuwen)*Num1
  end

  local A = (((AtkFinal*DefReduc*(1-DamReduc2)+Refine)*damChangePer)*(1-RefineDamReduc)*(1+DamIncrease)-Vit2*(1+VitPer2))*Sign

   if 1 >= A then
         return 1
   end

   return A
end
-----------------------------------------------------------------------------------------------------------------冲锋攻击 技能伤害计算公式(已改)
function CommonFun.calcDamage_1207(srcUser, targetUser, params, damageParam, logger)
  local Str = srcUser:GetProperty("Str")
  local Dex = srcUser:GetProperty("Dex")
  local Luk = srcUser:GetProperty("Luk")
  local Atk = srcUser:GetProperty("Atk")
  local AtkPer = srcUser:GetProperty("AtkPer")
  local DamIncrease = srcUser:GetProperty("DamIncrease")
  local IgnoreDef  = 0
  local IgnoreDef1 = srcUser:GetProperty("IgnoreDef")
  local IgnoreDef2 = srcUser:GetProperty("IgnoreEquipDef")
  if targetUser.boss or targetUser.mini then
     IgnoreDef=IgnoreDef1
  else
     IgnoreDef=(IgnoreDef1+IgnoreDef2)
  end

  if IgnoreDef >= 1 then
     IgnoreDef=1
  end
    ------------------------------------------------------------------------------------将原来的物伤加成改成精炼物理攻击
  local Refine = srcUser:GetProperty("Refine")

  local Def2 = targetUser:GetProperty("Def")
  local DefPer2 = targetUser:GetProperty("DefPer")
  local Vit2 = targetUser:GetProperty("Vit")
  local VitPer2 = targetUser:GetProperty("VitPer")
  local DamReduc2 = CommonFun.calcDamReDuc(srcUser, targetUser)
  local RefineDamReduc = targetUser:GetProperty("RefineDamReduc")

  local damChangePer = damageParam.damChangePer

  ----------------------------------------------------------------------------------------------------------------种族，体型，属性，BOSS加伤效果
  local raceparam     = CommonFun.CalcRaceParam(srcUser, targetUser, params, damageParam, logger)
  local bodyparam     = CommonFun.CalcBodyParam(srcUser, targetUser, params, damageParam, logger)
  local elementparam  = CommonFun.CalcElementParam(srcUser, targetUser, params, damageParam, logger)
  local bossparam     = CommonFun.CalcBossParam(srcUser, targetUser, params, damageParam, logger)

  ----------------------------------------------------------------------------------------------------------------种族，体型，属性，BOSS减伤效果
  local raceparam2    = CommonFun.CalcRaceParam2(srcUser, targetUser, params, damageParam, logger)
  local bodyparam2    = CommonFun.CalcBodyParam2(srcUser, targetUser, params, damageParam, logger)
  local elementparam2 = CommonFun.CalcElementParam2(srcUser, targetUser, params, damageParam, logger)
  local bossparam2    = CommonFun.CalcBossParam2(srcUser, targetUser, params, damageParam, logger)

  local BaseAtk  = Str*2 + math.floor(Str*Str/100) + math.floor(Dex/5) + math.floor(Luk/5)
  local AtkFinal = ((Atk-BaseAtk)*(1+AtkPer)*CommonFun.ShapeCorrection(srcUser,targetUser)*bodyparam*elementparam*elementparam2+BaseAtk)*raceparam*bossparam*bossparam2
-------------------------------------------- 攻击距离加成
  local targetid = targetUser:GetGuid()
  local distance = srcUser:GetDistance(targetid)
  local skilllv_1 = srcUser:GetLernedSkillLevel(601)
  local Num1= srcUser:GetRunePoint(13020)

  local DisDam= 1
        DisDam = 1 + distance*0.05*Num1

  ----------------------------物理防御减免

  local DefReduc= CommonFun.CalcDef(Def,Vit,srcUser,targetUser)
  local A = (((AtkFinal*DefReduc*(1-DamReduc2)+Refine)*damChangePer)*(1-RefineDamReduc)*(1+DamIncrease)-Vit2*(1+VitPer2))*DisDam
   if 1 >= A then
         return 1
   end

   return A
end
------------------------------------------------------------------------------新螺旋击刺技能伤害公式(已改)
----------------------------------------------------------------------------------------------------------------公式=[((Str/10)^2+武器类型*角色等级*3.5*0.8)*体型修正+精炼]*卡片倍率*属性倍率*5
function CommonFun.calcDamage_1301(srcUser, targetUser, params, damageParam, logger)
  local Str = srcUser:GetProperty("Str")
  local Dex = srcUser:GetProperty("Dex")
  local Luk = srcUser:GetProperty("Luk")
  local Atk = srcUser:GetProperty("Atk")
  local AtkPer = srcUser:GetProperty("AtkPer")

  local DamIncrease = srcUser:GetProperty("DamIncrease")
  local WeaponType =srcUser:GetEquipedWeaponType()
  local BaseLv = srcUser.BaseLv
  local Refine = srcUser:GetProperty("Refine")

  local damChangePer = damageParam.damChangePer
  local DamReduc2 = CommonFun.calcDamReDuc(srcUser, targetUser)
  local RefineDamReduc = targetUser:GetProperty("RefineDamReduc")
  ----------------------------------------------------------------------------------------------------------------种族，体型，属性，BOSS加伤效果
  local raceparam     = CommonFun.CalcRaceParam(srcUser, targetUser, params, damageParam, logger)
  local bodyparam     = CommonFun.CalcBodyParam(srcUser, targetUser, params, damageParam, logger)
  local elementparam  = CommonFun.CalcElementParam(srcUser, targetUser, params, damageParam, logger)
  local bossparam     = CommonFun.CalcBossParam(srcUser, targetUser, params, damageParam, logger)

  ----------------------------------------------------------------------------------------------------------------种族，体型，属性，BOSS减伤效果
  local raceparam2    = CommonFun.CalcRaceParam2(srcUser, targetUser, params, damageParam, logger)
  local bodyparam2    = CommonFun.CalcBodyParam2(srcUser, targetUser, params, damageParam, logger)
  local elementparam2 = CommonFun.CalcElementParam2(srcUser, targetUser, params, damageParam, logger)
  local bossparam2    = CommonFun.CalcBossParam2(srcUser, targetUser, params, damageParam, logger)

  local BaseAtk  = Str*2 + math.floor(Str*Str/100) + math.floor(Dex/5) + math.floor(Luk/5)
  local AtkFinal = (Atk-BaseAtk)*(1+AtkPer)

  local sizeCorrection=1
  if nil ~= CommonFun.Shape then
    if CommonFun.Shape.S == targetUser.shape then
        sizeCorrection = 1.3
    elseif CommonFun.Shape.M == targetUser.shape then
        sizeCorrection = 1
    elseif CommonFun.Shape.L == targetUser.shape then
        sizeCorrection = 0.8
    end
  end

  local WeaponType_value=0
  if WeaponType==170 then
     WeaponType_value=2
  else
     WeaponType_value=0.5
  end

---------------------------------------------------------------------风暴之枪

  local Weapon=srcUser:GetEquipedID(7)
  local calcfbzq=1
  if (Weapon==40041 or Weapon==140041) then
    calcfbzq=1+0.1
  end


  ---------------------------------------------------------------------戮魂长矛
  if (Weapon==40055 or Weapon==140055) then
    calcfbzq=calcfbzq+0.15
  end

  ---------------------------------------------------------------------伤害加深 印记
  local Sign = 1
  local Num1 = targetUser:GetBuffLayer(117660)--------------------------印记
  local fromid = targetUser:GetBuffFromID(117660)
  local guid = srcUser:GetGuid()

  local skilllv_1 = srcUser:GetLernedSkillLevel(1267)----伤害加深

  if fromid==guid then
    local fuwen = 0
    if srcUser:HasBuffID(820006) then
      fuwen=0.05
    end
    Sign = 1+(skilllv_1*0.01+0.02+fuwen)*Num1
  end
  ------------------------------------------------------------------------
  local  A = (((Str/4)^2+(WeaponType_value*AtkFinal)*elementparam*bodyparam)*damChangePer+Refine*15+BaseLv*15)*raceparam*bossparam*(1-RefineDamReduc)*(1+DamIncrease)*(1-DamReduc2)*sizeCorrection*elementparam2*bossparam2*calcfbzq*Sign
  if 1 >= A then
      return 1
  end

  return A

end


------------------------------------------------------------------------------怪物用新螺旋击刺技能伤害公式(已改)
----------------------------------------------------------------------------------------------------------------公式=[((Str/10)^2+武器类型*角色等级*3.5*0.8)*体型修正+精炼]*卡片倍率*属性倍率*5
function CommonFun.calcDamage_1302(srcUser, targetUser, params, damageParam, logger)
  local Str = srcUser:GetProperty("Str")
  local Dex = srcUser:GetProperty("Dex")
  local Luk = srcUser:GetProperty("Luk")
  local Atk = srcUser:GetProperty("Atk")
  local AtkPer = srcUser:GetProperty("AtkPer")

  local DamIncrease = srcUser:GetProperty("DamIncrease")
  local WeaponType =srcUser:GetEquipedWeaponType()
  local BaseLv = srcUser.BaseLv
  local Refine = srcUser:GetProperty("Refine")



  local damChangePer = damageParam.damChangePer
  local DamReduc2 = CommonFun.calcDamReDuc(srcUser, targetUser)
  local RefineDamReduc = targetUser:GetProperty("RefineDamReduc")

  ----------------------------------------------------------------------------------------------------------------种族，体型，属性，BOSS加伤效果
  local raceparam     = CommonFun.CalcRaceParam(srcUser, targetUser, params, damageParam, logger)
  local bodyparam     = CommonFun.CalcBodyParam(srcUser, targetUser, params, damageParam, logger)
  local elementparam  = CommonFun.CalcElementParam(srcUser, targetUser, params, damageParam, logger)
  local bossparam     = CommonFun.CalcBossParam(srcUser, targetUser, params, damageParam, logger)

  ----------------------------------------------------------------------------------------------------------------种族，体型，属性，BOSS减伤效果
  local raceparam2    = CommonFun.CalcRaceParam2(srcUser, targetUser, params, damageParam, logger)
  local bodyparam2    = CommonFun.CalcBodyParam2(srcUser, targetUser, params, damageParam, logger)
  local elementparam2 = CommonFun.CalcElementParam2(srcUser, targetUser, params, damageParam, logger)
  local bossparam2    = CommonFun.CalcBossParam2(srcUser, targetUser, params, damageParam, logger)

  local BaseAtk  = Str*2 + math.floor(Str*Str/100) + math.floor(Dex/5) + math.floor(Luk/5)
  local AtkFinal = (Atk-BaseAtk)*(1+AtkPer)


  local sizeCorrection=1
  if nil ~= CommonFun.Shape then
    if CommonFun.Shape.S == targetUser.shape then
        sizeCorrection = 1.3
    elseif CommonFun.Shape.M == targetUser.shape then
        sizeCorrection = 1
    elseif CommonFun.Shape.L == targetUser.shape then
        sizeCorrection = 0.8
    end
  end

  local WeaponType_value=0
  if WeaponType==170 then
     WeaponType_value=2
  else
     WeaponType_value=0.5
  end

  local  A = (((Str/4)^2+(WeaponType_value*AtkFinal)*elementparam*bodyparam)*damChangePer+Refine*15+BaseLv*5)*raceparam*bossparam*(1- RefineDamReduc)*(1+DamIncrease)*(1-DamReduc2)*sizeCorrection*elementparam2*bossparam2
  if 1 >= A then
      return 1
  end

  return A

end
--------------------------------------------------------------------------------------------------------------------------龙之吐息 伤害计算公式(已改)
function CommonFun.calcDamage_1401(srcUser, targetUser, params, damageParam, logger)
  local Str = srcUser:GetProperty("Str")
  local Dex = srcUser:GetProperty("Dex")
  local Luk = srcUser:GetProperty("Luk")
  local Int = srcUser:GetProperty("Int")
  local Atk = srcUser:GetProperty("Atk")
  local AtkPer = srcUser:GetProperty("AtkPer")
  local MAtk = srcUser:GetProperty("MAtk")
  local MAtkPer = srcUser:GetProperty("MAtkPer")
  local DamIncrease = srcUser:GetProperty("DamIncrease")
  local IgnoreDef  = 0
  local IgnoreDef1 = srcUser:GetProperty("IgnoreDef")
  local IgnoreDef2 = srcUser:GetProperty("IgnoreEquipDef")
  if targetUser.boss or targetUser.mini then
     IgnoreDef=IgnoreDef1
  else
     IgnoreDef=(IgnoreDef1+IgnoreDef2)
  end

  if IgnoreDef >= 1 then
     IgnoreDef=1
  end
  ------------------------------------------------------------------------------------将原来的物伤加成改成精炼物理攻击
  local MRefine = srcUser:GetProperty("MRefine")
    ------------------------------------------------------------------------------------将原来的物伤加成改成精炼物理攻击
  local Refine = srcUser:GetProperty("Refine")

  local Def2 = targetUser:GetProperty("Def")
  local DefPer2 = targetUser:GetProperty("DefPer")
  local Vit2 = targetUser:GetProperty("Vit")
  local VitPer2 = targetUser:GetProperty("VitPer")
  local DamReduc2 = CommonFun.calcDamReDuc(srcUser, targetUser)
  local RefineDamReduc = targetUser:GetProperty("RefineDamReduc")

  local damChangePer = damageParam.damChangePer
  ----------------------------------------------------------------------------------------------------------------种族，体型，属性，BOSS加伤效果
  local raceparam     = CommonFun.CalcRaceParam(srcUser, targetUser, params, damageParam, logger)
  local bodyparam     = CommonFun.CalcBodyParam(srcUser, targetUser, params, damageParam, logger)
  local elementparam  = CommonFun.CalcElementParam(srcUser, targetUser, params, damageParam, logger)
  local bossparam     = CommonFun.CalcBossParam(srcUser, targetUser, params, damageParam, logger)

  ----------------------------------------------------------------------------------------------------------------种族，体型，属性，BOSS减伤效果
  local raceparam2    = CommonFun.CalcRaceParam2(srcUser, targetUser, params, damageParam, logger)
  local bodyparam2    = CommonFun.CalcBodyParam2(srcUser, targetUser, params, damageParam, logger)
  local elementparam2 = CommonFun.CalcElementParam2(srcUser, targetUser, params, damageParam, logger)
  local bossparam2    = CommonFun.CalcBossParam2(srcUser, targetUser, params, damageParam, logger)

  local BaseAtk  = Str*2 + math.floor(Str*Str/100) + math.floor(Dex/5) + math.floor(Luk/5)
  local AtkFinal = ((Atk-BaseAtk)*(1+AtkPer)*CommonFun.ShapeCorrection(srcUser,targetUser)*bodyparam*elementparam*elementparam2+BaseAtk)*raceparam*bossparam*bossparam2
  local BaseMAtk = Int+math.floor(Int*Int/100)
  local MAtkFinal= ((MAtk-BaseMAtk)*(1+MAtkPer)+BaseMAtk)*raceparam

  ----------------------------物理防御减免
  local DefReduc= CommonFun.CalcDef(Def,Vit,srcUser,targetUser)
  ----------------------------------------------------------------------自身体质提高伤害
  local Vit = srcUser:GetProperty("Vit")
  local VitRatio = 1+Vit/1000  --------------------每10点体质提高1%伤害
  ---------------------------------生命点燃状态下吐息伤害提高
  local HpFire = 1
  if srcUser:HasBuffID(80220) or srcUser:HasBuffID(80223) then
      HpFire = 1.2
  end
  ---------------------------------------骑乘龙时伤害提高
  local skilllv_1 = srcUser:GetLernedSkillLevel(1260)-------驯龙术
  local Ride = 1
  if srcUser:IsRide(25114) or srcUser:IsRide(25116) or srcUser:IsRide(25117) or srcUser:IsRide(25118) or srcUser:IsRide(25122) then
      Ride = 1+skilllv_1*0.05
  end
  ---------------------------------驯龙者长枪【新】
  local Dragon = 1
  local RefineLv7=srcUser:GetEquipedRefineLv(7)
  if srcUser:HasBuffID(41200)  then
      Dragon= 1 + RefineLv7*0.01
  end
  local Dragon1 = 0
  if srcUser:HasBuffID(41200) and (RefineLv7 ==15) then
      Dragon1= 1
  end

  ---------------------------------巨龙咆哮
  if srcUser:HasBuffID(41740)  then
      Dragon= 1 + RefineLv7*0.01
  end
   if srcUser:HasBuffID(41740) and (RefineLv7 ==15) then
      Dragon1= 1
  end


  ---------------------------------星盘 龙之吐息
  local Numxp= srcUser:GetRunePoint(14020)------------星盘点
  local RuneDamage = 1 + Numxp*0.06

  ---------------------------------------------------------------火焰精灵卡片
  local  card = 1
  if  srcUser:HasBuffID(52580) then
    card = 1.1
  end

  local A = (((AtkFinal+MAtkFinal)*DefReduc*(1-DamReduc2)+Refine+MRefine)*(damChangePer+Dragon1)*(1-RefineDamReduc)*(1+DamIncrease)-Vit2*(1+VitPer2))*HpFire*VitRatio*Ride*Dragon*RuneDamage*card



  if 1 >= A then
    return 1
  end

  return A

end
---------------------------------------------------------------------------------------------------------------------------------符文骑士 矛 伤害公式
function CommonFun.calcDamage_1402(srcUser, targetUser, params, damageParam, logger)
  local Str = srcUser:GetProperty("Str")
  local Dex = srcUser:GetProperty("Dex")
  local Luk = srcUser:GetProperty("Luk")
  local Atk = srcUser:GetProperty("Atk")
  local AtkPer = srcUser:GetProperty("AtkPer")
  local DamIncrease = srcUser:GetProperty("DamIncrease")
  local IgnoreDef  = 0
  local IgnoreDef1 = srcUser:GetProperty("IgnoreDef")
  local IgnoreDef2 = srcUser:GetProperty("IgnoreEquipDef")
  if targetUser.boss or targetUser.mini then
     IgnoreDef=IgnoreDef1
  else
     IgnoreDef=(IgnoreDef1+IgnoreDef2)
  end

  if IgnoreDef >= 1 then
     IgnoreDef  = 1
  end

  local Refine = srcUser:GetProperty("Refine")


  local Def2 = targetUser:GetProperty("Def")
  local DefPer2 = targetUser:GetProperty("DefPer")
  local Vit2 = targetUser:GetProperty("Vit")
  local VitPer2 = targetUser:GetProperty("VitPer")
  local DamReduc2 = CommonFun.calcDamReDuc(srcUser, targetUser)
  local RefineDamReduc = targetUser:GetProperty("RefineDamReduc")
  local damChangePer = damageParam.damChangePer

  ----------------------------------------------------------------------------------------------------------------种族，体型，属性，BOSS加伤效果
  local raceparam     = CommonFun.CalcRaceParam(srcUser, targetUser, params, damageParam, logger)
  local bodyparam     = CommonFun.CalcBodyParam(srcUser, targetUser, params, damageParam, logger)
  local elementparam  = CommonFun.CalcElementParam(srcUser, targetUser, params, damageParam, logger)
  local bossparam     = CommonFun.CalcBossParam(srcUser, targetUser, params, damageParam, logger)

  ----------------------------------------------------------------------------------------------------------------种族，体型，属性，BOSS减伤效果
  local raceparam2    = CommonFun.CalcRaceParam2(srcUser, targetUser, params, damageParam, logger)
  local bodyparam2    = CommonFun.CalcBodyParam2(srcUser, targetUser, params, damageParam, logger)
  local elementparam2 = CommonFun.CalcElementParam2(srcUser, targetUser, params, damageParam, logger)
  local bossparam2    = CommonFun.CalcBossParam2(srcUser, targetUser, params, damageParam, logger)


  local BaseAtk  = Str*2 + math.floor(Str*Str/100) + math.floor(Dex/5) + math.floor(Luk/5)
  local AtkFinal = ((Atk-BaseAtk)*(1+AtkPer)*CommonFun.ShapeCorrection(srcUser,targetUser)*bodyparam*elementparam*elementparam2+BaseAtk)*raceparam*bossparam*bossparam2

  ----------------------------物理防御减免
  local DefReduc= CommonFun.CalcDef(Def,Vit,srcUser,targetUser)
  ---------------------------------------------------------------------伤害加深 印记
  local Sign = 1
  local Num1 = targetUser:GetBuffLayer(117660)--------------------------印记
  local fromid = targetUser:GetBuffFromID(117660)
  local guid = srcUser:GetGuid()

  local skilllv_1 = srcUser:GetLernedSkillLevel(1267)----伤害加深

  if fromid==guid then
    local fuwen = 0
    if srcUser:HasBuffID(820006) then
      fuwen=0.05
    end
    Sign = 1+(skilllv_1*0.01+0.02+fuwen)*Num1
  end
  ------------------------------------------------------------------------
  local A = ((AtkFinal*DefReduc*(1-DamReduc2)+Refine)*damChangePer*(1-RefineDamReduc)*(1+DamIncrease)-Vit2*(1+VitPer2))*Sign

  local skillID, skillLevel = CommonFun.UnmergeSkillID(params.skillIDAndLevel)
  ----------------------------------------------------------急速戳刺
  if skillID==1266 then
      local Num = srcUser:GetRunePoint(14040)
      local RuneDamage = 1 + Num*0.06

---------------------------------------------------------------------风暴之枪[第四档]
  local calcfbzq=1
  local RefineLv=srcUser:GetEquipedRefineLv(7)
  if RefineLv >= 10 and srcUser:HasBuffID(90002003) then
    calcfbzq=calcfbzq+0.15
  end

      A =A * (RuneDamage + calcfbzq)
  end

  if 1 >= A then
    return 1
  end

  return A

end
------------------------------------------------------------------------------新圣灵召唤技能伤害计算公式
function CommonFun.calcDamage_2103(srcUser, targetUser, params, damageParam, logger)
  local Int = srcUser:GetProperty("Int")
  local Vit = srcUser:GetProperty("Vit")
  local MAtk = srcUser:GetProperty("MAtk")
  local MAtkPer = srcUser:GetProperty("MAtkPer")
  local MDamIncrease = CommonFun.calcMDamIncrease(srcUser, targetUser)
  local IgnoreMDef = srcUser:GetProperty("IgnoreMDef")
  if IgnoreMDef >= 1 then
     IgnoreMDef  = 1
  end
  --------------------------------------------------------------------------------星盘加成概率使触发高能
  local Num1 = srcUser:GetRunePoint(22018)
  local RuneRate = Num1*8
  local RuneDamage = Num1*0.1 +1

 local MRefine = srcUser:GetProperty("MRefine")


  local srcAtkElement    = CommonFun.GetUserAtkAttr(srcUser,params,damageParam)
  local targetDefElement = targetUser:GetProperty("DefAttr")

  local MDef2 = targetUser:GetProperty("MDef")
  local MDefPer2 = targetUser:GetProperty("MDefPer")
  local Vit2 = targetUser:GetProperty("Vit")
  local VitPer2 = targetUser:GetProperty("VitPer")
  local Int2 = targetUser:GetProperty("Int")
  local IntPer2 = targetUser:GetProperty("IntPer")
  local MDamReduc2 = CommonFun.calcMDamReDuc(srcUser, targetUser)
  local RefineMDamReduc = targetUser:GetProperty("RefineMDamReduc")
  local enemy = srcUser:IsEnemy(targetUser)
  local race2 = targetUser.race

  local damChangePer  = damageParam.damChangePer
  local damChangePer1 = damageParam.damChangePer1
  local damChangePer2 = damageParam.damChangePer2

  ----------------------------------------------------------------------------------------------------------------种族，体型，属性，BOSS减伤效果
  local elementparam2 = CommonFun.CalcElementParam2(srcUser, targetUser, params, damageParam, logger)

  ----------------------------------------------------------------------------------------------------------------法系职业伤害会受到种族加伤减伤影响
  local raceparam     = CommonFun.CalcRaceParam(srcUser, targetUser, params, damageParam, logger)
  local raceparam2    = CommonFun.CalcRaceParam2(srcUser, targetUser, params, damageParam, logger)
  local bossparam     = CommonFun.CalcBossParam(srcUser, targetUser, params, damageParam, logger)
  local bossparam2    = CommonFun.CalcBossParam2(srcUser, targetUser, params, damageParam, logger)

  local BaseMAtk = Int+math.floor(Int*Int/100)
  local MAtkFinal= ((MAtk-BaseMAtk)*(1+MAtkPer)+BaseMAtk)*raceparam*bossparam*bossparam2

  ----------------------------魔法防御减免
  local MDefReduc = CommonFun.CalcMDef(MDef,Int,Vit,srcUser,targetUser)

  local A = ((MAtkFinal*MDefReduc*(1-MDamReduc2)+MRefine)*damChangePer*(1-RefineMDamReduc)-Vit2/2*(1+VitPer2)-Int2*(1+IntPer2))*(1+MDamIncrease)*GameConfig.ElementRestrain[srcAtkElement][targetDefElement]*elementparam2+damChangePer2


  if CommonFun.IsInRate(RuneRate, srcUser:GetRandom()) then
     if race2==5 then
        return A*(1+damChangePer1)*RuneDamage
     else
        return A*RuneDamage
     end
  else
      if race2==5 then
        return A*(1+damChangePer1)
      else
        return A
      end
  end

  if 1 >= A then
    return 1
  end

  return A
end


-- --------------------------------------------------------------------------------------------------------法师技能魔击术计算公式(已改)
function CommonFun.calcDamage_2201(srcUser, targetUser, params, damageParam, logger)
  local Int = srcUser:GetProperty("Int")
  local Vit = srcUser:GetProperty("Vit")
  local MAtk = srcUser:GetProperty("MAtk")
  local MAtkPer = srcUser:GetProperty("MAtkPer")
  local MDamIncrease = CommonFun.calcMDamIncrease(srcUser, targetUser)
  local IgnoreDef  = 0
  local IgnoreDef1 = srcUser:GetProperty("IgnoreDef")
  local IgnoreDef2 = srcUser:GetProperty("IgnoreEquipDef")
  if targetUser.boss or targetUser.mini then
     IgnoreDef=IgnoreDef1
  else
     IgnoreDef=(IgnoreDef1+IgnoreDef2)
  end

  if IgnoreDef >= 1 then
     IgnoreDef  = 1
  end

  local MRefine = srcUser:GetProperty("MRefine")


  local srcAtkElement    = CommonFun.GetUserAtkAttr(srcUser,params,damageParam)
  local targetDefElement = targetUser:GetProperty("DefAttr")

  local Def2      = targetUser:GetProperty("Def")
  local DefPer2   = targetUser:GetProperty("DefPer")
  local Vit2      = targetUser:GetProperty("Vit")
  local VitPer2   = targetUser:GetProperty("VitPer")
  local Int2      = targetUser:GetProperty("Int")
  local IntPer2   = targetUser:GetProperty("IntPer")
  local DamReduc2 = CommonFun.calcDamReDuc(srcUser, targetUser)
  local RefineDamReduc = targetUser:GetProperty("RefineDamReduc")
  local damChangePer = damageParam.damChangePer
  ----------------------------------------------------------------------------------------------------------------种族，体型，属性，BOSS减伤效果
  local elementparam2 = CommonFun.CalcElementParam2(srcUser, targetUser, params, damageParam, logger)

  ----------------------------------------------------------------------------------------------------------------法系职业伤害会受到种族加伤减伤影响
  local raceparam     = CommonFun.CalcRaceParam(srcUser, targetUser, params, damageParam, logger)
  local raceparam2    = CommonFun.CalcRaceParam2(srcUser, targetUser, params, damageParam, logger)
  local bossparam     = CommonFun.CalcBossParam(srcUser, targetUser, params, damageParam, logger)
  local bossparam2    = CommonFun.CalcBossParam2(srcUser, targetUser, params, damageParam, logger)

  local BaseMAtk = Int+math.floor(Int*Int/100)
  local MAtkFinal= ((MAtk-BaseMAtk)*(1+MAtkPer)+BaseMAtk)*raceparam*bossparam*bossparam2*GameConfig.ElementRestrain[srcAtkElement][targetDefElement]*elementparam2

  ----------------------------物理防御减免  魔击术计算物理防御
  local DefReduc= CommonFun.CalcDef(Def,Vit,srcUser,targetUser)

  local A = ((MAtkFinal*DefReduc*(1-DamReduc2)+MRefine)*(1-RefineDamReduc)*damChangePer-Vit2/2*(1+VitPer2)-Int2*(1+IntPer2))*(1+MDamIncrease)

  if 1 >= A then
    return 1
  end
 return A

end

---------------------------------------------------------------------------------------------------火焰冲击伤害公式(已改)
function CommonFun.calcDamage_2301(srcUser, targetUser, params, damageParam, logger)
  local Int = srcUser:GetProperty("Int")
  local Vit = srcUser:GetProperty("Vit")
  local MAtk = srcUser:GetProperty("MAtk")
  local MAtkPer = srcUser:GetProperty("MAtkPer")
  local MDamIncrease = CommonFun.calcMDamIncrease(srcUser, targetUser)
  local IgnoreMDef = srcUser:GetProperty("IgnoreMDef")
  if IgnoreMDef >= 1 then
     IgnoreMDef  = 1
  end
  local MRefine = srcUser:GetProperty("MRefine")

  local srcAtkElement    = CommonFun.GetUserAtkAttr(srcUser, params, damageParam)
  local targetDefElement = targetUser:GetProperty("DefAttr")


  local MDef2 = targetUser:GetProperty("MDef")
  local MDefPer2 = targetUser:GetProperty("MDefPer")
  local Vit2      = targetUser:GetProperty("Vit")
  local VitPer2   = targetUser:GetProperty("VitPer")
  local Int2      = targetUser:GetProperty("Int")
  local IntPer2   = targetUser:GetProperty("IntPer")
  local MDamReduc2 = CommonFun.calcMDamReDuc(srcUser, targetUser)
  local RefineMDamReduc = targetUser:GetProperty("RefineMDamReduc")
  local damChangePer  = damageParam.damChangePer
  local damChangePer1 = damageParam.damChangePer1
  ----------------------------------------------------------------------------------------------------------------种族，体型，属性，BOSS减伤效果
  local elementparam2 = CommonFun.CalcElementParam2(srcUser, targetUser, params, damageParam, logger)

  ----------------------------------------------------------------------------------------------------------------法系职业伤害会受到种族加伤减伤影响
  local raceparam     = CommonFun.CalcRaceParam(srcUser, targetUser, params, damageParam, logger)
  local raceparam2    = CommonFun.CalcRaceParam2(srcUser, targetUser, params, damageParam, logger)
  local bossparam     = CommonFun.CalcBossParam(srcUser, targetUser, params, damageParam, logger)
  local bossparam2    = CommonFun.CalcBossParam2(srcUser, targetUser, params, damageParam, logger)

  local BaseMAtk = Int+math.floor(Int*Int/100)
  local MAtkFinal= ((MAtk-BaseMAtk)*(1+MAtkPer)+BaseMAtk)*raceparam*bossparam*bossparam2*GameConfig.ElementRestrain[srcAtkElement][targetDefElement]*elementparam2

  local A = (((MAtkFinal*(1-MDamReduc2)*damChangePer+50)+MRefine)*(1-RefineMDamReduc)*damChangePer1-Vit2/2*(1+VitPer2)-Int2*(1+IntPer2))*(1+MDamIncrease)

  if 1 >= A then
    return 1
  end

  return A
end

--------------------------------------------------------------------------------------------------------------------------重力原野伤害技能
function CommonFun.calcDamage_2302(srcUser, targetUser, params, damageParam, logger)
  local Int = srcUser:GetProperty("Int")
  local Vit = srcUser:GetProperty("Vit")
  local MAtk = srcUser:GetProperty("MAtk")
  local MAtkPer = srcUser:GetProperty("MAtkPer")
  local MDamIncrease = CommonFun.calcMDamIncrease(srcUser, targetUser)
  local IgnoreMDef = srcUser:GetProperty("IgnoreMDef")
  if IgnoreMDef >= 1 then
     IgnoreMDef  = 1
  end

  ------------------------------------------------------------------------------------将原来的物伤加成改成精炼物理攻击
  local MRefine = srcUser:GetProperty("MRefine")

  local srcAtkElement    = CommonFun.GetUserAtkAttr(srcUser, params, damageParam)
  local targetDefElement = targetUser:GetProperty("DefAttr")
  ----------------------------------------------------------------------------------------------------------------种族，体型，属性，BOSS减伤效果
  local elementparam2 = CommonFun.CalcElementParam2(srcUser, targetUser, params, damageParam, logger)

  ----------------------------------------------------------------------------------------------------------------法系职业伤害会受到种族加伤减伤影响
  local raceparam     = CommonFun.CalcRaceParam(srcUser, targetUser, params, damageParam, logger)
  local raceparam2    = CommonFun.CalcRaceParam2(srcUser, targetUser, params, damageParam, logger)
  local bossparam     = CommonFun.CalcBossParam(srcUser, targetUser, params, damageParam, logger)
  local bossparam2    = CommonFun.CalcBossParam2(srcUser, targetUser, params, damageParam, logger)

  local MDef2 = targetUser:GetProperty("MDef")
  local MDefPer2 = targetUser:GetProperty("MDefPer")
  local Vit2 = targetUser:GetProperty("Vit")
  local VitPer2 = targetUser:GetProperty("VitPer")
  local Int2 = targetUser:GetProperty("Int")
  local IntPer2 = targetUser:GetProperty("IntPer")
  local MDamReduc2 = CommonFun.calcMDamReDuc(srcUser, targetUser)
  local RefineMDamReduc = targetUser:GetProperty("RefineMDamReduc")
  local damChangePer  = damageParam.damChangePer
  local damChangePer1 = damageParam.damChangePer1

  local BaseMAtk = Int+math.floor(Int*Int/100)
  local MAtkFinal= ((MAtk-BaseMAtk)*(1+MAtkPer)+BaseMAtk)*raceparam*bossparam*bossparam2

  ----------------------------魔法防御减免
  local MDefReduc = CommonFun.CalcMDef(MDef,Int,Vit,srcUser,targetUser)

  local A = ((MAtkFinal*MDefReduc*(1-MDamReduc2)+MRefine)*(1-RefineMDamReduc)*damChangePer*(1+MDamIncrease)*GameConfig.ElementRestrain[srcAtkElement][targetDefElement]*elementparam2-Vit2/2*(1+VitPer2)-Int2*(1+IntPer2))+damChangePer1

  if 1 >= A then
    return 1
  end

  return A

end
--------------------------------------------------------------------------------------------------------------------------法师灵魂爆发计算公式(已改)
function CommonFun.calcDamage_2303(srcUser, targetUser, params, damageParam, logger)
  local Luk = srcUser:GetProperty("Luk")
  local Int = srcUser:GetProperty("Int")
  local Vit = srcUser:GetProperty("Vit")
  local MAtk = srcUser:GetProperty("MAtk")
  local MAtkPer = srcUser:GetProperty("MAtkPer")

  -----------------------------------------------------------------------------------分割线
  local MDamIncrease = CommonFun.calcMDamIncrease(srcUser, targetUser)
  local IgnoreMDef = srcUser:GetProperty("IgnoreMDef")
  if IgnoreMDef >= 1 then
     IgnoreMDef  = 1
  end

  ------------------------------------------------------------------------------------将原来的物伤加成改成精炼物理攻击
  local MRefine = srcUser:GetProperty("MRefine")

  local srcAtkElement    = CommonFun.GetUserAtkAttr(srcUser, params, damageParam)
  local targetDefElement = targetUser:GetProperty("DefAttr")
  ----------------------------------------------------------------------------------------------------------------种族，体型，属性，BOSS减伤效果
  local elementparam2 = CommonFun.CalcElementParam2(srcUser, targetUser, params, damageParam, logger)

  ----------------------------------------------------------------------------------------------------------------法系职业伤害会受到种族加伤减伤影响
  local raceparam     = CommonFun.CalcRaceParam(srcUser, targetUser, params, damageParam, logger)
  local raceparam2    = CommonFun.CalcRaceParam2(srcUser, targetUser, params, damageParam, logger)
  local bossparam     = CommonFun.CalcBossParam(srcUser, targetUser, params, damageParam, logger)
  local bossparam2    = CommonFun.CalcBossParam2(srcUser, targetUser, params, damageParam, logger)

  local MDef2 = targetUser:GetProperty("MDef")
  local MDefPer2 = targetUser:GetProperty("MDefPer")
  local Vit2 = targetUser:GetProperty("Vit")
  local VitPer2 = targetUser:GetProperty("VitPer")
  local Int2 = targetUser:GetProperty("Int")
  local IntPer2 = targetUser:GetProperty("IntPer")
  local MDamReduc2 = CommonFun.calcMDamReDuc(srcUser, targetUser)
  local RefineMDamReduc = targetUser:GetProperty("RefineMDamReduc")

  local damChangePer = damageParam.damChangePer

  local BaseMAtk = Int+math.floor(Int*Int/100)
  local MAtkFinal= ((MAtk-BaseMAtk)*(1+MAtkPer)+BaseMAtk)*raceparam*bossparam*bossparam2
  ----------------------------魔法防御减免
  local MDefReduc = CommonFun.CalcMDef(MDef,Int,Vit,srcUser,targetUser)
  ---------------------------------------------------------------星盘
  local Num1 = srcUser:GetRunePoint(24040)
  local RuneDamage = 1 + Num1*0.05
  ---------------------------------------------------------------鸟人哈比卡片
  local  card = 1
  if  srcUser:HasBuffID(52550) then
    card = 1.1
  end

  local A = ((MAtkFinal*MDefReduc*(1-MDamReduc2)+MRefine)*damChangePer*(1-RefineMDamReduc)*(1+MDamIncrease)*GameConfig.ElementRestrain[srcAtkElement][targetDefElement]*elementparam2-Vit2/2*(1+VitPer2)-Int2*(1+IntPer2))*card*RuneDamage
 ------------------------------------------对白色监狱状态下敌人双倍伤害
  if targetUser:HasBuffID(116810) then
     A=A*2
  end
  if 1 >= A then
    return 1
  end

  return A

end
--------------------------------------------------------------------------------------------------------------------------法师生命吸收计算公式(已改)
function CommonFun.calcDamage_2304(srcUser, targetUser, params, damageParam, logger)
  local Luk = srcUser:GetProperty("Luk")
  local Int = srcUser:GetProperty("Int")
  local Vit = srcUser:GetProperty("Vit")
  local MAtk = srcUser:GetProperty("MAtk")
  local MAtkPer = srcUser:GetProperty("MAtkPer")
  local target_Hp=targetUser:GetProperty("Hp")
  -----------------------------------------------------------------------------------分割线
  local MDamIncrease = CommonFun.calcMDamIncrease(srcUser, targetUser)
  local IgnoreMDef = srcUser:GetProperty("IgnoreMDef")
  if IgnoreMDef >= 1 then
     IgnoreMDef  = 1
  end

  ------------------------------------------------------------------------------------将原来的物伤加成改成精炼物理攻击

  local srcAtkElement    = CommonFun.GetUserAtkAttr(srcUser, params, damageParam)
  local targetDefElement = targetUser:GetProperty("DefAttr")

  ----------------------------------------------------------------------------------------------------------------种族，体型，属性，BOSS减伤效果
  local elementparam2 = CommonFun.CalcElementParam2(srcUser, targetUser, params, damageParam, logger)

  ----------------------------------------------------------------------------------------------------------------法系职业伤害会受到种族加伤减伤影响


  local MDef2 = targetUser:GetProperty("MDef")
  local MDefPer2 = targetUser:GetProperty("MDefPer")
  local Vit2 = targetUser:GetProperty("Vit")
  local VitPer2 = targetUser:GetProperty("VitPer")
  local Int2 = targetUser:GetProperty("Int")
  local IntPer2 = targetUser:GetProperty("IntPer")
  local MDamReduc2 = CommonFun.calcMDamReDuc(srcUser, targetUser)
  local RefineMDamReduc = targetUser:GetProperty("RefineMDamReduc")

  local damChangePer = damageParam.damChangePer

  ----------------------------魔法防御减免
  local MDefReduc = CommonFun.CalcMDef(MDef,Int,Vit,srcUser,targetUser)
  ---------------------------------------------------------------星盘
  local Num1 = srcUser:GetRunePoint(24070)
  local RuneDamage = Num1*4
  if targetUser.boss == true or targetUser.mini == true or targetUser:HasBuffID(160000) then
           target_Hp = 0
  end
  local A = ((target_Hp*MDefReduc*(1-MDamReduc2))*(damChangePer+RuneDamage)/100*(1-RefineMDamReduc)*(1+MDamIncrease)*GameConfig.ElementRestrain[srcAtkElement][targetDefElement]*elementparam2-Vit2/2*(1+VitPer2)-Int2*(1+IntPer2))

  if 1 >= A then
    return 1
  end

  return A

end
--------------------------------------------------------------------------------------------------------------------------元素漩涡伤害计算公式(已改)
function CommonFun.calcDamage_2305(srcUser, targetUser, params, damageParam, logger)
  local Luk = srcUser:GetProperty("Luk")
  local Int = srcUser:GetProperty("Int")
  local Vit = srcUser:GetProperty("Vit")
  local MAtk = srcUser:GetProperty("MAtk")
  local MAtkPer = srcUser:GetProperty("MAtkPer")

  -----------------------------------------------------------------------------------分割线
  local MDamIncrease = CommonFun.calcMDamIncrease(srcUser, targetUser)
  local IgnoreMDef = srcUser:GetProperty("IgnoreMDef")
  if IgnoreMDef >= 1 then
     IgnoreMDef  = 1
  end

  ------------------------------------------------------------------------------------将原来的物伤加成改成精炼物理攻击
  local MRefine = srcUser:GetProperty("MRefine")
  -------------------------------------------------四种元素伤害分别判断
  local srcAtkElement1  = 1
    local elementInc1 = 0
    local elementRed1 = 0

    local targetDefElement = targetUser:GetProperty("DefAttr")


    if nil == targetDefElement then
        logger.error(string.format("%s targetDefElement is nil", targetUser.name))
        return 0
    end
    if nil == CommonFun.NatureProps[targetDefElement] then
        logger.error(string.format("%s CommonFun.NatureProps[%s] is nil", srcUser.name, tostring(targetDefElement)))
        return 0
    end

    if nil == CommonFun.NatureProps[srcAtkElement1] then
        logger.error(string.format("CommonFun.NatureProps[%s] is nil", tostring(srcAtkElement1)))
        return 0
    end

    elementInc1 = srcUser:GetProperty(CommonFun.NatureProps[targetDefElement][1])
    elementRed1 = targetUser:GetProperty(CommonFun.NatureProps[srcAtkElement1][2])
    elementAtk1 = srcUser:GetProperty(CommonFun.NatureProps[srcAtkElement1][3])

    if nil==elementAtk1 then
        elementAtk1 = 0
    end
    local result1 = 1+elementAtk1-elementRed1

    ------------------------------------------------------------------------竞技场额外增加30%元素减免
    local mapid,maptype = srcUser:GetMapInfo()-----------------获取所在地图
    ------------------------maptype 1 :野外 2：pvp 3:其他普通副本 4:gvg
    if maptype==2 or maptype==4 then
      local B1 = elementRed1 - elementAtk1  ---------------元素伤害减免
      B1 = B1 < -1 and -1 or B1 > 1 and 1 or B1
      B1 = math.floor(B1*1000)/1000
      B1 = B1 + 0.3*(1-math.sin(B1*3.14/2))
      --print("B2="..B)
      result1 = 1 - B1
    end

    if result1 <= 0.1 then
        result1 = 0.1
    end

    local srcAtkElement2   = 2
    local elementInc2 = 0
    local elementRed2 = 0

    local targetDefElement = targetUser:GetProperty("DefAttr")


    if nil == targetDefElement then
        logger.error(string.format("%s targetDefElement is nil", targetUser.name))
        return 0
    end
    if nil == CommonFun.NatureProps[targetDefElement] then
        logger.error(string.format("%s CommonFun.NatureProps[%s] is nil", srcUser.name, tostring(targetDefElement)))
        return 0
    end

    if nil == CommonFun.NatureProps[srcAtkElement2] then
        logger.error(string.format("CommonFun.NatureProps[%s] is nil", tostring(srcAtkElement2)))
        return 0
    end

    elementInc2 = srcUser:GetProperty(CommonFun.NatureProps[targetDefElement][1])
    elementRed2 = targetUser:GetProperty(CommonFun.NatureProps[srcAtkElement2][2])
    elementAtk2 = srcUser:GetProperty(CommonFun.NatureProps[srcAtkElement2][3])

    if nil==elementAtk2 then
        elementAtk2 = 0
    end
    local result2 = 1+elementAtk2-elementRed2

    if maptype==2 or maptype==4 then
      local B2 = elementRed2 - elementAtk2  ---------------元素伤害减免
      B2 = B2 < -1 and -1 or B2 > 1 and 1 or B2
      B2 = math.floor(B2*1000)/1000
      B2 = B2 + 0.3*(1-math.sin(B2*3.14/2))
      --print("B2="..B)
      result2 = 1 - B2
    end

    if result2 <= 0.1 then
        result2 = 0.1
    end

  local srcAtkElement3   = 3
    local elementInc3 = 0
    local elementRed3 = 0

    local targetDefElement = targetUser:GetProperty("DefAttr")


    if nil == targetDefElement then
        logger.error(string.format("%s targetDefElement is nil", targetUser.name))
        return 0
    end
    if nil == CommonFun.NatureProps[targetDefElement] then
        logger.error(string.format("%s CommonFun.NatureProps[%s] is nil", srcUser.name, tostring(targetDefElement)))
        return 0
    end

    if nil == CommonFun.NatureProps[srcAtkElement3] then
        logger.error(string.format("CommonFun.NatureProps[%s] is nil", tostring(srcAtkElement3)))
        return 0
    end

    elementInc3 = srcUser:GetProperty(CommonFun.NatureProps[targetDefElement][1])
    elementRed3 = targetUser:GetProperty(CommonFun.NatureProps[srcAtkElement3][2])
    elementAtk3 = srcUser:GetProperty(CommonFun.NatureProps[srcAtkElement3][3])

    if nil==elementAtk3 then
        elementAtk3 = 0
    end
    local result3 = 1+elementAtk3-elementRed3

    ------------------------maptype 1 :野外 2：pvp 3:其他普通副本 4:gvg
    if maptype==2 or maptype==4 then
      local B3 = elementRed3 - elementAtk3  ---------------元素伤害减免
      B3 = B3 < -1 and -1 or B3 > 1 and 1 or B3
      B3 = math.floor(B3*1000)/1000
      B3 = B3 + 0.3*(1-math.sin(B3*3.14/2))
      --print("B2="..B)
      result3 = 1 - B3
    end

    if result3 <= 0.1 then
        result3 = 0.1
    end

  local srcAtkElement4   = 4
    local elementInc4 = 0
    local elementRed4 = 0

    local targetDefElement = targetUser:GetProperty("DefAttr")


    if nil == targetDefElement then
        logger.error(string.format("%s targetDefElement is nil", targetUser.name))
        return 0
    end
    if nil == CommonFun.NatureProps[targetDefElement] then
        logger.error(string.format("%s CommonFun.NatureProps[%s] is nil", srcUser.name, tostring(targetDefElement)))
        return 0
    end

    if nil == CommonFun.NatureProps[srcAtkElement4] then
        logger.error(string.format("CommonFun.NatureProps[%s] is nil", tostring(srcAtkElement4)))
        return 0
    end

    elementInc4 = srcUser:GetProperty(CommonFun.NatureProps[targetDefElement][1])
    elementRed4 = targetUser:GetProperty(CommonFun.NatureProps[srcAtkElement4][2])
    elementAtk4 = srcUser:GetProperty(CommonFun.NatureProps[srcAtkElement4][3])

    if nil==elementAtk4 then
        elementAtk4 = 0
    end
    local result4 = 1+elementAtk4-elementRed4
    ------------------------maptype 1 :野外 2：pvp 3:其他普通副本 4:gvg
    if maptype==2 or maptype==4 then
      local B4 = elementRed4 - elementAtk4  ---------------元素伤害减免
      B4 = B4 < -1 and -1 or B4 > 1 and 1 or B4
      B4 = math.floor(B4*1000)/1000
      B4 = B4 + 0.3*(1-math.sin(B4*3.14/2))
      --print("B2="..B)
      result4 = 1 - B4
    end

    if result4 <= 0.1 then
        result4 = 0.1
    end
  ----------------------------------------------------------------------------------------------------------------种族，体型，属性，BOSS减伤效果

  local elementparam21 = result1
  local elementparam22 = result2
  local elementparam23 = result3
  local elementparam24 = result4
  ----------------------------------------------------------------------------------------------------------------法系职业伤害会受到种族加伤减伤影响
  local raceparam     = CommonFun.CalcRaceParam(srcUser, targetUser, params, damageParam, logger)
  local raceparam2    = CommonFun.CalcRaceParam2(srcUser, targetUser, params, damageParam, logger)
  local bossparam     = CommonFun.CalcBossParam(srcUser, targetUser, params, damageParam, logger)
  local bossparam2    = CommonFun.CalcBossParam2(srcUser, targetUser, params, damageParam, logger)

  local MDef2 = targetUser:GetProperty("MDef")
  local MDefPer2 = targetUser:GetProperty("MDefPer")
  local Vit2 = targetUser:GetProperty("Vit")
  local VitPer2 = targetUser:GetProperty("VitPer")
  local Int2 = targetUser:GetProperty("Int")
  local IntPer2 = targetUser:GetProperty("IntPer")
  local MDamReduc2 = CommonFun.calcMDamReDuc(srcUser, targetUser)
  local RefineMDamReduc = targetUser:GetProperty("RefineMDamReduc")

  local damChangePer = damageParam.damChangePer

  local BaseMAtk = Int+math.floor(Int*Int/100)
  local MAtkFinal= ((MAtk-BaseMAtk)*(1+MAtkPer)+BaseMAtk)*raceparam*bossparam*bossparam2
  ----------------------------魔法防御减免
  local MDefReduc = CommonFun.CalcMDef(MDef,Int,Vit,srcUser,targetUser)

  local A1 = ((MAtkFinal*MDefReduc*(1-MDamReduc2)+MRefine)*damChangePer*(1-RefineMDamReduc)*(1+MDamIncrease)*GameConfig.ElementRestrain[srcAtkElement1][targetDefElement]*elementparam21-Vit2/2*(1+VitPer2)-Int2*(1+IntPer2))
  local A2 = ((MAtkFinal*MDefReduc*(1-MDamReduc2)+MRefine)*damChangePer*(1-RefineMDamReduc)*(1+MDamIncrease)*GameConfig.ElementRestrain[srcAtkElement2][targetDefElement]*elementparam22-Vit2/2*(1+VitPer2)-Int2*(1+IntPer2))
  local A3 = ((MAtkFinal*MDefReduc*(1-MDamReduc2)+MRefine)*damChangePer*(1-RefineMDamReduc)*(1+MDamIncrease)*GameConfig.ElementRestrain[srcAtkElement3][targetDefElement]*elementparam23-Vit2/2*(1+VitPer2)-Int2*(1+IntPer2))
  local A4 = ((MAtkFinal*MDefReduc*(1-MDamReduc2)+MRefine)*damChangePer*(1-RefineMDamReduc)*(1+MDamIncrease)*GameConfig.ElementRestrain[srcAtkElement4][targetDefElement]*elementparam24-Vit2/2*(1+VitPer2)-Int2*(1+IntPer2))
  -------------------------------------星盘 元素融合
  local Num1 = srcUser:GetRunePoint(24010)
  local RuneDamage = 1 + Num1*0.04
  local A=(A1+A2+A3+A4)*RuneDamage

  if 1 >= A then
    return 1
  end

  return A

end
--------------------------------------------------------------------------------------------------------------------------法师  连锁闪电 魔法伤害计算公式(已改)
function CommonFun.calcDamage_2306(srcUser, targetUser, params, damageParam, logger)
  local Luk = srcUser:GetProperty("Luk")
  local Int = srcUser:GetProperty("Int")
  local Vit = srcUser:GetProperty("Vit")
  local MAtk = srcUser:GetProperty("MAtk")
  local MAtkPer = srcUser:GetProperty("MAtkPer")

  -----------------------------------------------------------------------------------分割线
  local MDamIncrease = CommonFun.calcMDamIncrease(srcUser, targetUser)
  local IgnoreMDef = srcUser:GetProperty("IgnoreMDef")
  if IgnoreMDef >= 1 then
     IgnoreMDef  = 1
  end

  ------------------------------------------------------------------------------------将原来的物伤加成改成精炼物理攻击
  local MRefine = srcUser:GetProperty("MRefine")

  local srcAtkElement    = CommonFun.GetUserAtkAttr(srcUser, params, damageParam)
  local targetDefElement = targetUser:GetProperty("DefAttr")
  ----------------------------------------------------------------------------------------------------------------种族，体型，属性，BOSS减伤效果
  local elementparam2 = CommonFun.CalcElementParam2(srcUser, targetUser, params, damageParam, logger)

  ----------------------------------------------------------------------------------------------------------------法系职业伤害会受到种族加伤减伤影响
  local raceparam     = CommonFun.CalcRaceParam(srcUser, targetUser, params, damageParam, logger)
  local raceparam2    = CommonFun.CalcRaceParam2(srcUser, targetUser, params, damageParam, logger)
  local bossparam     = CommonFun.CalcBossParam(srcUser, targetUser, params, damageParam, logger)
  local bossparam2    = CommonFun.CalcBossParam2(srcUser, targetUser, params, damageParam, logger)

  local MDef2 = targetUser:GetProperty("MDef")
  local MDefPer2 = targetUser:GetProperty("MDefPer")
  local Vit2 = targetUser:GetProperty("Vit")
  local VitPer2 = targetUser:GetProperty("VitPer")
  local Int2 = targetUser:GetProperty("Int")
  local IntPer2 = targetUser:GetProperty("IntPer")
  local MDamReduc2 = CommonFun.calcMDamReDuc(srcUser, targetUser)
  local RefineMDamReduc = targetUser:GetProperty("RefineMDamReduc")

  local damChangePer = damageParam.damChangePer

  local BaseMAtk = Int+math.floor(Int*Int/100)
  local MAtkFinal= ((MAtk-BaseMAtk)*(1+MAtkPer)+BaseMAtk)*raceparam*bossparam*bossparam2
  ----------------------------魔法防御减免
  local MDefReduc = CommonFun.CalcMDef(MDef,Int,Vit,srcUser,targetUser)

  local index = params.hitedIndex--第几个目标
  -------------------------------------------------星盘 跳跃
  local Num1 = srcUser:GetRunePoint(24020)
  local RuneDamage = Num1*0.03 + 1.1

  local JumpRatio = math.pow(RuneDamage,index)

  local A = ((MAtkFinal*MDefReduc*(1-MDamReduc2)+MRefine)*damChangePer*(1-RefineMDamReduc)*(1+MDamIncrease)*GameConfig.ElementRestrain[srcAtkElement][targetDefElement]*elementparam2-Vit2/2*(1+VitPer2)-Int2*(1+IntPer2))*JumpRatio

  if 1 >= A then
    return 1
  end

  return A

end
--------------------------------------------------------------------------------------------------------盗贼技能伏击伤害计算公式
function CommonFun.calcDamage_3101(srcUser, targetUser, params, damageParam, logger)
  local Str = srcUser:GetProperty("Str")
  local Dex = srcUser:GetProperty("Dex")
  local Luk = srcUser:GetProperty("Luk")
  local Atk = srcUser:GetProperty("Atk")
  local AtkPer = srcUser:GetProperty("AtkPer")
  local DamIncrease = srcUser:GetProperty("DamIncrease")
  local IgnoreDef  = 0
  local IgnoreDef1 = srcUser:GetProperty("IgnoreDef")
  local IgnoreDef2 = srcUser:GetProperty("IgnoreEquipDef")
  if targetUser.boss or targetUser.mini then
     IgnoreDef=IgnoreDef1
  else
     IgnoreDef=(IgnoreDef1+IgnoreDef2)
  end

  if IgnoreDef >= 1 then
     IgnoreDef  = 1
  end

  local Refine = srcUser:GetProperty("Refine")

  local Hiding = srcUser:GetProperty("Hiding")

  local AttrEffect = srcUser:GetProperty("AttrEffect")
  local bits=CommonFun.getBits(AttrEffect)

  local AttrEffect2 = srcUser:GetProperty("AttrEffect")
  local bits2=CommonFun.getBits(AttrEffect2)


  local Def2 = targetUser:GetProperty("Def")
  local DefPer2 = targetUser:GetProperty("DefPer")
  local Vit2 = targetUser:GetProperty("Vit")
  local VitPer2   = targetUser:GetProperty("VitPer")
  local DamReduc2 = CommonFun.calcDamReDuc(srcUser, targetUser)
  local RefineDamReduc = targetUser:GetProperty("RefineDamReduc")
  local damChangePer = damageParam.damChangePer

  ----------------------------------------------------------------------------------------------------------------种族，体型，属性，BOSS加伤效果
  local raceparam     = CommonFun.CalcRaceParam(srcUser, targetUser, params, damageParam, logger)
  local bodyparam     = CommonFun.CalcBodyParam(srcUser, targetUser, params, damageParam, logger)
  local elementparam  = CommonFun.CalcElementParam(srcUser, targetUser, params, damageParam, logger)
  local bossparam     = CommonFun.CalcBossParam(srcUser, targetUser, params, damageParam, logger)

  ----------------------------------------------------------------------------------------------------------------种族，体型，属性，BOSS减伤效果
  local raceparam2    = CommonFun.CalcRaceParam2(srcUser, targetUser, params, damageParam, logger)
  local bodyparam2    = CommonFun.CalcBodyParam2(srcUser, targetUser, params, damageParam, logger)
  local elementparam2 = CommonFun.CalcElementParam2(srcUser, targetUser, params, damageParam, logger)
  local bossparam2    = CommonFun.CalcBossParam2(srcUser, targetUser, params, damageParam, logger)


  local BaseAtk  = Str*2 + math.floor(Str*Str/100) + math.floor(Dex/5) + math.floor(Luk/5)
  local AtkFinal = ((Atk-BaseAtk)*(1+AtkPer)*CommonFun.ShapeCorrection(srcUser,targetUser)*bodyparam*elementparam*elementparam2+BaseAtk)*raceparam*bossparam*bossparam2

  ----------------------------物理防御减免
  local DefReduc= CommonFun.CalcDef(Def,Vit,srcUser,targetUser)

  local A = (AtkFinal*DefReduc*(1-DamReduc2)+Refine)*damChangePer*(1-RefineDamReduc)*(1+DamIncrease)-Vit2*(1+VitPer2)

   if 1 >= A then
         return 1
   end
  ------------------------------------------------------------------------------------------------星盘
    local Num1=srcUser:GetRunePoint(31001)
    local Num2=srcUser:GetRunePoint(31002)
    local Num3=srcUser:GetRunePoint(31003)
    local Num4=srcUser:GetRunePoint(31004)
    local Num5=srcUser:GetRunePoint(31005)

    local RuneDamage=Num1*0.05+Num2*0.1+Num3*0.05+Num4*0.05+Num5*0.05+1
  ------------------------------------------------------------------------------------------------隐匿伏击伤害提高
    local Num6=srcUser:GetRunePoint(90120)
    local RuneDamage2 = 0.1*Num6 + 1
  ------------------------------------------------------------------------------------------------隐匿状态或隐匿强化状态下伏击造成的伤害会加倍
  if Hiding==1 or bits[CommonFun.AttrEffect.HideStrengthEffect]==1 then
     if bits2[CommonFun.AttrEffect.Hualiduanjian]==1 then
        return A*2*1.5*RuneDamage*RuneDamage2
     else
        return A*2*RuneDamage*RuneDamage2
     end
  else
      if bits2[CommonFun.AttrEffect.Hualiduanjian]==1 then
        return A*1.5
      end

  end
        return A

end

--------------------------------------------------------------------------------------------------------盗贼技能毒刃伤害计算公式(已改)
function CommonFun.calcDamage_3102(srcUser, targetUser, params, damageParam, logger)
  local Str = srcUser:GetProperty("Str")
  local Dex = srcUser:GetProperty("Dex")
  local Luk = srcUser:GetProperty("Luk")
  local Atk = srcUser:GetProperty("Atk")
  local AtkPer = srcUser:GetProperty("AtkPer")
  local DamIncrease = srcUser:GetProperty("DamIncrease")
  local IgnoreDef  = 0
  local IgnoreDef1 = srcUser:GetProperty("IgnoreDef")
  local IgnoreDef2 = srcUser:GetProperty("IgnoreEquipDef")
  if targetUser.boss or targetUser.mini then
     IgnoreDef=IgnoreDef1
  else
     IgnoreDef=(IgnoreDef1+IgnoreDef2)
  end

  if IgnoreDef >= 1 then
     IgnoreDef  = 1
  end

  local Refine = srcUser:GetProperty("Refine")

  local AttrEffect= srcUser:GetProperty("AttrEffect")
  local bits=CommonFun.getBits(AttrEffect)

  local StateEffect2 = targetUser:GetProperty("StateEffect")
  local bits2=CommonFun.getBits(StateEffect2)

  local AttrEffect3 = srcUser:GetProperty("AttrEffect")
  local bits3=CommonFun.getBits(AttrEffect3)


  local Def2 = targetUser:GetProperty("Def")
  local DefPer2 = targetUser:GetProperty("DefPer")
  local Vit2 = targetUser:GetProperty("Vit")
  local VitPer2 = targetUser:GetProperty("VitPer")
  local DamReduc2 = CommonFun.calcDamReDuc(srcUser, targetUser)
  local RefineDamReduc = targetUser:GetProperty("RefineDamReduc")

  local damChangePer = damageParam.damChangePer

  ----------------------------------------------------------------------------------------------------------------种族，体型，属性，BOSS加伤效果
  local raceparam     = CommonFun.CalcRaceParam(srcUser, targetUser, params, damageParam, logger)
  local bodyparam     = CommonFun.CalcBodyParam(srcUser, targetUser, params, damageParam, logger)
  local elementparam  = CommonFun.CalcElementParam(srcUser, targetUser, params, damageParam, logger)
  local bossparam     = CommonFun.CalcBossParam(srcUser, targetUser, params, damageParam, logger)

  ----------------------------------------------------------------------------------------------------------------种族，体型，属性，BOSS减伤效果
  local raceparam2    = CommonFun.CalcRaceParam2(srcUser, targetUser, params, damageParam, logger)
  local bodyparam2    = CommonFun.CalcBodyParam2(srcUser, targetUser, params, damageParam, logger)
  local elementparam2 = CommonFun.CalcElementParam2(srcUser, targetUser, params, damageParam, logger)
  local bossparam2    = CommonFun.CalcBossParam2(srcUser, targetUser, params, damageParam, logger)

  local BaseAtk  = Str*2 + math.floor(Str*Str/100) + math.floor(Dex/5) + math.floor(Luk/5)
  local AtkFinal = ((Atk-BaseAtk)*(1+AtkPer)*CommonFun.ShapeCorrection(srcUser,targetUser)*bodyparam*elementparam*elementparam2+BaseAtk)*raceparam*bossparam*bossparam2

  ----------------------------物理防御减免
  local DefReduc= CommonFun.CalcDef(Def,Vit,srcUser,targetUser)

  -------------------------------------------------------------------------------------------------------------紫毒短剑效果
  local Weapon=srcUser:GetEquipedID(7)
  local B = 1

  if (Weapon==40738 or Weapon==140738) then
     B = 2
  end
  -------------------------------------------------------------------------------------------------------------紫毒短剑效果 (第四档)
  local weaponRefineLv_2=srcUser:GetEquipedRefineLv(7)
  local zidu = 0

  if srcUser:HasBuffID(90001313)  then
     zidu = weaponRefineLv_2*0.1
  end


  local A = ((AtkFinal*DefReduc*(1-DamReduc2)+Refine)*(damChangePer+zidu)*(1-RefineDamReduc)*(1+DamIncrease)-Vit2*(1+VitPer2))*B

  if 1 >= A then
         return 1
  end

  ----------------------------------------------------------血之泪
  local C = 1.25
  if srcUser:HasBuffID(90001040) then-----------------------血之泪升级
      C = 1.3
  end
  if srcUser:HasBuffID(90001046) then-----------------------血之泪再升级
      C = 1.3+0.1
  end
  ----------------------------------------------------------星盘毒刃
  local Num1=srcUser:GetRunePoint(31021)
  local Num2=srcUser:GetRunePoint(31022)
  local Num3=srcUser:GetRunePoint(31023)
  local RuneDamage=Num1*0.1+Num2*0.05+Num3*0.05+1
    --------------------------------------------------------目标处于中毒状态则毒刃造成的伤害翻倍&目标身上有毒刃和无影之牙的伤害加成效果 伤害增加25%
   if bits[CommonFun.AttrEffect.DuRenAndWuYingDam]==1 and bits2[CommonFun.StateEffect.Poison]==1 and bits3[CommonFun.AttrEffect.Hualiduanjian]==1 then
         return  A*2*C*1.5*RuneDamage
   elseif bits[CommonFun.AttrEffect.DuRenAndWuYingDam]==1 and bits2[CommonFun.StateEffect.Poison]==1 then
         return  A*2*C*RuneDamage
   elseif bits[CommonFun.AttrEffect.DuRenAndWuYingDam]==1 and bits3[CommonFun.AttrEffect.Hualiduanjian]==1 then
         return  A*C*1.5
   elseif bits2[CommonFun.StateEffect.Poison]==1 and bits3[CommonFun.AttrEffect.Hualiduanjian]==1 then
         return  A*2*1.5*RuneDamage
   elseif bits[CommonFun.AttrEffect.DuRenAndWuYingDam]==1 then
         return  A*C
   elseif bits2[CommonFun.StateEffect.Poison]==1 then
         return  A*2*RuneDamage
   elseif bits3[CommonFun.AttrEffect.Hualiduanjian]==1 then
         return  A*1.5
   end

   return A
end

--------------------------------------------------------------------------------------------------------盗贼音速投掷技能伤害计算公式(已改)
function CommonFun.calcDamage_3103(srcUser, targetUser, params, damageParam, logger)
  local Str = srcUser:GetProperty("Str")
  local Dex = srcUser:GetProperty("Dex")
  local Luk = srcUser:GetProperty("Luk")
  local Atk = srcUser:GetProperty("Atk")
  local AtkPer = srcUser:GetProperty("AtkPer")
  local DamIncrease = srcUser:GetProperty("DamIncrease")
  local IgnoreDef  = 0
  local IgnoreDef1 = srcUser:GetProperty("IgnoreDef")
  local IgnoreDef2 = srcUser:GetProperty("IgnoreEquipDef")
  if targetUser.boss or targetUser.mini then
     IgnoreDef=IgnoreDef1
  else
     IgnoreDef=(IgnoreDef1+IgnoreDef2)
  end

  if IgnoreDef >= 1 then
     IgnoreDef  = 1
  end

  local Refine = srcUser:GetProperty("Refine")

  local skilllv_1 = srcUser:GetLernedSkillLevel(damageParam.skill1_id)

  local AttrEffect= srcUser:GetProperty("AttrEffect")
  local bits=CommonFun.getBits(AttrEffect)


  local Def2 = targetUser:GetProperty("Def")
  local DefPer2 = targetUser:GetProperty("DefPer")
  local Vit2 = targetUser:GetProperty("Vit")
  local VitPer2 = targetUser:GetProperty("VitPer")
  local DamReduc2 = CommonFun.calcDamReDuc(srcUser, targetUser)
  local RefineDamReduc = targetUser:GetProperty("RefineDamReduc")

  local damChangePer = damageParam.damChangePer

  ----------------------------------------------------------------------------------------------------------------种族，体型，属性，BOSS加伤效果
  local raceparam     = CommonFun.CalcRaceParam(srcUser, targetUser, params, damageParam, logger)
  local bodyparam     = CommonFun.CalcBodyParam(srcUser, targetUser, params, damageParam, logger)
  local elementparam  = CommonFun.CalcElementParam(srcUser, targetUser, params, damageParam, logger)
  local bossparam     = CommonFun.CalcBossParam(srcUser, targetUser, params, damageParam, logger)

  ----------------------------------------------------------------------------------------------------------------种族，体型，属性，BOSS减伤效果
  local raceparam2    = CommonFun.CalcRaceParam2(srcUser, targetUser, params, damageParam, logger)
  local bodyparam2    = CommonFun.CalcBodyParam2(srcUser, targetUser, params, damageParam, logger)
  local elementparam2 = CommonFun.CalcElementParam2(srcUser, targetUser, params, damageParam, logger)
  local bossparam2    = CommonFun.CalcBossParam2(srcUser, targetUser, params, damageParam, logger)

  local BaseAtk  = Str*2 + math.floor(Str*Str/100) + math.floor(Dex/5) + math.floor(Luk/5)
  local AtkFinal = ((Atk-BaseAtk)*(1+AtkPer)*CommonFun.ShapeCorrection(srcUser,targetUser)*bodyparam*elementparam*elementparam2+BaseAtk)*raceparam*bossparam*bossparam2
  --print("Atk="..Atk,"BaseAtk="..BaseAtk,"AtkPer="..AtkPer,"bodyparam="..bodyparam,"elementparam="..elementparam,"elementparam2="..elementparam2,"raceparam="..raceparam)
  ----------------------------物理防御减免
  local DefReduc= CommonFun.CalcDef(Def,Vit,srcUser,targetUser)
  ----------------------------------------------灰森灵卡片存储
  local card = 1
  if srcUser:HasBuffID(80012130) then
      card = 1.05
  end

    ----------------------------------------------沙漠之风
  local shamo = 0
  local RefineLv1=srcUser:GetEquipedRefineLv(7)
  if srcUser:HasBuffID(90001293) then
    if RefineLv1==15 then
      shamo = 1
    end
  end
  ----------------------------------------------荒漠风暴
  if srcUser:HasBuffID(41850) then
    if RefineLv1==15 then
      shamo = 1
    end
  end
  ---------------------------------------时之吟游
  local Wing=srcUser:GetEquipedID(11)
  local RefineLv=srcUser:GetEquipedRefineLv(11)
  local time = 1
  if Wing == 45249 then
      time = 1 + RefineLv/100
  end
  local Num1 = srcUser:GetRunePoint(33010)
  local RuneDamage = Num1*0.02
  local DefReduc2=math.min(1,DefReduc+RuneDamage)
  ---------------------------------------------------------------------------------------------------------------------------------------------------------包含被动技能音速强化带来的加成效果
  local A = ((AtkFinal*DefReduc2*(1-DamReduc2)+Refine)*(damChangePer+card+shamo)*(1+skilllv_1*0.2)*(1-RefineDamReduc)*(1+DamIncrease)-Vit2*(1+VitPer2))*time*card

  -----------------------------------------------十字斩
  local skillID, skillLevel = CommonFun.UnmergeSkillID(params.skillIDAndLevel)
  ----------------------------------------------------------
    if skillID==1111 then
        --------------------------------------------
        local skilllv_yintou = srcUser:GetLernedSkillLevel(181)---音速投掷
        local skilllv_shizi = srcUser:GetLernedSkillLevel(1111)---十字
        local damChangePer = 2.4
        if skilllv_yintou<=10 then
            damChangePer = 2+0.4*skilllv_yintou
        elseif skilllv_yintou>10 then
            damChangePer =6 + 0.2*(skilllv_yintou-10)
        end
        A = ((AtkFinal*DefReduc2*(1-DamReduc2)+Refine)*(damChangePer+card+shamo)*(1+skilllv_1*0.2)*(1-RefineDamReduc)*(1+DamIncrease)-Vit2*(1+VitPer2))*time*card*(1+0.06*skilllv_shizi)
    end

   if 1 >= A then
         return 1
   end

  if bits[CommonFun.AttrEffect.Hualiduanjian]==1 then
     return A*1.5
  end

  return A

end
-----------------------------------------------------------------------------------------------------------------------近战刺客系斩击技能伤害计算公式(已改)
function CommonFun.calcDamage_3104(srcUser, targetUser, params, damageParam, logger)
  local Str = srcUser:GetProperty("Str")
  local Dex = srcUser:GetProperty("Dex")
  local Luk = srcUser:GetProperty("Luk")
  local Atk = srcUser:GetProperty("Atk")
  local AtkPer = srcUser:GetProperty("AtkPer")
  local DamIncrease = srcUser:GetProperty("DamIncrease")
  local IgnoreDef  = 0
  local IgnoreDef1 = srcUser:GetProperty("IgnoreDef")
  local IgnoreDef2 = srcUser:GetProperty("IgnoreEquipDef")
  if targetUser.boss or targetUser.mini then
     IgnoreDef=IgnoreDef1
  else
     IgnoreDef=(IgnoreDef1+IgnoreDef2)
  end

  if IgnoreDef >= 1 then
     IgnoreDef  = 1
  end

  local Refine = srcUser:GetProperty("Refine")

  local Def2 = targetUser:GetProperty("Def")
  local DefPer2 = targetUser:GetProperty("DefPer")
  local Vit2 = targetUser:GetProperty("Vit")
  local VitPer2 = targetUser:GetProperty("VitPer")
  local DamReduc2 = CommonFun.calcDamReDuc(srcUser, targetUser)
  local RefineDamReduc = targetUser:GetProperty("RefineDamReduc")
  local Hp2 = targetUser:GetProperty("Hp")
  local MaxHp2 = targetUser:GetProperty("MaxHp")

  local damChangePer = damageParam.damChangePer
  local AttrEffect= srcUser:GetProperty("AttrEffect")
  local bits=CommonFun.getBits(AttrEffect)

  ----------------------------------------------------------------------------------------------------------------种族，体型，属性，BOSS加伤效果
  local raceparam     = CommonFun.CalcRaceParam(srcUser, targetUser, params, damageParam, logger)
  local bodyparam     = CommonFun.CalcBodyParam(srcUser, targetUser, params, damageParam, logger)
  local elementparam  = CommonFun.CalcElementParam(srcUser, targetUser, params, damageParam, logger)
  local bossparam     = CommonFun.CalcBossParam(srcUser, targetUser, params, damageParam, logger)

  ----------------------------------------------------------------------------------------------------------------种族，体型，属性，BOSS减伤效果
  local raceparam2    = CommonFun.CalcRaceParam2(srcUser, targetUser, params, damageParam, logger)
  local bodyparam2    = CommonFun.CalcBodyParam2(srcUser, targetUser, params, damageParam, logger)
  local elementparam2 = CommonFun.CalcElementParam2(srcUser, targetUser, params, damageParam, logger)
  local bossparam2    = CommonFun.CalcBossParam2(srcUser, targetUser, params, damageParam, logger)

  local BaseAtk  = Str*2 + math.floor(Str*Str/100) + math.floor(Dex/5) + math.floor(Luk/5)
  local AtkFinal = ((Atk-BaseAtk)*(1+AtkPer)*CommonFun.ShapeCorrection(srcUser,targetUser)*bodyparam*elementparam*elementparam2+BaseAtk)*raceparam*bossparam*bossparam2

  ----------------------------物理防御减免
  local DefReduc= CommonFun.CalcDef(Def,Vit,srcUser,targetUser)

  local A = (AtkFinal*DefReduc*(1-DamReduc2)+Refine)*damChangePer*(1-RefineDamReduc)*(1+DamIncrease)-Vit2*(1+VitPer2)

   if 1 >= A then
         return 1
   end
   --------------------------------------------------------------------------------------------------------------------斩击效果当目标生命值低于当前血量伤害的30%时会造成额外伤害
   if Hp2<=MaxHp2*0.3 then
      if bits[CommonFun.AttrEffect.Hualiduanjian]==1 then
           return A*2*1.5
      else
           return A*2
      end
   else
     if  bits[CommonFun.AttrEffect.Hualiduanjian]==1 then
           return A*1.5
     end
   end

   return A

end

-----------------------------------------------------------------------------------------------------------------------近战刺客系心灵震波技能伤害公式(已改)
function CommonFun.calcDamage_3105(srcUser, targetUser, params, damageParam, logger)
  local Int = srcUser:GetProperty("Int")
  local Str = srcUser:GetProperty("Str")
  local Dex = srcUser:GetProperty("Dex")
  local Luk = srcUser:GetProperty("Luk")
  local Atk = srcUser:GetProperty("Atk")
  local AtkPer = srcUser:GetProperty("AtkPer")
  local DamIncrease = srcUser:GetProperty("DamIncrease")
  local IgnoreDef  = 0
  local IgnoreDef1 = srcUser:GetProperty("IgnoreDef")
  local IgnoreDef2 = srcUser:GetProperty("IgnoreEquipDef")
  if targetUser.boss or targetUser.mini then
     IgnoreDef=IgnoreDef1
  else
     IgnoreDef=(IgnoreDef1+IgnoreDef2)
  end

  if IgnoreDef >= 1 then
     IgnoreDef  = 1
  end

  local Refine = srcUser:GetProperty("Refine")
  local Def2 = targetUser:GetProperty("Def")
  local DefPer2 = targetUser:GetProperty("DefPer")
  local Vit2 = targetUser:GetProperty("Vit")
  local VitPer2 = targetUser:GetProperty("VitPer")
  local DamReduc2 = CommonFun.calcDamReDuc(srcUser, targetUser)
  local RefineDamReduc = targetUser:GetProperty("RefineDamReduc")
  local damChangePer  = damageParam.damChangePer
  local damChangePer1 = damageParam.damChangePer1

  local AttrEffect= srcUser:GetProperty("AttrEffect")
  local bits=CommonFun.getBits(AttrEffect)

  ----------------------------------------------------------------------------------------------------------------种族，体型，属性，BOSS加伤效果
  local raceparam     = CommonFun.CalcRaceParam(srcUser, targetUser, params, damageParam, logger)
  local bodyparam     = CommonFun.CalcBodyParam(srcUser, targetUser, params, damageParam, logger)
  local elementparam  = CommonFun.CalcElementParam(srcUser, targetUser, params, damageParam, logger)
  local bossparam     = CommonFun.CalcBossParam(srcUser, targetUser, params, damageParam, logger)

  ----------------------------------------------------------------------------------------------------------------种族，体型，属性，BOSS减伤效果
  local raceparam2    = CommonFun.CalcRaceParam2(srcUser, targetUser, params, damageParam, logger)
  local bodyparam2    = CommonFun.CalcBodyParam2(srcUser, targetUser, params, damageParam, logger)
  local elementparam2 = CommonFun.CalcElementParam2(srcUser, targetUser, params, damageParam, logger)
  local bossparam2    = CommonFun.CalcBossParam2(srcUser, targetUser, params, damageParam, logger)

  local BaseAtk  = Str*2 + math.floor(Str*Str/100) + math.floor(Dex/5) + math.floor(Luk/5)
  local AtkFinal = ((Atk-BaseAtk)*(1+AtkPer)*CommonFun.ShapeCorrection(srcUser,targetUser)*bodyparam*elementparam*elementparam2+BaseAtk)*raceparam*bossparam*bossparam2

  ----------------------------物理防御减免
  local DefReduc= CommonFun.CalcDef(Def,Vit,srcUser,targetUser)

  local Num1=srcUser:GetRunePoint(32060)
  local Num2=srcUser:GetRunePoint(32080)
  local RuneDamage1=0.2*Num1+1
  local RuneDamage2=6*Num2

  --幸运短剑判断规则
  local Bracelet=srcUser:GetEquipedID(1)
  local Weapon=srcUser:GetEquipedID(7)
  local RefineLv=srcUser:GetEquipedRefineLv(7)
  local LuckKnifeRatio = 1

  --目前只有尼罗手环是算远程
  if RefineLv == 15 and (Weapon == 140715 or Weapon == 40715) and (Bracelet == 61506 or Bracelet == 161506) then
    LuckKnifeRatio=1.15
  end
  ------------------------------------------------尼罗手环精炼效果加成
  local RefineLv1=srcUser:GetEquipedRefineLv(1)

  if RefineLv == 15 and (Weapon == 140715 or Weapon == 40715) and (Bracelet == 61506 or Bracelet == 161506)  and (RefineLv1>=10 and  RefineLv1<15) and srcUser:HasBuffID(90001863) then
    LuckKnifeRatio = LuckKnifeRatio+0.02
  elseif RefineLv == 15 and (Weapon == 140715 or Weapon == 40715) and (Bracelet == 61506 or Bracelet == 161506)  and  RefineLv1==15  and srcUser:HasBuffID(90001863)  then
    LuckKnifeRatio = LuckKnifeRatio+0.06
  end
  ------------------------------------------------------------------心灵威慑
  local StateEffect = targetUser:GetProperty("StateEffect")
  local bits=CommonFun.getBits(StateEffect)
  local skilllv_1 = srcUser:GetLernedSkillLevel(1108)
  local Fear = 1
  local WeaponType =srcUser:GetEquipedWeaponType()
  -----------------------------------------------------------------双刀增伤
  if skilllv_1>10 and WeaponType==250 then
      Fear = Fear + (skilllv_1-10)*0.03
  end
  -----------------------------------------------------------------恐惧增伤
  if bits[CommonFun.StateEffect.Fear] ==1 and skilllv_1>=1 then
      Fear = Fear + math.min(skilllv_1,10)*0.03
  end

  local A = ((AtkFinal*DefReduc*(1-DamReduc2)+Refine)*damChangePer+Int*(5*damChangePer1+20+RuneDamage2)+math.random(Int*5*RuneDamage1,Int*50*RuneDamage1)-Vit2*(1+VitPer2))*(1-RefineDamReduc)*(1+DamIncrease)*LuckKnifeRatio*Fear

  if 1 >= A then
      return 1
  end

  if bits[CommonFun.AttrEffect.Hualiduanjian]==1  then
     return A*1.5
  end

--------------------------------------------------幸运短剑[4档]

  local Weapon=srcUser:GetEquipedID(7)
  local RefineLv7=srcUser:GetEquipedRefineLv(7)
  local xinling=0
  if (srcUser:HasBuffID(90001973) and RefineLv7>=10 )then
     xinling=0.2
  end
  if Weapon==40715 or Weapon==140715 then
     return A*(1.2+xinling)
  end



  return A

  end

---------------------------------------------------------------------------------------------------------------------------近战刺客强刃击伤害公式
function CommonFun.calcDamage_3106(srcUser, targetUser, params, damageParam, logger)
  local Str = srcUser:GetProperty("Str")
  local Dex = srcUser:GetProperty("Dex")
  local Luk = srcUser:GetProperty("Luk")
  local Atk = srcUser:GetProperty("Atk")
  local AtkPer = srcUser:GetProperty("AtkPer")
  local DamIncrease = srcUser:GetProperty("DamIncrease")
  local IgnoreDef  = 0
  local IgnoreDef1 = srcUser:GetProperty("IgnoreDef")
  local IgnoreDef2 = srcUser:GetProperty("IgnoreEquipDef")
  if targetUser.boss or targetUser.mini then
     IgnoreDef=IgnoreDef1
  else
     IgnoreDef=(IgnoreDef1+IgnoreDef2)
  end

  if IgnoreDef >= 1 then
     IgnoreDef  = 1
  end
  ------------------------------------------------------------------------------------将原来的物伤加成改成精炼物理攻击
  local Refine = srcUser:GetProperty("Refine")

  local Def2 = targetUser:GetProperty("Def")
  local DefPer2 = targetUser:GetProperty("DefPer")
  local Vit2 = targetUser:GetProperty("Vit")
  local VitPer2 = targetUser:GetProperty("VitPer")
  local DamReduc2 = CommonFun.calcDamReDuc(srcUser, targetUser)
  local RefineDamReduc = targetUser:GetProperty("RefineDamReduc")
  local damChangePer  = damageParam.damChangePer
  local damChangePer1 = damageParam.damChangePer1

  local AttrEffect2 = srcUser:GetProperty("AttrEffect")
  local bits2=CommonFun.getBits(AttrEffect2)

  ----------------------------------------------------------------------------------------------------------------种族，体型，属性，BOSS加伤效果
  local raceparam     = CommonFun.CalcRaceParam(srcUser, targetUser, params, damageParam, logger)
  local bodyparam     = CommonFun.CalcBodyParam(srcUser, targetUser, params, damageParam, logger)
  local elementparam  = CommonFun.CalcElementParam(srcUser, targetUser, params, damageParam, logger)
  local bossparam     = CommonFun.CalcBossParam(srcUser, targetUser, params, damageParam, logger)

  ----------------------------------------------------------------------------------------------------------------种族，体型，属性，BOSS减伤效果
  local raceparam2    = CommonFun.CalcRaceParam2(srcUser, targetUser, params, damageParam, logger)
  local bodyparam2    = CommonFun.CalcBodyParam2(srcUser, targetUser, params, damageParam, logger)
  local elementparam2 = CommonFun.CalcElementParam2(srcUser, targetUser, params, damageParam, logger)
  local bossparam2    = CommonFun.CalcBossParam2(srcUser, targetUser, params, damageParam, logger)

  local BaseAtk  = Str*2 + math.floor(Str*Str/100) + math.floor(Dex/5) + math.floor(Luk/5)
  local AtkFinal = ((Atk-BaseAtk)*(1+AtkPer)*CommonFun.ShapeCorrection(srcUser,targetUser)*bodyparam*elementparam*elementparam2+BaseAtk)*raceparam*bossparam*bossparam2

  ----------------------------物理防御减免
  local DefReduc= CommonFun.CalcDef(Def,Vit,srcUser,targetUser)

  local A = ((AtkFinal*DefReduc*(1-DamReduc2)+Refine)*damChangePer*(1+DamIncrease) + damChangePer1)*(1-RefineDamReduc)-Vit2*(1+VitPer2)
      if 1 >= A then
         return 1
      end
  ---------------------------------------------------------------------------------------------------------------------星盘强刃击
  local Num1=srcUser:GetRunePoint(31016)
  local StateEffect = targetUser:GetProperty("StateEffect")
  local bits=CommonFun.getBits(StateEffect)
  local a = Num1*10

  if bits[CommonFun.StateEffect.Poison] ==1  and CommonFun.IsInRate(a, srcUser:GetRandom()) and bits2[CommonFun.AttrEffect.Hualiduanjian]==1 then
        return A*2*1.5, CommonFun.DamageType.Crit
  elseif bits[CommonFun.StateEffect.Poison] ==1  and CommonFun.IsInRate(a, srcUser:GetRandom()) then
        return A*2, CommonFun.DamageType.Crit
  elseif bits2[CommonFun.AttrEffect.Hualiduanjian]==1 then
        return A*1.5
  end

  return A
end
  ---------------------------------------------------------------------------------------------------------------------------近战刺客系无影之牙伤害计算公式（已改）
function CommonFun.calcDamage_3201(srcUser, targetUser, params, damageParam, logger)
  local Str = srcUser:GetProperty("Str")
  local Dex = srcUser:GetProperty("Dex")
  local Luk = srcUser:GetProperty("Luk")
  local Atk = srcUser:GetProperty("Atk")
  local AtkPer = srcUser:GetProperty("AtkPer")
  local DamIncrease = srcUser:GetProperty("DamIncrease")
  local IgnoreDef  = 0
  local IgnoreDef1 = srcUser:GetProperty("IgnoreDef")
  local IgnoreDef2 = srcUser:GetProperty("IgnoreEquipDef")
  if targetUser.boss or targetUser.mini then
     IgnoreDef=IgnoreDef1
  else
     IgnoreDef=(IgnoreDef1+IgnoreDef2)
  end

  if IgnoreDef >= 1 then
     IgnoreDef  = 1
  end

  ------------------------------------------------------------------------------------将原来的物伤加成改成精炼物理攻击
  local Refine = srcUser:GetProperty("Refine")
  local AttrEffect= srcUser:GetProperty("AttrEffect")
  local bits=CommonFun.getBits(AttrEffect)

  local AttrEffect2= srcUser:GetProperty("AttrEffect")
  local bits2=CommonFun.getBits(AttrEffect2)

  local Def2 = targetUser:GetProperty("Def")
  local DefPer2 = targetUser:GetProperty("DefPer")
  local Vit2 = targetUser:GetProperty("Vit")
  local VitPer2 = targetUser:GetProperty("VitPer")
  local DamReduc2 = CommonFun.calcDamReDuc(srcUser, targetUser)
  local RefineDamReduc = targetUser:GetProperty("RefineDamReduc")
  local damChangePer  = damageParam.damChangePer
  local damChangePer1 = damageParam.damChangePer1

  ----------------------------------------------------------------------------------------------------------------种族，体型，属性，BOSS加伤效果
  local raceparam     = CommonFun.CalcRaceParam(srcUser, targetUser, params, damageParam, logger)
  local bodyparam     = CommonFun.CalcBodyParam(srcUser, targetUser, params, damageParam, logger)
  local elementparam  = CommonFun.CalcElementParam(srcUser, targetUser, params, damageParam, logger)
  local bossparam     = CommonFun.CalcBossParam(srcUser, targetUser, params, damageParam, logger)

  ----------------------------------------------------------------------------------------------------------------种族，体型，属性，BOSS减伤效果
  local raceparam2    = CommonFun.CalcRaceParam2(srcUser, targetUser, params, damageParam, logger)
  local bodyparam2    = CommonFun.CalcBodyParam2(srcUser, targetUser, params, damageParam, logger)
  local elementparam2 = CommonFun.CalcElementParam2(srcUser, targetUser, params, damageParam, logger)
  local bossparam2    = CommonFun.CalcBossParam2(srcUser, targetUser, params, damageParam, logger)

  local BaseAtk  = Str*2 + math.floor(Str*Str/100) + math.floor(Dex/5) + math.floor(Luk/5)
  local AtkFinal = ((Atk-BaseAtk)*(1+AtkPer)*CommonFun.ShapeCorrection(srcUser,targetUser)*bodyparam*elementparam*elementparam2+BaseAtk)*raceparam*bossparam*bossparam2

  ----------------------------物理防御减免
  local DefReduc= CommonFun.CalcDef(Def,Vit,srcUser,targetUser)
  ----------------------------------------------------------------------------------------------------------------星盘无影之牙
  local Num1=srcUser:GetRunePoint(32026)
  local Num2=srcUser:GetRunePoint(32027)
  local Num3=srcUser:GetRunePoint(32028)
  local Num4=srcUser:GetRunePoint(32029)
  local Num5=srcUser:GetRunePoint(32030)
  local RuneDamage=Num1*0.1+Num2*0.05+Num3*0.05+Num4*0.1+Num5*0.05+1

  local Num6=srcUser:GetRunePoint(32019)
  local Num7=srcUser:GetRunePoint(32020)
  local Num8=srcUser:GetRunePoint(32021)
  local Num9=srcUser:GetRunePoint(32022)
  local Num10=srcUser:GetRunePoint(32023)
  local RuneDamage2=Num6*0.2+Num7*0.2+Num8*0.4+Num9*0.2+Num10*0.4+1
  local RuneRate=(Num6 + Num7 + Num8 + Num9 + Num10)*5


  local A =(((AtkFinal*DefReduc*(1-DamReduc2)+Refine)*damChangePer*(1+DamIncrease) + damChangePer1)*(1-RefineDamReduc)-Vit2*(1+VitPer2))*RuneDamage

  if 1 >= A then
     return 1
  end
  ----------------------------------------------------------血之泪
  ----------------------------------------------------------血之泪再升级
  local B = 1
  if bits[CommonFun.AttrEffect.DuRenAndWuYingDam]==1 and srcUser:HasBuffID(90001044) and srcUser:HasBuffID(90001047)then
      B = 2
  elseif bits[CommonFun.AttrEffect.DuRenAndWuYingDam]==1 and srcUser:HasBuffID(90001044) then
      B = 1.8
  elseif bits[CommonFun.AttrEffect.DuRenAndWuYingDam]==1 then
      B = 1.5
  end
  ----------------------------------------------------------华丽短剑
  local C = 1
  if bits2[CommonFun.AttrEffect.Hualiduanjian]==1 then
      C = 1.5
  end

  if CommonFun.IsInRate(RuneRate, srcUser:GetRandom()) then
      return A*B*C*RuneDamage2, CommonFun.DamageType.Crit
  end

  --print("A="..A,"B="..B,"C="..C,"RuneDamage2="..RuneDamage2)

  return A*B*C
end
---------------------------------------------------------------------------------------------------------------------------近战刺客系剧毒暗器伤害公式
function CommonFun.calcDamage_3202(srcUser, targetUser, params, damageParam, logger)
  local Str = srcUser:GetProperty("Str")
  local Dex = srcUser:GetProperty("Dex")
  local Luk = srcUser:GetProperty("Luk")
  local Atk = srcUser:GetProperty("Atk")
  local AtkPer = srcUser:GetProperty("AtkPer")
  local DamIncrease = srcUser:GetProperty("DamIncrease")
  local IgnoreDef  = 0
  local IgnoreDef1 = srcUser:GetProperty("IgnoreDef")
  local IgnoreDef2 = srcUser:GetProperty("IgnoreEquipDef")
  if targetUser.boss or targetUser.mini then
     IgnoreDef=IgnoreDef1
  else
     IgnoreDef=(IgnoreDef1+IgnoreDef2)
  end

  if IgnoreDef >= 1 then
     IgnoreDef  = 1
  end
  ------------------------------------------------------------------------------------将原来的物伤加成改成精炼物理攻击
  local Refine = srcUser:GetProperty("Refine")

  local Def2 = targetUser:GetProperty("Def")
  local DefPer2 = targetUser:GetProperty("DefPer")
  local Vit2 = targetUser:GetProperty("Vit")
  local VitPer2 = targetUser:GetProperty("VitPer")
  local DamReduc2 = CommonFun.calcDamReDuc(srcUser, targetUser)
  local RefineDamReduc = targetUser:GetProperty("RefineDamReduc")
  local damChangePer  = damageParam.damChangePer
  local damChangePer1 = damageParam.damChangePer1

  local AttrEffect2 = srcUser:GetProperty("AttrEffect")
  local bits2=CommonFun.getBits(AttrEffect2)


  ----------------------------------------------------------------------------------------------------------------种族，体型，属性，BOSS加伤效果
  local raceparam     = CommonFun.CalcRaceParam(srcUser, targetUser, params, damageParam, logger)
  local bodyparam     = CommonFun.CalcBodyParam(srcUser, targetUser, params, damageParam, logger)
  local elementparam  = CommonFun.CalcElementParam(srcUser, targetUser, params, damageParam, logger)
  local bossparam     = CommonFun.CalcBossParam(srcUser, targetUser, params, damageParam, logger)

  ----------------------------------------------------------------------------------------------------------------种族，体型，属性，BOSS减伤效果
  local raceparam2    = CommonFun.CalcRaceParam2(srcUser, targetUser, params, damageParam, logger)
  local bodyparam2    = CommonFun.CalcBodyParam2(srcUser, targetUser, params, damageParam, logger)
  local elementparam2 = CommonFun.CalcElementParam2(srcUser, targetUser, params, damageParam, logger)
  local bossparam2    = CommonFun.CalcBossParam2(srcUser, targetUser, params, damageParam, logger)

  local BaseAtk  = Str*2 + math.floor(Str*Str/100) + math.floor(Dex/5) + math.floor(Luk/5)
  local AtkFinal = ((Atk-BaseAtk)*(1+AtkPer)*CommonFun.ShapeCorrection(srcUser,targetUser)*bodyparam*elementparam*elementparam2+BaseAtk)*raceparam*bossparam*bossparam2

  ----------------------------物理防御减免
  local DefReduc= CommonFun.CalcDef(Def,Vit,srcUser,targetUser)
  ---------------------------------------------------------------------------------------------------------------------星盘剧毒暗器
  local Num1=srcUser:GetRunePoint(32006)
  local Num2=srcUser:GetRunePoint(32007)
  local Num3=srcUser:GetRunePoint(32008)
  local Num4=srcUser:GetRunePoint(32009)
  local RuneDamage=Num1*0.05+Num2*0.1+Num3*0.1+Num4*0.05+1

  local A = (((AtkFinal*DefReduc*(1-DamReduc2)+Refine)*damChangePer*(1+DamIncrease) + damChangePer1)*(1-RefineDamReduc)-Vit2*(1+VitPer2))*RuneDamage
      if 1 >= A then
         return 1
      end

  if bits2[CommonFun.AttrEffect.Hualiduanjian]==1 then
     return A*1.5
  end

  return A
end
-----------------------------------------------------------------------------------------------------------------------近战刺客系技能黑暗瞬间伤害计算公式(已改)
function CommonFun.calcDamage_3301(srcUser, targetUser, params, damageParam, logger)
  local Str = srcUser:GetProperty("Str")
  local Dex = srcUser:GetProperty("Dex")
  local Luk = srcUser:GetProperty("Luk")
  local Atk = srcUser:GetProperty("Atk")
  local AtkPer = srcUser:GetProperty("AtkPer")
  local DamIncrease = srcUser:GetProperty("DamIncrease")
  local IgnoreDef  = 0
  local IgnoreDef1 = srcUser:GetProperty("IgnoreDef")
  local IgnoreDef2 = srcUser:GetProperty("IgnoreEquipDef")
  if targetUser.boss or targetUser.mini then
     IgnoreDef=IgnoreDef1
  else
     IgnoreDef=(IgnoreDef1+IgnoreDef2)
  end

  if IgnoreDef >= 1 then
     IgnoreDef  = 1
  end

  local Refine = srcUser:GetProperty("Refine")

  local AttrEffect = srcUser:GetProperty("AttrEffect")
  local bits=CommonFun.getBits(AttrEffect)

  local AttrEffect2= srcUser:GetProperty("AttrEffect")
  local bits2=CommonFun.getBits(AttrEffect2)

  local Def2 = targetUser:GetProperty("Def")
  local DefPer2 = targetUser:GetProperty("DefPer")
  local Vit2 = targetUser:GetProperty("Vit")
  local VitPer2 = targetUser:GetProperty("VitPer")
  local DamReduc2 = CommonFun.calcDamReDuc(srcUser, targetUser)
  local RefineDamReduc = targetUser:GetProperty("RefineDamReduc")
  local StateEffect2 = targetUser:GetProperty("StateEffect")
  local bits2=CommonFun.getBits(StateEffect2)

  local damChangePer = damageParam.damChangePer

  ----------------------------------------------------------------------------------------------------------------种族，体型，属性，BOSS加伤效果
  local raceparam     = CommonFun.CalcRaceParam(srcUser, targetUser, params, damageParam, logger)
  local bodyparam     = CommonFun.CalcBodyParam(srcUser, targetUser, params, damageParam, logger)
  local elementparam  = CommonFun.CalcElementParam(srcUser, targetUser, params, damageParam, logger)
  local bossparam     = CommonFun.CalcBossParam(srcUser, targetUser, params, damageParam, logger)

  ----------------------------------------------------------------------------------------------------------------种族，体型，属性，BOSS减伤效果
  local raceparam2    = CommonFun.CalcRaceParam2(srcUser, targetUser, params, damageParam, logger)
  local bodyparam2    = CommonFun.CalcBodyParam2(srcUser, targetUser, params, damageParam, logger)
  local elementparam2 = CommonFun.CalcElementParam2(srcUser, targetUser, params, damageParam, logger)
  local bossparam2    = CommonFun.CalcBossParam2(srcUser, targetUser, params, damageParam, logger)

  local BaseAtk  = Str*2 + math.floor(Str*Str/100) + math.floor(Dex/5) + math.floor(Luk/5)
  local AtkFinal = ((Atk-BaseAtk)*(1+AtkPer)*CommonFun.ShapeCorrection(srcUser,targetUser)*bodyparam*elementparam*elementparam2+BaseAtk)*raceparam*bossparam*bossparam2

  ----------------------------物理防御减免
  local DefReduc= CommonFun.CalcDef(Def,Vit,srcUser,targetUser)

  local A = (AtkFinal*DefReduc*(1-DamReduc2)+Refine)*damChangePer*(1+DamIncrease)*(1-RefineDamReduc)-Vit2*(1+VitPer2)

   if 1 >= A then
         return 1
   end
  -----------------------------------------------------------------------------------------------------------------星盘黑暗瞬间
  local Num1=srcUser:GetRunePoint(32120)
  local a=0
  if Num1>0 then
    a=20
  end
  local RuneDamage=Num1*0.1+1
  -----------------------------------------------------------------------------------------------------------------装备上黑暗瞬间效果带来的伤害加成
  if bits[CommonFun.AttrEffect.HeiAnDam]==1 and bits2[CommonFun.AttrEffect.Hualiduanjian]==1 and CommonFun.IsInRate(a, srcUser:GetRandom()) then
         return A*1.5*1.5*RuneDamage,CommonFun.DamageType.Crit
  elseif bits[CommonFun.AttrEffect.HeiAnDam]==1 and CommonFun.IsInRate(a, srcUser:GetRandom()) then
         return A*1.5*RuneDamage,CommonFun.DamageType.Crit
  elseif bits2[CommonFun.AttrEffect.Hualiduanjian]==1 and CommonFun.IsInRate(a, srcUser:GetRandom()) then
         return A*1.5*RuneDamage,CommonFun.DamageType.Crit
  elseif CommonFun.IsInRate(a, srcUser:GetRandom()) then
         return A*RuneDamage,CommonFun.DamageType.Crit
  elseif bits[CommonFun.AttrEffect.HeiAnDam]==1 then
         return A*1.5
  elseif bits2[CommonFun.AttrEffect.Hualiduanjian]==1 then
         return A*1.5
  end

  return A

end
-----------------------------------------------------------------------------------------------------------------------十字切割者 技能 计算公式
function CommonFun.calcDamage_3401(srcUser, targetUser, params, damageParam, logger)
  local Str = srcUser:GetProperty("Str")
  local Dex = srcUser:GetProperty("Dex")
  local Luk = srcUser:GetProperty("Luk")
  local Atk = srcUser:GetProperty("Atk")
  local AtkPer = srcUser:GetProperty("AtkPer")
  local DamIncrease = srcUser:GetProperty("DamIncrease")
  local IgnoreDef  = 0
  local IgnoreDef1 = srcUser:GetProperty("IgnoreDef")
  local IgnoreDef2 = srcUser:GetProperty("IgnoreEquipDef")
  if targetUser.boss or targetUser.mini then
     IgnoreDef=IgnoreDef1
  else
     IgnoreDef=(IgnoreDef1+IgnoreDef2)
  end

  if IgnoreDef >= 1 then
     IgnoreDef  = 1
  end

  local WeaponType =srcUser:GetEquipedWeaponType()
  local skilllv_1 = srcUser:GetLernedSkillLevel(damageParam.skill1_id)
  ------------------------------------------------------------------------------------将原来的物伤加成改成精炼物理攻击
  local Refine = srcUser:GetProperty("Refine")

  local Def2 = targetUser:GetProperty("Def")
  local DefPer2 = targetUser:GetProperty("DefPer")
  local Vit2 = targetUser:GetProperty("Vit")
  local VitPer2 = targetUser:GetProperty("VitPer")
  local DamReduc2 = CommonFun.calcDamReDuc(srcUser, targetUser)
  local RefineDamReduc = targetUser:GetProperty("RefineDamReduc")

  local AttrEffect2 = srcUser:GetProperty("AttrEffect")
  local bits2=CommonFun.getBits(AttrEffect2)
  local damChangePer  = damageParam.damChangePer
  ----------------------------------------------------------------------------------------------------------------种族，体型，属性，BOSS加伤效果
  local raceparam     = CommonFun.CalcRaceParam(srcUser, targetUser, params, damageParam, logger)
  local bodyparam     = CommonFun.CalcBodyParam(srcUser, targetUser, params, damageParam, logger)
  local elementparam  = CommonFun.CalcElementParam(srcUser, targetUser, params, damageParam, logger)
  local bossparam     = CommonFun.CalcBossParam(srcUser, targetUser, params, damageParam, logger)

  ----------------------------------------------------------------------------------------------------------------种族，体型，属性，BOSS减伤效果
  local raceparam2    = CommonFun.CalcRaceParam2(srcUser, targetUser, params, damageParam, logger)
  local bodyparam2    = CommonFun.CalcBodyParam2(srcUser, targetUser, params, damageParam, logger)
  local elementparam2 = CommonFun.CalcElementParam2(srcUser, targetUser, params, damageParam, logger)
  local bossparam2    = CommonFun.CalcBossParam2(srcUser, targetUser, params, damageParam, logger)

  local BaseAtk  = Str*2 + math.floor(Str*Str/100) + math.floor(Dex/5) + math.floor(Luk/5)
  local AtkFinal = ((Atk-BaseAtk)*(1+AtkPer)*CommonFun.ShapeCorrection(srcUser,targetUser)*bodyparam*elementparam*elementparam2+BaseAtk)*raceparam*bossparam*bossparam2

  ----------------------------物理防御减免
  local DefReduc= CommonFun.CalcDef(Def,Vit,srcUser,targetUser)

  local A = (AtkFinal*DefReduc*(1-DamReduc2)+Refine)*damChangePer*(1-RefineDamReduc)*(1+DamIncrease)-Vit2*(1+VitPer2)

  local skillID, skillLevel = CommonFun.UnmergeSkillID(params.skillIDAndLevel)
  ----------------------------------------------------------回旋利刃
  if skillID==1104 then
    local Num1= srcUser:GetRunePoint(34010)------------星盘点
    local Num2 = srcUser:GetBuffLayer(116080)----------旋转点数
    A = A * (1+Num1*0.01*Num2)
  end
  -------------------------------------------------------------华丽短剑 伤害提高
    local AttrEffect2 = srcUser:GetProperty("AttrEffect")
    local bits=CommonFun.getBits(AttrEffect2)

      if bits[CommonFun.AttrEffect.Hualiduanjian]==1 then
           return A*1.5
      end

  return A
end
-----------------------------------------------------------------------------------------------------------------------十字切割者 回旋十字斩 计算公式
function CommonFun.calcDamage_3402(srcUser, targetUser, params, damageParam, logger)
  local Str = srcUser:GetProperty("Str")
  local Dex = srcUser:GetProperty("Dex")
  local Luk = srcUser:GetProperty("Luk")
  local Atk = srcUser:GetProperty("Atk")
  local AtkPer = srcUser:GetProperty("AtkPer")
  local DamIncrease = srcUser:GetProperty("DamIncrease")
  local IgnoreDef  = 0
  local IgnoreDef1 = srcUser:GetProperty("IgnoreDef")
  local IgnoreDef2 = srcUser:GetProperty("IgnoreEquipDef")
  if targetUser.boss or targetUser.mini then
     IgnoreDef=IgnoreDef1
  else
     IgnoreDef=(IgnoreDef1+IgnoreDef2)
  end

  if IgnoreDef >= 1 then
     IgnoreDef  = 1
  end

  local WeaponType =srcUser:GetEquipedWeaponType()
  local skilllv_1 = srcUser:GetLernedSkillLevel(damageParam.skill1_id)
  ------------------------------------------------------------------------------------将原来的物伤加成改成精炼物理攻击
  local Refine = srcUser:GetProperty("Refine")

  local Def2 = targetUser:GetProperty("Def")
  local DefPer2 = targetUser:GetProperty("DefPer")
  local Vit2 = targetUser:GetProperty("Vit")
  local VitPer2 = targetUser:GetProperty("VitPer")
  local DamReduc2 = CommonFun.calcDamReDuc(srcUser, targetUser)
  local RefineDamReduc = targetUser:GetProperty("RefineDamReduc")

  local AttrEffect2 = srcUser:GetProperty("AttrEffect")
  local bits2=CommonFun.getBits(AttrEffect2)
  local damChangePer  = damageParam.damChangePer
  ----------------------------------------------------------------------------------------------------------------种族，体型，属性，BOSS加伤效果
  local raceparam     = CommonFun.CalcRaceParam(srcUser, targetUser, params, damageParam, logger)
  local bodyparam     = CommonFun.CalcBodyParam(srcUser, targetUser, params, damageParam, logger)
  local elementparam  = CommonFun.CalcElementParam(srcUser, targetUser, params, damageParam, logger)
  local bossparam     = CommonFun.CalcBossParam(srcUser, targetUser, params, damageParam, logger)

  ----------------------------------------------------------------------------------------------------------------种族，体型，属性，BOSS减伤效果
  local raceparam2    = CommonFun.CalcRaceParam2(srcUser, targetUser, params, damageParam, logger)
  local bodyparam2    = CommonFun.CalcBodyParam2(srcUser, targetUser, params, damageParam, logger)
  local elementparam2 = CommonFun.CalcElementParam2(srcUser, targetUser, params, damageParam, logger)
  local bossparam2    = CommonFun.CalcBossParam2(srcUser, targetUser, params, damageParam, logger)

  local BaseAtk  = Str*2 + math.floor(Str*Str/100) + math.floor(Dex/5) + math.floor(Luk/5)
  local AtkFinal = ((Atk-BaseAtk)*(1+AtkPer)*CommonFun.ShapeCorrection(srcUser,targetUser)*bodyparam*elementparam*elementparam2+BaseAtk)*raceparam*bossparam*bossparam2

  ----------------------------物理防御减免
  local DefReduc= CommonFun.CalcDef(Def,Vit,srcUser,targetUser)

  local Num1 = srcUser:GetBuffLayer(116080)--------------------------旋转点数
  local Numxp= srcUser:GetRunePoint(34020)------------星盘点
  local Point = 1+Num1*(0.2+Numxp*0.03)

  ----------------------------洛奇的指甲
  local RefineLv7=srcUser:GetEquipedRefineLv(7)
  local luoqi = 1

  if srcUser:HasBuffID(90001038) then
    if ( RefineLv7>=5 and RefineLv7<10) then
      luoqi=0.05 + 1
      elseif  (RefineLv7>=10 and RefineLv7<15) then
      luoqi=0.05 + 0.05 + 1
      elseif RefineLv7 ==15 then
      luoqi=0.05 + 0.05 + 0.1 + 1
    end
  end
   ----------------------------死亡切割
  if srcUser:HasBuffID(41860) then
    if ( RefineLv7>=5 and RefineLv7<10) then
      luoqi=0.05 + 1
      elseif  (RefineLv7>=10 and RefineLv7<15) then
      luoqi=0.05 + 0.05 + 1
      elseif RefineLv7 ==15 then
      luoqi=0.05 + 0.05 + 0.1 + 1
    end
  end
  ----------------------------风行者斗篷
  local RefineLv3=srcUser:GetEquipedRefineLv(3)
  if srcUser:HasBuffID(90001963) and RefineLv3 > 5 then
    luoqi =luoqi + (RefineLv3-5)* 0.01
  end
  ---------------------------------洛奇的指甲Ⅸ＋风行者斗篷
  if srcUser:HasBuffID(90001038) and srcUser:HasBuffID(40420) then
    luoqi =luoqi + 0.05
  end
  ---------------------------------死亡切割＋风行者斗篷
  if srcUser:HasBuffID(41860) and srcUser:HasBuffID(40420) then
    luoqi =luoqi + 0.05
  end


  local A = ((AtkFinal*DefReduc*(1-DamReduc2)+Refine)*damChangePer*(1-RefineDamReduc)*(1+DamIncrease)-Vit2*(1+VitPer2))*Point*luoqi
  -------------------------------------------------------------华丽短剑
    local AttrEffect2 = srcUser:GetProperty("AttrEffect")
    local bits=CommonFun.getBits(AttrEffect2)

      if bits[CommonFun.AttrEffect.Hualiduanjian]==1 then
           return A*1.5
      end

  return A
end

  ------------------------------------------------------------------------------------------------------------------弓手二连矢技能伤害计算公式(已改)
function CommonFun.calcDamage_4101(srcUser, targetUser, params, damageParam, logger)
  local Str = srcUser:GetProperty("Str")
  local Dex = srcUser:GetProperty("Dex")
  local Luk = srcUser:GetProperty("Luk")
  local Atk = srcUser:GetProperty("Atk")
  local AtkPer = srcUser:GetProperty("AtkPer")
  local DamIncrease = srcUser:GetProperty("DamIncrease")
  local IgnoreDef  = 0
  local IgnoreDef1 = srcUser:GetProperty("IgnoreDef")
  local IgnoreDef2 = srcUser:GetProperty("IgnoreEquipDef")
  if targetUser.boss or targetUser.mini then
     IgnoreDef=IgnoreDef1
  else
     IgnoreDef=(IgnoreDef1+IgnoreDef2)
  end

  if IgnoreDef >= 1 then
     IgnoreDef  = 1
  end

  local Refine = srcUser:GetProperty("Refine")

  local AttrEffect = srcUser:GetProperty("AttrEffect")
  local bits=CommonFun.getBits(AttrEffect)

  local Def2 = targetUser:GetProperty("Def")
  local DefPer2 = targetUser:GetProperty("DefPer")
  local Vit2 = targetUser:GetProperty("Vit")
  local VitPer2 = targetUser:GetProperty("VitPer")
  local DamReduc2 = CommonFun.calcDamReDuc(srcUser, targetUser)
  local LongRangeDamReduc2 = targetUser:GetProperty("LongRangeDamReduc")
  local RefineDamReduc = targetUser:GetProperty("RefineDamReduc")

  local damChangePer  = damageParam.damChangePer
  local damChangePer1 = damageParam.damChangePer1

  ----------------------------------------------------------------------------------------------------------------种族，体型，属性，BOSS加伤效果
  local raceparam     = CommonFun.CalcRaceParam(srcUser, targetUser, params, damageParam, logger)
  local bodyparam     = CommonFun.CalcBodyParam(srcUser, targetUser, params, damageParam, logger)
  local elementparam  = CommonFun.CalcElementParam(srcUser, targetUser, params, damageParam, logger)
  local bossparam     = CommonFun.CalcBossParam(srcUser, targetUser, params, damageParam, logger)

  ----------------------------------------------------------------------------------------------------------------种族，体型，属性，BOSS减伤效果
  local raceparam2    = CommonFun.CalcRaceParam2(srcUser, targetUser, params, damageParam, logger)
  local bodyparam2    = CommonFun.CalcBodyParam2(srcUser, targetUser, params, damageParam, logger)
  local elementparam2 = CommonFun.CalcElementParam2(srcUser, targetUser, params, damageParam, logger)
  local bossparam2    = CommonFun.CalcBossParam2(srcUser, targetUser, params, damageParam, logger)

  local BaseAtk  = Dex*2 + math.floor(Dex*Dex/100) + math.floor(Str/5) + math.floor(Luk/5)
  local AtkFinal = ((Atk-BaseAtk)*(1+AtkPer)*CommonFun.ShapeCorrection(srcUser,targetUser)*bodyparam*elementparam*elementparam2+BaseAtk)*raceparam*bossparam*bossparam2

  ----------------------------物理防御减免
  local DefReduc= CommonFun.CalcDef(Def,Vit,srcUser,targetUser)

  ------------------------------------------------------------------------巅峰等级 苍鹰之眼
  local targetid = targetUser:GetGuid()
  local distance = srcUser:GetDistance(targetid)
  local skilllv_1 = srcUser:GetLernedSkillLevel(133)
  local DisDam= 1
  if skilllv_1>10 then
      DisDam = 1 + distance/7.5*(skilllv_1-10)*0.06
  end

  local A = (((AtkFinal*DefReduc*(1-DamReduc2)+Refine)*damChangePer*(1+DamIncrease-LongRangeDamReduc2) + damChangePer1)*(1- RefineDamReduc)-Vit2*(1+VitPer2))*DisDam

  if 1 >= A then
      return 1
  end
 ---------------------------------------------------------------------------------------------------------------------装备或卡片上有二连矢加伤百分比的效果
  if bits[CommonFun.AttrEffect.ErLianDam]==1 then
     return A*1.5
  end

     return A

end

-------------------------------------------------------------------------------------------------------------------弓手冲锋箭技能伤害计算公式(已改)
function CommonFun.calcDamage_4102(srcUser, targetUser, params, damageParam, logger)
  local Str = srcUser:GetProperty("Str")
  local Dex = srcUser:GetProperty("Dex")
  local Luk = srcUser:GetProperty("Luk")
  local Atk = srcUser:GetProperty("Atk")
  local AtkPer = srcUser:GetProperty("AtkPer")
  local DamIncrease = srcUser:GetProperty("DamIncrease")
  local IgnoreDef  = 0
  local IgnoreDef1 = srcUser:GetProperty("IgnoreDef")
  local IgnoreDef2 = srcUser:GetProperty("IgnoreEquipDef")
  if targetUser.boss or targetUser.mini then
     IgnoreDef=IgnoreDef1
  else
     IgnoreDef=(IgnoreDef1+IgnoreDef2)
  end

  if IgnoreDef >= 1 then
     IgnoreDef  = 1
  end

  local Refine = srcUser:GetProperty("Refine")

  local AttrEffect = srcUser:GetProperty("AttrEffect")
  local bits=CommonFun.getBits(AttrEffect)

  local Def2 = targetUser:GetProperty("Def")
  local DefPer2 = targetUser:GetProperty("DefPer")
  local Vit2 = targetUser:GetProperty("Vit")
  local VitPer2 = targetUser:GetProperty("VitPer")
  local DamReduc2 = CommonFun.calcDamReDuc(srcUser, targetUser)
  local LongRangeDamReduc2 = targetUser:GetProperty("LongRangeDamReduc")
  local RefineDamReduc = targetUser:GetProperty("RefineDamReduc")

  local damChangePer  = damageParam.damChangePer
  local damChangePer1 = damageParam.damChangePer1

  ----------------------------------------------------------------------------------------------------------------种族，体型，属性，BOSS加伤效果
  local raceparam     = CommonFun.CalcRaceParam(srcUser, targetUser, params, damageParam, logger)
  local bodyparam     = CommonFun.CalcBodyParam(srcUser, targetUser, params, damageParam, logger)
  local elementparam  = CommonFun.CalcElementParam(srcUser, targetUser, params, damageParam, logger)
  local bossparam     = CommonFun.CalcBossParam(srcUser, targetUser, params, damageParam, logger)

  ----------------------------------------------------------------------------------------------------------------种族，体型，属性，BOSS减伤效果
  local raceparam2    = CommonFun.CalcRaceParam2(srcUser, targetUser, params, damageParam, logger)
  local bodyparam2    = CommonFun.CalcBodyParam2(srcUser, targetUser, params, damageParam, logger)
  local elementparam2 = CommonFun.CalcElementParam2(srcUser, targetUser, params, damageParam, logger)
  local bossparam2    = CommonFun.CalcBossParam2(srcUser, targetUser, params, damageParam, logger)

  local BaseAtk  = Dex*2 + math.floor(Dex*Dex/100) + math.floor(Str/5) + math.floor(Luk/5)
  local AtkFinal = ((Atk-BaseAtk)*(1+AtkPer)*CommonFun.ShapeCorrection(srcUser,targetUser)*bodyparam*elementparam*elementparam2+BaseAtk)*raceparam*bossparam*bossparam2

  ----------------------------物理防御减免
  local DefReduc= CommonFun.CalcDef(Def,Vit,srcUser,targetUser)

  local Weapon=srcUser:GetEquipedID(7)
  local B = 1

  if (Weapon==41232 or Weapon==141232) then
     B = 2
  end
  ---------------------------------------------------------------------------星盘冲锋箭
  local Num1=srcUser:GetRunePoint(41016)
  local Num2=srcUser:GetRunePoint(41017)
  local Num3=srcUser:GetRunePoint(41018)
  local Num4=srcUser:GetRunePoint(41019)
  local Num5=srcUser:GetRunePoint(41020)
  local RuneDamage1=Num1*0.05+Num2*0.05+Num3*0.05+Num4*0.05+Num5*0.05+1

  local Num6=srcUser:GetRunePoint(41014)
  local Num7=srcUser:GetRunePoint(41015)
  local StateEffect = targetUser:GetProperty("StateEffect")
  local bits=CommonFun.getBits(StateEffect)
  local RuneDamage2=1

  if bits[CommonFun.StateEffect.NoMove] ==1 then
     RuneDamage2=Num6*0.15+Num7*0.15+1
  end

  local A = (((AtkFinal*DefReduc*(1-DamReduc2)+Refine)*damChangePer*(1+DamIncrease-LongRangeDamReduc2) + damChangePer1)*(1-RefineDamReduc)-Vit2*(1+VitPer2))*B*RuneDamage1*RuneDamage2


  if 1 >= A then
      return 1
  end

  return A

end
------------------------------------------------------------------------------------------------------------------箭雨伤害公式
function CommonFun.calcDamage_4103(srcUser, targetUser, params, damageParam, logger)
  local Str = srcUser:GetProperty("Str")
  local Dex = srcUser:GetProperty("Dex")
  local Luk = srcUser:GetProperty("Luk")
  local Atk = srcUser:GetProperty("Atk")
  local AtkPer = srcUser:GetProperty("AtkPer")
  local DamIncrease = srcUser:GetProperty("DamIncrease")
  local IgnoreDef  = 0
  local IgnoreDef1 = srcUser:GetProperty("IgnoreDef")
  local IgnoreDef2 = srcUser:GetProperty("IgnoreEquipDef")
  if targetUser.boss or targetUser.mini then
     IgnoreDef=IgnoreDef1
  else
     IgnoreDef=(IgnoreDef1+IgnoreDef2)
  end

  if IgnoreDef >= 1 then
     IgnoreDef=1
  end
   ------------------------------------------------------------------------------------将原来的物伤加成改成精炼物理攻击
  local Refine = srcUser:GetProperty("Refine")

  local AttrEffect = targetUser:GetProperty("AttrEffect")
  local bits=CommonFun.getBits(AttrEffect)

  local Def2 = targetUser:GetProperty("Def")
  local DefPer2 = targetUser:GetProperty("DefPer")
  local Vit2 = targetUser:GetProperty("Vit")
  local VitPer2 = targetUser:GetProperty("VitPer")
  local DamReduc2 = CommonFun.calcDamReDuc(srcUser, targetUser)
  local LongRangeDamReduc2 = targetUser:GetProperty("LongRangeDamReduc")
  local RefineDamReduc = targetUser:GetProperty("RefineDamReduc")

  local damChangePer = damageParam.damChangePer

  ----------------------------------------------------------------------------------------------------------------种族，体型，属性，BOSS加伤效果
  local raceparam     = CommonFun.CalcRaceParam(srcUser, targetUser, params, damageParam, logger)
  local bodyparam     = CommonFun.CalcBodyParam(srcUser, targetUser, params, damageParam, logger)
  local elementparam  = CommonFun.CalcElementParam(srcUser, targetUser, params, damageParam, logger)
  local bossparam     = CommonFun.CalcBossParam(srcUser, targetUser, params, damageParam, logger)

  ----------------------------------------------------------------------------------------------------------------种族，体型，属性，BOSS减伤效果
  local raceparam2    = CommonFun.CalcRaceParam2(srcUser, targetUser, params, damageParam, logger)
  local bodyparam2    = CommonFun.CalcBodyParam2(srcUser, targetUser, params, damageParam, logger)
  local elementparam2 = CommonFun.CalcElementParam2(srcUser, targetUser, params, damageParam, logger)
  local bossparam2    = CommonFun.CalcBossParam2(srcUser, targetUser, params, damageParam, logger)


  local BaseAtk  = Dex*2 + math.floor(Dex*Dex/100) + math.floor(Str/5) + math.floor(Luk/5)
  local AtkFinal = ((Atk-BaseAtk)*(1+AtkPer)*CommonFun.ShapeCorrection(srcUser,targetUser)*bodyparam*elementparam*elementparam2+BaseAtk)*raceparam*bossparam*bossparam2

  ----------------------------物理防御减免
  local DefReduc= CommonFun.CalcDef(Def,Vit,srcUser,targetUser)
  -------------------------------------------------------------------------------------------星盘箭雨
  local Num1=srcUser:GetRunePoint(41001)
  local Num2=srcUser:GetRunePoint(41002)
  local Num3=srcUser:GetRunePoint(41003)
  local Num4=srcUser:GetRunePoint(41004)
  local Num_srwn=srcUser:GetRunePoint(102006)---诗人舞娘
  local RuneDamage=Num1*0.05+Num2*0.1+Num3*0.05+Num4*0.05+Num_srwn*0.05+1
  -------------------------------------------------------------------------------------------星盘火箭雨暴击
  local Rate = 0
  local Num1=srcUser:GetRunePoint(41007)
  local UserArrow = srcUser:GetArrowID()
  local ArrowAttr = 0
  if UserArrow ~=0 then
     ArrowAttr = CommonFun.GetAtkAttrByArrow(UserArrow)
  end

  if ArrowAttr ==4 and Num1>0 then
      Rate=10
  end
  ----------------------------------------------------------------------------------------卡片箭雨
  local card1 =1
  local RefineLv1=srcUser:GetEquipedRefineLv(7)
  local CardNum = srcUser:GetEquipCardNum(7,24053)-------------获取武器部位 万箭增发卡 卡片数量
  if srcUser:HasBuffID(52410) then
    card1 =RefineLv1*0.02*CardNum+1
  end

  local A = ((AtkFinal*DefReduc*(1-DamReduc2)+Refine)*damChangePer*(1+DamIncrease-LongRangeDamReduc2)*(1-RefineDamReduc)-Vit2*(1+VitPer2))*RuneDamage*card1

  local skillID, skillLevel = CommonFun.UnmergeSkillID(params.skillIDAndLevel)
  ----------------------------------------------------------------------------箭矢风暴
  if skillID ==1246 then
      local skilllv_Arrow = srcUser:GetLernedSkillLevel(1246) -----箭矢风暴 等级
      local skilllv_Rain = srcUser:GetLernedSkillLevel(121)--------箭雨 等级
      local damChangePer = 0.75
      if skilllv_Rain<=10 then
          damChangePer = 0.75 + (skilllv_Rain-1)*0.15
      elseif skilllv_Rain>10 then
          damChangePer = 2.1 + (skilllv_Rain-10)*0.3
      end

      A = ((AtkFinal*DefReduc*(1-DamReduc2)+Refine)*damChangePer*(1+DamIncrease-LongRangeDamReduc2)*(1-RefineDamReduc)-Vit2*(1+VitPer2))*RuneDamage*card1*(skilllv_Arrow*0.2+1.6)
  end
  ----------------------------------------------------------------------------狂风暴雨
  if skillID ==1384 or skillID== 1433 then
      local skilllv_wn = srcUser:GetLernedSkillLevel(1384) -----箭矢风暴 等级 (舞娘)
      local skilllv_sr = srcUser:GetLernedSkillLevel(1433) -----箭矢风暴 等级 (诗人)
      local skill_all = skilllv_wn + skilllv_sr

      local skilllv_Rain = srcUser:GetLernedSkillLevel(121)--------箭雨 等级
      local damChangePer = 0.75
      if skilllv_Rain<=10 then
          damChangePer = 0.75 + (skilllv_Rain-1)*0.15
      elseif skilllv_Rain>10 then
          damChangePer = 2.1 + (skilllv_Rain-10)*0.3
      end

   -------------------------------------------------------------------------贝斯或秘鞭眷恋
      local RefineLv=srcUser:GetEquipedRefineLv(7)
      local beisi=1
      local Ring1=srcUser:GetEquipedID(7)
      if (Ring1==63109 or Ring1==163109 or Ring1==62820 or Ring1==162820) then
            beisi = 1 + RefineLv * 0.02
      end

      -------------------------------------------狂烈风暴符文
      local fuwen = 1
      if srcUser:HasBuffID(800007) then
          fuwen = 1.3
      end
  

      -------------------------------------------狂烈风暴符文
      local fuwen = 1
      if srcUser:HasBuffID(800016) then
          fuwen = 1.5
      end

      -----------------------------------------狂风暴雨 星盘
      local Num_kfby=srcUser:GetRunePoint(102040)

      A = ((AtkFinal*DefReduc*(1-DamReduc2)+Refine)*damChangePer*(1+DamIncrease-LongRangeDamReduc2)*(1-RefineDamReduc)-Vit2*(1+VitPer2))*RuneDamage*card1*(skill_all*0.04+0.4)*beisi*(1+Num_kfby*0.06)*fuwen
  end

   if 1 >= A then
         return 1
   end

   if CommonFun.IsInRate(Rate, srcUser:GetRandom()) then
      return A*1.5, CommonFun.DamageType.Crit
   end

   return A

end
------------------------------------------------------------------------------------------------------------------分裂箭伤害公式
function CommonFun.calcDamage_4201(srcUser, targetUser, params, damageParam, logger)
  local Str = srcUser:GetProperty("Str")
  local Dex = srcUser:GetProperty("Dex")
  local Luk = srcUser:GetProperty("Luk")
  local Atk = srcUser:GetProperty("Atk")
  local AtkPer = srcUser:GetProperty("AtkPer")
  local DamIncrease = srcUser:GetProperty("DamIncrease")
  local IgnoreDef  = 0
  local IgnoreDef1 = srcUser:GetProperty("IgnoreDef")
  local IgnoreDef2 = srcUser:GetProperty("IgnoreEquipDef")
  if targetUser.boss or targetUser.mini then
     IgnoreDef=IgnoreDef1
  else
     IgnoreDef=(IgnoreDef1+IgnoreDef2)
  end

  if IgnoreDef >= 1 then
     IgnoreDef=1
  end
   ------------------------------------------------------------------------------------将原来的物伤加成改成精炼物理攻击
  local Refine = srcUser:GetProperty("Refine")

  local AttrEffect = targetUser:GetProperty("AttrEffect")
  local bits=CommonFun.getBits(AttrEffect)

  local Def2 = targetUser:GetProperty("Def")
  local DefPer2 = targetUser:GetProperty("DefPer")
  local Vit2 = targetUser:GetProperty("Vit")
  local VitPer2 = targetUser:GetProperty("VitPer")
  local DamReduc2 = CommonFun.calcDamReDuc(srcUser, targetUser)
  local LongRangeDamReduc2 = targetUser:GetProperty("LongRangeDamReduc")
  local RefineDamReduc = targetUser:GetProperty("RefineDamReduc")

  local damChangePer = damageParam.damChangePer

  ----------------------------------------------------------------------------------------------------------------种族，体型，属性，BOSS加伤效果
  local raceparam     = CommonFun.CalcRaceParam(srcUser, targetUser, params, damageParam, logger)
  local bodyparam     = CommonFun.CalcBodyParam(srcUser, targetUser, params, damageParam, logger)
  local elementparam  = CommonFun.CalcElementParam(srcUser, targetUser, params, damageParam, logger)
  local bossparam     = CommonFun.CalcBossParam(srcUser, targetUser, params, damageParam, logger)

  ----------------------------------------------------------------------------------------------------------------种族，体型，属性，BOSS减伤效果
  local raceparam2    = CommonFun.CalcRaceParam2(srcUser, targetUser, params, damageParam, logger)
  local bodyparam2    = CommonFun.CalcBodyParam2(srcUser, targetUser, params, damageParam, logger)
  local elementparam2 = CommonFun.CalcElementParam2(srcUser, targetUser, params, damageParam, logger)
  local bossparam2    = CommonFun.CalcBossParam2(srcUser, targetUser, params, damageParam, logger)


  local BaseAtk  = Dex*2 + math.floor(Dex*Dex/100) + math.floor(Str/5) + math.floor(Luk/5)
  local AtkFinal = ((Atk-BaseAtk)*(1+AtkPer)*CommonFun.ShapeCorrection(srcUser,targetUser)*bodyparam*elementparam*elementparam2+BaseAtk)*raceparam*bossparam*bossparam2

  ----------------------------物理防御减免
  local DefReduc= CommonFun.CalcDef(Def,Vit,srcUser,targetUser)
  ------------------------------------------------------------------------------星盘分裂箭
  local Num1=srcUser:GetRunePoint(42016)
  local Num2=srcUser:GetRunePoint(42018)
  local Num3=srcUser:GetRunePoint(42019)
  local Num4=srcUser:GetRunePoint(42020)
  local Num5=srcUser:GetRunePoint(42021)
  local RuneDamage=Num1*0.05+Num2*0.05+Num3*0.05+Num4*0.05+Num5*0.1+1

  local A = ((AtkFinal*DefReduc*(1-DamReduc2)+Refine)*damChangePer*(1+DamIncrease-LongRangeDamReduc2)*(1-RefineDamReduc)-Vit2*(1+VitPer2))*RuneDamage

   if 1 >= A then
         return 1
   end

   return A

end

------------------------------------------------------------------------------------------------------------------远程物理陷阱技能（地雷陷阱）伤害计算公式(已改)
function CommonFun.calcDamage_4202(srcUser, targetUser, params, damageParam, logger)
  local BaseLv = srcUser.BaseLv
  local Dex = srcUser:GetProperty("Dex")
  local Int = srcUser:GetProperty("Int")
  local MDamIncrease = CommonFun.calcMDamIncrease(srcUser, targetUser)
  local IgnoreDef  = 0
  local IgnoreDef1 = srcUser:GetProperty("IgnoreDef")
  local IgnoreDef2 = srcUser:GetProperty("IgnoreEquipDef")
  if targetUser.boss or targetUser.mini then
     IgnoreDef=IgnoreDef1
  else
     IgnoreDef=(IgnoreDef1+IgnoreDef2)
  end

  if IgnoreDef >= 1 then
     IgnoreDef  = 1
  end


  local Def2 = targetUser:GetProperty("Def")
  local DefPer2 = targetUser:GetProperty("DefPer")
  local Vit2 = targetUser:GetProperty("Vit")
  local VitPer2 = targetUser:GetProperty("VitPer")
  local srcAtkElement    = CommonFun.GetUserAtkAttr(srcUser, params, damageParam)
  local targetDefElement = targetUser:GetProperty("DefAttr")
   ----------------------------------------------------------------------------------------------------------------种族，体型，属性，BOSS减伤效果
  local raceparam     = CommonFun.CalcRaceParam(srcUser, targetUser, params, damageParam, logger)
  local elementparam2 = CommonFun.CalcElementParam2(srcUser, targetUser, params, damageParam, logger)
  local bossparam     = CommonFun.CalcBossParam(srcUser, targetUser, params, damageParam, logger)

  local skilllv_1 = srcUser:GetLernedSkillLevel(damageParam.skill1_id)
  local skilllv_2 = srcUser:GetLernedSkillLevel(damageParam.skill2_id)

  local AttrEffect = srcUser:GetProperty("AttrEffect")
  local bits=CommonFun.getBits(AttrEffect)
  local MDamReduc2 = CommonFun.calcMDamReDuc(srcUser, targetUser)
  local RefineMDamReduc = targetUser:GetProperty("RefineMDamReduc")
  local damChangePer = damageParam.damChangePer

  ----------------------------物理防御减免
  local DefReduc= CommonFun.CalcDef(Def,Vit,srcUser,targetUser)
  -------------------------------------------------------------------------------------------------------------------星盘地雷陷阱
  local StateEffect = targetUser:GetProperty("StateEffect")
  local bits2=CommonFun.getBits(StateEffect)
  local Num6 = srcUser:GetRunePoint(42050)
  local RuneDamage2=1
  if bits2[CommonFun.StateEffect.NoMove] ==1 then
        RuneDamage2=1+Num6*0.1
  end
  -------------------------------------------装备升级  星尘外套+月亮胸针
  local suit = 1
  if srcUser:HasBuffID(90000773) and srcUser:HasBuffID(90001005) then
      suit = 1.1
  end
  -------------------------------------------星尘外套[第八档]
  local RefineLv2=srcUser:GetEquipedRefineLv(2)
  if srcUser:HasBuffID(90000777) then
        if (RefineLv2>=10 and RefineLv2<15) then
        suit =suit+(RefineLv2-10)* 0.02
         elseif RefineLv2 ==15 then
         suit =suit+(RefineLv2-10)* 0.02 + 0.05
        end
    end
      -------------------------------------------露娜弓[第八档]
  local RefineLv7=srcUser:GetEquipedRefineLv(7)
    if srcUser:HasBuffID(90000999) then
        if (RefineLv7>=10 and RefineLv7<15) then
        suit =suit+0.08
        elseif RefineLv7 ==15 then
         suit =suit+0.08+0.12
        end
    end
    -------------------------------------------月光女神
    if srcUser:HasBuffID(41812) then
      if (RefineLv7>=5 and RefineLv7<10) then
           suit =suit+0.05
      elseif(RefineLv7>=10 and RefineLv7<15) then
           suit =suit+0.05+0.1
      elseif RefineLv7 ==15 then
           suit =suit+0.05+0.1+0.15
      end
    end
    ----------------------------------------------------------------月亮胸针[第十档]

  local RefineLv5=srcUser:GetEquipedRefineLv(5)
  local RefineLv6=srcUser:GetEquipedRefineLv(6)

  local a = 0
  local b = 0
  if srcUser:HasBuffID(90001009)  then
      a = RefineLv5*0.01
  end
  if srcUser:HasBuffID(90001009) then
      b = RefineLv6*0.01
  end
  suit = suit + a + b
  -------------------------------------------炽天使精炼
  local Angel = 1
  if srcUser:HasBuffID(90001014) then
      local RefineLv=srcUser:GetEquipedRefineLv(7)
      Angel = 1 + 0.02*RefineLv
  end
  -------------------------------------------------------------------------------------------------------------------星盘陷阱研究
  local Num7 = srcUser:GetRunePoint(42060)
  local RuneDamage3 = 1+Num7*0.03*skilllv_1


  --------------------------------------------------------------------------------------------------------------------地雷陷阱等级大于5级
  local Refine = srcUser:GetProperty("Refine")
  local Atk = srcUser:GetProperty("Atk")
  local AtkPer = srcUser:GetProperty("AtkPer")
  local skilllv_add = srcUser:GetLernedSkillLevel(116)
  local atk_add = 0

  if skilllv_add > 5 then
    atk_add = (Atk*(1+AtkPer)+Refine)*((skilllv_add-5)*0.05)
  end
  ------------------------------------------------------三转器械专家
  local skilllv_trap = srcUser:GetLernedSkillLevel(1248)
  local trap = 1 + skilllv_trap*0.02

  local A = ((Dex*(3+BaseLv/100)*(1+Int/35)+atk_add)*damChangePer+skilllv_1*20*RuneDamage3)*DefReduc*(1+MDamIncrease)*(1-RefineMDamReduc)*(1-MDamReduc2)*GameConfig.ElementRestrain[srcAtkElement][targetDefElement]*elementparam2*raceparam*bossparam*RuneDamage2*suit*Angel*trap

  if 1 >= A then
    return 1
  end
  ------------------------------------------------------------------------------------手动引爆时伤害额外增加
  local Num1 = srcUser:GetRunePoint(42031)--------------------------------------------星盘引爆伤害
  local Num2 = srcUser:GetRunePoint(42032)
  local Num3 = srcUser:GetRunePoint(42033)
  local Num4 = srcUser:GetRunePoint(42034)
  local Num5 = srcUser:GetRunePoint(42035)
  local RuneDamage = Num1*0.1+Num2*0.05+Num3*0.05+Num4*0.1+Num5*0.05+1

  if bits[CommonFun.AttrEffect.TriggerTrapMark]==1 then
      return A*(1+skilllv_2*0.1)*RuneDamage
  end

      return A
end
------------------------------------------------------------------------------------------------------------------远程物理陷阱技能（电击陷阱）伤害计算公式(已改)
function CommonFun.calcDamage_4203(srcUser, targetUser, params, damageParam, logger)
  local BaseLv = srcUser.BaseLv
  local Dex = srcUser:GetProperty("Dex")
  local Int = srcUser:GetProperty("Int")
  local MDamIncrease = CommonFun.calcMDamIncrease(srcUser, targetUser)
  local IgnoreDef  = 0
  local IgnoreDef1 = srcUser:GetProperty("IgnoreDef")
  local IgnoreDef2 = srcUser:GetProperty("IgnoreEquipDef")
  if targetUser.boss or targetUser.mini then
     IgnoreDef=IgnoreDef1
  else
     IgnoreDef=(IgnoreDef1+IgnoreDef2)
  end

  if IgnoreDef >= 1 then
     IgnoreDef  = 1
  end


  local Def2 = targetUser:GetProperty("Def")
  local DefPer2 = targetUser:GetProperty("DefPer")
  local Vit2 = targetUser:GetProperty("Vit")
  local VitPer2 = targetUser:GetProperty("VitPer")
  local srcAtkElement    = CommonFun.GetUserAtkAttr(srcUser, params, damageParam)
  local targetDefElement = targetUser:GetProperty("DefAttr")
   ----------------------------------------------------------------------------------------------------------------种族，体型，属性，BOSS减伤效果
  local raceparam     = CommonFun.CalcRaceParam(srcUser, targetUser, params, damageParam, logger)
  local elementparam2 = CommonFun.CalcElementParam2(srcUser, targetUser, params, damageParam, logger)
  local bossparam     = CommonFun.CalcBossParam(srcUser, targetUser, params, damageParam, logger)

  local skilllv_1 = srcUser:GetLernedSkillLevel(damageParam.skill1_id)
  local skilllv_2 = srcUser:GetLernedSkillLevel(damageParam.skill2_id)

  local AttrEffect = srcUser:GetProperty("AttrEffect")
  local bits=CommonFun.getBits(AttrEffect)
  local MDamReduc2 = CommonFun.calcMDamReDuc(srcUser, targetUser)
  local RefineMDamReduc = targetUser:GetProperty("RefineMDamReduc")
  local damChangePer = damageParam.damChangePer

  ----------------------------物理防御减免
  local DefReduc= CommonFun.CalcDef(Def,Vit,srcUser,targetUser)

  -------------------------------------------装备升级  星尘外套+月亮胸针
  local suit = 1
  if srcUser:HasBuffID(90000773) and srcUser:HasBuffID(90001005) then
      suit = 1.1
  end
  -------------------------------------------星尘外套[第八档]
  local RefineLv2=srcUser:GetEquipedRefineLv(2)
  if srcUser:HasBuffID(90000777) then
        if (RefineLv2>=10 and RefineLv2<15) then
        suit =suit+(RefineLv2-10)* 0.02
         elseif RefineLv2 ==15 then
         suit =suit+(RefineLv2-10)* 0.02 + 0.05
        end
    end
    -------------------------------------------露娜弓[第八档]
  local RefineLv7=srcUser:GetEquipedRefineLv(7)
    if srcUser:HasBuffID(90000999) then
        if (RefineLv7>=10 and RefineLv7<15) then
        suit =suit+0.08
        elseif RefineLv7 ==15 then
         suit =suit+0.08+0.12
        end
    end
    -------------------------------------------月光女神
    if srcUser:HasBuffID(41812) then
      if (RefineLv7>=5 and RefineLv7<10) then
           suit =suit+0.05
      elseif(RefineLv7>=10 and RefineLv7<15) then
           suit =suit+0.05+0.1
      elseif RefineLv7 ==15 then
           suit =suit+0.05+0.1+0.15
      end
    end
     ----------------------------------------------------------------月亮胸针[第十档]

  local RefineLv5=srcUser:GetEquipedRefineLv(5)
  local RefineLv6=srcUser:GetEquipedRefineLv(6)

  local a = 0
  local b = 0
  if srcUser:HasBuffID(90001009)  then
      a = RefineLv5*0.01
  end
  if srcUser:HasBuffID(90001009) then
      b = RefineLv6*0.01
  end
  suit = suit + a + b
  -------------------------------------------炽天使精炼
  local Angel = 1
  if srcUser:HasBuffID(90001014) then
      local RefineLv=srcUser:GetEquipedRefineLv(7)
      Angel = 1 + 0.02*RefineLv
  end
  -------------------------------------------------------------------------------------------------------------------星盘陷阱研究
  local Num7 = srcUser:GetRunePoint(42060)
  local RuneDamage3 = 1+Num7*0.03*skilllv_1
  ------------------------------------------------------三转器械专家
  local skilllv_trap = srcUser:GetLernedSkillLevel(1248)
  local trap = 1 + skilllv_trap*0.02
  -------------------------------------------------星盘电击
  local NumDj = srcUser:GetRunePoint(44080)
  local RuneDj = 1 + NumDj*0.08

  local A = ((Dex*(3+BaseLv/100)*(1+Int/35))*damChangePer+skilllv_1*20*RuneDamage3)*DefReduc*(1+MDamIncrease)*(1-RefineMDamReduc)*(1-MDamReduc2)*GameConfig.ElementRestrain[srcAtkElement][targetDefElement]*elementparam2*raceparam*bossparam*suit*Angel*trap*RuneDj

  if 1 >= A then
    return 1
  end
  ------------------------------------------------------------------------------------手动引爆时伤害额外增加
  local Num1 = srcUser:GetRunePoint(42031)--------------------------------------------星盘引爆伤害
  local Num2 = srcUser:GetRunePoint(42032)
  local Num3 = srcUser:GetRunePoint(42033)
  local Num4 = srcUser:GetRunePoint(42034)
  local Num5 = srcUser:GetRunePoint(42035)
  local RuneDamage = Num1*0.1+Num2*0.05+Num3*0.05+Num4*0.1+Num5*0.05+1

  if bits[CommonFun.AttrEffect.TriggerTrapMark]==1 then
      return A*(1+skilllv_2*0.1)*RuneDamage
  end

      return A
end
------------------------------------------------------------------------------------------------------------------多重扫射远程物理伤害计算公式(已改)
function CommonFun.calcDamage_4301(srcUser, targetUser, params, damageParam, logger)
  local Str = srcUser:GetProperty("Str")
  local Dex = srcUser:GetProperty("Dex")
  local Luk = srcUser:GetProperty("Luk")
  local Atk = srcUser:GetProperty("Atk")
  local AtkPer = srcUser:GetProperty("AtkPer")
  local DamIncrease = srcUser:GetProperty("DamIncrease")
  local IgnoreDef  = 0
  local IgnoreDef1 = srcUser:GetProperty("IgnoreDef")
  local IgnoreDef2 = srcUser:GetProperty("IgnoreEquipDef")
  if targetUser.boss or targetUser.mini then
     IgnoreDef=IgnoreDef1
  else
     IgnoreDef=(IgnoreDef1+IgnoreDef2)
  end

  if IgnoreDef >= 1 then
     IgnoreDef=1
  end
   ------------------------------------------------------------------------------------将原来的物伤加成改成精炼物理攻击
  local Refine = srcUser:GetProperty("Refine")

  local AttrEffect = targetUser:GetProperty("AttrEffect")
  local bits=CommonFun.getBits(AttrEffect)

  local Def2 = targetUser:GetProperty("Def")
  local DefPer2 = targetUser:GetProperty("DefPer")
  local Vit2 = targetUser:GetProperty("Vit")
  local VitPer2 = targetUser:GetProperty("VitPer")
  local DamReduc2 = CommonFun.calcDamReDuc(srcUser, targetUser)
  local LongRangeDamReduc2 = targetUser:GetProperty("LongRangeDamReduc")
  local RefineDamReduc = targetUser:GetProperty("RefineDamReduc")

  local damChangePer = damageParam.damChangePer

  ----------------------------------------------------------------------------------------------------------------种族，体型，属性，BOSS加伤效果
  local raceparam     = CommonFun.CalcRaceParam(srcUser, targetUser, params, damageParam, logger)
  local bodyparam     = CommonFun.CalcBodyParam(srcUser, targetUser, params, damageParam, logger)
  local elementparam  = CommonFun.CalcElementParam(srcUser, targetUser, params, damageParam, logger)
  local bossparam     = CommonFun.CalcBossParam(srcUser, targetUser, params, damageParam, logger)

  ----------------------------------------------------------------------------------------------------------------种族，体型，属性，BOSS减伤效果
  local raceparam2    = CommonFun.CalcRaceParam2(srcUser, targetUser, params, damageParam, logger)
  local bodyparam2    = CommonFun.CalcBodyParam2(srcUser, targetUser, params, damageParam, logger)
  local elementparam2 = CommonFun.CalcElementParam2(srcUser, targetUser, params, damageParam, logger)
  local bossparam2    = CommonFun.CalcBossParam2(srcUser, targetUser, params, damageParam, logger)


  local BaseAtk  = Dex*2 + math.floor(Dex*Dex/100) + math.floor(Str/5) + math.floor(Luk/5)
  local AtkFinal = ((Atk-BaseAtk)*(1+AtkPer)*CommonFun.ShapeCorrection(srcUser,targetUser)*bodyparam*elementparam*elementparam2+BaseAtk)*raceparam*bossparam*bossparam2

  ----------------------------物理防御减免
  local DefReduc= CommonFun.CalcDef(Def,Vit,srcUser,targetUser)
  -------------------------------------------------------------------------------------星盘多重扫射
  local Num1 = srcUser:GetRunePoint(42110)
  local RuneDamage = 1+Num1*0.1

---------------------------------------------------------------------------------------卡片多重扫射
  local card1 =1
  local RefineLv1=srcUser:GetEquipedRefineLv(7)
  local CardNum = srcUser:GetEquipCardNum(7,24053)-------------获取武器部位 万箭增发卡 卡片数量
  if srcUser:HasBuffID(52410) then
    card1 =RefineLv1*0.02*CardNum+1
   end

  local A = ((AtkFinal*DefReduc*(1-DamReduc2)+Refine)*damChangePer*(1+DamIncrease-LongRangeDamReduc2)*(1-RefineDamReduc)-Vit2*(1+VitPer2))*RuneDamage*card1

   if 1 >= A then
         return 1
   end

   return A

end

------------------------------------------------------------------------------------------------------------------死亡狙击 伤害公式
function CommonFun.calcDamage_4401(srcUser, targetUser, params, damageParam, logger)
  local Str = srcUser:GetProperty("Str")
  local Dex = srcUser:GetProperty("Dex")
  local Luk = srcUser:GetProperty("Luk")
  local Atk = srcUser:GetProperty("Atk")
  local AtkPer = srcUser:GetProperty("AtkPer")
  local DamIncrease = srcUser:GetProperty("DamIncrease")
  local IgnoreDef  = 0
  local IgnoreDef1 = srcUser:GetProperty("IgnoreDef")
  local IgnoreDef2 = srcUser:GetProperty("IgnoreEquipDef")
  if targetUser.boss or targetUser.mini then
     IgnoreDef=IgnoreDef1
  else
     IgnoreDef=(IgnoreDef1+IgnoreDef2)
  end

  if IgnoreDef >= 1 then
     IgnoreDef=1
  end
   ------------------------------------------------------------------------------------将原来的物伤加成改成精炼物理攻击
  local Refine = srcUser:GetProperty("Refine")

  local AttrEffect = targetUser:GetProperty("AttrEffect")
  local bits=CommonFun.getBits(AttrEffect)

  local Def2 = targetUser:GetProperty("Def")
  local DefPer2 = targetUser:GetProperty("DefPer")
  local Vit2 = targetUser:GetProperty("Vit")
  local VitPer2 = targetUser:GetProperty("VitPer")
  local DamReduc2 = CommonFun.calcDamReDuc(srcUser, targetUser)
  local LongRangeDamReduc2 = targetUser:GetProperty("LongRangeDamReduc")
  local RefineDamReduc = targetUser:GetProperty("RefineDamReduc")

  local damChangePer = damageParam.damChangePer

  ----------------------------------------------------------------------------------------------------------------种族，体型，属性，BOSS加伤效果
  local raceparam     = CommonFun.CalcRaceParam(srcUser, targetUser, params, damageParam, logger)
  local bodyparam     = CommonFun.CalcBodyParam(srcUser, targetUser, params, damageParam, logger)
  local elementparam  = CommonFun.CalcElementParam(srcUser, targetUser, params, damageParam, logger)
  local bossparam     = CommonFun.CalcBossParam(srcUser, targetUser, params, damageParam, logger)

  ----------------------------------------------------------------------------------------------------------------种族，体型，属性，BOSS减伤效果
  local raceparam2    = CommonFun.CalcRaceParam2(srcUser, targetUser, params, damageParam, logger)
  local bodyparam2    = CommonFun.CalcBodyParam2(srcUser, targetUser, params, damageParam, logger)
  local elementparam2 = CommonFun.CalcElementParam2(srcUser, targetUser, params, damageParam, logger)
  local bossparam2    = CommonFun.CalcBossParam2(srcUser, targetUser, params, damageParam, logger)


  local BaseAtk  = Dex*2 + math.floor(Dex*Dex/100) + math.floor(Str/5) + math.floor(Luk/5)
  local AtkFinal = ((Atk-BaseAtk)*(1+AtkPer)*CommonFun.ShapeCorrection(srcUser,targetUser)*bodyparam*elementparam*elementparam2+BaseAtk)*raceparam*bossparam*bossparam2

  ----------------------------物理防御减免
  local DefReduc= CommonFun.CalcDef(Def,Vit,srcUser,targetUser)

  ----------------------------------------------------森林猎手
  local hunter = 0
  local Forest = 1
  local Ring7=srcUser:GetEquipedID(7)
  local RefineLv7=srcUser:GetEquipedRefineLv(7)
  if (Ring7==41246 or Ring7==141246) and RefineLv7>8 then
      hunter=hunter+(RefineLv7-8)*0.1
    end
  if srcUser:HasBuffID(91000430) then
      hunter=hunter+0.5
    end
  if (Ring7==41246 or Ring7==141246) and RefineLv7==15 then
      Forest=Forest+0.1
    end
  ------------------------------------------------星盘
  local Num = srcUser:GetRunePoint(44050)
  local Num2 = srcUser:GetRunePoint(44060) ----暴击
  local RuneDamage = 1 + Num*0.05


  local A = ((AtkFinal*DefReduc*(1-DamReduc2)+Refine)*(damChangePer+hunter)*(1+DamIncrease-LongRangeDamReduc2)*(1-RefineDamReduc)-Vit2*(1+VitPer2))*Forest*RuneDamage
  -----------------------------------------死亡狙击可进行暴击
  local Cri = srcUser:GetProperty("Cri")
  local CriRes2 = targetUser:GetProperty("CriRes")
  local CriDamPer = srcUser:GetProperty("CriDamPer")
  local CriDefPer2 = targetUser:GetProperty("CriDefPer")

  local Rate = (Cri-CriRes2)/3+Num2*3

  -----------------------------------------暗影狙击符文
  if srcUser:HasBuffID(800002) then
    Rate = Rate + 5
    CriDamPer = CriDamPer + 0.5
  end

  if CommonFun.IsInRate(Rate, srcUser:GetRandom()) then
      A = ((AtkFinal*(1-DamReduc2)+Refine)*(damChangePer+hunter)*(1+DamIncrease-LongRangeDamReduc2)*(1-RefineDamReduc)-Vit2*(1+VitPer2))*Forest*RuneDamage

      return A * (1.5+CriDamPer-CriDefPer2) , CommonFun.DamageType.Crit
  end

   if 1 >= A then
         return 1
   end

   return A

end

------------------------------------------------------------------------------------------------牧师治愈术治疗计算公式(已改)
------------------------------------------------------------------------------------------------【下面有个BUFF效果需要用到这里的伤害公式，每次更改时需要同步修改】
function CommonFun.calcDamage_5101(srcUser, targetUser, params, damageParam, logger)
  local BaseLv = srcUser.BaseLv
  local Int = srcUser:GetProperty("Int")
  local HolyAtk = srcUser:GetProperty("HolyAtk")
  local HealEncPer = srcUser:GetProperty("HealEncPer")
  local enemy=srcUser:IsEnemy(targetUser)
  local MDamIncrease = CommonFun.calcMDamIncrease(srcUser, targetUser)

  local skilllv_1 = srcUser:GetLernedSkillLevel(50034)
  local skilllv_2 = srcUser:GetLernedSkillLevel(50035)
  ------------------------------------------------------------------------------------------------治愈术-强效
  local Num1=srcUser:GetRunePoint(51001)
  local Num2=srcUser:GetRunePoint(51011)
  local RuneDamage=Num1*0.02 + Num2*0.02 + 1
  ------------------------------------------------------------------------------------------------白素贞卡片
  local c=1
  if srcUser:HasBuffID(51580) then
        c=1.1
  end
  ------------------------------------------------------------------------------------------------大天使之盾
  local RefineLv = srcUser:GetEquipedRefineLv(1)
  local Angel = 1
  if srcUser:HasBuffID(40430) then
     Angel = 1 + RefineLv/100
  end

  --------------------------------------------------------------------------大天使之盾升级
  if srcUser:HasBuffID(90001813) then
     if (RefineLv>=5 and RefineLv<10) then
        Angel=Angel+0.03
       elseif RefineLv>=10 then
        Angel=Angel+0.03+0.07
    end
  end

  local srcAtkElement    = CommonFun.GetUserAtkAttr(srcUser, params, damageParam)
  local targetDefElement = targetUser:GetProperty("DefAttr")

  local BeHealEncPer2 = targetUser:GetProperty("BeHealEncPer")
  local race2 = targetUser.race
  local DefAttr2=targetUser:GetProperty("DefAttr")


  local AttrEffect = targetUser:GetProperty("AttrEffect2")
  local bits=CommonFun.getBits(AttrEffect)

  local damChangePer  = damageParam.damChangePer
  local damChangePer1 = damageParam.damChangePer1
   ----------------------------------------------------------------------------------------------------------------种族，体型，属性，BOSS减伤效果
  local elementparam2 = CommonFun.CalcElementParam2(srcUser, targetUser, params, damageParam, logger)
  --------------------------------------------------------------------------------------治愈术基本治疗量公式

  local A=((math.floor((BaseLv+Int)/10)*damChangePer+100 + skilllv_1*50 + skilllv_2*50)*(1+HealEncPer)*(1+BeHealEncPer2) + damChangePer1)*(-1)*(1+HolyAtk)*RuneDamage*c*Angel

  local skillID, skillLevel = CommonFun.UnmergeSkillID(params.skillIDAndLevel)
  ----------------------------------------------------------治愈之光
  if skillID==1224 then
    local skilllv_3 = srcUser:GetLernedSkillLevel(144)
    local damChangePer = 4
      if skilllv_3<=10 then
        damChangePer = 4+skilllv_3*8
      elseif skilllv_3>10 then
        damChangePer =64+ skilllv_3*2
      end
    --------------------------------------------------星盘
    local MaxHp = targetUser:GetProperty("MaxHp")
    local Hp = targetUser:GetProperty("Hp")
    local Num = srcUser:GetRunePoint(54030)
    local RuneDamage1 = (MaxHp-Hp)*0.02*Num

    A=((math.floor((BaseLv+Int)/10)*damChangePer+100 + skilllv_1*50 + skilllv_2*50)*damChangePer1*(1+HealEncPer)*(1+BeHealEncPer2))*(-1)*(1+HolyAtk)*RuneDamage*c*Angel-RuneDamage1
  end
  -----------------------------------------------十字军濒死回复
  if targetUser:HasBuffID(41100050) then
      local MaxHp = targetUser:GetProperty("MaxHp")
      local Hp = targetUser:GetProperty("Hp")
      local Num1  = targetUser:GetBuffLayer(41100050)
      if Hp<MaxHp*(0.15*Num1) then
         A = A*3
      end
  end

  --------------------------------------------------------------------------------------对不死属性和不死种族怪物造成治疗量/2的圣属性伤害
  --------------------------------------------------------------------------------------这里的正值代表是伤害效果,负值是治疗效果
  if enemy then
        if DefAttr2==9 then
            return A/2*GameConfig.ElementRestrain[srcAtkElement][targetDefElement]*elementparam2*(-1)*(1+MDamIncrease)
        else
            return 0,0
        end
  else
        if DefAttr2==9 or bits[CommonFun.AttrEffect.PoisinDamNoUse]==1 then
            return -1
        else
            return A
        end
  end
end



--------------------------------------------------------------------------------------------------牧师系新转生术伤害公式(已改)
function CommonFun.calcDamage_5102(srcUser, targetUser, params, damageParam, logger)
  local BaseLv = srcUser.BaseLv
  local Int = srcUser:GetProperty("Int")
  local MDamIncrease = CommonFun.calcMDamIncrease(srcUser, targetUser)
  local DefAttr2=targetUser:GetProperty("DefAttr")

  local srcAtkElement    = CommonFun.GetUserAtkAttr(srcUser, params, damageParam)
  local targetDefElement = targetUser:GetProperty("DefAttr")
  ----------------------------------------------------------------------------------------------------------------种族，体型，属性，BOSS减伤效果
  local elementparam2 = CommonFun.CalcElementParam2(srcUser, targetUser, params, damageParam, logger)

  local damChangePer = damageParam.damChangePer
  local damChangePer1 = damageParam.damChangePer1

  local A=(BaseLv+Int+damChangePer)*GameConfig.ElementRestrain[srcAtkElement][targetDefElement]*elementparam2*(1+MDamIncrease)

  -------------------------------对恶魔种族伤害单独计算
  local race2 = targetUser.race

  if race2==3 then
    local raceparam     = CommonFun.CalcRaceParam(srcUser, targetUser, params, damageParam, logger)
    local raceparam2    = CommonFun.CalcRaceParam2(srcUser, targetUser, params, damageParam, logger)
    local bossparam     = CommonFun.CalcBossParam(srcUser, targetUser, params, damageParam, logger)
    local bossparam2    = CommonFun.CalcBossParam2(srcUser, targetUser, params, damageParam, logger)
    local MAtk = srcUser:GetProperty("MAtk")
    local MAtkPer = srcUser:GetProperty("MAtkPer")
    local MDamReduc2 = CommonFun.calcMDamReDuc(srcUser, targetUser)
    local RefineMDamReduc = targetUser:GetProperty("RefineMDamReduc")
    local MRefine = srcUser:GetProperty("MRefine")

    local BaseMAtk  = Int+math.floor(Int*Int/100)
    local MAtkFinal = ((MAtk-BaseMAtk)*(1+MAtkPer)+BaseMAtk)*raceparam*bossparam*bossparam2
    ----------------------------魔法防御减免
    local MDefReduc = CommonFun.CalcMDef(MDef,Int,Vit,srcUser,targetUser)
    -------------------------------星盘
    local Num0 = srcUser:GetRunePoint(52180)
    local RuneDamage0 = Num0

    A = (MAtkFinal*MDefReduc*(1-MDamReduc2)+MRefine)*(1-RefineMDamReduc)*(damChangePer1+RuneDamage0)*(1+MDamIncrease)*GameConfig.ElementRestrain[srcAtkElement][targetDefElement]*elementparam2
  end

  if 1>= A then
    A=1
  end
  ------------------------------------------------------------------------------------------------------------------星盘加成吸血效果
  local Num1 = srcUser:GetRunePoint(51014)
  local Num2 = srcUser:GetRunePoint(51018)
  local Num3 = srcUser:GetRunePoint(52027)
  local RuneDamage = (Num1 + Num2 + Num3)*0.07
  -------------------------------------------------------------------------------------------------------------------分割线
  if targetUser.isServerCall then -- 服务端调用
     if RuneDamage>0 then
       if DefAttr2 == CommonFun.Nature.Undead then
            srcUser:DoExtraDamage(A*(-1)*RuneDamage)
       else
            srcUser:DoExtraDamage(A*(-1)*RuneDamage*0.5)
       end
    end
  end

  return A

end

-- ----------------------------------------------------------------------------------------------------服事十字驱魔攻击计算公式(已改)
function CommonFun.calcDamage_5103(srcUser, targetUser, params, damageParam, logger)
  local Int = srcUser:GetProperty("Int")
  local Vit = srcUser:GetProperty("Vit")
  local MAtk = srcUser:GetProperty("MAtk")
  local MAtkPer = srcUser:GetProperty("MAtkPer")
  local MDamIncrease = CommonFun.calcMDamIncrease(srcUser, targetUser)
  local IgnoreMDef = srcUser:GetProperty("IgnoreMDef")
  if IgnoreMDef >= 1 then
     IgnoreMDef  = 1
  end
  local MRefine = srcUser:GetProperty("MRefine")

  local enemy=srcUser:IsEnemy(targetUser)
  local srcAtkElement    = CommonFun.GetUserAtkAttr(srcUser, params, damageParam)
  local targetDefElement = targetUser:GetProperty("DefAttr")


  local MDef2 = targetUser:GetProperty("MDef")
  local MDefPer2 = targetUser:GetProperty("MDefPer")
  local Vit2 = targetUser:GetProperty("Vit")
  local VitPer2 = targetUser:GetProperty("VitPer")
  local Int2 = targetUser:GetProperty("Int")
  local IntPer2 = targetUser:GetProperty("IntPer")
  local MDamReduc2 = CommonFun.calcMDamReDuc(srcUser, targetUser)
  local RefineMDamReduc = targetUser:GetProperty("RefineMDamReduc")
  local race2 = targetUser.race
  local DefAttr2=targetUser:GetProperty("DefAttr")

  local AttrEffect= srcUser:GetProperty("AttrEffect2")
  local bits=CommonFun.getBits(AttrEffect)

  local damChangePer = damageParam.damChangePer
  ----------------------------------------------------------------------------------------------------------------种族，体型，属性，BOSS减伤效果
  local elementparam2 = CommonFun.CalcElementParam2(srcUser, targetUser, params, damageParam, logger)

  ----------------------------------------------------------------------------------------------------------------法系职业伤害会受到种族加伤减伤影响
  local raceparam     = CommonFun.CalcRaceParam(srcUser, targetUser, params, damageParam, logger)
  local raceparam2    = CommonFun.CalcRaceParam2(srcUser, targetUser, params, damageParam, logger)
  local bossparam     = CommonFun.CalcBossParam(srcUser, targetUser, params, damageParam, logger)
  local bossparam2    = CommonFun.CalcBossParam2(srcUser, targetUser, params, damageParam, logger)

  local BaseMAtk  = Int+math.floor(Int*Int/100)
  local MAtkFinal = ((MAtk-BaseMAtk)*(1+MAtkPer)+BaseMAtk)*raceparam*bossparam*bossparam2

  ----------------------------魔法防御减免
  local MDefReduc = CommonFun.CalcMDef(MDef,Int,Vit,srcUser,targetUser)
  -----------------------------------------------------星盘 十字驱魔
  local Num1 = srcUser:GetRunePoint(52037)
  local RuneDamage = Num1*0.3
  --------------------------------------------------------十字驱魔增强
  local qumo = 1
  if bits[CommonFun.AttrEffect2.Shiziqumo]==1 then
       qumo = 1.2
  end
  --------------------------------------------------------复仇女神增强
  local weaponRefineLv=srcUser:GetEquipedRefineLv(7)
   if srcUser:HasBuffID(90001413) then
      qumo=weaponRefineLv*0.01+qumo
   end
  --------------------------------------------------------厄利尼厄斯之杖

  if srcUser:HasBuffID(41980) then
      qumo=weaponRefineLv*0.01+qumo
   end


  --------------------------------------------------------驱魔圣经增强
  local weaponRefineLv2=srcUser:GetEquipedRefineLv(1)
   if srcUser:HasBuffID(90001423) then
      qumo=weaponRefineLv2*0.01+qumo
   end
  -----------------------------------------------------巅峰等级 转生术 提高倍率
  local skilllv_1 = srcUser:GetLernedSkillLevel(160)
  local SkillPer = 0
  if skilllv_1 >10 then
    SkillPer = (skilllv_1-10)*0.1
  end

  local A = ((MAtkFinal*MDefReduc*(1-MDamReduc2)+MRefine)*(1-RefineMDamReduc)*(damChangePer+RuneDamage+SkillPer)-Vit2/2*(1+VitPer2)-Int2*(1+IntPer2))*(1+MDamIncrease)*GameConfig.ElementRestrain[srcAtkElement][targetDefElement]*elementparam2*qumo

  if 1 >= A then
    return 1
  end
  ----------------------------------------------只有特定类型的怪物才会受到伤害
  local Num2 = srcUser:GetRunePoint(52030)

  if enemy then
     if race2==3 or DefAttr2==9 then
          return A
     elseif Num2>0 then
          return A * Num2 * 0.07
     end
  else
       return 0,0
  end

  return 0, 0

end
----------------------------------------------------------------------------------------------------------------------------服事系光耀之堂技能公式修改(已改)
function CommonFun.calcDamage_5104(srcUser, targetUser, params, damageParam, logger)
  local BaseLv = srcUser.BaseLv
  local Int = srcUser:GetProperty("Int")
  local HolyAtk = srcUser:GetProperty("HolyAtk")
  local HealEncPer = srcUser:GetProperty("HealEncPer")
  local enemy=srcUser:IsEnemy(targetUser)
  local MDamIncrease = CommonFun.calcMDamIncrease(srcUser, targetUser)

  ------------------------------------------------------------------------------------------------------------------星盘加成额外治愈量效果
  local Num1 = srcUser:GetRunePoint(51010)
  local RuneDamage = Num1*0.15 + 1
  local Num2 = srcUser:GetRunePoint(53020)
  local RuneDamage1 = Num2*0.02 + 1
  ------------------------------------------------------------------------------------------------------------------白素贞卡片
  local c=1
  if srcUser:HasBuffID(51580) then
        c=1.1
  end

  local AttrEffect = srcUser:GetProperty("AttrEffect")
  local bits=CommonFun.getBits(AttrEffect)

  local srcAtkElement    = CommonFun.GetUserAtkAttr(srcUser, params, damageParam)
  local targetDefElement = targetUser:GetProperty("DefAttr")

  local BeHealEncPer2 = targetUser:GetProperty("BeHealEncPer")
  local race2 = targetUser.race
  local AttrEffect2 = targetUser:GetProperty("AttrEffect")
  local DefAttr2=targetUser:GetProperty("DefAttr")

  local damChangePer  = damageParam.damChangePer
  local damChangePer1 = damageParam.damChangePer1
  ----------------------------------------------------------------------------------------------------------------种族，体型，属性，BOSS减伤效果
  local elementparam2 = CommonFun.CalcElementParam2(srcUser, targetUser, params, damageParam, logger)

  --------------------------------------------------------------------------------------治愈术基本治疗量公式

  --local A=(math.floor((BaseLv+Int)/10)*damChangePer*(1+HealEncPer)*(1+BeHealEncPer2) + damChangePer1)*(-1)
  local A=damChangePer1*(1+HealEncPer)*(1+BeHealEncPer2)*(-1)*(1+HolyAtk)*RuneDamage*c*RuneDamage1
  -----------------------------------------------十字军濒死回复
  if targetUser:HasBuffID(41100050) then
      local MaxHp = targetUser:GetProperty("MaxHp")
      local Hp = targetUser:GetProperty("Hp")
      local Num1  = targetUser:GetRunePoint(70110)
      if Hp<MaxHp*(0.15*Num1) then
         return A*3
      end
  end
  --------------------------------------------------------------------------------------对不死属性和不死种族怪物造成治疗量/2的圣属性伤害
  --------------------------------------------------------------------------------------这里的正值代表是伤害效果,负值是治疗效果
  if enemy then
        if race2==3 or DefAttr2==9 then
            return A/2*GameConfig.ElementRestrain[srcAtkElement][targetDefElement]*elementparam2*(-1)*(1+MDamIncrease)
        else
            return 0,0
        end
  else
        if race2==3 or DefAttr2==9 then
            return -1
        else
            return A
        end
  end

end

-- ----------------------------------------------------------------------------------------------------服事审判技能攻击计算公式(已改)
function CommonFun.calcDamage_5105(srcUser, targetUser, params, damageParam, logger)
  local BaseLv = srcUser.BaseLv
  local Int = srcUser:GetProperty("Int")
  local Vit = srcUser:GetProperty("Vit")
  local MAtk = srcUser:GetProperty("MAtk")
  local MAtkPer = srcUser:GetProperty("MAtkPer")
  local MDamIncrease = CommonFun.calcMDamIncrease(srcUser, targetUser)
  local IgnoreMDef = srcUser:GetProperty("IgnoreMDef")
  local Luk=srcUser:GetProperty("Luk")
  if IgnoreMDef >= 1 then
     IgnoreMDef  = 1
  end
  local MRefine = srcUser:GetProperty("MRefine")

  local srcAtkElement    = CommonFun.GetUserAtkAttr(srcUser, params, damageParam)
  local targetDefElement = targetUser:GetProperty("DefAttr")
  local enemy=srcUser:IsEnemy(targetUser)


  local MDef2 = targetUser:GetProperty("MDef")
  local MDefPer2 = targetUser:GetProperty("MDefPer")
  local Vit2 = targetUser:GetProperty("Vit")
  local VitPer2 = targetUser:GetProperty("VitPer")
  local Int2 = targetUser:GetProperty("Int")
  local IntPer2 = targetUser:GetProperty("IntPer")
  local MDamReduc2 = CommonFun.calcMDamReDuc(srcUser, targetUser)
  local RefineMDamReduc = targetUser:GetProperty("RefineMDamReduc")
  local race2 = targetUser.race
  local DefAttr2=targetUser:GetProperty("DefAttr")

  local damChangePer = damageParam.damChangePer
  ----------------------------------------------------------------------------------------------------------------种族，体型，属性，BOSS减伤效果
  local elementparam2 = CommonFun.CalcElementParam2(srcUser, targetUser, params, damageParam, logger)

  ----------------------------------------------------------------------------------------------------------------法系职业伤害会受到种族加伤减伤影响
  local raceparam     = CommonFun.CalcRaceParam(srcUser, targetUser, params, damageParam, logger)
  local raceparam2    = CommonFun.CalcRaceParam2(srcUser, targetUser, params, damageParam, logger)
  local bossparam     = CommonFun.CalcBossParam(srcUser, targetUser, params, damageParam, logger)
  local bossparam2    = CommonFun.CalcBossParam2(srcUser, targetUser, params, damageParam, logger)

  local BaseMAtk = Int+math.floor(Int*Int/100)
  local MAtkFinal = ((MAtk-BaseMAtk)*(1+MAtkPer)+BaseMAtk)*raceparam*bossparam*bossparam2

  ----------------------------魔法防御减免
  local MDefReduc = CommonFun.CalcMDef(MDef,Int,Vit,srcUser,targetUser)
 --------------------------------------------------------------------------------------------------------------复仇女神效果
  local Weapon=srcUser:GetEquipedID(7)
  local B = 0

  if (Weapon==41521 or Weapon==141521 or Weapon==41568 or Weapon==141568) then
     B = Luk*50
  end

  local WeaponRefineLv=srcUser:GetEquipedRefineLv(7)
  if srcUser:HasBuffID(90001413) or srcUser:HasBuffID(41980) then
    if WeaponRefineLv==15 then
      B = B*2
    end
  end


  local A = (((MAtkFinal*MDefReduc*(1-MDamReduc2)+MRefine)*(1-RefineMDamReduc)*damChangePer*BaseLv/50 + B*MDefReduc*(1-MDamReduc2)*(1-RefineMDamReduc))-Vit2/2*(1+VitPer2)-Int2*(1+IntPer2))*(1+MDamIncrease)*GameConfig.ElementRestrain[srcAtkElement][targetDefElement]*elementparam2

  if srcUser:HasBuffID(52140) then
        A = A * 1.05
  end

  if 1 >= A then
    return 1
  end

  return A

end
-----------------------------------------------------------------------------------------------------佣兵猫使用治愈术
function CommonFun.calcDamage_5106(srcUser, targetUser, params, damageParam, logger)
  local BaseLv = srcUser.BaseLv
  local Int = srcUser:GetProperty("Int")
  local HealEncPer = srcUser:GetProperty("HealEncPer")
  local enemy=srcUser:IsEnemy(targetUser)
  local MDamIncrease = CommonFun.calcMDamIncrease(srcUser, targetUser)


  local srcAtkElement    = CommonFun.GetUserAtkAttr(srcUser, params, damageParam)
  local targetDefElement = targetUser:GetProperty("DefAttr")

  local BeHealEncPer2 = targetUser:GetProperty("BeHealEncPer")
  local race2 = targetUser.race
  local DefAttr2=targetUser:GetProperty("DefAttr")

  local damChangePer  = damageParam.damChangePer
  local damChangePer1 = damageParam.damChangePer1

  if damChangePer1 == nil then
    damChangePer1 = 0
  end

   ----------------------------------------------------------------------------------------------------------------种族，体型，属性，BOSS减伤效果
  local elementparam2 = CommonFun.CalcElementParam2(srcUser, targetUser, params, damageParam, logger)
  --------------------------------------------------------------------------------------治愈术基本治疗量公式

  local A=((math.floor((BaseLv+Int)/10)*damChangePer+100)*(1+HealEncPer)*(1+BeHealEncPer2) + damChangePer1)*(-1)
      if 0 <= A then
         return -1
      end

        return A
end
-----------------------------------------------------------------------------------------------------------------大主教双重圣光技能伤害计算公式(已改)
function CommonFun.calcDamage_5401(srcUser, targetUser, params, damageParam, logger)
  local Str = srcUser:GetProperty("Str")
  local Dex = srcUser:GetProperty("Dex")
  local Luk = srcUser:GetProperty("Luk")
  local Int = srcUser:GetProperty("Int")
  local Atk = srcUser:GetProperty("Atk")
  local AtkPer = srcUser:GetProperty("AtkPer")
  local MAtk = srcUser:GetProperty("MAtk")
  local MAtkPer = srcUser:GetProperty("MAtkPer")
  local DamIncrease = srcUser:GetProperty("DamIncrease")
  local IgnoreDef  = 0
  local IgnoreDef1 = srcUser:GetProperty("IgnoreDef")
  local IgnoreDef2 = srcUser:GetProperty("IgnoreEquipDef")
  if targetUser.boss or targetUser.mini then
     IgnoreDef=IgnoreDef1
  else
     IgnoreDef=(IgnoreDef1+IgnoreDef2)
  end

  if IgnoreDef >= 1 then
     IgnoreDef=1
  end
  ------------------------------------------------------------------------------------将原来的物伤加成改成精炼物理攻击
  local MRefine = srcUser:GetProperty("MRefine")
    ------------------------------------------------------------------------------------将原来的物伤加成改成精炼物理攻击
  local Refine = srcUser:GetProperty("Refine")

  local Def2 = targetUser:GetProperty("Def")
  local DefPer2 = targetUser:GetProperty("DefPer")
  local Vit2 = targetUser:GetProperty("Vit")
  local VitPer2 = targetUser:GetProperty("VitPer")
  local DamReduc2 = CommonFun.calcDamReDuc(srcUser, targetUser)
  local RefineDamReduc = targetUser:GetProperty("RefineDamReduc")

  local damChangePer = damageParam.damChangePer
  ----------------------------------------------------------------------------------------------------------------种族，体型，属性，BOSS加伤效果
  local raceparam     = CommonFun.CalcRaceParam(srcUser, targetUser, params, damageParam, logger)
  local bodyparam     = CommonFun.CalcBodyParam(srcUser, targetUser, params, damageParam, logger)
  local elementparam  = CommonFun.CalcElementParam(srcUser, targetUser, params, damageParam, logger)
  local bossparam     = CommonFun.CalcBossParam(srcUser, targetUser, params, damageParam, logger)

  ----------------------------------------------------------------------------------------------------------------种族，体型，属性，BOSS减伤效果
  local raceparam2    = CommonFun.CalcRaceParam2(srcUser, targetUser, params, damageParam, logger)
  local bodyparam2    = CommonFun.CalcBodyParam2(srcUser, targetUser, params, damageParam, logger)
  local elementparam2 = CommonFun.CalcElementParam2(srcUser, targetUser, params, damageParam, logger)
  local bossparam2    = CommonFun.CalcBossParam2(srcUser, targetUser, params, damageParam, logger)



  local BaseAtk  = Str*2 + math.floor(Str*Str/100) + math.floor(Dex/5) + math.floor(Luk/5)
  local AtkFinal = ((Atk-BaseAtk)*(1+AtkPer)*CommonFun.ShapeCorrection(srcUser,targetUser)*bodyparam*elementparam*elementparam2+BaseAtk)*raceparam*bossparam*bossparam2
  local BaseMAtk = Int+math.floor(Int*Int/100)
  local MAtkFinal= ((MAtk-BaseMAtk)*(1+MAtkPer)+BaseMAtk)*raceparam

  ----------------------------物理防御减免
  local DefReduc= CommonFun.CalcDef(Def,Vit,srcUser,targetUser)

  ---------------------------------星盘
  local Num = srcUser:GetRunePoint(54080)
  local RuneDamage = 1+Num*0.05

  local A = (((AtkFinal+MAtkFinal)*(1-DamReduc2)+Refine+MRefine)*damChangePer*(1-RefineDamReduc)*(1+DamIncrease)-Vit2*(1+VitPer2))*RuneDamage


   if 1 >= A then
         return 1
   end

   return A
end
--------------------------------------------------------------------------------------------------------------------------赞歌伤害计算公式(已改)
function CommonFun.calcDamage_5402(srcUser, targetUser, params, damageParam, logger)
  local Luk = srcUser:GetProperty("Luk")
  local Int = srcUser:GetProperty("Int")
  local Vit = srcUser:GetProperty("Vit")
  local MAtk = srcUser:GetProperty("MAtk")
  local MAtkPer = srcUser:GetProperty("MAtkPer")

  -----------------------------------------------------------------------------------分割线
  local MDamIncrease = CommonFun.calcMDamIncrease(srcUser, targetUser)
  local IgnoreMDef = srcUser:GetProperty("IgnoreMDef")
  if IgnoreMDef >= 1 then
     IgnoreMDef  = 1
  end

  ------------------------------------------------------------------------------------将原来的物伤加成改成精炼物理攻击
  local MRefine = srcUser:GetProperty("MRefine")

  local srcAtkElement    = CommonFun.GetUserAtkAttr(srcUser, params, damageParam)
  local targetDefElement = targetUser:GetProperty("DefAttr")
  ----------------------------------------------------------------------------------------------------------------种族，体型，属性，BOSS减伤效果
  local elementparam2 = CommonFun.CalcElementParam2(srcUser, targetUser, params, damageParam, logger)

  ----------------------------------------------------------------------------------------------------------------法系职业伤害会受到种族加伤减伤影响
  local raceparam     = CommonFun.CalcRaceParam(srcUser, targetUser, params, damageParam, logger)
  local raceparam2    = CommonFun.CalcRaceParam2(srcUser, targetUser, params, damageParam, logger)
  local bossparam     = CommonFun.CalcBossParam(srcUser, targetUser, params, damageParam, logger)
  local bossparam2    = CommonFun.CalcBossParam2(srcUser, targetUser, params, damageParam, logger)

  local MDef2 = targetUser:GetProperty("MDef")
  local MDefPer2 = targetUser:GetProperty("MDefPer")
  local Vit2 = targetUser:GetProperty("Vit")
  local VitPer2 = targetUser:GetProperty("VitPer")
  local Int2 = targetUser:GetProperty("Int")
  local IntPer2 = targetUser:GetProperty("IntPer")
  local MDamReduc2 = CommonFun.calcMDamReDuc(srcUser, targetUser)
  local RefineMDamReduc = targetUser:GetProperty("RefineMDamReduc")

  local damChangePer = damageParam.damChangePer

  local BaseMAtk = Int+math.floor(Int*Int/100)
  local MAtkFinal= ((MAtk-BaseMAtk)*(1+MAtkPer)+BaseMAtk)*raceparam*bossparam*bossparam2
  ----------------------------魔法防御减免
  local MDefReduc = CommonFun.CalcMDef(MDef,Int,Vit,srcUser,targetUser)

  ----------------------------审判之锤+审判之袍+审判之靴
  local Trial1 = 0
  local Trial2 = 1
  local Ring1=srcUser:GetEquipedID(7)
  local RefineLv7=srcUser:GetEquipedRefineLv(7)
  local Ring2=srcUser:GetEquipedID(2)
  local RefineLv2=srcUser:GetEquipedRefineLv(2)
  local Ring3=srcUser:GetEquipedID(4)
  local RefineLv4=srcUser:GetEquipedRefineLv(4)

  if (Ring1==41526 or Ring1==141526) and RefineLv7>5 then
       Trial1=Trial1+(RefineLv7-5)*0.2
  end
  if (Ring2==42076 or Ring2==142076) and RefineLv2>=10 then
       Trial1=Trial1+1
  end
  ----------------------------裁决之锤
  if (Ring1==41565 or Ring1==141565) and RefineLv7>5 then
       Trial1=Trial1+(RefineLv7-5)*0.2
  end
  ------------------------------------------------------审判之袍[第四档]
  if srcUser:HasBuffID(90002053) and RefineLv2>= 5 then
    Trial1=Trial1+0.5
  end

  if (Ring3==43552 or Ring3==143552)  then
      if (RefineLv4>=10 and RefineLv4<15) then
         Trial1=Trial1+0.5
      elseif (RefineLv4==15) then
         Trial1=Trial1+1+0.5
      end
  end

  if srcUser:HasBuffID(91000410) or srcUser:HasBuffID(91000690) then
    Trial2=1.1
  end

  ---------------------------------星盘
  local Num = srcUser:GetRunePoint(54050)
  local RuneDamage = 1+Num*0.06

  local A = ((MAtkFinal*MDefReduc*(1-MDamReduc2)+MRefine)*(damChangePer+Trial1)*(1-RefineMDamReduc)*(1+MDamIncrease)*GameConfig.ElementRestrain[srcAtkElement][targetDefElement]*elementparam2-Vit2/2*(1+VitPer2)-Int2*(1+IntPer2))*Trial2*RuneDamage

  if 1 >= A then
    return 1
  end

  return A

end
-----------------------------------------------------------------------------------------------------------------近战十字军圣十字攻击技能伤害计算公式(已改)
function CommonFun.calcDamage_7201(srcUser, targetUser, params, damageParam, logger)
  local Str = srcUser:GetProperty("Str")
  local Dex = srcUser:GetProperty("Dex")
  local Luk = srcUser:GetProperty("Luk")
  local Int = srcUser:GetProperty("Int")
  local Atk = srcUser:GetProperty("Atk")
  local AtkPer = srcUser:GetProperty("AtkPer")
  local DamIncrease = srcUser:GetProperty("DamIncrease")
  local MAtk = srcUser:GetProperty("MAtk")
  local MAtkPer = srcUser:GetProperty("MAtkPer")
  local IgnoreDef  = 0
  local IgnoreDef1 = srcUser:GetProperty("IgnoreDef")
  local IgnoreDef2 = srcUser:GetProperty("IgnoreEquipDef")
  local WeaponType =srcUser:GetEquipedWeaponType()
  if targetUser.boss or targetUser.mini then
     IgnoreDef=IgnoreDef1
  else
     IgnoreDef=(IgnoreDef1+IgnoreDef2)
  end

  if IgnoreDef >= 1 then
     IgnoreDef=1
  end
    ------------------------------------------------------------------------------------将原来的物伤加成改成精炼物理攻击
  local Refine = srcUser:GetProperty("Refine")

  local Def2 = targetUser:GetProperty("Def")
  local DefPer2 = targetUser:GetProperty("DefPer")
  local Vit2 = targetUser:GetProperty("Vit")
  local VitPer2 = targetUser:GetProperty("VitPer")
  local DamReduc2 = CommonFun.calcDamReDuc(srcUser, targetUser)
  local RefineDamReduc = targetUser:GetProperty("RefineDamReduc")
  ------------------------------------------------------------------------------------将原来的物伤加成改成精炼物理攻击
  local MRefine = srcUser:GetProperty("MRefine")
  -----------------------------------------------------------------------------------分割线
  local MDamIncrease = CommonFun.calcMDamIncrease(srcUser, targetUser)
  local IgnoreMDef = srcUser:GetProperty("IgnoreMDef")
  if IgnoreMDef >= 1 then
     IgnoreMDef  = 1
  end
  --------------------------------------------------------------------------------------------------------魔法防御减免
  local MDef2 = targetUser:GetProperty("MDef")
  local MDefPer2 = targetUser:GetProperty("MDefPer")
  local Vit2 = targetUser:GetProperty("Vit")
  local VitPer2 = targetUser:GetProperty("VitPer")
  local Int2 = targetUser:GetProperty("Int")
  local IntPer2 = targetUser:GetProperty("IntPer")
  local MDamReduc2 = CommonFun.calcMDamReDuc(srcUser, targetUser)
  local RefineMDamReduc = targetUser:GetProperty("RefineMDamReduc")
  local damChangePer = damageParam.damChangePer

  ----------------------------------------------------------------------------------------------------------------种族，体型，属性，BOSS加伤效果
  local raceparam     = CommonFun.CalcRaceParam(srcUser, targetUser, params, damageParam, logger)
  local bodyparam     = CommonFun.CalcBodyParam(srcUser, targetUser, params, damageParam, logger)
  local elementparam  = CommonFun.CalcElementParam(srcUser, targetUser, params, damageParam, logger)
  local bossparam     = CommonFun.CalcBossParam(srcUser, targetUser, params, damageParam, logger)

  ----------------------------------------------------------------------------------------------------------------种族，体型，属性，BOSS减伤效果
  local raceparam2    = CommonFun.CalcRaceParam2(srcUser, targetUser, params, damageParam, logger)
  local bodyparam2    = CommonFun.CalcBodyParam2(srcUser, targetUser, params, damageParam, logger)
  local elementparam2 = CommonFun.CalcElementParam2(srcUser, targetUser, params, damageParam, logger)
  local bossparam2    = CommonFun.CalcBossParam2(srcUser, targetUser, params, damageParam, logger)


  -------------------------------------------------------------星盘圣十字攻击
  local Num1 = srcUser:GetRunePoint(70020)
  local RuneDamage = 1 + 0.1*Num1
  -------------------------------------------------------------神佑之光伤害加成
  local skilllv_1 = srcUser:GetLernedSkillLevel(362)
  local Skilldamage = skilllv_1*0.2
  -------------------------------------------------------------旗鱼枪
  local EquipDamage = 0
  local RefineDamage =0
  local RefineLv=srcUser:GetEquipedRefineLv(7)
  if srcUser:HasBuffID(40380) then
      EquipDamage = 1
      RefineDamage = 0.3*RefineLv
  end
  -------------------------------------------------------------旗鱼枪四档
  local EquipDamage_1 = 0
  if srcUser:HasBuffID(90001253) then
    EquipDamage_1 = 0.5
  end

  -----------------------------------------------------------深海恐惧
  if srcUser:HasBuffID(41770) then
      EquipDamage = EquipDamage + 1.5
      RefineDamage = RefineDamage + 0.3*RefineLv
  end




  local BaseAtk  = Str*2 + math.floor(Str*Str/100) + math.floor(Dex/5) + math.floor(Luk/5)
  local AtkFinal = ((Atk-BaseAtk)*(1+AtkPer)*CommonFun.ShapeCorrection(srcUser,targetUser)*bodyparam*elementparam*elementparam2+BaseAtk)*raceparam*bossparam*bossparam2

  ----------------------------物理防御减免
  local DefReduc= CommonFun.CalcDef(Def,Vit,srcUser,targetUser)

  local A = (AtkFinal*DefReduc*(1-DamReduc2)+Refine)*(damChangePer + Skilldamage + EquipDamage + RefineDamage+EquipDamage_1)*(1+DamIncrease)*(1-RefineDamReduc)-Vit2*(1+VitPer2)

  if 1 >= A then
     A = 1
  end

  local srcAtkElement    = 6
  local targetDefElement = targetUser:GetProperty("DefAttr")

  local BaseMAtk = Int+math.floor(Int*Int/100)
  local MAtkFinal= ((MAtk-BaseMAtk)*(1+MAtkPer)+BaseMAtk)*raceparam

  ----------------------------魔法防御减免
  local MDefReduc = CommonFun.CalcMDef(MDef,Int,Vit,srcUser,targetUser)

  local B = ((MAtkFinal*MDefReduc*(1-MDamReduc2)+MRefine)*(damChangePer + Skilldamage + EquipDamage + RefineDamage)*(1-RefineMDamReduc)*(1+MDamIncrease)*GameConfig.ElementRestrain[srcAtkElement][targetDefElement]*elementparam2-Vit2/2*(1+VitPer2)-Int2*(1+IntPer2))

  if 1 >= B then
     B = 1
  end

  local C = (A + B)*RuneDamage

  local WeaponType =srcUser:GetEquipedWeaponType()
  if WeaponType~=170 then
      C=C*0.5
  end

   return C
end

-----------------------------------------------------------------------------------------------------------------神之威压 技能伤害计算公式(已改)
function CommonFun.calcDamage_7202(srcUser, targetUser, params, damageParam, logger)

  local damChangePer = damageParam.damChangePer

  local A = damChangePer

   return A
end
-----------------------------------------------------------------------------------------------------------------皇家卫士 大地猛击伤害计算公式(已改)
function CommonFun.calcDamage_7401(srcUser, targetUser, params, damageParam, logger)
  local Str = srcUser:GetProperty("Str")
  local Dex = srcUser:GetProperty("Dex")
  local Luk = srcUser:GetProperty("Luk")
  local Atk = srcUser:GetProperty("Atk")
  local AtkPer = srcUser:GetProperty("AtkPer")
  local DamIncrease = srcUser:GetProperty("DamIncrease")
  local IgnoreDef  = 0
  local IgnoreDef1 = srcUser:GetProperty("IgnoreDef")
  local IgnoreDef2 = srcUser:GetProperty("IgnoreEquipDef")
  if targetUser.boss or targetUser.mini then
     IgnoreDef=IgnoreDef1
  else
     IgnoreDef=(IgnoreDef1+IgnoreDef2)
  end

  if IgnoreDef >= 1 then
     IgnoreDef=1
  end
    ------------------------------------------------------------------------------------将原来的物伤加成改成精炼物理攻击
  local Refine = srcUser:GetProperty("Refine")

  local Def2 = targetUser:GetProperty("Def")
  local DefPer2 = targetUser:GetProperty("DefPer")
  local Vit2 = targetUser:GetProperty("Vit")
  local VitPer2 = targetUser:GetProperty("VitPer")
  local DamReduc2 = CommonFun.calcDamReDuc(srcUser, targetUser)
  local RefineDamReduc = targetUser:GetProperty("RefineDamReduc")

  local damChangePer = damageParam.damChangePer

  ----------------------------------------------------------------------------------------------------------------种族，体型，属性，BOSS加伤效果
  local raceparam     = CommonFun.CalcRaceParam(srcUser, targetUser, params, damageParam, logger)
  local bodyparam     = CommonFun.CalcBodyParam(srcUser, targetUser, params, damageParam, logger)
  local elementparam  = CommonFun.CalcElementParam(srcUser, targetUser, params, damageParam, logger)
  local bossparam     = CommonFun.CalcBossParam(srcUser, targetUser, params, damageParam, logger)

  ----------------------------------------------------------------------------------------------------------------种族，体型，属性，BOSS减伤效果
  local raceparam2    = CommonFun.CalcRaceParam2(srcUser, targetUser, params, damageParam, logger)
  local bodyparam2    = CommonFun.CalcBodyParam2(srcUser, targetUser, params, damageParam, logger)
  local elementparam2 = CommonFun.CalcElementParam2(srcUser, targetUser, params, damageParam, logger)
  local bossparam2    = CommonFun.CalcBossParam2(srcUser, targetUser, params, damageParam, logger)


  local Vit = srcUser:GetProperty("Vit")
  local Def = srcUser:GetProperty("Def")
  local DefPer = srcUser:GetProperty("DefPer")

  local BaseAtk  = Vit*Vit*Def*(1+DefPer)/10000
  local AtkFinal = BaseAtk*bodyparam*elementparam*elementparam2*raceparam*bossparam*bossparam2

  local skilllv_1 = srcUser:GetLernedSkillLevel(1181)--------------守护之盾
  local Sheild = skilllv_1*0.01+1
  ----------------------------物理防御减免
  local DefReduc= CommonFun.CalcDef(Def,Vit,srcUser,targetUser)

  local A = ((AtkFinal*DefReduc*(1-DamReduc2))*damChangePer*(1-RefineDamReduc)*(1+DamIncrease)-Vit2*(1+VitPer2))*Sheild

   if 1 >= A then
         return 1
   end

   return A
end
-----------------------------------------------------------------------------------------------------------------血十字 技能伤害计算公式(已改)
function CommonFun.calcDamage_7402(srcUser, targetUser, params, damageParam, logger)
  local Str = srcUser:GetProperty("Str")
  local Dex = srcUser:GetProperty("Dex")
  local Luk = srcUser:GetProperty("Luk")
  local Int = srcUser:GetProperty("Int")
  local Atk = srcUser:GetProperty("Atk")
  local AtkPer = srcUser:GetProperty("AtkPer")
  local DamIncrease = srcUser:GetProperty("DamIncrease")
  local MAtk = srcUser:GetProperty("MAtk")
  local MAtkPer = srcUser:GetProperty("MAtkPer")
  local IgnoreDef  = 0
  local IgnoreDef1 = srcUser:GetProperty("IgnoreDef")
  local IgnoreDef2 = srcUser:GetProperty("IgnoreEquipDef")
  local WeaponType =srcUser:GetEquipedWeaponType()
  if targetUser.boss or targetUser.mini then
     IgnoreDef=IgnoreDef1
  else
     IgnoreDef=(IgnoreDef1+IgnoreDef2)
  end

  if IgnoreDef >= 1 then
     IgnoreDef=1
  end
    ------------------------------------------------------------------------------------将原来的物伤加成改成精炼物理攻击
  local Refine = srcUser:GetProperty("Refine")

  local Def2 = targetUser:GetProperty("Def")
  local DefPer2 = targetUser:GetProperty("DefPer")
  local Vit2 = targetUser:GetProperty("Vit")
  local VitPer2 = targetUser:GetProperty("VitPer")
  local DamReduc2 = CommonFun.calcDamReDuc(srcUser, targetUser)
  local RefineDamReduc = targetUser:GetProperty("RefineDamReduc")
  ------------------------------------------------------------------------------------将原来的物伤加成改成精炼物理攻击
  local MRefine = srcUser:GetProperty("MRefine")
  -----------------------------------------------------------------------------------分割线
  local MDamIncrease = CommonFun.calcMDamIncrease(srcUser, targetUser)
  local IgnoreMDef = srcUser:GetProperty("IgnoreMDef")
  if IgnoreMDef >= 1 then
     IgnoreMDef  = 1
  end
  --------------------------------------------------------------------------------------------------------魔法防御减免
  local MDef2 = targetUser:GetProperty("MDef")
  local MDefPer2 = targetUser:GetProperty("MDefPer")
  local Vit2 = targetUser:GetProperty("Vit")
  local VitPer2 = targetUser:GetProperty("VitPer")
  local Int2 = targetUser:GetProperty("Int")
  local IntPer2 = targetUser:GetProperty("IntPer")
  local MDamReduc2 = CommonFun.calcMDamReDuc(srcUser, targetUser)
  local RefineMDamReduc = targetUser:GetProperty("RefineMDamReduc")
  local damChangePer = damageParam.damChangePer

  ----------------------------------------------------------------------------------------------------------------种族，体型，属性，BOSS加伤效果
  local raceparam     = CommonFun.CalcRaceParam(srcUser, targetUser, params, damageParam, logger)
  local bodyparam     = CommonFun.CalcBodyParam(srcUser, targetUser, params, damageParam, logger)
  local elementparam  = CommonFun.CalcElementParam(srcUser, targetUser, params, damageParam, logger)
  local bossparam     = CommonFun.CalcBossParam(srcUser, targetUser, params, damageParam, logger)

  ----------------------------------------------------------------------------------------------------------------种族，体型，属性，BOSS减伤效果
  local raceparam2    = CommonFun.CalcRaceParam2(srcUser, targetUser, params, damageParam, logger)
  local bodyparam2    = CommonFun.CalcBodyParam2(srcUser, targetUser, params, damageParam, logger)
  local elementparam2 = CommonFun.CalcElementParam2(srcUser, targetUser, params, damageParam, logger)
  local bossparam2    = CommonFun.CalcBossParam2(srcUser, targetUser, params, damageParam, logger)

  local BaseAtk  = Str*2 + math.floor(Str*Str/100) + math.floor(Dex/5) + math.floor(Luk/5)
  local AtkFinal = ((Atk-BaseAtk)*(1+AtkPer)*CommonFun.ShapeCorrection(srcUser,targetUser)*bodyparam*elementparam*elementparam2+BaseAtk)*raceparam*bossparam*bossparam2

  ----------------------------物理防御减免
  local DefReduc= CommonFun.CalcDef(Def,Vit,srcUser,targetUser)

  local A = (AtkFinal*DefReduc*(1-DamReduc2)+Refine)*damChangePer*(1+DamIncrease)*(1-RefineDamReduc)-Vit2*(1+VitPer2)

  if 1 >= A then
     A = 1
  end

  local srcAtkElement    = CommonFun.GetUserAtkAttr(srcUser, params, damageParam)
  local targetDefElement = targetUser:GetProperty("DefAttr")

  local BaseMAtk = Int+math.floor(Int*Int/100)
  local MAtkFinal= ((MAtk-BaseMAtk)*(1+MAtkPer)+BaseMAtk)*raceparam

  ----------------------------魔法防御减免
  local MDefReduc = CommonFun.CalcMDef(MDef,Int,Vit,srcUser,targetUser)

  local B = ((MAtkFinal*MDefReduc*(1-MDamReduc2)+MRefine)*damChangePer*(1-RefineMDamReduc)*(1+MDamIncrease)*GameConfig.ElementRestrain[srcAtkElement][targetDefElement]*elementparam2-Vit2/2*(1+VitPer2)-Int2*(1+IntPer2))

  if 1 >= B then
     B = 1
  end
  -----------------------------------------------星盘
  local Num = srcUser:GetRunePoint(74030)
  local RuneDamage = 1+Num*0.07

  -----------------------------------------------无颅武士卡片
  local Card = 1
  if srcUser:HasBuffID(52790) then
    Card = 1.1
  end
  -----------------------------------------------------------深海恐惧
  local EquipDamage = 1
  if srcUser:HasBuffID(41770) then
      EquipDamage = EquipDamage + 0.3
  end




  local C = (A + B)*RuneDamage*Card*EquipDamage

   return C
end
------------------------------------------------------------------------------------------------------随机伤害技能攻击计算公式(已改)
function CommonFun.calcDamage_8000(srcUser, targetUser, params, damageParam, logger)
  local Str = srcUser:GetProperty("Str")
  local Dex = srcUser:GetProperty("Dex")
  local Luk = srcUser:GetProperty("Luk")
  local Atk = srcUser:GetProperty("Atk")
  local AtkPer = srcUser:GetProperty("AtkPer")
  local DamIncrease = srcUser:GetProperty("DamIncrease")
  local IgnoreDef  = 0
  local IgnoreDef1 = srcUser:GetProperty("IgnoreDef")
  local IgnoreDef2 = srcUser:GetProperty("IgnoreEquipDef")
  if targetUser.boss or targetUser.mini then
     IgnoreDef=IgnoreDef1
  else
     IgnoreDef=(IgnoreDef1+IgnoreDef2)
  end

  if IgnoreDef >= 1 then
     IgnoreDef  = 1
  end

  local BaseLv = targetUser.BaseLv
  local WeaponType =srcUser:GetEquipedWeaponType()
  local skilllv_1 = srcUser:GetLernedSkillLevel(damageParam.skill1_id)
  ------------------------------------------------------------------------------------将原来的物伤加成改成精炼物理攻击
  local Refine = srcUser:GetProperty("Refine")

  local damChangePer  = damageParam.damChangePer

  local Def2 = targetUser:GetProperty("Def")
  local DefPer2 = targetUser:GetProperty("DefPer")
  local Vit2 = targetUser:GetProperty("Vit")
  local VitPer2 = targetUser:GetProperty("VitPer")
  local DamReduc2 = CommonFun.calcDamReDuc(srcUser, targetUser)
  local RefineDamReduc = targetUser:GetProperty("RefineDamReduc")

  local AttrEffect2 = srcUser:GetProperty("AttrEffect")
  local bits2=CommonFun.getBits(AttrEffect2)


  local AtkFinal = math.floor(BaseLv,BaseLv*3)*damChangePer

  ----------------------------物理防御减免
  local DefReduc= CommonFun.CalcDef(Def,Vit,srcUser,targetUser)

  local A = (AtkFinal*DefReduc*(1-DamReduc2)+Refine)*(1+DamIncrease)*(1-RefineDamReduc)-Vit2*(1+VitPer2)


   if 1 >= A then
         return 1
   end

  return A

end

-----------------------------------------------------------------------------------------------------------------连续盾击技能伤害(已改)
function CommonFun.calcDamage_7203(srcUser, targetUser, params, damageParam, logger)
  local Str = srcUser:GetProperty("Str")
  local Dex = srcUser:GetProperty("Dex")
  local Vit = srcUser:GetProperty("Vit")
  local Luk = srcUser:GetProperty("Luk")
  local Atk = srcUser:GetProperty("Atk")
  local AtkPer = srcUser:GetProperty("AtkPer")
  local DamIncrease = srcUser:GetProperty("DamIncrease")
  local shield=srcUser:GetEquipedID(1)
  local IgnoreDef  = 0
  local IgnoreDef1 = srcUser:GetProperty("IgnoreDef")
  local IgnoreDef2 = srcUser:GetProperty("IgnoreEquipDef")
  if targetUser.boss or targetUser.mini then
     IgnoreDef=IgnoreDef1
  else
     IgnoreDef=(IgnoreDef1+IgnoreDef2)
  end

  if IgnoreDef >= 1 then
     IgnoreDef=1
  end
    ------------------------------------------------------------------------------------将原来的物伤加成改成精炼物理攻击
  local Refine = srcUser:GetProperty("Refine")

  local Def2 = targetUser:GetProperty("Def")
  local DefPer2 = targetUser:GetProperty("DefPer")
  local Vit2 = targetUser:GetProperty("Vit")
  local VitPer2 = targetUser:GetProperty("VitPer")
  local DamReduc2 = CommonFun.calcDamReDuc(srcUser, targetUser)
  local RefineDamReduc = targetUser:GetProperty("RefineDamReduc")

  local damChangePer = damageParam.damChangePer

  ----------------------------------------------------------------------------------------------------------------种族，体型，属性，BOSS加伤效果
  local raceparam     = CommonFun.CalcRaceParam(srcUser, targetUser, params, damageParam, logger)
  local bodyparam     = CommonFun.CalcBodyParam(srcUser, targetUser, params, damageParam, logger)
  local elementparam  = CommonFun.CalcElementParam(srcUser, targetUser, params, damageParam, logger)
  local bossparam     = CommonFun.CalcBossParam(srcUser, targetUser, params, damageParam, logger)

  ----------------------------------------------------------------------------------------------------------------种族，体型，属性，BOSS减伤效果
  local raceparam2    = CommonFun.CalcRaceParam2(srcUser, targetUser, params, damageParam, logger)
  local bodyparam2    = CommonFun.CalcBodyParam2(srcUser, targetUser, params, damageParam, logger)
  local elementparam2 = CommonFun.CalcElementParam2(srcUser, targetUser, params, damageParam, logger)
  local bossparam2    = CommonFun.CalcBossParam2(srcUser, targetUser, params, damageParam, logger)



  local BaseAtk  = Str*2 + math.floor(Str*Str/100) + math.floor(Dex/5) + math.floor(Luk/5)
  local AtkFinal = ((Atk-BaseAtk)*(1+AtkPer)*CommonFun.ShapeCorrection(srcUser,targetUser)*bodyparam*elementparam*elementparam2+BaseAtk)*raceparam*bossparam*bossparam2

  ----------------------------物理防御减免
  local DefReduc= CommonFun.CalcDef(Def,Vit,srcUser,targetUser)
  -------------------------------------------------------------星盘连续盾击
  local Num1 = srcUser:GetRunePoint(70040)
  local RuneDamage = 1 + 0.1*Num1

    ------------------------------------------------------------体质和灵巧带来伤害加成
  local RefineLv=srcUser:GetEquipedRefineLv(1)
  local VDDamage = Vit/150 +Dex/200 + RefineLv/15
  if VDDamage <= 0 then
     VDDamage  = 0
  end

  local skilllv_1 = srcUser:GetLernedSkillLevel(1181)--------------守护之盾
  local Sheild = skilllv_1*0.01+1

  local A = ((AtkFinal*DefReduc*(1-DamReduc2)+Refine)*(damChangePer + VDDamage)*(1+DamIncrease)*(1-RefineDamReduc)-Vit2*(1+VitPer2))*RuneDamage*Sheild


    ---------------------------------------------------------------------------------------------------------------------皇家战甲[第四档]
  local RefineLvH = srcUser:GetEquipedRefineLv(2)
  local huangjiazhanjia = 0
  if RefineLvH >= 10 and srcUser:HasBuffID(90002013) then
       huangjiazhanjia = 0.15
  end
  ---------------------------------------------------------------------------------------------------------------------镜盾[第四档]
  local RefineLvJ = srcUser:GetEquipedRefineLv(1)
  local jingdun = 0
  if RefineLvJ >= 10 and srcUser:HasBuffID(90002033) then
       jingdun = 0.1
  end
  ----------------------------------------------------------------------------------------------------------------------------镜盾装备效果
  if shield==42508 or shield==142508 then
    return A*(1.15 + huangjiazhanjia + jingdun ) else
    return A*(1 + huangjiazhanjia + jingdun)
  end


   if 1 >= A then
         return 1
   end

   return A
end


-----------------------------------------------------------------------------------------------------------------回旋盾击技能伤害(已改)
function CommonFun.calcDamage_7204(srcUser, targetUser, params, damageParam, logger)
  local Str = srcUser:GetProperty("Str")
  local Dex = srcUser:GetProperty("Dex")
  local Vit = srcUser:GetProperty("Vit")
  local Luk = srcUser:GetProperty("Luk")
  local Atk = srcUser:GetProperty("Atk")
  local AtkPer = srcUser:GetProperty("AtkPer")
  local DamIncrease = srcUser:GetProperty("DamIncrease")
  local shield=srcUser:GetEquipedID(1)
  local RefineLv=srcUser:GetEquipedRefineLv(1)
  local IgnoreDef  = 0
  local IgnoreDef1 = srcUser:GetProperty("IgnoreDef")
  local IgnoreDef2 = srcUser:GetProperty("IgnoreEquipDef")
  if targetUser.boss or targetUser.mini then
     IgnoreDef=IgnoreDef1
  else
     IgnoreDef=(IgnoreDef1+IgnoreDef2)
  end

  if IgnoreDef >= 1 then
     IgnoreDef=1
  end
    ------------------------------------------------------------------------------------将原来的物伤加成改成精炼物理攻击
  local Refine = srcUser:GetProperty("Refine")

  local Def2 = targetUser:GetProperty("Def")
  local DefPer2 = targetUser:GetProperty("DefPer")
  local Vit2 = targetUser:GetProperty("Vit")
  local VitPer2 = targetUser:GetProperty("VitPer")
  local DamReduc2 = CommonFun.calcDamReDuc(srcUser, targetUser)
  local RefineDamReduc = targetUser:GetProperty("RefineDamReduc")

  local damChangePer = damageParam.damChangePer

  ----------------------------------------------------------------------------------------------------------------种族，体型，属性，BOSS加伤效果
  local raceparam     = CommonFun.CalcRaceParam(srcUser, targetUser, params, damageParam, logger)
  local bodyparam     = CommonFun.CalcBodyParam(srcUser, targetUser, params, damageParam, logger)
  local elementparam  = CommonFun.CalcElementParam(srcUser, targetUser, params, damageParam, logger)
  local bossparam     = CommonFun.CalcBossParam(srcUser, targetUser, params, damageParam, logger)

  ----------------------------------------------------------------------------------------------------------------种族，体型，属性，BOSS减伤效果
  local raceparam2    = CommonFun.CalcRaceParam2(srcUser, targetUser, params, damageParam, logger)
  local bodyparam2    = CommonFun.CalcBodyParam2(srcUser, targetUser, params, damageParam, logger)
  local elementparam2 = CommonFun.CalcElementParam2(srcUser, targetUser, params, damageParam, logger)
  local bossparam2    = CommonFun.CalcBossParam2(srcUser, targetUser, params, damageParam, logger)
  --------------------------------------------------------------回旋盾击巅峰等级
  local skilllv_1 = srcUser:GetLernedSkillLevel(352)
  local TopAtk = 0
  if skilllv_1>5 then
      TopAtk = (Atk*(1+AtkPer) + Refine)*(skilllv_1-5)/10
  end

  local BaseAtk  = Vit*8 + math.floor(Vit*Vit/100)*4 + math.floor(Dex/5) + math.floor(Luk/5) + RefineLv*RefineLv*2 + TopAtk
  local AtkFinal = BaseAtk*elementparam*elementparam2*raceparam*bossparam*bossparam2

  ----------------------------物理防御减免
  local DefReduc= CommonFun.CalcDef(Def,Vit,srcUser,targetUser)
  -------------------------------------------------------------星盘回旋盾击
  local Num1 = srcUser:GetRunePoint(70100)
  local RuneDamage = 1 + 0.05*Num1

  ------------------------------------------------------------体质和灵巧带来伤害加成
  local RefineLv=srcUser:GetEquipedRefineLv(1)
  local VDDamage = Vit/150 + Dex/200 + RefineLv/15
  if VDDamage <= 0 then
     VDDamage  = 0
  end

  local skilllv_1 = srcUser:GetLernedSkillLevel(1181)--------------守护之盾
  local Sheild = skilllv_1*0.01+1

  local A = (AtkFinal*DefReduc*(1-DamReduc2)*(damChangePer + VDDamage)*(1+DamIncrease)*(1-RefineDamReduc)-Vit2*(1+VitPer2))*RuneDamage*Sheild

     ---------------------------------------------------------------------------------------------------------------------皇家战甲[第四档]
  local RefineLvH = srcUser:GetEquipedRefineLv(2)
  local huangjiazhanjia = 0
  if RefineLvH >= 10 and srcUser:HasBuffID(90002013) then
       huangjiazhanjia = 0.15
  end
  ---------------------------------------------------------------------------------------------------------------------镜盾[第四档]
  local RefineLvJ = srcUser:GetEquipedRefineLv(1)
  local jingdun = 0
  if RefineLvJ >= 10 and srcUser:HasBuffID(90002033) then
       jingdun = 0.1
  end
  ----------------------------------------------------------------------------------------------------------------------------镜盾装备效果
  if shield==42508 or shield==142508 then
    return A*(1.15 + huangjiazhanjia + jingdun ) else
    return A*(1 + huangjiazhanjia + jingdun)
  end

   if 1 >= A then
         return 1
   end

   return A
end


-----------------------------------------------------------------------------------------------------------------盾击技能伤害(已改)
function CommonFun.calcDamage_7205(srcUser, targetUser, params, damageParam, logger)
  local Str = srcUser:GetProperty("Str")
  local Dex = srcUser:GetProperty("Dex")
  local Vit = srcUser:GetProperty("Vit")
  local Luk = srcUser:GetProperty("Luk")
  local Atk = srcUser:GetProperty("Atk")
  local AtkPer = srcUser:GetProperty("AtkPer")
  local DamIncrease = srcUser:GetProperty("DamIncrease")
  local shield=srcUser:GetEquipedID(1)
  local RefineLv=srcUser:GetEquipedRefineLv(1)
  local IgnoreDef  = 0
  local IgnoreDef1 = srcUser:GetProperty("IgnoreDef")
  local IgnoreDef2 = srcUser:GetProperty("IgnoreEquipDef")
  if targetUser.boss or targetUser.mini then
     IgnoreDef=IgnoreDef1
  else
     IgnoreDef=(IgnoreDef1+IgnoreDef2)
  end

  if IgnoreDef >= 1 then
     IgnoreDef=1
  end
    ------------------------------------------------------------------------------------将原来的物伤加成改成精炼物理攻击
  local Refine = srcUser:GetProperty("Refine")

  local Def2 = targetUser:GetProperty("Def")
  local DefPer2 = targetUser:GetProperty("DefPer")
  local Vit2 = targetUser:GetProperty("Vit")
  local VitPer2 = targetUser:GetProperty("VitPer")
  local DamReduc2 = CommonFun.calcDamReDuc(srcUser, targetUser)
  local RefineDamReduc = targetUser:GetProperty("RefineDamReduc")

  local damChangePer = damageParam.damChangePer

  ----------------------------------------------------------------------------------------------------------------种族，体型，属性，BOSS加伤效果
  local raceparam     = CommonFun.CalcRaceParam(srcUser, targetUser, params, damageParam, logger)
  local bodyparam     = CommonFun.CalcBodyParam(srcUser, targetUser, params, damageParam, logger)
  local elementparam  = CommonFun.CalcElementParam(srcUser, targetUser, params, damageParam, logger)
  local bossparam     = CommonFun.CalcBossParam(srcUser, targetUser, params, damageParam, logger)

  ----------------------------------------------------------------------------------------------------------------种族，体型，属性，BOSS减伤效果
  local raceparam2    = CommonFun.CalcRaceParam2(srcUser, targetUser, params, damageParam, logger)
  local bodyparam2    = CommonFun.CalcBodyParam2(srcUser, targetUser, params, damageParam, logger)
  local elementparam2 = CommonFun.CalcElementParam2(srcUser, targetUser, params, damageParam, logger)
  local bossparam2    = CommonFun.CalcBossParam2(srcUser, targetUser, params, damageParam, logger)



  local BaseAtk  = Str*2 + math.floor(Str*Str/100) + math.floor(Dex/5) + math.floor(Luk/5)
  local AtkFinal = ((Atk-BaseAtk)*(1+AtkPer)*CommonFun.ShapeCorrection(srcUser,targetUser)*bodyparam*elementparam*elementparam2+BaseAtk)*raceparam*bossparam*bossparam2

  ----------------------------物理防御减免
  local DefReduc= CommonFun.CalcDef(Def,Vit,srcUser,targetUser)
  ------------------------------------------------------------体质和灵巧带来伤害加成
  local RefineLv=srcUser:GetEquipedRefineLv(1)
  local VDDamage = Vit/150 + Dex/200 + RefineLv/15
  if VDDamage <= 0 then
     VDDamage  = 0
  end

  local skilllv_1 = srcUser:GetLernedSkillLevel(1181)--------------守护之盾
  local Sheild = skilllv_1*0.01+1

  local A = ((AtkFinal*DefReduc*(1-DamReduc2)+Refine)*(damChangePer + VDDamage)*(1+DamIncrease)*(1-RefineDamReduc)-Vit2*(1+VitPer2))*Sheild

     ---------------------------------------------------------------------------------------------------------------------皇家战甲[第四档]
  local RefineLvH = srcUser:GetEquipedRefineLv(2)
  local huangjiazhanjia = 0
  if RefineLvH >= 10 and srcUser:HasBuffID(90002013) then
       huangjiazhanjia = 0.15
  end
  ---------------------------------------------------------------------------------------------------------------------镜盾[第四档]
  local RefineLvJ = srcUser:GetEquipedRefineLv(1)
  local jingdun = 0
  if RefineLvJ >= 10 and srcUser:HasBuffID(90002033) then
       jingdun = 0.1
  end
  ----------------------------------------------------------------------------------------------------------------------------镜盾装备效果
  if shield==42508 or shield==142508 then
    return A*(1.15 + huangjiazhanjia + jingdun ) else
    return A*(1 + huangjiazhanjia + jingdun)
  end

   if 1 >= A then
         return 1
   end

   return A
end
-----------------------------------安生命值百分比决定的伤害
function CommonFun.calcDamage_8001(srcUser, targetUser, params, damageParam, logger)

  local damChangePer = damageParam.damChangePer
  local damChangePer1 = damageParam.damChangePer1
  local MaxHp = targetUser:GetProperty("MaxHp")

  local A = MaxHp*damChangePer+damChangePer1

   if 1 >= A then
         return 1
   end

  return A

end

-- ----------------------------------------------------------------------------------------------------随机伤害技能攻击计算公式(已改)
function CommonFun.calcDamage_8002(srcUser, targetUser, params, damageParam, logger)
  local Str = srcUser:GetProperty("Str")
  local Dex = srcUser:GetProperty("Dex")
  local Luk = srcUser:GetProperty("Luk")
  local Atk = srcUser:GetProperty("Atk")
  local AtkPer = srcUser:GetProperty("AtkPer")
  local DamIncrease = srcUser:GetProperty("DamIncrease")
  local IgnoreDef  = 0
  local IgnoreDef1 = srcUser:GetProperty("IgnoreDef")
  local IgnoreDef2 = srcUser:GetProperty("IgnoreEquipDef")
  if targetUser.boss or targetUser.mini then
     IgnoreDef=IgnoreDef1
  else
     IgnoreDef=(IgnoreDef1+IgnoreDef2)
  end

  if IgnoreDef >= 1 then
     IgnoreDef  = 1
  end

  local BaseLv = targetUser.BaseLv
  local WeaponType =srcUser:GetEquipedWeaponType()
  local skilllv_1 = srcUser:GetLernedSkillLevel(damageParam.skill1_id)
  ------------------------------------------------------------------------------------将原来的物伤加成改成精炼物理攻击
  local Refine = srcUser:GetProperty("Refine")

  local damChangePer   = damageParam.damChangePer
  local damChangePer1  = damageParam.damChangePer1

  local Def2 = targetUser:GetProperty("Def")
  local DefPer2 = targetUser:GetProperty("DefPer")
  local Vit2 = targetUser:GetProperty("Vit")
  local VitPer2 = targetUser:GetProperty("VitPer")
  local DamReduc2 = CommonFun.calcDamReDuc(srcUser, targetUser)
  local RefineDamReduc = targetUser:GetProperty("RefineDamReduc")

  local AttrEffect2 = srcUser:GetProperty("AttrEffect")
  local bits2=CommonFun.getBits(AttrEffect2)


  local AtkFinal = math.random(BaseLv*10,BaseLv*16)*damChangePer + math.random(500,1500)*damChangePer1

  ----------------------------物理防御减免
  local DefReduc= CommonFun.CalcDef(Def,Vit,srcUser,targetUser)

  local A = (AtkFinal*DefReduc*(1-DamReduc2)+Refine)*(1+DamIncrease)*(1-RefineDamReduc)-Vit2*(1+VitPer2)


   if 1 >= A then
         return 1
   end

  return A

end

-----------------------------------------------------------------------------------------------------佣兵猫使用冲锋箭
function CommonFun.calcDamage_8003(srcUser, targetUser, params, damageParam, logger)
  local Str = srcUser:GetProperty("Str")
  local Dex = srcUser:GetProperty("Dex")
  local Luk = srcUser:GetProperty("Luk")
  local Atk = srcUser:GetProperty("Atk")
  local AtkPer = srcUser:GetProperty("AtkPer")
  local DamIncrease = srcUser:GetProperty("DamIncrease")
  local IgnoreDef  = 0
  local IgnoreDef1 = srcUser:GetProperty("IgnoreDef")
  local IgnoreDef2 = srcUser:GetProperty("IgnoreEquipDef")
  if targetUser.boss or targetUser.mini then
     IgnoreDef=IgnoreDef1
  else
     IgnoreDef=(IgnoreDef1+IgnoreDef2)
  end

  if IgnoreDef >= 1 then
     IgnoreDef  = 1
  end

  local Refine = srcUser:GetProperty("Refine")

  local AttrEffect = srcUser:GetProperty("AttrEffect")
  local bits=CommonFun.getBits(AttrEffect)

  local Def2 = targetUser:GetProperty("Def")
  local DefPer2 = targetUser:GetProperty("DefPer")
  local Vit2 = targetUser:GetProperty("Vit")
  local VitPer2 = targetUser:GetProperty("VitPer")
  local DamReduc2 = CommonFun.calcDamReDuc(srcUser, targetUser)
  local LongRangeDamReduc2 = targetUser:GetProperty("LongRangeDamReduc")
  local RefineDamReduc = targetUser:GetProperty("RefineDamReduc")

  local damChangePer  = damageParam.damChangePer
  local damChangePer1 = damageParam.damChangePer1

  ----------------------------------------------------------------------------------------------------------------种族，体型，属性，BOSS加伤效果
  local raceparam     = CommonFun.CalcRaceParam(srcUser, targetUser, params, damageParam, logger)
  local bodyparam     = CommonFun.CalcBodyParam(srcUser, targetUser, params, damageParam, logger)
  local elementparam  = CommonFun.CalcElementParam(srcUser, targetUser, params, damageParam, logger)
  local bossparam     = CommonFun.CalcBossParam(srcUser, targetUser, params, damageParam, logger)

  ----------------------------------------------------------------------------------------------------------------种族，体型，属性，BOSS减伤效果
  local raceparam2    = CommonFun.CalcRaceParam2(srcUser, targetUser, params, damageParam, logger)
  local bodyparam2    = CommonFun.CalcBodyParam2(srcUser, targetUser, params, damageParam, logger)
  local elementparam2 = CommonFun.CalcElementParam2(srcUser, targetUser, params, damageParam, logger)
  local bossparam2    = CommonFun.CalcBossParam2(srcUser, targetUser, params, damageParam, logger)

  local BaseAtk  = Dex*2 + math.floor(Dex*Dex/100) + math.floor(Str/5) + math.floor(Luk/5)
  local AtkFinal = (Atk*(1+AtkPer)*elementparam*elementparam2+BaseAtk)*raceparam*bossparam
  ----------------------------物理防御减免
  local DefReduc= CommonFun.CalcDef(Def,Vit,srcUser,targetUser)

  local A = ((AtkFinal*DefReduc*(1-DamReduc2)+Refine)*damChangePer*(1+DamIncrease-LongRangeDamReduc2) + damChangePer1)*(1-RefineDamReduc)-Vit2*(1+VitPer2)

  if 1 >= A then
      return 1
  end
 ---------------------------------------------------------------------------------------------------------------------装备或卡片上有二连矢加伤百分比的效果
  if bits[CommonFun.AttrEffect.ErLianDam]==1 then
     return A*1.5
  end

     return A
end



------------------------------------------------------------------------------------------------------------------远程物理伤害计算公式(已改)
function CommonFun.calcDamage_8004(srcUser, targetUser, params, damageParam, logger)
  local Str = srcUser:GetProperty("Str")
  local Dex = srcUser:GetProperty("Dex")
  local Luk = srcUser:GetProperty("Luk")
  local Atk = srcUser:GetProperty("Atk")
  local AtkPer = srcUser:GetProperty("AtkPer")
  local DamIncrease = srcUser:GetProperty("DamIncrease")
  local IgnoreDef  = 0
  local IgnoreDef1 = srcUser:GetProperty("IgnoreDef")
  local IgnoreDef2 = srcUser:GetProperty("IgnoreEquipDef")
  if targetUser.boss or targetUser.mini then
     IgnoreDef=IgnoreDef1
  else
     IgnoreDef=(IgnoreDef1+IgnoreDef2)
  end

  if IgnoreDef >= 1 then
     IgnoreDef=1
  end
   ------------------------------------------------------------------------------------将原来的物伤加成改成精炼物理攻击
  local Refine = srcUser:GetProperty("Refine")

  local AttrEffect = targetUser:GetProperty("AttrEffect")
  local bits=CommonFun.getBits(AttrEffect)

  local Def2 = targetUser:GetProperty("Def")
  local DefPer2 = targetUser:GetProperty("DefPer")
  local Vit2 = targetUser:GetProperty("Vit")
  local VitPer2 = targetUser:GetProperty("VitPer")
  local DamReduc2 = CommonFun.calcDamReDuc(srcUser, targetUser)
  local LongRangeDamReduc2 = targetUser:GetProperty("LongRangeDamReduc")
  local RefineDamReduc = targetUser:GetProperty("RefineDamReduc")

  local damChangePer = damageParam.damChangePer

  ----------------------------------------------------------------------------------------------------------------种族，体型，属性，BOSS加伤效果
  local raceparam     = CommonFun.CalcRaceParam(srcUser, targetUser, params, damageParam, logger)
  local bodyparam     = CommonFun.CalcBodyParam(srcUser, targetUser, params, damageParam, logger)
  local elementparam  = CommonFun.CalcElementParam(srcUser, targetUser, params, damageParam, logger)
  local bossparam     = CommonFun.CalcBossParam(srcUser, targetUser, params, damageParam, logger)

  ----------------------------------------------------------------------------------------------------------------种族，体型，属性，BOSS减伤效果
  local raceparam2    = CommonFun.CalcRaceParam2(srcUser, targetUser, params, damageParam, logger)
  local bodyparam2    = CommonFun.CalcBodyParam2(srcUser, targetUser, params, damageParam, logger)
  local elementparam2 = CommonFun.CalcElementParam2(srcUser, targetUser, params, damageParam, logger)
  local bossparam2    = CommonFun.CalcBossParam2(srcUser, targetUser, params, damageParam, logger)


  local BaseAtk  = Dex*2 + math.floor(Dex*Dex/100) + math.floor(Str/5) + math.floor(Luk/5)
  local AtkFinal = (Atk*(1+AtkPer)*elementparam*elementparam2+BaseAtk)*raceparam*bossparam*bossparam2

  ----------------------------物理防御减免
  local DefReduc= CommonFun.CalcDef(Def,Vit,srcUser,targetUser)


  local A = (AtkFinal*DefReduc*(1-DamReduc2)+Refine)*damChangePer*(1+DamIncrease-LongRangeDamReduc2)*(1-RefineDamReduc)-Vit2*(1+VitPer2)

   if 1 >= A then
         return 1
   end

   if bits[CommonFun.AttrEffect.NormalSkillDam]==1 then
      return A*1.3
   end

   return A

end


------------------------------------------------------------------------------------------------------------------伤害返回数值为0但是播放命中特效的计算公式(已改)
function CommonFun.calcDamage_8005(srcUser, targetUser, params, damageParam, logger)
  local Str = srcUser:GetProperty("Str")
  local Dex = srcUser:GetProperty("Dex")
  local Luk = srcUser:GetProperty("Luk")
  local Atk = srcUser:GetProperty("Atk")
  local AtkPer = srcUser:GetProperty("AtkPer")
  local DamIncrease = srcUser:GetProperty("DamIncrease")
  local IgnoreDef  = 0
  local IgnoreDef1 = srcUser:GetProperty("IgnoreDef")
  local IgnoreDef2 = srcUser:GetProperty("IgnoreEquipDef")
  if targetUser.boss or targetUser.mini then
     IgnoreDef=IgnoreDef1
  else
     IgnoreDef=(IgnoreDef1+IgnoreDef2)
  end

  if IgnoreDef >= 1 then
     IgnoreDef=1
  end
   ------------------------------------------------------------------------------------将原来的物伤加成改成精炼物理攻击
  local Refine = srcUser:GetProperty("Refine")

  local AttrEffect = targetUser:GetProperty("AttrEffect")
  local bits=CommonFun.getBits(AttrEffect)

  local Def2 = targetUser:GetProperty("Def")
  local DefPer2 = targetUser:GetProperty("DefPer")
  local Vit2 = targetUser:GetProperty("Vit")
  local VitPer2 = targetUser:GetProperty("VitPer")
  local DamReduc2 = CommonFun.calcDamReDuc(srcUser, targetUser)
  local LongRangeDamReduc2 = targetUser:GetProperty("LongRangeDamReduc")
  local RefineDamReduc = targetUser:GetProperty("RefineDamReduc")

  local damChangePer  = damageParam.damChangePer
  local damChangePer1 = damageParam.damChangePer1

  ----------------------------------------------------------------------------------------------------------------种族，体型，属性，BOSS加伤效果
  local raceparam     = CommonFun.CalcRaceParam(srcUser, targetUser, params, damageParam, logger)
  local bodyparam     = CommonFun.CalcBodyParam(srcUser, targetUser, params, damageParam, logger)
  local elementparam  = CommonFun.CalcElementParam(srcUser, targetUser, params, damageParam, logger)
  local bossparam     = CommonFun.CalcBossParam(srcUser, targetUser, params, damageParam, logger)

  ----------------------------------------------------------------------------------------------------------------种族，体型，属性，BOSS减伤效果
  local raceparam2    = CommonFun.CalcRaceParam2(srcUser, targetUser, params, damageParam, logger)
  local bodyparam2    = CommonFun.CalcBodyParam2(srcUser, targetUser, params, damageParam, logger)
  local elementparam2 = CommonFun.CalcElementParam2(srcUser, targetUser, params, damageParam, logger)
  local bossparam2    = CommonFun.CalcBossParam2(srcUser, targetUser, params, damageParam, logger)


  local BaseAtk  = Dex*2 + math.floor(Dex*Dex/100) + math.floor(Str/5) + math.floor(Luk/5)
  local AtkFinal = (Atk*(1+AtkPer)*elementparam*elementparam2+BaseAtk)*raceparam*bossparam*bossparam2

  ----------------------------物理防御减免
  local DefReduc= CommonFun.CalcDef(Def,Vit,srcUser,targetUser)

   local A = ((AtkFinal*DefReduc*(1-DamReduc2)+Refine)*damChangePer*(1+DamIncrease) + damChangePer1)*(1-RefineDamReduc)-Vit2*(1+VitPer2)

   return A,CommonFun.DamageType.Normal

end
--------------------------------------------------------------------------------------------------------------------------魔焰伤害计算公式(已改)
function CommonFun.calcDamage_8006(srcUser, targetUser, params, damageParam, logger)
  local Luk = srcUser:GetProperty("Luk")
  local Int = srcUser:GetProperty("Int")
  local Vit = srcUser:GetProperty("Vit")
  local MAtk = srcUser:GetProperty("MAtk")
  local MAtkPer = srcUser:GetProperty("MAtkPer")

  -----------------------------------------------------------------------------------分割线
  local MDamIncrease = CommonFun.calcMDamIncrease(srcUser, targetUser)
  local IgnoreMDef = srcUser:GetProperty("IgnoreMDef")
  if IgnoreMDef >= 1 then
     IgnoreMDef  = 1
  end

  ------------------------------------------------------------------------------------将原来的物伤加成改成精炼物理攻击
  local MRefine = srcUser:GetProperty("MRefine")

  local srcAtkElement    = CommonFun.GetUserAtkAttr(srcUser, params, damageParam)
  local targetDefElement = targetUser:GetProperty("DefAttr")
  ----------------------------------------------------------------------------------------------------------------种族，体型，属性，BOSS减伤效果
  local elementparam2 = CommonFun.CalcElementParam2(srcUser, targetUser, params, damageParam, logger)

  ----------------------------------------------------------------------------------------------------------------法系职业伤害会受到种族加伤减伤影响
  local raceparam     = CommonFun.CalcRaceParam(srcUser, targetUser, params, damageParam, logger)
  local raceparam2    = CommonFun.CalcRaceParam2(srcUser, targetUser, params, damageParam, logger)
  local bossparam     = CommonFun.CalcBossParam(srcUser, targetUser, params, damageParam, logger)
  local bossparam2    = CommonFun.CalcBossParam2(srcUser, targetUser, params, damageParam, logger)

  local MDef2 = targetUser:GetProperty("MDef")
  local MDefPer2 = targetUser:GetProperty("MDefPer")
  local Vit2 = targetUser:GetProperty("Vit")
  local VitPer2 = targetUser:GetProperty("VitPer")
  local Int2 = targetUser:GetProperty("Int")
  local IntPer2 = targetUser:GetProperty("IntPer")
  local MDamReduc2 = CommonFun.calcMDamReDuc(srcUser, targetUser)
  local RefineMDamReduc = targetUser:GetProperty("RefineMDamReduc")

  local damChangePer = damageParam.damChangePer

  local BaseMAtk = Int+math.floor(Int*Int/100)
  local MAtkFinal= ((MAtk-BaseMAtk)*(1+MAtkPer)+BaseMAtk)*raceparam*bossparam*bossparam2
  ----------------------------魔法防御减免
  local MDefReduc = CommonFun.CalcMDef(MDef,Int,Vit,srcUser,targetUser)

  local A = ((MAtkFinal*MDefReduc*(1-MDamReduc2)+MRefine)*damChangePer*(1-RefineMDamReduc)*(1+MDamIncrease)*GameConfig.ElementRestrain[srcAtkElement][targetDefElement]*elementparam2-Vit2/2*(1+VitPer2)-Int2*(1+IntPer2))
  local skilllv_1 = srcUser:GetLernedSkillLevel(103140)
  local Rate = skilllv_1*5+30
  -- --------------燃烧吧 火焰伤害增加
  if CommonFun.IsInRate(Rate, srcUser:GetRandom()) then
      return A*1.5
  end

  if 1 >= A then
    return 1
  end

  return A

end
-- ---------------------------------------------------------------------------------------------------能量之拳  计算公式(已改)
function CommonFun.calcDamage_8007(srcUser, targetUser, params, damageParam, logger)

   local A = 111111
   return A,CommonFun.DamageType.Normal

end
-- ---------------------------------------------------------------------------------------------------游侠 任务怪  计算公式(已改)
function CommonFun.calcDamage_8008(srcUser, targetUser, params, damageParam, logger)
   local MaxHp = targetUser:GetProperty("MaxHp")
   local A = MaxHp*0.25

   return A,CommonFun.DamageType.Normal

end
------------------------------------------------------------------------------------------------------奥特曼普通攻击计算公式(已改)
function CommonFun.calcDamage_8020(srcUser, targetUser, params, damageParam, logger)
  local Str = srcUser:GetProperty("Str")
  local Dex = srcUser:GetProperty("Dex")
  local Luk = srcUser:GetProperty("Luk")
  local Atk = srcUser:GetProperty("Atk")
  local AtkPer = srcUser:GetProperty("AtkPer")
  local DamIncrease = srcUser:GetProperty("DamIncrease")
  local IgnoreDef  = 0
  local IgnoreDef1 = srcUser:GetProperty("IgnoreDef")
  local IgnoreDef2 = srcUser:GetProperty("IgnoreEquipDef")
  if targetUser.boss or targetUser.mini then
     IgnoreDef=IgnoreDef1
  else
     IgnoreDef=(IgnoreDef1+IgnoreDef2)
  end

  if IgnoreDef >= 1 then
     IgnoreDef  = 1
  end

  local BaseLv = targetUser.BaseLv
  local WeaponType =srcUser:GetEquipedWeaponType()
  local skilllv_1 = srcUser:GetLernedSkillLevel(damageParam.skill1_id)
  ------------------------------------------------------------------------------------将原来的物伤加成改成精炼物理攻击
  local Refine = srcUser:GetProperty("Refine")

  local damChangePer  = damageParam.damChangePer

  local Def2 = targetUser:GetProperty("Def")
  local DefPer2 = targetUser:GetProperty("DefPer")
  local Vit2 = targetUser:GetProperty("Vit")
  local VitPer2 = targetUser:GetProperty("VitPer")
  local DamReduc2 = CommonFun.calcDamReDuc(srcUser, targetUser)
  local RefineDamReduc = targetUser:GetProperty("RefineDamReduc")

  local AttrEffect2 = srcUser:GetProperty("AttrEffect")
  local bits2=CommonFun.getBits(AttrEffect2)


  local AtkFinal = math.floor(BaseLv,BaseLv*3)*damChangePer

  ----------------------------物理防御减免
  local DefReduc= CommonFun.CalcDef(Def,Vit,srcUser,targetUser)

  local A = (AtkFinal*DefReduc*(1-DamReduc2)+Refine)*(1+DamIncrease)*(1-RefineDamReduc)-Vit2*(1+VitPer2)


   if 1 >= A then
         return 1
   end

  return A

end
-- ----------------------------------------------------------------------------------------------------奥特曼随机伤害公式
function CommonFun.calcDamage_8021(srcUser, targetUser, params, damageParam, logger)
  local Str = srcUser:GetProperty("Str")
  local Dex = srcUser:GetProperty("Dex")
  local Luk = srcUser:GetProperty("Luk")
  local Atk = srcUser:GetProperty("Atk")
  local AtkPer = srcUser:GetProperty("AtkPer")
  local DamIncrease = srcUser:GetProperty("DamIncrease")
  local IgnoreDef  = 0
  local IgnoreDef1 = srcUser:GetProperty("IgnoreDef")
  local IgnoreDef2 = srcUser:GetProperty("IgnoreEquipDef")
  if targetUser.boss or targetUser.mini then
     IgnoreDef=IgnoreDef1
  else
     IgnoreDef=(IgnoreDef1+IgnoreDef2)
  end

  if IgnoreDef >= 1 then
     IgnoreDef  = 1
  end

  local BaseLv = targetUser.BaseLv
  local WeaponType =srcUser:GetEquipedWeaponType()
  local skilllv_1 = srcUser:GetLernedSkillLevel(damageParam.skill1_id)
  ------------------------------------------------------------------------------------将原来的物伤加成改成精炼物理攻击
  local Refine = srcUser:GetProperty("Refine")

  local damChangePer   = damageParam.damChangePer
  local damChangePer1  = damageParam.damChangePer1

  local Def2 = targetUser:GetProperty("Def")
  local DefPer2 = targetUser:GetProperty("DefPer")
  local Vit2 = targetUser:GetProperty("Vit")
  local VitPer2 = targetUser:GetProperty("VitPer")
  local DamReduc2 = CommonFun.calcDamReDuc(srcUser, targetUser)
  local RefineDamReduc = targetUser:GetProperty("RefineDamReduc")

  local AttrEffect2 = srcUser:GetProperty("AttrEffect")
  local bits2=CommonFun.getBits(AttrEffect2)


  local AtkFinal = math.random(BaseLv*10,BaseLv*16)*damChangePer + math.random(500,1500)*damChangePer1

  ----------------------------物理防御减免
  local DefReduc= CommonFun.CalcDef(Def,Vit,srcUser,targetUser)
  local skillID, skillLevel = CommonFun.UnmergeSkillID(params.skillIDAndLevel)

  if targetUser:GetNpcID() ~= 56008 and targetUser:GetNpcID() ~= 56009 and skillID == 40032 then
     AtkFinal=0
  end
  if targetUser:GetNpcID() ~= 56010 and targetUser:GetNpcID() ~= 56011 and skillID == 40034 then
     AtkFinal=0
  end
  if targetUser:GetNpcID() ~= 56012 and targetUser:GetNpcID() ~= 56013 and skillID == 40036 then
     AtkFinal=0
  end
  local A = AtkFinal


   if 1 >= A then
         return 1
   end

  return A

end
-- ----------------------------------------------------------------------------------------------------海之吐息伤害公式
function CommonFun.calcDamage_8030(srcUser, targetUser, params, damageParam, logger)
  local Int = srcUser:GetProperty("Int")
  local Vit = srcUser:GetProperty("Vit")
  local MAtk = srcUser:GetProperty("MAtk")
  local MAtkPer = srcUser:GetProperty("MAtkPer")
  local MDamIncrease = CommonFun.calcMDamIncrease(srcUser, targetUser)
  local IgnoreMDef = srcUser:GetProperty("IgnoreMDef")
  if IgnoreMDef >= 1 then
     IgnoreMDef  = 1
  end
  ------------------------------------------------------------------------------------将原来的物伤加成改成精炼物理攻击
  local MRefine  = srcUser:GetProperty("MRefine")
  local RangeDam = srcUser:GetProperty("RangeDam")

  local srcAtkElement    = CommonFun.GetUserAtkAttr(srcUser, params, damageParam)
  local targetDefElement = targetUser:GetProperty("DefAttr")
  ----------------------------------------------------------------------------------------------------------------种族，体型，属性，BOSS减伤效果
  local elementparam2 = CommonFun.CalcElementParam2(srcUser, targetUser, params, damageParam, logger)

  ----------------------------------------------------------------------------------------------------------------法系职业伤害会受到种族加伤减伤影响
  local raceparam     = CommonFun.CalcRaceParam(srcUser, targetUser, params, damageParam, logger)
  local raceparam2    = CommonFun.CalcRaceParam2(srcUser, targetUser, params, damageParam, logger)
  local bossparam     = CommonFun.CalcBossParam(srcUser, targetUser, params, damageParam, logger)
  local bossparam2    = CommonFun.CalcBossParam2(srcUser, targetUser, params, damageParam, logger)

  local MDef2 = targetUser:GetProperty("MDef")
  local MDefPer2 = targetUser:GetProperty("MDefPer")
  local Vit2 = targetUser:GetProperty("Vit")
  local VitPer2 = targetUser:GetProperty("VitPer")
  local Int2 = targetUser:GetProperty("Int")
  local IntPer2 = targetUser:GetProperty("IntPer")
  local MDamReduc2 = CommonFun.calcMDamReDuc(srcUser, targetUser)
  local RefineMDamReduc = targetUser:GetProperty("RefineMDamReduc")

  local damChangePer = damageParam.damChangePer

  local BaseMAtk = Int+math.floor(Int*Int/100)
  local MAtkFinal= ((MAtk-BaseMAtk)*(1+MAtkPer)+BaseMAtk)*raceparam*bossparam*bossparam2

  ----------------------------魔法防御减免
  local MDefReduc = CommonFun.CalcMDef(MDef,Int,Vit,srcUser,targetUser)
  local MaxHp = srcUser:GetProperty("MaxHp")
  local Hp = srcUser:GetProperty("Hp")
  local HpPerRatio=1
  local skillID, skillLevel = CommonFun.UnmergeSkillID(params.skillIDAndLevel)

  local count=params.hitedCount
  local CountDam = 1/(count^0.6)

  local A = ((MAtkFinal*MDefReduc*(1-MDamReduc2)+MRefine)*damChangePer*(1-RefineMDamReduc)*(1+MDamIncrease)*GameConfig.ElementRestrain[srcAtkElement][targetDefElement]*elementparam2-Vit2/2*(1+VitPer2)-Int2*(1+IntPer2))*CountDam




   if 1 >= A then
         return 1
   end

  return A

end
-----------------------------------------------------------------------------------------------------------------mvp崩裂术技能魔法伤害计算公式(已改)
function CommonFun.calcDamage_8031(srcUser, targetUser, params, damageParam, logger)
  local Int = srcUser:GetProperty("Int")
  local Vit = srcUser:GetProperty("Vit")
  local MAtk = srcUser:GetProperty("MAtk")
  local MAtkPer = srcUser:GetProperty("MAtkPer")
  local MDamIncrease = CommonFun.calcMDamIncrease(srcUser, targetUser)
  local IgnoreMDef = srcUser:GetProperty("IgnoreMDef")
  if IgnoreMDef >= 1 then
     IgnoreMDef  = 1
  end
  ------------------------------------------------------------------------------------将原来的物伤加成改成精炼物理攻击
  local MRefine  = srcUser:GetProperty("MRefine")
  local RangeDam = srcUser:GetProperty("RangeDam")

  local srcAtkElement    = CommonFun.GetUserAtkAttr(srcUser, params, damageParam)
  local targetDefElement = targetUser:GetProperty("DefAttr")
  ----------------------------------------------------------------------------------------------------------------种族，体型，属性，BOSS减伤效果
  local elementparam2 = CommonFun.CalcElementParam2(srcUser, targetUser, params, damageParam, logger)

  ----------------------------------------------------------------------------------------------------------------法系职业伤害会受到种族加伤减伤影响
  local raceparam     = CommonFun.CalcRaceParam(srcUser, targetUser, params, damageParam, logger)
  local raceparam2    = CommonFun.CalcRaceParam2(srcUser, targetUser, params, damageParam, logger)
  local bossparam     = CommonFun.CalcBossParam(srcUser, targetUser, params, damageParam, logger)
  local bossparam2    = CommonFun.CalcBossParam2(srcUser, targetUser, params, damageParam, logger)

  local MDef2 = targetUser:GetProperty("MDef")
  local MDefPer2 = targetUser:GetProperty("MDefPer")
  local Vit2 = targetUser:GetProperty("Vit")
  local VitPer2 = targetUser:GetProperty("VitPer")
  local Int2 = targetUser:GetProperty("Int")
  local IntPer2 = targetUser:GetProperty("IntPer")
  local MDamReduc2 = CommonFun.calcMDamReDuc(srcUser, targetUser)
  local RefineMDamReduc = targetUser:GetProperty("RefineMDamReduc")

  local damChangePer = damageParam.damChangePer

  local BaseMAtk = Int+math.floor(Int*Int/100)
  local MAtkFinal= ((MAtk-BaseMAtk)*(1+MAtkPer)+BaseMAtk)*raceparam*bossparam*bossparam2

  ----------------------------魔法防御减免
  local MDefReduc = CommonFun.CalcMDef(MDef,Int,Vit,srcUser,targetUser)
  local MaxHp = srcUser:GetProperty("MaxHp")
  local Hp = srcUser:GetProperty("Hp")
  local HpPerRatio=1
  local skillID, skillLevel = CommonFun.UnmergeSkillID(params.skillIDAndLevel)
  ----------------------------------------------------------暴风雪
  if skillID==71850 then
         if Hp<0.8*MaxHp then
            HpPerRatio=2
         end
  end
  if skillID==71860 then
         if Hp<0.5*MaxHp then
            HpPerRatio=2
         end
  end

  local A = ((MAtkFinal*MDefReduc*(1-MDamReduc2)+MRefine)*(1-RefineMDamReduc)*damChangePer*(1+MDamIncrease)*GameConfig.ElementRestrain[srcAtkElement][targetDefElement]*elementparam2-Vit2/2*(1+VitPer2)-Int2*(1+IntPer2))*(1 + RangeDam)*HpPerRatio


  if 1 >= A then
    return 1
  end

     return A

end

-- ----------------------------------------------------------------------------------------------------毁灭打击伤害公式
function CommonFun.calcDamage_8032(srcUser, targetUser, params, damageParam, logger)
  local Str = srcUser:GetProperty("Str")
  local Dex = srcUser:GetProperty("Dex")
  local Luk = srcUser:GetProperty("Luk")
  local Atk = srcUser:GetProperty("Atk")
  local AtkPer = srcUser:GetProperty("AtkPer")
  local DamIncrease = srcUser:GetProperty("DamIncrease")
  local IgnoreDef  = 0
  local IgnoreDef1 = srcUser:GetProperty("IgnoreDef")
  local IgnoreDef2 = srcUser:GetProperty("IgnoreEquipDef")
  if targetUser.boss or targetUser.mini then
     IgnoreDef=IgnoreDef1
  else
     IgnoreDef=(IgnoreDef1+IgnoreDef2)
  end

  if IgnoreDef >= 1 then
     IgnoreDef=1
  end
   ------------------------------------------------------------------------------------将原来的物伤加成改成精炼物理攻击
  local Refine = srcUser:GetProperty("Refine")

  local AttrEffect = targetUser:GetProperty("AttrEffect")
  local bits=CommonFun.getBits(AttrEffect)

  local Def2 = targetUser:GetProperty("Def")
  local DefPer2 = targetUser:GetProperty("DefPer")
  local Vit2 = targetUser:GetProperty("Vit")
  local VitPer2 = targetUser:GetProperty("VitPer")
  local DamReduc2 = CommonFun.calcDamReDuc(srcUser, targetUser)
  local LongRangeDamReduc2 = targetUser:GetProperty("LongRangeDamReduc")
  local RefineDamReduc = targetUser:GetProperty("RefineDamReduc")

  local damChangePer = damageParam.damChangePer

  ----------------------------------------------------------------------------------------------------------------种族，体型，属性，BOSS加伤效果
  local raceparam     = CommonFun.CalcRaceParam(srcUser, targetUser, params, damageParam, logger)
  local bodyparam     = CommonFun.CalcBodyParam(srcUser, targetUser, params, damageParam, logger)
  local elementparam  = CommonFun.CalcElementParam(srcUser, targetUser, params, damageParam, logger)
  local bossparam     = CommonFun.CalcBossParam(srcUser, targetUser, params, damageParam, logger)

  ----------------------------------------------------------------------------------------------------------------种族，体型，属性，BOSS减伤效果
  local raceparam2    = CommonFun.CalcRaceParam2(srcUser, targetUser, params, damageParam, logger)
  local bodyparam2    = CommonFun.CalcBodyParam2(srcUser, targetUser, params, damageParam, logger)
  local elementparam2 = CommonFun.CalcElementParam2(srcUser, targetUser, params, damageParam, logger)
  local bossparam2    = CommonFun.CalcBossParam2(srcUser, targetUser, params, damageParam, logger)


  local BaseAtk  = Dex*2 + math.floor(Dex*Dex/100) + math.floor(Str/5) + math.floor(Luk/5)
  local AtkFinal = (Atk*(1+AtkPer)*elementparam*elementparam2+BaseAtk)*raceparam*bossparam*bossparam2

  ----------------------------物理防御减免
  local DefReduc= CommonFun.CalcDef(Def,Vit,srcUser,targetUser)
  local count=params.hitedCount
  local CountDam = math.max(1-0.08*count,0.2)

  local A = ((AtkFinal*DefReduc*(1-DamReduc2)+Refine)*(1+DamIncrease)*(1-RefineDamReduc)-Vit2*(1+VitPer2))*CountDam


   if 1 >= A then
         return 1
   end

  return A

end


--------------------------------------------------------------------------------------------------------------------------贤者  精神损耗术 魔法伤害计算公式(已改)
function CommonFun.calcDamage_8201(srcUser, targetUser, params, damageParam, logger)
  local Luk = srcUser:GetProperty("Luk")
  local Int = srcUser:GetProperty("Int")
  local Vit = srcUser:GetProperty("Vit")
  local MAtk = srcUser:GetProperty("MAtk")
  local MAtkPer = srcUser:GetProperty("MAtkPer")

  -----------------------------------------------------------------------------------分割线
  local MDamIncrease = CommonFun.calcMDamIncrease(srcUser, targetUser)
  local IgnoreMDef = srcUser:GetProperty("IgnoreMDef")
  if IgnoreMDef >= 1 then
     IgnoreMDef  = 1
  end

  ------------------------------------------------------------------------------------将原来的物伤加成改成精炼物理攻击
  local MRefine = srcUser:GetProperty("MRefine")

  local srcAtkElement    = CommonFun.GetUserAtkAttr(srcUser, params, damageParam)
  local targetDefElement = targetUser:GetProperty("DefAttr")
  ----------------------------------------------------------------------------------------------------------------种族，体型，属性，BOSS减伤效果
  local elementparam2 = CommonFun.CalcElementParam2(srcUser, targetUser, params, damageParam, logger)

  ----------------------------------------------------------------------------------------------------------------法系职业伤害会受到种族加伤减伤影响
  local raceparam     = CommonFun.CalcRaceParam(srcUser, targetUser, params, damageParam, logger)
  local raceparam2    = CommonFun.CalcRaceParam2(srcUser, targetUser, params, damageParam, logger)
  local bossparam     = CommonFun.CalcBossParam(srcUser, targetUser, params, damageParam, logger)
  local bossparam2    = CommonFun.CalcBossParam2(srcUser, targetUser, params, damageParam, logger)

  local MDef2 = targetUser:GetProperty("MDef")
  local MDefPer2 = targetUser:GetProperty("MDefPer")
  local Vit2 = targetUser:GetProperty("Vit")
  local VitPer2 = targetUser:GetProperty("VitPer")
  local Int2 = targetUser:GetProperty("Int")
  local IntPer2 = targetUser:GetProperty("IntPer")
  local MDamReduc2 = CommonFun.calcMDamReDuc(srcUser, targetUser)
  local RefineMDamReduc = targetUser:GetProperty("RefineMDamReduc")

  local damChangePer = damageParam.damChangePer

  local BaseMAtk = Int+math.floor(Int*Int/100)
  -----------------------------------------------------损耗术
  local Sp = targetUser:GetProperty("Sp")

  local MAtkFinal= ((MAtk-BaseMAtk)*(1+MAtkPer)+BaseMAtk+Sp)*raceparam*bossparam*bossparam2
  ----------------------------魔法防御减免
  local MDefReduc = CommonFun.CalcMDef(MDef,Int,Vit,srcUser,targetUser)
  ------------------------------------------星盘
  local Num_js = srcUser:GetRunePoint(82020)
  local RuneDamage = 1 + Num_js*0.1
  ------------------------------------------精神手杖
  local RefineLv=srcUser:GetEquipedRefineLv(7)
  local JSSZ = 1
   if RefineLv == 15 and srcUser:HasBuffID(90002133) then
        JSSZ = 1.15
   end

  local A = ((MAtkFinal*MDefReduc*(1-MDamReduc2)+MRefine)*damChangePer*(1-RefineMDamReduc)*(1+MDamIncrease)*GameConfig.ElementRestrain[srcAtkElement][targetDefElement]*elementparam2-Vit2/2*(1+VitPer2)-Int2*(1+IntPer2))*RuneDamage*JSSZ

  if 1 >= A then
    return 1
  end

  return A

end
--------------------------------------------------------------------------------------------------------------------------贤者 范围技能魔法伤害计算公式(已改)
function CommonFun.calcDamage_8202(srcUser, targetUser, params, damageParam, logger)
  local Int = srcUser:GetProperty("Int")
  local Vit = srcUser:GetProperty("Vit")
  local MAtk = srcUser:GetProperty("MAtk")
  local MAtkPer = srcUser:GetProperty("MAtkPer")
  local MDamIncrease = CommonFun.calcMDamIncrease(srcUser, targetUser)
  local IgnoreMDef = srcUser:GetProperty("IgnoreMDef")
  if IgnoreMDef >= 1 then
     IgnoreMDef  = 1
  end
  ------------------------------------------------------------------------------------将原来的物伤加成改成精炼物理攻击
  local MRefine  = srcUser:GetProperty("MRefine")
  local RangeDam = srcUser:GetProperty("RangeDam")

  local srcAtkElement    = CommonFun.GetUserAtkAttr(srcUser, params, damageParam)
  local targetDefElement = targetUser:GetProperty("DefAttr")
  ----------------------------------------------------------------------------------------------------------------种族，体型，属性，BOSS减伤效果
  local elementparam2 = CommonFun.CalcElementParam2(srcUser, targetUser, params, damageParam, logger)

  ----------------------------------------------------------------------------------------------------------------法系职业伤害会受到种族加伤减伤影响
  local raceparam     = CommonFun.CalcRaceParam(srcUser, targetUser, params, damageParam, logger)
  local raceparam2    = CommonFun.CalcRaceParam2(srcUser, targetUser, params, damageParam, logger)
  local bossparam     = CommonFun.CalcBossParam(srcUser, targetUser, params, damageParam, logger)
  local bossparam2    = CommonFun.CalcBossParam2(srcUser, targetUser, params, damageParam, logger)

  local MDef2 = targetUser:GetProperty("MDef")
  local MDefPer2 = targetUser:GetProperty("MDefPer")
  local Vit2 = targetUser:GetProperty("Vit")
  local VitPer2 = targetUser:GetProperty("VitPer")
  local Int2 = targetUser:GetProperty("Int")
  local IntPer2 = targetUser:GetProperty("IntPer")
  local MDamReduc2 = CommonFun.calcMDamReDuc(srcUser, targetUser)
  local RefineMDamReduc = targetUser:GetProperty("RefineMDamReduc")

  local damChangePer = damageParam.damChangePer

  local BaseMAtk = Int+math.floor(Int*Int/100)
  local MAtkFinal= ((MAtk-BaseMAtk)*(1+MAtkPer)+BaseMAtk)*raceparam*bossparam*bossparam2

  ----------------------------魔法防御减免
  local MDefReduc = CommonFun.CalcMDef(MDef,Int,Vit,srcUser,targetUser)

  local A = ((MAtkFinal*MDefReduc*(1-MDamReduc2)+MRefine)*(1-RefineMDamReduc)*damChangePer*(1+MDamIncrease)*GameConfig.ElementRestrain[srcAtkElement][targetDefElement]*elementparam2-Vit2/2*(1+VitPer2)-Int2*(1+IntPer2))*(1 + RangeDam)

  local skillID, skillLevel = CommonFun.UnmergeSkillID(params.skillIDAndLevel)

   local skilllv_ele = srcUser:GetLernedSkillLevel(1333)-------召唤元素

   local ElementNpc = srcUser:getCurElementElfID()---获取元素生物
  -----------------------------------------------------------------岩枪
  if skillID==1330 then
      if ElementNpc==580030 then
         A = A * (1 + skilllv_ele*0.03)
      end
  end
  -----------------------------------------------------------------钻石星尘
  if skillID==1328 then
      local Num_xc = srcUser:GetRunePoint(82031)

      A = A * (1 + Num_xc*0.08)

      if ElementNpc==580020 then
         A = A * (1 + skilllv_ele*0.01)
      end
  ----------------------------冷澈之魔法书
    local RefineLv=srcUser:GetEquipedRefineLv(7)
    local Ring1=srcUser:GetEquipedID(7)
      if (Ring1==63433 or Ring1==163433) then
     A = A * (RefineLv * 0.02 + 1)
    end
  end
  -----------------------------------------------------------------地震术
  if skillID==1305 then
      local Num_dz = srcUser:GetRunePoint(82002)
      A = A*(1 + Num_dz*0.1)
  end
  ----------------------------------------------------------------精神冲击
  if skillID==1331 then
      local Num_js = srcUser:GetRunePoint(82033)
      A = A * (1 + Num_js*0.08)
  end

  if 1 >= A then
    return 1
  end

     return A

end
--------------------------------------------------------------------------------------------------------------------------贤者 闪电之枪 技能魔法伤害计算公式(已改)
function CommonFun.calcDamage_8203(srcUser, targetUser, params, damageParam, logger)
  local Int = srcUser:GetProperty("Int")
  local Vit = srcUser:GetProperty("Vit")
  local MAtk = srcUser:GetProperty("MAtk")
  local MAtkPer = srcUser:GetProperty("MAtkPer")
  local MDamIncrease = CommonFun.calcMDamIncrease(srcUser, targetUser)
  local IgnoreMDef = srcUser:GetProperty("IgnoreMDef")
  if IgnoreMDef >= 1 then
     IgnoreMDef  = 1
  end
  ------------------------------------------------------------------------------------将原来的物伤加成改成精炼物理攻击
  local MRefine  = srcUser:GetProperty("MRefine")
  local RangeDam = srcUser:GetProperty("RangeDam")

  local srcAtkElement    = CommonFun.GetUserAtkAttr(srcUser, params, damageParam)
  local targetDefElement = targetUser:GetProperty("DefAttr")
  ----------------------------------------------------------------------------------------------------------------种族，体型，属性，BOSS减伤效果
  local elementparam2 = CommonFun.CalcElementParam2(srcUser, targetUser, params, damageParam, logger)

  ----------------------------------------------------------------------------------------------------------------法系职业伤害会受到种族加伤减伤影响
  local raceparam     = CommonFun.CalcRaceParam(srcUser, targetUser, params, damageParam, logger)
  local raceparam2    = CommonFun.CalcRaceParam2(srcUser, targetUser, params, damageParam, logger)
  local bossparam     = CommonFun.CalcBossParam(srcUser, targetUser, params, damageParam, logger)
  local bossparam2    = CommonFun.CalcBossParam2(srcUser, targetUser, params, damageParam, logger)

  local MDef2 = targetUser:GetProperty("MDef")
  local MDefPer2 = targetUser:GetProperty("MDefPer")
  local Vit2 = targetUser:GetProperty("Vit")
  local VitPer2 = targetUser:GetProperty("VitPer")
  local Int2 = targetUser:GetProperty("Int")
  local IntPer2 = targetUser:GetProperty("IntPer")
  local MDamReduc2 = CommonFun.calcMDamReDuc(srcUser, targetUser)
  local RefineMDamReduc = targetUser:GetProperty("RefineMDamReduc")

  local damChangePer = damageParam.damChangePer

  local BaseMAtk = Int+math.floor(Int*Int/100)
  local MAtkFinal= ((MAtk-BaseMAtk)*(1+MAtkPer)+BaseMAtk)*raceparam*bossparam*bossparam2

  ----------------------------魔法防御减免
  local MDefReduc = CommonFun.CalcMDef(MDef,Int,Vit,srcUser,targetUser)
  ------------------------------------------------------------------------星盘
  local Num_shand = srcUser:GetRunePoint(82028)
  local RuneDamage = 1 + Num_shand*0.08
  --------------------------------------------------------------------------------------魔法伤害
  local A = ((MAtkFinal*MDefReduc*(1-MDamReduc2)+MRefine)*(1-RefineMDamReduc)*damChangePer*(1+MDamIncrease)*GameConfig.ElementRestrain[srcAtkElement][targetDefElement]*elementparam2-Vit2/2*(1+VitPer2)-Int2*(1+IntPer2))*RuneDamage

  local Def2 = targetUser:GetProperty("Def")
  local DefPer2 = targetUser:GetProperty("DefPer")

  local DamReduc2 = CommonFun.calcDamReDuc(srcUser, targetUser)
  local RefineDamReduc = targetUser:GetProperty("RefineDamReduc")
  ----------------------------物理防御减免
  local DefReduc= CommonFun.CalcDef(Def,Vit,srcUser,targetUser)
  --------------------------------------------------------------------------------------物理伤害
  local B = ((MAtkFinal*DefReduc*(1-DamReduc2)+MRefine)*(1-RefineDamReduc)*damChangePer*(1+MDamIncrease)*GameConfig.ElementRestrain[srcAtkElement][targetDefElement]*elementparam2-Vit2/2*(1+VitPer2)-Int2*(1+IntPer2))


  local skilllv_ele = srcUser:GetLernedSkillLevel(1333)-------召唤元素

  local ElementNpc = srcUser:getCurElementElfID()---获取元素生物
  local elementRatio = 1

      if ElementNpc==580040 then
         elementRatio = 1 + skilllv_ele*0.01
      end
  -------------------------------------------------------------------------------------------------------------------星盘闪电压制
  local StateEffect = targetUser:GetProperty("StateEffect")
  local bits2=CommonFun.getBits(StateEffect)
  local Num_yaz = srcUser:GetRunePoint(82029)
  local RuneDamage2= 1

  if bits2[CommonFun.StateEffect.Freeze] ==1 then
        RuneDamage2=1 + Num_yaz*0.2
  end

  local C = (A + B)*elementRatio*RuneDamage2

  if 1 >= C then
    return 1
  end

     return C

end
--------------------------------------------------------------------------------------------------------------------------贤者  元素生物  普攻技能 魔法伤害计算公式(已改)
function CommonFun.calcDamage_8204(srcUser, targetUser, params, damageParam, logger)

  local Master = srcUser:GetMasterUser()
  if Master==nil then
      return 0
  end

  local Int = Master:GetProperty("Int")
  local MAtk = Master:GetProperty("MAtk")
  local MAtkPer = Master:GetProperty("MAtkPer")
  -----------------------------------------------------------------------------------分割线
  local MDamIncrease = CommonFun.calcMDamIncrease(srcUser, targetUser)
  local IgnoreMDef = srcUser:GetProperty("IgnoreMDef")
  if IgnoreMDef >= 1 then
     IgnoreMDef  = 1
  end

  ------------------------------------------------------------------------------------将原来的物伤加成改成精炼物理攻击
  local MRefine = Master:GetProperty("MRefine")

  local srcAtkElement    = CommonFun.GetUserAtkAttr(srcUser, params, damageParam)
  local targetDefElement = targetUser:GetProperty("DefAttr")
  ----------------------------------------------------------------------------------------------------------------种族，体型，属性，BOSS减伤效果
  local elementparam2 = CommonFun.CalcElementParam2(srcUser, targetUser, params, damageParam, logger)

  ----------------------------------------------------------------------------------------------------------------法系职业伤害会受到种族加伤减伤影响
  local raceparam     = CommonFun.CalcRaceParam(srcUser, targetUser, params, damageParam, logger)
  local raceparam2    = CommonFun.CalcRaceParam2(srcUser, targetUser, params, damageParam, logger)
  local bossparam     = CommonFun.CalcBossParam(srcUser, targetUser, params, damageParam, logger)
  local bossparam2    = CommonFun.CalcBossParam2(srcUser, targetUser, params, damageParam, logger)

  local MDef2 = targetUser:GetProperty("MDef")
  local MDefPer2 = targetUser:GetProperty("MDefPer")

  local MDamReduc2 = CommonFun.calcMDamReDuc(srcUser, targetUser)
  local RefineMDamReduc = targetUser:GetProperty("RefineMDamReduc")

  local damChangePer = damageParam.damChangePer

  local BaseMAtk = Int+math.floor(Int*Int/100)

  local MAtkFinal= ((MAtk-BaseMAtk)*(1+MAtkPer)+BaseMAtk)*raceparam*bossparam*bossparam2
  ----------------------------魔法防御减免
  local MDefReduc = CommonFun.CalcMDef(MDef,Int,Vit,srcUser,targetUser)

  local skilllv_ele = Master:GetLernedSkillLevel(1333)-------召唤元素
  local skilllv_ele2 = Master:GetLernedSkillLevel(1334)-------元素交流
  local Final = (1 + 0.05*skilllv_ele)*(1 + 0.1*skilllv_ele2)

  local Num_hp = Master:GetRunePoint(82025)---星盘
  local RuneDamage = 1 + Num_hp*0.1

  local A = (MAtkFinal*MDefReduc*(1-MDamReduc2)+MRefine)*damChangePer*(1-RefineMDamReduc)*(1+MDamIncrease)*GameConfig.ElementRestrain[srcAtkElement][targetDefElement]*elementparam2*Final*RuneDamage

  if 1 >= A then
    return 1
  end

  return A

end
--------------------------------------------------------------------------------------------------------------------------贤者 精神冲击 范围技能魔法伤害计算公式(已改)
function CommonFun.calcDamage_8205(srcUser, targetUser, params, damageParam, logger)
  local Int = srcUser:GetProperty("Int")
  local Vit = srcUser:GetProperty("Vit")
  local MAtk = srcUser:GetProperty("MAtk")
  local MAtkPer = srcUser:GetProperty("MAtkPer")
  local MDamIncrease = CommonFun.calcMDamIncrease(srcUser, targetUser)
  local IgnoreMDef = srcUser:GetProperty("IgnoreMDef")
  if IgnoreMDef >= 1 then
     IgnoreMDef  = 1
  end
  ------------------------------------------------------------------------------------将原来的物伤加成改成精炼物理攻击
  local MRefine  = srcUser:GetProperty("MRefine")
  local RangeDam = srcUser:GetProperty("RangeDam")

  local srcAtkElement    = 5

  local ElementNpc = srcUser:getCurElementElfID()---获取元素生物

  if ElementNpc==580010 then
      srcAtkElement = 4
  elseif ElementNpc==580020 then
      srcAtkElement = 3
  elseif ElementNpc==580030 then
      srcAtkElement = 2
  elseif ElementNpc==580040 then
      srcAtkElement = 1
  end

  local targetDefElement = targetUser:GetProperty("DefAttr")
  ----------------------------------------------------------------------------------------------------------------种族，体型，属性，BOSS减伤效果
    if nil == CommonFun.NatureProps[srcAtkElement] or nil == CommonFun.NatureProps[targetDefElement] or nil == targetDefElement then
       return 0
    end

    local elementRed = targetUser:GetProperty(CommonFun.NatureProps[srcAtkElement][2])
    local elementAtk = srcUser:GetProperty(CommonFun.NatureProps[srcAtkElement][3])

    if nil==elementAtk then
        elementAtk = 0
    end

    local elementparam2 = 1+elementAtk-elementRed
    ------------------------------------------------------------------------竞技场额外增加30%元素减免
    local mapid,maptype = srcUser:GetMapInfo()-----------------获取所在地图
    ------------------------maptype 1 :野外 2：pvp 3:其他普通副本 4:gvg
    if maptype==2 or maptype==4 then
      local B = elementRed - elementAtk  ---------------元素伤害减免
      B = B < -1 and -1 or B > 1 and 1 or B
      B = math.floor(B*1000)/1000
      B = B + 0.3*(1-math.sin(B*3.14/2))
      --print("B2="..B)
      elementparam2 = 1 - B
    end

    if elementparam2 <= 0.1 then
        elementparam2 = 0.1
    end

  ----------------------------------------------------------------------------------------------------------------法系职业伤害会受到种族加伤减伤影响
  local raceparam     = CommonFun.CalcRaceParam(srcUser, targetUser, params, damageParam, logger)
  local raceparam2    = CommonFun.CalcRaceParam2(srcUser, targetUser, params, damageParam, logger)
  local bossparam     = CommonFun.CalcBossParam(srcUser, targetUser, params, damageParam, logger)
  local bossparam2    = CommonFun.CalcBossParam2(srcUser, targetUser, params, damageParam, logger)

  local MDef2 = targetUser:GetProperty("MDef")
  local MDefPer2 = targetUser:GetProperty("MDefPer")
  local Vit2 = targetUser:GetProperty("Vit")
  local VitPer2 = targetUser:GetProperty("VitPer")
  local Int2 = targetUser:GetProperty("Int")
  local IntPer2 = targetUser:GetProperty("IntPer")
  local MDamReduc2 = CommonFun.calcMDamReDuc(srcUser, targetUser)
  local RefineMDamReduc = targetUser:GetProperty("RefineMDamReduc")

  local damChangePer = damageParam.damChangePer

  local BaseMAtk = Int+math.floor(Int*Int/100)
  local MAtkFinal= ((MAtk-BaseMAtk)*(1+MAtkPer)+BaseMAtk)*raceparam*bossparam*bossparam2

  ----------------------------魔法防御减免
  local MDefReduc = CommonFun.CalcMDef(MDef,Int,Vit,srcUser,targetUser)
  local Num_js = srcUser:GetRunePoint(82033)

  local A = ((MAtkFinal*MDefReduc*(1-MDamReduc2)+MRefine)*(1-RefineMDamReduc)*damChangePer*(1+MDamIncrease)*GameConfig.ElementRestrain[srcAtkElement][targetDefElement]*elementparam2-Vit2/2*(1+VitPer2)-Int2*(1+IntPer2))*(1 + Num_js*0.08)*(1 + RangeDam)

  if 1 >= A then
    return 1
  end

     return A

end
--------------------------------------------------------------------------------------------------------------------------BOSS专用技能
function CommonFun.calcDamage_9000(srcUser, targetUser, params, damageParam, logger)
  local Int = srcUser:GetProperty("Int")
  local Vit = srcUser:GetProperty("Vit")
  local MAtk = srcUser:GetProperty("MAtk")
  local MAtkPer = srcUser:GetProperty("MAtkPer")
  local MDamIncrease = CommonFun.calcMDamIncrease(srcUser, targetUser)
  local IgnoreMDef = srcUser:GetProperty("IgnoreMDef")
  if IgnoreMDef >= 1 then
     IgnoreMDef  = 1
  end
  ------------------------------------------------------------------------------------将原来的物伤加成改成精炼物理攻击
  local MRefine = srcUser:GetProperty("MRefine")

  local srcAtkElement    = CommonFun.GetUserAtkAttr(srcUser, params, damageParam)
  local targetDefElement = targetUser:GetProperty("DefAttr")
  local count=params.hitedCount
  if count<=1 then
     count=1
  end
  ----------------------------------------------------------------------------------------------------------------种族，体型，属性，BOSS减伤效果
  local elementparam2 = CommonFun.CalcElementParam2(srcUser, targetUser, params, damageParam, logger)
  local raceparam     = CommonFun.CalcRaceParam(srcUser, targetUser, params, damageParam, logger)
  local bossparam2    = CommonFun.CalcBossParam2(srcUser, targetUser, params, damageParam, logger)

  local MDef2 = targetUser:GetProperty("MDef")
  local MDefPer2 = targetUser:GetProperty("MDefPer")
  local Vit2 = targetUser:GetProperty("Vit")
  local VitPer2 = targetUser:GetProperty("VitPer")
  local Int2 = targetUser:GetProperty("Int")
  local IntPer2 = targetUser:GetProperty("IntPer")
  local MDamReduc2 = CommonFun.calcMDamReDuc(srcUser, targetUser)
  local RefineMDamReduc = targetUser:GetProperty("RefineMDamReduc")
  local damChangePer = damageParam.damChangePer

  local BaseMAtk = Int+math.floor(Int*Int/100)
  local MAtkFinal= ((MAtk-BaseMAtk)*(1+MAtkPer)+BaseMAtk)*raceparam*bossparam2

  ----------------------------魔法防御减免
  local MDefReduc = CommonFun.CalcMDef(MDef,Int,Vit,srcUser,targetUser)

  local A = ((MAtkFinal*MDefReduc*(1-MDamReduc2)+MRefine)*damChangePer*(1-RefineMDamReduc)*(1+MDamIncrease)*GameConfig.ElementRestrain[srcAtkElement][targetDefElement]*elementparam2-Vit2/2*(1+VitPer2)-Int2*(1+IntPer2))/count


  if 1 >= A then
    return 1
  end

  return A

end

--------------------------------------------------------------------------------------------------------------------------BOSS专用技能
function CommonFun.calcDamage_9001(srcUser, targetUser, params, damageParam, logger)
  local Int = srcUser:GetProperty("Int")
  local Vit = srcUser:GetProperty("Vit")
  local MAtk = srcUser:GetProperty("MAtk")
  local MAtkPer = srcUser:GetProperty("MAtkPer")
  local MDamIncrease = CommonFun.calcMDamIncrease(srcUser, targetUser)
  local IgnoreMDef = srcUser:GetProperty("IgnoreMDef")
  if IgnoreMDef >= 1 then
     IgnoreMDef  = 1
  end
  ------------------------------------------------------------------------------------将原来的物伤加成改成精炼物理攻击
  local MRefine = srcUser:GetProperty("MRefine")

  local srcAtkElement    = CommonFun.GetUserAtkAttr(srcUser, params, damageParam)
  local targetDefElement = targetUser:GetProperty("DefAttr")
  local count=params.hitedCount
  if count<=1 then
     count=1
  end
  ----------------------------------------------------------------------------------------------------------------种族，体型，属性，BOSS减伤效果
  local elementparam2 = CommonFun.CalcElementParam2(srcUser, targetUser, params, damageParam, logger)
  local raceparam     = CommonFun.CalcRaceParam(srcUser, targetUser, params, damageParam, logger)
  local bossparam2    = CommonFun.CalcBossParam2(srcUser, targetUser, params, damageParam, logger)

  local MDef2 = targetUser:GetProperty("MDef")
  local MDefPer2 = targetUser:GetProperty("MDefPer")
  local Vit2 = targetUser:GetProperty("Vit")
  local VitPer2 = targetUser:GetProperty("VitPer")
  local Int2 = targetUser:GetProperty("Int")
  local IntPer2 = targetUser:GetProperty("IntPer")
  local MDamReduc2 = CommonFun.calcMDamReDuc(srcUser, targetUser)
  local RefineMDamReduc = targetUser:GetProperty("RefineMDamReduc")
  local damChangePer = damageParam.damChangePer

  local BaseMAtk = Int+math.floor(Int*Int/100)
  local MAtkFinal= ((MAtk-BaseMAtk)*(1+MAtkPer)+BaseMAtk)*raceparam*bossparam2

  ----------------------------魔法防御减免
  local MDefReduc = CommonFun.CalcMDef(MDef,Int,Vit,srcUser,targetUser)

  local A = ((MAtkFinal*MDefReduc*(1-MDamReduc2)+MRefine)*(1-RefineMDamReduc)*damChangePer*(1+MDamIncrease)*GameConfig.ElementRestrain[srcAtkElement][targetDefElement]*elementparam2-Vit2/2*(1+VitPer2)-Int2*(1+IntPer2))*count


  if 1 >= A then
    return 1
  end

  return A

end

function CommonFun.calcDamage_9002(srcUser, targetUser, params, damageParam, logger)
  local Str = srcUser:GetProperty("Str")
  local Dex = srcUser:GetProperty("Dex")
  local Luk = srcUser:GetProperty("Luk")
  local Atk = srcUser:GetProperty("Atk")
  local AtkPer = srcUser:GetProperty("AtkPer")
  local DamIncrease = srcUser:GetProperty("DamIncrease")
  local IgnoreDef  = 0
  local IgnoreDef1 = srcUser:GetProperty("IgnoreDef")
  local IgnoreDef2 = srcUser:GetProperty("IgnoreEquipDef")
  if targetUser.boss or targetUser.mini then
     IgnoreDef=IgnoreDef1
  else
     IgnoreDef=(IgnoreDef1+IgnoreDef2)
  end

  if IgnoreDef >= 1 then
     IgnoreDef=1
  end
    ------------------------------------------------------------------------------------将原来的物伤加成改成精炼物理攻击
  local Refine = srcUser:GetProperty("Refine")
  local count=params.hitedCount
  if count<=1 then
     count=1
  end



  local Def2 = targetUser:GetProperty("Def")
  local DefPer2 = targetUser:GetProperty("DefPer")
  local Vit2 = targetUser:GetProperty("Vit")
  local VitPer2 = targetUser:GetProperty("VitPer")
  local DamReduc2 = CommonFun.calcDamReDuc(srcUser, targetUser)
  local RefineDamReduc = targetUser:GetProperty("RefineDamReduc")

  local damChangePer = damageParam.damChangePer

  ----------------------------------------------------------------------------------------------------------------种族，体型，属性，BOSS加伤效果
  local raceparam     = CommonFun.CalcRaceParam(srcUser, targetUser, params, damageParam, logger)
  local bodyparam     = CommonFun.CalcBodyParam(srcUser, targetUser, params, damageParam, logger)
  local elementparam  = CommonFun.CalcElementParam(srcUser, targetUser, params, damageParam, logger)
  local bossparam     = CommonFun.CalcBossParam(srcUser, targetUser, params, damageParam, logger)

  ----------------------------------------------------------------------------------------------------------------种族，体型，属性，BOSS减伤效果
  local raceparam2    = CommonFun.CalcRaceParam2(srcUser, targetUser, params, damageParam, logger)
  local bodyparam2    = CommonFun.CalcBodyParam2(srcUser, targetUser, params, damageParam, logger)
  local elementparam2 = CommonFun.CalcElementParam2(srcUser, targetUser, params, damageParam, logger)
  local bossparam2    = CommonFun.CalcBossParam2(srcUser, targetUser, params, damageParam, logger)



  local BaseAtk  = Str*2 + math.floor(Str*Str/100) + math.floor(Dex/5) + math.floor(Luk/5)
  local AtkFinal = ((Atk-BaseAtk)*(1+AtkPer)*CommonFun.ShapeCorrection(srcUser,targetUser)*bodyparam*elementparam*elementparam2+BaseAtk)*raceparam*bossparam*bossparam2

  ----------------------------物理防御减免
  local DefReduc= CommonFun.CalcDef(Def,Vit,srcUser,targetUser)

  local A = ((AtkFinal*DefReduc*(1-DamReduc2)+Refine)*damChangePer*(1-RefineDamReduc)*(1+DamIncrease)-Vit2*(1+VitPer2))/count

   if 1 >= A then
         return 1
   end

   return A
end

function CommonFun.calcDamage_9003(srcUser, targetUser, params, damageParam, logger)
  local Int = srcUser:GetProperty("Int")
  local Vit = srcUser:GetProperty("Vit")
  local MAtk = srcUser:GetProperty("MAtk")
  local MAtkPer = srcUser:GetProperty("MAtkPer")
  local MDamIncrease = CommonFun.calcMDamIncrease(srcUser, targetUser)
  local IgnoreMDef = srcUser:GetProperty("IgnoreMDef")
  if IgnoreMDef >= 1 then
     IgnoreMDef  = 1
  end
  ------------------------------------------------------------------------------------将原来的物伤加成改成精炼物理攻击
  local MRefine = srcUser:GetProperty("MRefine")

  local srcAtkElement    = CommonFun.GetUserAtkAttr(srcUser, params, damageParam)
  local targetDefElement = targetUser:GetProperty("DefAttr")
  local count=params.hitedCount
  if count<=1 then
     count=1
  end
  ----------------------------------------------------------------------------------------------------------------种族，体型，属性，BOSS减伤效果
  local elementparam2 = CommonFun.CalcElementParam2(srcUser, targetUser, params, damageParam, logger)
  local raceparam     = CommonFun.CalcRaceParam(srcUser, targetUser, params, damageParam, logger)
  local bossparam2    = CommonFun.CalcBossParam2(srcUser, targetUser, params, damageParam, logger)

  local MDef2 = targetUser:GetProperty("MDef")
  local MDefPer2 = targetUser:GetProperty("MDefPer")
  local Vit2 = targetUser:GetProperty("Vit")
  local VitPer2 = targetUser:GetProperty("VitPer")
  local Int2 = targetUser:GetProperty("Int")
  local IntPer2 = targetUser:GetProperty("IntPer")
  local MDamReduc2 = CommonFun.calcMDamReDuc(srcUser, targetUser)
  local RefineMDamReduc = targetUser:GetProperty("RefineMDamReduc")
  local damChangePer = damageParam.damChangePer

  local BaseMAtk = Int+math.floor(Int*Int/100)
  local MAtkFinal= ((MAtk-BaseMAtk)*(1+MAtkPer)+BaseMAtk)*raceparam*bossparam2

  ----------------------------魔法防御减免
  local MDefReduc = CommonFun.CalcMDef(MDef,Int,Vit,srcUser,targetUser)

  local A = ((MAtkFinal*MDefReduc*(1-MDamReduc2)+MRefine)*(1-RefineMDamReduc)*damChangePer*(1+MDamIncrease)*GameConfig.ElementRestrain[srcAtkElement][targetDefElement]*elementparam2-Vit2/2*(1+VitPer2)-Int2*(1+IntPer2))/count


  if 1 >= A then
    return 1
  end

  return A

end

-------------------------------------------------------------------------------------------------------------------濒死之术
function CommonFun.calcDamage_9004(srcUser, targetUser, params, damageParam, logger)
  local Hp = targetUser:GetProperty("Hp")
  local Weapon = srcUser:GetEquipedID(7)
  local targetRace = targetUser.race
  local enemy=srcUser:IsEnemy(targetUser)
  local A = Hp-1
  ----------------------------------------------------------------------------暗灵之斧,斯特勒手斧濒死之术
  if enemy then
      if targetRace==3 and (Weapon==41815 or Weapon==141815) then
         if targetUser.boss == true or targetUser.mini == true then
           return 0,0
         else
           return A
         end
      elseif targetRace==1 and (Weapon==41836 or Weapon==141836) then
         if targetUser.boss == true or targetUser.mini == true then
           return 0,0
         else
           return A
         end
      else
           return 0,0
      end
  else
    return 0,0
  end

  return 0,0

end

function CommonFun.calcDamage_9005(srcUser, targetUser, params, damageParam, logger)
  local Str = srcUser:GetProperty("Str")
  local Dex = srcUser:GetProperty("Dex")
  local Luk = srcUser:GetProperty("Luk")
  local Atk = srcUser:GetProperty("Atk")
  local AtkPer = srcUser:GetProperty("AtkPer")
  local DamIncrease = srcUser:GetProperty("DamIncrease")
  local BaseLv = srcUser.BaseLv
  local IgnoreDef  = 0
  local IgnoreDef1 = srcUser:GetProperty("IgnoreDef")
  local IgnoreDef2 = srcUser:GetProperty("IgnoreEquipDef")
  if targetUser.boss or targetUser.mini then
     IgnoreDef=IgnoreDef1
  else
     IgnoreDef=(IgnoreDef1+IgnoreDef2)
  end

  if IgnoreDef >= 1 then
     IgnoreDef=1
  end
    ------------------------------------------------------------------------------------将原来的物伤加成改成精炼物理攻击
  local Refine = srcUser:GetProperty("Refine")
  local count=params.hitedCount
  if count<=1 then
     count=1
  end

  local Def2 = targetUser:GetProperty("Def")
  local DefPer2 = targetUser:GetProperty("DefPer")
  local Vit2 = targetUser:GetProperty("Vit")
  local VitPer2 = targetUser:GetProperty("VitPer")
  local DamReduc2 = CommonFun.calcDamReDuc(srcUser, targetUser)
  local RefineDamReduc = targetUser:GetProperty("RefineDamReduc")

  local damChangePer = damageParam.damChangePer

  ----------------------------------------------------------------------------------------------------------------种族，体型，属性，BOSS加伤效果
  local raceparam     = CommonFun.CalcRaceParam(srcUser, targetUser, params, damageParam, logger)
  local bodyparam     = CommonFun.CalcBodyParam(srcUser, targetUser, params, damageParam, logger)
  local elementparam  = CommonFun.CalcElementParam(srcUser, targetUser, params, damageParam, logger)
  local bossparam     = CommonFun.CalcBossParam(srcUser, targetUser, params, damageParam, logger)
  ----------------------------------------------------------------------------------------------------------------种族，体型，属性，BOSS减伤效果
  local raceparam2    = CommonFun.CalcRaceParam2(srcUser, targetUser, params, damageParam, logger)
  local bodyparam2    = CommonFun.CalcBodyParam2(srcUser, targetUser, params, damageParam, logger)
  local elementparam2 = CommonFun.CalcElementParam2(srcUser, targetUser, params, damageParam, logger)
  local bossparam2    = CommonFun.CalcBossParam2(srcUser, targetUser, params, damageParam, logger)



  local BaseAtk  = Str*2 + math.floor(Str*Str/100) + math.floor(Dex/5) + math.floor(Luk/5)
  local AtkFinal = ((Atk-BaseAtk)*(1+AtkPer)*CommonFun.ShapeCorrection(srcUser,targetUser)*bodyparam*elementparam*elementparam2+BaseAtk)*raceparam*bossparam*bossparam2

  ----------------------------物理防御减免
  local DefReduc= CommonFun.CalcDef(Def,Vit,srcUser,targetUser)

  local A = ((AtkFinal*DefReduc*(1-DamReduc2)+Refine)*damChangePer*(1-RefineDamReduc)*(1+DamIncrease)-Vit2*(1+VitPer2))/count

   if 1 >= A then
         return 1,CommonFun.DamageType.Normal_Sp
   end

   return A,CommonFun.DamageType.Normal_Sp
end

-----------------------------------------------------------------------------------------------------------------巴风特之怒技能伤害计算公式(已改)
function CommonFun.calcDamage_9006(srcUser, targetUser, params, damageParam, logger)
  local BaseLv = srcUser.BaseLv
  local RefineLv=srcUser:GetEquipedRefineLv(7)
  local B = 0
  local Num1 = srcUser:GetBuffLayer(24522)
  local weapon=srcUser:GetEquipedID(7)
  local DamIncrease = srcUser:GetProperty("DamIncrease")
  local DamReduc2 = CommonFun.calcDamReDuc(srcUser, targetUser)
  local RefineDamReduc = targetUser:GetProperty("RefineDamReduc")
  if (weapon==40020 or weapon==140020) then
     if RefineLv>=2 and RefineLv < 4 then
        B = 0.05
     elseif RefineLv>=4 and RefineLv < 6 then
        B = 0.1
     elseif RefineLv>=6 and RefineLv < 8 then
        B = 0.15
     elseif RefineLv>=8 and RefineLv < 10 then
        B = 0.20
     elseif RefineLv>=10 and RefineLv < 12 then
        B = 0.25
     elseif RefineLv>=12 and RefineLv < 14 then
        B = 0.30
     elseif RefineLv>=14 and RefineLv < 16 then
        B = 0.35
     elseif RefineLv>=16 and RefineLv < 18 then
        B = 0.40
     elseif RefineLv>=18 and RefineLv < 20 then
        B = 0.45
     elseif RefineLv==20 then
        B = 0.50
     end
  end

  local damChangePer = damageParam.damChangePer
    ----------------------------------------------------------------------------------------------------------------种族，体型，属性，BOSS加伤效果
  local raceparam     = CommonFun.CalcRaceParam(srcUser, targetUser, params, damageParam, logger)
  local bodyparam     = CommonFun.CalcBodyParam(srcUser, targetUser, params, damageParam, logger)
  local elementparam  = CommonFun.CalcElementParam(srcUser, targetUser, params, damageParam, logger)
  local bossparam     = CommonFun.CalcBossParam(srcUser, targetUser, params, damageParam, logger)
  ----------------------------------------------------------------------------------------------------------------种族，体型，属性，BOSS减伤效果
  local raceparam2    = CommonFun.CalcRaceParam2(srcUser, targetUser, params, damageParam, logger)
  local bodyparam2    = CommonFun.CalcBodyParam2(srcUser, targetUser, params, damageParam, logger)
  local elementparam2 = CommonFun.CalcElementParam2(srcUser, targetUser, params, damageParam, logger)
  local bossparam2    = CommonFun.CalcBossParam2(srcUser, targetUser, params, damageParam, logger)

  local A = math.max(1,BaseLv*Num1*damChangePer*(1+B))*elementparam*elementparam2*raceparam*bossparam*bossparam2*(1-DamReduc2)*(1-RefineDamReduc)*(1+DamIncrease)

   if 1 >= A then
         return 1
   end

   return A
end


--波利乱斗 撞击
function CommonFun.calcDamage_9010(srcUser, targetUser, params, damageParam, logger)

  if targetUser:GetNpcID() == 0 then --------------------为玩家
    local TargetAppleNum = targetUser:GetAppleNum()
    if  targetUser:HasBuffID(200020) or targetUser:HasBuffID(200021) then----目标苹果数量为0或有护盾Buff
      return 1, CommonFun.DamageType.Normal
    elseif TargetAppleNum == 0  then
      return 0, CommonFun.DamageType.Normal
    elseif targetUser:HasBuffID(200070) then---------------目标身上存在变大效果
      return math.ceil(TargetAppleNum/4)
    else
      return math.ceil(TargetAppleNum/2)
    end
  else-----------------------------为怪物（命中和暴击不在此处判断）
    local A = 100
    local SelfAppleNum = srcUser:GetAppleNum()
    if SelfAppleNum>5 then
      A = 100*((SelfAppleNum-5)*0.1+1)
    end
    return A
  end
end

--波利乱斗 怪物普攻
function CommonFun.calcDamage_9011(srcUser, targetUser, params, damageParam, logger)

  local damageParam = damageParam.damChangePer
  if damageParam == 0 then
    return 0, CommonFun.DamageType.Miss
  end

  if targetUser:GetNpcID() == 0 then --------------------为玩家
    local TargetAppleNum = targetUser:GetAppleNum()

    if TargetAppleNum <= 1 or targetUser:HasBuffID(200020) or targetUser:HasBuffID(200021) then----目标苹果数量为0或有护盾Buff
      return 0, CommonFun.DamageType.Miss
    elseif  CommonFun.IsInRate(damageParam/2, srcUser:GetRandom()) and targetUser:HasBuffID(200070)  then---------------目标身上存在变大则概率减半
      return 1
    elseif CommonFun.IsInRate(damageParam, srcUser:GetRandom()) then---------------默认30%概率掉落1个苹果
      return 1
    else
      return 0, CommonFun.DamageType.Miss
    end
  else-----------------------------为怪物
    return 0, CommonFun.DamageType.Miss
  end
end
----------------------------------------------------------------------卡仑技能 冰锥治疗
function CommonFun.calcDamage_9012(srcUser, targetUser, params, damageParam, logger)
  local MaxHp = targetUser:GetProperty("MaxHp")
  local A = -MaxHp*0.03

  return A

end
----------------------------------------------------------------------卡仑技能 冰锥伤害
function CommonFun.calcDamage_9013(srcUser, targetUser, params, damageParam, logger)
  local MaxHp = targetUser:GetProperty("MaxHp")
  local A = MaxHp*0.2

  return A

end
---------------------------------------------------------------------- 神器  冰霜结晶
function CommonFun.calcDamage_9014(srcUser, targetUser, params, damageParam, logger)
  local Atk = srcUser:GetProperty("Atk")
  local AtkPer = srcUser:GetProperty("AtkPer")
  local Refine = srcUser:GetProperty("Refine")
  local CriDamPer = srcUser:GetProperty("CriDamPer")
  local RefineDamReduc = targetUser:GetProperty("RefineDamReduc")

  local damChangePer = damageParam.damChangePer

  local A = (Atk*(1+AtkPer)+Refine)*(1.5+CriDamPer)*(1-RefineDamReduc)*damChangePer

  return A

end
---------------------------------------------------------------------- 神器  雷神之怒
function CommonFun.calcDamage_9015(srcUser, targetUser, params, damageParam, logger)
  local Atk = srcUser:GetProperty("Atk")
  local AtkPer = srcUser:GetProperty("AtkPer")
  local Refine = srcUser:GetProperty("Refine")
  local MAtk = srcUser:GetProperty("MAtk")
  local MAtkPer = srcUser:GetProperty("MAtkPer")
  local MRefine = srcUser:GetProperty("MRefine")
  local RefineDamReduc = targetUser:GetProperty("RefineDamReduc")

  local damChangePer = damageParam.damChangePer

  local A = (Atk*(1 + AtkPer) + Refine + MAtk*(1 + MAtkPer) + MRefine)*(1-RefineDamReduc)*damChangePer

  return A

end
------------------------------------------------------------------------------Mini怪火球弹射技能伤害公式（已改）
function CommonFun.calcDamage_9016(srcUser, targetUser, params, damageParam, logger)
  local Int = srcUser:GetProperty("Int")
  local Vit = srcUser:GetProperty("Vit")
  local MAtk = srcUser:GetProperty("MAtk")
  local MAtkPer = srcUser:GetProperty("MAtkPer")
  local MDamIncrease = CommonFun.calcMDamIncrease(srcUser, targetUser)
  local IgnoreMDef = srcUser:GetProperty("IgnoreMDef")
  if IgnoreMDef >= 1 then
     IgnoreMDef  = 1
  end
  ------------------------------------------------------------------------------------将原来的物伤加成改成精炼物理攻击
  local MRefine = srcUser:GetProperty("MRefine")

  local srcAtkElement    = CommonFun.GetUserAtkAttr(srcUser, params, damageParam)
  local targetDefElement = targetUser:GetProperty("DefAttr")
  local count=params.hitedCount
  if count<=1 then
     count=1
  end
  ----------------------------------------------------------------------------------------------------------------种族，体型，属性，BOSS减伤效果
  local elementparam2 = CommonFun.CalcElementParam2(srcUser, targetUser, params, damageParam, logger)
  local raceparam     = CommonFun.CalcRaceParam(srcUser, targetUser, params, damageParam, logger)
  local bossparam2    = CommonFun.CalcBossParam2(srcUser, targetUser, params, damageParam, logger)

  local MDef2 = targetUser:GetProperty("MDef")
  local MDefPer2 = targetUser:GetProperty("MDefPer")
  local Vit2 = targetUser:GetProperty("Vit")
  local VitPer2 = targetUser:GetProperty("VitPer")
  local Int2 = targetUser:GetProperty("Int")
  local IntPer2 = targetUser:GetProperty("IntPer")
  local MDamReduc2 = CommonFun.calcMDamReDuc(srcUser, targetUser)
  local RefineMDamReduc = targetUser:GetProperty("RefineMDamReduc")
  local damChangePer = damageParam.damChangePer

  local BaseMAtk = Int+math.floor(Int*Int/100)
  local MAtkFinal= ((MAtk-BaseMAtk)*(1+MAtkPer)+BaseMAtk)*raceparam*bossparam2

  ----------------------------魔法防御减免
  local MDefReduc = CommonFun.CalcMDef(MDef,Int,Vit,srcUser,targetUser)

  local A = ((MAtkFinal*MDefReduc*(1-MDamReduc2)+MRefine)*damChangePer*(1-RefineMDamReduc)*(1+MDamIncrease)*GameConfig.ElementRestrain[srcAtkElement][targetDefElement]*elementparam2-Vit2/2*(1+VitPer2)-Int2*(1+IntPer2))*count


  if 1 >= A then
    return 1
  end

  return A

end

--波利乱斗 炸弹
function CommonFun.calcDamage_9017(srcUser, targetUser, params, damageParam, logger)

  if targetUser:GetNpcID() == 0 then --------------------为玩家
    local TargetAppleNum = targetUser:GetAppleNum()
    return TargetAppleNum
  else-----------------------------为怪物（命中和暴击不在此处判断）
    return 500
  end
end
-------------------------------------------------------------------------------------------------------------------------风暴之心伤害计算公式(已改)
function CommonFun.calcDamage_9018(srcUser, targetUser, params, damageParam, logger)
  local Luk = srcUser:GetProperty("Luk")
  local Int = srcUser:GetProperty("Int")
  local Vit = srcUser:GetProperty("Vit")
  local MAtk = srcUser:GetProperty("MAtk")
  local MAtkPer = srcUser:GetProperty("MAtkPer")

  -----------------------------------------------------------------------------------分割线
  local MDamIncrease = CommonFun.calcMDamIncrease(srcUser, targetUser)
  local IgnoreMDef = srcUser:GetProperty("IgnoreMDef")
  if IgnoreMDef >= 1 then
     IgnoreMDef  = 1
  end

  ------------------------------------------------------------------------------------将原来的物伤加成改成精炼物理攻击
  local MRefine = srcUser:GetProperty("MRefine")
  -------------------------------------------------四种元素伤害分别判断
  local srcAtkElement1  = 1
    local elementInc1 = 0
    local elementRed1 = 0

    local targetDefElement = targetUser:GetProperty("DefAttr")


    if nil == targetDefElement then
        logger.error(string.format("%s targetDefElement is nil", targetUser.name))
        return 0
    end
    if nil == CommonFun.NatureProps[targetDefElement] then
        logger.error(string.format("%s CommonFun.NatureProps[%s] is nil", srcUser.name, tostring(targetDefElement)))
        return 0
    end

    if nil == CommonFun.NatureProps[srcAtkElement1] then
        logger.error(string.format("CommonFun.NatureProps[%s] is nil", tostring(srcAtkElement1)))
        return 0
    end

    elementInc1 = srcUser:GetProperty(CommonFun.NatureProps[targetDefElement][1])
    elementRed1 = targetUser:GetProperty(CommonFun.NatureProps[srcAtkElement1][2])
    elementAtk1 = srcUser:GetProperty(CommonFun.NatureProps[srcAtkElement1][3])

    if nil==elementAtk1 then
        elementAtk1 = 0
    end
    local result1 = 1+elementAtk1-elementRed1

    if result1 <= 0.1 then
        result1 = 0.1
    end


  local srcAtkElement3   = 3
    local elementInc3 = 0
    local elementRed3 = 0

    local targetDefElement = targetUser:GetProperty("DefAttr")


    if nil == targetDefElement then
        logger.error(string.format("%s targetDefElement is nil", targetUser.name))
        return 0
    end
    if nil == CommonFun.NatureProps[targetDefElement] then
        logger.error(string.format("%s CommonFun.NatureProps[%s] is nil", srcUser.name, tostring(targetDefElement)))
        return 0
    end

    if nil == CommonFun.NatureProps[srcAtkElement3] then
        logger.error(string.format("CommonFun.NatureProps[%s] is nil", tostring(srcAtkElement3)))
        return 0
    end

    elementInc3 = srcUser:GetProperty(CommonFun.NatureProps[targetDefElement][1])
    elementRed3 = targetUser:GetProperty(CommonFun.NatureProps[srcAtkElement3][2])
    elementAtk3 = srcUser:GetProperty(CommonFun.NatureProps[srcAtkElement3][3])

    if nil==elementAtk3 then
        elementAtk3 = 0
    end
    local result3 = 1+elementAtk3-elementRed3

    if result3 <= 0.1 then
        result3 = 0.1
    end


  ----------------------------------------------------------------------------------------------------------------种族，体型，属性，BOSS减伤效果

  local elementparam21 = result1
  local elementparam23 = result3
  ----------------------------------------------------------------------------------------------------------------法系职业伤害会受到种族加伤减伤影响
  local raceparam     = CommonFun.CalcRaceParam(srcUser, targetUser, params, damageParam, logger)
  local raceparam2    = CommonFun.CalcRaceParam2(srcUser, targetUser, params, damageParam, logger)
  local bossparam     = CommonFun.CalcBossParam(srcUser, targetUser, params, damageParam, logger)
  local bossparam2    = CommonFun.CalcBossParam2(srcUser, targetUser, params, damageParam, logger)

  local MDef2 = targetUser:GetProperty("MDef")
  local MDefPer2 = targetUser:GetProperty("MDefPer")
  local Vit2 = targetUser:GetProperty("Vit")
  local VitPer2 = targetUser:GetProperty("VitPer")
  local Int2 = targetUser:GetProperty("Int")
  local IntPer2 = targetUser:GetProperty("IntPer")
  local MDamReduc2 = CommonFun.calcMDamReDuc(srcUser, targetUser)
  local RefineMDamReduc = targetUser:GetProperty("RefineMDamReduc")

  local damChangePer = damageParam.damChangePer

  local BaseMAtk = Int+math.floor(Int*Int/100)
  local MAtkFinal= ((MAtk-BaseMAtk)*(1+MAtkPer)+BaseMAtk)*raceparam*bossparam*bossparam2
  ----------------------------魔法防御减免
  local MDefReduc = CommonFun.CalcMDef(MDef,Int,Vit,srcUser,targetUser)

  local A1 = ((MAtkFinal*MDefReduc*(1-MDamReduc2)+MRefine)*damChangePer*(1-RefineMDamReduc)*(1+MDamIncrease)*GameConfig.ElementRestrain[srcAtkElement1][targetDefElement]*elementparam21-Vit2/2*(1+VitPer2)-Int2*(1+IntPer2))
  local A3 = ((MAtkFinal*MDefReduc*(1-MDamReduc2)+MRefine)*damChangePer*(1-RefineMDamReduc)*(1+MDamIncrease)*GameConfig.ElementRestrain[srcAtkElement3][targetDefElement]*elementparam23-Vit2/2*(1+VitPer2)-Int2*(1+IntPer2))

  local A=A1+A3

  if 1 >= A then
    return 1
  end

  return A

end
------------------------------------------------------------------------------------------------------------------流氓 弓箭 物理伤害计算公式(已改)
function CommonFun.calcDamage_9201(srcUser, targetUser, params, damageParam, logger)
  local Str = srcUser:GetProperty("Str")
  local Dex = srcUser:GetProperty("Dex")
  local Luk = srcUser:GetProperty("Luk")
  local Atk = srcUser:GetProperty("Atk")
  local AtkPer = srcUser:GetProperty("AtkPer")
  ------------------------------------------------------普通攻击力
  local NormalAtk = srcUser:GetProperty("NormalAtk")
        NormalAtk = NormalAtk + 3*Dex
  ------------------------------------
  local DamIncrease = srcUser:GetProperty("DamIncrease")
  local IgnoreDef  = 0
  local IgnoreDef1 = srcUser:GetProperty("IgnoreDef")
  local IgnoreDef2 = srcUser:GetProperty("IgnoreEquipDef")
  if targetUser.boss or targetUser.mini then
     IgnoreDef=IgnoreDef1
  else
     IgnoreDef=(IgnoreDef1+IgnoreDef2)
  end

  if IgnoreDef >= 1 then
     IgnoreDef=1
  end
   ------------------------------------------------------------------------------------将原来的物伤加成改成精炼物理攻击
  local Refine = srcUser:GetProperty("Refine")

  local AttrEffect = targetUser:GetProperty("AttrEffect")
  local bits=CommonFun.getBits(AttrEffect)

  local Def2 = targetUser:GetProperty("Def")
  local DefPer2 = targetUser:GetProperty("DefPer")
  local Vit2 = targetUser:GetProperty("Vit")
  local VitPer2 = targetUser:GetProperty("VitPer")
  local DamReduc2 = CommonFun.calcDamReDuc(srcUser, targetUser)
  local LongRangeDamReduc2 = targetUser:GetProperty("LongRangeDamReduc")
  local RefineDamReduc = targetUser:GetProperty("RefineDamReduc")

  local damChangePer = damageParam.damChangePer

  ----------------------------------------------------------------------------------------------------------------种族，体型，属性，BOSS加伤效果
  local raceparam     = CommonFun.CalcRaceParam(srcUser, targetUser, params, damageParam, logger)
  local bodyparam     = CommonFun.CalcBodyParam(srcUser, targetUser, params, damageParam, logger)
  local elementparam  = CommonFun.CalcElementParam(srcUser, targetUser, params, damageParam, logger)
  local bossparam     = CommonFun.CalcBossParam(srcUser, targetUser, params, damageParam, logger)

  ----------------------------------------------------------------------------------------------------------------种族，体型，属性，BOSS减伤效果
  local raceparam2    = CommonFun.CalcRaceParam2(srcUser, targetUser, params, damageParam, logger)
  local bodyparam2    = CommonFun.CalcBodyParam2(srcUser, targetUser, params, damageParam, logger)
  local elementparam2 = CommonFun.CalcElementParam2(srcUser, targetUser, params, damageParam, logger)
  local bossparam2    = CommonFun.CalcBossParam2(srcUser, targetUser, params, damageParam, logger)


  local BaseAtk  = Dex*2 + math.floor(Dex*Dex/100) + math.floor(Str/5) + math.floor(Luk/5)
  local AtkFinal = ((Atk-BaseAtk)*(1+AtkPer)*CommonFun.ShapeCorrection(srcUser,targetUser)*bodyparam*elementparam*elementparam2+BaseAtk)*raceparam*bossparam*bossparam2

  local skillID, skillLevel = CommonFun.UnmergeSkillID(params.skillIDAndLevel)

  if skillID==469 then
     AtkFinal = ((Atk-BaseAtk+NormalAtk)*(1+AtkPer)*CommonFun.ShapeCorrection(srcUser,targetUser)*bodyparam*elementparam*elementparam2+BaseAtk)*raceparam*bossparam*bossparam2
  end
  -----------------------------------------物理防御减免
  local DefReduc= CommonFun.CalcDef(Def,Vit,srcUser,targetUser)
  -----------------------------------------------------苍鹰之眼  距离加伤
  local targetid = targetUser:GetGuid()
  local distance = srcUser:GetDistance(targetid)
  local skilllv_1 = srcUser:GetLernedSkillLevel(478)
  local DisDam= 1
  if skilllv_1>10 then
      DisDam = 1 + distance/7.5*(skilllv_1-10)*0.06
  end
  -------------------------------------------------------------死亡标记
    local fromid = targetUser:GetBuffFromID(116470)
    local guid = srcUser:GetGuid()
    local BUffDam = 1
    local skilllv_1 = srcUser:GetLernedSkillLevel(1147)
    ---------------------------------星盘
    local Numxp= srcUser:GetRunePoint(94080)------------星盘点

    if fromid==guid then
      BUffDam = 1+skilllv_1*0.02+Numxp*0.02
    end

  local A = (((AtkFinal*DefReduc*(1-DamReduc2)+Refine)*damChangePer)*(1-RefineDamReduc)*(1+DamIncrease-LongRangeDamReduc2)-Vit2*(1+VitPer2))*DisDam*BUffDam

   if 1 >= A then
         return 1
   end

   return A

end

-----------------------------------------------------------------------------------------------------------------------流氓 短剑 普通攻击伤害计算公式(已改)
function CommonFun.calcDamage_9202(srcUser, targetUser, params, damageParam, logger)
  local Str = srcUser:GetProperty("Str")
  local Dex = srcUser:GetProperty("Dex")
  local Luk = srcUser:GetProperty("Luk")
  local Atk = srcUser:GetProperty("Atk")
  local AtkPer = srcUser:GetProperty("AtkPer")
  ------------------------------------------------------普通攻击力
  local NormalAtk = srcUser:GetProperty("NormalAtk")
        NormalAtk = NormalAtk + 5*Str
  ------------------------------------
  local DamIncrease = srcUser:GetProperty("DamIncrease")
  local IgnoreDef  = 0
  local IgnoreDef1 = srcUser:GetProperty("IgnoreDef")
  local IgnoreDef2 = srcUser:GetProperty("IgnoreEquipDef")
  if targetUser.boss or targetUser.mini then
     IgnoreDef=IgnoreDef1
  else
     IgnoreDef=(IgnoreDef1+IgnoreDef2)
  end

  if IgnoreDef >= 1 then
     IgnoreDef  = 1
  end

  local WeaponType =srcUser:GetEquipedWeaponType()
  local skilllv_1 = srcUser:GetLernedSkillLevel(damageParam.skill1_id)
  ------------------------------------------------------------------------------------将原来的物伤加成改成精炼物理攻击
  local Refine = srcUser:GetProperty("Refine")

  local Def2 = targetUser:GetProperty("Def")
  local DefPer2 = targetUser:GetProperty("DefPer")
  local Vit2 = targetUser:GetProperty("Vit")
  local VitPer2 = targetUser:GetProperty("VitPer")
  local DamReduc2 = CommonFun.calcDamReDuc(srcUser, targetUser)
  local RefineDamReduc = targetUser:GetProperty("RefineDamReduc")

  local AttrEffect2 = srcUser:GetProperty("AttrEffect")
  local bits2=CommonFun.getBits(AttrEffect2)

  ----------------------------------------------------------------------------------------------------------------种族，体型，属性，BOSS加伤效果
  local raceparam     = CommonFun.CalcRaceParam(srcUser, targetUser, params, damageParam, logger)
  local bodyparam     = CommonFun.CalcBodyParam(srcUser, targetUser, params, damageParam, logger)
  local elementparam  = CommonFun.CalcElementParam(srcUser, targetUser, params, damageParam, logger)
  local bossparam     = CommonFun.CalcBossParam(srcUser, targetUser, params, damageParam, logger)

  ----------------------------------------------------------------------------------------------------------------种族，体型，属性，BOSS减伤效果
  local raceparam2    = CommonFun.CalcRaceParam2(srcUser, targetUser, params, damageParam, logger)
  local bodyparam2    = CommonFun.CalcBodyParam2(srcUser, targetUser, params, damageParam, logger)
  local elementparam2 = CommonFun.CalcElementParam2(srcUser, targetUser, params, damageParam, logger)
  local bossparam2    = CommonFun.CalcBossParam2(srcUser, targetUser, params, damageParam, logger)

  local BaseAtk  = Str*2 + math.floor(Str*Str/100) + math.floor(Dex/5) + math.floor(Luk/5)
  local AtkFinal = ((Atk-BaseAtk+NormalAtk)*(1+AtkPer)*CommonFun.ShapeCorrection(srcUser,targetUser)*bodyparam*elementparam*elementparam2+BaseAtk)*raceparam*bossparam*bossparam2

  ----------------------------物理防御减免
  local DefReduc= CommonFun.CalcDef(Def,Vit,srcUser,targetUser)
  --------------------------------------------------------逐一击破 三转加成
  local Enemy = 1
  local skilllv_1 = srcUser:GetLernedSkillLevel(1145)
  local EnemyNum = srcUser:GetRangeEnemy(3) ---------------自己3米内的敌人数量
  if skilllv_1>0 and EnemyNum==1 then
      Enemy = 1+skilllv_1*0.03
  end

  local A = ((AtkFinal*DefReduc*(1-DamReduc2)+Refine)*(1-RefineDamReduc)*(1+DamIncrease)-Vit2*(1+VitPer2))*Enemy
  ------------------------------------------------------------------------------------------------------------华丽短剑buff状态下刺客普通攻击伤害提升
  local Buff=srcUser:HasBuffID(24441)
  local huali=1


   --------------------------------------------华丽短剑[第四档]
  if (Buff==true and srcUser:HasBuffID(90001903)) then
      huali=1.25
      elseif  Buff==true then
      huali=1.1
  end


    ------------------------------------------------------星盘 二刀连击
  local Num1 = srcUser:GetRunePoint(90170)
  local RuneDamage = Num1*0.06 + 1

  if 1 >= A then
      return 1
  end
  -----------------------------------------------------------------------------------------------------------二刀连击
  local WeaponType =srcUser:GetEquipedWeaponType()
  local skilllv_1 = srcUser:GetLernedSkillLevel(179)
  -----------------------------------------------巅峰等级 二刀
  local ErDaoDam = 0
  if skilllv_1>10 then
      ErDaoDam = (skilllv_1-10)*0.05
      skilllv_1 = 10
  end

  local gemChance = 0
  local gemDamage = 1
  if srcUser:HasBuffID(810009) then  ------------------梦魇连击符文
    gemChance = 10
    gemDamage = 1.3
  end

  if WeaponType==250 and CommonFun.IsInRate(skilllv_1*5 + gemChance, srcUser:GetRandom())  then
        return A*(2+ErDaoDam)*huali*RuneDamage*gemDamage, CommonFun.DamageType.ErLianJi
  end


  return A*huali
end

------------------------------------------------------------------------------------------------------------------流氓 三连矢 物理伤害计算公式(已改)
function CommonFun.calcDamage_9203(srcUser, targetUser, params, damageParam, logger)
  local Str = srcUser:GetProperty("Str")
  local Dex = srcUser:GetProperty("Dex")
  local Luk = srcUser:GetProperty("Luk")
  local Atk = srcUser:GetProperty("Atk")
  local AtkPer = srcUser:GetProperty("AtkPer")
  local DamIncrease = srcUser:GetProperty("DamIncrease")
  local IgnoreDef  = 0
  local IgnoreDef1 = srcUser:GetProperty("IgnoreDef")
  local IgnoreDef2 = srcUser:GetProperty("IgnoreEquipDef")
  if targetUser.boss or targetUser.mini then
     IgnoreDef=IgnoreDef1
  else
     IgnoreDef=(IgnoreDef1+IgnoreDef2)
  end

  if IgnoreDef >= 1 then
     IgnoreDef=1
  end
   ------------------------------------------------------------------------------------将原来的物伤加成改成精炼物理攻击
  local Refine = srcUser:GetProperty("Refine")

  local AttrEffect = targetUser:GetProperty("AttrEffect")
  local bits=CommonFun.getBits(AttrEffect)

  local Def2 = targetUser:GetProperty("Def")
  local DefPer2 = targetUser:GetProperty("DefPer")
  local Vit2 = targetUser:GetProperty("Vit")
  local VitPer2 = targetUser:GetProperty("VitPer")
  local DamReduc2 = CommonFun.calcDamReDuc(srcUser, targetUser)
  local LongRangeDamReduc2 = targetUser:GetProperty("LongRangeDamReduc")
  local RefineDamReduc = targetUser:GetProperty("RefineDamReduc")

  local damChangePer = damageParam.damChangePer

  ----------------------------------------------------------------------------------------------------------------种族，体型，属性，BOSS加伤效果
  local raceparam     = CommonFun.CalcRaceParam(srcUser, targetUser, params, damageParam, logger)
  local bodyparam     = CommonFun.CalcBodyParam(srcUser, targetUser, params, damageParam, logger)
  local elementparam  = CommonFun.CalcElementParam(srcUser, targetUser, params, damageParam, logger)
  local bossparam     = CommonFun.CalcBossParam(srcUser, targetUser, params, damageParam, logger)

  ----------------------------------------------------------------------------------------------------------------种族，体型，属性，BOSS减伤效果
  local raceparam2    = CommonFun.CalcRaceParam2(srcUser, targetUser, params, damageParam, logger)
  local bodyparam2    = CommonFun.CalcBodyParam2(srcUser, targetUser, params, damageParam, logger)
  local elementparam2 = CommonFun.CalcElementParam2(srcUser, targetUser, params, damageParam, logger)
  local bossparam2    = CommonFun.CalcBossParam2(srcUser, targetUser, params, damageParam, logger)


  local BaseAtk  = Dex*2 + math.floor(Dex*Dex/100) + math.floor(Str/5) + math.floor(Luk/5)
  local AtkFinal = ((Atk-BaseAtk)*(1+AtkPer)*CommonFun.ShapeCorrection(srcUser,targetUser)*bodyparam*elementparam*elementparam2+BaseAtk)*raceparam*bossparam*bossparam2
  -----------------------------------------物理防御减免
  local DefReduc= CommonFun.CalcDef(Def,Vit,srcUser,targetUser)
  --------------------------------------------------------------
  local skilllv_1 = srcUser:GetLernedSkillLevel(468)
  ------------------------------------------------------星盘三连
  local Num1 = srcUser:GetRunePoint(90050)
  local RuneDamage = Num1*0.08 + 1
 ------------------------------------------------------盗贼之弓三连
  local Num2 =1
  local WeaponRefineLv=srcUser:GetEquipedRefineLv(7)
  if srcUser:HasBuffID(90001633) then
      Num2=WeaponRefineLv*0.03+1
  end
   ------------------------------------------------------盗贼之弓三连[第六档]
   if srcUser:HasBuffID(90001635) then
    Num2 = Num2 + 0.1
  end
  ------------------------------------------------------罗宾汉之弓
  local WeaponRefineLv=srcUser:GetEquipedRefineLv(7)
  if srcUser:HasBuffID(41880) then
      Num2=WeaponRefineLv*0.03+Num2
  end
   ------------------------------------------------------罗宾汉之弓
  if srcUser:HasBuffID(41880) then
    Num2 = Num2 + 0.2
  end


  -------------------------------------------------------------死亡标记
    local fromid = targetUser:GetBuffFromID(116470)
    local guid = srcUser:GetGuid()
    local BUffDam = 1
    local skilllv_dead = srcUser:GetLernedSkillLevel(1147)
    ---------------------------------星盘
    local Numxp= srcUser:GetRunePoint(94080)------------星盘点

    if fromid==guid then
      BUffDam = 1+skilllv_dead*0.02+Numxp*0.02
    end

  local A = ((AtkFinal*DefReduc*(1-DamReduc2)+Refine)*(damChangePer+skilllv_1*0.1)*(1-RefineDamReduc)*(1+DamIncrease-LongRangeDamReduc2)*RuneDamage-Vit2*(1+VitPer2))*Num2*BUffDam

   if 1 >= A then
         return 1
   end

   return A

end

-----------------------------------------------------------------------------------------------------------------------流氓 技能伤害计算公式(已改)
function CommonFun.calcDamage_9204(srcUser, targetUser, params, damageParam, logger)
  local Str = srcUser:GetProperty("Str")
  local Dex = srcUser:GetProperty("Dex")
  local Luk = srcUser:GetProperty("Luk")
  local Atk = srcUser:GetProperty("Atk")
  local AtkPer = srcUser:GetProperty("AtkPer")
  local DamIncrease = srcUser:GetProperty("DamIncrease")
  local IgnoreDef  = 0
  local IgnoreDef1 = srcUser:GetProperty("IgnoreDef")
  local IgnoreDef2 = srcUser:GetProperty("IgnoreEquipDef")
  if targetUser.boss or targetUser.mini then
     IgnoreDef=IgnoreDef1
  else
     IgnoreDef=(IgnoreDef1+IgnoreDef2)
  end

  if IgnoreDef >= 1 then
     IgnoreDef  = 1
  end

  local Refine = srcUser:GetProperty("Refine")

  local Def2 = targetUser:GetProperty("Def")
  local DefPer2 = targetUser:GetProperty("DefPer")
  local Vit2 = targetUser:GetProperty("Vit")
  local VitPer2 = targetUser:GetProperty("VitPer")
  local DamReduc2 = CommonFun.calcDamReDuc(srcUser, targetUser)
  local RefineDamReduc = targetUser:GetProperty("RefineDamReduc")
  local Hp2 = targetUser:GetProperty("Hp")
  local MaxHp2 = targetUser:GetProperty("MaxHp")

  local damChangePer = damageParam.damChangePer
  local AttrEffect= srcUser:GetProperty("AttrEffect")
  local bits=CommonFun.getBits(AttrEffect)

  ----------------------------------------------------------------------------------------------------------------种族，体型，属性，BOSS加伤效果
  local raceparam     = CommonFun.CalcRaceParam(srcUser, targetUser, params, damageParam, logger)
  local bodyparam     = CommonFun.CalcBodyParam(srcUser, targetUser, params, damageParam, logger)
  local elementparam  = CommonFun.CalcElementParam(srcUser, targetUser, params, damageParam, logger)
  local bossparam     = CommonFun.CalcBossParam(srcUser, targetUser, params, damageParam, logger)

  ----------------------------------------------------------------------------------------------------------------种族，体型，属性，BOSS减伤效果
  local raceparam2    = CommonFun.CalcRaceParam2(srcUser, targetUser, params, damageParam, logger)
  local bodyparam2    = CommonFun.CalcBodyParam2(srcUser, targetUser, params, damageParam, logger)
  local elementparam2 = CommonFun.CalcElementParam2(srcUser, targetUser, params, damageParam, logger)
  local bossparam2    = CommonFun.CalcBossParam2(srcUser, targetUser, params, damageParam, logger)

  local BaseAtk  = Str*2 + math.floor(Str*Str/100) + math.floor(Dex/5) + math.floor(Luk/5)
  local AtkFinal = ((Atk-BaseAtk)*(1+AtkPer)*CommonFun.ShapeCorrection(srcUser,targetUser)*bodyparam*elementparam*elementparam2+BaseAtk)*raceparam*bossparam*bossparam2

  ----------------------------物理防御减免
  local DefReduc= CommonFun.CalcDef(Def,Vit,srcUser,targetUser)

  local A = (AtkFinal*DefReduc*(1-DamReduc2)+Refine)*damChangePer*(1-RefineDamReduc)*(1+DamIncrease)-Vit2*(1+VitPer2)

  local skillID, skillLevel = CommonFun.UnmergeSkillID(params.skillIDAndLevel)
  ----------------------------------------------------------潜击
  if skillID==481 then
      --------------------------------------------星盘 潜击
      local Num1 = srcUser:GetRunePoint(90060)
      local RuneDamage1 = Num1*0.2+1
      A = A*RuneDamage1
  end
  ----------------------------------------------------------胁持
  if skillID==483 then
      --------------------------------------------星盘 胁持
      local Num2 = srcUser:GetRunePoint(90100)
      local RuneDamage2 = Num2*0.1+1
      A = A*RuneDamage2
  end

-------------------------------------------------------------致残袭击
  if (skillID==487 and srcUser:HasBuffID(40672)) then
      A = A*1.5
  end

  if 1 >= A then
         return 1
  end
-------------------------------------------------------------华丽短剑
      if bits[CommonFun.AttrEffect.Hualiduanjian]==1 then
           return A*1.5
      end

   return A

end

-----------------------------------------------------------------------------------------------------------------------流氓 背刺 技能伤害计算公式(已改)
function CommonFun.calcDamage_9205(srcUser, targetUser, params, damageParam, logger)
  local Str = srcUser:GetProperty("Str")
  local Dex = srcUser:GetProperty("Dex")
  local Luk = srcUser:GetProperty("Luk")
  local Atk = srcUser:GetProperty("Atk")
  local AtkPer = srcUser:GetProperty("AtkPer")
  local DamIncrease = srcUser:GetProperty("DamIncrease")
  local IgnoreDef  = 0
  local IgnoreDef1 = srcUser:GetProperty("IgnoreDef")
  local IgnoreDef2 = srcUser:GetProperty("IgnoreEquipDef")
  if targetUser.boss or targetUser.mini then
     IgnoreDef=IgnoreDef1
  else
     IgnoreDef=(IgnoreDef1+IgnoreDef2)
  end

  if IgnoreDef >= 1 then
     IgnoreDef  = 1
  end

  local Refine = srcUser:GetProperty("Refine")

  local Def2 = targetUser:GetProperty("Def")
  local DefPer2 = targetUser:GetProperty("DefPer")
  local Vit2 = targetUser:GetProperty("Vit")
  local VitPer2 = targetUser:GetProperty("VitPer")
  local DamReduc2 = CommonFun.calcDamReDuc(srcUser, targetUser)
  local RefineDamReduc = targetUser:GetProperty("RefineDamReduc")
  local Hp2 = targetUser:GetProperty("Hp")
  local MaxHp2 = targetUser:GetProperty("MaxHp")

  local damChangePer = damageParam.damChangePer
  local AttrEffect= srcUser:GetProperty("AttrEffect")
  local bits=CommonFun.getBits(AttrEffect)

  ----------------------------------------------------------------------------------------------------------------种族，体型，属性，BOSS加伤效果
  local raceparam     = CommonFun.CalcRaceParam(srcUser, targetUser, params, damageParam, logger)
  local bodyparam     = CommonFun.CalcBodyParam(srcUser, targetUser, params, damageParam, logger)
  local elementparam  = CommonFun.CalcElementParam(srcUser, targetUser, params, damageParam, logger)
  local bossparam     = CommonFun.CalcBossParam(srcUser, targetUser, params, damageParam, logger)

  ----------------------------------------------------------------------------------------------------------------种族，体型，属性，BOSS减伤效果
  local raceparam2    = CommonFun.CalcRaceParam2(srcUser, targetUser, params, damageParam, logger)
  local bodyparam2    = CommonFun.CalcBodyParam2(srcUser, targetUser, params, damageParam, logger)
  local elementparam2 = CommonFun.CalcElementParam2(srcUser, targetUser, params, damageParam, logger)
  local bossparam2    = CommonFun.CalcBossParam2(srcUser, targetUser, params, damageParam, logger)

  local BaseAtk  = Str*2 + math.floor(Str*Str/100) + math.floor(Dex/5) + math.floor(Luk/5)
  local AtkFinal = ((Atk-BaseAtk)*(1+AtkPer)*CommonFun.ShapeCorrection(srcUser,targetUser)*bodyparam*elementparam*elementparam2+BaseAtk)*raceparam*bossparam*bossparam2

  ----------------------------物理防御减免
  local DefReduc= CommonFun.CalcDef(Def,Vit,srcUser,targetUser)
    ------------------------------------------------------星盘 背刺
  local Num1 = srcUser:GetRunePoint(90080)
  local RuneDamage = Num1*0.08 + 1

------------------------------------------------------考尔德短剑
  local kerd = 1
  if srcUser:HasBuffID(40672) then
    kerd=1+0.5
  end

   ------------------------------------------------ 牙科手术刀[第一档]
   local yake2 = 1
  if srcUser:HasBuffID(90002160) then
    yake2=1+0.15
  end
  ----------------------手术刀 精炼时人型加伤
  local RefineLv=srcUser:GetEquipedRefineLv(7)
  local Weapon=srcUser:GetEquipedID(7)
  local targetRace =  targetUser.race
  local Hand = 1
  if targetRace ==2 and (Weapon==40744 or Weapon==140744 or Weapon==40745 or Weapon==140745) then
      if (RefineLv >=10 and RefineLv<15) then
          Hand =1.05
      elseif RefineLv==15 then
          Hand =1.15
      end
  end

  ------------------------------------------------ 牙科手术刀[第二档]
  if targetRace ==2 and srcUser:HasBuffID(90002161)   then
      if RefineLv >=5  then
        Hand = Hand + 0.05
    end
  end
  ----------------------------侠盗之衣+牙科手术刀
  local yake = 0
  if targetRace ==2 and srcUser:HasBuffID(91000290) then
    yake=0.5
  end

  --------------------------------------------------------逐一击破 三转加成
  local Enemy = 1
  local skilllv_1 = srcUser:GetLernedSkillLevel(1145)
  local EnemyNum = srcUser:GetRangeEnemy(3) ---------------自己3米内的敌人数量
  if skilllv_1>0 and EnemyNum==1 then
      Enemy = 1+skilllv_1*0.03
  end

  local A = ((AtkFinal*DefReduc*(1-DamReduc2)+Refine)*(damChangePer+yake)*(1-RefineDamReduc)*(1+DamIncrease)*RuneDamage-Vit2*(1+VitPer2))*kerd*Hand*Enemy*yake2

   if 1 >= A then
         return 1
   end
-------------------------------------------------------------华丽短剑   伏击后背刺双倍
      if bits[CommonFun.AttrEffect.Hualiduanjian]==1 and srcUser:HasBuffID(106110) then
           return A*1.5*2
      elseif bits[CommonFun.AttrEffect.Hualiduanjian]==1 then
           return A*1.5
      elseif srcUser:HasBuffID(106110) then
           return A*2
      end

   return A

end
-----------------------------------------------------------------------------------------------------------------------流氓 偷钱技能
function CommonFun.calcDamage_9206(srcUser, targetUser, params, damageParam, logger)

   local A = 0
   return A,CommonFun.DamageType.Normal

end
-----------------------------------------------------------------------------------------------------------------------逐影  魔力陷阱技能伤害计算公式(已改)
function CommonFun.calcDamage_9401(srcUser, targetUser, params, damageParam, logger)
  local Str = srcUser:GetProperty("Str")
  local Dex = srcUser:GetProperty("Dex")
  local Luk = srcUser:GetProperty("Luk")
  local Atk = srcUser:GetProperty("Atk")
  local AtkPer = srcUser:GetProperty("AtkPer")
  local DamIncrease = srcUser:GetProperty("DamIncrease")
  local IgnoreDef  = 0
  local IgnoreDef1 = srcUser:GetProperty("IgnoreDef")
  local IgnoreDef2 = srcUser:GetProperty("IgnoreEquipDef")
  if targetUser.boss or targetUser.mini then
     IgnoreDef=IgnoreDef1
  else
     IgnoreDef=(IgnoreDef1+IgnoreDef2)
  end

  if IgnoreDef >= 1 then
     IgnoreDef  = 1
  end

  local Refine = srcUser:GetProperty("Refine")

  local Def2 = targetUser:GetProperty("Def")
  local DefPer2 = targetUser:GetProperty("DefPer")
  local Vit2 = targetUser:GetProperty("Vit")
  local VitPer2 = targetUser:GetProperty("VitPer")
  local DamReduc2 = CommonFun.calcDamReDuc(srcUser, targetUser)
  local RefineDamReduc = targetUser:GetProperty("RefineDamReduc")
  local Hp2 = targetUser:GetProperty("Hp")
  local MaxHp2 = targetUser:GetProperty("MaxHp")

  local damChangePer = damageParam.damChangePer
  local damChangePer1 = damageParam.damChangePer1

  local AttrEffect= srcUser:GetProperty("AttrEffect")
  local bits=CommonFun.getBits(AttrEffect)

  ----------------------------------------------------------------------------------------------------------------种族，体型，属性，BOSS加伤效果
  local raceparam     = CommonFun.CalcRaceParam(srcUser, targetUser, params, damageParam, logger)
  local bodyparam     = CommonFun.CalcBodyParam(srcUser, targetUser, params, damageParam, logger)
  local elementparam  = CommonFun.CalcElementParam(srcUser, targetUser, params, damageParam, logger)
  local bossparam     = CommonFun.CalcBossParam(srcUser, targetUser, params, damageParam, logger)

  ----------------------------------------------------------------------------------------------------------------种族，体型，属性，BOSS减伤效果
  local raceparam2    = CommonFun.CalcRaceParam2(srcUser, targetUser, params, damageParam, logger)
  local bodyparam2    = CommonFun.CalcBodyParam2(srcUser, targetUser, params, damageParam, logger)
  local elementparam2 = CommonFun.CalcElementParam2(srcUser, targetUser, params, damageParam, logger)
  local bossparam2    = CommonFun.CalcBossParam2(srcUser, targetUser, params, damageParam, logger)

  local BaseAtk  = Str*2 + math.floor(Str*Str/100) + math.floor(Dex/5) + math.floor(Luk/5)
  local AtkFinal = ((Atk-BaseAtk)*(1+AtkPer)*CommonFun.ShapeCorrection(srcUser,targetUser)*bodyparam*elementparam*elementparam2+BaseAtk)*raceparam*bossparam*bossparam2

  ----------------------------物理防御减免
  local DefReduc= CommonFun.CalcDef(Def,Vit,srcUser,targetUser)
  local Int2 = targetUser:GetProperty("Int")
  ---------------------------------星盘
  local Numxp= srcUser:GetRunePoint(94050)------------星盘点
  local RuneDamage = 1 + Numxp*0.1

  local A = (((AtkFinal+Int2*damChangePer1)*DefReduc*(1-DamReduc2)+Refine)*damChangePer*(1-RefineDamReduc)*(1+DamIncrease)-Vit2*(1+VitPer2))*RuneDamage
-------------------------------------------------------------华丽短剑
      if bits[CommonFun.AttrEffect.Hualiduanjian]==1 then
           return A*1.5
      end

   return A

end
------------------------------------------------------------------------------------------------------------------诗人  远程物理伤害计算公式(已改)
function CommonFun.calcDamage_10201(srcUser, targetUser, params, damageParam, logger)
  local Str = srcUser:GetProperty("Str")
  local Dex = srcUser:GetProperty("Dex")
  local Luk = srcUser:GetProperty("Luk")
  local Atk = srcUser:GetProperty("Atk")
  local AtkPer = srcUser:GetProperty("AtkPer")
  local DamIncrease = srcUser:GetProperty("DamIncrease")
  local IgnoreDef  = 0
  local IgnoreDef1 = srcUser:GetProperty("IgnoreDef")
  local IgnoreDef2 = srcUser:GetProperty("IgnoreEquipDef")
  if targetUser.boss or targetUser.mini then
     IgnoreDef=IgnoreDef1
  else
     IgnoreDef=(IgnoreDef1+IgnoreDef2)
  end

  if IgnoreDef >= 1 then
     IgnoreDef=1
  end
   ------------------------------------------------------------------------------------将原来的物伤加成改成精炼物理攻击
  local Refine = srcUser:GetProperty("Refine")

  local AttrEffect = targetUser:GetProperty("AttrEffect")
  local bits=CommonFun.getBits(AttrEffect)

  local Def2 = targetUser:GetProperty("Def")
  local DefPer2 = targetUser:GetProperty("DefPer")
  local Vit2 = targetUser:GetProperty("Vit")
  local VitPer2 = targetUser:GetProperty("VitPer")
  local DamReduc2 = CommonFun.calcDamReDuc(srcUser, targetUser)
  local LongRangeDamReduc2 = targetUser:GetProperty("LongRangeDamReduc")
  local RefineDamReduc = targetUser:GetProperty("RefineDamReduc")

  local damChangePer = damageParam.damChangePer

  ----------------------------------------------------------------------------------------------------------------种族，体型，属性，BOSS加伤效果
  local raceparam     = CommonFun.CalcRaceParam(srcUser, targetUser, params, damageParam, logger)
  local bodyparam     = CommonFun.CalcBodyParam(srcUser, targetUser, params, damageParam, logger)
  local elementparam  = CommonFun.CalcElementParam(srcUser, targetUser, params, damageParam, logger)
  local bossparam     = CommonFun.CalcBossParam(srcUser, targetUser, params, damageParam, logger)

  ----------------------------------------------------------------------------------------------------------------种族，体型，属性，BOSS减伤效果
  local raceparam2    = CommonFun.CalcRaceParam2(srcUser, targetUser, params, damageParam, logger)
  local bodyparam2    = CommonFun.CalcBodyParam2(srcUser, targetUser, params, damageParam, logger)
  local elementparam2 = CommonFun.CalcElementParam2(srcUser, targetUser, params, damageParam, logger)
  local bossparam2    = CommonFun.CalcBossParam2(srcUser, targetUser, params, damageParam, logger)

  ----------------------------------------------------------------------------------------------------------------元素箭额外增加物理伤害
  local skillID, skillLevel = CommonFun.UnmergeSkillID(params.skillIDAndLevel)
  local skilllv_1 = srcUser:GetLernedSkillLevel(127)
  local atk_add = 0
  if skilllv_1 >10 and (skillID == 1410 or skillID==1446) then
    atk_add = Dex * ((skilllv_1-10) * 0.5)
  end
  ------------------------------------------普攻攻击力
  local NormalAtkAttr = srcUser:GetProperty("NormalAtk")
  local NormalAtk = NormalAtkAttr + 3*Dex

  local BaseAtk  = Dex*2 + math.floor(Dex*Dex/100) + math.floor(Str/5) + math.floor(Luk/5)
  local AtkFinal = ((Atk-BaseAtk+NormalAtk+atk_add)*(1+AtkPer)*CommonFun.ShapeCorrection(srcUser,targetUser)*bodyparam*elementparam*elementparam2+BaseAtk)*raceparam*bossparam*bossparam2
  -----------------------------------------物理防御减免
  local DefReduc= CommonFun.CalcDef(Def,Vit,srcUser,targetUser)
  ------------------------------------------------------------------------巅峰等级 苍鹰之眼
  local targetid = targetUser:GetGuid()
  local distance = srcUser:GetDistance(targetid)
  local skilllv_1 = srcUser:GetLernedSkillLevel(133)
  local DisDam= 1
  if skilllv_1>10 and skillID==1446 then
      DisDam = 1 + distance/7.5*(skilllv_1-10)*0.06
  end
  ---------------------------重伤箭
  local Injured = 1
  if bits[CommonFun.AttrEffect.NormalSkillDam]==1 then
      Injured = 1.3
  end
  local Num1 = srcUser:GetRunePoint(103030)
  local RuneDamage = Num1*0.01+1


  local A = (((AtkFinal*DefReduc*(1-DamReduc2)+Refine)*damChangePer)*(1-RefineDamReduc)*(1+DamIncrease-LongRangeDamReduc2)-Vit2*(1+VitPer2))*DisDam*Injured*RuneDamage

   if 1 >= A then
         return 1
   end
   --print("DisDam="..DisDam,"Injured="..Injured,"NormalAtk="..NormalAtk,"A="..A)
   return A

end

------------------------------------------------------------------------------------------------------------------舞娘  远程物理伤害计算公式(已改)
function CommonFun.calcDamage_11201(srcUser, targetUser, params, damageParam, logger)
  local Str = srcUser:GetProperty("Str")
  local Dex = srcUser:GetProperty("Dex")
  local Luk = srcUser:GetProperty("Luk")
  local Atk = srcUser:GetProperty("Atk")
  local AtkPer = srcUser:GetProperty("AtkPer")
  local DamIncrease = srcUser:GetProperty("DamIncrease")
  local IgnoreDef  = 0
  local IgnoreDef1 = srcUser:GetProperty("IgnoreDef")
  local IgnoreDef2 = srcUser:GetProperty("IgnoreEquipDef")
  if targetUser.boss or targetUser.mini then
     IgnoreDef=IgnoreDef1
  else
     IgnoreDef=(IgnoreDef1+IgnoreDef2)
  end

  if IgnoreDef >= 1 then
     IgnoreDef=1
  end
   ------------------------------------------------------------------------------------将原来的物伤加成改成精炼物理攻击
  local Refine = srcUser:GetProperty("Refine")

  local AttrEffect = targetUser:GetProperty("AttrEffect")
  local bits=CommonFun.getBits(AttrEffect)

  local Def2 = targetUser:GetProperty("Def")
  local DefPer2 = targetUser:GetProperty("DefPer")
  local Vit2 = targetUser:GetProperty("Vit")
  local VitPer2 = targetUser:GetProperty("VitPer")
  local DamReduc2 = CommonFun.calcDamReDuc(srcUser, targetUser)
  local LongRangeDamReduc2 = targetUser:GetProperty("LongRangeDamReduc")
  local RefineDamReduc = targetUser:GetProperty("RefineDamReduc")

  local damChangePer = damageParam.damChangePer

  ----------------------------------------------------------------------------------------------------------------种族，体型，属性，BOSS加伤效果
  local raceparam     = CommonFun.CalcRaceParam(srcUser, targetUser, params, damageParam, logger)
  local bodyparam     = CommonFun.CalcBodyParam(srcUser, targetUser, params, damageParam, logger)
  local elementparam  = CommonFun.CalcElementParam(srcUser, targetUser, params, damageParam, logger)
  local bossparam     = CommonFun.CalcBossParam(srcUser, targetUser, params, damageParam, logger)

  ----------------------------------------------------------------------------------------------------------------种族，体型，属性，BOSS减伤效果
  local raceparam2    = CommonFun.CalcRaceParam2(srcUser, targetUser, params, damageParam, logger)
  local bodyparam2    = CommonFun.CalcBodyParam2(srcUser, targetUser, params, damageParam, logger)
  local elementparam2 = CommonFun.CalcElementParam2(srcUser, targetUser, params, damageParam, logger)
  local bossparam2    = CommonFun.CalcBossParam2(srcUser, targetUser, params, damageParam, logger)

  ----------------------------------------------------------------------------------------------------------------元素箭额外增加物理伤害
  local skillID, skillLevel = CommonFun.UnmergeSkillID(params.skillIDAndLevel)
  local skilllv_1 = srcUser:GetLernedSkillLevel(127)
  local atk_add = 0
  if skilllv_1 >10 and (skillID == 1360 or skillID==1397) then
    atk_add = Dex * ((skilllv_1-10) * 0.5)
  end
  ------------------------------------------普攻攻击力
  local NormalAtkAttr = srcUser:GetProperty("NormalAtk")
  local NormalAtk = NormalAtkAttr + 3*Dex

  local BaseAtk  = Dex*2 + math.floor(Dex*Dex/100) + math.floor(Str/5) + math.floor(Luk/5)
  local AtkFinal = ((Atk-BaseAtk+NormalAtk+atk_add)*(1+AtkPer)*CommonFun.ShapeCorrection(srcUser,targetUser)*bodyparam*elementparam*elementparam2+BaseAtk)*raceparam*bossparam*bossparam2
  -----------------------------------------物理防御减免
  local DefReduc= CommonFun.CalcDef(Def,Vit,srcUser,targetUser)
  ------------------------------------------------------------------------巅峰等级 苍鹰之眼
  local targetid = targetUser:GetGuid()
  local distance = srcUser:GetDistance(targetid)
  local skilllv_1 = srcUser:GetLernedSkillLevel(133)
  local DisDam= 1
  if skilllv_1>10 and skillID==1397 then
      DisDam = 1 + distance/7.5*(skilllv_1-10)*0.06
  end
  ---------------------------重伤箭
  local Injured = 1
  if bits[CommonFun.AttrEffect.NormalSkillDam]==1 then
      Injured = 1.3
  end
  local Num1 = srcUser:GetRunePoint(103030)
  local RuneDamage = Num1*0.01+1

  local A = (((AtkFinal*DefReduc*(1-DamReduc2)+Refine)*damChangePer)*(1-RefineDamReduc)*(1+DamIncrease-LongRangeDamReduc2)-Vit2*(1+VitPer2))*DisDam*Injured*RuneDamage

   if 1 >= A then
         return 1
   end
   --print("DisDam="..DisDam,"Injured="..Injured,"NormalAtk="..NormalAtk,"A="..A)
   return A

end
------------------------------------------------------------------------------------------------------------------振动回响 陷阱技能伤害计算公式
function CommonFun.calcDamage_11202(srcUser, targetUser, params, damageParam, logger)
  local BaseLv = srcUser.BaseLv
  local Str = srcUser:GetProperty("Str")
  local Dex = srcUser:GetProperty("Dex")
  local Luk = srcUser:GetProperty("Luk")
  local Int = srcUser:GetProperty("Int")
  local Atk = srcUser:GetProperty("Atk")
  local AtkPer = srcUser:GetProperty("AtkPer")
  local MDamIncrease = CommonFun.calcMDamIncrease(srcUser, targetUser)
  local RefineMDamReduc = targetUser:GetProperty("RefineMDamReduc")
  local IgnoreDef  = 0
  local IgnoreDef1 = srcUser:GetProperty("IgnoreDef")
  local IgnoreDef2 = srcUser:GetProperty("IgnoreEquipDef")
  if targetUser.boss or targetUser.mini then
     IgnoreDef=IgnoreDef1
  else
     IgnoreDef=(IgnoreDef1+IgnoreDef2)
  end

  if IgnoreDef >= 1 then
     IgnoreDef  = 1
  end

  local srcAtkElement    = CommonFun.GetUserAtkAttr(srcUser, params, damageParam)
  local targetDefElement = targetUser:GetProperty("DefAttr")

  local damChangePer = damageParam.damChangePer
  ----------------------------------------------------------------------------------------------------------------法系职业伤害会受到种族加伤减伤影响
  local raceparam     = CommonFun.CalcRaceParam(srcUser, targetUser, params, damageParam, logger)
  local elementparam2 = CommonFun.CalcElementParam2(srcUser, targetUser, params, damageParam, logger)
  local bossparam     = CommonFun.CalcBossParam(srcUser, targetUser, params, damageParam, logger)
  local bossparam2    = CommonFun.CalcBossParam2(srcUser, targetUser, params, damageParam, logger)

  local MDef2 = targetUser:GetProperty("MDef")
  local MDefPer2 = targetUser:GetProperty("MDefPer")

  local MDamReduc2 = CommonFun.calcMDamReDuc(srcUser, targetUser)
  local RefineMDamReduc = targetUser:GetProperty("RefineMDamReduc")

  local damChangePer = damageParam.damChangePer

  local BaseAtk  = Dex*2 + math.floor(Dex*Dex/100) + math.floor(Str/5) + math.floor(Luk/5)
  local AtkFinal = ((Atk-BaseAtk)*(1+AtkPer)+BaseAtk)*raceparam*bossparam*bossparam2
  local Refine = srcUser:GetProperty("Refine")
  ----------------------------魔法防御减免
  local MDefReduc = CommonFun.CalcMDef(MDef,Int,Vit,srcUser,targetUser)

  local A = (AtkFinal*MDefReduc*(1-MDamReduc2)+Refine)*damChangePer*(1-RefineMDamReduc)*(1+MDamIncrease)*GameConfig.ElementRestrain[srcAtkElement][targetDefElement]*elementparam2

  if 1 >= A then
    return 1
  end
----------------------------------------------------------------------------振动领域
  local skilllv_1 = srcUser:GetLernedSkillLevel(1387)---舞娘
  local skilllv_2 = srcUser:GetLernedSkillLevel(1436)---诗人

  local AttrEffect = srcUser:GetProperty("AttrEffect")
  local bits=CommonFun.getBits(AttrEffect)

  if bits[CommonFun.AttrEffect.TriggerTrapMark]==1 then
      return A*(1+(skilllv_1+skilllv_2)*0.2)
  end

      return A
end

------------------------------------------------------------------------------------------------------------------舞娘  远程物理  技能 伤害计算公式(已改)
function CommonFun.calcDamage_11203(srcUser, targetUser, params, damageParam, logger)
  local Str = srcUser:GetProperty("Str")
  local Dex = srcUser:GetProperty("Dex")
  local Luk = srcUser:GetProperty("Luk")
  local Atk = srcUser:GetProperty("Atk")
  local AtkPer = srcUser:GetProperty("AtkPer")
  local DamIncrease = srcUser:GetProperty("DamIncrease")
  local IgnoreDef  = 0
  local IgnoreDef1 = srcUser:GetProperty("IgnoreDef")
  local IgnoreDef2 = srcUser:GetProperty("IgnoreEquipDef")
  if targetUser.boss or targetUser.mini then
     IgnoreDef=IgnoreDef1
  else
     IgnoreDef=(IgnoreDef1+IgnoreDef2)
  end

  if IgnoreDef >= 1 then
     IgnoreDef=1
  end
   ------------------------------------------------------------------------------------将原来的物伤加成改成精炼物理攻击
  local Refine = srcUser:GetProperty("Refine")

  local AttrEffect = targetUser:GetProperty("AttrEffect")
  local bits=CommonFun.getBits(AttrEffect)

  local Def2 = targetUser:GetProperty("Def")
  local DefPer2 = targetUser:GetProperty("DefPer")
  local Vit2 = targetUser:GetProperty("Vit")
  local VitPer2 = targetUser:GetProperty("VitPer")
  local DamReduc2 = CommonFun.calcDamReDuc(srcUser, targetUser)
  local LongRangeDamReduc2 = targetUser:GetProperty("LongRangeDamReduc")
  local RefineDamReduc = targetUser:GetProperty("RefineDamReduc")

  local damChangePer = damageParam.damChangePer

  ----------------------------------------------------------------------------------------------------------------种族，体型，属性，BOSS加伤效果
  local raceparam     = CommonFun.CalcRaceParam(srcUser, targetUser, params, damageParam, logger)
  local bodyparam     = CommonFun.CalcBodyParam(srcUser, targetUser, params, damageParam, logger)
  local elementparam  = CommonFun.CalcElementParam(srcUser, targetUser, params, damageParam, logger)
  local bossparam     = CommonFun.CalcBossParam(srcUser, targetUser, params, damageParam, logger)

  ----------------------------------------------------------------------------------------------------------------种族，体型，属性，BOSS减伤效果
  local raceparam2    = CommonFun.CalcRaceParam2(srcUser, targetUser, params, damageParam, logger)
  local bodyparam2    = CommonFun.CalcBodyParam2(srcUser, targetUser, params, damageParam, logger)
  local elementparam2 = CommonFun.CalcElementParam2(srcUser, targetUser, params, damageParam, logger)
  local bossparam2    = CommonFun.CalcBossParam2(srcUser, targetUser, params, damageParam, logger)

  ----------------------------------------------------------------------------------------------------------------
  local skillID, skillLevel = CommonFun.UnmergeSkillID(params.skillIDAndLevel)
  -----------------------------------------------------------------------------------缠箭投掷、乐器攻击星盘
  local RuneDamage =1
  if skillID == 1364 or skillID == 1414 then
      local Num1 = srcUser:GetRunePoint(102015)----乐器攻击
      local Num2 = srcUser:GetRunePoint(112007)----缠箭投掷
      RuneDamage = 1 + (Num1+Num2)*0.08
  end
  ------------------------------------------------------------------------------------奥义箭乱舞  星盘
  local AtkSp= 0
  if skillID == 1373 or skillID == 1423 then
      local Num3 = srcUser:GetRunePoint(102026)
      local Num4 = srcUser:GetRunePoint(102027)
      local Sp = srcUser:GetProperty("Sp")
      RuneDamage = 1+Num3*0.06
      AtkSp = math.floor(Sp/10)*Num4
  end

  local BaseAtk  = Dex*2 + math.floor(Dex*Dex/100) + math.floor(Str/5) + math.floor(Luk/5)
  local AtkFinal = ((Atk-BaseAtk+AtkSp)*(1+AtkPer)*CommonFun.ShapeCorrection(srcUser,targetUser)*bodyparam*elementparam*elementparam2+BaseAtk)*raceparam*bossparam*bossparam2
  -----------------------------------------物理防御减免
  local DefReduc= CommonFun.CalcDef(Def,Vit,srcUser,targetUser)


  local A = (((AtkFinal*DefReduc*(1-DamReduc2)+Refine)*damChangePer)*(1-RefineDamReduc)*(1+DamIncrease-LongRangeDamReduc2)-Vit2*(1+VitPer2))*RuneDamage

   if 1 >= A then
         return 1
   end

   return A

end
------------------------------------------------------------------------------------------------------------------金属摇滚 技能伤害计算公式
function CommonFun.calcDamage_11204(srcUser, targetUser, params, damageParam, logger)
  local BaseLv = srcUser.BaseLv
  local Str = srcUser:GetProperty("Str")
  local Dex = srcUser:GetProperty("Dex")
  local Luk = srcUser:GetProperty("Luk")
  local Int = srcUser:GetProperty("Int")
  local Atk = srcUser:GetProperty("Atk")
  local AtkPer = srcUser:GetProperty("AtkPer")
  local MDamIncrease = CommonFun.calcMDamIncrease(srcUser, targetUser)
  local RefineMDamReduc = targetUser:GetProperty("RefineMDamReduc")
  local IgnoreDef  = 0
  local IgnoreDef1 = srcUser:GetProperty("IgnoreDef")
  local IgnoreDef2 = srcUser:GetProperty("IgnoreEquipDef")
  if targetUser.boss or targetUser.mini then
     IgnoreDef=IgnoreDef1
  else
     IgnoreDef=(IgnoreDef1+IgnoreDef2)
  end

  if IgnoreDef >= 1 then
     IgnoreDef  = 1
  end

  local srcAtkElement    = CommonFun.GetUserAtkAttr(srcUser, params, damageParam)
  local targetDefElement = targetUser:GetProperty("DefAttr")

  local damChangePer = damageParam.damChangePer
  ----------------------------------------------------------------------------------------------------------------法系职业伤害会受到种族加伤减伤影响
  local raceparam     = CommonFun.CalcRaceParam(srcUser, targetUser, params, damageParam, logger)
  local elementparam2 = CommonFun.CalcElementParam2(srcUser, targetUser, params, damageParam, logger)
  local bossparam     = CommonFun.CalcBossParam(srcUser, targetUser, params, damageParam, logger)
  local bossparam2    = CommonFun.CalcBossParam2(srcUser, targetUser, params, damageParam, logger)

  local MDef2 = targetUser:GetProperty("MDef")
  local MDefPer2 = targetUser:GetProperty("MDefPer")

  local MDamReduc2 = CommonFun.calcMDamReDuc(srcUser, targetUser)
  local RefineMDamReduc = targetUser:GetProperty("RefineMDamReduc")

  local damChangePer = damageParam.damChangePer

  local BaseAtk  = Dex*2 + math.floor(Dex*Dex/100) + math.floor(Str/5) + math.floor(Luk/5)
  local AtkFinal = ((Atk-BaseAtk)*(1+AtkPer)+BaseAtk)*raceparam*bossparam*bossparam2
  local Refine = srcUser:GetProperty("Refine")
  ----------------------------魔法防御减免
  local MDefReduc = CommonFun.CalcMDef(MDef,Int,Vit,srcUser,targetUser)

  local A = (AtkFinal*MDefReduc*(1-MDamReduc2)+Refine)*damChangePer*(1-RefineMDamReduc)*(1+MDamIncrease)*GameConfig.ElementRestrain[srcAtkElement][targetDefElement]*elementparam2

  if 1 >= A then
    return 1
  end
----------------------------------------------------------------------------演奏课程
  local skilllv_1 = srcUser:GetLernedSkillLevel(1388)---舞娘
  local skilllv_2 = srcUser:GetLernedSkillLevel(1437)---诗人

  A = A * (1 + 0.05*(skilllv_1 + skilllv_2))

  return A
end
-----------------------------------------------------------------------------------------------------------------武僧弹指神通技能伤害计算公式(已改)
function CommonFun.calcDamage_12201(srcUser, targetUser, params, damageParam, logger)
  local Str = srcUser:GetProperty("Str")
  local Dex = srcUser:GetProperty("Dex")
  local Luk = srcUser:GetProperty("Luk")
  local Atk = srcUser:GetProperty("Atk")
  local AtkPer = srcUser:GetProperty("AtkPer")
  local DamIncrease = srcUser:GetProperty("DamIncrease")
  local IgnoreDef  = 0
  local IgnoreDef1 = srcUser:GetProperty("IgnoreDef")
  local IgnoreDef2 = srcUser:GetProperty("IgnoreEquipDef")
  if targetUser.boss or targetUser.mini then
     IgnoreDef=IgnoreDef1
  else
     IgnoreDef=(IgnoreDef1+IgnoreDef2)
  end

  if IgnoreDef >= 1 then
     IgnoreDef=1
  end
    ------------------------------------------------------------------------------------将原来的物伤加成改成精炼物理攻击
  local Refine = srcUser:GetProperty("Refine")

  local Def2 = targetUser:GetProperty("Def")
  local DefPer2 = targetUser:GetProperty("DefPer")
  local Vit2 = targetUser:GetProperty("Vit")
  local VitPer2 = targetUser:GetProperty("VitPer")
  local DamReduc2 = CommonFun.calcDamReDuc(srcUser, targetUser)
  local RefineDamReduc = targetUser:GetProperty("RefineDamReduc")

  local damChangePer = damageParam.damChangePer

  ----------------------------------------------------------------------------------------------------------------种族，体型，属性，BOSS加伤效果
  local raceparam     = CommonFun.CalcRaceParam(srcUser, targetUser, params, damageParam, logger)
  local bodyparam     = CommonFun.CalcBodyParam(srcUser, targetUser, params, damageParam, logger)
  local elementparam  = CommonFun.CalcElementParam(srcUser, targetUser, params, damageParam, logger)
  local bossparam     = CommonFun.CalcBossParam(srcUser, targetUser, params, damageParam, logger)

  ----------------------------------------------------------------------------------------------------------------种族，体型，属性，BOSS减伤效果
  local raceparam2    = CommonFun.CalcRaceParam2(srcUser, targetUser, params, damageParam, logger)
  local bodyparam2    = CommonFun.CalcBodyParam2(srcUser, targetUser, params, damageParam, logger)
  local elementparam2 = CommonFun.CalcElementParam2(srcUser, targetUser, params, damageParam, logger)
  local bossparam2    = CommonFun.CalcBossParam2(srcUser, targetUser, params, damageParam, logger)



  local BaseAtk  = Str*2 + math.floor(Str*Str/100) + math.floor(Dex/5) + math.floor(Luk/5)
  local AtkFinal = ((Atk-BaseAtk)*(1+AtkPer)*CommonFun.ShapeCorrection(srcUser,targetUser)*bodyparam*elementparam*elementparam2+BaseAtk)*raceparam*bossparam*bossparam2

  ----------------------------物理防御减免
  local DefReduc= CommonFun.CalcDef(Def,Vit,srcUser,targetUser)

  local Num1 = srcUser:GetBuffLayer(100500)--------------------------弹指神通气弹数
        Num1 = math.min(Num1,5)---------------最多5个
  local skilllv_1 = srcUser:GetLernedSkillLevel(322)---------------气弹精修
  local Num2 = Num1*skilllv_1*0.01+1

  local A = ((AtkFinal*DefReduc*(1-DamReduc2)+Refine)*damChangePer*(1-RefineDamReduc)*(1+DamIncrease)-Vit2*(1+VitPer2))*Num1*Num2
  local B = 0
  ---------------------------------------------------------------------------------------------------------------------------------------------------星盘弹指神通附带魔法伤害
  local Num1 = srcUser:GetRunePoint(120130)
  local RuneDamage = Num1*0.1

  if Num1 > 0 then

    local srcAtkElement    = 5
    local targetDefElement = targetUser:GetProperty("DefAttr")
    local Int = srcUser:GetProperty("Int")
    local MAtk = srcUser:GetProperty("MAtk")
    local MAtkPer = srcUser:GetProperty("MAtkPer")
    local IgnoreMDef = srcUser:GetProperty("IgnoreMDef")
    local BaseMAtk = Int+math.floor(Int*Int/100)
    local MDef2 = targetUser:GetProperty("MDef")
    local MDefPer2 = targetUser:GetProperty("MDefPer")
    local Vit2 = targetUser:GetProperty("Vit")
    local VitPer2 = targetUser:GetProperty("VitPer")
    local Int2 = targetUser:GetProperty("Int")
    local IntPer2 = targetUser:GetProperty("IntPer")
    local MDamReduc2 = CommonFun.calcMDamReDuc(srcUser, targetUser)
    local RefineMDamReduc = targetUser:GetProperty("RefineMDamReduc")
    local MDamIncrease = CommonFun.calcMDamIncrease(srcUser, targetUser)
    local MRefine = srcUser:GetProperty("MRefine")

    local MAtkFinal= ((MAtk-BaseMAtk)*(1+MAtkPer)+BaseMAtk)*raceparam*RuneDamage

    ----------------------------魔法防御减免
    local MDefReduc = CommonFun.CalcMDef(MDef,Int,Vit,srcUser,targetUser)

    B = ((MAtkFinal*MDefReduc*(1-MDamReduc2)+MRefine)*damChangePer*(1-RefineMDamReduc)*(1+MDamIncrease)*GameConfig.ElementRestrain[srcAtkElement][targetDefElement]*elementparam2-Vit2/2*(1+VitPer2)-Int2*(1+IntPer2))
  end

   if 1 >= B then
        B = 0
   end

   if 1 >= (A + B) then
         return 1
   end

   return A + B
end

-----------------------------------------------------------------------------------------------------------------武僧阿修罗霸凰拳技能伤害计算公式(已改)
function CommonFun.calcDamage_12202(srcUser, targetUser, params, damageParam, logger)
  local Str = srcUser:GetProperty("Str")
  local Dex = srcUser:GetProperty("Dex")
  local Luk = srcUser:GetProperty("Luk")
  local Atk = srcUser:GetProperty("Atk")
  local AtkPer = srcUser:GetProperty("AtkPer")
  local DamIncrease = srcUser:GetProperty("DamIncrease")
  local Sp = srcUser:GetProperty("Sp")
  local IgnoreDef  = 0
  local IgnoreDef1 = srcUser:GetProperty("IgnoreDef")
  local IgnoreDef2 = srcUser:GetProperty("IgnoreEquipDef")
  if targetUser.boss or targetUser.mini then
     IgnoreDef=IgnoreDef1
  else
     IgnoreDef=(IgnoreDef1+IgnoreDef2)
  end

  if IgnoreDef >= 1 then
     IgnoreDef=1
  end
    ------------------------------------------------------------------------------------将原来的物伤加成改成精炼物理攻击
  local Refine = srcUser:GetProperty("Refine")

  local Def2 = targetUser:GetProperty("Def")
  local DefPer2 = targetUser:GetProperty("DefPer")
  local Vit2 = targetUser:GetProperty("Vit")
  local VitPer2 = targetUser:GetProperty("VitPer")
  local RefineDamReduc = targetUser:GetProperty("RefineDamReduc")

  local damChangePer = damageParam.damChangePer
  local damChangePer1 = damageParam.damChangePer1
  ---------------------------------------------------------------------------物理减免
    local DamSpike = srcUser:GetProperty("DamSpike")
    local DamReduc = targetUser:GetProperty("DamReduc")
    ReduceLv = CommonFun.calcSpikeLv(srcUser, targetUser) -----穿刺等级
    local SkillDamReduc = CommonFun.calcSkillDamReduc(srcUser, targetUser)----技能物理伤害减免
    local DamReduc2 =1- (1 + 0.009*ReduceLv + DamSpike - DamReduc)*SkillDamReduc
    -----------------------------------------------------------------------阿修罗霸皇拳  巅峰等级 无视部分减伤
    local skilllv = srcUser:GetLernedSkillLevel(306)
    if skilllv>5 then
        DamReduc2 =1- (1 + 0.009*ReduceLv + DamSpike - math.max(DamReduc-0.06*(skilllv-5),0))
    end
  ----------------------------------------------------------------------------------------------------------------种族，体型，属性，BOSS加伤效果
  local raceparam     = CommonFun.CalcRaceParam(srcUser, targetUser, params, damageParam, logger)
  local bodyparam     = CommonFun.CalcBodyParam(srcUser, targetUser, params, damageParam, logger)
  local elementparam  = CommonFun.CalcElementParam(srcUser, targetUser, params, damageParam, logger)
  local bossparam     = CommonFun.CalcBossParam(srcUser, targetUser, params, damageParam, logger)

  ----------------------------------------------------------------------------------------------------------------种族，体型，属性，BOSS减伤效果
  local raceparam2    = CommonFun.CalcRaceParam2(srcUser, targetUser, params, damageParam, logger)
  local bodyparam2    = CommonFun.CalcBodyParam2(srcUser, targetUser, params, damageParam, logger)
  local elementparam2 = CommonFun.CalcElementParam2(srcUser, targetUser, params, damageParam, logger)
  local bossparam2    = CommonFun.CalcBossParam2(srcUser, targetUser, params, damageParam, logger)
  ------------------------------------------------------星盘
  local Num1 = srcUser:GetRunePoint(120100)
  local RuneDamage = Num1*0.6
  ---------------------------------------------装备 阿修罗
  local a = 0
  local b = 0
  local c = 0
  local d = 0
  local Equip1=srcUser:GetEquipedID(7)----鹰爪
  local Equip3=srcUser:GetEquipedID(5)----坚定指环
  local Equip4=srcUser:GetEquipedID(6)----坚定指环

  if Equip1 == 62508 or Equip1 == 162508 then
     a = 5
  end
  ---------------------------------------------装备格里芬之爪
  if Equip1 == 62540 or Equip1 == 162540 then
     a = 5
  end
  if srcUser:HasBuffID(90000935) then----坚定战袍升级buff
     b = 2
  end
  if Equip3 == 44003 or Equip3 == 144003 then
     c =1.5
  end
  if Equip4 == 44003 or Equip4 == 144003 then
     d =1.5
  end
  local BaseAtk   = Str*2 + math.floor(Str*Str/100)   + math.floor(Dex/5) + math.floor(Luk/5)
  local BaseAtk1  = Str*4 + math.floor(Str*Str/100)*2   + math.floor(Dex/5) + math.floor(Luk/5)
  local AtkFinal = ((Atk-BaseAtk)*(1+AtkPer)*CommonFun.ShapeCorrection(srcUser,targetUser)*bodyparam*elementparam*elementparam2+BaseAtk1)*raceparam*bossparam*bossparam2

  local A = ((AtkFinal*(1 - DamReduc2) + Refine)*(damChangePer + Sp/100 + RuneDamage + a + b + c + d)+2500+500*damChangePer1)*(1+DamIncrease)*(1-RefineDamReduc)

   if 1 >= A then
         return 1
   end


   return A
end

-----------------------------------------------------------------------------------------------------------------武僧浸透劲技能伤害计算公式(已改)
function CommonFun.calcDamage_12203(srcUser, targetUser, params, damageParam, logger)
  local Str = srcUser:GetProperty("Str")
  local Dex = srcUser:GetProperty("Dex")
  local Luk = srcUser:GetProperty("Luk")
  local Atk = srcUser:GetProperty("Atk")
  local AtkPer = srcUser:GetProperty("AtkPer")
  local DamIncrease = srcUser:GetProperty("DamIncrease")
  local Sp = srcUser:GetProperty("Sp")
  local IgnoreDef  = 0
  local IgnoreDef1 = srcUser:GetProperty("IgnoreDef")
  local IgnoreDef2 = srcUser:GetProperty("IgnoreEquipDef")
  if targetUser.boss or targetUser.mini then
     IgnoreDef=IgnoreDef1
  else
     IgnoreDef=(IgnoreDef1+IgnoreDef2)
  end

  if IgnoreDef >= 1 then
     IgnoreDef=1
  end
    ------------------------------------------------------------------------------------将原来的物伤加成改成精炼物理攻击
  local Refine = srcUser:GetProperty("Refine")

  local Def2 = targetUser:GetProperty("Def")
  local DefPer2 = targetUser:GetProperty("DefPer")
  local Vit2 = targetUser:GetProperty("Vit")
  local VitPer2 = targetUser:GetProperty("VitPer")
  local DamReduc2 = CommonFun.calcDamReDuc(srcUser, targetUser)
  local RefineDamReduc = targetUser:GetProperty("RefineDamReduc")

  local damChangePer = damageParam.damChangePer

  ----------------------------------------------------------------------------------------------------------------种族，体型，属性，BOSS加伤效果
  local raceparam     = CommonFun.CalcRaceParam(srcUser, targetUser, params, damageParam, logger)
  local bodyparam     = CommonFun.CalcBodyParam(srcUser, targetUser, params, damageParam, logger)
  local elementparam  = CommonFun.CalcElementParam(srcUser, targetUser, params, damageParam, logger)
  local bossparam     = CommonFun.CalcBossParam(srcUser, targetUser, params, damageParam, logger)

  ----------------------------------------------------------------------------------------------------------------种族，体型，属性，BOSS减伤效果
  local raceparam2    = CommonFun.CalcRaceParam2(srcUser, targetUser, params, damageParam, logger)
  local bodyparam2    = CommonFun.CalcBodyParam2(srcUser, targetUser, params, damageParam, logger)
  local elementparam2 = CommonFun.CalcElementParam2(srcUser, targetUser, params, damageParam, logger)
  local bossparam2    = CommonFun.CalcBossParam2(srcUser, targetUser, params, damageParam, logger)



  local BaseAtk  = Str*2 + math.floor(Str*Str/100) + math.floor(Dex/5) + math.floor(Luk/5)
  local AtkFinal = ((Atk-BaseAtk)*(1+AtkPer)*CommonFun.ShapeCorrection(srcUser,targetUser)*bodyparam*elementparam*elementparam2+BaseAtk)*raceparam*bossparam*bossparam2
  local DefFinal = (Def2-Vit2)*(1+DefPer2)+ Vit2*(1+VitPer2)
  if DefFinal >= 800 then
     DefFinal  = 800
  end

  local A = (AtkFinal*(1 - DamReduc2) + Refine) * (2 + 1.5*damChangePer + DefFinal/120)*(1+DamIncrease)*(1-RefineDamReduc)
  local B = 0
  ---------------------------------------------------------------------------------------------------------------------------------------------------星盘浸透劲附带魔法伤害
  local Num1 = srcUser:GetRunePoint(120220)
  local RuneDamage = Num1*0.1

  if Num1 > 0 then

    local srcAtkElement    = 5
    local targetDefElement = targetUser:GetProperty("DefAttr")
    local Int = srcUser:GetProperty("Int")
    local MAtk = srcUser:GetProperty("MAtk")
    local MAtkPer = srcUser:GetProperty("MAtkPer")
    local IgnoreMDef = srcUser:GetProperty("IgnoreMDef")
    local BaseMAtk = Int+math.floor(Int*Int/100)
    local MDef2 = targetUser:GetProperty("MDef")
    local MDefPer2 = targetUser:GetProperty("MDefPer")
    local Vit2 = targetUser:GetProperty("Vit")
    local VitPer2 = targetUser:GetProperty("VitPer")
    local Int2 = targetUser:GetProperty("Int")
    local IntPer2 = targetUser:GetProperty("IntPer")
    local MDamReduc2 = CommonFun.calcMDamReDuc(srcUser, targetUser)
    local MDamIncrease = CommonFun.calcMDamIncrease(srcUser, targetUser)
    local RefineMDamReduc = targetUser:GetProperty("RefineMDamReduc")
    local MRefine = srcUser:GetProperty("MRefine")

    local MAtkFinal= ((MAtk-BaseMAtk)*(1+MAtkPer)+BaseMAtk)*raceparam*RuneDamage

    ----------------------------魔法防御减免
    local MDefReduc = CommonFun.CalcMDef(MDef,Int,Vit,srcUser,targetUser)

     B = ((MAtkFinal*MDefReduc*(1-MDamReduc2)+MRefine)*(1-RefineMDamReduc)*damChangePer*(1+MDamIncrease)*GameConfig.ElementRestrain[srcAtkElement][targetDefElement]*elementparam2-Vit2/2*(1+VitPer2)-Int2*(1+IntPer2))
  end

   if 1 >= B then
      B = 0
   end

   if 1 >= (A + B) then
         return 1
   end

   return A + B
end

-----------------------------------------------------------------------------------------------------------------近战武僧系六合拳技能伤害计算公式(已改)
function CommonFun.calcDamage_12204(srcUser, targetUser, params, damageParam, logger)
  local Str = srcUser:GetProperty("Str")
  local Dex = srcUser:GetProperty("Dex")
  local Luk = srcUser:GetProperty("Luk")
  local Atk = srcUser:GetProperty("Atk")
  local AtkPer = srcUser:GetProperty("AtkPer")
  local DamIncrease = srcUser:GetProperty("DamIncrease")
  local IgnoreDef  = 0
  local IgnoreDef1 = srcUser:GetProperty("IgnoreDef")
  local IgnoreDef2 = srcUser:GetProperty("IgnoreEquipDef")
  if targetUser.boss or targetUser.mini then
     IgnoreDef=IgnoreDef1
  else
     IgnoreDef=(IgnoreDef1+IgnoreDef2)
  end

  if IgnoreDef >= 1 then
     IgnoreDef=1
  end
    ------------------------------------------------------------------------------------将原来的物伤加成改成精炼物理攻击
  local Refine = srcUser:GetProperty("Refine")

  local Def2 = targetUser:GetProperty("Def")
  local DefPer2 = targetUser:GetProperty("DefPer")
  local Vit2 = targetUser:GetProperty("Vit")
  local VitPer2 = targetUser:GetProperty("VitPer")
  local DamReduc2 = CommonFun.calcDamReDuc(srcUser, targetUser)
  local RefineDamReduc = targetUser:GetProperty("RefineDamReduc")

  local damChangePer = damageParam.damChangePer

  ----------------------------------------------------------------------------------------------------------------种族，体型，属性，BOSS加伤效果
  local raceparam     = CommonFun.CalcRaceParam(srcUser, targetUser, params, damageParam, logger)
  local bodyparam     = CommonFun.CalcBodyParam(srcUser, targetUser, params, damageParam, logger)
  local elementparam  = CommonFun.CalcElementParam(srcUser, targetUser, params, damageParam, logger)
  local bossparam     = CommonFun.CalcBossParam(srcUser, targetUser, params, damageParam, logger)

  ----------------------------------------------------------------------------------------------------------------种族，体型，属性，BOSS减伤效果
  local raceparam2    = CommonFun.CalcRaceParam2(srcUser, targetUser, params, damageParam, logger)
  local bodyparam2    = CommonFun.CalcBodyParam2(srcUser, targetUser, params, damageParam, logger)
  local elementparam2 = CommonFun.CalcElementParam2(srcUser, targetUser, params, damageParam, logger)
  local bossparam2    = CommonFun.CalcBossParam2(srcUser, targetUser, params, damageParam, logger)



  local BaseAtk  = Str*2 + math.floor(Str*Str/100) + math.floor(Dex/5) + math.floor(Luk/5)
  local AtkFinal = ((Atk-BaseAtk)*(1+AtkPer)*CommonFun.ShapeCorrection(srcUser,targetUser)*bodyparam*elementparam*elementparam2+BaseAtk)*raceparam*bossparam*bossparam2

  ----------------------------物理防御减免
  local DefReduc= CommonFun.CalcDef(Def,Vit,srcUser,targetUser)

  local Num1 = srcUser:GetRunePoint(120110)
  local RuneDamage = 1 + Num1*0.1

  local A = ((AtkFinal*DefReduc*(1-DamReduc2)+Refine)*damChangePer*(1-RefineDamReduc)*(1+DamIncrease)-Vit2*(1+VitPer2))*RuneDamage

   if 1 >= A then
         return 1
   end

   if srcUser:HasBuffID(24890) then
      return A*1.15
   elseif srcUser:HasBuffID(24910) then
      return A*1.1
   end

   return A
end

-----------------------------------------------------------------------------------------------------------------近战武僧连环全身掌技能伤害计算公式(已改)
function CommonFun.calcDamage_12205(srcUser, targetUser, params, damageParam, logger)
  local Str = srcUser:GetProperty("Str")
  local Dex = srcUser:GetProperty("Dex")
  local Vit = srcUser:GetProperty("Vit")
  local Luk = srcUser:GetProperty("Luk")
  local Atk = srcUser:GetProperty("Atk")
  local AtkPer = srcUser:GetProperty("AtkPer")
  local DamIncrease = srcUser:GetProperty("DamIncrease")
  local IgnoreDef  = 0
  local IgnoreDef1 = srcUser:GetProperty("IgnoreDef")
  local IgnoreDef2 = srcUser:GetProperty("IgnoreEquipDef")
  if targetUser.boss or targetUser.mini then
     IgnoreDef=IgnoreDef1
  else
     IgnoreDef=(IgnoreDef1+IgnoreDef2)
  end

  if IgnoreDef >= 1 then
     IgnoreDef=1
  end
    ------------------------------------------------------------------------------------将原来的物伤加成改成精炼物理攻击
  local Refine = srcUser:GetProperty("Refine")

  local Def2 = targetUser:GetProperty("Def")
  local DefPer2 = targetUser:GetProperty("DefPer")
  local Vit2 = targetUser:GetProperty("Vit")
  local VitPer2 = targetUser:GetProperty("VitPer")
  local DamReduc2 = CommonFun.calcDamReDuc(srcUser, targetUser)
  local RefineDamReduc = targetUser:GetProperty("RefineDamReduc")

  local damChangePer = damageParam.damChangePer

  ----------------------------------------------------------------------------------------------------------------种族，体型，属性，BOSS加伤效果
  local raceparam     = CommonFun.CalcRaceParam(srcUser, targetUser, params, damageParam, logger)
  local bodyparam     = CommonFun.CalcBodyParam(srcUser, targetUser, params, damageParam, logger)
  local elementparam  = CommonFun.CalcElementParam(srcUser, targetUser, params, damageParam, logger)
  local bossparam     = CommonFun.CalcBossParam(srcUser, targetUser, params, damageParam, logger)

  ----------------------------------------------------------------------------------------------------------------种族，体型，属性，BOSS减伤效果
  local raceparam2    = CommonFun.CalcRaceParam2(srcUser, targetUser, params, damageParam, logger)
  local bodyparam2    = CommonFun.CalcBodyParam2(srcUser, targetUser, params, damageParam, logger)
  local elementparam2 = CommonFun.CalcElementParam2(srcUser, targetUser, params, damageParam, logger)
  local bossparam2    = CommonFun.CalcBossParam2(srcUser, targetUser, params, damageParam, logger)



  local BaseAtk  = Str*2 + math.floor(Str*Str/100) + math.floor(Dex/5) + math.floor(Luk/5)
  local AtkFinal = ((Atk-BaseAtk)*(1+AtkPer)*CommonFun.ShapeCorrection(srcUser,targetUser)*bodyparam*elementparam*elementparam2+BaseAtk)*raceparam*bossparam*bossparam2

  ----------------------------物理防御减免
  local DefReduc= CommonFun.CalcDef(Def,Vit,srcUser,targetUser)
  ----------------------------------------------------星盘连环全身掌
  local Num1 = srcUser:GetRunePoint(120230)
  local RuneDamage = 1 + Num1*0.05
  ----------------------------------------------------体质会给连环全身掌带来伤害加成
  local VitDamage  = Vit/150
  if VitDamage<= 0 then
     VitDamage = 0
  end


  local A = ((AtkFinal*DefReduc*(1-DamReduc2) + Refine)*(damChangePer + VitDamage)*(1-RefineDamReduc)*(1 + DamIncrease)-Vit2*(1 + VitPer2))*RuneDamage

   if 1 >= A then
         return 1
   end

   if srcUser:HasBuffID(24910) then
      return A*1.1
   end

   return A
end

-----------------------------------------------------------------------------------------------------------------近战武僧猛龙夸强技能伤害计算公式(已改)
function CommonFun.calcDamage_12206(srcUser, targetUser, params, damageParam, logger)
  local Str = srcUser:GetProperty("Str")
  local Dex = srcUser:GetProperty("Dex")
  local Luk = srcUser:GetProperty("Luk")
  local Atk = srcUser:GetProperty("Atk")
  local AtkPer = srcUser:GetProperty("AtkPer")
  local DamIncrease = srcUser:GetProperty("DamIncrease")
  local IgnoreDef  = 0
  local IgnoreDef1 = srcUser:GetProperty("IgnoreDef")
  local IgnoreDef2 = srcUser:GetProperty("IgnoreEquipDef")
  if targetUser.boss or targetUser.mini then
     IgnoreDef=IgnoreDef1
  else
     IgnoreDef=(IgnoreDef1+IgnoreDef2)
  end

  if IgnoreDef >= 1 then
     IgnoreDef=1
  end
    ------------------------------------------------------------------------------------将原来的物伤加成改成精炼物理攻击
  local Refine = srcUser:GetProperty("Refine")

  local Def2 = targetUser:GetProperty("Def")
  local DefPer2 = targetUser:GetProperty("DefPer")
  local Vit2 = targetUser:GetProperty("Vit")
  local VitPer2 = targetUser:GetProperty("VitPer")
  local DamReduc2 = CommonFun.calcDamReDuc(srcUser, targetUser)
  local RefineDamReduc = targetUser:GetProperty("RefineDamReduc")

  local damChangePer = damageParam.damChangePer

  ----------------------------------------------------------------------------------------------------------------种族，体型，属性，BOSS加伤效果
  local raceparam     = CommonFun.CalcRaceParam(srcUser, targetUser, params, damageParam, logger)
  local bodyparam     = CommonFun.CalcBodyParam(srcUser, targetUser, params, damageParam, logger)
  local elementparam  = CommonFun.CalcElementParam(srcUser, targetUser, params, damageParam, logger)
  local bossparam     = CommonFun.CalcBossParam(srcUser, targetUser, params, damageParam, logger)

  ----------------------------------------------------------------------------------------------------------------种族，体型，属性，BOSS减伤效果
  local raceparam2    = CommonFun.CalcRaceParam2(srcUser, targetUser, params, damageParam, logger)
  local bodyparam2    = CommonFun.CalcBodyParam2(srcUser, targetUser, params, damageParam, logger)
  local elementparam2 = CommonFun.CalcElementParam2(srcUser, targetUser, params, damageParam, logger)
  local bossparam2    = CommonFun.CalcBossParam2(srcUser, targetUser, params, damageParam, logger)



  local BaseAtk  = Str*2 + math.floor(Str*Str/100) + math.floor(Dex/5) + math.floor(Luk/5)
  local AtkFinal = ((Atk-BaseAtk)*(1+AtkPer)*CommonFun.ShapeCorrection(srcUser,targetUser)*bodyparam*elementparam*elementparam2+BaseAtk)*raceparam*bossparam*bossparam2

  ----------------------------物理防御减免
  local DefReduc= CommonFun.CalcDef(Def,Vit,srcUser,targetUser)
  --------------------------------------------------------------------星盘猛龙夸强
  local Num1 = srcUser:GetRunePoint(120150)
  local RuneDamage = Num1*0.05+1

  local A = ((AtkFinal*DefReduc*(1-DamReduc2)+Refine)*damChangePer*(1-RefineDamReduc)*(1+DamIncrease)-Vit2*(1+VitPer2))*RuneDamage

   if 1 >= A then
         return 1
   end

   if srcUser:HasBuffID(24910) then
        return A*1.15
   end

   return A
end

-----------------------------------------------------------------------------------------------------------------武僧伏虎拳技能伤害计算公式
function CommonFun.calcDamage_12207(srcUser, targetUser, params, damageParam, logger)
  local Str = srcUser:GetProperty("Str")
  local Dex = srcUser:GetProperty("Dex")
  local Luk = srcUser:GetProperty("Luk")
  local Atk = srcUser:GetProperty("Atk")
  local AtkPer = srcUser:GetProperty("AtkPer")
  local DamIncrease = srcUser:GetProperty("DamIncrease")
  local IgnoreDef  = 0
  local IgnoreDef1 = srcUser:GetProperty("IgnoreDef")
  local IgnoreDef2 = srcUser:GetProperty("IgnoreEquipDef")
  if targetUser.boss or targetUser.mini then
     IgnoreDef=IgnoreDef1
  else
     IgnoreDef=(IgnoreDef1+IgnoreDef2)
  end

  if IgnoreDef >= 1 then
     IgnoreDef=1
  end
    ------------------------------------------------------------------------------------将原来的物伤加成改成精炼物理攻击
  local Refine = srcUser:GetProperty("Refine")

  local Def2 = targetUser:GetProperty("Def")
  local DefPer2 = targetUser:GetProperty("DefPer")
  local Vit2 = targetUser:GetProperty("Vit")
  local VitPer2 = targetUser:GetProperty("VitPer")
  local DamReduc2 = CommonFun.calcDamReDuc(srcUser, targetUser)
  local RefineDamReduc = targetUser:GetProperty("RefineDamReduc")

  local damChangePer = damageParam.damChangePer

  ----------------------------------------------------------------------------------------------------------------种族，体型，属性，BOSS加伤效果
  local raceparam     = CommonFun.CalcRaceParam(srcUser, targetUser, params, damageParam, logger)
  local bodyparam     = CommonFun.CalcBodyParam(srcUser, targetUser, params, damageParam, logger)
  local elementparam  = CommonFun.CalcElementParam(srcUser, targetUser, params, damageParam, logger)
  local bossparam     = CommonFun.CalcBossParam(srcUser, targetUser, params, damageParam, logger)

  ----------------------------------------------------------------------------------------------------------------种族，体型，属性，BOSS减伤效果
  local raceparam2    = CommonFun.CalcRaceParam2(srcUser, targetUser, params, damageParam, logger)
  local bodyparam2    = CommonFun.CalcBodyParam2(srcUser, targetUser, params, damageParam, logger)
  local elementparam2 = CommonFun.CalcElementParam2(srcUser, targetUser, params, damageParam, logger)
  local bossparam2    = CommonFun.CalcBossParam2(srcUser, targetUser, params, damageParam, logger)



  local BaseAtk  = Str*2 + math.floor(Str*Str/100) + math.floor(Dex/5) + math.floor(Luk/5)
  local AtkFinal = ((Atk-BaseAtk)*(1+AtkPer)*CommonFun.ShapeCorrection(srcUser,targetUser)*bodyparam*elementparam*elementparam2+BaseAtk)*raceparam*bossparam*bossparam2

  ----------------------------物理防御减免
  local DefReduc= CommonFun.CalcDef(Def,Vit,srcUser,targetUser)
  --------------------------------------------------------------星盘伏虎拳
  local Num1 = srcUser:GetRunePoint(120260)
  local RuneDamage = Num1*0.05+1

  ----------------------------------------------------------升龙拳套
  local Num2=1
   if srcUser:HasBuffID(90001513) then
     Num2=1.3
   end


  local A = ((AtkFinal*DefReduc*(1-DamReduc2)+Refine)*damChangePer*(1-RefineDamReduc)*(1+DamIncrease)-Vit2*(1+VitPer2))*RuneDamage*Num2

   if 1 >= A then
         return 1
   end

   return A
end

-----------------------------------------------------------------------------------------------------------------武僧技能气爆散伤害计算公式
function CommonFun.calcDamage_12208(srcUser, targetUser, params, damageParam, logger)
  local Str = srcUser:GetProperty("Str")
  local Dex = srcUser:GetProperty("Dex")
  local Luk = srcUser:GetProperty("Luk")
  local Atk = srcUser:GetProperty("Atk")
  local AtkPer = srcUser:GetProperty("AtkPer")
  local DamIncrease = srcUser:GetProperty("DamIncrease")
  local IgnoreDef  = 0
  local IgnoreDef1 = srcUser:GetProperty("IgnoreDef")
  local IgnoreDef2 = srcUser:GetProperty("IgnoreEquipDef")
  if targetUser.boss or targetUser.mini then
     IgnoreDef=IgnoreDef1
  else
     IgnoreDef=(IgnoreDef1+IgnoreDef2)
  end

  if IgnoreDef >= 1 then
     IgnoreDef=1
  end
    ------------------------------------------------------------------------------------将原来的物伤加成改成精炼物理攻击
  local Refine = srcUser:GetProperty("Refine")

  local Def2 = targetUser:GetProperty("Def")
  local DefPer2 = targetUser:GetProperty("DefPer")
  local Vit2 = targetUser:GetProperty("Vit")
  local VitPer2 = targetUser:GetProperty("VitPer")
  local DamReduc2 = CommonFun.calcDamReDuc(srcUser, targetUser)
  local RefineDamReduc = targetUser:GetProperty("RefineDamReduc")

  local damChangePer = damageParam.damChangePer

  ----------------------------------------------------------------------------------------------------------------种族，体型，属性，BOSS加伤效果
  local raceparam     = CommonFun.CalcRaceParam(srcUser, targetUser, params, damageParam, logger)
  local bodyparam     = CommonFun.CalcBodyParam(srcUser, targetUser, params, damageParam, logger)
  local elementparam  = CommonFun.CalcElementParam(srcUser, targetUser, params, damageParam, logger)
  local bossparam     = CommonFun.CalcBossParam(srcUser, targetUser, params, damageParam, logger)

  ----------------------------------------------------------------------------------------------------------------种族，体型，属性，BOSS减伤效果
  local raceparam2    = CommonFun.CalcRaceParam2(srcUser, targetUser, params, damageParam, logger)
  local bodyparam2    = CommonFun.CalcBodyParam2(srcUser, targetUser, params, damageParam, logger)
  local elementparam2 = CommonFun.CalcElementParam2(srcUser, targetUser, params, damageParam, logger)
  local bossparam2    = CommonFun.CalcBossParam2(srcUser, targetUser, params, damageParam, logger)



  local BaseAtk  = Str*2 + math.floor(Str*Str/100) + math.floor(Dex/5) + math.floor(Luk/5)
  local AtkFinal = ((Atk-BaseAtk)*(1+AtkPer)*CommonFun.ShapeCorrection(srcUser,targetUser)*bodyparam*elementparam*elementparam2+BaseAtk)*raceparam*bossparam*bossparam2

  ----------------------------物理防御减免
  local DefReduc= CommonFun.CalcDef(Def,Vit,srcUser,targetUser)
  --------------------------------------------------------------星盘气爆散
  local Num1 = srcUser:GetRunePoint(120240)
  local RuneDamage = Num1*0.05+1

  local A = ((AtkFinal*DefReduc*(1-DamReduc2)+Refine)*damChangePer*(1-RefineDamReduc)*(1+DamIncrease)-Vit2*(1+VitPer2))*RuneDamage

   if 1 >= A then
         return 1
   end

   return A
end
-----------------------------------------------------------------------------------------------------------------修罗 技能伤害计算公式(已改)
function CommonFun.calcDamage_12401(srcUser, targetUser, params, damageParam, logger)
  local Str = srcUser:GetProperty("Str")
  local Dex = srcUser:GetProperty("Dex")
  local Luk = srcUser:GetProperty("Luk")
  local Atk = srcUser:GetProperty("Atk")
  local AtkPer = srcUser:GetProperty("AtkPer")
  local DamIncrease = srcUser:GetProperty("DamIncrease")
  local IgnoreDef  = 0
  local IgnoreDef1 = srcUser:GetProperty("IgnoreDef")
  local IgnoreDef2 = srcUser:GetProperty("IgnoreEquipDef")
  if targetUser.boss or targetUser.mini then
     IgnoreDef=IgnoreDef1
  else
     IgnoreDef=(IgnoreDef1+IgnoreDef2)
  end

  if IgnoreDef >= 1 then
     IgnoreDef=1
  end
    ------------------------------------------------------------------------------------将原来的物伤加成改成精炼物理攻击
  local Refine = srcUser:GetProperty("Refine")

  local Def2 = targetUser:GetProperty("Def")
  local DefPer2 = targetUser:GetProperty("DefPer")
  local Vit2 = targetUser:GetProperty("Vit")
  local VitPer2 = targetUser:GetProperty("VitPer")
  local DamReduc2 = CommonFun.calcDamReDuc(srcUser, targetUser)
  local RefineDamReduc = targetUser:GetProperty("RefineDamReduc")

  local damChangePer = damageParam.damChangePer

  ----------------------------------------------------------------------------------------------------------------种族，体型，属性，BOSS加伤效果
  local raceparam     = CommonFun.CalcRaceParam(srcUser, targetUser, params, damageParam, logger)
  local bodyparam     = CommonFun.CalcBodyParam(srcUser, targetUser, params, damageParam, logger)
  local elementparam  = CommonFun.CalcElementParam(srcUser, targetUser, params, damageParam, logger)
  local bossparam     = CommonFun.CalcBossParam(srcUser, targetUser, params, damageParam, logger)

  ----------------------------------------------------------------------------------------------------------------种族，体型，属性，BOSS减伤效果
  local raceparam2    = CommonFun.CalcRaceParam2(srcUser, targetUser, params, damageParam, logger)
  local bodyparam2    = CommonFun.CalcBodyParam2(srcUser, targetUser, params, damageParam, logger)
  local elementparam2 = CommonFun.CalcElementParam2(srcUser, targetUser, params, damageParam, logger)
  local bossparam2    = CommonFun.CalcBossParam2(srcUser, targetUser, params, damageParam, logger)



  local BaseAtk  = Str*2 + math.floor(Str*Str/100) + math.floor(Dex/5) + math.floor(Luk/5)
  local AtkFinal = ((Atk-BaseAtk)*(1+AtkPer)*CommonFun.ShapeCorrection(srcUser,targetUser)*bodyparam*elementparam*elementparam2+BaseAtk)*raceparam*bossparam*bossparam2

  ----------------------------物理防御减免
  local DefReduc= CommonFun.CalcDef(Def,Vit,srcUser,targetUser)

  local A = (AtkFinal*DefReduc*(1-DamReduc2)+Refine)*damChangePer*(1-RefineDamReduc)*(1+DamIncrease)-Vit2*(1+VitPer2)

  ------------------------------------------------------------------------------大锤崩坠
  local skillID, skillLevel = CommonFun.UnmergeSkillID(params.skillIDAndLevel)
  ----------------------------------------------------------
    if skillID==1201 then
        if srcUser:HasBuffID(117010) then ----接双龙摆尾
          A = A *1.5
        end
    end

   if 1 >= A then
         return 1
   end

   return A
end
-----------------------------------------------------------------------------------------------------------------修罗 虎炮 技能伤害计算公式(已改)
function CommonFun.calcDamage_12402(srcUser, targetUser, params, damageParam, logger)
  local Str = srcUser:GetProperty("Str")
  local Dex = srcUser:GetProperty("Dex")
  local Luk = srcUser:GetProperty("Luk")
  local Atk = srcUser:GetProperty("Atk")
  local AtkPer = srcUser:GetProperty("AtkPer")
  local DamIncrease = srcUser:GetProperty("DamIncrease")
  local IgnoreDef  = 0
  local IgnoreDef1 = srcUser:GetProperty("IgnoreDef")
  local IgnoreDef2 = srcUser:GetProperty("IgnoreEquipDef")
  if targetUser.boss or targetUser.mini then
     IgnoreDef=IgnoreDef1
  else
     IgnoreDef=(IgnoreDef1+IgnoreDef2)
  end

  if IgnoreDef >= 1 then
     IgnoreDef=1
  end
    ------------------------------------------------------------------------------------将原来的物伤加成改成精炼物理攻击
  local Refine = srcUser:GetProperty("Refine")

  local Def2 = targetUser:GetProperty("Def")
  local DefPer2 = targetUser:GetProperty("DefPer")
  local Vit2 = targetUser:GetProperty("Vit")
  local VitPer2 = targetUser:GetProperty("VitPer")
  local DamReduc2 = CommonFun.calcDamReDuc(srcUser, targetUser)
  local RefineDamReduc = targetUser:GetProperty("RefineDamReduc")

  local damChangePer = damageParam.damChangePer

  ----------------------------------------------------------------------------------------------------------------种族，体型，属性，BOSS加伤效果
  local raceparam     = CommonFun.CalcRaceParam(srcUser, targetUser, params, damageParam, logger)
  local bodyparam     = CommonFun.CalcBodyParam(srcUser, targetUser, params, damageParam, logger)
  local elementparam  = CommonFun.CalcElementParam(srcUser, targetUser, params, damageParam, logger)
  local bossparam     = CommonFun.CalcBossParam(srcUser, targetUser, params, damageParam, logger)

  ----------------------------------------------------------------------------------------------------------------种族，体型，属性，BOSS减伤效果
  local raceparam2    = CommonFun.CalcRaceParam2(srcUser, targetUser, params, damageParam, logger)
  local bodyparam2    = CommonFun.CalcBodyParam2(srcUser, targetUser, params, damageParam, logger)
  local elementparam2 = CommonFun.CalcElementParam2(srcUser, targetUser, params, damageParam, logger)
  local bossparam2    = CommonFun.CalcBossParam2(srcUser, targetUser, params, damageParam, logger)



  local BaseAtk  = Str*2 + math.floor(Str*Str/100) + math.floor(Dex/5) + math.floor(Luk/5)
  local AtkFinal = ((Atk-BaseAtk)*(1+AtkPer)*CommonFun.ShapeCorrection(srcUser,targetUser)*bodyparam*elementparam*elementparam2+BaseAtk)*raceparam*bossparam*bossparam2

  ----------------------------物理防御减免
  local DefReduc= CommonFun.CalcDef(Def,Vit,srcUser,targetUser)

  ---------------------------------------------------------秘拳套闪光
  local shanguang=1
  if srcUser:HasBuffID(90001953) then
    shanguang=0.05 + 1
  end

  local RefineLv7=srcUser:GetEquipedRefineLv(7)
  local miquan =0

  if srcUser:HasBuffID(90001953) then
    if ( RefineLv7<10) then
      miquan=RefineLv7* 0.1
      elseif  (RefineLv7>=10 and RefineLv7<15) then
      miquan=RefineLv7* 0.1 +0.4
      elseif RefineLv7 ==15 then
      miquan=RefineLv7* 0.1 +0.4+0.8
    end
  end
  ------------------------------------------------星盘
  local Num = srcUser:GetRunePoint(124020)
  local RuneDamage = 1 + Num*0.1

  local A = ((AtkFinal*DefReduc*(1-DamReduc2)+Refine)*(damChangePer+miquan)*(1-RefineDamReduc)*(1+DamIncrease)-Vit2*(1+VitPer2))*shanguang*RuneDamage

   if 1 >= A then
         return 1
   end
   ----------------------------------------------大锤崩坠之后伤害翻倍
   if srcUser:HasBuffID(117020) then
     A = A*2
   end

   return A
end
-----------------------------------------------------------------------------------------------------------------修罗 罗刹破凰拳 技能伤害计算公式(已改)
function CommonFun.calcDamage_12403(srcUser, targetUser, params, damageParam, logger)
  local Str = srcUser:GetProperty("Str")
  local Dex = srcUser:GetProperty("Dex")
  local Luk = srcUser:GetProperty("Luk")
  local Atk = srcUser:GetProperty("Atk")
  local AtkPer = srcUser:GetProperty("AtkPer")
  local DamIncrease = srcUser:GetProperty("DamIncrease")
  local IgnoreDef  = 0
  local IgnoreDef1 = srcUser:GetProperty("IgnoreDef")
  local IgnoreDef2 = srcUser:GetProperty("IgnoreEquipDef")
  if targetUser.boss or targetUser.mini then
     IgnoreDef=IgnoreDef1
  else
     IgnoreDef=(IgnoreDef1+IgnoreDef2)
  end

  if IgnoreDef >= 1 then
     IgnoreDef=1
  end
    ------------------------------------------------------------------------------------将原来的物伤加成改成精炼物理攻击
  local Refine = srcUser:GetProperty("Refine")

  local Def2 = targetUser:GetProperty("Def")
  local DefPer2 = targetUser:GetProperty("DefPer")
  local Vit2 = targetUser:GetProperty("Vit")
  local VitPer2 = targetUser:GetProperty("VitPer")
  local DamReduc2 = CommonFun.calcDamReDuc(srcUser, targetUser)
  local RefineDamReduc = targetUser:GetProperty("RefineDamReduc")

  local damChangePer = damageParam.damChangePer

  ----------------------------------------------------------------------------------------------------------------种族，体型，属性，BOSS加伤效果
  local raceparam     = CommonFun.CalcRaceParam(srcUser, targetUser, params, damageParam, logger)
  local bodyparam     = CommonFun.CalcBodyParam(srcUser, targetUser, params, damageParam, logger)
  local elementparam  = CommonFun.CalcElementParam(srcUser, targetUser, params, damageParam, logger)
  local bossparam     = CommonFun.CalcBossParam(srcUser, targetUser, params, damageParam, logger)

  ----------------------------------------------------------------------------------------------------------------种族，体型，属性，BOSS减伤效果
  local raceparam2    = CommonFun.CalcRaceParam2(srcUser, targetUser, params, damageParam, logger)
  local bodyparam2    = CommonFun.CalcBodyParam2(srcUser, targetUser, params, damageParam, logger)
  local elementparam2 = CommonFun.CalcElementParam2(srcUser, targetUser, params, damageParam, logger)
  local bossparam2    = CommonFun.CalcBossParam2(srcUser, targetUser, params, damageParam, logger)

  local BaseAtk  = Str*2 + math.floor(Str*Str/100) + math.floor(Dex/5) + math.floor(Luk/5)
  local AtkFinal = ((Atk-BaseAtk)*(1+AtkPer)*CommonFun.ShapeCorrection(srcUser,targetUser)*bodyparam*elementparam*elementparam2+BaseAtk)*raceparam*bossparam*bossparam2

  ----------------------------------自身血量越少，伤害越高
  local Numxp = srcUser:GetRunePoint(124030)

  local MaxHp = srcUser:GetProperty("MaxHp")
  local Hp = srcUser:GetProperty("Hp")
  local HpPerRatio = 1+(1-Hp/MaxHp)*(1+0.3*Numxp)
  ----------------------------物理防御减免
  local DefReduc= CommonFun.CalcDef(Def,Vit,srcUser,targetUser)

  ------------------------------坚定战袍
  local jianding = 0
  if srcUser:HasBuffID(90000939) then
     jianding=0.5
   end
  ------------------------------------------------------------------------------霸王乱舞
  local Ring7=srcUser:GetEquipedID(7)
  if (Ring7 == 62515 or Ring7==162515) then
    jianding = jianding + 1
  end
------------------------------------------------------------------------------苍天霸皇
  if (Ring7 == 62541 or Ring7==162541) then
    jianding = jianding + 1
  end
 ------------------------------------------------------------------------------霸王乱舞
  local RefineLv7=srcUser:GetEquipedRefineLv(7)
  local bawang = 1
  if (Ring7 == 62515 or Ring7==162515)  then
    if RefineLv7 > 0 then
      bawang=(RefineLv7-0)* 0.01+1
    end
  end
  if ((Ring7 == 62515 or Ring7==162515) and srcUser:HasBuffID(90000939)  and srcUser:HasBuffID(90001943) )then
     bawang=bawang+0.05
   end
  ------------------------------------------------------------------------------苍天霸皇

  if (Ring7 == 62541 or Ring7==162541)  then
    if RefineLv7 > 0 then
      bawang=(RefineLv7-0)* 0.01+1
    end
  end

  if ((Ring7 == 62541 or Ring7==162541) and srcUser:HasBuffID(90000939)  and srcUser:HasBuffID(90001943) )then
     bawang=bawang+0.05
   end
  ------------------------------------------------------------------------------霸王乱舞
  local dabawang = 0
  if (Ring7 == 62515 or Ring7==162515)  then
    if (RefineLv7>=5 and RefineLv7<10) then
        dabawang = 0.05
    elseif (RefineLv7>=10 and RefineLv7<15) then
        dabawang = 0.05 + 0.05
    elseif RefineLv7 ==15 then
        dabawang = 0.05 + 0.05 +0.1
    end
  end
 ------------------------------------------------------------------------------苍天霸皇
  if (Ring7 == 62541 or Ring7==162541)  then
    if (RefineLv7>=5 and RefineLv7<10) then
        dabawang = 0.05
    elseif (RefineLv7>=10 and RefineLv7<15) then
        dabawang = 0.05 + 0.05
    elseif RefineLv7 ==15 then
        dabawang = 0.05 + 0.05 +0.1
    end
  end
  ------------------------------------------------------------------------------坚定指环
  local Ring1=srcUser:GetEquipedID(5)
  local RefineLv1=srcUser:GetEquipedRefineLv(5)
  local Ring2=srcUser:GetEquipedID(6)
  local RefineLv2=srcUser:GetEquipedRefineLv(6)

  local a = 0
  local b = 0

  if (Ring1==44003 or Ring1==144003) and RefineLv1>=10 and RefineLv1< 15 and srcUser:HasBuffID(90001943) then
      a = 0.05
      elseif (Ring1==44003 or Ring1==144003) and RefineLv1==15 and srcUser:HasBuffID(90001943) then
        a = 0.15
  end
  if (Ring2==44003 or Ring2==144003) and RefineLv2>=10 and  RefineLv2<15  and srcUser:HasBuffID(90001943) then
      b = 0.05
      elseif (Ring2==44003 or Ring2==144003) and RefineLv2==15 and srcUser:HasBuffID(90001943)  then
        b = 0.15
  end
  local sizeCorrection=1
  if nil ~= CommonFun.Shape then
    if CommonFun.Shape.S == targetUser.shape then
        sizeCorrection = 1 + a + b
    elseif CommonFun.Shape.M == targetUser.shape then
        sizeCorrection = 1
    elseif CommonFun.Shape.L == targetUser.shape then
        sizeCorrection = 1 + a + b
    end
  end
  ------------------------------------------------星盘
  local Num = srcUser:GetRunePoint(124040)
  local RuneDamage = 1 + Num*0.06

  local A = ((AtkFinal*DefReduc*(1-DamReduc2)+Refine)*(damChangePer+jianding)*(1-RefineDamReduc)*(1+DamIncrease)-Vit2*(1+VitPer2))*HpPerRatio*sizeCorrection*bawang*RuneDamage

   if 1 >= A then
         return 1
   end
   ----------------------------------------------大锤崩坠之后伤害翻倍
   if srcUser:HasBuffID(117020) then
     A = A*(2+dabawang)
   end

   return A
end

-----------------------------------------------------------------------------------------------------------------修罗 点穴-默伤害计算公式(已改)
function CommonFun.calcDamage_12404(srcUser, targetUser, params, damageParam, logger)
  local Str = srcUser:GetProperty("Str")
  local Dex = srcUser:GetProperty("Dex")
  local Luk = srcUser:GetProperty("Luk")
  local Atk = srcUser:GetProperty("Atk")
  local AtkPer = srcUser:GetProperty("AtkPer")
  local DamIncrease = srcUser:GetProperty("DamIncrease")
  local IgnoreDef  = 0
  local IgnoreDef1 = srcUser:GetProperty("IgnoreDef")
  local IgnoreDef2 = srcUser:GetProperty("IgnoreEquipDef")
  if targetUser.boss or targetUser.mini then
     IgnoreDef=IgnoreDef1
  else
     IgnoreDef=(IgnoreDef1+IgnoreDef2)
  end

  if IgnoreDef >= 1 then
     IgnoreDef=1
  end
    ------------------------------------------------------------------------------------将原来的物伤加成改成精炼物理攻击
  local Refine = srcUser:GetProperty("Refine")

  local Def2 = targetUser:GetProperty("Def")
  local DefPer2 = targetUser:GetProperty("DefPer")
  local Vit2 = targetUser:GetProperty("Vit")
  local VitPer2 = targetUser:GetProperty("VitPer")
  local DamReduc2 = CommonFun.calcDamReDuc(srcUser, targetUser)
  local RefineDamReduc = targetUser:GetProperty("RefineDamReduc")

  local damChangePer = damageParam.damChangePer

  ----------------------------------------------------------------------------------------------------------------种族，体型，属性，BOSS加伤效果
  local raceparam     = CommonFun.CalcRaceParam(srcUser, targetUser, params, damageParam, logger)
  local bodyparam     = CommonFun.CalcBodyParam(srcUser, targetUser, params, damageParam, logger)
  local elementparam  = CommonFun.CalcElementParam(srcUser, targetUser, params, damageParam, logger)
  local bossparam     = CommonFun.CalcBossParam(srcUser, targetUser, params, damageParam, logger)

  ----------------------------------------------------------------------------------------------------------------种族，体型，属性，BOSS减伤效果
  local raceparam2    = CommonFun.CalcRaceParam2(srcUser, targetUser, params, damageParam, logger)
  local bodyparam2    = CommonFun.CalcBodyParam2(srcUser, targetUser, params, damageParam, logger)
  local elementparam2 = CommonFun.CalcElementParam2(srcUser, targetUser, params, damageParam, logger)
  local bossparam2    = CommonFun.CalcBossParam2(srcUser, targetUser, params, damageParam, logger)



  local BaseAtk  = Str*2 + math.floor(Str*Str/100) + math.floor(Dex/5) + math.floor(Luk/5)
  local AtkFinal = ((Atk-BaseAtk)*(1+AtkPer)*CommonFun.ShapeCorrection(srcUser,targetUser)*bodyparam*elementparam*elementparam2+BaseAtk)*raceparam*bossparam*bossparam2

  ----------------------------物理防御减免
  local DefReduc= CommonFun.CalcDef(Def,Vit,srcUser,targetUser)

  local A = ((AtkFinal*DefReduc*(1-DamReduc2)+Refine)*damChangePer*(1-RefineDamReduc)*(1+DamIncrease)-Vit2*(1+VitPer2))*(1+Dex/100)

   if 1 >= A then
         return 1
   end

   return A
end
-----------------------------------------------------------------------------------------------------------------修罗  气弹爆破 技能伤害计算公式(已改)
function CommonFun.calcDamage_12405(srcUser, targetUser, params, damageParam, logger)
  local Str = srcUser:GetProperty("Str")
  local Dex = srcUser:GetProperty("Dex")
  local Luk = srcUser:GetProperty("Luk")
  local Atk = srcUser:GetProperty("Atk")
  local AtkPer = srcUser:GetProperty("AtkPer")
  local DamIncrease = srcUser:GetProperty("DamIncrease")
  local IgnoreDef  = 0
  local IgnoreDef1 = srcUser:GetProperty("IgnoreDef")
  local IgnoreDef2 = srcUser:GetProperty("IgnoreEquipDef")
  if targetUser.boss or targetUser.mini then
     IgnoreDef=IgnoreDef1
  else
     IgnoreDef=(IgnoreDef1+IgnoreDef2)
  end

  if IgnoreDef >= 1 then
     IgnoreDef=1
  end
    ------------------------------------------------------------------------------------将原来的物伤加成改成精炼物理攻击
  local Refine = srcUser:GetProperty("Refine")

  local Def2 = targetUser:GetProperty("Def")
  local DefPer2 = targetUser:GetProperty("DefPer")
  local Vit2 = targetUser:GetProperty("Vit")
  local VitPer2 = targetUser:GetProperty("VitPer")
  local DamReduc2 = CommonFun.calcDamReDuc(srcUser, targetUser)
  local RefineDamReduc = targetUser:GetProperty("RefineDamReduc")

  local damChangePer = damageParam.damChangePer
  local damChangePer1 = damageParam.damChangePer1
  ----------------------------------------------------------------------------------------------------------------种族，体型，属性，BOSS加伤效果
  local raceparam     = CommonFun.CalcRaceParam(srcUser, targetUser, params, damageParam, logger)
  local bodyparam     = CommonFun.CalcBodyParam(srcUser, targetUser, params, damageParam, logger)
  local elementparam  = CommonFun.CalcElementParam(srcUser, targetUser, params, damageParam, logger)
  local bossparam     = CommonFun.CalcBossParam(srcUser, targetUser, params, damageParam, logger)

  ----------------------------------------------------------------------------------------------------------------种族，体型，属性，BOSS减伤效果
  local raceparam2    = CommonFun.CalcRaceParam2(srcUser, targetUser, params, damageParam, logger)
  local bodyparam2    = CommonFun.CalcBodyParam2(srcUser, targetUser, params, damageParam, logger)
  local elementparam2 = CommonFun.CalcElementParam2(srcUser, targetUser, params, damageParam, logger)
  local bossparam2    = CommonFun.CalcBossParam2(srcUser, targetUser, params, damageParam, logger)



  local BaseAtk  = Str*2 + math.floor(Str*Str/100) + math.floor(Dex/5) + math.floor(Luk/5)
  local AtkFinal = ((Atk-BaseAtk)*(1+AtkPer)*CommonFun.ShapeCorrection(srcUser,targetUser)*bodyparam*elementparam*elementparam2+BaseAtk)*raceparam*bossparam*bossparam2

  ----------------------------物理防御减免
  local DefReduc= CommonFun.CalcDef(Def,Vit,srcUser,targetUser)

   local Num1 = srcUser:GetBuffLayer(100500)--------------------------弹指神通气弹数

    ------------------------------------------------------------------------------霸王乱舞[第二档]
  local RefineLv7=srcUser:GetEquipedRefineLv(7)
  local bawang2 = 1
  if srcUser:HasBuffID(90002061)  then
      bawang2=(RefineLv7-0)* 0.02+1
  end
  if srcUser:HasBuffID(41910)  then
      bawang2=(RefineLv7-0)* 0.02+1
  end


  local A =( (AtkFinal*DefReduc*(1-DamReduc2)+Refine)*(damChangePer+damChangePer1*Num1)*(1-RefineDamReduc)*(1+DamIncrease)-Vit2*(1+VitPer2)) * bawang2

   if 1 >= A then
         return 1
   end

   return A
end
-----------------------------------------------------------------------------------------------------------------炼金术士普攻伤害计算公式(已改)
function CommonFun.calcDamage_13201(srcUser, targetUser, params, damageParam, logger)
  local Str1 = srcUser:GetProperty("Str")
  --------------------------------------------------------------------------------------------------------炼金星盘加成的力量转换的普攻加成率提升百分比
  local Num1 = srcUser:GetRunePoint(130110)
  local RuneDamage = Num1*0.03 + 1
  local Str = Str1*RuneDamage

  local Dex = srcUser:GetProperty("Dex")
  local Luk = srcUser:GetProperty("Luk")
  local Atk = srcUser:GetProperty("Atk")
  local AtkPer = srcUser:GetProperty("AtkPer")
  ------------------------------------------------------普通攻击力
  local NormalAtk = srcUser:GetProperty("NormalAtk")
        NormalAtk = NormalAtk + 5*Str
  ------------------------------------
  local DamIncrease = srcUser:GetProperty("DamIncrease")
  local IgnoreDef  = 0
  local IgnoreDef1 = srcUser:GetProperty("IgnoreDef")
  local IgnoreDef2 = srcUser:GetProperty("IgnoreEquipDef")
  if targetUser.boss or targetUser.mini then
     IgnoreDef=IgnoreDef1
  else
     IgnoreDef=(IgnoreDef1+IgnoreDef2)
  end

  if IgnoreDef >= 1 then
     IgnoreDef=1
  end
    ------------------------------------------------------------------------------------将原来的物伤加成改成精炼物理攻击
  local Refine = srcUser:GetProperty("Refine")

  local Def2 = targetUser:GetProperty("Def")
  local DefPer2 = targetUser:GetProperty("DefPer")
  local Vit2 = targetUser:GetProperty("Vit")
  local VitPer2 = targetUser:GetProperty("VitPer")
  local DamReduc2 = CommonFun.calcDamReDuc(srcUser, targetUser)
  local RefineDamReduc = targetUser:GetProperty("RefineDamReduc")

  local damChangePer = damageParam.damChangePer

  ----------------------------------------------------------------------------------------------------------------种族，体型，属性，BOSS加伤效果
  local raceparam     = CommonFun.CalcRaceParam(srcUser, targetUser, params, damageParam, logger)
  local bodyparam     = CommonFun.CalcBodyParam(srcUser, targetUser, params, damageParam, logger)
  local elementparam  = CommonFun.CalcElementParam(srcUser, targetUser, params, damageParam, logger)
  local bossparam     = CommonFun.CalcBossParam(srcUser, targetUser, params, damageParam, logger)

  ----------------------------------------------------------------------------------------------------------------种族，体型，属性，BOSS减伤效果
  local raceparam2    = CommonFun.CalcRaceParam2(srcUser, targetUser, params, damageParam, logger)
  local bodyparam2    = CommonFun.CalcBodyParam2(srcUser, targetUser, params, damageParam, logger)
  local elementparam2 = CommonFun.CalcElementParam2(srcUser, targetUser, params, damageParam, logger)
  local bossparam2    = CommonFun.CalcBossParam2(srcUser, targetUser, params, damageParam, logger)

  local BaseAtk   = Str1*2 + math.floor(Str1*Str1/100) + math.floor(Dex/5) + math.floor(Luk/5)
  local BaseAtk1  = Str*2 + math.floor(Str*Str/100) + math.floor(Dex/5) + math.floor(Luk/5)

  local AtkFinal = ((Atk-BaseAtk+NormalAtk)*(1+AtkPer)*CommonFun.ShapeCorrection(srcUser,targetUser)*bodyparam*elementparam*elementparam2+BaseAtk1)*raceparam*bossparam*bossparam2

  ----------------------------物理防御减免
  local DefReduc= CommonFun.CalcDef(Def,Vit,srcUser,targetUser)

  local A = (AtkFinal*DefReduc*(1-DamReduc2)+Refine)*damChangePer*(1-RefineDamReduc)*(1+DamIncrease)-Vit2*(1+VitPer2)

  -----------------------------------------------------------------------------------------------------------二刀连击
  local WeaponType =srcUser:GetEquipedWeaponType()
  local skilllv_1 = srcUser:GetLernedSkillLevel(179)

  local gemChance = 0
  local gemDamage = 1
  if srcUser:HasBuffID(810009) then  ------------------梦魇连击符文
    gemChance = 10
    gemDamage = 1.3
  end

  if WeaponType==250 and CommonFun.IsInRate(skilllv_1*5 + gemChance, srcUser:GetRandom())  then
        return A*2*gemDamage, CommonFun.DamageType.ErLianJi
  end


   if 1 >= A then
         return 1
   end

   return A
end

-----------------------------------------------------------------------------------------------------------------火烟瓶投掷技能伤害计算公式(已改)
function CommonFun.calcDamage_13202(srcUser, targetUser, params, damageParam, logger)
  local Str = srcUser:GetProperty("Str")
  local Dex = srcUser:GetProperty("Dex")
  local Luk = srcUser:GetProperty("Luk")
  local Atk = srcUser:GetProperty("Atk")
  local AtkPer = srcUser:GetProperty("AtkPer")
  local DamIncrease = srcUser:GetProperty("DamIncrease")
  local IgnoreDef  = 0
  local IgnoreDef1 = srcUser:GetProperty("IgnoreDef")
  local IgnoreDef2 = srcUser:GetProperty("IgnoreEquipDef")
  if targetUser.boss or targetUser.mini then
     IgnoreDef=IgnoreDef1
  else
     IgnoreDef=(IgnoreDef1+IgnoreDef2)
  end

  if IgnoreDef >= 1 then
     IgnoreDef=1
  end
    ------------------------------------------------------------------------------------将原来的物伤加成改成精炼物理攻击
  local Refine = srcUser:GetProperty("Refine")

  local Def2 = targetUser:GetProperty("Def")
  local DefPer2 = targetUser:GetProperty("DefPer")
  local Vit2 = targetUser:GetProperty("Vit")
  local VitPer2 = targetUser:GetProperty("VitPer")
  local DamReduc2 = CommonFun.calcDamReDuc(srcUser, targetUser)
  local RefineDamReduc = targetUser:GetProperty("RefineDamReduc")

  local damChangePer = damageParam.damChangePer

  ----------------------------------------------------------------------------------------------------------------种族，体型，属性，BOSS加伤效果
  local raceparam     = CommonFun.CalcRaceParam(srcUser, targetUser, params, damageParam, logger)
  local bodyparam     = CommonFun.CalcBodyParam(srcUser, targetUser, params, damageParam, logger)
  local elementparam  = CommonFun.CalcElementParam(srcUser, targetUser, params, damageParam, logger)
  local bossparam     = CommonFun.CalcBossParam(srcUser, targetUser, params, damageParam, logger)

  ----------------------------------------------------------------------------------------------------------------种族，体型，属性，BOSS减伤效果
  local raceparam2    = CommonFun.CalcRaceParam2(srcUser, targetUser, params, damageParam, logger)
  local bodyparam2    = CommonFun.CalcBodyParam2(srcUser, targetUser, params, damageParam, logger)
  local elementparam2 = CommonFun.CalcElementParam2(srcUser, targetUser, params, damageParam, logger)
  local bossparam2    = CommonFun.CalcBossParam2(srcUser, targetUser, params, damageParam, logger)



  local BaseAtk  = Str*2 + math.floor(Str*Str/100) + math.floor(Dex/5) + math.floor(Luk/5)
  local AtkFinal = ((Atk-BaseAtk)*(1+AtkPer)*CommonFun.ShapeCorrection(srcUser,targetUser)*bodyparam*elementparam*elementparam2+BaseAtk)*raceparam*bossparam*bossparam2

  ----------------------------物理防御减免
  local DefReduc= CommonFun.CalcDef(Def,Vit,srcUser,targetUser)

  local A = (AtkFinal*DefReduc*(1-DamReduc2)+Refine)*damChangePer*(1-RefineDamReduc)*(1+DamIncrease)-Vit2*(1+VitPer2)
  local B = 0
  -----------------------------------------------------------------------------------------------------------------------------------------------强化火烟瓶投掷
  local skilllv_1 = srcUser:GetLernedSkillLevel(425)

    if skilllv_1 >= 1 then

      local srcAtkElement    = 4
      local targetDefElement = targetUser:GetProperty("DefAttr")
      local Int = srcUser:GetProperty("Int")
      local MAtk = srcUser:GetProperty("MAtk")
      local MAtkPer = srcUser:GetProperty("MAtkPer")
      local IgnoreMDef = srcUser:GetProperty("IgnoreMDef")
      local BaseMAtk = Int+math.floor(Int*Int/100)
      local MDef2 = targetUser:GetProperty("MDef")
      local MDefPer2 = targetUser:GetProperty("MDefPer")
      local Vit2 = targetUser:GetProperty("Vit")
      local VitPer2 = targetUser:GetProperty("VitPer")
      local Int2 = targetUser:GetProperty("Int")
      local IntPer2 = targetUser:GetProperty("IntPer")
      local MDamReduc2 = CommonFun.calcMDamReDuc(srcUser, targetUser)
      local MDamIncrease = CommonFun.calcMDamIncrease(srcUser, targetUser)
      local RefineMDamReduc = targetUser:GetProperty("RefineMDamReduc")
      local MRefine = srcUser:GetProperty("MRefine")

      local MAtkFinal= ((MAtk-BaseMAtk)*(1+MAtkPer)+BaseMAtk)*raceparam
      ----------------------------魔法防御减免
      local MDefReduc = CommonFun.CalcMDef(MDef,Int,Vit,srcUser,targetUser)


       B = ((MAtkFinal*MDefReduc*(1-MDamReduc2)+MRefine)*(skilllv_1*0.3+0.5)*(1-RefineMDamReduc)*(1+MDamIncrease)*GameConfig.ElementRestrain[srcAtkElement][targetDefElement]*elementparam2-Vit2/2*(1+VitPer2)-Int2*(1+IntPer2))
    end

   if 1 >= B then
      B = 0
   end
   --------------------------------------------星盘火烟瓶投掷
   local Num1 = srcUser:GetRunePoint(130260)
   local RuneDamage1 = Num1*0.1
  -------------------------------------星盘 丽芙祈福
   local Num2 = srcUser:GetRunePoint(130170)
   local RuneDamage2 = 0
   if  srcUser:IsBeingPresent(600010)==true then
      RuneDamage2 = Num2*0.03
   end
   --------------------------------------------------------------艾尔德之锤
   ---------------------------------------------------酸蚀之触
   local aerde = 1
   local weaponRefineLv=srcUser:GetEquipedRefineLv(7)
   if srcUser:HasBuffID(40610) or srcUser:HasBuffID(42000)  then
      aerde=weaponRefineLv*0.05+1
   end
  ------------------------------------------艾尔德[第四档]【火烟瓶投掷】
  local Int8 = srcUser:GetProperty("Int")
  local Str8 = srcUser:GetProperty("Str")
  local Vit8 = srcUser:GetProperty("Vit")
  if (srcUser:HasBuffID(90001883) and Int8>=119 and Str8>=119 ) then
    aerde=aerde+0.1
  end
  ---------------------------------------------------酸蚀之触
  if (srcUser:HasBuffID(42000) and Int8>=119 and Str8>=119 ) then
    aerde=aerde+0.1
  end

   if 1 >= (A + B) then
         return 1
   end

   return (A + B)*(1+RuneDamage1+RuneDamage2)*aerde
end

-----------------------------------------------------------------------------------------------------------------炼金术士强酸伤害计算公式(已改)
function CommonFun.calcDamage_13203(srcUser, targetUser, params, damageParam, logger)
  local Str = srcUser:GetProperty("Str")
  local Dex = srcUser:GetProperty("Dex")
  local Luk = srcUser:GetProperty("Luk")
  local Int = srcUser:GetProperty("Int")
  local Atk = srcUser:GetProperty("Atk")
  local AtkPer = srcUser:GetProperty("AtkPer")
  local MAtk = srcUser:GetProperty("MAtk")
  local MAtkPer = srcUser:GetProperty("MAtkPer")
  local DamIncrease = srcUser:GetProperty("DamIncrease")
  local IgnoreDef  = 0
  local IgnoreDef1 = srcUser:GetProperty("IgnoreDef")
  local IgnoreDef2 = srcUser:GetProperty("IgnoreEquipDef")
  if targetUser.boss or targetUser.mini then
     IgnoreDef=IgnoreDef1
  else
     IgnoreDef=(IgnoreDef1+IgnoreDef2)
  end

  if IgnoreDef >= 1 then
     IgnoreDef=1
  end
  ------------------------------------------------------------------------------------将原来的物伤加成改成精炼物理攻击
  local MRefine = srcUser:GetProperty("MRefine")
    ------------------------------------------------------------------------------------将原来的物伤加成改成精炼物理攻击
  local Refine = srcUser:GetProperty("Refine")

  local Def2 = targetUser:GetProperty("Def")
  local DefPer2 = targetUser:GetProperty("DefPer")
  local Vit2 = targetUser:GetProperty("Vit")
  local VitPer2 = targetUser:GetProperty("VitPer")
  local DamReduc2 = CommonFun.calcDamReDuc(srcUser, targetUser)
  local RefineDamReduc = targetUser:GetProperty("RefineDamReduc")

  local damChangePer = damageParam.damChangePer
  local damChangePer1 = damageParam.damChangePer1
  ----------------------------------------------------------------------------------------------------------------种族，体型，属性，BOSS加伤效果
  local raceparam     = CommonFun.CalcRaceParam(srcUser, targetUser, params, damageParam, logger)
  local bodyparam     = CommonFun.CalcBodyParam(srcUser, targetUser, params, damageParam, logger)
  local elementparam  = CommonFun.CalcElementParam(srcUser, targetUser, params, damageParam, logger)
  local bossparam     = CommonFun.CalcBossParam(srcUser, targetUser, params, damageParam, logger)

  ----------------------------------------------------------------------------------------------------------------种族，体型，属性，BOSS减伤效果
  local raceparam2    = CommonFun.CalcRaceParam2(srcUser, targetUser, params, damageParam, logger)
  local bodyparam2    = CommonFun.CalcBodyParam2(srcUser, targetUser, params, damageParam, logger)
  local elementparam2 = CommonFun.CalcElementParam2(srcUser, targetUser, params, damageParam, logger)
  local bossparam2    = CommonFun.CalcBossParam2(srcUser, targetUser, params, damageParam, logger)



  local BaseAtk  = Str*2 + math.floor(Str*Str/100) + math.floor(Dex/5) + math.floor(Luk/5)
  local AtkFinal = ((Atk-BaseAtk)*(1+AtkPer)*CommonFun.ShapeCorrection(srcUser,targetUser)*bodyparam*elementparam*elementparam2+BaseAtk)*raceparam*bossparam*bossparam2
  local BaseMAtk = Int+math.floor(Int*Int/100)
  local MAtkFinal= ((MAtk-BaseMAtk)*(1+MAtkPer)+BaseMAtk)*raceparam


  ----------------------------物理防御减免
  local DefReduc= CommonFun.CalcDef(Def,Vit,srcUser,targetUser)

  --------------------------------------------星盘 强酸攻击
  local Num1 = srcUser:GetRunePoint(130160)
  local RuneDamage1 = Num1*0.05
  -------------------------------------星盘 丽芙祈福
  local Num2 = srcUser:GetRunePoint(130170)
  local RuneDamage2 = 0
  if  srcUser:IsBeingPresent(600010)==true then
        RuneDamage2 = Num2*0.03
  end
------------------------------------------艾尔德
  ---------------------------------------------------酸蚀之触
  local  aerde1=1
  local weaponRefineLv=srcUser:GetEquipedRefineLv(7)
  if srcUser:HasBuffID(40610) or srcUser:HasBuffID(42000)  then
      aerde1=weaponRefineLv*0.02+1
  end
------------------------------------------艾尔德【第四档】
  local Int8 = srcUser:GetProperty("Int")
  local Str8 = srcUser:GetProperty("Str")
  local Vit8 = srcUser:GetProperty("Vit")
  if (srcUser:HasBuffID(90001883) and Int8>=119 and Str8>=119 ) then
    aerde1=aerde1+0.05
  end
  ---------------------------------------------------酸蚀之触
  if (srcUser:HasBuffID(42000) and Int8>=119 and Str8>=119 ) then
    aerde1=aerde1+0.05

  end


  local A = (((AtkFinal*DefReduc*(1-DamReduc2)+Refine)*damChangePer+(MAtkFinal*DefReduc*(1-DamReduc2)+MRefine)*damChangePer1)*(1-RefineDamReduc)*(1+DamIncrease)-Vit2*(1+VitPer2))*(1+RuneDamage1+RuneDamage2)*aerde1

   if 1 >= A then
         return 1
   end

   return A
end

-----------------------------------------------------------------------------------------------------------------炼金术士强酸火烟瓶伤害计算公式(已改)
function CommonFun.calcDamage_13204(srcUser, targetUser, params, damageParam, logger)
  local Str = srcUser:GetProperty("Str")
  local Dex = srcUser:GetProperty("Dex")
  local Luk = srcUser:GetProperty("Luk")
  local Int = srcUser:GetProperty("Int")
  local Atk = srcUser:GetProperty("Atk")
  local AtkPer = srcUser:GetProperty("AtkPer")
  local MAtk = srcUser:GetProperty("MAtk")
  local MAtkPer = srcUser:GetProperty("MAtkPer")
  local DamIncrease = srcUser:GetProperty("DamIncrease")
  local IgnoreDef  = 0
  local IgnoreDef1 = srcUser:GetProperty("IgnoreDef")
  local IgnoreDef2 = srcUser:GetProperty("IgnoreEquipDef")
  if targetUser.boss or targetUser.mini then
     IgnoreDef=IgnoreDef1
  else
     IgnoreDef=(IgnoreDef1+IgnoreDef2)
  end

  if IgnoreDef >= 1 then
     IgnoreDef=1
  end
  ------------------------------------------------------------------------------------将原来的物伤加成改成精炼物理攻击
  local MRefine = srcUser:GetProperty("MRefine")
    ------------------------------------------------------------------------------------将原来的物伤加成改成精炼物理攻击
  local Refine = srcUser:GetProperty("Refine")

  local Def2 = targetUser:GetProperty("Def")
  local DefPer2 = targetUser:GetProperty("DefPer")
  local Vit2 = targetUser:GetProperty("Vit")
  local VitPer2 = targetUser:GetProperty("VitPer")
  local DamReduc2 = CommonFun.calcDamReDuc(srcUser, targetUser)
  local RefineDamReduc = targetUser:GetProperty("RefineDamReduc")

  local damChangePer = damageParam.damChangePer
  ----------------------------------------------------------------------------------------------------------------种族，体型，属性，BOSS加伤效果
  local raceparam     = CommonFun.CalcRaceParam(srcUser, targetUser, params, damageParam, logger)
  local bodyparam     = CommonFun.CalcBodyParam(srcUser, targetUser, params, damageParam, logger)
  local elementparam  = CommonFun.CalcElementParam(srcUser, targetUser, params, damageParam, logger)
  local bossparam     = CommonFun.CalcBossParam(srcUser, targetUser, params, damageParam, logger)

  ----------------------------------------------------------------------------------------------------------------种族，体型，属性，BOSS减伤效果
  local raceparam2    = CommonFun.CalcRaceParam2(srcUser, targetUser, params, damageParam, logger)
  local bodyparam2    = CommonFun.CalcBodyParam2(srcUser, targetUser, params, damageParam, logger)
  local elementparam2 = CommonFun.CalcElementParam2(srcUser, targetUser, params, damageParam, logger)
  local bossparam2    = CommonFun.CalcBossParam2(srcUser, targetUser, params, damageParam, logger)



  local BaseAtk  = Str*2 + math.floor(Str*Str/100) + math.floor(Dex/5) + math.floor(Luk/5)
  local AtkFinal = ((Atk-BaseAtk)*(1+AtkPer)*CommonFun.ShapeCorrection(srcUser,targetUser)*bodyparam*elementparam*elementparam2+BaseAtk)*raceparam*bossparam*bossparam2
  local BaseMAtk = Int+math.floor(Int*Int/100)
  local MAtkFinal= ((MAtk-BaseMAtk)*(1+MAtkPer)+BaseMAtk)*raceparam

  ----------------------------物理防御减免
  local DefReduc= CommonFun.CalcDef(Def,Vit,srcUser,targetUser)

  --------------------------------------------星盘 强酸火烟瓶
  local Num1 = srcUser:GetRunePoint(130210)
  local RuneDamage1 = Num1*0.08+1

  ------------------------------------------艾尔德
  ---------------------------------------------------酸蚀之触
  local  aerde2=0
  local weaponRefineLv=srcUser:GetEquipedRefineLv(7)
  if srcUser:HasBuffID(40610) or srcUser:HasBuffID(42000) then
      aerde2=weaponRefineLv*0.3
  end

  ------------------------------------------艾尔德[第四档]【强酸火焰瓶投掷】
  local Int8 = srcUser:GetProperty("Int")
  local Str8 = srcUser:GetProperty("Str")
  local Vit8 = srcUser:GetProperty("Vit")
    if (srcUser:HasBuffID(90001883) and Int8>=119 and Str8>=119 ) then
    aerde2=aerde2+0.75
  end
  ---------------------------------------------------酸蚀之触
  if (srcUser:HasBuffID(42000) and Int8>=119 and Str8>=119 ) then
   aerde2=aerde2+0.75
  end


  ------------------------------------------艾尔德+化学防护手套
  local  aerde3=1
  if srcUser:HasBuffID(91000300) then
      aerde3=0.15 + aerde3
  end
  ---------------------------------------------------酸蚀之触 + 化学防护手套
   if srcUser:HasBuffID(91000710) then
      aerde3=0.15 + aerde3
  end

  if srcUser:HasBuffID(90002203) then
      aerde3=0.05 + aerde3
  end

  -------------------------------------星盘 丽芙祈福
  local Num2 = srcUser:GetRunePoint(130170)
  local RuneDamage2 = 1
  if srcUser:IsBeingPresent(600010)==true then
      RuneDamage2 = Num2*0.02+1
  end
  ------------------------------------------目标体质相关的倍率
  local skilllv_1 = srcUser:GetLernedSkillLevel(411)
  local VitRatio = 0
  local Num3 = srcUser:GetRunePoint(133010)
      Vit2 = Vit2+Num3*10
  if Vit2 > 0 and Vit2 <=80 then
      VitRatio = Vit2/50*(1+skilllv_1/40)
  elseif Vit2 > 80 and Vit2 <=120 then
      VitRatio = Vit2/45*(1+skilllv_1/35)
  elseif Vit2 > 120 and Vit2 <=150 then
      VitRatio = Vit2/40*(1+skilllv_1/30)
  elseif Vit2 > 150 and Vit2 <=200 then
      VitRatio = Vit2/30*(1+skilllv_1/25)
  elseif Vit2 > 200 then
      VitRatio = Vit2/20*(1+skilllv_1/25)
  end
  ----------------------------------------------------------灼热风暴
  local Fire=1
  local skilllv_2 = srcUser:GetLernedSkillLevel(1121)

  ---------------------------------星盘 疯狂火焰
  local Numxp= srcUser:GetRunePoint(134010)------------星盘点
  local RuneFire = Numxp*0.04

  if targetUser:HasBuffID(116204) then
      Fire = skilllv_2*0.04 + 1 + RuneFire
  end

  local A = (((AtkFinal+MAtkFinal)*DefReduc*(1-DamReduc2)+Refine+MRefine)*(damChangePer+VitRatio+aerde2)*(1-RefineDamReduc)*(1+DamIncrease)-Vit2*(1+VitPer2))*RuneDamage1*aerde3*RuneDamage2*Fire

  -----------------------------------------------火焰爆炸
  local skillID, skillLevel = CommonFun.UnmergeSkillID(params.skillIDAndLevel)
  ----------------------------------------------------------
    if skillID==1122 then
        --------------------------------------------
        local skilllv_3 = srcUser:GetLernedSkillLevel(422)
        local damChangePer = 2.8
        if skilllv_3<=10 then
            damChangePer = 2.8+0.8*skilllv_3
        elseif skilllv_3>10 then
            damChangePer =10.8 + 0.3*(skilllv_3-10)
        end
        ---------------------------------星盘
        local Numxp= srcUser:GetRunePoint(134090)------------星盘点
        local RuneDamageFire = 1 + Numxp*0.06

        A = (((AtkFinal+MAtkFinal)*DefReduc*(1-DamReduc2)+Refine+MRefine)*(damChangePer+VitRatio+aerde2)*(1-RefineDamReduc)*(1+DamIncrease)-Vit2*(1+VitPer2))*RuneDamage1*aerde3*RuneDamage2*Fire*RuneDamageFire
   end
   --------------------------------------不稳定药剂
   local skilllv_yj = srcUser:GetLernedSkillLevel(1135)
   local random_yj = srcUser:GetRandom()
   local Final_ran = (80 + random_yj*(skilllv_yj*0.05 + 0.45))/100

   if skilllv_yj>0 then
      A = A*Final_ran
      if Final_ran>1 then
          return A, CommonFun.DamageType.Crit
      end
   end

   if 1 >= A then
         return 1
   end

   return A
end

-----------------------------------------------------------------------------------------------------------------炼金术士 气泡虫伤害计算公式(已改)
function CommonFun.calcDamage_13205(srcUser, targetUser, params, damageParam, logger)
  local Str = srcUser:GetProperty("Str")
  local Dex = srcUser:GetProperty("Dex")
  local Luk = srcUser:GetProperty("Luk")
  local Atk = srcUser:GetProperty("Atk")
  local AtkPer = srcUser:GetProperty("AtkPer")
  local MAtk = srcUser:GetProperty("MAtk")
  local MAtkPer = srcUser:GetProperty("MAtkPer")
  local DamIncrease = srcUser:GetProperty("DamIncrease")
  local IgnoreDef  = 0
  local IgnoreDef1 = srcUser:GetProperty("IgnoreDef")
  local IgnoreDef2 = srcUser:GetProperty("IgnoreEquipDef")
  if targetUser.boss or targetUser.mini then
     IgnoreDef=IgnoreDef1
  else
     IgnoreDef=(IgnoreDef1+IgnoreDef2)
  end

  if IgnoreDef >= 1 then
     IgnoreDef=1
  end
  ------------------------------------------------------------------------------------将原来的物伤加成改成精炼物理攻击
  local MRefine = srcUser:GetProperty("MRefine")
    ------------------------------------------------------------------------------------将原来的物伤加成改成精炼物理攻击
  local Refine = srcUser:GetProperty("Refine")

  local Def2 = targetUser:GetProperty("Def")
  local DefPer2 = targetUser:GetProperty("DefPer")
  local Vit2 = targetUser:GetProperty("Vit")
  local VitPer2 = targetUser:GetProperty("VitPer")
  local DamReduc2 = CommonFun.calcDamReDuc(srcUser, targetUser)
  local RefineDamReduc = targetUser:GetProperty("RefineDamReduc")

  local damChangePer = damageParam.damChangePer
  local damChangePer1 = damageParam.damChangePer1
  local damChangePer2 = damageParam.damChangePer2
  ----------------------------------------------------------------------------------------------------------------种族，体型，属性，BOSS加伤效果
  local raceparam     = CommonFun.CalcRaceParam(srcUser, targetUser, params, damageParam, logger)
  local bodyparam     = CommonFun.CalcBodyParam(srcUser, targetUser, params, damageParam, logger)
  local elementparam  = CommonFun.CalcElementParam(srcUser, targetUser, params, damageParam, logger)
  local bossparam     = CommonFun.CalcBossParam(srcUser, targetUser, params, damageParam, logger)

  ----------------------------------------------------------------------------------------------------------------种族，体型，属性，BOSS减伤效果
  local raceparam2    = CommonFun.CalcRaceParam2(srcUser, targetUser, params, damageParam, logger)
  local bodyparam2    = CommonFun.CalcBodyParam2(srcUser, targetUser, params, damageParam, logger)
  local elementparam2 = CommonFun.CalcElementParam2(srcUser, targetUser, params, damageParam, logger)
  local bossparam2    = CommonFun.CalcBossParam2(srcUser, targetUser, params, damageParam, logger)



  local BaseAtk  = Str*2 + math.floor(Str*Str/100) + math.floor(Dex/5) + math.floor(Luk/5)
  local AtkFinal = ((Atk-BaseAtk)*(1+AtkPer)*CommonFun.ShapeCorrection(srcUser,targetUser)*bodyparam*elementparam*elementparam2+BaseAtk)*raceparam*bossparam*bossparam2

  ----------------------------物理防御减免
  local DefReduc= CommonFun.CalcDef(Def,Vit,srcUser,targetUser)

  --------------------------------------------星盘 气泡虫召唤
  local Num1 = srcUser:GetRunePoint(130020)
  local RuneDamage1 = Num1*0.3
  -------------------------------------------------------红色手提包
  local Redhandbag = 1
  local Ring1=srcUser:GetEquipedID(1)
  if (Ring1==42551 or Ring1==142551) then
    Redhandbag=1.15
  end

   -------------------------------------------------------红色手提包[第四档]

  local RefineLv1=srcUser:GetEquipedRefineLv(1)
   if (RefineLv1>=5 and srcUser:HasBuffID(90002213)) then
    Redhandbag = Redhandbag + 0.1
  end

  local A = (((AtkFinal*DefReduc*(1-DamReduc2)+Refine)*(damChangePer+RuneDamage1)+damChangePer1*DefReduc*(1-DamReduc2))*(1-RefineDamReduc)*(1+DamIncrease)-Vit2*(1+VitPer2))*damChangePer2*Redhandbag


  local skillID, skillLevel = CommonFun.UnmergeSkillID(params.skillIDAndLevel)
  ----------------------------------------------------------气泡虫寄生
         -------------------------------------------------------红色手提包
  local Redhandbag1 = 1
  local Ring1=srcUser:GetEquipedID(1)
  if (Ring1==42551 or Ring1==142551) then
    Redhandbag1=1.15
  end

   -------------------------------------------------------红色手提包[第四档]

  local RefineLv1=srcUser:GetEquipedRefineLv(1)
   if (RefineLv1>=5 and srcUser:HasBuffID(90002213)) then
    Redhandbag1 = Redhandbag1 + 0.1
  end
    if skillID==415 then

        --------------------------------------------星盘 气泡虫寄生
        local Num2 = srcUser:GetRunePoint(130080)
        local RuneDamage2 = Num2*0.1+1
        A = A*RuneDamage2*Redhandbag1
   end

   if 1 >= A then
         return 1
   end

   return A
end

-----------------------------------------------------------------------------------------------------------------炼金术士地狱植物计算公式(已改)
function CommonFun.calcDamage_13206(srcUser, targetUser, params, damageParam, logger)
  local Str = srcUser:GetProperty("Str")
  local Dex = srcUser:GetProperty("Dex")
  local Luk = srcUser:GetProperty("Luk")
  local Atk = srcUser:GetProperty("Atk")
  local AtkPer = srcUser:GetProperty("AtkPer")
  local DamIncrease = srcUser:GetProperty("DamIncrease")
  local IgnoreDef  = 0
  local IgnoreDef1 = srcUser:GetProperty("IgnoreDef")
  local IgnoreDef2 = srcUser:GetProperty("IgnoreEquipDef")
  if targetUser.boss or targetUser.mini then
     IgnoreDef=IgnoreDef1
  else
     IgnoreDef=(IgnoreDef1+IgnoreDef2)
  end

  if IgnoreDef >= 1 then
     IgnoreDef=1
  end
    ------------------------------------------------------------------------------------将原来的物伤加成改成精炼物理攻击
  local Refine = srcUser:GetProperty("Refine")

  local Def2 = targetUser:GetProperty("Def")
  local DefPer2 = targetUser:GetProperty("DefPer")
  local Vit2 = targetUser:GetProperty("Vit")
  local VitPer2 = targetUser:GetProperty("VitPer")
  local DamReduc2 = CommonFun.calcDamReDuc(srcUser, targetUser)
  local RefineDamReduc = targetUser:GetProperty("RefineDamReduc")

  local damChangePer = damageParam.damChangePer

  ----------------------------------------------------------------------------------------------------------------种族，体型，属性，BOSS加伤效果
  local raceparam     = CommonFun.CalcRaceParam(srcUser, targetUser, params, damageParam, logger)
  local bodyparam     = CommonFun.CalcBodyParam(srcUser, targetUser, params, damageParam, logger)
  local elementparam  = CommonFun.CalcElementParam(srcUser, targetUser, params, damageParam, logger)
  local bossparam     = CommonFun.CalcBossParam(srcUser, targetUser, params, damageParam, logger)

  ----------------------------------------------------------------------------------------------------------------种族，体型，属性，BOSS减伤效果
  local raceparam2    = CommonFun.CalcRaceParam2(srcUser, targetUser, params, damageParam, logger)
  local bodyparam2    = CommonFun.CalcBodyParam2(srcUser, targetUser, params, damageParam, logger)
  local elementparam2 = CommonFun.CalcElementParam2(srcUser, targetUser, params, damageParam, logger)
  local bossparam2    = CommonFun.CalcBossParam2(srcUser, targetUser, params, damageParam, logger)



  local BaseAtk  = Str*2 + math.floor(Str*Str/100) + math.floor(Dex/5) + math.floor(Luk/5)
  local AtkFinal = ((Atk-BaseAtk)*(1+AtkPer)*CommonFun.ShapeCorrection(srcUser,targetUser)*bodyparam*elementparam*elementparam2+BaseAtk)*raceparam*bossparam*bossparam2

  ----------------------------物理防御减免
  local DefReduc= CommonFun.CalcDef(Def,Vit,srcUser,targetUser)

  -----------------------生命体强化2
  local skilllv_1 = srcUser:GetLernedSkillLevel(428)
  --------------------------------------------星盘 地狱植物
  local Num1 = srcUser:GetRunePoint(130140)
  local RuneDamage1 = Num1*0.05+1
  ------------------------------------------生命通灵
  local skilllv_2 = srcUser:GetLernedSkillLevel(417)
  local life = 1
  if srcUser:HasBuffID(104050) then
      life = 1+ 0.02*skilllv_2
  end
  -------------------------------------------生命融合
  local skilllv_3 = srcUser:GetLernedSkillLevel(1126)
  if srcUser:HasBuffID(116221) then
      life = life+ 0.03*skilllv_3
  end

  -------------------------------------- 破灭战斧
  local pomieNum1 = 1
  if  srcUser:HasBuffID(42010)  then
       pomieNum1 = 1.15
  end


  local A = ((AtkFinal*DefReduc*(1-DamReduc2)+Refine)*(damChangePer+skilllv_1*0.1)*(1-RefineDamReduc)*(1+DamIncrease)-Vit2*(1+VitPer2))*RuneDamage1*life*pomieNum1


   if 1 >= A then
         return 1
   end

   return A
end
-----------------------------------------------------------------------------------------------------------------炼金术士 疯狂火焰伤害计算公式(已改)
function CommonFun.calcDamage_13401(srcUser, targetUser, params, damageParam, logger)
  local Str = srcUser:GetProperty("Str")
  local Dex = srcUser:GetProperty("Dex")
  local Luk = srcUser:GetProperty("Luk")
  local Atk = srcUser:GetProperty("Atk")
  local AtkPer = srcUser:GetProperty("AtkPer")
  local MAtk = srcUser:GetProperty("MAtk")
  local MAtkPer = srcUser:GetProperty("MAtkPer")
  local DamIncrease = srcUser:GetProperty("DamIncrease")
  local IgnoreDef  = 0
  local IgnoreDef1 = srcUser:GetProperty("IgnoreDef")
  local IgnoreDef2 = srcUser:GetProperty("IgnoreEquipDef")
  if targetUser.boss or targetUser.mini then
     IgnoreDef=IgnoreDef1
  else
     IgnoreDef=(IgnoreDef1+IgnoreDef2)
  end

  if IgnoreDef >= 1 then
     IgnoreDef=1
  end
  ------------------------------------------------------------------------------------将原来的物伤加成改成精炼物理攻击
  local MRefine = srcUser:GetProperty("MRefine")
    ------------------------------------------------------------------------------------将原来的物伤加成改成精炼物理攻击
  local Refine = srcUser:GetProperty("Refine")

  local Def2 = targetUser:GetProperty("Def")
  local DefPer2 = targetUser:GetProperty("DefPer")
  local Vit2 = targetUser:GetProperty("Vit")
  local VitPer2 = targetUser:GetProperty("VitPer")
  local DamReduc2 = CommonFun.calcDamReDuc(srcUser, targetUser)
  local MDamReduc2 = CommonFun.calcMDamReDuc(srcUser, targetUser)
  local RefineMDamReduc = targetUser:GetProperty("RefineMDamReduc")
  local MDamIncrease = CommonFun.calcMDamIncrease(srcUser, targetUser)

  local damChangePer = damageParam.damChangePer
  ----------------------------------------------------------------------------------------------------------------种族，体型，属性，BOSS加伤效果
  local raceparam     = CommonFun.CalcRaceParam(srcUser, targetUser, params, damageParam, logger)
  local bodyparam     = CommonFun.CalcBodyParam(srcUser, targetUser, params, damageParam, logger)
  local elementparam  = CommonFun.CalcElementParam(srcUser, targetUser, params, damageParam, logger)
  local bossparam     = CommonFun.CalcBossParam(srcUser, targetUser, params, damageParam, logger)

  ----------------------------------------------------------------------------------------------------------------种族，体型，属性，BOSS减伤效果
  local raceparam2    = CommonFun.CalcRaceParam2(srcUser, targetUser, params, damageParam, logger)
  local bodyparam2    = CommonFun.CalcBodyParam2(srcUser, targetUser, params, damageParam, logger)
  local elementparam2 = CommonFun.CalcElementParam2(srcUser, targetUser, params, damageParam, logger)
  local bossparam2    = CommonFun.CalcBossParam2(srcUser, targetUser, params, damageParam, logger)

  local BaseAtk  = Str*2 + math.floor(Str*Str/100) + math.floor(Dex/5) + math.floor(Luk/5)
  local AtkFinal = ((Atk-BaseAtk)*(1+AtkPer)*CommonFun.ShapeCorrection(srcUser,targetUser)*bodyparam*elementparam*elementparam2+BaseAtk)*raceparam*bossparam*bossparam2

  ----------------------------魔法防御减免
  local MDefReduc = CommonFun.CalcMDef(MDef,Int,Vit,srcUser,targetUser)

  local A = ((AtkFinal*MDefReduc*(1-MDamReduc2)+Refine)*damChangePer*(1-RefineMDamReduc)*(1+MDamIncrease)-Vit2*(1+VitPer2))

   if 1 >= A then
         return 1
   end

   return A
end

-----------------------------------------------------------------------------------------------------------------炼金术士 加农炮技能 计算公式(已改)
function CommonFun.calcDamage_13402(srcUser, targetUser, params, damageParam, logger)
  local Str = srcUser:GetProperty("Str")
  local Dex = srcUser:GetProperty("Dex")
  local Luk = srcUser:GetProperty("Luk")
  local Int = srcUser:GetProperty("Int")
  local Atk = srcUser:GetProperty("Atk")
  local AtkPer = srcUser:GetProperty("AtkPer")
  local DamIncrease = srcUser:GetProperty("DamIncrease")
  local IgnoreDef  = 0
  local IgnoreDef1 = srcUser:GetProperty("IgnoreDef")
  local IgnoreDef2 = srcUser:GetProperty("IgnoreEquipDef")
  if targetUser.boss or targetUser.mini then
     IgnoreDef=IgnoreDef1
  else
     IgnoreDef=(IgnoreDef1+IgnoreDef2)
  end

  if IgnoreDef >= 1 then
     IgnoreDef=1
  end
    ------------------------------------------------------------------------------------将原来的物伤加成改成精炼物理攻击
  local Refine = srcUser:GetProperty("Refine")

  local Def2 = targetUser:GetProperty("Def")
  local DefPer2 = targetUser:GetProperty("DefPer")
  local Vit2 = targetUser:GetProperty("Vit")
  local VitPer2 = targetUser:GetProperty("VitPer")
  local DamReduc2 = CommonFun.calcDamReDuc(srcUser, targetUser)
  local RefineDamReduc = targetUser:GetProperty("RefineDamReduc")

  local damChangePer = damageParam.damChangePer
  local skilllv_1 = srcUser:GetLernedSkillLevel(266)
  ----------------------------------------------------------------------------------------------------------------种族，体型，属性，BOSS加伤效果
  local raceparam     = CommonFun.CalcRaceParam(srcUser, targetUser, params, damageParam, logger)
  local bodyparam     = CommonFun.CalcBodyParam(srcUser, targetUser, params, damageParam, logger)
  local elementparam  = CommonFun.CalcElementParam(srcUser, targetUser, params, damageParam, logger)
  local bossparam     = CommonFun.CalcBossParam(srcUser, targetUser, params, damageParam, logger)

  ----------------------------------------------------------------------------------------------------------------种族，体型，属性，BOSS减伤效果
  local raceparam2    = CommonFun.CalcRaceParam2(srcUser, targetUser, params, damageParam, logger)
  local bodyparam2    = CommonFun.CalcBodyParam2(srcUser, targetUser, params, damageParam, logger)
  local elementparam2 = CommonFun.CalcElementParam2(srcUser, targetUser, params, damageParam, logger)
  local bossparam2    = CommonFun.CalcBossParam2(srcUser, targetUser, params, damageParam, logger)



  local BaseAtk  = Str*2 + math.floor(Str*Str/100) + math.floor(Dex/5) + math.floor(Luk/5)
  local AtkFinal = ((Atk-BaseAtk+skilllv_1*15)*(1+AtkPer)*CommonFun.ShapeCorrection(srcUser,targetUser)*bodyparam*elementparam*elementparam2+BaseAtk)*raceparam*bossparam*bossparam2

  ----------------------------物理防御减免
  local DefReduc= CommonFun.CalcDef(Def,Vit,srcUser,targetUser)
  ---------------------------------星盘 加农炮
  local Numxp= srcUser:GetRunePoint(134040)------------星盘点
  local RuneDamage = 1 + Numxp*0.1

-------------------------------------------------------红色手提包[第四档]

  local Redhandbag = 1
  local RefineLv1=srcUser:GetEquipedRefineLv(1)
   if (RefineLv1>=10 and srcUser:HasBuffID(90002213)) then
    Redhandbag = Redhandbag + 0.15
  end


    local A = ((AtkFinal*DefReduc*(1-DamReduc2)+Refine)*(damChangePer+Int/20)*(1-RefineDamReduc)*(1+DamIncrease)-Vit2*(1+VitPer2))*RuneDamage*Redhandbag


   if 1 >= A then
         return 1
   end

   return A
end

-----------------------------------------------------------------------------------------------------------------炼金术士 野草 计算公式(已改)
function CommonFun.calcDamage_13403(srcUser, targetUser, params, damageParam, logger)
  local Str = srcUser:GetProperty("Str")
  local Dex = srcUser:GetProperty("Dex")
  local Luk = srcUser:GetProperty("Luk")
  local Int = srcUser:GetProperty("Int")
  local Atk = srcUser:GetProperty("Atk")
  local AtkPer = srcUser:GetProperty("AtkPer")
  local DamIncrease = srcUser:GetProperty("DamIncrease")
  local IgnoreDef  = 0
  local IgnoreDef1 = srcUser:GetProperty("IgnoreDef")
  local IgnoreDef2 = srcUser:GetProperty("IgnoreEquipDef")
  if targetUser.boss or targetUser.mini then
     IgnoreDef=IgnoreDef1
  else
     IgnoreDef=(IgnoreDef1+IgnoreDef2)
  end

  if IgnoreDef >= 1 then
     IgnoreDef=1
  end
    ------------------------------------------------------------------------------------将原来的物伤加成改成精炼物理攻击
  local Refine = srcUser:GetProperty("Refine")

  local Def2 = targetUser:GetProperty("Def")
  local DefPer2 = targetUser:GetProperty("DefPer")
  local Vit2 = targetUser:GetProperty("Vit")
  local VitPer2 = targetUser:GetProperty("VitPer")
  local DamReduc2 = CommonFun.calcDamReDuc(srcUser, targetUser)
  local RefineDamReduc = targetUser:GetProperty("RefineDamReduc")

  local damChangePer = damageParam.damChangePer

  ----------------------------------------------------------------------------------------------------------------种族，体型，属性，BOSS加伤效果
  local raceparam     = CommonFun.CalcRaceParam(srcUser, targetUser, params, damageParam, logger)
  local bodyparam     = CommonFun.CalcBodyParam(srcUser, targetUser, params, damageParam, logger)
  local elementparam  = CommonFun.CalcElementParam(srcUser, targetUser, params, damageParam, logger)
  local bossparam     = CommonFun.CalcBossParam(srcUser, targetUser, params, damageParam, logger)

  ----------------------------------------------------------------------------------------------------------------种族，体型，属性，BOSS减伤效果
  local raceparam2    = CommonFun.CalcRaceParam2(srcUser, targetUser, params, damageParam, logger)
  local bodyparam2    = CommonFun.CalcBodyParam2(srcUser, targetUser, params, damageParam, logger)
  local elementparam2 = CommonFun.CalcElementParam2(srcUser, targetUser, params, damageParam, logger)
  local bossparam2    = CommonFun.CalcBossParam2(srcUser, targetUser, params, damageParam, logger)



  local BaseAtk  = Str*2 + math.floor(Str*Str/100) + math.floor(Dex/5) + math.floor(Luk/5)
  local AtkFinal = ((Atk-BaseAtk)*(1+AtkPer)*CommonFun.ShapeCorrection(srcUser,targetUser)*bodyparam*elementparam*elementparam2+BaseAtk)*raceparam*bossparam*bossparam2

  ----------------------------物理防御减免
  local DefReduc= CommonFun.CalcDef(Def,Vit,srcUser,targetUser)

  local A = ((AtkFinal*DefReduc*(1-DamReduc2)+Refine)*damChangePer*(1-RefineDamReduc)*(1+DamIncrease)-Vit2*(1+VitPer2))

   -------------------------------------------------------红色手提包
  local Redhandbag3 = 1
  local Ring1=srcUser:GetEquipedID(1)
    if (Ring1==42551 or Ring1==142551) then
      Redhandbag3=1.15
    end

  -------------------------------------------------------红色手提包[第四档]

  local RefineLv1=srcUser:GetEquipedRefineLv(1)
   if (RefineLv1>=10 and srcUser:HasBuffID(90002213)) then
    Redhandbag3 = Redhandbag3 + 0.15
  end


  local skillID, skillLevel = CommonFun.UnmergeSkillID(params.skillIDAndLevel)
   if skillID==1124 then
        ---------------------------------星盘
        local Numxp= srcUser:GetRunePoint(134060)------------星盘点
        local RuneDamage = 1 + Numxp*0.08
         A = A*Redhandbag3*RuneDamage
   end


   if 1 >= A then
         return 1
   end

   return A
end

-- 技能吸血
function CommonFun.CalcSuckBlood(srcUser, damage, skillid)
    local skillParams = Table_Skill[skillid]
    if skillParams == nil or skillParams.Logic_Param == nil then
      return 0
    end

    local Num1=srcUser:GetRunePoint(42130)
    local RuneDamage=0.01*Num1
    local skilllv_1=srcUser:GetLernedSkillLevel(1168)

    if skillParams.Logic_Param.isSuckSkill then
          if math.floor(skillid/1000)==130 and skillid%100<=5 then
              return damage * (0.15+RuneDamage)
          end
          if math.floor(skillid/1000)==130 and skillid%100>5 then
              return damage * (0.3+RuneDamage)
          end
          ----------------------------------------生命吸收
          if math.floor(skillid/1000)==1168 then
              return damage*(0.25+math.min(skilllv_1,5)*0.05)
          end
    end

    return 0
end



----------------------------------------------------------公式调用
CommonFun.CalcDamageFuncs = {
  [17]   = CommonFun.calcDamage_17,
  [18]   = CommonFun.calcDamage_18,
  [19]   = CommonFun.calcDamage_19,
  [20]   = CommonFun.calcDamage_20,
  [21]   = CommonFun.calcDamage_21,
  [22]   = CommonFun.calcDamage_22,
  [23]   = CommonFun.calcDamage_23,
  [24]   = CommonFun.calcDamage_24,
  [25]   = CommonFun.calcDamage_25,
  [26]   = CommonFun.calcDamage_26,
  [27]   = CommonFun.calcDamage_27,
  [28]   = CommonFun.calcDamage_28,
  [30]   = CommonFun.calcDamage_30,
  [31]   = CommonFun.calcDamage_31,
  [32]   = CommonFun.calcDamage_32,
  [33]   = CommonFun.calcDamage_33,
  [34]   = CommonFun.calcDamage_34,
  [35]   = CommonFun.calcDamage_35,
  [36]   = CommonFun.calcDamage_36,
  [37]   = CommonFun.calcDamage_37,
  [38]   = CommonFun.calcDamage_38,
  [39]   = CommonFun.calcDamage_39,
  [40]   = CommonFun.calcDamage_40,
  [41]   = CommonFun.calcDamage_41,
  [42]   = CommonFun.calcDamage_42,
  [43]   = CommonFun.calcDamage_43,
  [50]   = CommonFun.calcDamage_50,
  [60]   = CommonFun.calcDamage_60,
  [80]   = CommonFun.calcDamage_80,
  [100]   = CommonFun.calcDamage_100,
  [101]   = CommonFun.calcDamage_101,
  [1101] = CommonFun.calcDamage_1101,
  [1102] = CommonFun.calcDamage_1102,
  [1103] = CommonFun.calcDamage_1103,
  [1201] = CommonFun.calcDamage_1201,
  [1202] = CommonFun.calcDamage_1202,
  [1203] = CommonFun.calcDamage_1203,
  [1204] = CommonFun.calcDamage_1204,
  [1205] = CommonFun.calcDamage_1205,
  [1206] = CommonFun.calcDamage_1206,
  [1207] = CommonFun.calcDamage_1207,
  [1301] = CommonFun.calcDamage_1301,
  [1302] = CommonFun.calcDamage_1302,
  [1401] = CommonFun.calcDamage_1401,
  [1402] = CommonFun.calcDamage_1402,
  [2103] = CommonFun.calcDamage_2103,
  [2201] = CommonFun.calcDamage_2201,
  [2301] = CommonFun.calcDamage_2301,
  [2302] = CommonFun.calcDamage_2302,
  [2303] = CommonFun.calcDamage_2303,
  [2304] = CommonFun.calcDamage_2304,
  [2305] = CommonFun.calcDamage_2305,
  [2306] = CommonFun.calcDamage_2306,
  [3101] = CommonFun.calcDamage_3101,
  [3102] = CommonFun.calcDamage_3102,
  [3103] = CommonFun.calcDamage_3103,
  [3104] = CommonFun.calcDamage_3104,
  [3105] = CommonFun.calcDamage_3105,
  [3106] = CommonFun.calcDamage_3106,
  [3201] = CommonFun.calcDamage_3201,
  [3202] = CommonFun.calcDamage_3202,
  [3301] = CommonFun.calcDamage_3301,
  [3401] = CommonFun.calcDamage_3401,
  [3402] = CommonFun.calcDamage_3402,
  [4101] = CommonFun.calcDamage_4101,
  [4102] = CommonFun.calcDamage_4102,
  [4103] = CommonFun.calcDamage_4103,
  [4201] = CommonFun.calcDamage_4201,
  [4202] = CommonFun.calcDamage_4202,
  [4203] = CommonFun.calcDamage_4203,
  [4301] = CommonFun.calcDamage_4301,
  [4401] = CommonFun.calcDamage_4401,
  [5101] = CommonFun.calcDamage_5101,
  [5102] = CommonFun.calcDamage_5102,
  [5103] = CommonFun.calcDamage_5103,
  [5104] = CommonFun.calcDamage_5104,
  [5105] = CommonFun.calcDamage_5105,
  [5106] = CommonFun.calcDamage_5106,
  [5401] = CommonFun.calcDamage_5401,
  [5402] = CommonFun.calcDamage_5402,
  [6101] = CommonFun.calcDamage_6101,
  [6102] = CommonFun.calcDamage_6102,
  [6103] = CommonFun.calcDamage_6103,
  [6104] = CommonFun.calcDamage_6104,
  [6105] = CommonFun.calcDamage_6105,
  [6106] = CommonFun.calcDamage_6106,
  [6301] = CommonFun.calcDamage_6301,
  [6302] = CommonFun.calcDamage_6302,
  [6401] = CommonFun.calcDamage_6401,
  [6402] = CommonFun.calcDamage_6402,
  [6403] = CommonFun.calcDamage_6403,
  [6404] = CommonFun.calcDamage_6404,
  [7201] = CommonFun.calcDamage_7201,
  [7202] = CommonFun.calcDamage_7202,
  [7203] = CommonFun.calcDamage_7203,
  [7204] = CommonFun.calcDamage_7204,
  [7205] = CommonFun.calcDamage_7205,
  [7401] = CommonFun.calcDamage_7401,
  [7402] = CommonFun.calcDamage_7402,
  [8000] = CommonFun.calcDamage_8000,
  [8001] = CommonFun.calcDamage_8001,
  [8002] = CommonFun.calcDamage_8002,
  [8003] = CommonFun.calcDamage_8003,
  [8004] = CommonFun.calcDamage_8004,
  [8005] = CommonFun.calcDamage_8005,
  [8006] = CommonFun.calcDamage_8006,
  [8007] = CommonFun.calcDamage_8007,
  [8008] = CommonFun.calcDamage_8008,
  [8020] = CommonFun.calcDamage_8020,
  [8030] = CommonFun.calcDamage_8030,
  [8031] = CommonFun.calcDamage_8031,
  [8032] = CommonFun.calcDamage_8032,
  [8021] = CommonFun.calcDamage_8021,
  [8201] = CommonFun.calcDamage_8201,
  [8202] = CommonFun.calcDamage_8202,
  [8203] = CommonFun.calcDamage_8203,
  [8204] = CommonFun.calcDamage_8204,
  [8205] = CommonFun.calcDamage_8205,
  [9000] = CommonFun.calcDamage_9000,
  [9001] = CommonFun.calcDamage_9001,
  [9002] = CommonFun.calcDamage_9002,
  [9003] = CommonFun.calcDamage_9003,
  [9004] = CommonFun.calcDamage_9004,
  [9005] = CommonFun.calcDamage_9005,
  [9006] = CommonFun.calcDamage_9006,
  [9010] = CommonFun.calcDamage_9010,
  [9011] = CommonFun.calcDamage_9011,
  [9012] = CommonFun.calcDamage_9012,
  [9013] = CommonFun.calcDamage_9013,
  [9014] = CommonFun.calcDamage_9014,
  [9015] = CommonFun.calcDamage_9015,
  [9016] = CommonFun.calcDamage_9016,
  [9017] = CommonFun.calcDamage_9017,
  [9018] = CommonFun.calcDamage_9018,
  [9201] = CommonFun.calcDamage_9201,
  [9202] = CommonFun.calcDamage_9202,
  [9203] = CommonFun.calcDamage_9203,
  [9204] = CommonFun.calcDamage_9204,
  [9205] = CommonFun.calcDamage_9205,
  [9206] = CommonFun.calcDamage_9206,
  [9401] = CommonFun.calcDamage_9401,
  [10201] = CommonFun.calcDamage_10201,
  [11201] = CommonFun.calcDamage_11201,
  [11202] = CommonFun.calcDamage_11202,
  [11203] = CommonFun.calcDamage_11203,
  [11204] = CommonFun.calcDamage_11204,
  [12201] = CommonFun.calcDamage_12201,
  [12202] = CommonFun.calcDamage_12202,
  [12203] = CommonFun.calcDamage_12203,
  [12204] = CommonFun.calcDamage_12204,
  [12205] = CommonFun.calcDamage_12205,
  [12206] = CommonFun.calcDamage_12206,
  [12207] = CommonFun.calcDamage_12207,
  [12208] = CommonFun.calcDamage_12208,
  [12401] = CommonFun.calcDamage_12401,
  [12402] = CommonFun.calcDamage_12402,
  [12403] = CommonFun.calcDamage_12403,
  [12404] = CommonFun.calcDamage_12404,
  [12405] = CommonFun.calcDamage_12405,
  [13201] = CommonFun.calcDamage_13201,
  [13202] = CommonFun.calcDamage_13202,
  [13203] = CommonFun.calcDamage_13203,
  [13204] = CommonFun.calcDamage_13204,
  [13205] = CommonFun.calcDamage_13205,
  [13206] = CommonFun.calcDamage_13206,
  [13401] = CommonFun.calcDamage_13401,
  [13402] = CommonFun.calcDamage_13402,
  [13403] = CommonFun.calcDamage_13403,
}

function CommonFun.calcOdds_1(srcUser)

 return 100

end

function CommonFun.calcOdds_2(srcUser,targetUser)
 if srcUser==nil or targetUser==nil then
    return 0
 end
  -----------------------------------------------------------------猎人系老鹰普攻是否可携带宠物进行攻击的判定
  local skilllv_1 = srcUser:GetLernedSkillLevel(126)
    if skilllv_1<=0 then
      return 0
    end

  local Hp         =  targetUser:GetProperty("Hp")
  local MaxHp      =  targetUser:GetProperty("MaxHp")
  -------------------------------------------星盘闪电冲击概率
  local Num1=srcUser:GetRunePoint(42001)
  local Num2=srcUser:GetRunePoint(42002)
  local Num3=srcUser:GetRunePoint(42003)
  local Num4=srcUser:GetRunePoint(42004)
  local Num5=srcUser:GetRunePoint(42005)
  local RuneDamage=Num1*2+Num2*1+Num3*1+Num4*1+Num5*2
  -------------------------------------------野性觉醒的计算效果
  local skilllv_2 = srcUser:GetLernedSkillLevel(250)
  local Luk = srcUser:GetProperty("Luk")

  if skilllv_2<=5 and Hp<=MaxHp*0.3 then
    return 5+Luk/3+skilllv_2*6+RuneDamage
  elseif skilllv_2>5 and Hp<=MaxHp*0.5 then
    return 5+Luk/3+30+RuneDamage
  end

    return 5+Luk/3+RuneDamage
end

function CommonFun.calcTrapNum(srcUser)
  -----------------------------------------------------------------猎人系可安放陷阱的总个数上限
local skilllv_1 = srcUser:GetLernedSkillLevel(142)
   if skilllv_1<=0 then
      return 8
   elseif  skilllv_1>0 and skilllv_1<=2 then
      return 9
   elseif  skilllv_1>2 and skilllv_1<=4 then
      return 10
   elseif  skilllv_1>4 and skilllv_1<=6 then
      return 11
   elseif  skilllv_1>6 and skilllv_1<=8 then
      return 12
   else
      return 13
   end
end

-------------------------------------------------------------------刺客系技能无影之牙释放有概率不接触隐匿状态
function CommonFun.calcOdds_4(srcUser)
local skilllv_1 = srcUser:GetLernedSkillLevel(183)
 if skilllv_1<=0 then
    return 0
 end
    return skilllv_1*5+25
end

-------------------------------------------------------------------火柱选择多个目标的技能表配置
function CommonFun.calcOdds_5(srcUser)
  local Num1=srcUser:GetRunePoint(22041)
  local Num2=srcUser:GetRunePoint(22043)
  return Num1 + Num2
end

-------------------------------------------------------------------缓速术选择多个目标的技能表配置
function CommonFun.calcOdds_6(srcUser)
  local Num1=srcUser:GetRunePoint(52110)
  return Num1*3
end

-------------------------------------------------------------------吸气回蓝
function CommonFun.Inhale(srcUser, targetUser)

  if srcUser == nil or targetUser == nil then
      return 0
  end
  local A=0
  -------------------------------------------------------------------
  if targetUser:GetNpcID() == 0 then --------------------吸对方的球
      local Num1=targetUser:GetBuffLayer(100500)
      A = 7 * Num1
  elseif targetUser:GetNpcID()~=0 then
      if (targetUser.boss or targetUser.mini) then----------------------对MVP　mini 无效
          return 0
      elseif  CommonFun.IsInRate(10, srcUser:GetRandom()) then
          local BaseLv = targetUser.BaseLv
          A = BaseLv*2
      end
  end

  return A
end
-----------------------------------------------------------------流氓偷钱成功率及比例
function CommonFun.StealMoney(srcUser, targetUser)
  local skilllv_1 = srcUser:GetLernedSkillLevel(474) ---偷钱
  local skilllv_2 = srcUser:GetLernedSkillLevel(473) ---强夺
  local Dex = srcUser:GetProperty("Dex")
  local Luk = srcUser:GetProperty("Luk")
  local Rate = math.min(20,(Dex + Luk)/10)  ----D,L影响成功率
  local RateSum = Rate + 5

  local A = skilllv_1*0.05 +  skilllv_2*0.02

  if  CommonFun.IsInRate(RateSum, srcUser:GetRandom())  then
        return  A
  end

  return 0
end
-----------------------------------------------------------------流氓陷阱移除
function CommonFun.RemoveTrap(srcUser, targetUser)
  local skilllv_1 = srcUser:GetLernedSkillLevel(489) ---陷阱移除

  return skilllv_1
end
-------------------------------------------------------------------流氓隐蔽射击 概率不接触隐匿状态
function CommonFun.calcOdds_10(srcUser)
local skilllv_1 = srcUser:GetLernedSkillLevel(1148)
 if skilllv_1<=5 then
    return 0
 end
    return (skilllv_1*10-20)
end



function CommonFun.GetFormulaValue(srcUser, targetUser,type)
  if CommonFun.FormulaFuns[type] == nil then
    return 0
  end

  local  func = CommonFun.FormulaFuns[type]
  local  value = func(srcUser,targetUser)
  return value
end


CommonFun.FormulaFuns = {
  [1] = CommonFun.calcOdds_1,
  [2] = CommonFun.calcOdds_2,
  [3] = CommonFun.calcTrapNum,
  [4] = CommonFun.calcOdds_4,
  [5] = CommonFun.calcOdds_5,
  [6] = CommonFun.calcOdds_6,
  [7] = CommonFun.Inhale,
  [8] = CommonFun.StealMoney,
  [9] = CommonFun.RemoveTrap,
  [10] = CommonFun.calcOdds_10,
}

-----------------------------------------------------------------------------------------------------------------------------------------------素质影响的BUFF的概率计算公式--【中毒】
function CommonFun.calcAttrPoisonRate(srcUser, targetUser)
local Luk=srcUser:GetProperty("Luk")
local Vit=targetUser:GetProperty("Vit")
local Int=targetUser:GetProperty("Int")
local A = math.max(0.1,Luk*0.5/100)
local B = math.min(0.8,(Vit*0.3+Int*0.3)/100)
local Rate = 1 + A - B
if Rate <= 0 then
   Rate = 0
end
return Rate
end
-----------------------------------------------------------------------------------------------------------------------------------------------素质影响的BUFF的概率计算公式--【流血】
function CommonFun.calcAttrBlindRate(srcUser, targetUser)
local Int=srcUser:GetProperty("Int")
local Vit=targetUser:GetProperty("Vit")
local Int2=targetUser:GetProperty("Int")
local A = math.max(0.1,Int*0.5/100)
local B = math.min(0.8,(Vit*0.3+Int2*0.3)/100)
local Rate = 1 + A - B
if Rate <= 0 then
   Rate = 0
end
return Rate
end
-----------------------------------------------------------------------------------------------------------------------------------------------素质影响的BUFF的概率计算公式--【灼烧】
function CommonFun.calcAttrBurnRate(srcUser, targetUser)
local Int=srcUser:GetProperty("Int")
local Vit=targetUser:GetProperty("Vit")
local Agi=targetUser:GetProperty("Agi")
local A = math.max(0.1,Int*0.5/100)
local B = math.min(0.8,(Vit*0.3+Agi*0.3)/100)
local Rate = 1 + A - B
if Rate <= 0 then
   Rate = 0
end
return Rate
end
-----------------------------------------------------------------------------------------------------------------------------------------------素质影响的BUFF的概率计算公式--【眩晕】
function CommonFun.calcAttrDizzyRate(srcUser, targetUser)
local Str=srcUser:GetProperty("Str")
local Vit=targetUser:GetProperty("Vit")
local Agi=targetUser:GetProperty("Agi")
local A = math.max(0.1,Str*0.3/100)
local B = math.min(0.8,(Vit*0.3+Agi*0.3)/100)
local Rate = 1 + A - B
if Rate <= 0 then
   Rate = 0
end
return Rate
end

-----------------------------------------------------------------------------------------------------------------------------------------------素质影响的BUFF的概率计算公式--【冰冻】
function CommonFun.calcAttrFreezeRate(srcUser, targetUser)
local Int=srcUser:GetProperty("Int")
local Int2=targetUser:GetProperty("Int")
local Dex=targetUser:GetProperty("Dex")
local A = math.max(0.1,Int*0.3/100)
local B = math.min(0.8,(Int2*0.3+Dex*0.3)/100)
local Rate = 1 + A - B
if Rate <= 0 then
   Rate = 0
end
return Rate
end

-----------------------------------------------------------------------------------------------------------------------------------------------素质影响的BUFF的概率计算公式--【石化】
function CommonFun.calcAttrStoneRate(srcUser, targetUser)
local Int=srcUser:GetProperty("Int")
local Int2=targetUser:GetProperty("Int")
local Dex=targetUser:GetProperty("Dex")
local A = math.max(0.1,Int*0.3/100)
local B = math.min(0.8,(Int2*0.3+Dex*0.3)/100)
local Rate = 1 + A - B
if Rate <= 0 then
   Rate = 0
end
return Rate
end

-----------------------------------------------------------------------------------------------------------------------------------------------素质影响的BUFF的概率计算公式--【睡眠】
function CommonFun.calcAttrSleepRate(srcUser, targetUser)
local Dex=srcUser:GetProperty("Dex")
local Int=targetUser:GetProperty("Int")
local Luk=targetUser:GetProperty("Luk")
local A = math.max(0.1,Dex*0.3/100)
local B = math.min(0.5,(Int*0.3+Luk*0.3)/100)
local Rate = 1 + A - B
if Rate <= 0 then
   Rate = 0
end
return Rate
end

-----------------------------------------------------------------------------------------------------------------------------------------------素质影响的BUFF的概率计算公式--【恐惧】
function CommonFun.calcAttrFearRate(srcUser, targetUser)
local Dex=srcUser:GetProperty("Dex")
local Int=targetUser:GetProperty("Int")
local Luk=targetUser:GetProperty("Luk")
local A = math.max(0.1,Dex*0.5/100)
local B = math.min(0.5,(Int*0.3+Luk*0.3)/100)
local Rate = 1 + A - B
if Rate <= 0 then
   Rate = 0
end
return Rate
end
-----------------------------------------------------------------------------------------------------------------------------------------------素质影响的BUFF的概率计算公式--【定身】
function CommonFun.calcAttrSlowRate(srcUser, targetUser)
local Agi=srcUser:GetProperty("Agi")
local Vit=targetUser:GetProperty("Vit")
local Str=targetUser:GetProperty("Str")
local A = math.max(0.1,Agi*0.4/100)
local B = math.min(0.6,(Vit*0.3+Str*0.3)/100)
local Rate = 1 + A - B
if Rate <= 0 then
   Rate = 0
end
return Rate
end
-----------------------------------------------------------------------------------------------------------------------------------------------素质影响的BUFF的概率计算公式--【沉默】
function CommonFun.calcAttrSilenceRate(srcUser, targetUser)
local Dex=srcUser:GetProperty("Dex")
local Vit=targetUser:GetProperty("Vit")
local Str=targetUser:GetProperty("Str")
local A = math.max(0.1,Dex*0.5/100)
local B = math.min(0.6,(Vit*0.3+Str*0.3)/100)
local Rate = 1 + A - B
if Rate <= 0 then
   Rate = 0
end
return Rate
end

-----------------------------------------------------------------------------------------------------------------------------------------------素质影响的BUFF的概率计算公式--【诅咒】
function CommonFun.calcAttrCurseRate(srcUser, targetUser)
local Str=srcUser:GetProperty("Str")
local Int=targetUser:GetProperty("Int")
local Dex=targetUser:GetProperty("Dex")
local A = math.max(0.1,Str*0.5/100)
local B = math.min(0.5,(Int*0.3+Dex*0.3)/100)
local Rate = 1 + A - B
if Rate <= 0 then
   Rate = 0
end
return Rate
end

-----------------------------------------------------------------------------------------------------------------------------------------------素质影响的BUFF的概率计算公式--【黑暗】
function CommonFun.calcAttrDarkRate(srcUser, targetUser)
local Str=srcUser:GetProperty("Str")
local Int=targetUser:GetProperty("Int")
local Dex=targetUser:GetProperty("Dex")
local A = math.max(0.1,Str*0.5/100)
local B = math.min(0.5,(Int*0.3+Dex*0.3)/100)
local Rate = 1 + A - B
if Rate <= 0 then
   Rate = 0
end
return Rate
end
-----------------------------------------------------------------------------------------------------------------------------------------------素质影响的BUFF的时间计算公式--【中毒】
function CommonFun.calcAttrPoisonTime(srcUser, targetUser)
local Luk=srcUser:GetProperty("Luk")
local Vit=targetUser:GetProperty("Vit")
local A = math.max(0.3,Luk*0.6/100)
local B = math.min(0.8,Vit*0.4/100)
local Time = 1 + A - B
if Time <= 0 then
   Time = 0
end
return Time
end
-----------------------------------------------------------------------------------------------------------------------------------------------素质影响的BUFF的时间计算公式--【流血】
function CommonFun.calcAttrBlindTime(srcUser, targetUser)
local Int=srcUser:GetProperty("Int")
local Vit=targetUser:GetProperty("Vit")
local A = math.max(0.3,Int*0.6/100)
local B = math.min(0.8,Vit*0.4/100)
local Time = 1 + A - B
if Time <= 0 then
   Time = 0
end
return Time
end
-----------------------------------------------------------------------------------------------------------------------------------------------素质影响的BUFF的时间计算公式--【灼烧】
function CommonFun.calcAttrBurnTime(srcUser, targetUser)
local Int=srcUser:GetProperty("Int")
local Vit=targetUser:GetProperty("Vit")
local A = math.max(0.3,Int*0.6/100)
local B = math.min(0.8,Vit*0.4/100)
local Time = 1 + A - B
if Time <= 0 then
   Time = 0
end
return Time
end
-----------------------------------------------------------------------------------------------------------------------------------------------素质影响的BUFF的时间计算公式--【眩晕】
function CommonFun.calcAttrDizzyTime(srcUser, targetUser)
local Str=srcUser:GetProperty("Str")
local Vit=targetUser:GetProperty("Vit")
local A = math.max(0.3,Str*0.6/100)
local B = math.min(0.8,Vit*0.4/100)
local Time = 1 + A - B
if Time <= 0 then
   Time = 0
end
return Time
end

-----------------------------------------------------------------------------------------------------------------------------------------------素质影响的BUFF的时间计算公式--【冰冻】
function CommonFun.calcAttrFreezeTime(srcUser, targetUser)
local Int=srcUser:GetProperty("Int")
local Int2=targetUser:GetProperty("Int")
local A = math.max(0.3,Int*0.6/100)
local B = math.min(0.8,Int2*0.4/100)
local Time = 1 + A - B
if Time <= 0 then
   Time = 0
end
return Time
end

-----------------------------------------------------------------------------------------------------------------------------------------------素质影响的BUFF的时间计算公式--【石化】
function CommonFun.calcAttrStoneTime(srcUser, targetUser)
local Int=srcUser:GetProperty("Int")
local Int2=targetUser:GetProperty("Int")
local A = math.max(0.3,Int*0.6/100)
local B = math.min(0.8,Int2*0.4/100)
local Time = 1 + A - B
if Time <= 0 then
   Time = 0
end
return Time
end

-----------------------------------------------------------------------------------------------------------------------------------------------素质影响的BUFF的时间计算公式--【睡眠】
function CommonFun.calcAttrSleepTime(srcUser, targetUser)
local Dex=srcUser:GetProperty("Dex")
local Int=targetUser:GetProperty("Int")
local A = math.max(0.3,Dex*0.6/100)
local B = math.min(0.8,Int*0.4/100)
local Time = 1 + A - B
if Time <= 0 then
   Time = 0
end
return Time
end

-----------------------------------------------------------------------------------------------------------------------------------------------素质影响的BUFF的时间计算公式--【恐惧】
function CommonFun.calcAttrFearTime(srcUser, targetUser)
local Dex=srcUser:GetProperty("Dex")
local Int=targetUser:GetProperty("Int")
local A = math.max(0.3,Dex*0.6/100)
local B = math.min(0.8,Int*0.4/100)
local Time = 1 + A - B
if Time <= 0 then
   Time = 0
end
return Time
end
-----------------------------------------------------------------------------------------------------------------------------------------------素质影响的BUFF的时间计算公式--【定身】
function CommonFun.calcAttrSlowTime(srcUser, targetUser)
local Agi=srcUser:GetProperty("Agi")
local Vit=targetUser:GetProperty("Vit")
local A = math.max(0.3,Agi*0.6/100)
local B = math.min(0.8,Vit*0.4/100)
local Time = 1 + A - B
if Time <= 0 then
   Time = 0
end
return Time
end
-----------------------------------------------------------------------------------------------------------------------------------------------素质影响的BUFF的时间计算公式--【沉默】
function CommonFun.calcAttrSilenceTime(srcUser, targetUser)
local Dex=srcUser:GetProperty("Dex")
local Vit=targetUser:GetProperty("Vit")
local A = math.max(0.3,Dex*0.6/100)
local B = math.min(0.8,Vit*0.4/100)
local Time = 1 + A - B
if Time <= 0 then
   Time = 0
end
return Time
end

-----------------------------------------------------------------------------------------------------------------------------------------------素质影响的BUFF的时间计算公式--【诅咒】
function CommonFun.calcAttrCurseTime(srcUser, targetUser)
local Str=srcUser:GetProperty("Str")
local Int=targetUser:GetProperty("Int")
local A = math.max(0.3,Str*0.6/100)
local B = math.min(0.8,Int*0.4/100)
local Time = 1 + A - B
if Time <= 0 then
   Time = 0
end
return Time
end

-----------------------------------------------------------------------------------------------------------------------------------------------素质影响的BUFF的时间计算公式--【黑暗】
function CommonFun.calcAttrDarkTime(srcUser, targetUser)
local Str=srcUser:GetProperty("Str")
local Int=targetUser:GetProperty("Int")
local A = math.max(0.3,Str*0.6/100)
local B = math.min(0.8,Int*0.4/100)
local Time = 1 + A - B
if Time <= 0 then
   Time = 0
end
return Time
end



-------------------------------------------------------------------------------------------------------------------------------------------------BUFF的概率和时间计算公式
function CommonFun.calcBuffValue(srcUser, targetUser, type, a, b, c, d,lv,damage)
  if CommonFun.CalcBuffFuncs[type] == nil then
    return 0
  end
  return CommonFun.CalcBuffFuncs[type](srcUser, targetUser, a, b, c, d,lv,damage)
end
----------------------------------------------------------------------------------------------------------点燃效果
function CommonFun.calcBuff_20(srcUser, targetUser, a, b, c, d,lv)
  if srcUser == nil or targetUser == nil then
    return 0
  end

  local Int = srcUser:GetProperty("Int")
  local Vit = srcUser:GetProperty("Vit")
  local MAtk = srcUser:GetProperty("MAtk")
  local MAtkPer1 = srcUser:GetProperty("MAtkPer")
  ------------------------------------------------------------------------------------星盘带来的额外魔法攻击加成效果
  local Num1 = srcUser:GetRunePoint(22008)
  local Num2 = srcUser:GetRunePoint(22009)
  local RuneDamage = (Num1 + Num2)*0.03
  local MAtkPer = MAtkPer1 + RuneDamage

  local MDamIncrease = CommonFun.calcMDamIncrease(srcUser, targetUser)
  local IgnoreMDef = srcUser:GetProperty("IgnoreMDef")
  ------------------------------------------------------------------------------------将原来的物伤加成改成精炼物理攻击
  local MRefine = srcUser:GetProperty("MRefine")

  local srcAtkElement    = 4
  local targetDefElement = targetUser:GetProperty("DefAttr")


  local MDef2 = targetUser:GetProperty("MDef")
  local MDefPer2 = targetUser:GetProperty("MDefPer")
  local Vit2 = targetUser:GetProperty("Vit")
  local VitPer2 = targetUser:GetProperty("VitPer")
  local Int2 = targetUser:GetProperty("Int")
  local IntPer2 = targetUser:GetProperty("IntPer")
  local MDamReduc2 = CommonFun.calcMDamReDuc(srcUser, targetUser)
  local RefineMDamReduc = targetUser:GetProperty("RefineMDamReduc")

  local BaseMAtk = Int+math.floor(Int*Int/100)
  local MAtkFinal= (MAtk-BaseMAtk)*(1+MAtkPer)+BaseMAtk+MRefine+MDamIncrease

  ----------------------------魔法防御减免
  local MDefReduc = CommonFun.CalcMDef(MDef,Int,Vit,srcUser,targetUser)

  local A = (MAtkFinal*MDefReduc*(1-MDamReduc2)*(a*lv+b)-Vit2/2*(1+VitPer2)-Int2*(1+IntPer2))*GameConfig.ElementRestrain[srcAtkElement][targetDefElement]*(1-RefineMDamReduc)

    ------------------------------------------攻击年兽伤害为1
    if targetUser:GetNpcID() == 30043 or targetUser:GetNpcID() == 56008 or targetUser:GetNpcID() == 56009 or targetUser:GetNpcID() == 56010 or targetUser:GetNpcID() == 56011 or targetUser:GetNpcID() == 56012 or targetUser:GetNpcID() == 56013 then
        A = 1
    end
    --------------------------------------------不对每次受伤只掉1血的生效
    if targetUser:DamageAlways1() then
        A = 1
    end
  if 1 >= A then
    return -1
  end

  return -A

end

function CommonFun.calcBuff_21(srcUser, targetUser, a, b, c, d,lv)

if srcUser == nil or targetUser == nil then
   return 0
end

local BaseLv = srcUser.BaseLv

local A = BaseLv*(a*lv+b)
      if A<=0 then
        A=1
      end
return A

end


function CommonFun.calcBuff_22(srcUser, targetUser, a, b, c, d,lv)
  if srcUser == nil or targetUser == nil then
    return 0
  end
  local Int = srcUser:GetProperty("Int")
  local Vit = srcUser:GetProperty("Vit")
  local MAtk = srcUser:GetProperty("MAtk")
  local MAtkPer = srcUser:GetProperty("MAtkPer")
  local MDamIncrease = CommonFun.calcMDamIncrease(srcUser, targetUser)
  local IgnoreMDef = srcUser:GetProperty("IgnoreMDef")

  local srcAtkElement    = 3
  local targetDefElement = targetUser:GetProperty("DefAttr")


  local MDef2 = targetUser:GetProperty("MDef")
  local MDefPer2 = targetUser:GetProperty("MDefPer")
  local Vit2 = targetUser:GetProperty("Vit")
  local Int2 = targetUser:GetProperty("Int")
  local MDamReduc2 = CommonFun.calcMDamReDuc(srcUser, targetUser)

  local BaseMAtk = Int+math.floor(Int*Int/100)
  local MAtkFinal= (MAtk-BaseMAtk)*(1+MAtkPer)+BaseMAtk

  local A = MAtkFinal*(a*lv+b)*GameConfig.ElementRestrain[srcAtkElement][targetDefElement]

  if A >= 0 then
    return -1
  end

  return A

end

function CommonFun.calcBuff_23(srcUser, targetUser, a, b, c, d,lv)
  if srcUser == nil or targetUser == nil then
      return 0
  end
  local BaseLv = targetUser.BaseLv
  local A= (math.random(1,BaseLv)*a+b)

  if A <= 1 then
    return 1
  end

  return A

end


-----------------获取职业等级和角色等级的计算结果
function CommonFun.calcBuff_39(srcUser, targetUser, a, b, c, d,lv)
  if srcUser == nil or targetUser == nil then
      return 0
  end

  local BaseLv = srcUser.BaseLv

  local A= BaseLv*a + b

  if A <= 0 then
    return 0
  end

  return A

end

-----------------获取职业等级和角色等级的计算结果
function CommonFun.calcBuff_40(srcUser, targetUser, a, b, c, d,lv)
  if srcUser == nil or targetUser == nil then
      return 0
  end

  local JobLv =srcUser:GetJobLv()

  local A= JobLv*a+b

  if A <= 0 then
    return 0
  end

  return A

end

------------------------------------------------------------------------隐匿状态下提升技能释放成功率
function CommonFun.calcBuff_41(srcUser, targetUser, a, b, c, d,lv)
  if srcUser == nil or targetUser == nil then
      return 0
  end

  local Hiding = srcUser:GetProperty("Hiding")

  local A= lv*a+b

  if A <= 0 then
    return 0
  end

  if Hiding==1 or bits[CommonFun.AttrEffect.HideStrengthEffect]==1 then
      return A*2
  end

  return A

end


function CommonFun.calcBuff_50(srcUser, targetUser, a, b, c, d,lv)
  if srcUser == nil or targetUser == nil then
      return 0
  end

 local Hp    =  srcUser:GetProperty("Hp")
 local MaxHp =  srcUser:GetProperty("MaxHp")
 local A     =  (1-Hp/MaxHp)*0.6

 if A <= 0 then
    return 0
 end

 if A >= 0.5 then
    return 0.5
 end

 return A

end
--------------------------------------------------------------------------------有守卫光环下添加buff
function CommonFun.calcBuff_51(srcUser, targetUser, a, b, c, d,lv)
  if srcUser == nil or targetUser == nil then
      return 0
  end
  local Buff = srcUser:HasBuffID(114)
  local A = 0

  if Buff==true then
    return 100
  end

  return A

end
--------------------------------------------------------------------------------气泡虫存储buff下生效
function CommonFun.calcBuff_52(srcUser, targetUser, a, b, c, d,lv)
  if srcUser == nil or targetUser == nil then
      return 0
  end
  local Buff = srcUser:HasBuffID(80001190)
  local A = 0

  if Buff==true then
    return 100
  end

  return A

end
---------------------------------------------------------------------------------野猪卡片存储
function CommonFun.calcBuff_53(srcUser, targetUser, a, b, c, d,lv)
  if srcUser == nil or targetUser == nil then
      return 0
  end

  local A = 0
  if targetUser:GetNpcID() == 10057 then
      return 100
  end

  return A

end
---------------------------------------------------------------------------------野猪卡片存储体质相关
function CommonFun.calcBuff_54(srcUser, targetUser, a, b, c, d,lv)
  if srcUser == nil or targetUser == nil then
      return 0
  end
  local Vit = srcUser:GetProperty("Vit")
  local A = Vit*-5

  return A

end
-----------------------------------------------------------------------------------------------生命点燃伤害公式
function CommonFun.calcBuff_55(srcUser, targetUser, a, b, c, d,lv)
  local MaxHp = srcUser:GetProperty("MaxHp")
  local MaxSp = srcUser:GetProperty("MaxSp")
  local skilllv_1 = srcUser:GetLernedSkillLevel(69)
  local Buff = srcUser:HasBuffID(80000410)
  local Card1 = srcUser:GetEquipCardNum(2,20041)-------------获取盔甲部位大嘴鸟卡片数量
  local mapid,maptype = srcUser:GetMapInfo()-----------------获取所在地图

  if srcUser == nil or targetUser == nil then
      return 0
  end

  ----------------------------------------------------------竞技场最大生命除以4
  if maptype==2 or maptype==4 then
     MaxHp = MaxHp*0.25
  end

  local A = MaxHp*a+MaxSp*b+skilllv_1*c+(2*skilllv_1-10)*d
  -----------------------------------------------装备大嘴鸟卡片且存储伤害增加
  if Buff==true and Card1>0 then
    return A*1.1
  end

    ------------------------------------------攻击年兽伤害为1
    if targetUser:GetNpcID() == 30043 or targetUser:GetNpcID() == 56008 or targetUser:GetNpcID() == 56009 or targetUser:GetNpcID() == 56010 or targetUser:GetNpcID() == 56011 or targetUser:GetNpcID() == 56012 or targetUser:GetNpcID() == 56013 then
        A = -1
    end
        --------------------------------------------不对每次受伤只掉1血的生效
    if targetUser:DamageAlways1() then
        A = -1
    end

  return A

end
---------------------------------------------------------------------------------水母卡片存储冰冻概率增加
function CommonFun.calcBuff_56(srcUser, targetUser, a, b, c, d,lv)
  if srcUser == nil or targetUser == nil then
      return 0
  end
  local A = 5

  local Buff = srcUser:HasBuffID(80000250)
  if Buff==true then
     A = 10
  end

  return A

end
---------------------------------------------------------------------------------牺牲祈福根据星盘获得额外的时间加成
function CommonFun.calcBuff_57(srcUser, targetUser, a, b, c, d,lv)
  if srcUser == nil or targetUser == nil then
      return 0
  end

  local Num1  = srcUser:GetRunePoint(52034)

  local A = lv*a + b + 2*Num1

  return A
end

----------------------------------------------------------------------------------------------血的贪求（生命体）计算公式
function CommonFun.calcBuff_58(srcUser, targetUser, a, b, c, d,lv)
  if srcUser == nil or targetUser == nil then
    return 0
  end

  local Atk = srcUser:GetProperty("Atk")
  local AtkPer  = srcUser:GetProperty("AtkPer")
  local BaseLv = srcUser.BaseLv

  local master = srcUser:GetMasterUser()

  if master == nil then
    return 0
  end

  local masterRefine = master:GetProperty("Refine")
  local masterAtk = master:GetProperty("Atk")


  ---生命体攻击力计算公式
  Atk = (masterRefine*2 + Atk*(1+AtkPer)/10) * (a+b)

  local DamIncrease = srcUser:GetProperty("DamIncrease")

  local Def2 = targetUser:GetProperty("Def")
  local DefPer2 = targetUser:GetProperty("DefPer")
  local Vit2 = targetUser:GetProperty("Vit")
  local VitPer2 = targetUser:GetProperty("VitPer")
  local DamReduc2 = CommonFun.calcDamReDuc(srcUser, targetUser)
  local RefineDamReduc = targetUser:GetProperty("RefineDamReduc")

  local AtkFinal = Atk*CommonFun.ShapeCorrection(srcUser,targetUser)

  ----------------------------物理防御减免
  local DefReduc= CommonFun.CalcDef(Def,Vit,srcUser,targetUser)

  local A = AtkFinal*DefReduc*(1-DamReduc2)*(1-RefineDamReduc)*(1+DamIncrease)-Vit2*(1+VitPer2)

    ------------------------------------------攻击年兽伤害为1
    if targetUser:GetNpcID() == 30043 or targetUser:GetNpcID() == 56008 or targetUser:GetNpcID() == 56009 or targetUser:GetNpcID() == 56010 or targetUser:GetNpcID() == 56011 or targetUser:GetNpcID() == 56012 or targetUser:GetNpcID() == 56013 then
        A = 1
    end
     --------------------------------------------不对每次受伤只掉1血的生效
    if targetUser:DamageAlways1() then
        A = 1
    end

  if 1 >= A then
    return -1
  end

  return -A
end

----------------------------------------------------------------------------------------------------------生物炸弹（生命体）计算公式
function CommonFun.calcBuff_59(srcUser, targetUser, a, b, c, d,lv)
  if srcUser == nil or targetUser == nil then
    return 0
  end

  local Int = srcUser:GetProperty("Int")
  local Vit = srcUser:GetProperty("Vit")
  local MAtk = srcUser:GetProperty("MAtk")
  local MAtkPer = srcUser:GetProperty("MAtkPer")



  local skilllv_1 = srcUser:GetLernedSkillLevel(446)
  MAtk = MAtk  *(1+MAtkPer)
  skillDamPer = skilllv_1 * c + d

  local MDamIncrease = CommonFun.calcMDamIncrease(srcUser, targetUser)
  local IgnoreMDef = srcUser:GetProperty("IgnoreMDef")

  local srcAtkElement    = 5
  local targetDefElement = targetUser:GetProperty("DefAttr")


  local MDef2 = targetUser:GetProperty("MDef")
  local MDefPer2 = targetUser:GetProperty("MDefPer")
  local Vit2 = targetUser:GetProperty("Vit")
  local VitPer2 = targetUser:GetProperty("VitPer")
  local Int2 = targetUser:GetProperty("Int")
  local IntPer2 = targetUser:GetProperty("IntPer")
  local MDamReduc2 = CommonFun.calcMDamReDuc(srcUser, targetUser)
  local RefineMDamReduc = targetUser:GetProperty("RefineMDamReduc")

  local BaseMAtk = Int+math.floor(Int*Int/100)
  local MAtkFinal= MAtk+MDamIncrease

  ----------------------------魔法防御减免
  local MDefReduc = CommonFun.CalcMDef(MDef,Int,Vit,srcUser,targetUser)

  local A = (MAtkFinal*MDefReduc*(1-MDamReduc2)-Vit2/2*(1+VitPer2)-Int2*(1+IntPer2))*GameConfig.ElementRestrain[srcAtkElement][targetDefElement]*skillDamPer*(1-RefineMDamReduc)

   ------------------------------------------攻击年兽伤害为1
    if targetUser:GetNpcID() == 30043 or targetUser:GetNpcID() == 56008 or targetUser:GetNpcID() == 56009 or targetUser:GetNpcID() == 56010 or targetUser:GetNpcID() == 56011 or targetUser:GetNpcID() == 56012 or targetUser:GetNpcID() == 56013 then
        A = 1
    end
      --------------------------------------------不对每次受伤只掉1血的生效
    if targetUser:DamageAlways1() then
        A = 1
    end
  if 1 >= A then
    return -1
  end

  return -A

end

----------------------------------------------------------------------------------------------------------王牌驯兽师11-15属性判断
function CommonFun.calcBuff_60(srcUser, targetUser, a, b, c, d,lv)
  if srcUser == nil or targetUser == nil then
    return 0
  end

  local skilllv = srcUser:GetLernedSkillLevel(251)
  local CriDamage = 0
  if skilllv > 10 then
    CriDamage = (skilllv-10)*0.01
    return CriDamage
  else
    return CriDamage
  end

end

----------------------------------------------------------------------------------------------------------心神凝结11-20属性判断
function CommonFun.calcBuff_61(srcUser, targetUser, a, b, c, d,lv)
  if srcUser == nil or targetUser == nil then
    return 0
  end

  local skilllv = srcUser:GetLernedSkillLevel(115)
  local value_add= 0
  if skilllv > 10 then
    value_add =  (skilllv-10)*a
    return value_add
  else
    return value_add
  end

end
-----------------------------------------------------------------------------------------------生命点燃 自身损血伤害公式
function CommonFun.calcBuff_62(srcUser, targetUser, a, b, c, d,lv)
  local MaxHp = srcUser:GetProperty("MaxHp")
  local mapid,maptype = srcUser:GetMapInfo()-----------------获取所在地图

  if srcUser == nil or targetUser == nil then
      return 0
  end

  ----------------------------------------------------------竞技场最大生命除以4
  if maptype==2 or maptype==4 then
     MaxHp = MaxHp*0.25
  end

  local A = MaxHp*a

  return A

end

------------------------------------------------------------------------状态抗性带来的时间减少公式(沉默)
------------------------------------------------------------------------【需要增加素质抵抗的计算公式】--【沉默概率】
function CommonFun.calcBuff_100(srcUser, targetUser, a, b, c, d,lv)
  if srcUser == nil or targetUser == nil then
      return 0
  end
  local SilenceAtk  = srcUser:GetProperty("SilenceAtk")
  local SilenceDef2 = targetUser:GetProperty("SilenceDef")
  local SlienceDam  = 1 + SilenceAtk - SilenceDef2
  if SlienceDam <=0 then
     SlienceDam  =0
  end
  ---------------------------------------------------------------------异常状态的每个公式必加
  local StateAtk  = srcUser:GetProperty("StateAtk")
  local StateDef2 = targetUser:GetProperty("StateDef")
  local StateDam  = (1+StateAtk - StateDef2)
  if StateDam<=0 then
     StateDam =0
  end

  local A= (lv*a+b)*SlienceDam*StateDam*CommonFun.calcAttrSilenceRate(srcUser, targetUser)

  if A <= 0 then
    return 0
  end

  return A
end

------------------------------------------------------------------------【需要增加素质抵抗的计算公式】--【沉默时间】
function CommonFun.calcBuff_1000(srcUser, targetUser, a, b, c, d,lv)
  if srcUser == nil or targetUser == nil then
      return 0
  end
  local SilenceAtk  = srcUser:GetProperty("SilenceAtk")
  local SilenceDef2 = targetUser:GetProperty("SilenceDef")
  local SlienceDam  = 1 + SilenceAtk - SilenceDef2
  if SlienceDam <=0 then
     SlienceDam  =0
  end
  ---------------------------------------------------------------------异常状态的每个公式必加
  local StateAtk  = srcUser:GetProperty("StateAtk")
  local StateDef2 = targetUser:GetProperty("StateDef")
  local StateDam  = (1 + StateAtk - StateDef2)
  if StateDam<=0 then
     StateDam =0
  end

  local A= (lv*a+b)*SlienceDam*StateDam*CommonFun.calcAttrSilenceTime(srcUser, targetUser)

  if A <= 0 then
    return 0
  end

  return A
end


------------------------------------------------------------------------状态抗性带来的时间减少公式(沉默)【牧师普攻附带沉默效果】
------------------------------------------------------------------------【需要增加素质抵抗的概率计算公式】--【沉默概率】
function CommonFun.calcBuff_101(srcUser, targetUser, a, b, c, d,lv)
  if srcUser == nil or targetUser == nil then
      return 0
  end
  -------------------------------------------------------------------星盘计算牧师普攻沉默目标
  local Num1  = srcUser:GetRunePoint(52019)
  local Num2  = srcUser:GetRunePoint(52020)
  local Num3  = srcUser:GetRunePoint(52022)
  local Num4  = srcUser:GetRunePoint(52025)
  local Num5  = srcUser:GetRunePoint(52026)
  local RuneRate = (Num1 + Num2 + Num3 + Num4 + Num5)

  local SilenceAtk  = srcUser:GetProperty("SilenceAtk")
  local SilenceDef2 = targetUser:GetProperty("SilenceDef")
  local SlienceDam  = 1 + SilenceAtk - SilenceDef2
  if SlienceDam <=0 then
     SlienceDam  =0
  end
  ---------------------------------------------------------------------异常状态的每个公式必加
  local StateAtk  = srcUser:GetProperty("StateAtk")
  local StateDef2 = targetUser:GetProperty("StateDef")
  local StateDam  = (1+StateAtk)*(1-StateDef2)
  if StateDam<=0 then
     StateDam =0
  end

  local A= RuneRate*a*SlienceDam*StateDam*CommonFun.calcAttrSilenceRate(srcUser, targetUser)

  if A <= 0 then
    return 0
  end

  return A
end

------------------------------------------------------------------------【需要增加素质抵抗的时间计算公式】--【沉默时间】
function CommonFun.calcBuff_102(srcUser, targetUser, a, b, c, d,lv)
  if srcUser == nil or targetUser == nil then
      return 0
  end
  -------------------------------------------------------------------星盘计算牧师普攻沉默目标
  local Num1  = srcUser:GetRunePoint(52019)
  local Num2  = srcUser:GetRunePoint(52020)
  local Num3  = srcUser:GetRunePoint(52022)
  local Num4  = srcUser:GetRunePoint(52025)
  local Num5  = srcUser:GetRunePoint(52026)
  local RuneTime = (Num1 + Num2 + Num3 + Num4 + Num5)

  local A= RuneTime*CommonFun.calcAttrSilenceTime(srcUser, targetUser)

  if A <= 0 then
    return 0
  end

  return A
end

--------------------------------------------------------------------------------------------计算沉默之术切换效果的添加概率
------------------------------------------------------------------------【需要增加素质抵抗的概率计算公式】--【沉默概率】
function CommonFun.calcBuff_103(srcUser, targetUser, a, b, c, d,lv)
  if srcUser == nil or targetUser == nil then
      return 0
  end
  -------------------------------------------------------------------星盘增加沉默之术效果切换
  local Num1  = srcUser:GetRunePoint(52100)
  local SilenceAtk  = srcUser:GetProperty("SilenceAtk")
  local SilenceDef2 = targetUser:GetProperty("SilenceDef")
  local SlienceDam  = 1 + SilenceAtk - SilenceDef2
  if SlienceDam <=0 then
     SlienceDam  =0
  end
  ---------------------------------------------------------------------异常状态的每个公式必加
  local StateAtk  = srcUser:GetProperty("StateAtk")
  local StateDef2 = targetUser:GetProperty("StateDef")
  local StateDam  = (1+StateAtk)*(1-StateDef2)
  if StateDam<=0 then
     StateDam =0
  end

  local A = 100*SlienceDam*StateDam*CommonFun.calcAttrSilenceRate(srcUser, targetUser)

  if Num1 > 0 then
     A = 0
  end

  if A <= 0 then
    return 0
  end

  return A
end

--------------------------------------------------------------------------------------------计算沉默之术切换效果的添加概率
------------------------------------------------------------------------【需要增加素质抵抗的概率计算公式】--【沉默概率】
function CommonFun.calcBuff_104(srcUser, targetUser, a, b, c, d,lv)
  if srcUser == nil or targetUser == nil then
      return 0
  end
  -------------------------------------------------------------------星盘增加沉默之术效果切换
  local Num1  = srcUser:GetRunePoint(52100)
  local A =  Num1*100*CommonFun.calcAttrSilenceRate(srcUser, targetUser)

  if (targetUser.boss or targetUser.mini) then----------------------对MVP　mini 无效
     A = 0
  end

  if A <= 0 then
    return 0
  end

  return A
end

--------------------------------------------------------------------------------------------计算沉默之术切换效果的添加效果【效果计算】
function CommonFun.calcBuff_105(srcUser, targetUser, a, b, c, d,lv)
  if srcUser == nil or targetUser == nil then
      return 0
  end
  -------------------------------------------------------------------星盘增加沉默之术效果切换
  local Num1  = srcUser:GetRunePoint(52100)
  local A =  Num1*a

  if A <= 0 then
    return 0
  end

  return A
end

--------------------------------------------------------------------------------------------计算沉默之术损失魔法上限的添加概率和添加效果
------------------------------------------------------------------------【需要增加素质抵抗的概率计算公式】--【沉默】
function CommonFun.calcBuff_106(srcUser, targetUser, a, b, c, d,lv)
  if srcUser == nil or targetUser == nil then
      return 0
  end
  -------------------------------------------------------------------星盘增加沉默之术效果切换
  local Num1  = srcUser:GetRunePoint(52130)
  local Num2  = srcUser:GetRunePoint(52100)
  local A =  Num1*a*CommonFun.calcAttrSilenceRate(srcUser, targetUser)
  if  Num2>=1 then
      A = 0
  end

  if A <= 0 then
    return 0
  end

  return A
end

--------------------------------------------------------------------------------------------计算沉默之术损失魔法上限的添加概率和添加效果【效果计算】
function CommonFun.calcBuff_107(srcUser, targetUser, a, b, c, d,lv)
  if srcUser == nil or targetUser == nil then
      return 0
  end
  -------------------------------------------------------------------星盘增加沉默之术效果切换
  local Num1  = srcUser:GetRunePoint(52130)
  local MaxSp  = srcUser:GetProperty("MaxSp")
  local A =  Num1*a*MaxSp

  return A
end

------------------------------------------------------------------------状态抗性带来的时间减少公式(冰冻)
------------------------------------------------------------------------【需要增加素质抵抗的计算公式】--【冰冻概率】
function CommonFun.calcBuff_110(srcUser, targetUser, a, b, c, d,lv)
  if srcUser == nil or targetUser == nil then
      return 0
  end
  local FreezeAtk  = srcUser:GetProperty("FreezeAtk")
  local FreezeDef2 = targetUser:GetProperty("FreezeDef")
  local FreezeDam  = (1 + FreezeAtk - FreezeDef2)
  if FreezeDam <=0 then
     FreezeDam  =0
  end

  ---------------------------------------------------------------------异常状态的每个公式必加
  local StateAtk  = srcUser:GetProperty("StateAtk")
  local StateDef2 = targetUser:GetProperty("StateDef")
  local StateDam  = (1 + StateAtk - StateDef2)
  if StateDam<=0 then
     StateDam =0
  end

  local A= (lv*a+b)*FreezeDam*StateDam*CommonFun.calcAttrFreezeRate(srcUser, targetUser)

  if A <= 0 then
    return 0
  end

  return A
end

------------------------------------------------------------------------【需要增加素质抵抗的计算公式】--【冰冻时间】
function CommonFun.calcBuff_1100(srcUser, targetUser, a, b, c, d,lv)
  if srcUser == nil or targetUser == nil then
      return 0
  end
  local FreezeAtk  = srcUser:GetProperty("FreezeAtk")
  local FreezeDef2 = targetUser:GetProperty("FreezeDef")
  local FreezeDam  = (1 + FreezeAtk - FreezeDef2)
  if FreezeDam <=0 then
     FreezeDam  =0
  end

  ---------------------------------------------------------------------异常状态的每个公式必加
  local StateAtk  = srcUser:GetProperty("StateAtk")
  local StateDef2 = targetUser:GetProperty("StateDef")
  local StateDam  = (1 + StateAtk - StateDef2)
  if StateDam<=0 then
     StateDam =0
  end

  local A= (lv*a+b)*FreezeDam*StateDam*CommonFun.calcAttrFreezeTime(srcUser, targetUser)

  if A <= 0 then
    return 0
  end

  return A
end

------------------------------------------------------------------------冰冻术专用效果
------------------------------------------------------------------------【需要增加素质抵抗的计算公式】--【冰冻】
function CommonFun.calcBuff_111(srcUser, targetUser, a, b, c, d,lv)
  if srcUser == nil or targetUser == nil then
      return 0
  end
  local FreezeAtk  = srcUser:GetProperty("FreezeAtk")
  local FreezeDef2 = targetUser:GetProperty("FreezeDef")
  local FreezeDam  = (1 + FreezeAtk - FreezeDef2)
  if FreezeDam <=0 then
     FreezeDam  =0
  end

  ---------------------------------------------------------------------异常状态的每个公式必加
  local StateAtk  = srcUser:GetProperty("StateAtk")
  local StateDef2 = targetUser:GetProperty("StateDef")
  local StateDam  = (1 + StateAtk - StateDef2)
  if StateDam<=0 then
     StateDam =0
  end
  ---------------------------------------------------------------------星盘效果
  local Num1 = srcUser:GetRunePoint(22130)
  local A= (lv*a+b)*FreezeDam*StateDam*CommonFun.calcAttrFreezeRate(srcUser, targetUser)

  if Num1>=1 then
     A = 0
  end

  if A <= 0 then
    return 0
  end

  return A
end

------------------------------------------------------------------------冰冻术专用冰冻自己的添加概率
------------------------------------------------------------------------【需要增加素质抵抗的计算公式】--【冰冻】
function CommonFun.calcBuff_112(srcUser, targetUser, a, b, c, d,lv)
  if srcUser == nil or targetUser == nil then
      return 0
  end
  ---------------------------------------------------------------------星盘效果
  local Num1 = srcUser:GetRunePoint(22130)
  local A= 0

  if Num1>=1 then
     A = (lv*a+b)
  end

  if A <= 0 then
    return 0
  end

  return A
end

------------------------------------------------------------------------冰冻术专用冰冻自己的添加概率
------------------------------------------------------------------------【需要增加素质抵抗的计算公式】--【冰冻】
function CommonFun.calcBuff_113(srcUser, targetUser, a, b, c, d,lv)
  if srcUser == nil or targetUser == nil then
      return 0
  end
  ---------------------------------------------------------------------星盘效果
  local Num1 = srcUser:GetRunePoint(22130)
  local A= Num1*a

  if A <= 0 then
    return 0
  end

  return A
end
------------------------------------------------------------------------冰冻术专用添加回复的概率
function CommonFun.calcBuff_114(srcUser, targetUser, a, b, c, d,lv)
  if srcUser == nil or targetUser == nil then
      return 0
  end
  ---------------------------------------------------------------------星盘效果
  local Num1 = srcUser:GetRunePoint(22140)
  local A= Num1*100

  if A <= 0 then
    return 0
  end

  return A
end

------------------------------------------------------------------------冰冻术专用恢复效果的概率
function CommonFun.calcBuff_115(srcUser, targetUser, a, b, c, d,lv)
  if srcUser == nil or targetUser == nil then
      return 0
  end
  ---------------------------------------------------------------------星盘效果
  local Num1 = srcUser:GetRunePoint(22140)
  local MaxHp = srcUser:GetProperty("MaxHp")
  local A= Num1*a*MaxHp

  if A <= 0 then
    return 0
  end

  return A
end
------------------------------------------------------------------------状态抗性带来的时间减少公式(石化)
------------------------------------------------------------------------【需要增加素质抵抗的计算公式】--【石化概率】
function CommonFun.calcBuff_120(srcUser, targetUser, a, b, c, d,lv)
  if srcUser == nil or targetUser == nil then
      return 0
  end
  local StoneAtk = srcUser:GetProperty("StoneAtk")
  local StoneDef2 = targetUser:GetProperty("StoneDef")
  local StoneDam  = (1 + StoneAtk - StoneDef2)
  if StoneDam <=0 then
     StoneDam  =0
  end

  ---------------------------------------------------------------------异常状态的每个公式必加
  local StateAtk  = srcUser:GetProperty("StateAtk")
  local StateDef2 = targetUser:GetProperty("StateDef")
  local StateDam  = (1 + StateAtk - StateDef2)
  if StateDam<=0 then
     StateDam =0
  end

  local A= (lv*a+b)*StoneDam*StateDam*CommonFun.calcAttrStoneRate(srcUser, targetUser)

  if A <= 0 then
    return 0
  end
  return A
end

------------------------------------------------------------------------【需要增加素质抵抗的计算公式】--【石化时间】
function CommonFun.calcBuff_1200(srcUser, targetUser, a, b, c, d,lv)
  if srcUser == nil or targetUser == nil then
      return 0
  end
  local StoneAtk = srcUser:GetProperty("StoneAtk")
  local StoneDef2 = targetUser:GetProperty("StoneDef")
  local StoneDam  = (1 + StoneAtk - StoneDef2)
  if StoneDam <=0 then
     StoneDam  =0
  end

  ---------------------------------------------------------------------异常状态的每个公式必加
  local StateAtk  = srcUser:GetProperty("StateAtk")
  local StateDef2 = targetUser:GetProperty("StateDef")
  local StateDam  = (1 + StateAtk - StateDef2)
  if StateDam<=0 then
     StateDam =0
  end

  local A= (lv*a+b)*StoneDam*StateDam*CommonFun.calcAttrStoneTime(srcUser, targetUser)

  if A <= 0 then
    return 0
  end
  return A
end

------------------------------------------------------------------------状态抗性带来的时间减少公式(晕眩)
------------------------------------------------------------------------【需要增加素质抵抗的计算公式】--【晕眩概率】
function CommonFun.calcBuff_130(srcUser, targetUser, a, b, c, d,lv)
  if srcUser == nil or targetUser == nil then
      return 0
  end
  local StunAtk = srcUser:GetProperty("StunAtk")
  local StunDef2 = targetUser:GetProperty("StunDef")
  local StunDam  = (1 + StunAtk - StunDef2)
  if StunDam <=0 then
     StunDam  =0
  end

  ---------------------------------------------------------------------异常状态的每个公式必加
  local StateAtk  = srcUser:GetProperty("StateAtk")
  local StateDef2 = targetUser:GetProperty("StateDef")
  local StateDam  = (1 + StateAtk - StateDef2)
  if StateDam<=0 then
     StateDam =0
  end



  local A= (lv*a+b)*StunDam*StateDam*CommonFun.calcAttrDizzyRate(srcUser, targetUser)
  local Buff = srcUser:HasBuffID(80000220)

  if Buff==true then
     A = (lv*a+b+2)*StunDam*StateDam*CommonFun.calcAttrDizzyRate(srcUser, targetUser)
  end

  if A <= 0 then
    return 0
  end

  return A
end

------------------------------------------------------------------------【需要增加素质抵抗的计算公式】--【晕眩时间】
function CommonFun.calcBuff_1300(srcUser, targetUser, a, b, c, d,lv)
  if srcUser == nil or targetUser == nil then
      return 0
  end
  local StunAtk = srcUser:GetProperty("StunAtk")
  local StunDef2 = targetUser:GetProperty("StunDef")
  local StunDam  = (1 + StunAtk - StunDef2)
  if StunDam <=0 then
     StunDam  =0
  end

  ---------------------------------------------------------------------异常状态的每个公式必加
  local StateAtk  = srcUser:GetProperty("StateAtk")
  local StateDef2 = targetUser:GetProperty("StateDef")
  local StateDam  = (1 + StateAtk - StateDef2)
  if StateDam<=0 then
     StateDam =0
  end

  local A= (lv*a+b)*StunDam*StateDam*CommonFun.calcAttrDizzyTime(srcUser, targetUser)
  local Buff = srcUser:HasBuffID(80000220)

  if Buff==true then
     A = (lv*a+b+2)*StunDam*StateDam*CommonFun.calcAttrDizzyTime(srcUser, targetUser)
  end

  if A <= 0 then
    return 0
  end

  return A
end
------------------------------------------------------------------------神圣增幅技能---状态抗性带来的时间减少公式(晕眩)
------------------------------------------------------------------------【需要增加素质抵抗的计算公式】--【晕眩】
function CommonFun.calcBuff_131(srcUser, targetUser, a, b, c, d,lv)
  if srcUser == nil or targetUser == nil then
      return 0
  end

  local skilllv_1 = srcUser:GetLernedSkillLevel(235)
  ---------------------------------------------------------------------星盘加成的额外眩晕效果
  local Num1 = srcUser:GetRunePoint(51019)
  local Num2 = srcUser:GetRunePoint(51020)
  local RuneRate =  (Num1 + Num2)*20
  --------------------------------------------------------------------分割线
  local StunAtk = srcUser:GetProperty("StunAtk")
  local StunDef2 = targetUser:GetProperty("StunDef")
  local StunDam  = (1 + StunAtk - StunDef2)
  if StunDam <=0 then
     StunDam  =0
  end

  ---------------------------------------------------------------------异常状态的每个公式必加
  local StateAtk  = srcUser:GetProperty("StateAtk")
  local StateDef2 = targetUser:GetProperty("StateDef")
  local StateDam  = (1 + StateAtk - StateDef2)
  if StateDam<=0 then
     StateDam =0
  end

  local A= (skilllv_1*a + b + RuneRate)*StunDam*StateDam*CommonFun.calcAttrDizzyRate(srcUser, targetUser)

  if A <= 0 then
    return 0
  end

  if skilllv_1<=0 then
     return 0
  end

  return A
end

------------------------------------------------------------------------震慑技能效果---状态抗性带来的时间减少公式(晕眩)
------------------------------------------------------------------------【需要增加素质抵抗的计算公式】--【晕眩】
function CommonFun.calcBuff_132(srcUser, targetUser, a, b, c, d,lv)
  if srcUser == nil or targetUser == nil then
      return 0
  end

  local skilllv_1 = srcUser:GetLernedSkillLevel(123)
  local StunAtk = srcUser:GetProperty("StunAtk")
  local StunDef2 = targetUser:GetProperty("StunDef")
  local StunDam  = (1 + StunAtk - StunDef2)
  if StunDam <=0 then
     StunDam  =0
  end

  ---------------------------------------------------------------------异常状态的每个公式必加
  local StateAtk  = srcUser:GetProperty("StateAtk")
  local StateDef2 = targetUser:GetProperty("StateDef")
  local StateDam  = (1 + StateAtk - StateDef2)
  if StateDam<=0 then
     StateDam =0
  end

  local A= (skilllv_1*a+b)*StunDam*StateDam*CommonFun.calcAttrDizzyRate(srcUser, targetUser)

  if A <= 0 then
    return 0
  end

  if skilllv_1<=0 then
     return 0
  end

  return A
end

------------------------------------------------------------------------【需要增加素质抵抗的计算公式】--【晕眩】
function CommonFun.calcBuff_1320(srcUser, targetUser, a, b, c, d,lv)
  if srcUser == nil or targetUser == nil then
      return 0
  end

  local skilllv_1 = srcUser:GetLernedSkillLevel(123)
  local StunAtk = srcUser:GetProperty("StunAtk")
  local StunDef2 = targetUser:GetProperty("StunDef")
  local StunDam  = (1 + StunAtk - StunDef2)
  if StunDam <=0 then
     StunDam  =0
  end

  ---------------------------------------------------------------------异常状态的每个公式必加
  local StateAtk  = srcUser:GetProperty("StateAtk")
  local StateDef2 = targetUser:GetProperty("StateDef")
  local StateDam  = (1 + StateAtk - StateDef2)
  if StateDam<=0 then
     StateDam =0
  end

  local A= (skilllv_1*a+b)*StunDam*StateDam*CommonFun.calcAttrDizzyTime(srcUser, targetUser)

  if A <= 0 then
    return 0
  end

  if skilllv_1<=0 then
     return 0
  end

  return A
end
------------------------------------------------------------------------状态抗性带来的时间减少公式(灼烧)
------------------------------------------------------------------------【需要增加素质抵抗的计算公式】--【灼烧概率】
function CommonFun.calcBuff_140(srcUser, targetUser, a, b, c, d,lv)
  if srcUser == nil or targetUser == nil then
      return 0
  end
  local BlindAtk = srcUser:GetProperty("BlindAtk")
  local BlindDef2 = targetUser:GetProperty("BlindDef")
  local BlindDam  = (1 + BlindAtk - BlindDef2)
  if BlindDam <=0 then
     BlindDam  =0
  end
  ---------------------------------------------------------------------异常状态的每个公式必加
  local StateAtk  = srcUser:GetProperty("StateAtk")
  local StateDef2 = targetUser:GetProperty("StateDef")
  local StateDam  = (1 + StateAtk - StateDef2)
  if StateDam<=0 then
     StateDam =0
  end


  local A= (lv*a+b)*BlindDam*StateDam*CommonFun.calcAttrBurnRate(srcUser, targetUser)

  if A <= 0 then
    return 0
  end
  return A
end

------------------------------------------------------------------------【需要增加素质抵抗的计算公式】--【灼烧时间】
function CommonFun.calcBuff_1400(srcUser, targetUser, a, b, c, d,lv)
  if srcUser == nil or targetUser == nil then
      return 0
  end
  local BlindAtk = srcUser:GetProperty("BlindAtk")
  local BlindDef2 = targetUser:GetProperty("BlindDef")
  local BlindDam  = (1 + BlindAtk - BlindDef2)
  if BlindDam <=0 then
     BlindDam  =0
  end
  ---------------------------------------------------------------------异常状态的每个公式必加
  local StateAtk  = srcUser:GetProperty("StateAtk")
  local StateDef2 = targetUser:GetProperty("StateDef")
  local StateDam  = (1 + StateAtk - StateDef2)
  if StateDam<=0 then
     StateDam =0
  end


  local A= (lv*a+b)*BlindDam*StateDam*CommonFun.calcAttrBurnTime(srcUser, targetUser)

  if A <= 0 then
    return 0
  end
  return A
end
------------------------------------------------------------------------状态抗性带来的时间减少公式(灼烧)
------------------------------------------------------------------------【需要增加素质抵抗的计算公式】--【灼烧】
function CommonFun.calcBuff_141(srcUser, targetUser, a, b, c, d,lv)
  if srcUser == nil or targetUser == nil then
      return 0
  end
  local skilllv_1 = srcUser:GetLernedSkillLevel(88)
  local BlindAtk = srcUser:GetProperty("BlindAtk")
  local BlindDef2 = targetUser:GetProperty("BlindDef")
  local BlindDam  = (1 + BlindAtk - BlindDef2)
  if BlindDam <=0 then
     BlindDam  =0
  end
  ---------------------------------------------------------------------异常状态的每个公式必加
  local StateAtk  = srcUser:GetProperty("StateAtk")
  local StateDef2 = targetUser:GetProperty("StateDef")
  local StateDam  = (1 + StateAtk - StateDef2)
  if StateDam<=0 then
     StateDam =0
  end


  local A= (skilllv_1*a+b)*BlindDam*StateDam*CommonFun.calcAttrBurnRate(srcUser, targetUser)

  if skilllv_1<=0 then
     return 0
  end

  if A <= 0 then
    return 0
  end


  return A
end

------------------------------------------------------------------------状态抗性带来的时间减少公式(中毒)
------------------------------------------------------------------------【需要增加素质抵抗的计算公式】--【中毒概率】
function CommonFun.calcBuff_150(srcUser, targetUser, a, b, c, d,lv)
  if srcUser == nil or targetUser == nil then
      return 0
  end
  local PoisonAtk = srcUser:GetProperty("PoisonAtk")
  local PoisonDef2 = targetUser:GetProperty("PoisonDef")
  local PoisonDam  = (1 + PoisonAtk - PoisonDef2)
  if PoisonDam <=0 then
     PoisonDam  =0
  end

  ---------------------------------------------------------------------异常状态的每个公式必加
  local StateAtk  = srcUser:GetProperty("StateAtk")
  local StateDef2 = targetUser:GetProperty("StateDef")
  local StateDam  = (1 + StateAtk - StateDef2)
  if StateDam<=0 then
     StateDam =0
  end


  local A= (lv*a+b)*PoisonDam*StateDam*CommonFun.calcAttrPoisonRate(srcUser, targetUser)

  if A <= 0 then
    return 0
  end
  return A
end
------------------------------------------------------------------------【需要增加素质抵抗的计算公式】--【中毒时间】
function CommonFun.calcBuff_1500(srcUser, targetUser, a, b, c, d,lv)
  if srcUser == nil or targetUser == nil then
      return 0
  end
  local PoisonAtk = srcUser:GetProperty("PoisonAtk")
  local PoisonDef2 = targetUser:GetProperty("PoisonDef")
  local PoisonDam  = (1 + PoisonAtk - PoisonDef2)
  if PoisonDam <=0 then
     PoisonDam  =0
  end

  ---------------------------------------------------------------------异常状态的每个公式必加
  local StateAtk  = srcUser:GetProperty("StateAtk")
  local StateDef2 = targetUser:GetProperty("StateDef")
  local StateDam  = (1 + StateAtk - StateDef2)
  if StateDam<=0 then
     StateDam =0
  end


  local A= (lv*a+b)*PoisonDam*StateDam*CommonFun.calcAttrPoisonTime(srcUser, targetUser)

  if A <= 0 then
    return 0
  end
  return A
end
------------------------------------------------------------------------状态抗性带来的时间减少公式(中毒)
------------------------------------------------------------------------【需要增加素质抵抗的计算公式】--【中毒】
function CommonFun.calcBuff_151(srcUser, targetUser, a, b, c, d,lv)
  if srcUser == nil or targetUser == nil then
      return 0
  end
  local skilllv_1 = srcUser:GetLernedSkillLevel(191)
  local PoisonAtk = srcUser:GetProperty("PoisonAtk")
  local PoisonDef2 = targetUser:GetProperty("PoisonDef")
  local PoisonDam  = (1 + PoisonAtk - PoisonDef2)
  if PoisonDam <=0 then
     PoisonDam  =0
  end

  ---------------------------------------------------------------------异常状态的每个公式必加
  local StateAtk  = srcUser:GetProperty("StateAtk")
  local StateDef2 = targetUser:GetProperty("StateDef")
  local StateDam  = (1 + StateAtk - StateDef2)
  if StateDam<=0 then
     StateDam =0
  end


  local A= (skilllv_1*a+b)*PoisonDam*StateDam*CommonFun.calcAttrPoisonTime(srcUser, targetUser)

  if A <= 0 then
    return 0
  end
  return A
end

------------------------------------------------------------------------剧毒暗器添加不可被治疗不可使用药瓶的概率
function CommonFun.calcBuff_152(srcUser, targetUser, a, b, c, d,lv)
  if srcUser == nil or targetUser == nil then
      return 0
  end
  ------------------------------------------------------------------------星盘加成的效果
  local Num1 = srcUser:GetRunePoint(32005)
  local RuneRate = Num1*10
  local A= RuneRate

  if A <= 0 then
    return 0
  end
  return A
end


------------------------------------------------------------------------星盘带来的中毒损血百分比效果
function CommonFun.calcBuff_153(srcUser, targetUser, a, b, c, d,lv)
  if srcUser == nil or targetUser == nil then
      return 0
  end
  ------------------------------------------------------------------------星盘加成的效果
  local Num1 = srcUser:GetRunePoint(31026)
  local Num2 = srcUser:GetRunePoint(31027)
  local RuneDamage = Num1*0.05 + Num2*0.05
  local A= a - RuneDamage

  if A <= 0 then
    return 0
  end
  return A
end


------------------------------------------------------------------------凯美拉卡片效果
------------------------------------------------------------------------【需要增加素质抵抗的计算公式】--【中毒概率】
function CommonFun.calcBuff_154(srcUser, targetUser, a, b, c, d,lv)
  if srcUser == nil or targetUser == nil then
      return 0
  end
  local PoisonAtk = srcUser:GetProperty("PoisonAtk")
  local PoisonDef2 = targetUser:GetProperty("PoisonDef")
  local PoisonDam  = (1 + PoisonAtk - PoisonDef2)
  local Profession=srcUser:GetProfressionID()

  if PoisonDam <=0 then
     PoisonDam  =0
  end

  ---------------------------------------------------------------------异常状态的每个公式必加
  local StateAtk  = srcUser:GetProperty("StateAtk")
  local StateDef2 = targetUser:GetProperty("StateDef")
  local StateDam  = (1 + StateAtk - StateDef2)
  if StateDam<=0 then
     StateDam =0
  end

  if Profession==31 or Profession==32 or Profession==33 or Profession==34 then
      b = 12
  end

  local A= (lv*a+b)*PoisonDam*StateDam*CommonFun.calcAttrPoisonRate(srcUser, targetUser)

  if A <= 0 then
    return 0
  end
  return A
end

------------------------------------------------------------------------状态抗性带来的时间减少公式(定身)
------------------------------------------------------------------------【需要增加素质抵抗的计算公式】--【定身概率】
function CommonFun.calcBuff_160(srcUser, targetUser, a, b, c, d,lv)
  if srcUser == nil or targetUser == nil then
      return 0
  end
  local SlowAtk = srcUser:GetProperty("SlowAtk")
  local SlowDef2 = targetUser:GetProperty("SlowDef")
  local SlowDam  = (1 + SlowAtk - SlowDef2)
  if SlowDam <=0 then
     SlowDam  =0
  end

  ---------------------------------------------------------------------异常状态的每个公式必加
  local StateAtk  = srcUser:GetProperty("StateAtk")
  local StateDef2 = targetUser:GetProperty("StateDef")
  local StateDam  = (1 + StateAtk - StateDef2)
  if StateDam<=0 then
     StateDam =0
  end

  local A= (lv*a+b)*SlowDam*StateDam*CommonFun.calcAttrSlowRate(srcUser, targetUser)

  if A <= 0 then
    return 0
  end
  return A
end
------------------------------------------------------------------------【需要增加素质抵抗的计算公式】--【定身时间】
function CommonFun.calcBuff_1600(srcUser, targetUser, a, b, c, d,lv)
  if srcUser == nil or targetUser == nil then
      return 0
  end
  local SlowAtk = srcUser:GetProperty("SlowAtk")
  local SlowDef2 = targetUser:GetProperty("SlowDef")
  local SlowDam  = (1 + SlowAtk - SlowDef2)
  if SlowDam <=0 then
     SlowDam  =0
  end

  ---------------------------------------------------------------------异常状态的每个公式必加
  local StateAtk  = srcUser:GetProperty("StateAtk")
  local StateDef2 = targetUser:GetProperty("StateDef")
  local StateDam  = (1 + StateAtk - StateDef2)
  if StateDam<=0 then
     StateDam =0
  end


  local A= (lv*a+b)*SlowDam*StateDam*CommonFun.calcAttrSlowTime(srcUser, targetUser)

  if A <= 0 then
    return 0
  end
  return A
end
------------------------------------------------------------------------状态抗性带来的时间减少公式(恐惧)
------------------------------------------------------------------------【需要增加素质抵抗的计算公式】--【恐惧概率】
function CommonFun.calcBuff_170(srcUser, targetUser, a, b, c, d,lv)
  if srcUser == nil or targetUser == nil then
      return 0
  end
  local ChaosAtk = srcUser:GetProperty("ChaosAtk")
  local ChaosDef2 = targetUser:GetProperty("ChaosDef")
  local ChaosDam  = (1 + ChaosAtk - ChaosDef2)
  if ChaosDam <=0 then
     ChaosDam  =0
  end

  ---------------------------------------------------------------------异常状态的每个公式必加
  local StateAtk  = srcUser:GetProperty("StateAtk")
  local StateDef2 = targetUser:GetProperty("StateDef")
  local StateDam  = (1 + StateAtk - StateDef2)
  if StateDam<=0 then
     StateDam =0
  end


  local A= (lv*a+b)*ChaosDam*StateDam*CommonFun.calcAttrFearRate(srcUser, targetUser)

  if A <= 0 then
    return 0
  end
  return A
end
------------------------------------------------------------------------黑洞 - 迷失【恐惧概率】
function CommonFun.calcBuff_171(srcUser, targetUser, a, b, c, d,lv)
  local A = 0
  local Num1=srcUser:GetRunePoint(94030)

  if Num1>0 then
      A = 100
  end

  if A <= 0 then
    return 0
  end
  print("A="..A)
  return A
end
------------------------------------------------------------------------【需要增加素质抵抗的计算公式】--【恐惧时间】
function CommonFun.calcBuff_1700(srcUser, targetUser, a, b, c, d,lv)
  if srcUser == nil or targetUser == nil then
      return 0
  end
  local ChaosAtk = srcUser:GetProperty("ChaosAtk")
  local ChaosDef2 = targetUser:GetProperty("ChaosDef")
  local ChaosDam  = (1 + ChaosAtk - ChaosDef2)
  if ChaosDam <=0 then
     ChaosDam  =0
  end

  ---------------------------------------------------------------------异常状态的每个公式必加
  local StateAtk  = srcUser:GetProperty("StateAtk")
  local StateDef2 = targetUser:GetProperty("StateDef")
  local StateDam  = (1 + StateAtk - StateDef2)
  if StateDam<=0 then
     StateDam =0
  end


  local A= (lv*a+b)*ChaosDam*StateDam*CommonFun.calcAttrFearTime(srcUser, targetUser)

  if A <= 0 then
    return 0
  end
  return A
end
------------------------------------------------------------------------黑洞 迷失--【恐惧时间】
function CommonFun.calcBuff_1701(srcUser, targetUser, a, b, c, d,lv)
  if srcUser == nil or targetUser == nil then
      return 0
  end

  local Num1=srcUser:GetRunePoint(94030)

  local A= Num1
  print("A="..A)
  if A <= 0 then
    return 0
  end

  return A
end
------------------------------------------------------------------------状态抗性带来的时间减少公式(诅咒)
------------------------------------------------------------------------【需要增加素质抵抗的计算公式】--【诅咒】
function CommonFun.calcBuff_180(srcUser, targetUser, a, b, c, d,lv)
  if srcUser == nil or targetUser == nil then
      return 0
  end
  local CurseAtk = srcUser:GetProperty("CurseAtk")
  local CurseDef2 = targetUser:GetProperty("CurseDef")
  local CurseDam  = (1 + CurseAtk - CurseDef2)
  if CurseDam <=0 then
     CurseDam  =0
  end

  ---------------------------------------------------------------------异常状态的每个公式必加
  local StateAtk  = srcUser:GetProperty("StateAtk")
  local StateDef2 = targetUser:GetProperty("StateDef")
  local StateDam  = (1 + StateAtk - StateDef2)
  if StateDam<=0 then
     StateDam =0
  end

  local A= (lv*a+b)*CurseDam*StateDam*CommonFun.calcAttrCurseRate(srcUser, targetUser)

  if A <= 0 then
    return 0
  end
  return A
end

------------------------------------------------------------------------【需要增加素质抵抗的计算公式】--【诅咒】
function CommonFun.calcBuff_1800(srcUser, targetUser, a, b, c, d,lv)
  if srcUser == nil or targetUser == nil then
      return 0
  end
  local CurseAtk = srcUser:GetProperty("CurseAtk")
  local CurseDef2 = targetUser:GetProperty("CurseDef")
  local CurseDam  = (1 + CurseAtk - CurseDef2)
  if CurseDam <=0 then
     CurseDam  =0
  end

  ---------------------------------------------------------------------异常状态的每个公式必加
  local StateAtk  = srcUser:GetProperty("StateAtk")
  local StateDef2 = targetUser:GetProperty("StateDef")
  local StateDam  = (1 + StateAtk - StateDef2)
  if StateDam<=0 then
     StateDam =0
  end


  local A= (lv*a+b)*CurseDam*StateDam*CommonFun.calcAttrCurseTime(srcUser, targetUser)

  if A <= 0 then
    return 0
  end
  return A
end
------------------------------------------------------------------------状态抗性带来的时间减少公式(流血)
------------------------------------------------------------------------【需要增加素质抵抗的计算公式】--流血
function CommonFun.calcBuff_185(srcUser, targetUser, a, b, c, d,lv)
  if srcUser == nil or targetUser == nil then
      return 0
  end
  ---------------------------------------------------------------------异常状态的每个公式必加
  local StateAtk  = srcUser:GetProperty("StateAtk")
  local StateDef2 = targetUser:GetProperty("StateDef")
  local StateDam  = (1 + StateAtk - StateDef2)
  if StateDam<=0 then
     StateDam =0
  end

  local A= (lv*a+b)*StateDam*CommonFun.calcAttrBlindRate(srcUser, targetUser)

  if A <= 0 then
    return 0
  end
  return A
end

------------------------------------------------------------------------【需要增加素质抵抗的计算公式】--流血时间
function CommonFun.calcBuff_1850(srcUser, targetUser, a, b, c, d,lv)
  if srcUser == nil or targetUser == nil then
      return 0
  end
  ---------------------------------------------------------------------异常状态的每个公式必加
  local StateAtk  = srcUser:GetProperty("StateAtk")
  local StateDef2 = targetUser:GetProperty("StateDef")
  local StateDam  = (1 + StateAtk - StateDef2)
  if StateDam<=0 then
     StateDam =0
  end


  local A= (lv*a+b)*StateDam*CommonFun.calcAttrBlindTime(srcUser, targetUser)

  if A <= 0 then
    return 0
  end
  return A
end
------------------------------------------------------------------------诅咒之弓效果更改
function CommonFun.calcBuff_190(srcUser, targetUser, a, b, c, d,lv)
  if srcUser == nil or targetUser == nil then
      return 0
  end

  local Weapon=srcUser:GetEquipedID(7)
  local A = 0

  if (Weapon==41233 or Weapon==141233 or Weapon==41256 or Weapon==141256) then
        A = 10
  end

  if A <= 0 then
    return 0
  end
  return A
end

------------------------------------------------------------------------生命转换物理攻击
function CommonFun.calcBuff_200(srcUser, targetUser, a, b, c, d,lv)
  if srcUser == nil or targetUser == nil then
      return 0
  end
  local MaxHp = srcUser:GetProperty("MaxHp")
  local MDef = srcUser:GetProperty("MDef")
  local Flee = srcUser:GetProperty("Flee")
  local Weapon2=srcUser:GetEquipedID(2)
  local A = 0
  local mapid,maptype = srcUser:GetMapInfo()-----------------获取所在地图
  ----------------------------------------------------------竞技场最大生命除以4
  if maptype==2 or maptype==4 then
     MaxHp = MaxHp*0.25
  end
  -------------------------------------------------------------圣者法袍的生命值转换物理攻击比例
  if (Weapon2==42058 or Weapon2==142058) then
        A = MaxHp/200
  end

  if A <= 0 then
    return 0
  end
  return A
end

  -----------------------------------------------------------大天使圣像的魔法防御转换魔法攻击比例
function CommonFun.calcBuff_201(srcUser, targetUser, a, b, c, d,lv)
  if srcUser == nil or targetUser == nil then
      return 0
  end
  local MaxHp = srcUser:GetProperty("MaxHp")
  local MDef = srcUser:GetProperty("MDef")
  local Flee = srcUser:GetProperty("Flee")
  local Weapon1=srcUser:GetEquipedID(1)
  local A = 0

  -----------------------------------------------------------大天使圣像的魔法防御转换魔法攻击比例
  if (Weapon1==60512 or Weapon1==160512) then
        A = MDef/10
  end

  if A <= 0 then
    return 0
  end
  return A
end

    -------------------------------------------------------------芬特克的手环的闪避转换物理攻击比例
function CommonFun.calcBuff_202(srcUser, targetUser, a, b, c, d,lv)
  if srcUser == nil or targetUser == nil then
      return 0
  end
  local MaxHp = srcUser:GetProperty("MaxHp")
  local MDef = srcUser:GetProperty("MDef")
  local Flee = srcUser:GetProperty("Flee")
  local Weapon1=srcUser:GetEquipedID(1)
  local A = 0

    -------------------------------------------------------------芬特克的手环的闪避转换物理攻击比例
  if (Weapon1==61512 or Weapon1==161512) then
        A = Flee/10
  end

  if A <= 0 then
    return 0
  end
  return A
end

    -------------------------------------------------------------华贵腕甲的装备攻速转攻击力
function CommonFun.calcBuff_203(srcUser, targetUser, a, b, c, d,lv)
  if srcUser == nil or targetUser == nil then
      return 0
  end
  local MaxHp = srcUser:GetProperty("MaxHp")
  local MDef = srcUser:GetProperty("MDef")
  local EquipASPD = srcUser:GetProperty("EquipASPD")
  local Weapon1=srcUser:GetEquipedID(1)

  local A = 0

    -------------------------------------------------------------芬特克的手环的闪避转换物理攻击比例
  if (Weapon1==61011 or Weapon1==161011) then
        A = EquipASPD*100
  end

  if A <= 0 then
    return 0
  end
  return A
end
-----------------------------------------------------------------------------------星盘灵巧转攻击力
function CommonFun.calcBuff_204(srcUser, targetUser, a, b, c, d,lv)
  if srcUser == nil or targetUser == nil then
      return 0
  end
  local Dex = srcUser:GetProperty("Dex")
  local Num1=srcUser:GetRunePoint(62013)
  local Num2=srcUser:GetRunePoint(62014)
  local Num3=srcUser:GetRunePoint(62015)
  local Num4=srcUser:GetRunePoint(62016)
  local Num5=srcUser:GetRunePoint(62017)
  local RuneDamage=Num1*0.2+Num2*0.2+Num3*0.2+Num4*0.2+Num5*0.2

  local A = Dex*RuneDamage

  if A <= 0 then
    return 0
  end
  return A
end
-----------------------------------------------------------------------------------星盘幸运转攻击力
function CommonFun.calcBuff_205(srcUser, targetUser, a, b, c, d,lv)
    if srcUser == nil or targetUser == nil then
      return 0
  end
  local Luk = srcUser:GetProperty("Luk")
  local Num1=srcUser:GetRunePoint(62026)
  local Num2=srcUser:GetRunePoint(62027)
  local Num3=srcUser:GetRunePoint(62028)
  local Num4=srcUser:GetRunePoint(62029)
  local Num5=srcUser:GetRunePoint(62030)
  local RuneDamage=Num1*0.2+Num2*0.4+Num3*0.2+Num4*0.2+Num5*0.2

  local A = Luk*RuneDamage

  if A <= 0 then
    return 0
  end
  return A
end

-----------------------------------------------------------------------------------持久愈合-高效生效条件
function CommonFun.calcBuff_300(srcUser, targetUser, a, b, c, d,lv)
    if srcUser == nil or targetUser == nil then
      return 0
  end
  local Num1=srcUser:GetRunePoint(51002)
  local Num2=srcUser:GetRunePoint(51007)
  local Num3=srcUser:GetRunePoint(51008)
  local RuneDamage=(Num1 + Num2 + Num3)
  local A = 0
  if RuneDamage > 0 then
     A = 100
  end
  if A <= 0 then
    return 0
  end
  return A
end

-----------------------------------------------------------------------------------持久愈合-高效持续效果
function CommonFun.calcBuff_301(srcUser, targetUser, a, b, c, d,lv)
    if srcUser == nil or targetUser == nil then
      return 0
  end
  local Num1=srcUser:GetRunePoint(51003)
  local Num2=srcUser:GetRunePoint(51006)
  local Num3=srcUser:GetRunePoint(51009)
  local Num4=srcUser:GetRunePoint(52002)
  local RuneDamage=(Num1 + Num2 + Num3 + Num4)

  local A = RuneDamage * a

  if A <= 0 then
    return 0
  end
  return A
end

-----------------------------------------------------------------------------------持久愈合-高效持续时间
function CommonFun.calcBuff_302(srcUser, targetUser, a, b, c, d,lv)
    if srcUser == nil or targetUser == nil then
      return 0
  end
  local Num1=srcUser:GetRunePoint(51002)
  local Num2=srcUser:GetRunePoint(51007)
  local Num3=srcUser:GetRunePoint(51008)
  local RuneDamage=(Num1 + Num2 + Num3)

  local A = RuneDamage*a

  if A <= 0 then
    return 0
  end
  return A
end

-----------------------------------------------------------------------------------霸邪之阵-生效条件
function CommonFun.calcBuff_310(srcUser, targetUser, a, b, c, d,lv)
    if srcUser == nil or targetUser == nil then
      return 0
  end
  local Num1=srcUser:GetRunePoint(51004)
  local Num2=srcUser:GetRunePoint(51005)
  local Num3=srcUser:GetRunePoint(52010)
  local RuneDamage=(Num1 + Num2 + Num3)
  local A = 0
  if RuneDamage > 0 then
     A = 100
  end
  if A <= 0 then
    return 0
  end
  return A
end

-----------------------------------------------------------------------------------霸邪之阵-持续时间
function CommonFun.calcBuff_311(srcUser, targetUser, a, b, c, d,lv)
    if srcUser == nil or targetUser == nil then
      return 0
  end
  local Num1=srcUser:GetRunePoint(51004)
  local Num2=srcUser:GetRunePoint(51005)
  local Num3=srcUser:GetRunePoint(52010)
  local RuneDamage=(Num1 + Num2 + Num3)

  local A = RuneDamage*a

  if A <= 0 then
    return 0
  end
  return A
end

-----------------------------------------------------------------------------------剑术修炼-强效
function CommonFun.calcBuff_320(srcUser, targetUser, a, b, c, d,lv)
    if srcUser == nil or targetUser == nil then
      return 0
  end
  local Num1=srcUser:GetRunePoint(11002)
  local Num2=srcUser:GetRunePoint(11007)
  local Num3=srcUser:GetRunePoint(11013)
  local RuneDamage=(Num1 + Num2 + Num3)*c + 1

  local A = (lv*a + b)*RuneDamage

  if A <= 0 then
    return 0
  end
  return A
end

-----------------------------------------------------------------------------------风行护甲
function CommonFun.calcBuff_321(srcUser, targetUser, a, b, c, d,lv)
  if srcUser == nil or targetUser == nil then
      return 0
  end
  local Agi = srcUser:GetProperty("Agi")
  local Num1=srcUser:GetRunePoint(11011)
  local Num2=srcUser:GetRunePoint(12012)
  local A=(Num1 + Num2)*(math.floor(Agi/5))

  if A <= 0 then
    return 0
  end
  return A
end

-----------------------------------------------------------------------------------挑衅-警惕
function CommonFun.calcBuff_322(srcUser, targetUser, a, b, c, d,lv)
  if srcUser == nil or targetUser == nil then
      return 0
  end
  local Num1=srcUser:GetRunePoint(11003)
  local Num2=srcUser:GetRunePoint(11009)
  local Num3=srcUser:GetRunePoint(11016)
  local Num4=srcUser:GetRunePoint(11017)
  local Num5=srcUser:GetRunePoint(12022)
  local A=lv*a + b + (Num1 + Num2 + Num3 + Num4 + Num5)*c
  if A <= 0 then
    return 0
  end
  return A
end

-----------------------------------------------------------------------------------骑乘训练
function CommonFun.calcBuff_323(srcUser, targetUser, a, b, c, d,lv)
  if srcUser == nil or targetUser == nil then
      return 0
  end
  local skilllv_1 = srcUser:GetLernedSkillLevel(45)   ----骑士系
  local skilllv_2 = srcUser:GetLernedSkillLevel(370)  ----十字军系
  local Num1=srcUser:GetRunePoint(12014)
  local Num2=srcUser:GetRunePoint(12015)
  local Num3=srcUser:GetRunePoint(12016)
  local Num4=srcUser:GetRunePoint(12036)
  local Num5=srcUser:GetRunePoint(12037)
  local Num6=srcUser:GetRunePoint(12038)
  local A=(Num1 + Num2 + Num3 + Num4 + Num5 + Num6)*a*skilllv_1+(Num1 + Num2 + Num3 + Num4 + Num5 + Num6)*a*skilllv_2
  if A <= 0 then
    return 0
  end
  return A
end

-----------------------------------------------------------------------------------强化涂毒
function CommonFun.calcBuff_330(srcUser, targetUser, a, b, c, d,lv)
  if srcUser == nil or targetUser == nil then
      return 0
  end
  local skillLevel = srcUser:GetLernedSkillLevel(191)
  local Num1=srcUser:GetRunePoint(31024)
  local Num2=srcUser:GetRunePoint(31025)
  local Num3=srcUser:GetRunePoint(32024)
  local Num4=srcUser:GetRunePoint(32025)
  local RuneDamage = (Num1*0.25 + Num2*0.5 + Num3*0.5 + Num4*0.25 + 1)

  local A = skillLevel*a*RuneDamage

  if A <= 0 then
    return 0
  end
  return A
end

-----------------------------------------------------------------------------------后退回避闪避
function CommonFun.calcBuff_340(srcUser, targetUser, a, b, c, d,lv)
  if srcUser == nil or targetUser == nil then
      return 0
  end
  local Num1=srcUser:GetRunePoint(32004)
  local RuneDamage = Num1*15
  local A=lv*a + RuneDamage

  if A <= 0 then
    return 0
  end
  return A
end

-----------------------------------------------------------------------------------后退回避移动速度
function CommonFun.calcBuff_350(srcUser, targetUser, a, b, c, d,lv)
  if srcUser == nil or targetUser == nil then
      return 0
  end
  local Num1=srcUser:GetRunePoint(32003)

  local A = Num1*0.25

  if A <= 0 then
    return 0
  end
  return A
end

------------------------------------------------------------------------状态抗性带来的时间减少公式(火箭雨灼烧)
-----------------------------------------------------------------------------------【需要增加素质抵抗的计算公式】--【灼烧】
function CommonFun.calcBuff_360(srcUser, targetUser, a, b, c, d,lv)
  if srcUser == nil or targetUser == nil then
      return 0
  end
  local BlindAtk = srcUser:GetProperty("BlindAtk")
  local BlindDef2 = targetUser:GetProperty("BlindDef")
  local BlindDam  = (1 + BlindAtk - BlindDef2)
  if BlindDam <=0 then
     BlindDam  =0
  end
  ---------------------------------------------------------------------异常状态的每个公式必加
  local StateAtk  = srcUser:GetProperty("StateAtk")
  local StateDef2 = targetUser:GetProperty("StateDef")
  local StateDam  = (1+StateAtk)*(1-StateDef2)
  if StateDam<=0 then
     StateDam =0
  end

  local A = 0
  local Num1=srcUser:GetRunePoint(41006)

  local SkillAttr = srcUser:GetCurSkillAtkAttr()

  if SkillAttr ==4 then
      A= (lv*a+b)*BlindDam*StateDam*Num1
  end

  if A <= 0 then
    return 0
  end
  return A
end
------------------------------------------------------------------------状态抗性带来的时间减少公式(分裂箭灼烧)
-----------------------------------------------------------------------------------【需要增加素质抵抗的计算公式】--【灼烧】
function CommonFun.calcBuff_370(srcUser, targetUser, a, b, c, d,lv)
  if srcUser == nil or targetUser == nil then
      return 0
  end
  local BlindAtk = srcUser:GetProperty("BlindAtk")
  local BlindDef2 = targetUser:GetProperty("BlindDef")
  local BlindDam  = (1 + BlindAtk - BlindDef2)
  if BlindDam <=0 then
     BlindDam  =0
  end
  ---------------------------------------------------------------------异常状态的每个公式必加
  local StateAtk  = srcUser:GetProperty("StateAtk")
  local StateDef2 = targetUser:GetProperty("StateDef")
  local StateDam  = (1+StateAtk)*(1-StateDef2)
  if StateDam<=0 then
     StateDam =0
  end

  local Num1=srcUser:GetRunePoint(42022)

  local A= (lv*a+b)*BlindDam*StateDam*Num1

  if A <= 0 then
    return 0
  end
  return A
end

-----------------------------------------------------------------------------------爆散陷阱火属性加成
function CommonFun.calcBuff_380(srcUser, targetUser, a, b, c, d,lv)
  if srcUser == nil or targetUser == nil then
      return 0
  end
  local Num1=srcUser:GetRunePoint(42025)
  local Num2=srcUser:GetRunePoint(42026)
  local Num3=srcUser:GetRunePoint(42027)
  local Num4=srcUser:GetRunePoint(42028)
  local Num5=srcUser:GetRunePoint(42029)

  local A = -(Num1*0.1+Num2*0.05+Num3*0.05+Num4*0.05+Num5*0.1)

  return A

end
-----------------------------------------------------------------------------------冰霜陷阱水属性加成
function CommonFun.calcBuff_390(srcUser, targetUser, a, b, c, d,lv)
  if srcUser == nil or targetUser == nil then
      return 0
  end

  local Num1=srcUser:GetRunePoint(42036)
  local Num2=srcUser:GetRunePoint(42037)
  local Num3=srcUser:GetRunePoint(42038)
  local Num4=srcUser:GetRunePoint(42039)
  local Num5=srcUser:GetRunePoint(42040)

  local A = -(Num1*0.05+Num2*0.1+Num3*0.05+Num4*0.1+Num5*0.1)

  return A
end
-----------------------------------------------------------------------------------火狩释放火之猎杀技能的概率
function CommonFun.calcBuff_400(srcUser, targetUser, a, b, c, d,lv)
  if srcUser == nil or targetUser == nil then
      return 0
  end
  local Num1=srcUser:GetRunePoint(21006)

  local A = Num1*100

  if A <= 0 then
    return 0
  end
  return A
end

-----------------------------------------------------------------------------------火狩添加层数的概率
function CommonFun.calcBuff_401(srcUser, targetUser, a, b, c, d,lv)
  if srcUser == nil or targetUser == nil then
      return 0
  end
  local Num1=srcUser:GetRunePoint(22007)

  local A = Num1*3

  ------------------------------------------层数小于等于0表示无限制
  if A <= 1 then
    return 1
  end
  return A
end

-----------------------------------------------------------------------------------释放圣灵召唤的概率
function CommonFun.calcBuff_410(srcUser, targetUser, a, b, c, d,lv)
  if srcUser == nil or targetUser == nil then
      return 0
  end
  local Num1=srcUser:GetRunePoint(22020)
  local Num2=srcUser:GetRunePoint(22019)
  local Num3=srcUser:GetRunePoint(22021)

  local A = Num1*5 + Num2*2 + Num3*2

  if A <= 0 then
    return 0
  end
  return A
end

-- --------------------------------------------------------------------------------------------------------冰冻术，霜冻之术破冰伤害
function CommonFun.calcBuff_420(srcUser, targetUser, a, b, c, d,lv)
  local Int = srcUser:GetProperty("Int")
  local Vit = srcUser:GetProperty("Vit")
  local MAtk = srcUser:GetProperty("MAtk")
  local MAtkPer1 = srcUser:GetProperty("MAtkPer")
  local MDamIncrease = CommonFun.calcMDamIncrease(srcUser, targetUser)
  local IgnoreMDef = srcUser:GetProperty("IgnoreMDef")
  if IgnoreMDef >= 1 then
     IgnoreMDef  = 1
  end


  ------------------------------------------------------------------------------------将原来的物伤加成改成精炼物理攻击
  local MRefine  = srcUser:GetProperty("MRefine")
  local RangeDam = srcUser:GetProperty("RangeDam")


  -------------------------------------------------------------------------------------星盘加成冰冻术霜冻之术伤害百分比效果
  local Num1=srcUser:GetRunePoint(22024)
  local Num2=srcUser:GetRunePoint(22025)
  local RuneDamage = (Num1*0.4*lv)*(Num2*0.15 + 1)
  ----------------------------------------------------------------------------------------------------------------获取冰冻术技能等级


  local MDef2 = targetUser:GetProperty("MDef")
  local MDefPer2 = targetUser:GetProperty("MDefPer")
  local Vit2 = targetUser:GetProperty("Vit")
  local VitPer2 = targetUser:GetProperty("VitPer")
  local Int2 = targetUser:GetProperty("Int")
  local IntPer2 = targetUser:GetProperty("IntPer")
  local MDamReduc2 = CommonFun.calcMDamReDuc(srcUser, targetUser)
  local RefineMDamReduc = targetUser:GetProperty("RefineMDamReduc")

  local BaseMAtk = Int+math.floor(Int*Int/100)
  local MAtkFinal= ((MAtk-BaseMAtk)*(1+MAtkPer1)+BaseMAtk)

  ----------------------------魔法防御减免
  local MDefReduc = CommonFun.CalcMDef(MDef,Int,Vit,srcUser,targetUser)

  local B = ((MAtkFinal*MDefReduc*(1-MDamReduc2)+MRefine)*(1-RefineMDamReduc)*(1+MDamIncrease)-Vit2/2*(1+VitPer2)-Int2*(1+IntPer2))
   ------------------------------------------攻击年兽伤害为1

  local A = - B*RuneDamage
    if targetUser:GetNpcID() == 30043 or targetUser:GetNpcID() == 56008 or targetUser:GetNpcID() == 56009 or targetUser:GetNpcID() == 56010 or targetUser:GetNpcID() == 56011 or targetUser:GetNpcID() == 56012 or targetUser:GetNpcID() == 56013 then
        A = -1
    end
            --------------------------------------------不对每次受伤只掉1血的生效
    if targetUser:DamageAlways1() then
        A = -1
    end
  return A
end


-- --------------------------------------------------------------------------------------------------------忏悔的持续魔法伤害
function CommonFun.calcBuff_421(srcUser, targetUser, a, b, c, d,lv)
  local Int = srcUser:GetProperty("Int")
  local Vit = srcUser:GetProperty("Vit")
  local MAtk = srcUser:GetProperty("MAtk")
  local MAtkPer1 = srcUser:GetProperty("MAtkPer")
  local MDamIncrease = CommonFun.calcMDamIncrease(srcUser, targetUser)
  local IgnoreMDef = srcUser:GetProperty("IgnoreMDef")
  if IgnoreMDef >= 1 then
     IgnoreMDef  = 1
  end

  local Num1=srcUser:GetRunePoint(52024)
  ------------------------------------------------------------------------------------将原来的物伤加成改成精炼物理攻击
  local MRefine  = srcUser:GetProperty("MRefine")
  local RangeDam = srcUser:GetProperty("RangeDam")
  --------------------------------------------------------------------------------------分割
  local MDef2 = targetUser:GetProperty("MDef")
  local MDefPer2 = targetUser:GetProperty("MDefPer")
  local Vit2 = targetUser:GetProperty("Vit")
  local VitPer2 = targetUser:GetProperty("VitPer")
  local Int2 = targetUser:GetProperty("Int")
  local IntPer2 = targetUser:GetProperty("IntPer")
  local MDamReduc2 = CommonFun.calcMDamReDuc(srcUser, targetUser)
  local RefineMDamReduc = targetUser:GetProperty("RefineMDamReduc")

  local BaseMAtk = Int+math.floor(Int*Int/100)
  local MAtkFinal= (MAtk-BaseMAtk)*(1+MAtkPer1)+BaseMAtk

  ----------------------------魔法防御减免
  local MDefReduc = CommonFun.CalcMDef(MDef,Int,Vit,srcUser,targetUser)

  local B = ((MAtkFinal*MDefReduc*(1-MDamReduc2)+MRefine)*(1-RefineMDamReduc)*(1+MDamIncrease)-Vit2/2*(1+VitPer2)-Int2*(1+IntPer2))
  local A = - B*a*Num1
          ------------------------------------------攻击年兽伤害为1
    if targetUser:GetNpcID() == 30043 or targetUser:GetNpcID() == 56008 or targetUser:GetNpcID() == 56009 or targetUser:GetNpcID() == 56010 or targetUser:GetNpcID() == 56011 or targetUser:GetNpcID() == 56012 or targetUser:GetNpcID() == 56013 then
        A = -1
    end
        --------------------------------------------不对每次受伤只掉1血的生效
    if targetUser:DamageAlways1() then
        A = -1
    end
  return A
end


-----------------------------------------------------------------------------------忏悔的概率计算公式
function CommonFun.calcBuff_422(srcUser, targetUser, a, b, c, d,lv)
  if srcUser == nil or targetUser == nil then
      return 0
  end
  local Num1=srcUser:GetRunePoint(52024)
  local A = Num1*a

  if A <= 0 then
    return 0
  end
  return A
end

-----------------------------------------------------------------------------------光猎延长时间计算公式
function CommonFun.calcBuff_430(srcUser, targetUser, a, b, c, d,lv)
  if srcUser == nil or targetUser == nil then
      return 0
  end
  local Num1=srcUser:GetRunePoint(52035)
  local Num2=srcUser:GetRunePoint(120200)
  local A = Num1*10 + Num2*10 + a*lv + b

  if A <= 0 then
    return 0
  end
  return A
end

-----------------------------------------------------------------------------------持久愈合的添加概率计算
function CommonFun.calcBuff_440(srcUser, targetUser, a, b, c, d,lv,damage)----damage>0 表示扣血，<0 表示加血
  if srcUser == nil or targetUser == nil then
      return 0
  end
  --------------------------------------------------------------治愈术效果
  local Num1 = srcUser:GetRunePoint(51002)
  local Num2 = srcUser:GetRunePoint(51007)
  local Num3 = srcUser:GetRunePoint(51008)
  local RuneRate = (Num1 + Num2 + Num3)
  local A = RuneRate*100

  if A <= 0 then
    return 0
  end
  return A
end


-----------------------------------------------------------------------------------持久愈合的添加效果计算
function CommonFun.calcBuff_441(srcUser, targetUser, a, b, c, d,lv,damage)----damage>0 表示扣血，<0 表示加血
  if srcUser == nil or targetUser == nil then
      return 0
  end

  --------------------------------------------------------------持久愈合治愈量加成
  local Num4=srcUser:GetRunePoint(51003)
  local Num5=srcUser:GetRunePoint(51002)
  local Num6=srcUser:GetRunePoint(51009)
  local Num7=srcUser:GetRunePoint(52002)
  local RuneValue = 0

  if Num5>=1 then
     RuneValue=0.1
  end

  local RuneDamage = ((Num4 + Num5 + Num6 + Num7)*0.05+RuneValue)*(-1)

  local A = RuneDamage*damage

  if A <= 0 then
    return 0
  end
  return A
end

-----------------------------------------------------------------------------------持久愈合的添加时间计算
function CommonFun.calcBuff_442(srcUser, targetUser, a, b, c, d,lv,damage)----damage>0 表示扣血，<0 表示加血
  if srcUser == nil or targetUser == nil then
      return 0
  end
  --------------------------------------------------------------治愈术效果
  local Num1=srcUser:GetRunePoint(51002)
  local Num2=srcUser:GetRunePoint(51007)
  local Num3=srcUser:GetRunePoint(51008)

  local RuneDamage = (Num1 + Num2 + Num3)*7

  local A = RuneDamage

  if A <= 0 then
    return 0
  end
  return A
end

-----------------------------------------------------------------------------------双重愈合添加时间计算
function CommonFun.calcBuff_450(srcUser, targetUser, a, b, c, d,lv,damage)
  if srcUser == nil or targetUser == nil then
      return 0
  end
  --------------------------------------------------------------治愈术效果
  local Num1=srcUser:GetRunePoint(52003)
  local RuneDamage = Num1*3

  local A = RuneDamage + a

  if A <= 0 then
    return 0
  end
  return A
end

-----------------------------------------------------------------------------------乘胜追击时间计算
function CommonFun.calcBuff_460(srcUser, targetUser, a, b, c, d,lv,damage)
  if srcUser == nil or targetUser == nil then
      return 0
  end
  --------------------------------------------------------------治愈术效果
  local Num1=srcUser:GetRunePoint(12005)
  local Num2=srcUser:GetRunePoint(12007)
  local Num3=srcUser:GetRunePoint(12008)

  local RuneDamage = (Num1 + Num2 + Num3)

  local A = RuneDamage*a

  if A <= 0 then
    return 0
  end
  return A
end
-----------------------------------------------------------------------------------信仰祈福效果计算
function CommonFun.calcBuff_470(srcUser, targetUser, a, b, c, d,lv,damage)
  if srcUser == nil or targetUser == nil then
      return 0
  end

  local Num1=srcUser:GetRunePoint(52008)
  local Num2=srcUser:GetRunePoint(52009)
  local RuneDamage = (Num1 + Num2)*0.05

  local A = RuneDamage

  if A <= 0 then
    return 0
  end
  return A
end

-----------------------------------------------------------------------------------信仰祈福概率计算
function CommonFun.calcBuff_471(srcUser, targetUser, a, b, c, d,lv,damage)
  if srcUser == nil or targetUser == nil then
      return 0
  end

  local Num1=srcUser:GetRunePoint(52008)
  local A = Num1*100

  if A <= 0 then
    return 0
  end
  return A
end

-----------------------------------------------------------------------------------手推车撞击降低攻击力概率
function CommonFun.calcBuff_480(srcUser, targetUser, a, b, c, d,lv,damage)
  if srcUser == nil or targetUser == nil then
      return 0
  end

  local Num1=srcUser:GetRunePoint(62020)
  local Num2=srcUser:GetRunePoint(62021)
  local Num3=srcUser:GetRunePoint(62022)
  local Num4=srcUser:GetRunePoint(62023)
  local RuneRate =Num1*10+Num2*5+Num3*5+Num4*5

  local A = RuneRate

  if A <= 0 then
    return 0
  end
  return A
end

-----------------------------------------------------------------------------------手推车撞击降低攻击力
function CommonFun.calcBuff_490(srcUser, targetUser, a, b, c, d,lv,damage)
  if srcUser == nil or targetUser == nil then
      return 0
  end

  local Num1=srcUser:GetRunePoint(62020)
  local Num2=srcUser:GetRunePoint(62021)
  local Num3=srcUser:GetRunePoint(62022)
  local Num4=srcUser:GetRunePoint(62023)
  local RuneAtk =-(Num1*0.1+Num2*0.05+Num3*0.05+Num4*0.05)

  local A = RuneAtk

  return A
end

--------------------------------------------------------------------------------------神威祈福增加物理攻击效果
function CommonFun.calcBuff_500(srcUser, targetUser, a, b, c, d,lv)
  if srcUser == nil or targetUser == nil then
      return 0
  end
  -------------------------------------------------------------------
  local Num1  = srcUser:GetRunePoint(51015)
  local Num2  = srcUser:GetRunePoint(51016)
  local Num3  = srcUser:GetRunePoint(52028)
  local Num4  = srcUser:GetRunePoint(52029)
  local RuneDamage = (Num1 + Num2 + Num3 + Num4)*0.05+1

  local A= RuneDamage*(a*lv + b)

  if A <= 0 then
    return 0
  end

  return A
end

-----------------------------------------------------------------------------------毒药投掷生命上限降低
function CommonFun.calcBuff_510(srcUser, targetUser, a, b, c, d,lv,damage)
  if srcUser == nil or targetUser == nil then
      return 0
  end

  local Num1=srcUser:GetRunePoint(32050)

  local A =-0.01*Num1+a

  return A
end
-----------------------------------------------------------------------------------毒药投掷毒属性技能额外伤害
function CommonFun.calcBuff_511(srcUser, targetUser, a, b, c, d,lv,damage)
  if srcUser == nil or targetUser == nil then
      return 0
  end

  local Num1=srcUser:GetRunePoint(32050)

  local A =-0.1*Num1+a

  return A
end

--------------------------------------------------------------------------------------致命涂毒效果
function CommonFun.calcBuff_520(srcUser, targetUser, a, b, c, d,lv)
  if srcUser == nil or targetUser == nil then
      return 0
  end
  -------------------------------------------------------------------
  local Num1  = srcUser:GetRunePoint(32100)

  local RuneDamage = Num1*0.02

  if lv> 10 then
    lv = 10
  end

  local A= a*lv+RuneDamage

  if A <= 0 then
    return 0
  end

  return A
end

--------------------------------------------------------------------------------------缓速术的添加概率
function CommonFun.calcBuff_530(srcUser, targetUser, a, b, c, d,lv)
  if srcUser == nil or targetUser == nil then
      return 0
  end
  -------------------------------------------------------------------
  local Num1  = srcUser:GetRunePoint(52110)

  local A = Num1*100

  if A <= 0 then
    return 0
  end

  return A
end

--------------------------------------------------------------------------------------牺牲祈福的添加概率
function CommonFun.calcBuff_540(srcUser, targetUser, a, b, c, d,lv)
  if srcUser == nil or targetUser == nil then
      return 0
  end
  -------------------------------------------------------------------
  local Num1  = srcUser:GetRunePoint(52080)

  local A = Num1*100

  if A <= 0 then
    return 0
  end

  return A
end

--------------------------------------------------------------------------------------牺牲祈福的添加概率
function CommonFun.calcBuff_550(srcUser, targetUser, a, b, c, d,lv)
  if srcUser == nil or targetUser == nil then
      return 0
  end
  -------------------------------------------------------------------
  local Num1  = srcUser:GetRunePoint(52080)

  local A = 100

  if  Num1>0 then
      A = 0
  end

  if A <= 0 then
    return 0
  end

  return A
end

--------------------------------------------------------------------------------------牺牲祈福的添加概率
function CommonFun.calcBuff_551(srcUser, targetUser, a, b, c, d,lv)
  if srcUser == nil or targetUser == nil then
      return 0
  end
  -------------------------------------------------------------------
  local Num1  = srcUser:GetRunePoint(52080)

  local A = Num1*100

  if A <= 0 then
    return 0
  end

  return A
end

--------------------------------------------------------------------------------------牺牲祈福的添加概率
function CommonFun.calcBuff_552(srcUser, targetUser, a, b, c, d,lv)
  if srcUser == nil or targetUser == nil then
      return 0
  end
  -------------------------------------------------------------------
  local Num1  = srcUser:GetRunePoint(52080)

  local A = Num1*a

  return A
end

--------------------------------------------------------------------------------------牧师普攻释放神威祈福
function CommonFun.calcBuff_560(srcUser, targetUser, a, b, c, d,lv)
  if srcUser == nil or targetUser == nil then
      return 0
  end
  -------------------------------------------------------------------
  local Num1  = srcUser:GetRunePoint(52160)

  local A = Num1*a

  if A <= 0 then
    return 0
  end

  return A
end


--------------------------------------------------------------------------------------忏悔效果时间计算
function CommonFun.calcBuff_570(srcUser, targetUser, a, b, c, d,lv)
  if srcUser == nil or targetUser == nil then
      return 0
  end
  -------------------------------------------------------------------
  local Num1  = srcUser:GetRunePoint(52023)
  local Num2  = srcUser:GetRunePoint(52170)
  local Num3  = srcUser:GetRunePoint(52171)
  local A = (Num1*6 + Num2*2 + Num3*2)

  if A <= 0 then
    return 0
  end

  return A
end


--------------------------------------------------------------------------------------驱散身上的增益效果
function CommonFun.calcBuff_580(srcUser, targetUser, a, b, c, d,lv)
  if srcUser == nil or targetUser == nil then
      return 0
  end
  -------------------------------------------------------------------
  local Num1  = srcUser:GetRunePoint(52090)

  local A = Num1*a

  if A <= 0 then
    return 0
  end

  return A
end

-----------------------------------------------------------------------------------灵魂抽取额外加成伤害
function CommonFun.calcBuff_590(srcUser, targetUser, a, b, c, d,lv,damage)
  if srcUser == nil or targetUser == nil then
      return 0
  end

  local Num1=srcUser:GetRunePoint(42100)

  local A =-0.05*Num1

  return A
end

------------------------------------------------------------------------闪电冲击驱散buff
function CommonFun.calcBuff_600(srcUser, targetUser, a, b, c, d,lv)
  if srcUser == nil or targetUser == nil then
      return 0
  end
  local Num1 = srcUser:GetRunePoint(42090)
  local RuneRate = Num1*5

  local A= RuneRate

  if A <= 0 then
    return 0
  end
  return A
end

------------------------------------------------------------------------光猎会对隐匿目标造成额外伤害
function CommonFun.calcBuff_610(srcUser, targetUser, a, b, c, d,lv)
  if srcUser == nil or targetUser == nil then
      return 0
  end
  local Hiding = targetUser:GetProperty("Hiding")
  local A = 0
  if Hiding==1 then
     A = 100
  end

  if A <= 0 then
    return 0
  end
  return A
end

------------------------------------------------------------------------斧头精炼度提升效果
function CommonFun.calcBuff_620(srcUser, targetUser, a, b, c, d,lv)
  if srcUser == nil or targetUser == nil then
      return 0
  end
  local Num1 = srcUser:GetRunePoint(62040)
  local RuneDamage = Num1*0.1+1

  local A= RuneDamage*a

  if A <= 0 then
    return 0
  end
  return A
end

-----------------------------------------------------------------------------------旋风斧减移动速度
function CommonFun.calcBuff_630(srcUser, targetUser, a, b, c, d,lv,damage)
  if srcUser == nil or targetUser == nil then
      return 0
  end

  local Num1=srcUser:GetRunePoint(62060)
  local Num2=srcUser:GetRunePoint(62061)
  local Num3=srcUser:GetRunePoint(62062)
  local Num4=srcUser:GetRunePoint(62063)
  local Num5=srcUser:GetRunePoint(62064)

  local A =-0.1*(Num1+Num2+Num3+Num4+Num5)

  return A
end

-----------------------------------------------------------------------------------旋风斧持续时间
function CommonFun.calcBuff_631(srcUser, targetUser, a, b, c, d,lv,damage)
  if srcUser == nil or targetUser == nil then
      return 0
  end

  local Num1=srcUser:GetRunePoint(62060)
  local Num2=srcUser:GetRunePoint(62061)
  local Num3=srcUser:GetRunePoint(62062)
  local Num4=srcUser:GetRunePoint(62063)
  local Num5=srcUser:GetRunePoint(62064)

  local A = Num1+Num2+Num3+Num4+Num5

  return A
end

-----------------------------------------------------------------------------------分裂斧触发概率
function CommonFun.calcBuff_640(srcUser, targetUser, a, b, c, d,lv,damage)
  if srcUser == nil or targetUser == nil then
      return 0
  end

  local Num1 = srcUser:GetRunePoint(62090)
  local Num2 = srcUser:GetRunePoint(62091)
  local Num3 = srcUser:GetRunePoint(62092)

  local A = (Num1+Num2+Num3)*5

  return A
end

-----------------------------------------------------------------------------------法师普攻也能触发点燃
function CommonFun.calcBuff_650(srcUser, targetUser, a, b, c, d,lv,damage)
  if srcUser == nil or targetUser == nil then
      return 0
  end
  local skilllv_1 = srcUser:GetLernedSkillLevel(88)
  local Num1=srcUser:GetRunePoint(22170)
  local AtkAttr = srcUser:GetProperty("AtkAttr")
  local A = 0

  if AtkAttr==4 and Num1>=1 then
     A = 5*skilllv_1
  end

  return A
end

--------------------------------------------------------------------------------------------------------------------------法师星盘风属性魔法伤害计算公式
function CommonFun.calcBuff_660(srcUser, targetUser, a, b, c, d,lv,damage)
  local Luk = srcUser:GetProperty("Luk")
  local Int = srcUser:GetProperty("Int")
  local Vit = srcUser:GetProperty("Vit")
  local MAtk = srcUser:GetProperty("MAtk")
  local MAtkPer = srcUser:GetProperty("MAtkPer")
  -----------------------------------------------------------------------------------分割线
  local MDamIncrease = CommonFun.calcMDamIncrease(srcUser, targetUser)
  local IgnoreMDef = srcUser:GetProperty("IgnoreMDef")
  if IgnoreMDef >= 1 then
     IgnoreMDef  = 1
  end

  ------------------------------------------------------------------------------------将原来的物伤加成改成精炼物理攻击
  local MRefine = srcUser:GetProperty("MRefine")

  local srcAtkElement    = 1
  local targetDefElement = targetUser:GetProperty("DefAttr")

  local MDef2 = targetUser:GetProperty("MDef")
  local MDefPer2 = targetUser:GetProperty("MDefPer")
  local Vit2 = targetUser:GetProperty("Vit")
  local VitPer2 = targetUser:GetProperty("VitPer")
  local Int2 = targetUser:GetProperty("Int")
  local IntPer2 = targetUser:GetProperty("IntPer")
  local MDamReduc2 = CommonFun.calcMDamReDuc(srcUser, targetUser)
  local RefineMDamReduc = targetUser:GetProperty("RefineMDamReduc")

  local BaseMAtk = Int+math.floor(Int*Int/100)
  local MAtkFinal= ((MAtk-BaseMAtk)*(1+MAtkPer)+BaseMAtk)*GameConfig.ElementRestrain[srcAtkElement][targetDefElement]

  ----------------------------魔法防御减免
  local MDefReduc = CommonFun.CalcMDef(MDef,Int,Vit,srcUser,targetUser)

  local A = ((MAtkFinal*MDefReduc*(1-MDamReduc2)+MRefine)*(a*lv)*math.floor(Int/10)*(1-RefineMDamReduc)*(1+MDamIncrease)-Vit2/2*(1+VitPer2)-Int2*(1+IntPer2))

    ------------------------------------------攻击年兽伤害为1
    if targetUser:GetNpcID() == 30043 or targetUser:GetNpcID() == 56008 or targetUser:GetNpcID() == 56009 or targetUser:GetNpcID() == 56010 or targetUser:GetNpcID() == 56011 or targetUser:GetNpcID() == 56012 or targetUser:GetNpcID() == 56013 then
        A = -1
    end
    --------------------------------------------不对每次受伤只掉1血的生效
    if targetUser:DamageAlways1() then
        A = -1
    end
  return A

end

-----------------------------------------------------------------------------------破冰之后继续冰冻的添加概率
-----------------------------------------------------------------------------------【需要增加素质抵抗的计算公式】--【冰冻】
function CommonFun.calcBuff_670(srcUser, targetUser, a, b, c, d,lv,damage)
  if srcUser == nil or targetUser == nil then
      return 0
  end

  local Num1=srcUser:GetRunePoint(22110)
  local A = Num1*100

  return A
end


-----------------------------------------------------------------------------------破冰之后继续冰冻的生效范围
function CommonFun.calcBuff_671(srcUser, targetUser, a, b, c, d,lv,damage)
  if srcUser == nil or targetUser == nil then
      return 0
  end

  local Num1=srcUser:GetRunePoint(22110)
  local A = Num1+a

  return A
end
-----------------------------------------------------------------------------------陨石术概率释放火柱的添加概率
function CommonFun.calcBuff_680(srcUser, targetUser, a, b, c, d,lv,damage)
  if srcUser == nil or targetUser == nil then
      return 0
  end

  local Num1=srcUser:GetRunePoint(22041)
  local Num2=srcUser:GetRunePoint(22043)
  local A = 0
  if (Num1 + Num2)>=1 then
     A = a
  end

  return A
end

-----------------------------------------------------------------------------------集中攻击减少防御力
function CommonFun.calcBuff_690(srcUser, targetUser, a, b, c, d,lv)
  if srcUser == nil or targetUser == nil then
      return 0
  end
  -------------------------------------------------------------------
  local Num1  = srcUser:GetRunePoint(12080)

  local RuneDamage = Num1*0.07

  local A= a*lv+RuneDamage

  if A>=0 then
    return 0
  end

  return A
end

-----------------------------------------------------------------------------------狂怒之枪减少闪避
function CommonFun.calcBuff_700(srcUser, targetUser, a, b, c, d,lv)
  if srcUser == nil or targetUser == nil then
      return 0
  end
  -------------------------------------------------------------------
  local Num1  = srcUser:GetRunePoint(12130)

  local RuneDamage = Num1*0.12

  local A= a+RuneDamage

  if A>=0 then
    return 0
  end

  return A
end

-----------------------------------------------------------------------------------投掷长矛减速概率
function CommonFun.calcBuff_710(srcUser, targetUser, a, b, c, d,lv)
  if srcUser == nil or targetUser == nil then
      return 0
  end
  -------------------------------------------------------------------
  local Num1  = srcUser:GetRunePoint(12120)

  local A = Num1*15

  return A
end

-----------------------------------------------------------------------------------投掷长矛减速效果
function CommonFun.calcBuff_720(srcUser, targetUser, a, b, c, d,lv)
  if srcUser == nil or targetUser == nil then
      return 0
  end
  -------------------------------------------------------------------
  local Num1  = srcUser:GetRunePoint(12120)

  local A = -0.2*Num1

  return A
end


-----------------------------------------------------------------------------------反击造成的去除原本的反击效果
function CommonFun.calcBuff_730(srcUser, targetUser, a, b, c, d,lv)
  if srcUser == nil or targetUser == nil then
      return 0
  end
  -------------------------------------------------------------------
  local Num1  = srcUser:GetRunePoint(12050)

  local A = 100 - Num1*100

  if A<=0 then
    return 0
  end

  return A
end
-----------------------------------------------------------------------------------反击造成的近战物理反伤效果
function CommonFun.calcBuff_731(srcUser, targetUser, a, b, c, d,lv)
  if srcUser == nil or targetUser == nil then
      return 0
  end
  -------------------------------------------------------------------
  local Num1  = srcUser:GetRunePoint(12050)

  local A = Num1*100

  if A<=0 then
    return 0
  end

  return A
end

-----------------------------------------------------------------------------------反击造成的远程物理反伤和远程魔法反伤效果
function CommonFun.calcBuff_732(srcUser, targetUser, a, b, c, d,lv)
  if srcUser == nil or targetUser == nil then
      return 0
  end
  -------------------------------------------------------------------
  local Num1  = srcUser:GetRunePoint(12050)
  local Num2  = srcUser:GetRunePoint(12040)

  local A = 0

  if Num1 >=1 then
    A = 100*Num2
  end

  if A<=0 then
    return 0
  end

  return A
end

-----------------------------------------------------------------------------------反击造成的远程物理反伤和远程魔法反伤效果
function CommonFun.calcBuff_733(srcUser, targetUser, a, b, c, d,lv)
  if srcUser == nil or targetUser == nil then
      return 0
  end
  -------------------------------------------------------------------
  local Num1  = srcUser:GetRunePoint(12050)
  local Num2  = srcUser:GetRunePoint(12041)

  local A = 0

  if Num1 >=1 then
    A = 100*Num2
  end

  if A<=0 then
    return 0
  end

  return A
end

-----------------------------------------------------------------------------------反击造成的近战物理反伤效果
function CommonFun.calcBuff_734(srcUser, targetUser, a, b, c, d,lv)
  if srcUser == nil or targetUser == nil then
      return 0
  end
  -------------------------------------------------------------------
  local Num1  = srcUser:GetRunePoint(12050)
  local Def = srcUser:GetProperty("Def")
  local Vit = srcUser:GetProperty("Vit")
  local DefPer = srcUser:GetProperty("DefPer")
  local DefFinal = (Def-Vit)*(1+DefPer)+Vit


  local A = (Num1*a)*b*DefFinal

  return A
end
-----------------------------------------------------------------------------------霸体的原石效果删除概率
function CommonFun.calcBuff_740(srcUser, targetUser, a, b, c, d,lv)
  if srcUser == nil or targetUser == nil then
      return 0
  end
  -------------------------------------------------------------------
  local Num1  = srcUser:GetRunePoint(12180)

  local A = 100-Num1*100

  if A<=0 then
    return 0
  end

  return A
end
-----------------------------------------------------------------------------------霸体的原石效果删除概率
function CommonFun.calcBuff_741(srcUser, targetUser, a, b, c, d,lv)
  if srcUser == nil or targetUser == nil then
      return 0
  end
  -------------------------------------------------------------------
  local Num1  = srcUser:GetRunePoint(12180)

  local A = Num1*(a*lv+b)

  if A<=0 then
    return 0
  end

  return A
end

-----------------------------------------------------------------------------------霸体的原始效果删除概率
function CommonFun.calcBuff_750(srcUser, targetUser, a, b, c, d,lv)
  if srcUser == nil or targetUser == nil then
      return 0
  end
  -------------------------------------------------------------------
  local Num1  = srcUser:GetRunePoint(12060)

  local A = Num1*a

  return A
end

-----------------------------------------------------------------------------------狂暴之怒的添加效果
function CommonFun.calcBuff_760(srcUser, targetUser, a, b, c, d,lv)
  if srcUser == nil or targetUser == nil then
      return 0
  end
  -------------------------------------------------------------------
  local Num1  = srcUser:GetRunePoint(12131)

  local A = Num1*a + b

  if A<=0 then
    return 0
  end

  return A
end
----------------------------------------------------------------------------------蓄气的上限
function CommonFun.calcBuff_770(srcUser, targetUser, a, b, c, d,lv)
  if srcUser == nil or targetUser == nil then
      return 0
  end
  -------------------------------------------------------------------
  local profressionID = targetUser:GetProfressionID()
  local skilllv_1 = targetUser:GetLernedSkillLevel(301)----蓄气
  local skilllv_2 = targetUser:GetLernedSkillLevel(1207)----潜龙升天
  local Dragon = 0

  local A = 5
  -----------------------------------------------潜龙升天 加气弹
  if srcUser:HasBuffID(117110) then
      Dragon = skilllv_2
  end
  if (profressionID==122 or profressionID==123 or profressionID==124) then
      A = skilllv_1 + Dragon
  end

  if A <= 0 then
     A = 1
  end
  --print("skilllv_1="..skilllv_1,"skilllv_2="..skilllv_2,"A="..A)
  return A
end

----------------------------------------------------------------------------------蓄气(气弹精修)
function CommonFun.calcBuff_780(srcUser, targetUser, a, b, c, d,lv)
  if srcUser == nil or targetUser == nil then
      return 0
  end
  -------------------------------------------------------------------
  local skilllv_1 = srcUser:GetLernedSkillLevel(322)---------------气弹精修
  local skilllv_2 =0
  if srcUser:HasBuffID(100510) then
     skilllv_2 = srcUser:GetLernedSkillLevel(303)---------------爆气加攻击
  end

  local atk1 = 0
  if skilllv_1>=1 and skilllv_1 <=5 then
        atk1=1
  elseif skilllv_1>5 then
        atk1=2
  end

  local A = (a + atk1)*(1 + skilllv_2*0.2)

  return A
end

----------------------------------------------------------------------------------蓄气(气弹精修)
function CommonFun.calcBuff_790(srcUser, targetUser, a, b, c, d,lv)
  if srcUser == nil or targetUser == nil then
      return 0
  end
  -------------------------------------------------------------------
  local skilllv_1 = srcUser:GetLernedSkillLevel(322)---------------气弹精修
  local IgnoreDef = 0
  if skilllv_1>=1 and skilllv_1 <=5 then
        IgnoreDef=0.005
  elseif skilllv_1>5 then
        IgnoreDef=0.01
  end

  local A = a + IgnoreDef

  return A
end

----------------------------------------------------------------------------------纳迦鳞盾效果
function CommonFun.calcBuff_800(srcUser, targetUser, a, b, c, d,lv)
  if srcUser == nil or targetUser == nil then
      return 0
  end
  -------------------------------------------------------------------
  local Int = srcUser:GetProperty("Int")
  local A = math.floor(Int/3)
  if A<=0 then
     A = 0
  end

  return A
end

----------------------------------------------------------------------------------运气调息
function CommonFun.calcBuff_1900(srcUser, targetUser, a, b, c, d,lv)
  if srcUser == nil or targetUser == nil then
      return 0
  end
  -------------------------------------------------------------------
  local MaxHp = srcUser:GetProperty("MaxHp")
  local Num1  = srcUser:GetRunePoint(120070)
  local RuneDamage = Num1 * 0.1 + 1

  local A = math.floor((MaxHp/a+b)*RuneDamage)*lv

  return A
end

----------------------------------------------------------------------------------运气调息
function CommonFun.calcBuff_1901(srcUser, targetUser, a, b, c, d,lv)
  if srcUser == nil or targetUser == nil then
      return 0
  end
  -------------------------------------------------------------------
  local MaxSp = srcUser:GetProperty("MaxSp")
  local Num1  = srcUser:GetRunePoint(120070)
  local RuneDamage = Num1 * 0.1 + 1

  local A = math.floor((MaxSp/a+b)*RuneDamage)*lv

  return A
end

----------------------------------------------------------------------------------神之威压扣蓝
function CommonFun.calcBuff_1910(srcUser, targetUser, a, b, c, d,lv)
  if srcUser == nil or targetUser == nil then
      return 0
  end
  -------------------------------------------------------------------
  local MaxSp = srcUser:GetProperty("MaxSp")

  local A = -math.floor(MaxSp*(0.01+(lv-1)*0.005)+lv*5+15)

  return A
end
----------------------------------------------------------------------------------牺牲 光之盾 传递概率
function CommonFun.calcBuff_1920(srcUser, targetUser, a, b, c, d,lv)
  if srcUser == nil or targetUser == nil then
      return 0
  end
  local A = 0
  -------------------------------------------------------------------
  if srcUser:HasBuffID(115080) then
      A = 100
  end

  return A
end
----------------------------------------------------------------------------------牺牲 光之盾 传递时间
function CommonFun.calcBuff_1930(srcUser, targetUser, a, b, c, d,lv)
  if srcUser == nil or targetUser == nil then
      return 0
  end

  local A = srcUser:GetBuffEndTime(115080)

  return A
end
----------------------------------------------------------------------------------恩赐 受治愈属性 舍命庇护
function CommonFun.calcBuff_1940(srcUser, targetUser, a, b, c, d,lv)
  if srcUser == nil or targetUser == nil then
      return 0
  end

  local A = 0.01*lv

  return A
end
----------------------------------------------------------------------------------金刚不坏攻击速度
function CommonFun.calcBuff_1950(srcUser, targetUser, a, b, c, d,lv)
  if srcUser == nil or targetUser == nil then
      return 0
  end

  local Num1  = srcUser:GetRunePoint(120030)

  local A = -0.5 + lv*0.05 + 0.03*Num1

  return A
end

----------------------------------------------------------------------------------普攻恢复SP
function CommonFun.calcBuff_1960(srcUser, targetUser, a, b, c, d,lv)
  if srcUser == nil or targetUser == nil then
      return 0
  end

  local Num1  = srcUser:GetRunePoint(120080)

  local A = 25*Num1

  return A
end

----------------------------------------------------------------------------------爆气攻速
function CommonFun.calcBuff_1970(srcUser, targetUser, a, b, c, d,lv)
  if srcUser == nil or targetUser == nil then
      return 0
  end

  local Num1  = srcUser:GetRunePoint(120090)

  local A = Num1 * 0.01

  return A
end

----------------------------------------------------------------------------------蓄气(忽视魔防)
function CommonFun.calcBuff_1980(srcUser, targetUser, a, b, c, d,lv)
  if srcUser == nil or targetUser == nil then
      return 0
  end
  local Num1  = srcUser:GetRunePoint(120170)
  local A = Num1*0.01

  return A
end
------------------------------------------------------------------------盾击眩晕概率【需要增加素质抵抗的计算公式】--【晕眩概率】
function CommonFun.calcBuff_2000(srcUser, targetUser, a, b, c, d,lv)
  if srcUser == nil or targetUser == nil then
      return 0
  end
  local StunAtk = srcUser:GetProperty("StunAtk")
  local StunDef2 = targetUser:GetProperty("StunDef")
  local StunDam  = (1 + StunAtk - StunDef2)
  if StunDam <=0 then
     StunDam  =0
  end

  ---------------------------------------------------------------------异常状态的每个公式必加
  local StateAtk  = srcUser:GetProperty("StateAtk")
  local StateDef2 = targetUser:GetProperty("StateDef")
  local StateDam  = (1+StateAtk)*(1-StateDef2)
  if StateDam<=0 then
     StateDam =0
  end
  local Num1  = srcUser:GetRunePoint(70110)
  local A= (lv*a+b+Num1*15)*StunDam*StateDam*CommonFun.calcAttrDizzyRate(srcUser, targetUser)

  if A <= 0 then
    return 0
  end

  return A
end

----------------------------------------------------------------------------------圣十字审判自身受到的伤害
function CommonFun.calcBuff_2010(srcUser, targetUser, a, b, c, d,lv)
  if srcUser == nil or targetUser == nil then
      return 0
  end

  local BaseLv = srcUser.BaseLv
  local Str = srcUser:GetProperty("Str")
  local Int = srcUser:GetProperty("Int")
  local Num1  = srcUser:GetRunePoint(70080)

  local A = -(Str*2+math.floor(Str*Str/100)+Int*2+math.floor(Int*Int/100)+BaseLv*10)*3*(1-Num1*0.05)

  return A
end

----------------------------------------------------------------------------------大天使之盾反射魔法伤害
function CommonFun.calcBuff_2020(srcUser, targetUser, a, b, c, d,lv)
  if srcUser == nil or targetUser == nil then
      return 0
  end

  local A = 0

  if srcUser:HasBuffID(40430) then
    local RefineLv = srcUser:GetEquipedRefineLv(1)
    A = RefineLv/100
  end

  return A
end

----------------------------------------------------------------------------------阿修罗 物伤减免添加概率
function CommonFun.calcBuff_2030(srcUser, targetUser, a, b, c, d,lv)
  if srcUser == nil or targetUser == nil then
      return 0
  end

  local A = 0

  if srcUser:HasBuffID(90000935) then
     A = 100
  end

  return A
end
----------------------------------------------------------------------------------红十字杖+天衣月舞
function CommonFun.calcBuff_2040(srcUser, targetUser, a, b, c, d,lv)
  if srcUser == nil or targetUser == nil then
      return 0
  end

  local A = 0

  if srcUser:HasBuffID(90000653) and srcUser:HasBuffID(90000683) then
    local RefineLv=srcUser:GetEquipedRefineLv(2)
    if RefineLv>=10 then
        A = 0.1
    else
        A = 0.05
    end
  end

  return A
end

----------------------------------------------------------------------------------生机之杖+天衣月舞
function CommonFun.calcBuff_2041(srcUser, targetUser, a, b, c, d,lv)
  if srcUser == nil or targetUser == nil then
      return 0
  end

  local A = 0

  if srcUser:HasBuffID(41960) and srcUser:HasBuffID(90000683) then
    local RefineLv=srcUser:GetEquipedRefineLv(2)
    if RefineLv>=10 then
        A = 0.1
    else
        A = 0.05
    end
  end

  return A
end
----------------------------------------------------------------------------------秘衣恶德升级效果
function CommonFun.calcBuff_2050(srcUser, targetUser, a, b, c, d,lv)
  if srcUser == nil or targetUser == nil then
      return 0
  end

  local A = 0
  local RefineLv=srcUser:GetEquipedRefineLv(2)

    if RefineLv>=5 and RefineLv<10 then
        A = 0.03
    elseif RefineLv>=10 and RefineLv<15 then
        A = 0.07
    elseif RefineLv ==15 then
        A = 0.12
    end

  return A
end
----------------------------------------------------------------------------------三角裤+衬衫 添加概率
function CommonFun.calcBuff_2060(srcUser, targetUser, a, b, c, d,lv)
  if srcUser == nil or targetUser == nil then
      return 0
  end

  local A = 0
  if srcUser:HasBuffID(90000895) and srcUser:HasBuffID(90000733) then
      A = 100
  end

  return A
end
----------------------------------------------------------------------------------三角裤+衬衫 闪避转换
function CommonFun.calcBuff_2061(srcUser, targetUser, a, b, c, d,lv)
  if srcUser == nil or targetUser == nil then
      return 0
  end

  local Flee = srcUser:GetProperty("Flee")
  local A = 5*Flee

  return A
end
----------------------------------------------------------------------------------露娜弓+月亮胸针 添加概率
function CommonFun.calcBuff_2070(srcUser, targetUser, a, b, c, d,lv)
  if srcUser == nil or targetUser == nil then
      return 0
  end

  local A = 0
  if srcUser:HasBuffID(90000995) and srcUser:HasBuffID(90001005) then
      A = 100
  end

  return A
end
----------------------------------------------------------------------------------大猫+时之蓝+高等布袋熊 添加概率
function CommonFun.calcBuff_2080(srcUser, targetUser, a, b, c, d,lv)
  if srcUser == nil or targetUser == nil then
      return 0
  end

  local A = 0
  if srcUser:HasBuffID(90000985) and srcUser:HasBuffID(90001073) and srcUser:HasBuffID(40470) then
      A = 100
  end

  return A
end
----------------------------------------------------------------------------------神圣复仇者 减少 舍命攻击扣除的血量 （天谴）
function CommonFun.calcBuff_2090(srcUser, targetUser, a, b, c, d,lv)
  if srcUser == nil or targetUser == nil then
      return 0
  end
  local MaxHp = srcUser:GetProperty("MaxHp")
  local mapid,maptype = srcUser:GetMapInfo()-----------------获取所在地图
  local pvpRatio = 1

  if maptype==2 or maptype==4 then
      pvpRatio = 0.25
  end

  local A = -MaxHp*0.09*pvpRatio

  if srcUser:HasBuffID(90001093)  or srcUser:HasBuffID(41732) then
      A = -MaxHp*0.07*pvpRatio
  end

  return A
end
----------------------------------------------------------------------------------神圣复仇者  舍命攻击添加概率  （天谴）
function CommonFun.calcBuff_2091(srcUser, targetUser, a, b, c, d,lv)
  if srcUser == nil or targetUser == nil then
      return 0
  end
  local A = 8
  local B = 0

  --拥有华贵腕甲或狐纹腕甲[第四档]的Buff时概率额外附加
  if srcUser:HasBuffID(40170) or srcUser:HasBuffID(90000533)  then
    B = 12
  end

  if srcUser:HasBuffID(115090) and (srcUser:HasBuffID(90001093) or srcUser:HasBuffID(41732))then
    local Hp = srcUser:GetProperty("Hp")
    local MaxHp = srcUser:GetProperty("MaxHp")

    if Hp>MaxHp*0.09 then
        A = 40
    end
   end

   return A + B
end

----------------------------------------------------------------------------------狮鹫兽[存储]概率
function CommonFun.calcBuff_2092(srcUser, targetUser, a, b, c, d,lv)
  if srcUser == nil or targetUser == nil then
      return 0
  end
  local Profession=srcUser:GetProfressionID()
  local A = 3

  --怪物互击效果
  if srcUser:HasBuffID(80000710) and (Profession == 11 or Profession == 12 or Profession == 13 or Profession == 14 or Profession == 72 or Profession == 73 or Profession == 74 )  then
    A = 6
  end

  return A
end

----------------------------------------------------------------------------------半龙人[存储]概率
function CommonFun.calcBuff_2093(srcUser, targetUser, a, b, c, d,lv)
  if srcUser == nil or targetUser == nil then
      return 0
  end

  local A = 3

  --拥有半龙人[存储]的Buff时概率额外附加
  if srcUser:HasBuffID(80001290)  then
    A = 6
  end

  return A
end

----------------------------------------------------------------------------------大猫+水晶靴 添加概率
function CommonFun.calcBuff_2100(srcUser, targetUser, a, b, c, d,lv)
  if srcUser == nil or targetUser == nil then
      return 0
  end

  local A = 0
  if srcUser:HasBuffID(90000985) and srcUser:HasBuffID(40440) then
      A = 100
  end

  return A
end
----------------------------------------------------------------------------------血之泪 拳刃修炼
function CommonFun.calcBuff_2110(srcUser, targetUser, a, b, c, d,lv)
  if srcUser == nil or targetUser == nil then
      return 0
  end
  local skilllv_1 = srcUser:GetLernedSkillLevel(189)

  if skilllv_1~=10 then
      a = 0
  end
  local A = a + b

  return A
end
----------------------------------------------------------------------------------洛奇的指甲+华贵腕甲 添加概率
function CommonFun.calcBuff_2120(srcUser, targetUser, a, b, c, d,lv)
  if srcUser == nil or targetUser == nil then
      return 0
  end

  local A = 0
  if srcUser:HasBuffID(90001034) and srcUser:HasBuffID(40170) then
      A = 100
  end

  return A
end
-------------------------------------------------------------洛奇的指甲  华贵腕甲的装备攻速转攻击力
function CommonFun.calcBuff_2121(srcUser, targetUser, a, b, c, d,lv)
  if srcUser == nil or targetUser == nil then
      return 0
  end
    local EquipASPD = srcUser:GetProperty("EquipASPD")
    local A = math.floor(EquipASPD/2*100)

  if A <= 0 then
    return 0
  end
  return A
end
----------------------------------------------------------------------------------防水靴+丝质外袍 添加概率
function CommonFun.calcBuff_2130(srcUser, targetUser, a, b, c, d,lv)
  if srcUser == nil or targetUser == nil then
      return 0
  end

  local A = 0
  if srcUser:HasBuffID(90000945) and srcUser:HasBuffID(90000955) then
      A = 100
  end

  return A
end
----------------------------------------------------------------------------------定位陷阱 伤害加成 添加概率
function CommonFun.calcBuff_2140(srcUser, targetUser, a, b, c, d,lv)
  if srcUser == nil or targetUser == nil then
      return 0
  end

  local A = 0
  if srcUser:HasBuffID(90001004)  then
      A = 0.1
  end

  return A
end
----------------------------------------------------------------------------------霸邪之阵
function CommonFun.calcBuff_2150(srcUser, targetUser, a, b, c, d,lv)
  if srcUser == nil or targetUser == nil then
      return 0
  end
  local A = 5

  local skilllv_1 = srcUser:GetLernedSkillLevel(150)

  if skilllv_1>=2 and skilllv_1<4 then
    A = 6
  elseif skilllv_1>=4 and skilllv_1<6 then
    A = 7
  elseif skilllv_1>=6 and skilllv_1<8 then
    A = 8
  elseif skilllv_1>=8 and skilllv_1<10 then
    A = 9
  elseif skilllv_1 >=10 then
    A = 10
  end

  return A
end
----------------------------------------------------------------------------------霸邪之阵
function CommonFun.calcBuff_2151(srcUser, targetUser, a, b, c, d,lv)
  if srcUser == nil or targetUser == nil then
      return 0
  end
  local MaxHp = targetUser:GetProperty("MaxHp")
  local skilllv_1 = srcUser:GetLernedSkillLevel(150)-----------霸邪之阵

  local Num = srcUser:GetRunePoint(51004) ----霸邪之阵疾走

  local extraLv = 0
  if skilllv_1 >10 then
      extraLv = skilllv_1-10
  end

  local A = 0.1 + 0.02*math.min(skilllv_1,10) + (Num*1500+1500*extraLv)/MaxHp

  return A
end
----------------------------------------------------------------------------------隐匿眩晕概率
function CommonFun.calcBuff_2160(srcUser, targetUser, a, b, c, d,lv)
  if srcUser == nil or targetUser == nil then
      return 0
  end
  local A = 0
  local AttrEffect = srcUser:GetProperty("AttrEffect")
  local bits=CommonFun.getBits(AttrEffect)
  if bits[CommonFun.AttrEffect.HideStrengthEffect]==1 then
    A = 100
  end

 return A
end

----------------------------------------------------------------------------------按技能等级恢复Hp
function CommonFun.calcBuff_2170(srcUser, targetUser, a, b, c, d,lv)
  if srcUser == nil or targetUser == nil then
      return 0
  end
  local MaxHp = targetUser:GetProperty("MaxHp")
  local skilllv_1 = srcUser:GetLernedSkillLevel(102010)
  local A = MaxHp*(a+skilllv_1*b)

  if A <= 1 then
    A = 1
  end
 return A
end

----------------------------------------------------------------------------------按技能等级恢复Sp
function CommonFun.calcBuff_2180(srcUser, targetUser, a, b, c, d,lv)
  if srcUser == nil or targetUser == nil then
      return 0
  end
  local MaxSp = targetUser:GetProperty("MaxSp")
  local skilllv_1 = srcUser:GetLernedSkillLevel(102000)
  local A = MaxSp*(a+skilllv_1*b)

  if A <= 1 then
    A = 1
  end

 return A
end

----------------------------------------------------------------------------------哥布灵首领卡片存储效果
function CommonFun.calcBuff_2190(srcUser, targetUser, a, b, c, d,lv, damage)
  if srcUser == nil or targetUser == nil then
      return 0
  end

  if damage <= 1 then
    return 1
  end

  local MaxHp = srcUser:GetProperty("MaxHp")
  local Hp = srcUser:GetProperty("Hp")
  local HpRatio = Hp / MaxHp

  if  CommonFun.IsInRate(50, srcUser:GetRandom())  and srcUser:HasBuffID(80000770) and HpRatio <=0.3 then
    return damage * 0.1
  else
    return damage * 0.05
  end


end

----------------------------------------------------------------------------------赤苍蝇卡片效果
function CommonFun.calcBuff_2200(srcUser, targetUser, a, b, c, d,lv,damage)
  if srcUser == nil or targetUser == nil then
      return 0
  end

  local MaxHp = srcUser:GetProperty("MaxHp")
  if damage <= 1 then
    return 1
  end

  if srcUser:HasBuffID(80000880) then
    return MaxHp * 0.03
  else
    return MaxHp * 0.02
  end


end

----------------------------------------------------------------------------------毕帝特飞龙[存储]
function CommonFun.calcBuff_2210(srcUser, targetUser, a, b, c, d,lv)
  if srcUser == nil or targetUser == nil then
      return 0
  end

  local MaxHp = srcUser:GetProperty("MaxHp")
  local MaxSp = srcUser:GetProperty("MaxSp")
  local MaxHpRatio = 0
  local MaxSpRatio = 0

  if MaxHp >=0 and MaxHp<2000 then
    MaxHpRatio = 0.01
  elseif MaxHp >=2000 and MaxHp<5000 then
    MaxHpRatio = 0.02
  elseif MaxHp >=5000 and MaxHp<10000 then
    MaxHpRatio = 0.03
  elseif MaxHp >=10000 and MaxHp<20000 then
    MaxHpRatio = 0.04
  elseif MaxHp >=20000 and MaxHp<50000 then
    MaxHpRatio = 0.05
  elseif MaxHp >=50000 and MaxHp<100000 then
    MaxHpRatio = 0.06
  else
    MaxHpRatio = 0.07
  end


  if MaxSp >=0 and MaxSp<200 then
    MaxSpRatio = 0.01
  elseif MaxSp >=200 and MaxSp<500 then
    MaxSpRatio = 0.02
  elseif MaxSp >=500 and MaxSp<1000 then
    MaxSpRatio = 0.03
  elseif MaxSp >=1000 and MaxSp<2000 then
    MaxSpRatio = 0.04
  elseif MaxSp >=2000 and MaxSp<5000 then
    MaxSpRatio = 0.05
  elseif MaxSp >=5000 and MaxSp<10000 then
    MaxSpRatio = 0.06
  else
    MaxSpRatio = 0.07
  end

  local A = MaxHpRatio + MaxSpRatio + b

  if A >=1 then
    A = 1
  end

  return A
end

----------------------------------------------------------------------------------兽人腐尸卡片[存储]
function CommonFun.calcBuff_2220(srcUser, targetUser, a, b, c, d,lv)
  if srcUser == nil or targetUser == nil then
    return 0
  end

  local targetRace =  targetUser.race

  if targetRace ==5 and srcUser:HasBuffID(50670) then
    return -0.2
  else
    return 0
  end
end

----------------------------------------------------------------------------------永恒戒指
function CommonFun.calcBuff_2230(srcUser, targetUser, a, b, c, d,lv)
  if srcUser == nil or targetUser == nil then
      return 0
  end
  local Ring1=srcUser:GetEquipedID(5)
  local RefineLv1=srcUser:GetEquipedRefineLv(5)
  local Ring2=srcUser:GetEquipedID(6)
  local RefineLv2=srcUser:GetEquipedRefineLv(6)

  local a = 0
  local b = 0

  if (Ring1==44008 or Ring1==144008) and RefineLv1>=10 then
      a = RefineLv1/100
  end
  if (Ring2==44008 or Ring2==144008) and RefineLv2>=10 then
      b = RefineLv2/100
  end

 local A = a + b

 return A
end

----------------------------------------------------------------------------------回血判断
function CommonFun.calcBuff_2240(srcUser, targetUser, a, b, c, d,lv)
--a HP百分比
--b SP百分比

  if srcUser == nil or targetUser == nil then
      return 0
  end

  local MaxHp = srcUser:GetProperty("MaxHp")
  local Hp = srcUser:GetProperty("Hp")
  local MaxSp = srcUser:GetProperty("MaxSp")
  local Sp = srcUser:GetProperty("Sp")
  local HpRatio = Hp / MaxHp
  local SpRatio = Sp / MaxSp

  if HpRatio <=a and srcUser:HasBuffID(80001440) and srcUser:HasBuffID(51251) then
    return 100
  else
    return 0
  end
end

----------------------------------------------------------------------------------生命药水投掷
function CommonFun.calcBuff_2250(srcUser, targetUser, a, b, c, d,lv)
  if srcUser == nil or targetUser == nil then
    return 0
  end
  local Vit = targetUser:GetProperty("Vit")
  local Int = srcUser:GetProperty("Int")
  local skilllv_1 = srcUser:GetLernedSkillLevel(419) ---知识药水
  local skilllv_2 = srcUser:GetLernedSkillLevel(423) ---生命药水投掷
  local rate1 = 1
  local rate2 = 1

  if skilllv_1>=1 then
      rate1 = 1 + 0.1 + 0.02*skilllv_1
  end

  if skilllv_2>=1 then
      rate2 = 1 + 0.1*skilllv_2
  end
----------------------------------------------------------------援护者皮靴
  local Weapon=srcUser:GetEquipedID(4)
  local rate3 = 1
    if (Weapon==43551 or Weapon==143551) then
      rate3=rate3+0.2
  end
----------------------------------------------------------------援护者皮靴升级
  if srcUser:HasBuffID(90001563) then
      rate3=rate3+0.2
  end
------------------------------------------------------[艾尔德之锤】]+[援护者皮靴]
  if srcUser:HasBuffID(91000130) then
      rate3=rate3+0.1
  end
------------------------------------------------------酸蚀之触 + 援护者皮靴
  if srcUser:HasBuffID(91000700) then
      rate3=rate3+0.1
  end

  local A = 400*(1+Vit*0.025)*(1+Int*0.005)*rate1*rate2*rate3

  return A

end

----------------------------------------------------------------------------------魔力药水投掷
function CommonFun.calcBuff_2260(srcUser, targetUser, a, b, c, d,lv)
  if srcUser == nil or targetUser == nil then
    return 0
  end
  local Int1 = targetUser:GetProperty("Int")
  local Int2 = srcUser:GetProperty("Int")
  local skilllv_1 = srcUser:GetLernedSkillLevel(419) ---知识药水
  local skilllv_2 = srcUser:GetLernedSkillLevel(424) ---魔力药水投掷
  local rate1 = 1
  local rate2 = 1

  if skilllv_1>=1 then
      rate1 = 1 + 0.1 + 0.02*skilllv_1
  end

  if skilllv_2>=1 then
      rate2 = 1 + skilllv_2
  end

----------------------------------------------------------------援护者皮靴
  local Weapon=srcUser:GetEquipedID(4)
  local rate3 = 1
  if (Weapon==43551 or Weapon==143551) then
      rate3=rate3+0.2
  end
----------------------------------------------------------------援护者皮靴升级
  if srcUser:HasBuffID(90001563) then
      rate3=rate3+0.2
  end
------------------------------------------------------[艾尔德之锤]+[援护者皮靴]
  if srcUser:HasBuffID(91000130) then
      rate3=rate3+0.1
  end
------------------------------------------------------酸蚀之触 + 援护者皮靴
  if srcUser:HasBuffID(91000700) then
      rate3=rate3+0.1
  end

  local A = 50*(1+Int1*0.015)*(1+Int2*0.0015)*rate1*rate2*rate3

  return A

end


----------------------------------------------------------------------------------银月魔女
function CommonFun.calcBuff_2270(srcUser, targetUser, a, b, c, d,lv)
  if srcUser == nil or targetUser == nil then
    return 0
  end

  local IgnoreDef = 0
  local IgnoreDef1 = srcUser:GetProperty("IgnoreDef")
  local IgnoreDef2 = srcUser:GetProperty("IgnoreEquipDef")
  if targetUser.boss or targetUser.mini then
     IgnoreDef=IgnoreDef1
  else
     IgnoreDef=(IgnoreDef1+IgnoreDef2)
  end

  if IgnoreDef >= 1 then
     IgnoreDef=1
  end

  local Def2 = targetUser:GetProperty("Def")
  local DefPer2 = targetUser:GetProperty("DefPer")
  local Vit2 = targetUser:GetProperty("Vit")
  local VitPer2 = targetUser:GetProperty("VitPer")
  local DamReduc2 = CommonFun.calcDamReDuc(srcUser, targetUser)
  local RefineDamReduc = targetUser:GetProperty("RefineDamReduc")
  local Sp = srcUser:GetProperty("Sp")
  local Luk = srcUser:GetProperty("Luk")

  ----------------------------物理防御减免
  local DefReduc= CommonFun.CalcDef(Def,Vit,srcUser,targetUser)

  local A = -(Sp*(1+Luk/100)*DefReduc*(1-RefineDamReduc)*(1-DamReduc2)-Vit2*(1+VitPer2))

  ------------------------------------------攻击年兽伤害为1
    if targetUser:GetNpcID() == 30043 or targetUser:GetNpcID() == 56008 or targetUser:GetNpcID() == 56009 or targetUser:GetNpcID() == 56010 or targetUser:GetNpcID() == 56011 or targetUser:GetNpcID() == 56012 or targetUser:GetNpcID() == 56013 then
        A = -1
    end
        --------------------------------------------不对每次受伤只掉1血的生效
    if targetUser:DamageAlways1() then
        A = -1
    end

  --print("A="..A,"Sp="..Sp,"Luk="..Luk)

  return A

end

----------------------------------------------------------------------------------生命通灵(生命体2)
function CommonFun.calcBuff_2280(srcUser, targetUser, a, b, c, d,lv)
  if srcUser == nil or targetUser == nil then
    return 0
  end
  local Atk = srcUser:GetProperty("Atk")
  local AtkPer = srcUser:GetProperty("AtkPer")
  local MAtk = srcUser:GetProperty("MAtk")
  local MAtkPer = srcUser:GetProperty("MAtkPer")
  local skilllv_1 = srcUser:GetLernedSkillLevel(417) ---生命通灵

  local A = Atk*(1+AtkPer+0.1+0.01*skilllv_1)*(0.1+skilllv_1*0.02)+MAtk*(1+MAtkPer+0.1+0.01*skilllv_1)*skilllv_1*0.01

  return A

end
----------------------------------------------------------------------------------生命通灵(生命体3)
function CommonFun.calcBuff_2290(srcUser, targetUser, a, b, c, d,lv)
  if srcUser == nil or targetUser == nil then
    return 0
  end
  local Atk = srcUser:GetProperty("Atk")
  local AtkPer = srcUser:GetProperty("AtkPer")
  local MAtk = srcUser:GetProperty("MAtk")
  local MAtkPer = srcUser:GetProperty("MAtkPer")
  local skilllv_1 = srcUser:GetLernedSkillLevel(417) ---生命通灵

  local A = Atk*(1+AtkPer+0.1+0.01*skilllv_1)*skilllv_1*0.01+MAtk*(1+MAtkPer+0.1+0.01*skilllv_1)*(0.1+skilllv_1*0.02)

  return A

end

----------------------------------------------------------------------------------超生命通灵(生命体2)
function CommonFun.calcBuff_2300(srcUser, targetUser, a, b, c, d,lv)
  if srcUser == nil or targetUser == nil then
    return 0
  end
  local Vit = srcUser:GetProperty("Vit")

  local skilllv_1 = srcUser:GetLernedSkillLevel(427) ---生命通灵
  skilllv_1 = math.min(skilllv_1,7)
  local A = Vit*(skilllv_1+2)

  return A

end

----------------------------------------------------------------------------------超生命通灵(生命体3)
function CommonFun.calcBuff_2310(srcUser, targetUser, a, b, c, d,lv)
  if srcUser == nil or targetUser == nil then
    return 0
  end
  local Vit = srcUser:GetProperty("Vit")

  local skilllv_1 = srcUser:GetLernedSkillLevel(427) ---生命通灵
  skilllv_1 = math.min(skilllv_1,5)
  local A = Vit*skilllv_1

  return A

end

----------------------------------------------------------------------------------化学铠甲保护
function CommonFun.calcBuff_2320(srcUser, targetUser, a, b, c, d,lv)
  if srcUser == nil or targetUser == nil then
    return 0
  end

  local skilllv_1 = srcUser:GetLernedSkillLevel(430) ---化学铠甲保护

  local A = 100*skilllv_1

  return A

end

----------------------------------------------------------------------------------巴尼米乐斯的祈福
function CommonFun.calcBuff_2330(srcUser, targetUser, a, b, c, d,lv)
  if srcUser == nil or targetUser == nil then
    return 0
  end

   local A = 0

   if  srcUser:IsBeingPresent(600030)==true then
       A = 20
   end

  return A

end

----------------------------------------------------------------------------------艾米斯可鲁的祈福
function CommonFun.calcBuff_2340(srcUser, targetUser, a, b, c, d,lv)
  if srcUser == nil or targetUser == nil then
    return 0
  end

   local A = 0

   if  srcUser:IsBeingPresent(600020)==true then
       A = 20
   end

  return A

end

----------------------------------------------------------------------------------智力转换
function CommonFun.calcBuff_2350(srcUser, targetUser, a, b, c, d,lv)
  if srcUser == nil or targetUser == nil then
    return 0
  end
   local Int = srcUser:GetProperty("Int")
   local Num = srcUser:GetRunePoint(130070)

   local A = 0.2*Num*Int

  return A

end

----------------------------------------------------------------------------------幸运转换
function CommonFun.calcBuff_2360(srcUser, targetUser, a, b, c, d,lv)
  if srcUser == nil or targetUser == nil then
    return 0
  end
   local Luk = srcUser:GetProperty("Luk")
   local Num = srcUser:GetRunePoint(130240)

   local A = 0.2*Num*Luk

  return A

end

----------------------------------------------------------------------------------化学头盔保护
function CommonFun.calcBuff_2370(srcUser, targetUser, a, b, c, d,lv)
  if srcUser == nil or targetUser == nil then
    return 0
  end

  local skilllv_1 = srcUser:GetLernedSkillLevel(433) ---化学头盔保护

  local A = 100*skilllv_1

  return A

end
----------------------------------------------------------------------------------化学副手保护
function CommonFun.calcBuff_2380(srcUser, targetUser, a, b, c, d,lv)
  if srcUser == nil or targetUser == nil then
    return 0
  end

  local skilllv_1 = srcUser:GetLernedSkillLevel(434) ---化学副手保护

  local A = 100*skilllv_1

  return A

end
----------------------------------------------------------------------------------生命体修复
function CommonFun.calcBuff_2390(srcUser, targetUser, a, b, c, d,lv)
  if srcUser == nil or targetUser == nil then
    return 0
  end

  local skilllv_1 = srcUser:GetLernedSkillLevel(435) ---化学副手保护
  local MaxHp = targetUser:GetProperty("MaxHp")

  local A = 0.02*skilllv_1*MaxHp

  return A

end
----------------------------------------------------------------------------------配药 生命药水投掷
function CommonFun.calcBuff_2400(srcUser, targetUser, a, b, c, d,lv)
  if srcUser == nil or targetUser == nil then
    return 0
  end

  local skilllv_1 = srcUser:GetLernedSkillLevel(423) ---生命药水投掷
  local A = 0

  if skilllv_1 >=1 then
     A = 0.04*skilllv_1+0.1
  end

  return A

end
----------------------------------------------------------------------------------饰品 拆卸
function CommonFun.calcBuff_2410(srcUser, targetUser, a, b, c, d,lv)
   if srcUser == nil or targetUser == nil then
      return 0
   end

   local skilllv_1 = srcUser:GetLernedSkillLevel(491) ---卸除饰品
   local skilllv_2 = srcUser:GetLernedSkillLevel(492) ---卸除双倍饰品
   local skilllv_3 = srcUser:GetLernedSkillLevel(493) ---卸除武器
   local Luk = srcUser:GetProperty("Luk")
   local Dex = srcUser:GetProperty("Dex")

   -----------------------------------------------------------------------------------破甲短锥卸除首饰
   local RefineLv=srcUser:GetEquipedRefineLv(7)
   local Weapon=srcUser:GetEquipedID(7)
   local pojia=0
   if (Weapon==40746 or Weapon==140746) then
    if (RefineLv>=5 and RefineLv<10 ) then
      pojia=5
      elseif (RefineLv>=10 and RefineLv<15 ) then
        pojia=10
      elseif RefineLv==15 then
          pojia=20
      end
    end
  -----------------------------------------------------------------------------------破甲短锥[第四档]卸除首饰
    if srcUser:HasBuffID(90001893) then
        if RefineLv > 5 then
         pojia=pojia + (RefineLv-5)* 1
        end
    end

-----------------------------------------------------------------------------------象牙匕首卸除首饰
   local Weapon_1=srcUser:GetEquipedID(7)
   local pojia_1=0
   if (Weapon_1==40743 or Weapon_1==140743) then
      pojia_1=3
    end

-----------------------------------------------------------------------------------象牙匕首精炼+8卸除盾牌
   local pojia_8=0
    if srcUser:HasBuffID(90001643) then
     if RefineLv>=8  then
      pojia_8=3
    end
  end

   local Rate = math.min(skilllv_1*3+skilllv_2*3+skilllv_3*3+pojia+pojia_1+pojia_8+(Luk+Dex)/5,90)

   if CommonFun.IsInRate(Rate, srcUser:GetRandom()) then---------------成功卸除的话，判断卸除部位
      local off5 = targetUser:IsEquipForceOff(5)
      local off6 = targetUser:IsEquipForceOff(6)
      local off7 = targetUser:IsEquipForceOff(7)
      local equiped5 = targetUser:GetEquipedID(5) ~= 0
      local equiped6 = targetUser:GetEquipedID(6) ~= 0
      local equiped7 = targetUser:GetEquipedID(7) ~= 0
      local skill2 = skilllv_2>0
      local skill3 = skilllv_3>0

      local odd = {1,1,0,0}
      if skill2 then
         odd[3] = 2
      end
      if skill3 then
         odd[4] = 2
      end
      if off5 or equiped5 == false then
         odd[1] = 0
      end
      if off6 or equiped6 == false then
         odd[2] = 0
      end
      if off7 or equiped7 == false then
         odd[4] = 0
      end
      if odd[1] == 0 or odd[2] == 0 then
         odd[3] = 0
      end

      local r = 100
      local c1, c2 = 0, 0
      for i, v in ipairs(odd) do
         if v == 2 then
            odd[i] = 30
            r = r - 30
            c2 = c2 + 1
         elseif v == 1 then
            c1 = c1 + 1
         end
      end

      if c1 > 0 then
         for i, v in ipairs(odd) do
            if v == 1 then
               odd[i] = r / c1
            end
         end
      elseif c2 > 0 then
         for i, v in ipairs(odd) do
            if v == 30 then
               odd[i] = 100 / c2
            end
         end
      end

      r = 0
      for i, v in ipairs(odd) do
         if v ~= 0 then
            r = r + v
            odd[i] = r
         end
      end

      local pos = {[1] = {w = odd[1], pos = 5}, [2] = {w = odd[2], pos = 6}, [3] = {w = odd[3], pos = 506}, [4] = {w = odd[4], pos = 7}}
      local random = srcUser:GetRandom()

      for k,v in ipairs(pos) do
         if v.w>=random then
            return v.pos
         end
      end

      return 0
   end

   return 0

end
--------------------------------------------------------------------------------饰品拆除 降低魔物攻击力
function CommonFun.calcBuff_2420(srcUser, targetUser, a, b, c, d,lv)
   if srcUser == nil or targetUser == nil then
      return 0
   end

   local n,m = 0,0

   if  targetUser:GetNpcID() == 0 then
        n = 1
   end

   if targetUser:GetNpcID() ~= 0 and targetUser.boss == false and targetUser.mini == false then
        m = 1
   end

   local A =a*n+b*m

   return A

end
--------------------------------------------------------------------------------野蛮凶砍  怪物
function CommonFun.calcBuff_2421(srcUser, targetUser, a, b, c, d,lv)
   if srcUser == nil or targetUser == nil then
      return 0
   end
   local m = 0

   if targetUser:GetNpcID() ~= 0 then
        m = 1
   end

   local A =a*m

   return A

end
----------------------------------------------------------------------------------盾牌 拆卸
function CommonFun.calcBuff_2430(srcUser, targetUser, a, b, c, d,lv)
   if srcUser == nil or targetUser == nil then
      return 0
   end

   local skilllv_1 = srcUser:GetLernedSkillLevel(494) ---卸除盾牌
   local skilllv_2 = srcUser:GetLernedSkillLevel(495) ---卸除靴子
   local skilllv_3 = srcUser:GetLernedSkillLevel(496) ---卸除头盔
   local skilllv_4 = srcUser:GetLernedSkillLevel(497) ---卸除铠甲
   local skilllv_5 = srcUser:GetLernedSkillLevel(498) ---双倍卸除防具

   local Luk = srcUser:GetProperty("Luk")
   local Dex = srcUser:GetProperty("Dex")
--------------------------------------------------------------破甲短锥卸除盾牌
   local RefineLv=srcUser:GetEquipedRefineLv(7)
   local Weapon=srcUser:GetEquipedID(7)
   local pojia=0
   if (Weapon==40746 or Weapon==140746) then
    if (RefineLv>=5 and RefineLv<10 ) then
      pojia=5
      elseif (RefineLv>=10 and RefineLv<15 ) then
        pojia=10
      elseif RefineLv==15 then
          pojia=20
      end
    end
  -----------------------------------------------------------------------------------破甲短锥[第四档]卸除盾牌
    if srcUser:HasBuffID(90001893) then
        if RefineLv > 5 then
         pojia=pojia + (RefineLv-5)* 1
        end
    end


    -----------------------------------------------------------------------------------象牙匕首卸除盾牌
   local Weapon_1=srcUser:GetEquipedID(7)
   local pojia_1=0
   if (Weapon_1==40743 or Weapon_1==140743) then
      pojia_1=3
    end
   -----------------------------------------------------------------------------------象牙匕首精炼+8卸除盾牌
   local pojia_8=0
    if srcUser:HasBuffID(90001643) then
     if RefineLv>=8  then
      pojia_8=3
    end
  end

   local Rate = math.min(skilllv_1*3+skilllv_2*3+skilllv_3*3+skilllv_4*3 + pojia + pojia_1 +pojia_8+ (Luk+Dex)/5,90)


   if CommonFun.IsInRate(Rate, srcUser:GetRandom()) then---------------成功卸除的话，判断卸除部位
      local skill2=skilllv_2>0
      local skill3=skilllv_3>0
      local skill4=skilllv_4>0
      local skill5=skilllv_5>0
      local off, equiped = {}, {}
      off[1], equiped[1] = targetUser:IsEquipForceOff(1), targetUser:GetEquipedID(1) ~= 0-----盾牌
      off[4], equiped[4] = targetUser:IsEquipForceOff(4), targetUser:GetEquipedID(4) ~= 0-----靴子
      off[8], equiped[8] = targetUser:IsEquipForceOff(8), targetUser:GetEquipedID(8) ~= 0-----头盔
      off[2], equiped[2] = targetUser:IsEquipForceOff(2), targetUser:GetEquipedID(2) ~= 0-----铠甲
      local result, rate = 0, 1

      for i = 1, 2 do
         local odd={1,0,0,0}
         local c1 = 1

         if off[1] or equiped[1] == false then
            odd[1] = 0
            c1 = c1 - 1
         end
         if skill2 and off[4]==false and equiped[4] then
            odd[2] = 1
            c1 = c1 + 1
         end
         if skill3 and off[8]==false and equiped[8] then
            odd[3] = 1
            c1 = c1 + 1
         end
         if skill4 and off[2]==false and equiped[2] then
            odd[4] = 1
            c1 = c1 + 1
         end


         local r = 0
         for k, v in ipairs(odd) do
            if v == 1 then
               r = 100 / c1 + r
               odd[k] = r
            end
         end

         local pos = {[1] = {w = odd[1], pos = 1}, [2] = {w = odd[2], pos = 4}, [3] = {w = odd[3], pos = 8}, [4] = {w = odd[4], pos = 2}}
         local random = srcUser:GetRandom()

         for k,v in ipairs(pos) do
            if v.w>=random then
               result = result + v.pos * rate
               rate = rate * 100
               off[v.pos] = true
               break
            end
         end

         -- 随机双倍
         if srcUser:GetRandom() > skilllv_5 * 10 then
            break
         end
      end

      return result
   end

   return 0

end

----------------------------------------------------------------------------------火烟瓶投掷  武器破坏
function CommonFun.calcBuff_2440(srcUser, targetUser, a, b, c, d,lv)
   if srcUser == nil or targetUser == nil then
      return 0
   end

   local Rate = 5 --------------------基础破坏率
   local skilllv_1 = srcUser:GetLernedSkillLevel(432)-------------化学武器破坏
   local skilllv_2 = srcUser:GetLernedSkillLevel(464)-------------化学盾牌破坏
   local Luk = srcUser:GetProperty("Luk")
   local Dex = srcUser:GetProperty("Dex")

   local effect =0
   if skilllv_1>0 and skilllv_1<=10 then
      effect = 10+5*skilllv_1
   elseif skilllv_1>10 then
      effect = 60 + (skilllv_1-10)*2
   end

   Rate = 5 + math.min(effect,(Luk+Dex)/5)/4
  ---------------------------------------------------------------------艾尔德提升基础率 +酸蚀之触
   local Weapon=srcUser:GetEquipedID(7)
   if (Weapon==41545 or Weapon==141545 or Weapon==41567 or Weapon==141567) then
     Rate = Rate + 5
   end

   local pos = 0

   if CommonFun.IsInRate(Rate, srcUser:GetRandom())  then
      pos = 7
      if skilllv_2>0 and CommonFun.IsInRate(skilllv_2*10, srcUser:GetRandom()) then
        pos =107
      end
   end

   return pos

end

----------------------------------------------------------------------------------武器破坏(怪物用)
function CommonFun.calcBuff_2441(srcUser, targetUser, a, b, c, d,lv)
   if srcUser == nil or targetUser == nil then
      return 0
   end

   local Rate = 20 --------------------基础破坏率
   local skilllv_1 = 10
   local skilllv_2 = 10
   local Luk = srcUser:GetProperty("Luk")
   local Dex = srcUser:GetProperty("Dex")

   if skilllv_1 >0 then
      Rate = 5 + math.min(10+5*skilllv_1,(Luk+Dex)/5)/4
   end
   local pos = 0

   if CommonFun.IsInRate(Rate, srcUser:GetRandom())  then
      pos = 7
      if skilllv_2>0 and CommonFun.IsInRate(skilllv_2*10, srcUser:GetRandom()) then
        pos =107
      end
   end

   return pos

end

----------------------------------------------------------------------------------铠甲破坏(怪物用)
function CommonFun.calcBuff_2442(srcUser, targetUser, a, b, c, d,lv)
   if srcUser == nil or targetUser == nil then
      return 0
   end

   local Rate = 20 --------------------基础破坏率
   local skilllv_1 = 10
   local skilllv_2 = 10
   local Luk = srcUser:GetProperty("Luk")
   local Dex = srcUser:GetProperty("Dex")

   if skilllv_1 >0 then
      Rate = 5 + math.min(10+5*skilllv_1,(Luk+Dex)/5)
   end
   local pos = 0

   if CommonFun.IsInRate(Rate, srcUser:GetRandom())  then
      pos = 2
      if skilllv_2>0 and CommonFun.IsInRate(skilllv_2*10, srcUser:GetRandom()) then
        pos =208
      end
   end

   return pos

end

--------------------------------------------------------------------------------强酸攻击  破坏铠甲
function CommonFun.calcBuff_2450(srcUser, targetUser, a, b, c, d,lv)
   if srcUser == nil or targetUser == nil then
      return 0
   end
   local skill = srcUser:GetLernedSkillLevel(411) ----------------强酸攻击
   local skilllv_1 = srcUser:GetLernedSkillLevel(432)-------------化学武器破坏
   local skilllv_2 = srcUser:GetLernedSkillLevel(463)-------------化学头盔破坏
   local Luk = srcUser:GetProperty("Luk")
   local Dex = srcUser:GetProperty("Dex")

   local Rate = skill
   local effect =0
   if skilllv_1>0 and skilllv_1<=10 then
      effect = 10+5*skilllv_1
   elseif skilllv_1>10 then
      effect = 60 + (skilllv_1-10)*2
   end

   Rate = skill + math.min(effect,(Luk+Dex)/5)
  ---------------------------------------------------------------------  艾尔德提升基础率 +酸蚀之触
  local Weapon=srcUser:GetEquipedID(7)
   if (Weapon==41545 or Weapon==141545 or Weapon==41567 or Weapon==141567) then
      Rate = Rate+5
   end

  local pos = 0

   if CommonFun.IsInRate(Rate, srcUser:GetRandom())  then
      pos = 2
      if skilllv_2>0 and CommonFun.IsInRate(skilllv_2*10, srcUser:GetRandom()) then
        pos =208
      end
   end

   return pos

end

--------------------------------------------------------------------------------强酸火烟瓶  破坏武器
function CommonFun.calcBuff_2460(srcUser, targetUser, a, b, c, d,lv)
   if srcUser == nil or targetUser == nil then
      return 0
   end
   local skill = srcUser:GetLernedSkillLevel(422) ----------------强酸火烟瓶
   local skilllv_1 = srcUser:GetLernedSkillLevel(432)-------------化学武器破坏
   local skilllv_2 = srcUser:GetLernedSkillLevel(464)-------------化学盾牌破坏
   local Luk = srcUser:GetProperty("Luk")
   local Dex = srcUser:GetProperty("Dex")

   local Rate = skill
   local effect =0
   if skilllv_1>0 and skilllv_1<=10 then
      effect = 10+5*skilllv_1
   elseif skilllv_1>10 then
      effect = 60 + (skilllv_1-10)*2
   end

   Rate = skill + math.min(effect,(Luk+Dex)/5)
---------------------------------------------------------------------艾尔德提升基础率 +酸蚀之触
  local Weapon=srcUser:GetEquipedID(7)
   if (Weapon==41545 or Weapon==141545 or Weapon==41567 or Weapon==141567) then
      Rate = Rate+5
    end

   local pos = 0

   if CommonFun.IsInRate(Rate, srcUser:GetRandom())  then
      pos = 7
      if skilllv_2>0 and CommonFun.IsInRate(skilllv_2*10, srcUser:GetRandom()) then
        pos =107
      end
   end

   return pos

end

--------------------------------------------------------------------------------强酸火烟瓶  破坏盔甲
function CommonFun.calcBuff_2470(srcUser, targetUser, a, b, c, d,lv)
   if srcUser == nil or targetUser == nil then
      return 0
   end
   local skill = srcUser:GetLernedSkillLevel(422) ----------------强酸火烟瓶
   local skilllv_1 = srcUser:GetLernedSkillLevel(432)-------------化学武器破坏
   local skilllv_2 = srcUser:GetLernedSkillLevel(463)-------------化学头盔破坏
   local Luk = srcUser:GetProperty("Luk")
   local Dex = srcUser:GetProperty("Dex")

   local Rate = skill
   local effect =0
   if skilllv_1>0 and skilllv_1<=10 then
      effect = 10+5*skilllv_1
   elseif skilllv_1>10 then
      effect = 60 + (skilllv_1-10)*2
   end

   Rate = skill + math.min(effect,(Luk+Dex)/5)
   ---------------------------------------------------------------------艾尔德提升基础率  +酸蚀之触
  local Weapon=srcUser:GetEquipedID(7)
   if (Weapon==41545 or Weapon==141545  or Weapon==41567 or Weapon==141567 ) then
      Rate = Rate+5
    end

   local pos = 0

   if CommonFun.IsInRate(Rate, srcUser:GetRandom())  then
      pos = 2
      if skilllv_2>0 and CommonFun.IsInRate(skilllv_2*10, srcUser:GetRandom()) then
        pos =208
      end
   end

   return pos

end

--------------------------------------------------------------------------------野蛮凶砍  破坏武器 铠甲
function CommonFun.calcBuff_2480(srcUser, targetUser, a, b, c, d,lv)
   if srcUser == nil or targetUser == nil then
      return 0
   end
   local skill = srcUser:GetLernedSkillLevel(217) ----------------野蛮凶砍

   local pos = 0
   local random1 = srcUser:GetRandom()
   local random2 = srcUser:GetRandom()

   if CommonFun.IsInRate(skill,random1) and CommonFun.IsInRate(skill*0.7,random2) then
      pos = 207
      if CommonFun.IsInRate(skill,random1) and CommonFun.IsInRate(skill*0.7,random2)==false then
        pos =7
      elseif CommonFun.IsInRate(skill,random1)==false and CommonFun.IsInRate(skill*0.7,random2) then
        pos =2
      end
   end

   return pos

end
--------------------------------------------------------------------------------隐匿强化
function CommonFun.calcBuff_2490(srcUser, targetUser, a, b, c, d,lv)
   if srcUser == nil or targetUser == nil then
      return 0
   end
   local skill = srcUser:GetLernedSkillLevel(467) ----------------隐匿强化
   ---------------------------星盘隐匿强化
   local Num1 = srcUser:GetRunePoint(90160)

   local A = skill*2 + 1 + Num1


   return A

end
--------------------------------------------------------------------------------潜击 伤害加成
function CommonFun.calcBuff_2500(srcUser, targetUser, a, b, c, d,lv)
   if srcUser == nil or targetUser == nil then
      return 0
   end
   local skill = srcUser:GetLernedSkillLevel(481) ----------------潜击
   ---------------------------星盘潜击
   local Num1 = srcUser:GetRunePoint(90070)

   local A = skill*0.01 + 0.1 + Num1*0.03

   return A

end
--------------------------------------------------------------------------------擒拿 霸邪 概率
function CommonFun.calcBuff_2510(srcUser, targetUser, a, b, c, d,lv)
   if srcUser == nil or targetUser == nil then
      return 0
   end
   local A = 0

   local Num1 = srcUser:GetRunePoint(90130)

   if Num1 > 0 then
        A = 100
   end

   return A

end
--------------------------------------------------------------------------------擒拿 霸邪 次数
function CommonFun.calcBuff_2520(srcUser, targetUser, a, b, c, d,lv)
   if srcUser == nil or targetUser == nil then
      return 0
   end

   local Num1 = srcUser:GetRunePoint(90130)

   local A = Num1*2

   return A

end
--------------------------------------------------------------------------------擒拿 霸邪 上限
function CommonFun.calcBuff_2530(srcUser, targetUser, a, b, c, d,lv)
   if srcUser == nil or targetUser == nil then
      return 0
   end

   local Num1 = srcUser:GetRunePoint(90130)

   local A = Num1*0.1

   return A

end
--------------------------------------------------------------------------------致命涂毒 巅峰等级
function CommonFun.calcBuff_2540(srcUser, targetUser, a, b, c, d,lv)
   if srcUser == nil or targetUser == nil then
      return 0
   end
   local skill = srcUser:GetLernedSkillLevel(198) ----------------致命涂毒
   local A = 0

   if skill>10 then
        A = 100
   end

   return A

end
--------------------------------------------------------------------------------伏击 背刺添加概率
function CommonFun.calcBuff_2550(srcUser, targetUser, a, b, c, d,lv)
   if srcUser == nil or targetUser == nil then
      return 0
   end
   local profressionID = srcUser:GetProfressionID()
   local A = 0

   if (profressionID==92 or profressionID==93 or profressionID==94)  then
        A = 100
   end

   return A

end
--------------------------------------------------------------------------------银月魔女猫  添加概率
function CommonFun.calcBuff_2560(srcUser, targetUser, a, b, c, d,lv)
   if srcUser == nil or targetUser == nil then
      return 0
   end

   local A = 100

   local AttrFunction = srcUser:GetProperty("AttrFunction")
   local bitfunc = CommonFun.getBits(AttrFunction)

    if (targetUser.boss or targetUser.mini or targetUser.changelinepunish) and targetUser.zoneType == 1 then
      if bitfunc[CommonFun.AttrFunction.JustInViceZone] == 1 then
        A = 0
      end
    end
    --------------------------------------------不对每次受伤只掉1血的生效
    if targetUser:DamageAlways1() then
        A = 0
    end

   return A

end
--------------------------------------------------------------------------------波利套装 添加概率
function CommonFun.calcBuff_2570(srcUser, targetUser, a, b, c, d,lv)
   if srcUser == nil or targetUser == nil then
      return 0
   end

   local A = 100

    if  targetUser:GetNpcID() == 0 or targetUser.boss or targetUser.mini then
        A = 0
    end

   return A

end

----------------------------------------------------------------------------------炼金铠甲_丽芙
function CommonFun.calcBuff_2580(srcUser, targetUser, a, b, c, d,lv)
  if srcUser == nil or targetUser == nil then
    return 0
  end

   local A = 0

   if  srcUser:IsBeingPresent(600010)==true then
       A = 4
   end
  return A

end

----------------------------------------------------------------------------------炼金铠甲_丽芙2
function CommonFun.calcBuff_2581(srcUser, targetUser, a, b, c, d,lv)
  if srcUser == nil or targetUser == nil then
    return 0
  end

   local A = 0

   if  srcUser:IsBeingPresent(600010)==true then
       A = 8
   end
  return A

end


----------------------------------------------------------------------------------炼金铠甲_艾米斯可鲁
function CommonFun.calcBuff_2590(srcUser, targetUser, a, b, c, d,lv)
  if srcUser == nil or targetUser == nil then
    return 0
  end

   local A = 0

   if  srcUser:IsBeingPresent(600020)==true then
       A = 0.04
   end

  return A

end

----------------------------------------------------------------------------------炼金铠甲_艾米斯可鲁2
function CommonFun.calcBuff_2591(srcUser, targetUser, a, b, c, d,lv)
  if srcUser == nil or targetUser == nil then
    return 0
  end

   local A = 0

   if  srcUser:IsBeingPresent(600020)==true then
       A = 0.08
   end

  return A

end

----------------------------------------------------------------------------------炼金铠甲_艾米斯可鲁3
function CommonFun.calcBuff_2592(srcUser, targetUser, a, b, c, d,lv)
  if srcUser == nil or targetUser == nil then
    return 0
  end

   local A = 0

   if  srcUser:IsBeingPresent(600020)==true then
       A = 100
   end

  return A

end

----------------------------------------------------------------------------------炼金铠甲_巴尼米乐斯
function CommonFun.calcBuff_2600(srcUser, targetUser, a, b, c, d,lv)
  if srcUser == nil or targetUser == nil then
    return 0
  end

   local A = 0

   if  srcUser:IsBeingPresent(600030)==true then
       A = 0.04
   end

  return A

end

----------------------------------------------------------------------------------炼金铠甲_巴尼米乐斯2
function CommonFun.calcBuff_2601(srcUser, targetUser, a, b, c, d,lv)
  if srcUser == nil or targetUser == nil then
    return 0
  end

   local A = 0

   if  srcUser:IsBeingPresent(600030)==true then
       A = 0.08
   end

  return A

end

----------------------------------------------------------------------------------芬特克的手环精炼时闪避转换物理攻击
function CommonFun.calcBuff_2610(srcUser, targetUser, a, b, c, d,lv)
  if srcUser == nil or targetUser == nil then
      return 0
  end
  local Flee = srcUser:GetProperty("Flee")
  local Weapon1=srcUser:GetEquipedID(1)
  local RefineLv=srcUser:GetEquipedRefineLv(1)
  local Profession=srcUser:GetProfressionID()
  local A = 0
  if (Weapon1==61512 or Weapon1==161512) then
    if (RefineLv>=10 and RefineLv<15) then
      A=Flee/10
      elseif RefineLv==15 then
      A=Flee/10+Flee/5
    end
  end
  if A <= 0 then
    return 0
  end
    return A
end

----------------------------------------------------------------------------------斯勒特手斧[第四档]

function CommonFun.calcBuff_2620(srcUser, targetUser, a, b, c, d,lv)
  if srcUser == nil or targetUser == nil then
      return 0
  end
  local Weapon1=srcUser:GetEquipedID(7)
  local RefineLv=srcUser:GetEquipedRefineLv(7)
  local A = 0

  if (Weapon1==41836 or Weapon1==141836)  then
      A = RefineLv/100
  end

 return A
end

----------------------------------------------------------------------------------名刀不知火[第四档]

function CommonFun.calcBuff_2630(srcUser, targetUser, a, b, c, d,lv)


  if srcUser == nil or targetUser == nil then
      return 0
  end
  local Ring=srcUser:GetEquipedID(7)
  local RefineLv=srcUser:GetEquipedRefineLv(7)
  local A = 0.05

  if (Ring==40322 or Ring==140322)  then
    if (RefineLv>=10 and RefineLv<15) then
      A=0.05+0.05
      elseif RefineLv==15 then
      A=0.05+0.05+0.05
    end
  end

 return A
end
----------------------------------------------------------------------------------兔子拖鞋[第四档]

function CommonFun.calcBuff_2640(srcUser, targetUser, a, b, c, d,lv)
  if srcUser == nil or targetUser == nil then
      return 0
  end
  local Ring=srcUser:GetEquipedID(4)
  local RefineLv=srcUser:GetEquipedRefineLv(4)
  local A =0

  if (Ring==43509 or Ring==143509)  then
    if (RefineLv>=10 and RefineLv<15) then
      A=0+0.05
      elseif RefineLv==15 then
      A=0+0.05+0.05
    end
  end

 return A
end

----------------------------------------------------------------------------------修尔特长矛[第四档]

function CommonFun.calcBuff_2650(srcUser, targetUser, a, b, c, d,lv)
  if srcUser == nil or targetUser == nil then
      return 0
  end
  local Ring=srcUser:GetEquipedID(7)
  local RefineLv=srcUser:GetEquipedRefineLv(7)
  local A =0.1

  if (Ring==40011 or Ring==140011)  then
    if (RefineLv>=10 and RefineLv<15) then
      A=0.1+0.1
      elseif RefineLv==15 then
      A=0.1+0.1+0.3
    end
  end

 return A
end

----------------------------------------------------------------------------------多芙斗篷[第四档]

function CommonFun.calcBuff_2660(srcUser, targetUser, a, b, c, d,lv)
  if srcUser == nil or targetUser == nil then
      return 0
  end
  local Ring=srcUser:GetEquipedID(3)
  local RefineLv=srcUser:GetEquipedRefineLv(3)
  local A =0

  if (Ring==43030 or Ring==143030)  then
    if (RefineLv>=10 and RefineLv<15) then
      A=0.05
      elseif RefineLv==15 then
      A=0.1
    end
  end

 return A
end

----------------------------------------------------------------------------------皇家之盾[第六档]

function CommonFun.calcBuff_2670(srcUser, targetUser, a, b, c, d,lv)
  if srcUser == nil or targetUser == nil then
      return 0
  end
  local Ring=srcUser:GetEquipedID(1)
  local RefineLv=srcUser:GetEquipedRefineLv(1)
  local A =10

  if (Ring==42513 or Ring==142513)  then
    if (RefineLv>=10 and RefineLv<15) then
      A=10+5
      elseif RefineLv==15 then
      A=10+5+10
    end
  end

 return A
end


----------------------------------------------------------------------------------沙漠之风[第四档]1

function CommonFun.calcBuff_2680(srcUser, targetUser, a, b, c, d,lv)
  if srcUser == nil or targetUser == nil then
      return 0
  end
  local Ring=srcUser:GetEquipedID(7)
  local RefineLv=srcUser:GetEquipedRefineLv(7)
  local A =0

  if (Ring==40723 or Ring==140723)  then
    if RefineLv>=10 then
      A=0+0.05
    end
  end

 return A
end

----------------------------------------------------------------------------------沙漠之风[第四档]2

function CommonFun.calcBuff_2690(srcUser, targetUser, a, b, c, d,lv)
  if srcUser == nil or targetUser == nil then
      return 0
  end
  local Ring=srcUser:GetEquipedID(7)
  local RefineLv=srcUser:GetEquipedRefineLv(7)
  local A =0

  if (Ring==40723 or Ring==140723)  then
    if RefineLv>=12 then
      A=0+0.1
    end
  end

 return A
end
----------------------------------------------------------------------------------荒漠风暴

function CommonFun.calcBuff_2691(srcUser, targetUser, a, b, c, d,lv)
  if srcUser == nil or targetUser == nil then
      return 0
  end
  local Ring=srcUser:GetEquipedID(7)
  local RefineLv=srcUser:GetEquipedRefineLv(7)
  local A =0

  if (Ring==40766 or Ring==140766)  then
    if RefineLv>=12 then
      A=0+0.1
    end
  end

 return A
end


----------------------------------------------------------------------------------代理者拳刃[第四档]

function CommonFun.calcBuff_2700(srcUser, targetUser, a, b, c, d,lv)
  if srcUser == nil or targetUser == nil then
      return 0
  end
  local Weapon1=srcUser:GetEquipedID(7)
  local RefineLv=srcUser:GetEquipedRefineLv(7)
  local A = 0

  if (Weapon1==40914 or Weapon1==140914)  then
      A = RefineLv/100
  end

 return A
end

----------------------------------------------------------------------------------献祭之书[第四档]
function CommonFun.calcBuff_2710(srcUser, targetUser, a, b, c, d,lv)
  if srcUser == nil or targetUser == nil then
      return 0
  end
  local Weapon1=srcUser:GetEquipedID(1)
  local IgnoreMDef = srcUser:GetProperty("IgnoreMDef")
  local A = 0
  if (Weapon1==42535 or Weapon1==142535)  then
      A = IgnoreMDef*100*0.5
  end

 return A
end


----------------------------------------------------------------------------------魔锤安魂曲[第四档]

function CommonFun.calcBuff_2720(srcUser, targetUser, a, b, c, d,lv)
  if srcUser == nil or targetUser == nil then
      return 0
  end
  local Ring=srcUser:GetEquipedID(7)
  local RefineLv=srcUser:GetEquipedRefineLv(7)
  local A =0

  if (Ring==41509 or Ring==141509)  then
    if (RefineLv>=5 and RefineLv<10) then
      A=0.03
      elseif (RefineLv>=10 and RefineLv<15) then
      A=0.08
      elseif RefineLv==15 then
      A=0.15
    end
  end

 return A
end

----------------------------------------------------------------------------------高等生存魔杖[第四档]1

function CommonFun.calcBuff_2730(srcUser, targetUser, a, b, c, d,lv)
  if srcUser == nil or targetUser == nil then
      return 0
  end
  local Ring=srcUser:GetEquipedID(7)
  local RefineLv=srcUser:GetEquipedRefineLv(7)
  local A =0

  if (Ring==40621 or Ring==140621)  then
    if (RefineLv>=5 and RefineLv<10) then
      A=0.05
      elseif (RefineLv>=10) then
      A=0.1
    end
  end

 return A
end

----------------------------------------------------------------------------------高等生存魔杖[第四档]2

function CommonFun.calcBuff_2740(srcUser, targetUser, a, b, c, d,lv)
  if srcUser == nil or targetUser == nil then
      return 0
  end
  local Ring=srcUser:GetEquipedID(7)
  local RefineLv=srcUser:GetEquipedRefineLv(7)
  local A =0

  if (Ring==40621 or Ring==140621)  then
    if (RefineLv==15) then
      A=0.05

    end
  end

 return A
end

----------------------------------------------------------------------------------深红闪电[第四档]1

function CommonFun.calcBuff_2750(srcUser, targetUser, a, b, c, d,lv)
  if srcUser == nil or targetUser == nil then
      return 0
  end
  local Ring=srcUser:GetEquipedID(7)
  local RefineLv=srcUser:GetEquipedRefineLv(7)
  local A =0

  if (Ring==41232 or Ring==141232)  then
    if (RefineLv>=10 and RefineLv<=15) then
      A=0.08
    end
  end

 return A
end

----------------------------------------------------------------------------------深红闪电[第四档]2

function CommonFun.calcBuff_2760(srcUser, targetUser, a, b, c, d,lv)
  if srcUser == nil or targetUser == nil then
      return 0
  end
  local Ring=srcUser:GetEquipedID(7)
  local RefineLv=srcUser:GetEquipedRefineLv(7)
  local A =0

  if (Ring==41232 or Ring==141232)  then
    if (RefineLv==15) then
      A=0.1

    end
  end

 return A
end


----------------------------------------------------------------------------------神射手之衣[第四档]

function CommonFun.calcBuff_2770(srcUser, targetUser, a, b, c, d,lv)

  if srcUser == nil or targetUser == nil then
      return 0
  end
  local Ring=srcUser:GetEquipedID(2)
  local RefineLv=srcUser:GetEquipedRefineLv(2)
  local A = 0.05

  if (Ring==42055 or Ring==142055)  then
   if (RefineLv>=5 and RefineLv<10) then
      A=0.05+0.03
      elseif (RefineLv>=10 and RefineLv<15) then
      A=0.05+0.08
      elseif RefineLv==15 then
      A=0.05+0.15
  end
 end
 return A
end
----------------------------------------------------------------------------------巨灵拳套[第四档]1

function CommonFun.calcBuff_2780(srcUser, targetUser, a, b, c, d,lv)
  if srcUser == nil or targetUser == nil then
      return 0
  end
  local Ring=srcUser:GetEquipedID(7)
  local RefineLv=srcUser:GetEquipedRefineLv(7)
  local A =24

  if (Ring==62509 or Ring==162509)  then
    if RefineLv>=5  then
      A=24+40
    end
  end

 return A
end

----------------------------------------------------------------------------------巨灵拳套[第四档]2

function CommonFun.calcBuff_2790(srcUser, targetUser, a, b, c, d,lv)
  if srcUser == nil or targetUser == nil then
      return 0
  end
  local Ring=srcUser:GetEquipedID(7)
  local RefineLv=srcUser:GetEquipedRefineLv(7)
  local A =0

  if (Ring==62509 or Ring==162509)  then
    if (RefineLv>=10 and RefineLv<=15) then
      A=200
    end
  end

 return A
end

----------------------------------------------------------------------------------巨灵拳套[第四档]3

function CommonFun.calcBuff_2800(srcUser, targetUser, a, b, c, d,lv)
  if srcUser == nil or targetUser == nil then
      return 0
  end
  local Ring=srcUser:GetEquipedID(7)
  local RefineLv=srcUser:GetEquipedRefineLv(7)
  local A =0

  if (Ring==62509 or Ring==162509)  then
    if RefineLv==15 then
      A=0.05
    end
  end

 return A
end

----------------------------------------------------------------------------------升龙拳套[第四档]

function CommonFun.calcBuff_2810(srcUser, targetUser, a, b, c, d,lv)
  if srcUser == nil or targetUser == nil then
      return 0
  end

  local A =30
  if srcUser:HasBuffID(90001513) and srcUser:HasBuffID(90001123) then
        A =60
  end

 return A
end


----------------------------------------------------------------------------------圣母圣像[第四档]

function CommonFun.calcBuff_2820(srcUser, targetUser, a, b, c, d,lv)

  if srcUser == nil or targetUser == nil then
      return 0
  end
  local Ring=srcUser:GetEquipedID(1)
  local RefineLv=srcUser:GetEquipedRefineLv(1)
  local A = 0

  if (Ring==60504 or Ring==160504)  then
   if (RefineLv>=5 and RefineLv<10) then
      A=0.05
      elseif (RefineLv>=10 and RefineLv<15) then
      A=0.05+0.05
      elseif RefineLv==15 then
      A=0.05+0.05+0.1
  end
 end
 return A
end


----------------------------------------------------------------------------------炼金合金装甲[第四档]

function CommonFun.calcBuff_2830(srcUser, targetUser, a, b, c, d,lv)

  if srcUser == nil or targetUser == nil then
      return 0
  end
  local Ring=srcUser:GetEquipedID(2)
  local RefineLv=srcUser:GetEquipedRefineLv(2)
  local A = 0

  if (Ring==42075 or Ring==142075)  then
   if (RefineLv>=5 and RefineLv<10) then
      A=0.02
      elseif RefineLv>=10  then
      A=0.02+0.03
  end
 end
 return A
end

----------------------------------------------------------------------------------考尔德短剑[第六档]

function CommonFun.calcBuff_2840(srcUser, targetUser, a, b, c, d,lv)
  if srcUser == nil or targetUser == nil then
      return 0
  end
  local Ring=srcUser:GetEquipedID(7)
  local RefineLv=srcUser:GetEquipedRefineLv(7)
  local A =0

  if (Ring==40742 or Ring==140742)  then
    if (RefineLv>=10 and RefineLv<15) then
      A=0.05
      elseif RefineLv==15 then
      A=0.05+0.1
    end
  end

 return A
end
----------------------------------------------------------------------------------黑曜石斗篷[第五档]
function CommonFun.calcBuff_2850(srcUser, targetUser, a, b, c, d,lv)
  if srcUser == nil or targetUser == nil then
      return 0
  end
  local Ring=srcUser:GetEquipedID(3)
  local RefineLv=srcUser:GetEquipedRefineLv(3)
  local A =a

  if (Ring==43028 or Ring==143028) and srcUser:HasBuffID(90001664) then
      A=RefineLv/100+a

  end

 return A
end


----------------------------------------------------------------------------------坚定魔法斗篷[第四档]
function CommonFun.calcBuff_2860(srcUser, targetUser, a, b, c, d,lv)
  if srcUser == nil or targetUser == nil then
      return 0
  end
  local Ring=srcUser:GetEquipedID(3)
  local RefineLv=srcUser:GetEquipedRefineLv(3)
  local A =0

  if (Ring==43032 or Ring==143032)  then
    if RefineLv>=10 then
      A=0.1
    end
  end

 return A
end

----------------------------------------------------------------------------------【速度激发】Lv.10
function CommonFun.calcBuff_2870(srcUser, targetUser, a, b, c, d,lv)
  if srcUser == nil or targetUser == nil then
      return 0
  end
local skilllv_1 = srcUser:GetLernedSkillLevel(210)
local A =210005
if skilllv_1 == 10 then
  A =210010
end

 return A
end

----------------------------------------------------------------------------------【圣十字攻击】Lv.10
function CommonFun.calcBuff_2880(srcUser, targetUser, a, b, c, d,lv)
  if srcUser == nil or targetUser == nil then
      return 0
  end
local skilllv_1 = srcUser:GetLernedSkillLevel(354)
local A =354005
if skilllv_1 == 10 then
  A =354010
end

 return A
end

----------------------------------------------------------------------------------【毒刃】Lv.10
function CommonFun.calcBuff_2890(srcUser, targetUser, a, b, c, d,lv)
  if srcUser == nil or targetUser == nil then
      return 0
  end
local skilllv_1 = srcUser:GetLernedSkillLevel(174)
local A =174005
if skilllv_1 == 10 then
  A =174010
end

 return A
end
----------------------------------------------------------------------------------炎灵护卫 添加概率
function CommonFun.calcBuff_2900(srcUser, targetUser, a, b, c, d,lv)
  if srcUser == nil or targetUser == nil then
      return 0
  end
  local MaxHp = srcUser:GetProperty("MaxHp")
  local Hp = srcUser:GetProperty("Hp")

  local A =100
  if Hp >= MaxHp*0.4 then
      A = 0
  end

 return A
end
----------------------------------------------------------------------------------炎灵守卫
function CommonFun.calcBuff_2910(srcUser, targetUser, a, b, c, d,lv)
  if srcUser == nil or targetUser == nil then
    return 0
  end

  local MaxHp = targetUser:GetProperty("MaxHp")
  local Hp = targetUser:GetProperty("Hp")

  local A = -(MaxHp*0.3+Hp*0.1)

  return A

end
----------------------------------------------------------------------------------独角兽
function CommonFun.calcBuff_2920(srcUser, targetUser, a, b, c, d,lv)
  if srcUser == nil or targetUser == nil then
    return 0
  end

  local Num1 = srcUser:GetBuffLayer(31561)
  local A = 75

  if Num1 >=1 and Num1 <=3 then
      A = 55
  elseif Num1 >3 and Num1 <=6 then
      A = 35
  elseif Num1 >6 then
      A = 15
  end

  return A

end
----------------------------------------------------------------------------------巅峰等级 天使之击
function CommonFun.calcBuff_2930(srcUser, targetUser, a, b, c, d,lv)
  if srcUser == nil or targetUser == nil then
    return 0
  end
  local skilllv_1 = srcUser:GetLernedSkillLevel(234)
  local Luk = targetUser:GetProperty("Luk")
  local A = 0

  if skilllv_1>10 then
    A = Luk/(23-skilllv_1)/100
  end

  return A

end
----------------------------------------------------------------------------------音乐 添加概率
function CommonFun.calcBuff_2940(srcUser, targetUser, a, b, c, d,lv)
  if srcUser == nil or targetUser == nil then
    return 0
  end

  local A = 0

  if targetUser:HasSubmitQuest(393310001) ==true then
    A = 100
  end

  return A

end
----------------------------------------------------------------------------------超生命通灵 添加概率
function CommonFun.calcBuff_2950(srcUser, targetUser, a, b, c, d,lv)
  if srcUser == nil or targetUser == nil then
    return 0
  end

  local A = 0
  local skilllv_1 = srcUser:GetLernedSkillLevel(427)
  if skilllv_1>5 then
    A = 100
  end

  return A

end
----------------------------------------------------------------------------------邪骨腕甲
function CommonFun.calcBuff_2960(srcUser, targetUser, a, b, c, d,lv)
  if srcUser == nil or targetUser == nil then
    return 0
  end

  local A =0
  if srcUser:HasBuffID(90001303) then
        A =0.05
  end

  return A

end
----------------------------------------------------------------------------------神器 虚空
function CommonFun.calcBuff_2970(srcUser, targetUser, a, b, c, d,lv)
  if srcUser == nil or targetUser == nil then
    return 0
  end

  local A =100
  if srcUser:HasBuffID(107090) or srcUser:HasBuffID(107094) then
        A =0
  end

  return A

end


----------------------------------------------------------------------------------年兽技能
function CommonFun.calcBuff_3000(srcUser, targetUser, a, b, c, d,lv)
  if srcUser == nil or targetUser == nil then
    return 0
  end

  local Skilllv = srcUser:GetLernedSkillLevel(103130)
  local QualityValue_a = 0
  local QualityValue_b = 0

  QualityValue_a = math.ceil(Skilllv/2)  --向上取整(技能等级为单数时增加)
  QualityValue_b = math.floor(Skilllv/2)  --向下取整(技能等级为双数时增加)

  if a == 1 then
  	return QualityValue_a
  elseif b == 1 then
  	return QualityValue_b
  else
  	return 0
  end
end
------------------------------------------------------------------------【需要增加素质抵抗的计算公式】--【言语沉默时间】
function CommonFun.calcBuff_3010(srcUser, targetUser, a, b, c, d,lv)
  if srcUser == nil or targetUser == nil then
      return 0
  end

	local Dex=srcUser:GetProperty("Dex")
	local Vit=targetUser:GetProperty("Vit")
	local Dex2=targetUser:GetProperty("Dex")
	local m = math.min(0.3,Dex*0.2/100)
	local n = math.min(1,(Vit*0.4+Dex2*0.4)/100)
	local Time = 1 + m - n
	if Time <= 0 then
	   Time = 0
	end

  local A= (lv*a+b)*Time

  if A <= 0 then
    return 0
  end

  return A
end
------------------------------------------------------------------------【需要增加素质抵抗的计算公式】--【新毒中毒概率】
function CommonFun.calcBuff_3020(srcUser, targetUser, a, b, c, d,lv)
  if srcUser == nil or targetUser == nil then
      return 0
  end
  local PoisonAtk = srcUser:GetProperty("PoisonAtk")
  local PoisonDef2 = targetUser:GetProperty("PoisonDef")
  local PoisonDam  = (1 + PoisonAtk - PoisonDef2)
  if PoisonDam <=0 then
     PoisonDam  =0
  end
  ---------------------------------------------------------------------异常状态的每个公式必加
  local StateAtk  = srcUser:GetProperty("StateAtk")
  local StateDef2 = targetUser:GetProperty("StateDef")
  local StateDam  = (1+StateAtk)*(1-StateDef2)
  if StateDam<=0 then
     StateDam =0
  end
  local skilllv_1 = srcUser:GetLernedSkillLevel(1101)-------剧毒武器
  local skilllv_2 = srcUser:GetLernedSkillLevel(1102)-------新毒研究

  local A= (5+skilllv_2)*PoisonDam*StateDam*CommonFun.calcAttrPoisonRate(srcUser, targetUser)

  if A <= 0 then
    return 0
  end
  return A
end
------------------------------------------------------------------------【需要增加素质抵抗的计算公式】--【新毒毒雾中毒概率】
function CommonFun.calcBuff_3021(srcUser, targetUser, a, b, c, d,lv)
  if srcUser == nil or targetUser == nil then
      return 0
  end
  local PoisonAtk = srcUser:GetProperty("PoisonAtk")
  local PoisonDef2 = targetUser:GetProperty("PoisonDef")
  local PoisonDam  = (1 + PoisonAtk - PoisonDef2)
  if PoisonDam <=0 then
     PoisonDam  =0
  end
  ---------------------------------------------------------------------异常状态的每个公式必加
  local StateAtk  = srcUser:GetProperty("StateAtk")
  local StateDef2 = targetUser:GetProperty("StateDef")
  local StateDam  = (1+StateAtk)*(1-StateDef2)
  if StateDam<=0 then
     StateDam =0
  end
  local skilllv_1 = srcUser:GetLernedSkillLevel(1103)-------毒雾
  local skilllv_2 = srcUser:GetLernedSkillLevel(1102)-------新毒研究

  skilllv_1 = math.min(skilllv_1,10)----毒雾巅峰不加概率

  local A= (10+skilllv_1*4+skilllv_2)*PoisonDam*StateDam*CommonFun.calcAttrPoisonRate(srcUser, targetUser)

  if A <= 0 then
    return 0
  end
  return A
end
------------------------------------------------------------------------【需要增加素质抵抗的计算公式】--【新毒持续时间】
function CommonFun.calcBuff_3030(srcUser, targetUser, a, b, c, d,lv)
  if srcUser == nil or targetUser == nil then
      return 0
  end
  local PoisonAtk = srcUser:GetProperty("PoisonAtk")
  local PoisonDef2 = targetUser:GetProperty("PoisonDef")
  local PoisonDam  = (1 + PoisonAtk - PoisonDef2)
  if PoisonDam <=0 then
     PoisonDam  =0
  end

  ---------------------------------------------------------------------异常状态的每个公式必加
  local StateAtk  = srcUser:GetProperty("StateAtk")
  local StateDef2 = targetUser:GetProperty("StateDef")
  local StateDam  = (1+StateAtk)*(1-StateDef2)
  if StateDam<=0 then
     StateDam =0
  end
  local skilllv_1 = srcUser:GetLernedSkillLevel(1101)-------剧毒武器
  local skilllv_2 = srcUser:GetLernedSkillLevel(1102)-------新毒研究
  local Num = srcUser:GetRunePoint(34060)

  local A= (10+skilllv_1+skilllv_2 +Num*2 )*PoisonDam*StateDam*CommonFun.calcAttrPoisonTime(srcUser, targetUser)

  if A <= 0 then
    return 0
  end
  return A
end

------------------------------------------------------------------------基因调节
function CommonFun.calcBuff_3040(srcUser, targetUser, a, b, c, d,lv)
  if srcUser == nil or targetUser == nil then
      return 0
  end

  local Vit=srcUser:GetProperty("Vit")
  local skilllv_1 = srcUser:GetLernedSkillLevel(1128)-------基因调节
  local Num = srcUser:GetRunePoint(134030)
    skillv_1=math.min(skilllv_1,10)
  local A= Vit*(skilllv_1*4 + Num*5)

  if A <= 0 then
    return 0
  end

  return A
end
--------------------------------------------------------------------------------嗜血渴望
function CommonFun.calcBuff_3050(srcUser, targetUser, a, b, c, d,lv)
   if srcUser == nil or targetUser == nil then
      return 0
   end
   local skilllv_1 = srcUser:GetLernedSkillLevel(1140)-------嗜血渴望
   local MaxHp = targetUser:GetProperty("MaxHp")
   local Hp = targetUser:GetProperty("Hp")

   local A =-skilllv_1/100*(1+MaxHp/Hp*0.05)*MaxHp

   if targetUser.boss == true and targetUser.mini == true then
        A = 0
   end

   return A

end
--------------------------------------------------------------------------------嗜血渴望 减速
function CommonFun.calcBuff_3051(srcUser, targetUser, a, b, c, d,lv)
   if srcUser == nil or targetUser == nil then
      return 0
   end
   local Num = srcUser:GetRunePoint(94010)
   local MaxHp = targetUser:GetProperty("MaxHp")
   local Hp = targetUser:GetProperty("Hp")
   local A = 0

   if Num>0 then
      A =-(Num*0.1+MaxHp/Hp*0.05)
   end

   if targetUser.boss == true and targetUser.mini == true then
        A = 0
   end

   return A

end
----------------------------------------------------------------------------------血腥骑士卡片
function CommonFun.calcBuff_3060(srcUser, targetUser, a, b, c, d,lv)
  if srcUser == nil or targetUser == nil then
      return 0
  end

  local A = 5

  --拥有苍白领主卡片概率额外附加
  if srcUser:HasBuffID(52430)  then
    A = 8
  end

  return A
end
--------------------------------------------------------------------------------陷阱对MINI MVP无效
function CommonFun.calcBuff_3070(srcUser, targetUser, a, b, c, d,lv)
   if srcUser == nil or targetUser == nil then
      return 0
   end

   local A = lv*a+b

   if targetUser:HasBuffID(160000) then
        A = 0
   end

   if targetUser.boss == true or targetUser.mini == true then
        A = 0
   end

   return A

end
--------------------------------------------------------------------------------圣音
function CommonFun.calcBuff_3080(srcUser, targetUser, a, b, c, d,lv)
     if srcUser == nil or targetUser == nil then
      return 0
   end
   local skilllv_1 = srcUser:GetLernedSkillLevel(1185)-------圣音
   local Vit = srcUser:GetProperty("Vit")
   local Num = srcUser:GetRunePoint(74070)
   local BeHealEncPer2 = targetUser:GetProperty("BeHealEncPer")
   local HealEncPer = srcUser:GetProperty("HealEncPer")
   local A=0
   if skilllv_1>0 and skilllv_1<=10 then
      A = skilllv_1*2*(100+Vit)*(1+HealEncPer)*(1+BeHealEncPer2)*(1+Num/10)
   elseif skilllv_1>10 then
      A = (20+skilllv_1)*(100+Vit)*(1+HealEncPer)*(1+BeHealEncPer2)*(1+Num/10)
   end
   return A


end
--------------------------------------------------------------------------------威望
function CommonFun.calcBuff_3090(srcUser, targetUser, a, b, c, d,lv)
   if srcUser == nil or targetUser == nil then
      return 0
   end
   local skilllv_1 = srcUser:GetLernedSkillLevel(1190)-------威望

   local A = skilllv_1*a

   return A

end
--------------------------------------------------------------------------------虎炮 减少SP
function CommonFun.calcBuff_3100(srcUser, targetUser, a, b, c, d,lv)
   if srcUser == nil or targetUser == nil then
      return 0
   end
   local skilllv_1 = srcUser:GetLernedSkillLevel(1202)-------虎炮
   local MaxSp = targetUser:GetProperty("MaxSp")
   local Num = srcUser:GetRunePoint(124010)
   local A =-(skilllv_1*3+Num*5)/100*MaxSp

   return A

end
----------------------------------------------------------------------------------点穴-愈
function CommonFun.calcBuff_3110(srcUser, targetUser, a, b, c, d,lv)
  if srcUser == nil or targetUser == nil then
    return 0
  end
  local Vit = targetUser:GetProperty("Vit")
  local Int = srcUser:GetProperty("Int")
  local skilllv_1 = srcUser:GetLernedSkillLevel(1204)-------点穴
  local BeHealEncPer2 = targetUser:GetProperty("BeHealEncPer")
  local HealEncPer = srcUser:GetProperty("HealEncPer")
  ------------------------------------------------星盘
  local Num = srcUser:GetRunePoint(124070)

  local A = 0
  if (skilllv_1>0 and skilllv_1<=5) then
     A= 100*(5+skilllv_1)*(1+Vit/100)*(1+Int/100)*(1+BeHealEncPer2)*(1+HealEncPer)*(1+Num*0.08)
  elseif (skilllv_1>5 and skilllv_1<=10) then
     A= 100*(10+skilllv_1*0.5)*(1+Vit/100)*(1+Int/100)*(1+BeHealEncPer2)*(1+HealEncPer)*(1+Num*0.08)
  end
  return A

end
----------------------------------------------------------------------------------大地扭曲（卸除武器）
function CommonFun.calcBuff_3120(srcUser, targetUser, a, b, c, d,lv)
   if srcUser == nil or targetUser == nil then
      return 0
   end

   return 7
end
----------------------------------------------------------------------------------大地扭曲（卸除头饰）
function CommonFun.calcBuff_3121(srcUser, targetUser, a, b, c, d,lv)
   if srcUser == nil or targetUser == nil then
      return 0
   end

   return 8
end
----------------------------------------------------------------------------------混乱恐慌（卸除坐骑）
function CommonFun.calcBuff_3122(srcUser, targetUser, a, b, c, d,lv)
   if srcUser == nil or targetUser == nil then
      return 0
   end

   return 13
end
----------------------------------------------------------------------------------白色监狱
function CommonFun.calcBuff_3130(srcUser, targetUser, a, b, c, d,lv)
   if srcUser == nil or targetUser == nil then
      return 0
   end
   local skilllv_1 = srcUser:GetLernedSkillLevel(1161)-------白色监狱
   local MaxHp = targetUser:GetProperty("MaxHp")

   local A = -MaxHp*(0.06+skilllv_1*0.02)

   return A
end
--------------------------------------------------------------------------------电击 减少SP
function CommonFun.calcBuff_3140(srcUser, targetUser, a, b, c, d,lv)
   if srcUser == nil or targetUser == nil then
      return 0
   end
   local skilllv_1 = srcUser:GetLernedSkillLevel(1247)-------电击
   local MaxSp = targetUser:GetProperty("MaxSp")

   local A =-skilllv_1/100*MaxSp

   return A

end
------------------------------------------------------------------------------卸除装备（怪物专用
function CommonFun.calcBuff_3150(srcUser, targetUser, a, b, c, d,lv)
   if srcUser == nil or targetUser == nil then
      return 0
   end

      local off1 = targetUser:IsEquipForceOff(1)
      local off2 = targetUser:IsEquipForceOff(2)
      local off3 = targetUser:IsEquipForceOff(3)
      local off4 = targetUser:IsEquipForceOff(4)
      local off5 = targetUser:IsEquipForceOff(5)
      local off6 = targetUser:IsEquipForceOff(6)
      local off7 = targetUser:IsEquipForceOff(7)
      local off8 = targetUser:IsEquipForceOff(8)
      local equiped1 = targetUser:GetEquipedID(1) ~= 0
      local equiped2 = targetUser:GetEquipedID(2) ~= 0
      local equiped3 = targetUser:GetEquipedID(3) ~= 0
      local equiped4 = targetUser:GetEquipedID(4) ~= 0
      local equiped5 = targetUser:GetEquipedID(5) ~= 0
      local equiped6 = targetUser:GetEquipedID(6) ~= 0
      local equiped7 = targetUser:GetEquipedID(7) ~= 0
      local equiped8 = targetUser:GetEquipedID(8) ~= 0
      local list = {}
      if off1 == false and equiped1 == true then
         table.insert(list,1)
      end
      if off2 == false and equiped2 == true then
         table.insert(list,2)
      end
      if off3 == false and equiped3 == true then
         table.insert(list,3)
      end
      if off4 == false and equiped4 == true then
         table.insert(list,4)
      end
      if off5 == false and equiped5 == true then
         table.insert(list,5)
      end
      if off6 == false and equiped6 == true then
         table.insert(list,6)
      end
      if off7 == false and equiped7 == true then
         table.insert(list,7)
      end
      if off8 == false and equiped8 == true then
         table.insert(list,8)
      end


      if #list <= 0 then
        return 0
      end
      local random = srcUser:GetRandom()
      return list[(random % #list) + 1]
end
------------------------------------------------------------------------------卸除装备（怪物专用
function CommonFun.calcBuff_3151(srcUser, targetUser, a, b, c, d,lv)
   if srcUser == nil or targetUser == nil then
      return 0
   end

      local off2 = targetUser:IsEquipForceOff(2)
      local off7 = targetUser:IsEquipForceOff(7)
      local equiped2 = targetUser:GetEquipedID(2) ~= 0
      local equiped7 = targetUser:GetEquipedID(7) ~= 0
      local list = {}
      if off2 == false and equiped2 == true then
         table.insert(list,2)
      end
      if off7 == false and equiped7 == true then
         table.insert(list,7)
      end

      if #list <= 0 then
        return 0
      end
      local random = srcUser:GetRandom()
      return list[(random % #list) + 1]
end
------------------------------------------------------------------------------卸除装备（怪物专用
function CommonFun.calcBuff_3152(srcUser, targetUser, a, b, c, d,lv)
   if srcUser == nil or targetUser == nil then
      return 0
   end

      local off2 = targetUser:IsEquipForceOff(2)
      local off4 = targetUser:IsEquipForceOff(4)
      local equiped2 = targetUser:GetEquipedID(2) ~= 0
      local equiped4 = targetUser:GetEquipedID(4) ~= 0
      local list = {}
      if off2 == false and equiped2 == true then
         table.insert(list,2)
      end
      if off4 == false and equiped4 == true then
         table.insert(list,4)
      end

      if #list <= 0 then
        return 0
      end
      local random = srcUser:GetRandom()
      return list[(random % #list) + 1]
end
--------------------------------------------------------------------------------驯龙术 无视体型伤害
function CommonFun.calcBuff_3160(srcUser, targetUser, a, b, c, d,lv)
   if srcUser == nil or targetUser == nil then
      return 0
   end
   local skilllv_1 = srcUser:GetLernedSkillLevel(1260)-------驯龙术
   local WeaponType =srcUser:GetEquipedWeaponType()

   local A =0

   if WeaponType==170 then
      A = skilllv_1*0.2
   end

   return A

end
--------------------------------------------------------------------------------附魔之刃
function CommonFun.calcBuff_3170(srcUser, targetUser, a, b, c, d,lv)
   if srcUser == nil or targetUser == nil then
      return 0
   end
   local skilllv_1 = srcUser:GetLernedSkillLevel(1263)-------附魔
   local MAtk = srcUser:GetProperty("MAtk")
   local MAtkPer = srcUser:GetProperty("MAtkPer")
   local Num = srcUser:GetRunePoint(14060)
   local A =MAtk*(1+MAtkPer)*skilllv_1*0.1*(1+Num/20)

   return A

end
--------------------------------------------------------------------------------孤注一掷
function CommonFun.calcBuff_3180(srcUser, targetUser, a, b, c, d,lv)
   if srcUser == nil or targetUser == nil then
      return 0
   end
   local skilllv_1 = srcUser:GetLernedSkillLevel(1264)-------孤注一掷
   local MDef2 = srcUser:GetProperty("MDef")
   local MDefPer2 = srcUser:GetProperty("MDefPer")
   skilllv_1 = math.min(skilllv_1,5)
   local A =MDef2*(1+MDefPer2)*skilllv_1*0.3

   --print("skilllv_1="..skilllv_1,"MDef2="..MDef2,"A="..A)

   return A

end
--------------------------------------------------------------------------------孤注一掷
function CommonFun.calcBuff_3181(srcUser, targetUser, a, b, c, d,lv)
   if srcUser == nil or targetUser == nil then
      return 0
   end
   local MDef2 = srcUser:GetProperty("MDef")
   local MDefPer2 = srcUser:GetProperty("MDefPer")
   local Num = srcUser:GetRunePoint(14070)

   local A = -(MDef2*(1+MDefPer2)*(1-Num/10))

   --print("MDef2="..MDef2,"A="..A)

   return A

end
--------------------------------------------------------------------------------符文石持续时间
function CommonFun.calcBuff_3190(srcUser, targetUser, a, b, c, d,lv)
   if srcUser == nil or targetUser == nil then
      return 0
   end
   local skilllv_1 = srcUser:GetLernedSkillLevel(1269)-------符文精通
   local Num = srcUser:GetRunePoint(14050)
   local A =a*(1+skilllv_1/10+Num/20)

   return A

end
--------------------------------------------------------------------------------圣灵降临
function CommonFun.calcBuff_3200(srcUser, targetUser, a, b, c, d,lv)
   if srcUser == nil or targetUser == nil then
      return 0
   end
   local MaxHp = targetUser:GetProperty("MaxHp")
   local MaxSp = targetUser:GetProperty("MaxSp")
   local skilllv_1 = srcUser:GetLernedSkillLevel(1222)-------圣灵降临
   skilllv_1 = math.min(skilllv_1,5)

   local A =MaxHp*(skilllv_1*0.005+0.015)*a + MaxSp*(skilllv_1*0.005+0.015)*b

   return A

end

--------------------------------------------------------------------------------狼突击 流血
function CommonFun.calcBuff_3210(srcUser, targetUser, a, b, c, d,lv)
   if srcUser == nil or targetUser == nil then
      return 0
   end
   local MaxHp = targetUser:GetProperty("MaxHp")

   local skilllv_1 = srcUser:GetLernedSkillLevel(1242)-------狼牙

   local A =-MaxHp*(skilllv_1/10+1)*0.005

   return A

end
--------------------------------------------------------------------------------磁场 对MINI MVP无效
function CommonFun.calcBuff_3220(srcUser, targetUser, a, b, c, d,lv)
   if srcUser == nil or targetUser == nil then
      return 0
   end
   --------------------------------------------------------------悬浮
   local AttrEffect= targetUser:GetProperty("AttrEffect2")
   local bits=CommonFun.getBits(AttrEffect)

   local A = 100

   if targetUser.boss == true or targetUser.mini == true or bits[CommonFun.AttrEffect2.Suspend]==1 then
        A = 0
   end

   return A

end
--------------------------------------------------------------------------------白色监狱
function CommonFun.calcBuff_3221(srcUser, targetUser, a, b, c, d,lv)
   if srcUser == nil or targetUser == nil then
      return 0
   end
   local Num = srcUser:GetRunePoint(24050)
   local MaxHp = targetUser:GetProperty("MaxHp")

   local A =-(Num*2/100*MaxHp)

   if targetUser.boss == true and targetUser.mini == true then
        A = 0
   end

   return A

end
--------------------------------------------------------------------------------飞行椅子 减少SP
function CommonFun.calcBuff_3222(srcUser, targetUser, a, b, c, d,lv)
   if srcUser == nil or targetUser == nil then
      return 0
   end

   local Sp = targetUser:GetProperty("Sp")

   local A =-Sp

   return A

end
--------------------------------------------------------------------------------贪得无厌
function CommonFun.calcBuff_3223(srcUser, targetUser, a, b, c, d,lv)
   if srcUser == nil or targetUser == nil then
      return 0
   end
   local TargetAppleNum = srcUser:GetAppleNum()

   local A =0

   if TargetAppleNum>5 then
      A = math.max(-0.95,- 0.05*(TargetAppleNum-5))
   end

   return A

end
---------------------------------------------------------------------星盘 技能相关的计算

function CommonFun.calcBuff_3250(srcUser, targetUser, a, b, c, d,lv)
   if srcUser == nil or targetUser == nil then
      return 0
   end

   local Num = srcUser:GetRunePoint(c)

   local A = lv*a + b + Num*d
   --print("lv="..lv,"a="..a,"b="..b,"c="..c,"Num="..Num,"A="..A)

  return A
end

---------------------------------------------------------------------独奏 属性 技能相关的计算
function CommonFun.calcBuff_3251(srcUser, targetUser, a, b, c, d,lv)
   if srcUser == nil or targetUser == nil then
      return 0
   end

   local Attr = srcUser:GetProperty(CommonFun.GetAttrName(c))

   local A = math.floor(Attr/a) + lv*b + d
   --print("lv="..lv,"a="..a,"b="..b,"c="..c,"Num="..Num,"A="..A)

  return A
end
---------------------------------------------------------------------合奏 属性 技能相关的计算
function CommonFun.calcBuff_3252(srcUser, targetUser, a, b, c, d,lv)
   if srcUser == nil or targetUser == nil then
      return 0
   end

   local Attr = srcUser:GetProperty(CommonFun.GetAttrName(c))

   local Ensemble = srcUser:GetEnsemblePartner()                  ----------获取伴奏者

   if Ensemble==nil then
      return 0
   end

   local Attr2 = Ensemble:GetProperty(CommonFun.GetAttrName(c))   ----------获取伴奏者属性

   local A = math.floor(Attr/a + Attr2/a) + lv*b + d
   --print("lv="..lv,"a="..a,"b="..b,"c="..c,"Num="..Num,"A="..A)

  return A
end
---------------------------------------------------------------------合奏   星盘  属性 技能相关的计算
function CommonFun.calcBuff_3253(srcUser, targetUser, a, b, c, d,lv)
   if srcUser == nil or targetUser == nil then
      return 0
   end

   local Num1 = srcUser:GetRunePoint(c)

   local Ensemble = srcUser:GetEnsemblePartner()                  ----------获取伴奏者

   if Ensemble==nil then
      return 0
   end

   local Num2 = Ensemble:GetRunePoint(c)                          ----------获取伴奏者 星盘点数

   local A = lv*a + b + (Num1+Num2)*d
   --print("lv="..lv,"a="..a,"b="..b,"c="..c,"Num="..Num,"A="..A)

  return A
end
------------------------------------------------------------------------------布莱奇之诗
function CommonFun.calcBuff_3254(srcUser, targetUser, a, b, c, d,lv)
   if srcUser == nil or targetUser == nil then
      return 0
   end

   local Int = srcUser:GetProperty("Int")
   local Num = srcUser:GetRunePoint(102034)

   local A = Int/300 + lv*0.1 + Num*0.05
   --print("lv="..lv,"a="..a,"b="..b,"c="..c,"Num="..Num,"A="..A)

  return A
end

------------------------------------------------------------------装备升级精炼+5、+10、+15[衣服通用]
function CommonFun.calcBuff_3300(srcUser, targetUser, a, b, c, d,lv)
  if srcUser == nil or targetUser == nil then
      return 0
  end
  local A = d
  local RefineLv=srcUser:GetEquipedRefineLv(2)

    if (RefineLv>=5 and RefineLv<10) then
        A = d + a
    elseif (RefineLv>=10 and RefineLv<15) then
        A = d + a + b
    elseif RefineLv ==15 then
        A = d + a + b + c
    end

  return A
end


------------------------------------------------------------------装备升级精炼+5、+10、+15[武器通用]

function CommonFun.calcBuff_3301(srcUser, targetUser, a, b, c, d,lv)
  if srcUser == nil or targetUser == nil then
      return 0
  end
  local A = d
  local RefineLv=srcUser:GetEquipedRefineLv(7)

    if (RefineLv>=5 and RefineLv<10) then
        A = d + a
    elseif (RefineLv>=10 and RefineLv<15) then
        A = d + a + b
    elseif RefineLv ==15 then
        A = d + a + b + c
    end

  return A
end


------------------------------------------------------------------装备升级精炼+5、+10、+15[鞋子通用]

function CommonFun.calcBuff_3302(srcUser, targetUser, a, b, c, d,lv)
  if srcUser == nil or targetUser == nil then
      return 0
  end
  local A = d
  local RefineLv=srcUser:GetEquipedRefineLv(4)

    if (RefineLv>=5 and RefineLv<10) then
        A = d + a
    elseif (RefineLv>=10 and RefineLv<15) then
        A = d + a + b
    elseif RefineLv ==15 then
        A = d + a + b + c
    end

  return A
end

------------------------------------------------------------------装备升级精炼+5、+10、+15[副手通用]

function CommonFun.calcBuff_3303(srcUser, targetUser, a, b, c, d,lv)
  if srcUser == nil or targetUser == nil then
      return 0
  end
  local A = d
  local RefineLv=srcUser:GetEquipedRefineLv(1)

    if (RefineLv>=5 and RefineLv<10) then
        A = d + a
    elseif (RefineLv>=10 and RefineLv<15) then
        A = d + a + b
    elseif RefineLv ==15 then
        A = d + a + b + c
    end

  return A
end

------------------------------------------------------------------装备升级精炼+5、+10、+15[披风通用]

function CommonFun.calcBuff_3304(srcUser, targetUser, a, b, c, d,lv)
  if srcUser == nil or targetUser == nil then
      return 0
  end
  local A = d
  local RefineLv=srcUser:GetEquipedRefineLv(3)

    if (RefineLv>=5 and RefineLv<10) then
        A = d + a
    elseif (RefineLv>=10 and RefineLv<15) then
        A = d + a + b
    elseif RefineLv ==15 then
        A = d + a + b + c
    end

  return A
end
----------------------------------------------------------------------------------衬衫[第七档]
function CommonFun.calcBuff_3310(srcUser, targetUser, a, b, c, d,lv)
  if srcUser == nil or targetUser == nil then
      return 0
  end
  local Flee = srcUser:GetProperty("Flee")
  local A =  math.floor(Flee/10*1)
  if A <= 0 then
    return 0
  end

 return A
end

---------------------------------------------------------------精炼+b以上，每精炼+1,属性+a，c固定值[3号位通用]
function CommonFun.calcBuff_3320(srcUser, targetUser, a, b, c, d,lv)
  if srcUser == nil or targetUser == nil then
      return 0
  end
  local RefineLv=srcUser:GetEquipedRefineLv(3)
  local A =c

  if RefineLv > b then
      A=(RefineLv-b)* a + A
  end

 return A
end

---------------------------------------------------------------精炼+b以上，每精炼+1,属性+a，c固定值[1号位通用]
function CommonFun.calcBuff_3321(srcUser, targetUser, a, b, c, d,lv)
  if srcUser == nil or targetUser == nil then
      return 0
  end
  local RefineLv=srcUser:GetEquipedRefineLv(1)
  local A =c

  if RefineLv > b then
      A=(RefineLv-b)* a + A
  end

 return A
end

---------------------------------------------------------------精炼+b以上，每精炼+1,属性+a，c固定值[7号位通用]
function CommonFun.calcBuff_3322(srcUser, targetUser, a, b, c, d,lv)
  if srcUser == nil or targetUser == nil then
      return 0
  end
  local RefineLv=srcUser:GetEquipedRefineLv(7)
  local A =c

  if RefineLv > b then
      A=(RefineLv-b)* a + A
  end

 return A
end

---------------------------------------------------------------精炼+b以上，每精炼+1,属性+a，c固定值[2号位通用]
function CommonFun.calcBuff_3323(srcUser, targetUser, a, b, c, d,lv)
  if srcUser == nil or targetUser == nil then
      return 0
  end
  local RefineLv=srcUser:GetEquipedRefineLv(2)
  local A =c

  if RefineLv > b then
      A=(RefineLv-b)* a + A
  end

 return A
end

---------------------------------------------------------------精炼+b以上，每精炼+1,属性+a，c固定值[4号位通用]
function CommonFun.calcBuff_3324(srcUser, targetUser, a, b, c, d,lv)
  if srcUser == nil or targetUser == nil then
      return 0
  end
  local RefineLv=srcUser:GetEquipedRefineLv(4)
  local A =c

  if RefineLv > b then
      A=(RefineLv-b)* a + A
  end

 return A
end

---------------------------------------------------------------迪斯凯特的软甲(6档)
function CommonFun.calcBuff_3325(srcUser, targetUser, a, b, c, d,lv)
  if srcUser == nil or targetUser == nil then
      return 0
  end
  local RefineLv=srcUser:GetEquipedRefineLv(2)
  local A =c

  if (RefineLv > b and srcUser:HasBuffID(90002255) )then
      A=(RefineLv-b)* a + A
  end

 return A
end



---------------------------------------------------------------高等布袋熊长靴[第四档]
function CommonFun.calcBuff_3330(srcUser, targetUser, a, b, c, d,lv)
  if srcUser == nil or targetUser == nil then
      return 0
  end
  local RefineLv=srcUser:GetEquipedRefineLv(4)
  local Agi = srcUser:GetProperty("Agi")
  local A =0
  if RefineLv >= 12 then
    if Agi >= 150 then
      A=0.05
    end
  end

 return A
end

---------------------------------------------------------------高等布袋熊长靴[第四档]
function CommonFun.calcBuff_3340(srcUser, targetUser, a, b, c, d,lv)
  if srcUser == nil or targetUser == nil then
      return 0
  end
  local RefineLv=srcUser:GetEquipedRefineLv(4)
  local Str = srcUser:GetProperty("Str")
  local Dex = srcUser:GetProperty("Dex")
  local A =0
  if RefineLv >= 0 then
    if (Str >= 225 or Dex >= 225) then
      A=0.03
    end
  end

 return A
end


----------------------------------------------------------------------------------强运项链
function CommonFun.calcBuff_3350(srcUser, targetUser, a, b, c, d,lv)
  if srcUser == nil or targetUser == nil then
      return 0
  end
  local Ring1=srcUser:GetEquipedID(5)
  local RefineLv1=srcUser:GetEquipedRefineLv(5)
  local Ring2=srcUser:GetEquipedID(6)
  local RefineLv2=srcUser:GetEquipedRefineLv(6)

  local a = 0
  local b = 0

  if (Ring1==44032 or Ring1==144032) and RefineLv1>=12 then
      a = 0.04
  end
  if (Ring2==44032 or Ring2==144032) and RefineLv2>=12 then
      b = 0.04
  end

 local A = a + b

 return A
end

----------------------------------------------------------------------------------强力戒指
function CommonFun.calcBuff_3360(srcUser, targetUser, a, b, c, d,lv)
  if srcUser == nil or targetUser == nil then
      return 0
  end
  local Ring1=srcUser:GetEquipedID(5)
  local RefineLv1=srcUser:GetEquipedRefineLv(5)
  local Ring2=srcUser:GetEquipedID(6)
  local RefineLv2=srcUser:GetEquipedRefineLv(6)

  local a = 0
  local b = 0

  if (Ring1==44029 or Ring1==144029) and RefineLv1>=12 then
      a = 0.03
  end
  if (Ring2==44029 or Ring2==144029) and RefineLv2>=12 then
      b = 0.03
  end

 local A = a + b

 return A
end

----------------------------------------------------------------------------------强体项链
function CommonFun.calcBuff_3370(srcUser, targetUser, a, b, c, d,lv)
  if srcUser == nil or targetUser == nil then
      return 0
  end
  local Ring1=srcUser:GetEquipedID(5)
  local RefineLv1=srcUser:GetEquipedRefineLv(5)
  local Ring2=srcUser:GetEquipedID(6)
  local RefineLv2=srcUser:GetEquipedRefineLv(6)

  local a = 0
  local b = 0

  if (Ring1==44031 or Ring1==144031) and RefineLv1>=12 then
      a = 0.03
  end
  if (Ring2==44031 or Ring2==144031) and RefineLv2>=12 then
      b = 0.03

  end

 local A = a + b

 return A
end

----------------------------------------------------------------------------------强敏别针
function CommonFun.calcBuff_3380(srcUser, targetUser, a, b, c, d,lv)
  if srcUser == nil or targetUser == nil then
      return 0
  end
  local Ring1=srcUser:GetEquipedID(5)
  local RefineLv1=srcUser:GetEquipedRefineLv(5)
  local Ring2=srcUser:GetEquipedID(6)
  local RefineLv2=srcUser:GetEquipedRefineLv(6)

  local a = 0
  local b = 0

  if (Ring1==44030 or Ring1==144030) and RefineLv1>=12 then
      a = 0.06
  end
  if (Ring2==44030 or Ring2==144030) and RefineLv2>=12 then
      b = 0.06
  end

 local A = a + b

 return A
end

----------------------------------------------------------------------------------犬牙手套
function CommonFun.calcBuff_3390(srcUser, targetUser, a, b, c, d,lv)
  if srcUser == nil or targetUser == nil then
      return 0
  end
  local Ring1=srcUser:GetEquipedID(5)
  local RefineLv1=srcUser:GetEquipedRefineLv(5)
  local Ring2=srcUser:GetEquipedID(6)
  local RefineLv2=srcUser:GetEquipedRefineLv(6)

  local a = 0
  local b = 0

  if (Ring1==44010 or Ring1==144010) and RefineLv1>=12 then
      a = 0.04
  end
  if (Ring2==44010 or Ring2==144010) and RefineLv2>=12 then
      b = 0.04
  end

 local A = a + b

 return A
end

----------------------------------------------------------------------------------永恒戒指1
function CommonFun.calcBuff_3400(srcUser, targetUser, a, b, c, d,lv)
  if srcUser == nil or targetUser == nil then
      return 0
  end
  local Ring1=srcUser:GetEquipedID(5)
  local RefineLv1=srcUser:GetEquipedRefineLv(5)
  local Ring2=srcUser:GetEquipedID(6)
  local RefineLv2=srcUser:GetEquipedRefineLv(6)

  local a = 0
  local b = 0

  if (Ring1==44008 or Ring1==144008) and RefineLv1>=12 then
      a = 0.05
        end
  if (Ring2==44008 or Ring2==144008) and RefineLv2>=12 then
      b = 0.05
  end

 local A = a + b

 return A
end

----------------------------------------------------------------------------------永恒戒指2
function CommonFun.calcBuff_3401(srcUser, targetUser, a, b, c, d,lv)
  if srcUser == nil or targetUser == nil then
      return 0
  end
  local Ring1=srcUser:GetEquipedID(5)
  local RefineLv1=srcUser:GetEquipedRefineLv(5)
  local Ring2=srcUser:GetEquipedID(6)
  local RefineLv2=srcUser:GetEquipedRefineLv(6)

  local a = 0
  local b = 0

  if (Ring1==44008 or Ring1==144008) and RefineLv1>=12 then
      a = -0.05
  end
  if (Ring2==44008 or Ring2==144008) and RefineLv2>=12 then
      b = -0.05
  end

 local A = a + b

 return A
end

----------------------------------------------------------------------------------大巫师之杖[第八档]
function CommonFun.calcBuff_3410(srcUser, targetUser, a, b, c, d,lv)
  if srcUser == nil or targetUser == nil then
      return 0
  end
  local RefineLv=srcUser:GetEquipedRefineLv(7)
  local A =0
  if RefineLv >= 12 then
          A=0.03
  end

 return A
end

----------------------------------------------------------------------------------水晶靴[第四档]
function CommonFun.calcBuff_3420(srcUser, targetUser, a, b, c, d,lv)
  if srcUser == nil or targetUser == nil then
      return 0
  end
  local RefineLv=srcUser:GetEquipedRefineLv(4)
  local A =0
  if RefineLv >= 12 then
          A=0.02
  end

 return A
end

----------------------------------------------------------------------------------红十字杖[1][第八档]
function CommonFun.calcBuff_3430(srcUser, targetUser, a, b, c, d,lv)
  if srcUser == nil or targetUser == nil then
      return 0
  end
  local RefineLv=srcUser:GetEquipedRefineLv(7)
  local A =0
  if RefineLv >= 13 then
          A=0.05
  end

 return A
end

----------------------------------------------------------------------------------红十字杖[1][第八档]
function CommonFun.calcBuff_3440(srcUser, targetUser, a, b, c, d,lv)
  if srcUser == nil or targetUser == nil then
      return 0
  end
  local RefineLv=srcUser:GetEquipedRefineLv(7)
  local A =0.05
  if RefineLv >= 13 then
        A=0.1 + A
  end

 return A
end

----------------------------------------------------------------------------------生机之杖
function CommonFun.calcBuff_3441(srcUser, targetUser, a, b, c, d,lv)
  if srcUser == nil or targetUser == nil then
      return 0
  end
  local RefineLv=srcUser:GetEquipedRefineLv(7)
  local A =0
  if RefineLv >= 13 then
          A=0.1
  end

 return A
end

----------------------------------------------------------------------------------神秘之弓[1][第八档]
function CommonFun.calcBuff_3450(srcUser, targetUser, a, b, c, d,lv)
  if srcUser == nil or targetUser == nil then
      return 0
  end
  local RefineLv=srcUser:GetEquipedRefineLv(7)
  local Dex=targetUser:GetProperty("Dex")
  local A =53
  if RefineLv == 15 then
      A =  math.floor(Dex/10)*4 + A
  end
  if A <= 0 then
    return 0
  end

 return A
end
----------------------------------------------------------------------------------神秘之弓[1][第八档]

function CommonFun.calcBuff_3451(srcUser, targetUser, a, b, c, d,lv)
  if srcUser == nil or targetUser == nil then
      return 0
  end
  local A = d
  local RefineLv=srcUser:GetEquipedRefineLv(7)

    if (RefineLv>=5 and RefineLv<10) then
        A = d + a
    elseif (RefineLv>=10 and RefineLv<15) then
        A = d + a + b
    elseif RefineLv ==15 then
        A = d + a + b + c
    end
  local Dex = srcUser:GetProperty("Dex")
    if Dex >= 240 then
      A= 0.02 + A
    end

  return A
end

----------------------------------------------------------------------------------追风者之弓
function CommonFun.calcBuff_3452(srcUser, targetUser, a, b, c, d,lv)
  if srcUser == nil or targetUser == nil then
      return 0
  end
  local RefineLv=srcUser:GetEquipedRefineLv(7)
  local Dex=targetUser:GetProperty("Dex")
  local A =0
  if RefineLv == 15 then
      A =  math.floor(Dex/10)*4 + A
  end
  if A <= 0 then
    return 0
  end

 return A
end


---------------------------------------------------------------鲜血斧[第四档]
function CommonFun.calcBuff_3460(srcUser, targetUser, a, b, c, d,lv)
  if srcUser == nil or targetUser == nil then
      return 0
  end
  local RefineLv=srcUser:GetEquipedRefineLv(7)
  local Str = srcUser:GetProperty("Str")
  local Dex = srcUser:GetProperty("Dex")
  local Luk = srcUser:GetProperty("Luk")
  local A =70
  if RefineLv >= 12 then
     A = A + math.floor(Str/10)*2+math.floor(Dex/10)*2+math.floor(Luk/10)*2
  end

 return A
end
---------------------------------------------------------------鲜血斧[第四档]
function CommonFun.calcBuff_3461(srcUser, targetUser, a, b, c, d,lv)
  if srcUser == nil or targetUser == nil then
      return 0
  end
  local RefineLv=srcUser:GetEquipedRefineLv(7)
  local Str = srcUser:GetProperty("Str")
  local Dex = srcUser:GetProperty("Dex")
  local Luk = srcUser:GetProperty("Luk")
  local A =70
  if RefineLv >= 10 then
     A = A + math.floor(Str/10)*2+math.floor(Dex/10)*2+math.floor(Luk/10)*2
  end

 return A
end



------------------------------------------------------------------神圣大驹短剑[第八档]

function CommonFun.calcBuff_3470(srcUser, targetUser, a, b, c, d,lv)
  if srcUser == nil or targetUser == nil then
      return 0
  end
  local A = 3
  local RefineLv=srcUser:GetEquipedRefineLv(7)

    if (srcUser:HasBuffID(90000617) and RefineLv>=10) then
        A = 3 + 2
      end

  return A
end

------------------------------------------------------------------神圣大驹短剑[第八档]

function CommonFun.calcBuff_3471(srcUser, targetUser, a, b, c, d,lv)
  if srcUser == nil or targetUser == nil then
      return 0
  end
  local A = 3
  local RefineLv=srcUser:GetEquipedRefineLv(7)

    if (srcUser:HasBuffID(41890) and RefineLv>=10) then
        A = 3 + 2
    end

  return A
end


--------------------------------------------------------------------神圣大驹短剑[第八档]
function CommonFun.calcBuff_3480(srcUser, targetUser, a, b, c, d,lv)
  if srcUser == nil or targetUser == nil then
      return 0
  end
  local RefineLv=srcUser:GetEquipedRefineLv(7)
  local Str=targetUser:GetProperty("Str")
  local A =0
  if RefineLv == 15 then
      A =  math.floor(Str/10)*4
  end
  if A <= 0 then
    return 0
  end

 return A
end

--------------------------------------------------------------------神圣大驹短剑[第八档]
function CommonFun.calcBuff_3481(srcUser, targetUser, a, b, c, d,lv)
  if srcUser == nil or targetUser == nil then
      return 0
  end

  local Str = srcUser:GetProperty("Str")
    if Str >= 240 then
      A= 0.03
    end

  return A
end


------------------------------------------------------------------皇家战甲

function CommonFun.calcBuff_3500(srcUser, targetUser, a, b, c, d,lv)
  if srcUser == nil or targetUser == nil then
      return 0
  end
  local A = 0
  local Ring1=srcUser:GetEquipedID(2)
  if ( Ring1==42077 or Ring1==142077)   then
      A = 100
  end

  return A
end


------------------------------------------------------------------驯龙者长枪【新】

function CommonFun.calcBuff_3490(srcUser, targetUser, a, b, c, d,lv)
  if srcUser == nil or targetUser == nil then
      return 0
  end
  local A = 0
  local RefineLv=srcUser:GetEquipedRefineLv(7)
  local Ring1=srcUser:GetEquipedID(7)
  if (( Ring1==40047 or Ring1==140047)  and RefineLv>=10 ) then
      A = 100
  end

  return A
end
------------------------------------------------------------------审判之锤

function CommonFun.calcBuff_3492(srcUser, targetUser, a, b, c, d,lv)
  if srcUser == nil or targetUser == nil then
      return 0
  end
  local A = 0
  local RefineLv=srcUser:GetEquipedRefineLv(7)
  local Ring1=srcUser:GetEquipedID(7)
  if (( Ring1==41526 or Ring1==141526)  and RefineLv>=10 and  srcUser:HasBuffID(90002041)  ) then
      A = 15
  end

  if (( Ring1==41565 or Ring1==141565)  and RefineLv>=10 ) then
      A = 15
  end

  return A
end



------------------------------------------------------------------巨龙咆哮

function CommonFun.calcBuff_3491(srcUser, targetUser, a, b, c, d,lv)
  if srcUser == nil or targetUser == nil then
      return 0
  end
  local A = 0
  local RefineLv=srcUser:GetEquipedRefineLv(7)
  local Ring1=srcUser:GetEquipedID(7)
  if (( Ring1==40057 or Ring1==140057)  and RefineLv>=10 ) then
      A = 100
  end

  return A
end

------------------------------------------------------------------领袖之风卡片【穿戴】

function CommonFun.calcBuff_3510(srcUser, targetUser, a, b, c, d,lv)
  if srcUser == nil or targetUser == nil then
      return 0
  end
  local A = 0
  if  srcUser:HasBuffID(52640)    then
      A = 0.08
  end

  return A
end

------------------------------------------------------------------领袖之风卡片【存储】

function CommonFun.calcBuff_3511(srcUser, targetUser, a, b, c, d,lv)
  if srcUser == nil or targetUser == nil then
      return 0
  end
  local A = 0
  if ( srcUser:HasBuffID(81000500)  and   srcUser:HasBuffID(52640) ) then
      A = 0.02
  end

  return A
end
------------------------------------------------------------------念力增幅卡片【穿戴】

function CommonFun.calcBuff_3520(srcUser, targetUser, a, b, c, d,lv)
  if srcUser == nil or targetUser == nil then
      return 0
  end
  local A = 0
  if  srcUser:HasBuffID(52650)    then
      A = 100
  end

  return A
end

-----------------------------------------------------------------------------------------------太阳头饰伤害公式
function CommonFun.calcBuff_3530(srcUser, targetUser, a, b, c, d,lv)
  local MaxHp = srcUser:GetProperty("MaxHp")
   local mapid,maptype = srcUser:GetMapInfo()-----------------获取所在地图

  if srcUser == nil or targetUser == nil then
      return 0
  end

  ----------------------------------------------------------竞技场最大生命除以4
  if maptype==2 or maptype==4 then
     MaxHp = MaxHp*0.25
  end

  local A = MaxHp*a
  -----------------------------------------------装备大嘴鸟卡片且存储伤害增加

    ------------------------------------------攻击年兽伤害为1
    if targetUser:GetNpcID() == 30043 or targetUser:GetNpcID() == 56008 or targetUser:GetNpcID() == 56009 or targetUser:GetNpcID() == 56010 or targetUser:GetNpcID() == 56011 or targetUser:GetNpcID() == 56012 or targetUser:GetNpcID() == 56013 then
        A = -1
    end
    --------------------------------------------不对每次受伤只掉1血的生效
    if targetUser:DamageAlways1() then
        A = -1
    end
  return A

end
-----------------------------------------------------------------------------------------------魔力陷阱伤害公式
function CommonFun.calcBuff_3540(srcUser, targetUser, a, b, c, d,lv)

local Str = srcUser:GetProperty("Str")
  local Dex = srcUser:GetProperty("Dex")
  local Luk = srcUser:GetProperty("Luk")
  local Atk = srcUser:GetProperty("Atk")
  local AtkPer = srcUser:GetProperty("AtkPer")
  local DamIncrease = srcUser:GetProperty("DamIncrease")
  local IgnoreDef  = 0
  local IgnoreDef1 = srcUser:GetProperty("IgnoreDef")
  local IgnoreDef2 = srcUser:GetProperty("IgnoreEquipDef")
  if targetUser.boss or targetUser.mini then
     IgnoreDef=IgnoreDef1
  else
     IgnoreDef=(IgnoreDef1+IgnoreDef2)
  end

  if IgnoreDef >= 1 then
     IgnoreDef  = 1
  end

  local Refine = srcUser:GetProperty("Refine")

  local Def2 = targetUser:GetProperty("Def")
  local DefPer2 = targetUser:GetProperty("DefPer")
  local Vit2 = targetUser:GetProperty("Vit")
  local VitPer2 = targetUser:GetProperty("VitPer")
  local DamReduc2 = CommonFun.calcDamReDuc(srcUser, targetUser)
  local RefineDamReduc = targetUser:GetProperty("RefineDamReduc")
  local Hp2 = targetUser:GetProperty("Hp")
  local MaxHp2 = targetUser:GetProperty("MaxHp")
  ------------------------------------------------------------------技能
  lv = math.min(lv,10) -----巅峰
  local damChangePer = 0.3*lv+3
  local damChangePer1 = 4*lv

  local AttrEffect= srcUser:GetProperty("AttrEffect")
  local bits=CommonFun.getBits(AttrEffect)
  ----------------------------------------------------------------------------种族伤害
    local raceparam = 1

    local srcRace = srcUser.race
    local targetRace = targetUser.race

    if nil == CommonFun.RaceProps[targetRace] then
        raceparam = 1
    end
    if nil == CommonFun.RaceProps[srcRace] then
        raceparam = 1
    end
    local raceInc = srcUser:GetProperty(CommonFun.RaceProps[targetRace][1])
    local raceRed = targetUser:GetProperty(CommonFun.RaceProps[srcRace][2])

    local raceparam =  (1+raceInc-raceRed)

    ------------------------------------------------------------------------竞技场额外增加30%种族减免
    local mapid,maptype = srcUser:GetMapInfo()-----------------获取所在地图

    if maptype==2 or maptype==4 then
      local B = raceRed - raceInc  ---------------种族伤害减免
      B = B < -1 and -1 or B > 1 and 1 or B
      B = math.floor(B*1000)/1000
      B = B + 0.3*(1-math.sin(B*3.14/2))
      --print("B2="..B)
      raceparam = 1 - B
    end

    if raceparam <= 0.1 then
       raceparam  = 0.1
    end
----------------------------------------------------------------------------------属性伤害
  local srcAtkElement = 5
  local targetDefElement = targetUser:GetProperty("DefAttr")
  local ElementRate = GameConfig.ElementRestrain[srcAtkElement][targetDefElement]

    if nil == CommonFun.NatureProps[srcAtkElement] or nil == CommonFun.NatureProps[targetDefElement] or nil == targetDefElement then
       return 0
    end

  local elementInc = srcUser:GetProperty(CommonFun.NatureProps[targetDefElement][1])
  local elementRed = targetUser:GetProperty(CommonFun.NatureProps[srcAtkElement][2])
  local elementAtk = srcUser:GetProperty(CommonFun.NatureProps[srcAtkElement][3])

  local elementparam = (1+elementInc)*ElementRate

  local elementparam2 = 1+elementAtk-elementRed

    ------------------------------------------------------------------------竞技场额外增加30%元素减免
    local mapid,maptype = srcUser:GetMapInfo()-----------------获取所在地图
    ------------------------maptype 1 :野外 2：pvp 3:其他普通副本 4:gvg
    if maptype==2 or maptype==4 then
      local B = elementRed - elementAtk  ---------------元素伤害减免
      B = B < -1 and -1 or B > 1 and 1 or B
      B = math.floor(B*1000)/1000
      B = B + 0.3*(1-math.sin(B*3.14/2))
      --print("B2="..B)
      elementparam2 = 1 - B
    end


    if elementparam2 <= 0.1 then
        elementparam2 = 0.1
    end

  local ele = elementparam*elementparam2
  --print("elementInc="..elementInc,"ElementRate="..ElementRate,"elementparam="..elementparam,"elementparam2="..elementparam2,"ele="..ele)
  if targetDefElement==nil or ElementRate==nil or elementInc==nil or elementRed==nil or elementAtk==nil then
      ele =1
  end

  local BaseAtk  = Str*2 + math.floor(Str*Str/100) + math.floor(Dex/5) + math.floor(Luk/5)
  local AtkFinal = ((Atk-BaseAtk)*(1+AtkPer)*CommonFun.ShapeCorrection(srcUser,targetUser)*ele+BaseAtk)*raceparam

  ----------------------------物理防御减免
  local DefReduc= CommonFun.CalcDef(Def,Vit,srcUser,targetUser)
  local Int2 = targetUser:GetProperty("Int")
  ---------------------------------星盘
  local Numxp= srcUser:GetRunePoint(94050)------------星盘点
  local RuneDamage = 1 + Numxp*0.1

  local A = -(((AtkFinal+Int2*damChangePer1)*DefReduc*(1-DamReduc2)+Refine)*damChangePer*(1-RefineDamReduc)*(1+DamIncrease)-Vit2*(1+VitPer2))*RuneDamage
-------------------------------------------------------------华丽短剑
      if bits[CommonFun.AttrEffect.Hualiduanjian]==1 then
           return A*1.5
      end
------------------------------------------------------------------------特殊处理
    local AttrFunction = srcUser:GetProperty("AttrFunction")
    local bitfunc = CommonFun.getBits(AttrFunction)

    if (targetUser.boss or targetUser.mini or targetUser.changelinepunish) and targetUser.zoneType == 1 then
      if bitfunc[CommonFun.AttrFunction.JustInViceZone] == 1 then
        A = 0
      end
    end

   ------------------------------------------攻击年兽伤害为1
    if targetUser:GetNpcID() == 30043 or targetUser:GetNpcID() == 56008 or targetUser:GetNpcID() == 56009 or targetUser:GetNpcID() == 56010 or targetUser:GetNpcID() == 56011 or targetUser:GetNpcID() == 56012 or targetUser:GetNpcID() == 56013 then
        A = -1
    end
    --------------------------------------------不对每次受伤只掉1血的生效
    if targetUser:DamageAlways1() then
        A = -1
    end

   return A
end
-----------------------------------------------------------------------------------------------毒雾伤害公式
function CommonFun.calcBuff_3541(srcUser, targetUser, a, b, c, d,lv)

local Str = srcUser:GetProperty("Str")
  local Dex = srcUser:GetProperty("Dex")
  local Luk = srcUser:GetProperty("Luk")
  local Atk = srcUser:GetProperty("Atk")
  local AtkPer = srcUser:GetProperty("AtkPer")
  local DamIncrease = srcUser:GetProperty("DamIncrease")
  local IgnoreDef  = 0
  local IgnoreDef1 = srcUser:GetProperty("IgnoreDef")
  local IgnoreDef2 = srcUser:GetProperty("IgnoreEquipDef")
  if targetUser.boss or targetUser.mini then
     IgnoreDef=IgnoreDef1
  else
     IgnoreDef=(IgnoreDef1+IgnoreDef2)
  end

  if IgnoreDef >= 1 then
     IgnoreDef  = 1
  end

  local Refine = srcUser:GetProperty("Refine")

  local Def2 = targetUser:GetProperty("Def")
  local DefPer2 = targetUser:GetProperty("DefPer")
  local Vit2 = targetUser:GetProperty("Vit")
  local VitPer2 = targetUser:GetProperty("VitPer")
  local DamReduc2 = CommonFun.calcDamReDuc(srcUser, targetUser)
  local RefineDamReduc = targetUser:GetProperty("RefineDamReduc")
  local Hp2 = targetUser:GetProperty("Hp")
  local MaxHp2 = targetUser:GetProperty("MaxHp")
  ------------------------------------------------------------------技能
  local damChangePer = 0.3*lv+1.3

  local AttrEffect= srcUser:GetProperty("AttrEffect")
  local bits=CommonFun.getBits(AttrEffect)
    ----------------------------------------------------------------------------种族伤害
    local raceparam = 1

    local srcRace = srcUser.race
    local targetRace = targetUser.race

    if nil == CommonFun.RaceProps[targetRace] then
        raceparam = 1
    end
    if nil == CommonFun.RaceProps[srcRace] then
        raceparam = 1
    end
    local raceInc = srcUser:GetProperty(CommonFun.RaceProps[targetRace][1])
    local raceRed = targetUser:GetProperty(CommonFun.RaceProps[srcRace][2])

    local raceparam =  (1+raceInc-raceRed)
    ------------------------------------------------------------------------竞技场额外增加30%种族减免
    local mapid,maptype = srcUser:GetMapInfo()-----------------获取所在地图

    if maptype==2 or maptype==4 then
      local B = raceRed - raceInc  ---------------种族伤害减免
      B = B < -1 and -1 or B > 1 and 1 or B
      B = math.floor(B*1000)/1000
      B = B + 0.3*(1-math.sin(B*3.14/2))
      --print("B2="..B)
      raceparam = 1 - B
    end

    if raceparam <= 0.1 then
       raceparam  = 0.1
    end
  ----------------------------------------------------------------------------------属性伤害
  local srcAtkElement = 10
  local targetDefElement = targetUser:GetProperty("DefAttr")
  local ElementRate = GameConfig.ElementRestrain[srcAtkElement][targetDefElement]
  -----------------------------------------------------------------------------------------星盘加成的毒属性对其他属性克制系数
  local NumXp1 = srcUser:GetRunePoint(31019)
  local NumXp2 = srcUser:GetRunePoint(31020)
  local RuneRate = (NumXp1 + NumXp2)*0.1

  ElementRate = ElementRate + RuneRate

  if nil == CommonFun.NatureProps[srcAtkElement] or nil == CommonFun.NatureProps[targetDefElement] or nil == targetDefElement then
       return 0
  end

  local elementInc = srcUser:GetProperty(CommonFun.NatureProps[targetDefElement][1])
  local elementRed = targetUser:GetProperty(CommonFun.NatureProps[srcAtkElement][2])
  local elementAtk = srcUser:GetProperty(CommonFun.NatureProps[srcAtkElement][3])

  local elementparam = (1+elementInc)*ElementRate

  local elementparam2 = 1+elementAtk-elementRed

    ------------------------------------------------------------------------竞技场额外增加30%元素减免
    local mapid,maptype = srcUser:GetMapInfo()-----------------获取所在地图
    ------------------------maptype 1 :野外 2：pvp 3:其他普通副本 4:gvg
    if maptype==2 or maptype==4 then
      local B = elementRed - elementAtk  ---------------元素伤害减免
      B = B < -1 and -1 or B > 1 and 1 or B
      B = math.floor(B*1000)/1000
      B = B + 0.3*(1-math.sin(B*3.14/2))
      --print("B2="..B)
      elementparam2 = 1 - B
    end


    if elementparam2 <= 0.1 then
        elementparam2 = 0.1
    end

  local ele = elementparam*elementparam2
  --print("elementInc="..elementInc,"ElementRate="..ElementRate,"elementparam="..elementparam,"elementparam2="..elementparam2,"ele="..ele)
  if targetDefElement==nil or ElementRate==nil or elementInc==nil or elementRed==nil or elementAtk==nil then
      ele =1
  end

  local BaseAtk  = Str*2 + math.floor(Str*Str/100) + math.floor(Dex/5) + math.floor(Luk/5)
  local AtkFinal = ((Atk-BaseAtk)*(1+AtkPer)*CommonFun.ShapeCorrection(srcUser,targetUser)*ele+BaseAtk)*raceparam

  ----------------------------物理防御减免
  local DefReduc= CommonFun.CalcDef(Def,Vit,srcUser,targetUser)

  local A = -((AtkFinal*DefReduc*(1-DamReduc2)+Refine)*damChangePer*(1-RefineDamReduc)*(1+DamIncrease)-Vit2*(1+VitPer2))
-------------------------------------------------------------华丽短剑
      if bits[CommonFun.AttrEffect.Hualiduanjian]==1 then
           return A*1.5
      end
------------------------------------------------------------------------特殊处理
    local AttrFunction = srcUser:GetProperty("AttrFunction")
    local bitfunc = CommonFun.getBits(AttrFunction)

    if (targetUser.boss or targetUser.mini or targetUser.changelinepunish) and targetUser.zoneType == 1 then
      if bitfunc[CommonFun.AttrFunction.JustInViceZone] == 1 then
        A = 0
      end
    end

   ------------------------------------------攻击年兽伤害为1
    if targetUser:GetNpcID() == 30043 or targetUser:GetNpcID() == 56008 or targetUser:GetNpcID() == 56009 or targetUser:GetNpcID() == 56010 or targetUser:GetNpcID() == 56011 or targetUser:GetNpcID() == 56012 or targetUser:GetNpcID() == 56013 then
        A = -1
    end
    --------------------------------------------不对每次受伤只掉1血的生效
    if targetUser:DamageAlways1() then
        A = -1
    end

   return A
end

---------------------------------------------------------------胜利飞燕
function CommonFun.calcBuff_3550(srcUser, targetUser, a, b, c, d,lv)
  if srcUser == nil or targetUser == nil then
      return 0
  end

  local Str = srcUser:GetProperty("Str")
  local Dex = srcUser:GetProperty("Dex")
  local A = a
  if (Str >= 200 or Dex >= 200) then
      A= a + b
  end

 return A
end

---------------------------------------------------------------闹哄哄的塔奥群卡
function CommonFun.calcBuff_3560(srcUser, targetUser, a, b, c, d,lv)
  if srcUser == nil or targetUser == nil then
      return 0
  end

  local Int = srcUser:GetProperty("Int")
  local A = a
  if (Int >= 200 ) then
      A= a + b
  end

 return A
end

---------------------------------------------------------------背包精炼
function CommonFun.calcBuff_3570(srcUser, targetUser, a, b, c, d,lv)
  if srcUser == nil or targetUser == nil then
      return 0
  end
  local RefineLv=srcUser:GetEquipedRefineLv(11)
  local A = a
  if RefineLv >= c then
     A= a + b
  end

 return A
end

---------------------------------------------------------------背包精炼
function CommonFun.calcBuff_3580(srcUser, targetUser, a, b, c, d,lv)
  if srcUser == nil or targetUser == nil then
      return 0
  end
  local RefineLv=srcUser:GetEquipedRefineLv(11)
  local A = a
  if RefineLv >= c then
     A= a + b * (RefineLv-c)
  end

 return A
end

---------------------------------------------------------------白蚁★卡片
function CommonFun.calcBuff_3590(srcUser, targetUser, a, b, c, d,lv)
  if srcUser == nil or targetUser == nil then
      return 0
  end

  local Str = srcUser:GetProperty("Str")
  local Dex = srcUser:GetProperty("Dex")
  local A = a
  if (Str >= 225 or Dex >= 225) then
      A= a + b
  end

 return A
end
------------------------------------------------------------------------【需要增加素质抵抗的计算公式】--【麻痹电流概率】
function CommonFun.calcBuff_3600(srcUser, targetUser, a, b, c, d,lv)
  if srcUser == nil or targetUser == nil then
      return 0
  end
  local skilllv_1 = srcUser:GetLernedSkillLevel(103180)
  local SlowAtk = srcUser:GetProperty("SlowAtk")
  local SlowDef2 = targetUser:GetProperty("SlowDef")
  local SlowDam  = (1 + SlowAtk - SlowDef2)
  if SlowDam <=0 then
     SlowDam  =0
  end

  ---------------------------------------------------------------------异常状态的每个公式必加
  local StateAtk  = srcUser:GetProperty("StateAtk")
  local StateDef2 = targetUser:GetProperty("StateDef")
  local StateDam  = (1+StateAtk)*(1-StateDef2)
  if StateDam<=0 then
     StateDam =0
  end

  local A= (skilllv_1*a+b)*SlowDam*StateDam*CommonFun.calcAttrSlowRate(srcUser, targetUser)

  if A <= 0 then
    return 0
  end
  return A
end
------------------------------------------------------------------------生命吸收 提高生命上限
function CommonFun.calcBuff_3610(srcUser, targetUser, a, b, c, d,lv)
  if srcUser == nil or targetUser == nil then
      return 0
  end

  local target_Hp=targetUser:GetProperty("Hp")
  local skilllv_1 = srcUser:GetLernedSkillLevel(1168)

  local A = -(math.min(target_Hp*(skilllv_1-5)*0.03,(skilllv_1-5)*10000))

  if (targetUser.boss or targetUser.mini) then----------------------对MVP　mini 无效
     A = 0
  end

 return A
end
----------------------------庇护
function CommonFun.calcBuff_3620(srcUser, targetUser, a, b, c, d,lv)
  if srcUser == nil or targetUser == nil then
      return 0
  end

  local skilllv_1 = srcUser:GetLernedSkillLevel(103680)-------庇护
  local A= skilllv_1*a+b

  if A <= 0 then
    return 0
  end

  return A
end
----------------------------冰焰
function CommonFun.calcBuff_3630(srcUser, targetUser, a, b, c, d,lv)
  if srcUser == nil or targetUser == nil then
      return 0
  end
  local FreezeAtk  = srcUser:GetProperty("FreezeAtk")
  local FreezeDef2 = targetUser:GetProperty("FreezeDef")
  local FreezeDam  = (1 + FreezeAtk - FreezeDef2)
  if FreezeDam <=0 then
     FreezeDam  =0
  end

  ---------------------------------------------------------------------异常状态的每个公式必加
  local StateAtk  = srcUser:GetProperty("StateAtk")
  local StateDef2 = targetUser:GetProperty("StateDef")
  local StateDam  = (1+StateAtk)*(1-StateDef2)
  if StateDam<=0 then
     StateDam =0
  end
  local skilllv_1 = srcUser:GetLernedSkillLevel(103700)-------冰焰
  local A= (skilllv_1*a+b)*FreezeDam*StateDam*CommonFun.calcAttrFreezeRate(srcUser, targetUser)

  if A <= 0 then
    return 0
  end

  return A
end


  ----------------------------黑焰
function CommonFun.calcBuff_3640(srcUser, targetUser, a, b, c, d,lv)
  if srcUser == nil or targetUser == nil then
      return 0
  end
  local BlindAtk = srcUser:GetProperty("BlindAtk")
  local BlindDef2 = targetUser:GetProperty("BlindDef")
  local BlindDam  = (1 + BlindAtk - BlindDef2)
  if BlindDam <=0 then
     BlindDam  =0
  end
  ---------------------------------------------------------------------异常状态的每个公式必加
  local StateAtk  = srcUser:GetProperty("StateAtk")
  local StateDef2 = targetUser:GetProperty("StateDef")
  local StateDam  = (1+StateAtk)*(1-StateDef2)
  if StateDam<=0 then
     StateDam =0
  end

  local skilllv_1 = srcUser:GetLernedSkillLevel(103710)-------黑焰
  local A= (skilllv_1*a+b)*BlindDam*StateDam*CommonFun.calcAttrBurnRate(srcUser, targetUser)

  if A <= 0 then
    return 0
  end
  return A
end
----------------------------基因调节按智力提升魔攻
function CommonFun.calcBuff_3650(srcUser, targetUser, a, b, c, d,lv)
  if srcUser == nil or targetUser == nil then
      return 0
  end

  local Int=srcUser:GetProperty("Int")
  local skilllv_1 = srcUser:GetLernedSkillLevel(1128)-------基因调节
 local A= math.floor(Int*(skilllv_1-10)*0.2)

  if A <= 0 then
    return 0
  end

  return A
end
----------------------------守护之盾提升物攻
function CommonFun.calcBuff_3660(srcUser, targetUser, a, b, c, d,lv)
  if srcUser == nil or targetUser == nil then
      return 0
  end

  local Def=srcUser:GetProperty("Def")
  local DefPer=srcUser:GetProperty("DefPer")
  local skilllv_1 = srcUser:GetLernedSkillLevel(1181)-------守护之盾
  local A= math.floor(Def*(1+DefPer)*(skilllv_1-10)*0.2/12)

  if A <= 0 then
    return 0
  end

  return A
end
----------------------------守护之盾提升魔攻
function CommonFun.calcBuff_3670(srcUser, targetUser, a, b, c, d,lv)
  if srcUser == nil or targetUser == nil then
      return 0
  end

  local MDef=srcUser:GetProperty("MDef")
  local MDefPer=srcUser:GetProperty("MDefPer")
  local skilllv_1 = srcUser:GetLernedSkillLevel(1181)-------守护之盾
  local A= math.floor(MDef*(1+MDefPer)*(skilllv_1-10)*0.2/6)

  if A <= 0 then
    return 0
  end

  return A
end
----------------------------自然守护提升魔法防御
function CommonFun.calcBuff_3680(srcUser, targetUser, a, b, c, d,lv)
  if srcUser == nil or targetUser == nil then
      return 0
  end

  local Int=srcUser:GetProperty("Int")
  local skilllv_1 = srcUser:GetLernedSkillLevel(1250)-------自然守护
  local A= math.floor(Int/(10*(11-skilllv_1)))/100

  if A <= 0 then
    return 0
  end

  return A
end
--------------------------------------------------------------------------------贤者 HP转换  损失HP
function CommonFun.calcBuff_3690(srcUser, targetUser, a, b, c, d,lv)
   if srcUser == nil or targetUser == nil then
      return 0
   end
   local skilllv_1 = srcUser:GetLernedSkillLevel(1317)-------Hp转换
   local Num = srcUser:GetRunePoint(83040)
   local MaxHp = srcUser:GetProperty("MaxHp")
   local MaxHpPer = srcUser:GetProperty("MaxHpPer")

   local A = -MaxHp*(1+MaxHpPer)*(skilllv_1*0.01-Num*0.01)

   if A > 0 then
       A = 0
   end

   return A

end
--------------------------------------------------------------------------------贤者 HP转换  SP获得
function CommonFun.calcBuff_3691(srcUser, targetUser, a, b, c, d,lv)
   if srcUser == nil or targetUser == nil then
      return 0
   end
   local skilllv_1 = srcUser:GetLernedSkillLevel(1317)-------Hp转换
   local MaxHp = srcUser:GetProperty("MaxHp")
   local MaxHpPer = srcUser:GetProperty("MaxHpPer")

   local mapid,maptype = srcUser:GetMapInfo()-----------------获取所在地图

  ----------------------------------------------------------竞技场最大生命除以4
   if maptype==2 or maptype==4 then
     MaxHp = MaxHp*0.25
   end

   local Num_hp = srcUser:GetRunePoint(82018)

   local A = MaxHp*(1+MaxHpPer)*skilllv_1*0.01*(1+Num_hp*0.1)

   return A

end
---------------------------------------------------------------蝴蝶结·琉璃
function CommonFun.calcBuff_3700(srcUser, targetUser, a, b, c, d,lv)
  if srcUser == nil or targetUser == nil then
      return 0
  end

  local MDamReduc = srcUser:GetProperty("MDamReduc")
  local A = math.floor(MDamReduc*100*75)

  if A <= 0 then
    return 0
  end

 return A
end

--------------------------------------------------------------------------------暖风
function CommonFun.calcBuff_3710(srcUser, targetUser, a, b, c, d,lv)
   if srcUser == nil or targetUser == nil then
      return 0
   end
   local skilllv_1 = srcUser:GetLernedSkillLevel(1325)-------暖风
   local MaxHp = targetUser:GetProperty("MaxHp")
   local MaxHpPer = targetUser:GetProperty("MaxHpPer")
   local skilllv_2 = srcUser:GetLernedSkillLevel(1333)-------召唤元素

   local BeHealEncPer2 = targetUser:GetProperty("BeHealEncPer")
   local HealEncPer = srcUser:GetProperty("HealEncPer")
   ------------------------火元素在场
   local Element = 0
   local ElementNpc = srcUser:getCurElementElfID()

   if ElementNpc==580010 then
        Element = 0.001*skilllv_2
   end

   local mapid,maptype = srcUser:GetMapInfo()-----------------获取所在地图

  ----------------------------------------------------------竞技场最大生命除以4
   if maptype==2 or maptype==4 then
     MaxHp = MaxHp*0.25
   end

   local A = MaxHp*(1+MaxHpPer)*(skilllv_1*0.004 + 0.008 + Element)*(1+BeHealEncPer2)*(1+HealEncPer)

   return A

end
--------------------------------------------------------------------------------元素生物buff持续时间
function CommonFun.calcBuff_3720(srcUser, targetUser, a, b, c, d,lv)
   if srcUser == nil or targetUser == nil then
      return 0
   end
   local skilllv_1 = srcUser:GetLernedSkillLevel(1334)-------元素交流

   local skilllv_2 = srcUser:GetLernedSkillLevel(1333)-------召唤元素

   local A = 50 + 10*skilllv_1 + 10*skilllv_2

   return A

end

------------------------------------------------------------------狼外婆卡片【存储】

function CommonFun.calcBuff_3730(srcUser, targetUser, a, b, c, d,lv)
  if srcUser == nil or targetUser == nil then
      return 0
  end
  local A = 0
  if (srcUser:HasBuffID(52880) ) then
      A = 0.05
  end

  return A
end
------------------------------------------------------------------噩梦（减少6围）
function CommonFun.calcBuff_3740(srcUser, targetUser, a, b, c, d,lv)
 if srcUser == nil or targetUser == nil then
      return 0
  end

  local Int=srcUser:GetProperty("Int")
  local A= -math.floor(Int/2)

  return A
end
------------------------------------------------------------------噩梦（减少6围）

function CommonFun.calcBuff_3741(srcUser, targetUser, a, b, c, d,lv)
 if srcUser == nil or targetUser == nil then
      return 0
  end


  local Str=srcUser:GetProperty("Str")
  local A= -math.floor(Str/2)

  return A
end------------------------------------------------------------------噩梦（减少6围）

function CommonFun.calcBuff_3742(srcUser, targetUser, a, b, c, d,lv)
 if srcUser == nil or targetUser == nil then
      return 0
  end

  local Dex=srcUser:GetProperty("Dex")
  local A= -math.floor(Dex/2)

  return A
end------------------------------------------------------------------噩梦（减少6围）

function CommonFun.calcBuff_3743(srcUser, targetUser, a, b, c, d,lv)
 if srcUser == nil or targetUser == nil then
      return 0
  end

  local Agi=srcUser:GetProperty("Agi")
  local A= -math.floor(Agi/2)

  return A
end------------------------------------------------------------------噩梦（减少6围）

function CommonFun.calcBuff_3744(srcUser, targetUser, a, b, c, d,lv)
 if srcUser == nil or targetUser == nil then
      return 0
  end

  local Vit=srcUser:GetProperty("Vit")
  local A= -math.floor(Vit/2)

  return A
end
------------------------------------------------------------------噩梦（减少6围）
function CommonFun.calcBuff_3745(srcUser, targetUser, a, b, c, d,lv)
 if srcUser == nil or targetUser == nil then
      return 0
  end

  local Luk=srcUser:GetProperty("Luk")
  local A= -math.floor(Luk/2)

  return A
end
----------------------------------------------------------------------------------强韧
function CommonFun.calcBuff_3750(srcUser, targetUser, a, b, c, d,lv)
  if srcUser == nil or targetUser == nil then
    return 0
  end

  local Skilllv = srcUser:GetLernedSkillLevel(103740)
  local QualityValue_a = 0
  local QualityValue_b = 0

  QualityValue_a = math.ceil(Skilllv/2)  --向上取整(技能等级为单数时增加)
  QualityValue_b = math.floor(Skilllv/2)  --向下取整(技能等级为双数时增加)

  if a == 1 then
    return QualityValue_a
  elseif b == 1 then
    return QualityValue_b
  else
    return 0
  end
end
-------------
---------------------------------------------------------------------星盘按技能等级计算

function CommonFun.calcBuff_3760(srcUser, targetUser, a, b, c, d,lv)
   if srcUser == nil or targetUser == nil then
      return 0
   end

   local Num = srcUser:GetRunePoint(c)

   local A = lv*a*Num
   --print("lv="..lv,"a="..a,"b="..b,"c="..c,"Num="..Num,"A="..A)

  return A
end
--------------------------------------------------------------------------------擒拿
function CommonFun.calcBuff_3770(srcUser, targetUser, a, b, c, d,lv)
   if srcUser == nil or targetUser == nil then
      return 0
   end
   local Num = srcUser:GetRunePoint(93030)
   local MaxHp = targetUser:GetProperty("MaxHp")

   local A =-(Num*0.5/100*MaxHp)

   if targetUser.boss == true and targetUser.mini == true then
        A = 0
   end

   return A

end
--------------------------------------------------------------------------------正义裁决
function CommonFun.calcBuff_3780(srcUser, targetUser, a, b, c, d,lv)
   if srcUser == nil or targetUser == nil then
      return 0
   end
   local Num = srcUser:GetRunePoint(13030)
   local Vit = targetUser:GetProperty("Vit")

   local A =Num*1/5*Vit


   return A

end
-------------------------------------------------------------------------------金刚不坏
function CommonFun.calcBuff_3790(srcUser, targetUser, a, b, c, d,lv)
   if srcUser == nil or targetUser == nil then
      return 0
   end
   local Num = srcUser:GetRunePoint(123010)


   local A =(1-Num)*lv*a+Num*10


   return A

end
-------------------------------------------------------------------------------攻防转换
function CommonFun.calcBuff_3800(srcUser, targetUser, a, b, c, d,lv)
   if srcUser == nil or targetUser == nil then
      return 0
   end
   local Num = srcUser:GetRunePoint(123030)
   local Atk = srcUser:GetProperty("Atk")
   local AtkPer = srcUser:GetProperty("AtkPer")

   local A = math.floor((Atk*(1+AtkPer)*0.2*Num)/50)


   return A

end
-------------------------------------------------------------------------------攻防转换
function CommonFun.calcBuff_3810(srcUser, targetUser, a, b, c, d,lv)
   if srcUser == nil or targetUser == nil then
      return 0
   end
   local skill = srcUser:GetLernedSkillLevel(192) ----------------隐匿强化
   ---------------------------星盘隐匿强化
   local Num1 = srcUser:GetRunePoint(33040)

   local A = skill*2 + 1 + Num1


   return A

end
--------------------------------------------------------------------------------循环自然之声
function CommonFun.calcBuff_3820(srcUser, targetUser, a, b, c, d,lv)
     if srcUser == nil or targetUser == nil then
      return 0
   end
   local skilllv_1 = srcUser:GetLernedSkillLevel(1391)-------循环自然之声（舞娘）
   local skilllv_2 = srcUser:GetLernedSkillLevel(1440)-------循环自然之声（诗人）
   local Vit = srcUser:GetProperty("Vit")
   local Int = srcUser:GetProperty("Int")
   local BeHealEncPer2 = targetUser:GetProperty("BeHealEncPer")
   local HealEncPer = srcUser:GetProperty("HealEncPer")
   local rune = 1

    if srcUser:HasBuffID(800013) then --------------------自然回声符文
      rune = 1.3
    end
   -----------------------------------------------------------诗人舞娘星盘
   local Num = srcUser:GetRunePoint(102045)

   local A = ((skilllv_1+skilllv_2)*3+20)*(Vit/2+Int)*(1+HealEncPer)*(1+BeHealEncPer2)*(1+Num*0.05)

   return A
end
----------------------------------------------------------------------------------丑陋之舞
function CommonFun.calcBuff_3830(srcUser, targetUser, a, b, c, d,lv)
  if srcUser == nil or targetUser == nil then
    return 0
  end

  local IgnoreDef = 0
  local IgnoreDef1 = srcUser:GetProperty("IgnoreDef")
  local IgnoreDef2 = srcUser:GetProperty("IgnoreEquipDef")
  if targetUser.boss or targetUser.mini then
     IgnoreDef=IgnoreDef1
  else
     IgnoreDef=(IgnoreDef1+IgnoreDef2)
  end

  if IgnoreDef >= 1 then
     IgnoreDef=1
  end

  local Def2 = targetUser:GetProperty("Def")
  local DefPer2 = targetUser:GetProperty("DefPer")
  local Vit2 = targetUser:GetProperty("Vit")
  local VitPer2 = targetUser:GetProperty("VitPer")
  local DamReduc2 = CommonFun.calcDamReDuc(srcUser, targetUser)
  local RefineDamReduc = targetUser:GetProperty("RefineDamReduc")
  local Sp = srcUser:GetProperty("Sp")

  local skilllv_1 = srcUser:GetLernedSkillLevel(1367)-----丑陋之舞
  ----------------------------物理防御减免
  local DefReduc= CommonFun.CalcDef(Def,Vit,srcUser,targetUser)

  local A = -(Sp*(skilllv_1+1)*DefReduc*(1-RefineDamReduc)*(1-DamReduc2)-Vit2*(1+VitPer2))

  ------------------------------------------攻击年兽伤害为1
    if targetUser:GetNpcID() == 30043 or targetUser:GetNpcID() == 56008 or targetUser:GetNpcID() == 56009 or targetUser:GetNpcID() == 56010 or targetUser:GetNpcID() == 56011 or targetUser:GetNpcID() == 56012 or targetUser:GetNpcID() == 56013 then
        A = -1
    end
        --------------------------------------------不对每次受伤只掉1血的生效
    if targetUser:DamageAlways1() then
        A = -1
    end

  --print("A="..A,"Sp="..Sp,"Luk="..Luk)

  return A

end
----------------------------------------------------------------------------------不和谐音
function CommonFun.calcBuff_3840(srcUser, targetUser, a, b, c, d,lv)
  if srcUser == nil or targetUser == nil then
    return 0
  end

  local IgnoreDef = 0
  local IgnoreDef1 = srcUser:GetProperty("IgnoreDef")
  local IgnoreDef2 = srcUser:GetProperty("IgnoreEquipDef")
  if targetUser.boss or targetUser.mini then
     IgnoreDef=IgnoreDef1
  else
     IgnoreDef=(IgnoreDef1+IgnoreDef2)
  end

  if IgnoreDef >= 1 then
     IgnoreDef=1
  end

  local Def2 = targetUser:GetProperty("Def")
  local DefPer2 = targetUser:GetProperty("DefPer")
  local Vit2 = targetUser:GetProperty("Vit")
  local VitPer2 = targetUser:GetProperty("VitPer")
  local DamReduc2 = CommonFun.calcDamReDuc(srcUser, targetUser)
  local RefineDamReduc = targetUser:GetProperty("RefineDamReduc")
  local Atk = srcUser:GetProperty("Atk")
  local AtkPer = srcUser:GetProperty("AtkPer")

  local skilllv_1 = srcUser:GetLernedSkillLevel(1418)-----不和谐音
  ----------------------------物理防御减免
  local DefReduc= CommonFun.CalcDef(Def,Vit,srcUser,targetUser)

  local A = -(Atk*(1+AtkPer)*(skilllv_1*1.2+1.2)*DefReduc*(1-RefineDamReduc)*(1-DamReduc2)-Vit2*(1+VitPer2))

  ------------------------------------------攻击年兽伤害为1
    if targetUser:GetNpcID() == 30043 or targetUser:GetNpcID() == 56008 or targetUser:GetNpcID() == 56009 or targetUser:GetNpcID() == 56010 or targetUser:GetNpcID() == 56011 or targetUser:GetNpcID() == 56012 or targetUser:GetNpcID() == 56013 then
        A = -1
    end
        --------------------------------------------不对每次受伤只掉1血的生效
    if targetUser:DamageAlways1() then
        A = -1
    end

  --print("A="..A,"Sp="..Sp,"Luk="..Luk)

  return A

end
---------------------------------------------------------------------      雷拉德的晨露  合奏 属性 技能相关的计算
function CommonFun.calcBuff_3850(srcUser, targetUser, a, b, c, d,lv)
   if srcUser == nil or targetUser == nil then
      return 0
   end

  local Ensemble = srcUser:GetEnsemblePartner()           ----------获取伴奏者

   if Ensemble==nil then
      return 0
   end

  local mapid,maptype = srcUser:GetMapInfo()-----------------获取所在地图

   local MaxHp1 = srcUser:GetProperty("MaxHp")
   local MaxHp2 = Ensemble:GetProperty("MaxHp")   ----------获取伴奏者属性
  ----------------------------------------------------------竞技场最大生命除以4
   local MaxHp = MaxHp1+MaxHp2

  if maptype==2 or maptype==4 then
     MaxHp = (MaxHp1+MaxHp2)*0.25
  end

   local A = 0

   if lv <=10 then
      A = MaxHp*0.05 + lv *400 + 1000
   elseif lv>10 then
      A = MaxHp*(0.05 + (lv-10)*0.01) + 5000
   end
   --print("lv="..lv,"a="..a,"b="..b,"c="..c,"Num="..Num,"A="..A)

  return A
end
---------------------------------------------------------------------      远古夕阳之歌  合奏 属性 技能相关的计算
function CommonFun.calcBuff_3860(srcUser, targetUser, a, b, c, d,lv)
   if srcUser == nil or targetUser == nil then
      return 0
   end

  local Ensemble = srcUser:GetEnsemblePartner()           ----------获取伴奏者

   if Ensemble==nil then
      return 0
   end

   local Atk1 = srcUser:GetProperty("Atk")
   local AtkPer1 = srcUser:GetProperty("AtkPer")
   local Atk2 = Ensemble:GetProperty("Atk")   ----------获取伴奏者属性
   local AtkPer2 = Ensemble:GetProperty("AtkPer")

   local Atk = Atk1*(1+AtkPer1)+Atk2*(1+AtkPer2)
   ------------------------------------------------------------------星盘
   local Num1 = srcUser:GetRunePoint(102049)
   local Num2 = Ensemble:GetRunePoint(102049)
   local Rune = (Num1+Num2)*0.02+1

   local A = 0

   if lv <=10 then
      A =  lv*15*Rune
   elseif lv>10 then
      A = (Atk*( (lv-10)*0.004 ) + 150)*Rune
   end

  return A
end
---------------------------------------------------------------------      远古夕阳之歌  合奏 属性 技能相关的计算
function CommonFun.calcBuff_3870(srcUser, targetUser, a, b, c, d,lv)
   if srcUser == nil or targetUser == nil then
      return 0
   end

  local Ensemble = srcUser:GetEnsemblePartner()           ----------获取伴奏者

   if Ensemble==nil then
      return 0
   end

   local MAtk1 = srcUser:GetProperty("MAtk")
   local MAtkPer1 = srcUser:GetProperty("MAtkPer")
   local MAtk2 = Ensemble:GetProperty("MAtk")   ----------获取伴奏者属性
   local MAtkPer2 = Ensemble:GetProperty("MAtkPer")

   local MAtk = MAtk1*(1+MAtkPer1)+MAtk2*(1+MAtkPer2)
   ------------------------------------------------------------------星盘
   local Num1 = srcUser:GetRunePoint(102048)
   local Num2 = Ensemble:GetRunePoint(102048)
   local Rune = (Num1+Num2)*0.02+1

   local A = 0

   if lv <=10 then
      A = lv*15*Rune
   elseif lv>10 then
      A = (MAtk*((lv-10)*0.004 ) + 150)*Rune
   end

  return A
end

----------------------------------------------------------------------------------命运的塔罗牌
function CommonFun.calcBuff_3880(srcUser, targetUser, a, b, c, d,lv)
--a HP百分比
--b SP百分比

  if srcUser == nil or targetUser == nil then
      return 0
  end

  local Hp = targetUser:GetProperty("Hp")

  local Sp = targetUser:GetProperty("Sp")

  local A = -(Hp*lv*a + Sp*lv*b)

    return A

end
----------------------------------------------------------------------------------安息 摇篮曲
function CommonFun.calcBuff_3890(srcUser, targetUser, a, b, c, d,lv)
--a HP百分比
--b SP百分比

  if srcUser == nil or targetUser == nil then
      return 0
  end

  local MaxHp = targetUser:GetProperty("MaxHp")

  local MaxSp = targetUser:GetProperty("MaxSp")

  local A = MaxHp*lv*a + MaxSp*lv*b

    return A

end
----------------------------------------------------------------------------------死亡轮回
function CommonFun.calcBuff_3900(srcUser, targetUser, a, b, c, d,lv)


  if srcUser == nil or targetUser == nil then
      return 0
  end
  local  HpPerRatio=1
   if Hp<0.8*MaxHp then
            HpPerRatio=2
   end
  local A = -0.5*HpPerRatio
    return A

end



---------------------------------------------------------------狼外婆的拖鞋
function CommonFun.calcBuff_4000(srcUser, targetUser, a, b, c, d,lv)
  if srcUser == nil or targetUser == nil then
      return 0
  end
  local RefineLv=srcUser:GetEquipedRefineLv(4)
  local A =0
  if RefineLv >= 12 and srcUser:HasBuffID(41561)  then
      A = 0.03
  end

 return A
end
---------------------------------------------------------------法力风暴之杖
function CommonFun.calcBuff_4010(srcUser, targetUser, a, b, c, d,lv)
  if srcUser == nil or targetUser == nil then
      return 0
  end
  local skilllv_1 = srcUser:GetLernedSkillLevel(1163)-------元素强化
  local RefineLv = srcUser:GetEquipedRefineLv(7)
  local A = math.min(0.1,skilllv_1 * 0.02)
  if RefineLv >=10 then
   A = A + (RefineLv-10) * 0.01
  end

   return A
end

---------------------------------------------------------------献祭之书[第八档]
function CommonFun.calcBuff_4020(srcUser, targetUser, a, b, c, d,lv)
  if srcUser == nil or targetUser == nil then
      return 0
  end
  local IgnoreMDef = srcUser:GetProperty("IgnoreMDef")
  local RefineLv=srcUser:GetEquipedRefineLv(1)
  local A = 0
  if RefineLv >= 10 and IgnoreMDef > 0.6 then
    A = 0.03
  end


   return A
end

---------------------------------------------------------------------贤者日记

function CommonFun.calcBuff_4030(srcUser, targetUser, a, b, c, d,lv)
   if srcUser == nil or targetUser == nil then
      return 0
   end

   local Num = srcUser:GetRunePoint(c)
   local RefineLv = srcUser:GetEquipedRefineLv(7)


   local A = lv*a + b + Num*d  + RefineLv*0.3
   --print("lv="..lv,"a="..a,"b="..b,"c="..c,"Num="..Num,"A="..A)

  return A
end

---------------------------------------------------------------------精神手杖

function CommonFun.calcBuff_4040(srcUser, targetUser, a, b, c, d,lv)
   if srcUser == nil or targetUser == nil then
      return 0
   end

   local Num = srcUser:GetRunePoint(c)
   local RefineLv = srcUser:GetEquipedRefineLv(7)
   local JS = 0
   if RefineLv == 15 and srcUser:HasBuffID(90002133) then
        JS = 0.05
   end


   local A = lv*a + b + Num*d  + JS
   --print("lv="..lv,"a="..a,"b="..b,"c="..c,"Num="..Num,"A="..A)

  return A
end

----------------------------------------------------------------------------------精神手杖[第八档]
function CommonFun.calcBuff_4050(srcUser, targetUser, a, b, c, d,lv)
  if srcUser == nil or targetUser == nil then
      return 0
  end
  local RefineLv=srcUser:GetEquipedRefineLv(7)
  local A =0
  if RefineLv >= 12 and srcUser:HasBuffID(90002137) then
          A=0.05
  end

 return A
end

----------------------------------------------------------------------------------贤者日记[第八档]
function CommonFun.calcBuff_4060(srcUser, targetUser, a, b, c, d,lv)
  if srcUser == nil or targetUser == nil then
      return 0
  end
  local RefineLv=srcUser:GetEquipedRefineLv(7)
  local A =0
  if RefineLv >= 12 and srcUser:HasBuffID(90002147) then
       A=0.05
  end

 return A
end
----------------------------------------------------------------------------------灵犀宝珠[第八档]

function CommonFun.calcBuff_4070(srcUser, targetUser, a, b, c, d,lv)
  if srcUser == nil or targetUser == nil then
      return 0
  end
  local RefineLv=srcUser:GetEquipedRefineLv(1)
  local A =0
  if RefineLv >= 10 and srcUser:HasBuffID(90002157) then
          A=0.05
  end

 return A
end

----------------------------------------------------------------------------------代理者拳刃[第八档]

function CommonFun.calcBuff_4080(srcUser, targetUser, a, b, c, d,lv)
  if srcUser == nil or targetUser == nil then
      return 0
  end
  local RefineLv=srcUser:GetEquipedRefineLv(7)
  local A =5
  if RefineLv >= 10 and srcUser:HasBuffID(90001333) then
        A=8
  end

 return A
end

----------------------------------------------------------------------------------暗杀者拳刃

function CommonFun.calcBuff_4081(srcUser, targetUser, a, b, c, d,lv)
  if srcUser == nil or targetUser == nil then
      return 0
  end
  local RefineLv=srcUser:GetEquipedRefineLv(7)
  local A =5
  if RefineLv >= 10 and srcUser:HasBuffID(41870) then
        A =8
  end

 return A
end

----------------------------------------------------------------------------------牙科手术刀[第二档]

function CommonFun.calcBuff_4090(srcUser, targetUser, a, b, c, d,lv)
  if srcUser == nil or targetUser == nil then
      return 0
  end
  local Str=srcUser:GetProperty("Str")
  local A =0
  if  srcUser:HasBuffID(90002161) then
    if  Str>=240 then
        A=0.08
    elseif  Str>=200 then
        A=0.03
    end
  end

 return A
end

----------------------------------------------------------------------------------巨人战斧[1][第十档]

function CommonFun.calcBuff_4100(srcUser, targetUser, a, b, c, d,lv)
  if srcUser == nil or targetUser == nil then
      return 0
  end
  local Str=srcUser:GetProperty("Str")
  local A =0
  if  srcUser:HasBuffID(90000909) and Str>=240 then
        A=0.1
  end

 return A
end
----------------------------------------------------------------------------------超重双手斧[第四档]

function CommonFun.calcBuff_4110(srcUser, targetUser, a, b, c, d,lv)
  if srcUser == nil or targetUser == nil then
      return 0
  end
  local Str=srcUser:GetProperty("Str")
  local A =0
  if  srcUser:HasBuffID(90002173) then
    if  Str>=240 then
        A=0.15
    elseif  Str>=210 then
        A=0.08
    elseif  Str>=180 then
        A=0.03
    end
  end

 return A
end

----------------------------------------------------------------------------------超重双手斧[第四档]

function CommonFun.calcBuff_4120(srcUser, targetUser, a, b, c, d,lv)
  if srcUser == nil or targetUser == nil then
      return 0
  end
  local Str=srcUser:GetProperty("Str")
  local A =0.05
  if  srcUser:HasBuffID(90002173) then
    if  Str>=240 then
        A=0.25
    elseif  Str>=210 then
        A=0.15
    elseif  Str>=180 then
        A=0.1
    end
  end

 return A
end


----------------------------------------------------------------------------------瓶中精灵
function CommonFun.calcBuff_4130(srcUser, targetUser, a, b, c, d,lv)
  if srcUser == nil or targetUser == nil then
      return 0
  end

  local RefineLv1=srcUser:GetEquipedRefineLv(5)
  local RefineLv2=srcUser:GetEquipedRefineLv(6)
  local Ring1=srcUser:GetEquipedID(5)
  local Ring2=srcUser:GetEquipedID(6)

  local a = 0
  local b = 0
  local c = 0
  local d = 0
  local A = 3

  if srcUser:HasBuffID(90002223) and (Ring1==44038 or Ring1==144038) and RefineLv1>=10 then
      a = 1
  end
  if srcUser:HasBuffID(90002223)  and (Ring2==44038 or Ring2==144038) and RefineLv2>=10 then
      b = 1
  end
  if srcUser:HasBuffID(90002223) and (Ring1==44038 or Ring1==144038) and RefineLv1==15 then
      c = 1
  end
  if srcUser:HasBuffID(90002223) and (Ring2==44038 or Ring2==144038) and RefineLv2==15 then
      d = 1
  end

 local A = 3 + math.min(1,a+b ) + math.min(1,c+d )

 return A
end

----------------------------------------------------------------------------------奥尔里昂的手套[第十档]
function CommonFun.calcBuff_4140(srcUser, targetUser, a, b, c, d,lv)
  if srcUser == nil or targetUser == nil then
      return 0
  end
  local Ring1=srcUser:GetEquipedID(5)
  local RefineLv1=srcUser:GetEquipedRefineLv(5)
  local Ring2=srcUser:GetEquipedID(6)
  local RefineLv2=srcUser:GetEquipedRefineLv(6)

  local a = 0
  local b = 0

  if (Ring1==44005 or Ring1==144005) and RefineLv1>=12 then
      a = 0.03
        end
  if (Ring2==44005 or Ring2==144005) and RefineLv2>=12 then
      b = 0.03
  end

 local A = a + b

 return A
end


----------------------------------------------------------------------------------奥尔里昂的项链[第十档]
function CommonFun.calcBuff_4150(srcUser, targetUser, a, b, c, d,lv)
  if srcUser == nil or targetUser == nil then
      return 0
  end
  local Ring1=srcUser:GetEquipedID(5)
  local RefineLv1=srcUser:GetEquipedRefineLv(5)
  local Ring2=srcUser:GetEquipedID(6)
  local RefineLv2=srcUser:GetEquipedRefineLv(6)

  local a = 0
  local b = 0

  if (Ring1==44004 or Ring1==144004) and RefineLv1>=5 then
      a = 30
        end
  if (Ring2==44004 or Ring2==144004) and RefineLv2>=5 then
      b = 30
  end

 local A = a + b

 return A
end


----------------------------------------------------------------------------------奥尔里昂的项链[第十档]
function CommonFun.calcBuff_4160(srcUser, targetUser, a, b, c, d,lv)
  if srcUser == nil or targetUser == nil then
      return 0
  end
  local Ring1=srcUser:GetEquipedID(5)
  local RefineLv1=srcUser:GetEquipedRefineLv(5)
  local Ring2=srcUser:GetEquipedID(6)
  local RefineLv2=srcUser:GetEquipedRefineLv(6)

  local a = 0
  local b = 0

  if (Ring1==44004 or Ring1==144004) and RefineLv1>=10 then
      a = 0.03
        end
  if (Ring2==44004 or Ring2==144004) and RefineLv2>=10 then
      b = 0.03
  end

 local A = a + b

 return A
end

----------------------------------------------------------------------------------黑狐颈链[第十档]
function CommonFun.calcBuff_4170(srcUser, targetUser, a, b, c, d,lv)
  if srcUser == nil or targetUser == nil then
      return 0
  end

  local RefineLv1=srcUser:GetEquipedRefineLv(5)
  local RefineLv2=srcUser:GetEquipedRefineLv(6)
  local Ring1=srcUser:GetEquipedID(5)
  local Ring2=srcUser:GetEquipedID(6)

  local a = 0
  local b = 0
  local c = 0
  local d = 0
  local A = 5

  if srcUser:HasBuffID(90001679) and (Ring1==44021 or Ring1==144021) and RefineLv1>=10 then
      a = 1
  end
  if srcUser:HasBuffID(90001679)  and (Ring2==44021 or Ring2==144021) and RefineLv2>=10 then
      b = 1
  end
  if srcUser:HasBuffID(90001679)  and (Ring1==44021 or Ring1==144021) and RefineLv1==15 then
      c = 2
  end
  if srcUser:HasBuffID(90001679)  and (Ring2==44021 or Ring2==144021) and RefineLv2==15 then
      d = 2
  end

 local A = 5 + math.min(1,a+b ) + math.min(2,c+d )

 return A
end



----------------------------------------------------------------------------------伯爵斗篷[第四档]
function CommonFun.calcBuff_4180(srcUser, targetUser, a, b, c, d,lv)
  if srcUser == nil or targetUser == nil then
      return 0
  end
  local RefineLv1=srcUser:GetEquipedRefineLv(3)
  local IgnoreDef = srcUser:GetProperty("IgnoreDef")
  local A = 0
  if (RefineLv1 >=8 and srcUser:HasBuffID(90002263))  then
      A = IgnoreDef*100*0.5
  end

 return A
end

----------------------------------------------------------------------------------伯爵斗篷[第四档]
function CommonFun.calcBuff_4190(srcUser, targetUser, a, b, c, d,lv)
  if srcUser == nil or targetUser == nil then
      return 0
  end
  local RefineLv1=srcUser:GetEquipedRefineLv(3)
  local A = 0
  if (RefineLv1 >=12 and srcUser:HasBuffID(90002263) )  then
      A = 0.03
  end

 return A
end

----------------------------------------------------------------------------------安毕斯假面
function CommonFun.calcBuff_4390(srcUser, targetUser, a, b, c, d,lv)
  if srcUser == nil or targetUser == nil then
      return 0
  end
  local Ring1=srcUser:GetEquipedID(5)
  local RefineLv1=srcUser:GetEquipedRefineLv(5)
  local Ring2=srcUser:GetEquipedID(6)
  local RefineLv2=srcUser:GetEquipedRefineLv(6)

  local a = 0
  local b = 0

  if (Ring1 == 45692) and RefineLv1 >= 6 then
      a = 0.03
        end
  if (Ring2 == 45692) and RefineLv2 >= 6 then
      b = 0.03
  end

 local A = a + b

 return A
end


--------------------------------------------------------------------------------孤注一掷
function CommonFun.calcBuff_4200(srcUser, targetUser, a, b, c, d,lv)
   if srcUser == nil or targetUser == nil then
      return 0
   end
   local MDef2 = srcUser:GetProperty("MDef")
   local MDefPer2 = srcUser:GetProperty("MDefPer")
   local A =MDef2*(1+MDefPer2)*2

   return A

end

--------------------------------------------------------------------------------【亡者-鹗枭男爵卡片】和【鹗枭男爵★卡片】
function CommonFun.calcBuff_4210(srcUser, targetUser, a, b, c, d,lv)
   if srcUser == nil or targetUser == nil then
      return 0
   end
  local A = 20
  if ( srcUser:HasBuffID(52950) and srcUser:HasBuffID(53050) )  then
      A = 45
  end

   return A

end


----------------------------------------------------------------死灵★卡片

function CommonFun.calcBuff_4220(srcUser, targetUser, a, b, c, d,lv)
 if srcUser == nil or targetUser == nil then
      return 0
  end

  local Agi=srcUser:GetProperty("Agi")
  local A= 0.075
  if Agi > 180 then
    A= 0.075+0.05
  end
   return A

end



----------------------------------------------------------------贤者之书

function CommonFun.calcBuff_4230(srcUser, targetUser, a, b, c, d,lv)
 if srcUser == nil or targetUser == nil then
      return 0
  end

  local Agi=srcUser:GetProperty("Agi")
  local A= math.floor(Agi/20)/100

    return A

  end

----------------------------------------------------------------完美舞姿卡片

function CommonFun.calcBuff_4240(srcUser, targetUser, a, b, c, d,lv)
 if srcUser == nil or targetUser == nil then
      return 0
  end

  local MaxSp = srcUser:GetProperty("MaxSp")
  local A= math.floor(MaxSp/800)*0.01

    return A

  end

 ----------------------------------------------------------------土人★卡片
function CommonFun.calcBuff_4250(srcUser, targetUser, a, b, c, d,lv)
   if srcUser == nil or targetUser == nil then
      return 0
   end
  local A = 15
  local RefineLv2=srcUser:GetEquipedRefineLv(2)

  if ( srcUser:HasBuffID(53150) and RefineLv2 >=10 )  then
      A = 30
  end

   return A

end


---------------------------------------------------------------精炼+b以上，每精炼+1,属性+a，c固定值[3号位通用]
function CommonFun.calcBuff_4260(srcUser, targetUser, a, b, c, d,lv)
  if srcUser == nil or targetUser == nil then
      return 0
  end
  local RefineLv=srcUser:GetEquipedRefineLv(8)
  local A =c

  if RefineLv > b then
      A=(RefineLv-b)* a + A
  end

 return A
end
----------------------------------------------------------------------------------地元素领域
function CommonFun.calcBuff_4270(srcUser, targetUser, a, b, c, d,lv)
  if srcUser == nil or targetUser == nil then
    return 0
  end

  local Num1 = targetUser:GetBuffLayer(118142)
  local A = 0

  if Num1 >=3 then
      A = 100
  end

  return A

end

 ----------------------------------------------------------------审判之锤
function CommonFun.calcBuff_4280(srcUser, targetUser, a, b, c, d,lv)
   if srcUser == nil or targetUser == nil then
      return 0
   end
  local A = 0

  if ( srcUser:HasBuffID(41240) or srcUser:HasBuffID(41970) )  then
      A = 15
  end

   return A

end


 ----------------------------------------------------------------厨神的祝福
function CommonFun.calcBuff_4290(srcUser, targetUser, a, b, c, d,lv)
   if srcUser == nil or targetUser == nil then
      return 0
   end
  local A = 0

  if  srcUser:HasBuffID(8004)   then
      A = 1
  end

   return A

end

 ----------------------------------------------------------------厨神的祝福
function CommonFun.calcBuff_4300(srcUser, targetUser, a, b, c, d,lv)
   if srcUser == nil or targetUser == nil then
      return 0
   end
  local A = 0

  if  srcUser:HasBuffID(8004)   then
      A = 8
  end

   return A

end

----------------------------------------------------------------------------------致命一击
function CommonFun.calcBuff_4310(srcUser, targetUser, a, b, c, d,lv)
  if srcUser == nil or targetUser == nil then
    return 0
  end

  local Num1 = targetUser:GetBuffLayer(161740)
  local MaxHp = targetUser:GetProperty("MaxHp")
  local A = math.min(Num1*0.3+0.3,1)*MaxHp


  return -A

end


------------------------------------------------------------------------无影无踪
function CommonFun.calcBuff_4320(srcUser, targetUser, a, b, c, d,lv)
  if srcUser == nil or targetUser == nil then
      return 0
  end
  local StunAtk = srcUser:GetProperty("StunAtk")
  local StunDef2 = targetUser:GetProperty("StunDef")
  local StunDam  = (1 + StunAtk - StunDef2)
  if StunDam <=0 then
     StunDam  =0
  end
  ---------------------------------------------------------------------异常状态的每个公式必加
  local StateAtk  = srcUser:GetProperty("StateAtk")
  local StateDef2 = targetUser:GetProperty("StateDef")
  local StateDam  = (1 + StateAtk - StateDef2)
  if StateDam<=0 then
     StateDam =0
  end

  local StateEffect = targetUser:GetProperty("StateEffect")
  local bits=CommonFun.getBits(StateEffect)

  local Profession=srcUser:GetProfressionID()
  if bits[CommonFun.StateEffect.Poison] ==1 and (Profession==32 or Profession==33 or Profession==34) then
    b= 5
  end

  local A= b*StunDam*StateDam*CommonFun.calcAttrDizzyRate(srcUser, targetUser)

  --------------print("b="..b,"A="..A)

  if A <= 0 then
    return 0
  end

  return A
end


 ----------------------------------------------------------------奈伯利安·星切
function CommonFun.calcBuff_4330(srcUser, targetUser, a, b, c, d,lv)
   if srcUser == nil or targetUser == nil then
      return 0
   end
  local A = 0

  if  srcUser:HasBuffID(34152)   then
      A = 100
  end

   return A

end


----------------------------------------------------------------阿斯特蕾娅的眷恋

function CommonFun.calcBuff_4340(srcUser, targetUser, a, b, c, d,lv)
 if srcUser == nil or targetUser == nil then
      return 0
  end

  local Agi=srcUser:GetProperty("Agi")
  local A= math.floor(Agi/2)

    return A

  end

---------------------------------------------------------------放浪者外套
function CommonFun.calcBuff_4350(srcUser, targetUser, a, b, c, d,lv)
  if srcUser == nil or targetUser == nil then
      return 0
  end
  local RefineLv=srcUser:GetEquipedRefineLv(2)
  local A =0

  if (RefineLv >= 10 and srcUser:HasBuffID(90001623) )then
      A= a
  end

 return A
end

---------------------------------------------------------------格里芬之爪
function CommonFun.calcBuff_4360(srcUser, targetUser, a, b, c, d,lv)
  if srcUser == nil or targetUser == nil then
      return 0
  end
  local RefineLv=srcUser:GetEquipedRefineLv(7)
  local Ring1=srcUser:GetEquipedID(7)
  local A =100

  if (Ring1==62540 or Ring1==162540) then
       A=RefineLv* a + A + b
  end

 return A
end

----------------------------------------------------------------------------------按百分比恢复已损失的SP
function CommonFun.calcBuff_4370(srcUser, targetUser, a, b, c, d,lv)
  if srcUser == nil or targetUser == nil then
      return 0
  end

  local MaxSp = srcUser:GetProperty("MaxSp")

  local Sp = targetUser:GetProperty("Sp")


  local A = (MaxSp - Sp) * a

  return A
end

----------------------------------------------------------------------------------中粒子屏障持续时间
function CommonFun.calcBuff_4380(srcUser, targetUser, a, b, c, d,lv)
  if srcUser == nil or targetUser == nil then
      return 0
  end

  local A = a

  if srcUser:HasBuffID(850006) then --------------------虚影屏障符文
     A = A + 3
  end

  return A
end

----------------------------------------------------------------------------------检查是否有buff

function CommonFun.calcBuff_5040(srcUser, targetUser, a, b, c, d, lv)
  if srcUser == nil or targetUser == nil then
    return 0
  end
  local Hasbuff = 0
  if srcUser:HasBuffID(c) then
    Hasbuff = 1
  end
  local A = a + b * Hasbuff + d * lv
  return A
end


CommonFun.BaseAttrCalNoPer = {
    "Cri",
    "MaxHp" ,
    "MaxSp",
    "MoveSpd",
    "Hit" ,
    "Flee" ,
    "RestoreSpd" ,
    "SpRestoreSpd"
}

function CommonFun.checkIsNoNeedPercent(key)
  for i=1,#CommonFun.BaseAttrCalNoPer do
    local single = CommonFun.BaseAttrCalNoPer[i]
    if(single == key)then
      return true
    end
  end
end



CommonFun.CalcBuffFuncs = {
  [20] = CommonFun.calcBuff_20,
  [21] = CommonFun.calcBuff_21,
  [22] = CommonFun.calcBuff_22,
  [23] = CommonFun.calcBuff_23,
  [39] = CommonFun.calcBuff_39,
  [40] = CommonFun.calcBuff_40,
  [41] = CommonFun.calcBuff_41,
  [50] = CommonFun.calcBuff_50,
  [51] = CommonFun.calcBuff_51,
  [52] = CommonFun.calcBuff_52,
  [53] = CommonFun.calcBuff_53,
  [54] = CommonFun.calcBuff_54,
  [55] = CommonFun.calcBuff_55,
  [56] = CommonFun.calcBuff_56,
  [57] = CommonFun.calcBuff_57,
  [58] = CommonFun.calcBuff_58,
  [59] = CommonFun.calcBuff_59,
  [60] = CommonFun.calcBuff_60,
  [61] = CommonFun.calcBuff_61,
  [62] = CommonFun.calcBuff_62,
  [100] = CommonFun.calcBuff_100,
  [101] = CommonFun.calcBuff_101,
  [102] = CommonFun.calcBuff_102,
  [103] = CommonFun.calcBuff_103,
  [104] = CommonFun.calcBuff_104,
  [105] = CommonFun.calcBuff_105,
  [106] = CommonFun.calcBuff_106,
  [107] = CommonFun.calcBuff_107,
  [110] = CommonFun.calcBuff_110,
  [111] = CommonFun.calcBuff_111,
  [112] = CommonFun.calcBuff_112,
  [113] = CommonFun.calcBuff_113,
  [114] = CommonFun.calcBuff_114,
  [115] = CommonFun.calcBuff_115,
  [120] = CommonFun.calcBuff_120,
  [130] = CommonFun.calcBuff_130,
  [131] = CommonFun.calcBuff_131,
  [132] = CommonFun.calcBuff_132,
  [140] = CommonFun.calcBuff_140,
  [141] = CommonFun.calcBuff_141,
  [150] = CommonFun.calcBuff_150,
  [151] = CommonFun.calcBuff_151,
  [152] = CommonFun.calcBuff_152,
  [153] = CommonFun.calcBuff_153,
  [154] = CommonFun.calcBuff_154,
  [160] = CommonFun.calcBuff_160,
  [170] = CommonFun.calcBuff_170,
  [171] = CommonFun.calcBuff_171,
  [180] = CommonFun.calcBuff_180,
  [185] = CommonFun.calcBuff_185,
  [190] = CommonFun.calcBuff_190,
  [200] = CommonFun.calcBuff_200,
  [201] = CommonFun.calcBuff_201,
  [202] = CommonFun.calcBuff_202,
  [203] = CommonFun.calcBuff_203,
  [204] = CommonFun.calcBuff_204,
  [205] = CommonFun.calcBuff_205,
  [300] = CommonFun.calcBuff_300,
  [301] = CommonFun.calcBuff_301,
  [302] = CommonFun.calcBuff_302,
  [310] = CommonFun.calcBuff_310,
  [311] = CommonFun.calcBuff_311,
  [320] = CommonFun.calcBuff_320,
  [321] = CommonFun.calcBuff_321,
  [322] = CommonFun.calcBuff_322,
  [323] = CommonFun.calcBuff_323,
  [330] = CommonFun.calcBuff_330,
  [340] = CommonFun.calcBuff_340,
  [350] = CommonFun.calcBuff_350,
  [360] = CommonFun.calcBuff_360,
  [370] = CommonFun.calcBuff_370,
  [380] = CommonFun.calcBuff_380,
  [390] = CommonFun.calcBuff_390,
  [400] = CommonFun.calcBuff_400,
  [401] = CommonFun.calcBuff_401,
  [410] = CommonFun.calcBuff_410,
  [420] = CommonFun.calcBuff_420,
  [421] = CommonFun.calcBuff_421,
  [422] = CommonFun.calcBuff_422,
  [430] = CommonFun.calcBuff_430,
  [440] = CommonFun.calcBuff_440,
  [441] = CommonFun.calcBuff_441,
  [442] = CommonFun.calcBuff_442,
  [450] = CommonFun.calcBuff_450,
  [460] = CommonFun.calcBuff_460,
  [470] = CommonFun.calcBuff_470,
  [471] = CommonFun.calcBuff_471,
  [480] = CommonFun.calcBuff_480,
  [490] = CommonFun.calcBuff_490,
  [500] = CommonFun.calcBuff_500,
  [510] = CommonFun.calcBuff_510,
  [511] = CommonFun.calcBuff_511,
  [520] = CommonFun.calcBuff_520,
  [530] = CommonFun.calcBuff_530,
  [540] = CommonFun.calcBuff_540,
  [550] = CommonFun.calcBuff_550,
  [551] = CommonFun.calcBuff_551,
  [552] = CommonFun.calcBuff_552,
  [560] = CommonFun.calcBuff_560,
  [570] = CommonFun.calcBuff_570,
  [580] = CommonFun.calcBuff_580,
  [590] = CommonFun.calcBuff_590,
  [600] = CommonFun.calcBuff_600,
  [610] = CommonFun.calcBuff_610,
  [620] = CommonFun.calcBuff_620,
  [630] = CommonFun.calcBuff_630,
  [631] = CommonFun.calcBuff_631,
  [640] = CommonFun.calcBuff_640,
  [650] = CommonFun.calcBuff_650,
  [660] = CommonFun.calcBuff_660,
  [670] = CommonFun.calcBuff_670,
  [671] = CommonFun.calcBuff_671,
  [680] = CommonFun.calcBuff_680,
  [690] = CommonFun.calcBuff_690,
  [700] = CommonFun.calcBuff_700,
  [710] = CommonFun.calcBuff_710,
  [720] = CommonFun.calcBuff_720,
  [730] = CommonFun.calcBuff_730,
  [731] = CommonFun.calcBuff_731,
  [732] = CommonFun.calcBuff_732,
  [733] = CommonFun.calcBuff_733,
  [734] = CommonFun.calcBuff_734,
  [740] = CommonFun.calcBuff_740,
  [741] = CommonFun.calcBuff_741,
  [750] = CommonFun.calcBuff_750,
  [760] = CommonFun.calcBuff_760,
  [770] = CommonFun.calcBuff_770,
  [780] = CommonFun.calcBuff_780,
  [790] = CommonFun.calcBuff_790,
  [800] = CommonFun.calcBuff_800,
  [1000] = CommonFun.calcBuff_1000,
  [1100] = CommonFun.calcBuff_1100,
  [1200] = CommonFun.calcBuff_1200,
  [1300] = CommonFun.calcBuff_1300,
  [1320] = CommonFun.calcBuff_1320,
  [1400] = CommonFun.calcBuff_1400,
  [1500] = CommonFun.calcBuff_1500,
  [1600] = CommonFun.calcBuff_1600,
  [1700] = CommonFun.calcBuff_1700,
  [1701] = CommonFun.calcBuff_1701,
  [1800] = CommonFun.calcBuff_1800,
  [1850] = CommonFun.calcBuff_1850,
  [1900] = CommonFun.calcBuff_1900,
  [1901] = CommonFun.calcBuff_1901,
  [1910] = CommonFun.calcBuff_1910,
  [1920] = CommonFun.calcBuff_1920,
  [1930] = CommonFun.calcBuff_1930,
  [1940] = CommonFun.calcBuff_1940,
  [1950] = CommonFun.calcBuff_1950,
  [1960] = CommonFun.calcBuff_1960,
  [1970] = CommonFun.calcBuff_1970,
  [1980] = CommonFun.calcBuff_1980,
  [2000] = CommonFun.calcBuff_2000,
  [2010] = CommonFun.calcBuff_2010,
  [2020] = CommonFun.calcBuff_2020,
  [2030] = CommonFun.calcBuff_2030,
  [2040] = CommonFun.calcBuff_2040,
  [2041] = CommonFun.calcBuff_2041,
  [2050] = CommonFun.calcBuff_2050,
  [2060] = CommonFun.calcBuff_2060,
  [2061] = CommonFun.calcBuff_2061,
  [2070] = CommonFun.calcBuff_2070,
  [2080] = CommonFun.calcBuff_2080,
  [2090] = CommonFun.calcBuff_2090,
  [2091] = CommonFun.calcBuff_2091,
  [2092] = CommonFun.calcBuff_2092,
  [2093] = CommonFun.calcBuff_2093,
  [2100] = CommonFun.calcBuff_2100,
  [2110] = CommonFun.calcBuff_2110,
  [2120] = CommonFun.calcBuff_2120,
  [2121] = CommonFun.calcBuff_2121,
  [2130] = CommonFun.calcBuff_2130,
  [2140] = CommonFun.calcBuff_2140,
  [2150] = CommonFun.calcBuff_2150,
  [2151] = CommonFun.calcBuff_2151,
  [2160] = CommonFun.calcBuff_2160,
  [2170] = CommonFun.calcBuff_2170,
  [2180] = CommonFun.calcBuff_2180,
  [2190] = CommonFun.calcBuff_2190,
  [2200] = CommonFun.calcBuff_2200,
  [2210] = CommonFun.calcBuff_2210,
  [2220] = CommonFun.calcBuff_2220,
  [2230] = CommonFun.calcBuff_2230,
  [2240] = CommonFun.calcBuff_2240,
  [2250] = CommonFun.calcBuff_2250,
  [2260] = CommonFun.calcBuff_2260,
  [2270] = CommonFun.calcBuff_2270,
  [2280] = CommonFun.calcBuff_2280,
  [2290] = CommonFun.calcBuff_2290,
  [2300] = CommonFun.calcBuff_2300,
  [2310] = CommonFun.calcBuff_2310,
  [2320] = CommonFun.calcBuff_2320,
  [2330] = CommonFun.calcBuff_2330,
  [2340] = CommonFun.calcBuff_2340,
  [2350] = CommonFun.calcBuff_2350,
  [2360] = CommonFun.calcBuff_2360,
  [2370] = CommonFun.calcBuff_2370,
  [2380] = CommonFun.calcBuff_2380,
  [2390] = CommonFun.calcBuff_2390,
  [2400] = CommonFun.calcBuff_2400,
  [2410] = CommonFun.calcBuff_2410,
  [2420] = CommonFun.calcBuff_2420,
  [2421] = CommonFun.calcBuff_2421,
  [2430] = CommonFun.calcBuff_2430,
  [2440] = CommonFun.calcBuff_2440,
  [2441] = CommonFun.calcBuff_2441,
  [2442] = CommonFun.calcBuff_2442,
  [2450] = CommonFun.calcBuff_2450,
  [2460] = CommonFun.calcBuff_2460,
  [2470] = CommonFun.calcBuff_2470,
  [2480] = CommonFun.calcBuff_2480,
  [2490] = CommonFun.calcBuff_2490,
  [2500] = CommonFun.calcBuff_2500,
  [2510] = CommonFun.calcBuff_2510,
  [2520] = CommonFun.calcBuff_2520,
  [2530] = CommonFun.calcBuff_2530,
  [2540] = CommonFun.calcBuff_2540,
  [2550] = CommonFun.calcBuff_2550,
  [2560] = CommonFun.calcBuff_2560,
  [2570] = CommonFun.calcBuff_2570,
  [2580] = CommonFun.calcBuff_2580,
  [2581] = CommonFun.calcBuff_2581,
  [2590] = CommonFun.calcBuff_2590,
  [2591] = CommonFun.calcBuff_2591,
  [2592] = CommonFun.calcBuff_2592,
  [2600] = CommonFun.calcBuff_2600,
  [2601] = CommonFun.calcBuff_2601,
  [2610] = CommonFun.calcBuff_2610,
  [2620] = CommonFun.calcBuff_2620,
  [2630] = CommonFun.calcBuff_2630,
  [2640] = CommonFun.calcBuff_2640,
  [2650] = CommonFun.calcBuff_2650,
  [2660] = CommonFun.calcBuff_2660,
  [2670] = CommonFun.calcBuff_2670,
  [2680] = CommonFun.calcBuff_2680,
  [2690] = CommonFun.calcBuff_2690,
  [2691] = CommonFun.calcBuff_2691,
  [2700] = CommonFun.calcBuff_2700,
  [2710] = CommonFun.calcBuff_2710,
  [2720] = CommonFun.calcBuff_2720,
  [2730] = CommonFun.calcBuff_2730,
  [2740] = CommonFun.calcBuff_2740,
  [2750] = CommonFun.calcBuff_2750,
  [2760] = CommonFun.calcBuff_2760,
  [2770] = CommonFun.calcBuff_2770,
  [2780] = CommonFun.calcBuff_2780,
  [2790] = CommonFun.calcBuff_2790,
  [2800] = CommonFun.calcBuff_2800,
  [2810] = CommonFun.calcBuff_2810,
  [2820] = CommonFun.calcBuff_2820,
  [2830] = CommonFun.calcBuff_2830,
  [2840] = CommonFun.calcBuff_2840,
  [2850] = CommonFun.calcBuff_2850,
  [2860] = CommonFun.calcBuff_2860,
  [2870] = CommonFun.calcBuff_2870,
  [2880] = CommonFun.calcBuff_2880,
  [2890] = CommonFun.calcBuff_2890,
  [2900] = CommonFun.calcBuff_2900,
  [2910] = CommonFun.calcBuff_2910,
  [2920] = CommonFun.calcBuff_2920,
  [2930] = CommonFun.calcBuff_2930,
  [2940] = CommonFun.calcBuff_2940,
  [2950] = CommonFun.calcBuff_2950,
  [2960] = CommonFun.calcBuff_2960,
  [2970] = CommonFun.calcBuff_2970,
  [3000] = CommonFun.calcBuff_3000,
  [3010] = CommonFun.calcBuff_3010,
  [3020] = CommonFun.calcBuff_3020,
  [3021] = CommonFun.calcBuff_3021,
  [3030] = CommonFun.calcBuff_3030,
  [3040] = CommonFun.calcBuff_3040,
  [3050] = CommonFun.calcBuff_3050,
  [3051] = CommonFun.calcBuff_3051,
  [3060] = CommonFun.calcBuff_3060,
  [3070] = CommonFun.calcBuff_3070,
  [3080] = CommonFun.calcBuff_3080,
  [3090] = CommonFun.calcBuff_3090,
  [3100] = CommonFun.calcBuff_3100,
  [3110] = CommonFun.calcBuff_3110,
  [3120] = CommonFun.calcBuff_3120,
  [3121] = CommonFun.calcBuff_3121,
  [3122] = CommonFun.calcBuff_3122,
  [3130] = CommonFun.calcBuff_3130,
  [3140] = CommonFun.calcBuff_3140,
  [3150] = CommonFun.calcBuff_3150,
  [3151] = CommonFun.calcBuff_3151,
  [3152] = CommonFun.calcBuff_3152,
  [3160] = CommonFun.calcBuff_3160,
  [3170] = CommonFun.calcBuff_3170,
  [3180] = CommonFun.calcBuff_3180,
  [3181] = CommonFun.calcBuff_3181,
  [3190] = CommonFun.calcBuff_3190,
  [3200] = CommonFun.calcBuff_3200,
  [3210] = CommonFun.calcBuff_3210,
  [3220] = CommonFun.calcBuff_3220,
  [3221] = CommonFun.calcBuff_3221,
  [3222] = CommonFun.calcBuff_3222,
  [3223] = CommonFun.calcBuff_3223,
  [3250] = CommonFun.calcBuff_3250,
  [3251] = CommonFun.calcBuff_3251,
  [3252] = CommonFun.calcBuff_3252,
  [3253] = CommonFun.calcBuff_3253,
  [3254] = CommonFun.calcBuff_3254,
  [3300] = CommonFun.calcBuff_3300,
  [3301] = CommonFun.calcBuff_3301,
  [3302] = CommonFun.calcBuff_3302,
  [3303] = CommonFun.calcBuff_3303,
  [3304] = CommonFun.calcBuff_3304,
  [3310] = CommonFun.calcBuff_3310,
  [3320] = CommonFun.calcBuff_3320,
  [3321] = CommonFun.calcBuff_3321,
  [3322] = CommonFun.calcBuff_3322,
  [3323] = CommonFun.calcBuff_3323,
  [3324] = CommonFun.calcBuff_3324,
  [3325] = CommonFun.calcBuff_3325,
  [3330] = CommonFun.calcBuff_3330,
  [3340] = CommonFun.calcBuff_3340,
  [3350] = CommonFun.calcBuff_3350,
  [3360] = CommonFun.calcBuff_3360,
  [3370] = CommonFun.calcBuff_3370,
  [3380] = CommonFun.calcBuff_3380,
  [3390] = CommonFun.calcBuff_3390,
  [3400] = CommonFun.calcBuff_3400,
  [3401] = CommonFun.calcBuff_3401,
  [3410] = CommonFun.calcBuff_3410,
  [3420] = CommonFun.calcBuff_3420,
  [3430] = CommonFun.calcBuff_3430,
  [3440] = CommonFun.calcBuff_3440,
  [3441] = CommonFun.calcBuff_3441,
  [3450] = CommonFun.calcBuff_3450,
  [3451] = CommonFun.calcBuff_3451,
  [3452] = CommonFun.calcBuff_3452,
  [3460] = CommonFun.calcBuff_3460,
  [3461] = CommonFun.calcBuff_3461,
  [3470] = CommonFun.calcBuff_3470,
  [3471] = CommonFun.calcBuff_3471,
  [3480] = CommonFun.calcBuff_3480,
  [3481] = CommonFun.calcBuff_3481,
  [3490] = CommonFun.calcBuff_3490,
  [3491] = CommonFun.calcBuff_3491,
  [3492] = CommonFun.calcBuff_3492,
  [3500] = CommonFun.calcBuff_3500,
  [3510] = CommonFun.calcBuff_3510,
  [3511] = CommonFun.calcBuff_3511,
  [3520] = CommonFun.calcBuff_3520,
  [3530] = CommonFun.calcBuff_3530,
  [3540] = CommonFun.calcBuff_3540,
  [3541] = CommonFun.calcBuff_3541,
  [3550] = CommonFun.calcBuff_3550,
  [3560] = CommonFun.calcBuff_3560,
  [3570] = CommonFun.calcBuff_3570,
  [3580] = CommonFun.calcBuff_3580,
  [3590] = CommonFun.calcBuff_3590,
  [3600] = CommonFun.calcBuff_3600,
  [3610] = CommonFun.calcBuff_3610,
  [3620] = CommonFun.calcBuff_3620,
  [3630] = CommonFun.calcBuff_3630,
  [3640] = CommonFun.calcBuff_3640,
  [3650] = CommonFun.calcBuff_3650,
  [3660] = CommonFun.calcBuff_3660,
  [3670] = CommonFun.calcBuff_3670,
  [3680] = CommonFun.calcBuff_3680,
  [3690] = CommonFun.calcBuff_3690,
  [3691] = CommonFun.calcBuff_3691,
  [3700] = CommonFun.calcBuff_3700,
  [3710] = CommonFun.calcBuff_3710,
  [3720] = CommonFun.calcBuff_3720,
  [3730] = CommonFun.calcBuff_3730,
  [3740] = CommonFun.calcBuff_3740,
  [3741] = CommonFun.calcBuff_3741,
  [3742] = CommonFun.calcBuff_3742,
  [3743] = CommonFun.calcBuff_3743,
  [3744] = CommonFun.calcBuff_3744,
  [3745] = CommonFun.calcBuff_3745,
  [3750] = CommonFun.calcBuff_3750,
  [3760] = CommonFun.calcBuff_3760,
  [3770] = CommonFun.calcBuff_3770,
  [3780] = CommonFun.calcBuff_3780,
  [3790] = CommonFun.calcBuff_3790,
  [3800] = CommonFun.calcBuff_3800,
  [3810] = CommonFun.calcBuff_3810,
  [3820] = CommonFun.calcBuff_3820,
  [3830] = CommonFun.calcBuff_3830,
  [3840] = CommonFun.calcBuff_3840,
  [3850] = CommonFun.calcBuff_3850,
  [3860] = CommonFun.calcBuff_3860,
  [3870] = CommonFun.calcBuff_3870,
  [3880] = CommonFun.calcBuff_3880,
  [3890] = CommonFun.calcBuff_3890,
  [3900] = CommonFun.calcBuff_3900,
  [4000] = CommonFun.calcBuff_4000,
  [4010] = CommonFun.calcBuff_4010,
  [4020] = CommonFun.calcBuff_4020,
  [4030] = CommonFun.calcBuff_4030,
  [4040] = CommonFun.calcBuff_4040,
  [4050] = CommonFun.calcBuff_4050,
  [4060] = CommonFun.calcBuff_4060,
  [4070] = CommonFun.calcBuff_4070,
  [4080] = CommonFun.calcBuff_4080,
  [4081] = CommonFun.calcBuff_4081,
  [4090] = CommonFun.calcBuff_4090,
  [4100] = CommonFun.calcBuff_4100,
  [4110] = CommonFun.calcBuff_4110,
  [4120] = CommonFun.calcBuff_4120,
  [4130] = CommonFun.calcBuff_4130,
  [4140] = CommonFun.calcBuff_4140,
  [4150] = CommonFun.calcBuff_4150,
  [4160] = CommonFun.calcBuff_4160,
  [4170] = CommonFun.calcBuff_4170,
  [4180] = CommonFun.calcBuff_4180,
  [4190] = CommonFun.calcBuff_4190,
  [4200] = CommonFun.calcBuff_4200,
  [4210] = CommonFun.calcBuff_4210,
  [4220] = CommonFun.calcBuff_4220,
  [4230] = CommonFun.calcBuff_4230,
  [4240] = CommonFun.calcBuff_4240,
  [4250] = CommonFun.calcBuff_4250,
  [4260] = CommonFun.calcBuff_4260,
  [4270] = CommonFun.calcBuff_4270,
  [4280] = CommonFun.calcBuff_4280,
  [4290] = CommonFun.calcBuff_4290,
  [4300] = CommonFun.calcBuff_4300,
  [4310] = CommonFun.calcBuff_4310,
  [4320] = CommonFun.calcBuff_4320,
  [4330] = CommonFun.calcBuff_4330,
  [4340] = CommonFun.calcBuff_4340,
  [4350] = CommonFun.calcBuff_4350,
  [4360] = CommonFun.calcBuff_4360,
  [4370] = CommonFun.calcBuff_4370,
  [4380] = CommonFun.calcBuff_4380,
  [5040] = CommonFun.calcBuff_5040,
}
----根据排名获取额外积分奖励
----maxApple 苹果积分上限
----rank 排名，1,2,3,4
function CommonFun.calcExtraScore(maxApple, rank)

if rank == nil or maxApple == nil then
  return 0
end

 --苹果额外奖励系数
  local appleparam = {
    [1] = 0.4,
    [2] = 0.2,
    [3] = 0.1,
    [4] = 0,
    [5] = 0,
    [6] = 0,
    [7] = 0,
    [8] = 0,
    [9] = 0,
    [10] = 0,
  }

  --额外积分
  local ExtraScore = 0

  if appleparam[rank] == nil then
    return 0
  else
    ExtraScore = maxApple * appleparam[rank]
    return ExtraScore
  end
end



function CommonFun.getExpExtra(npczone, npctype, stype, mapid)
  local extra = 0
  local mextra = 0
  local cur = os.time()

  -- npc type
  if npczone == 1 then
    local starttime = os.time({year = 2020, month = 2, day = 24, hour = 9, min = 10})
    local endtime = os.time({year = 2020, month = 2, day = 28, hour = 9, min = 10})
    if cur >= starttime and cur <= endtime then
      extra = 0.5
    end
  elseif npczone == 3 then
    local starttime = os.time({year = 2020, month = 2, day = 25, hour = 9, min = 10})
    local endtime = os.time({year = 2020, month = 2, day = 28, hour = 9, min = 10})
    if cur >= starttime and cur <= endtime then
      extra = 1
    end
  elseif npczone == 4 then
    local starttime = os.time({year = 2020, month = 2, day = 25, hour = 9, min = 10})
    local endtime = os.time({year = 2020, month = 2, day = 26, hour = 9, min = 10})
    if cur >= starttime and cur <= endtime then
      extra = 2
    end
  elseif npczone == 5 then
    local starttime = os.time({year = 2020, month = 2, day = 25, hour = 9, min = 10})
    local endtime = os.time({year = 2020, month = 2, day = 26, hour = 9, min = 10})
    if cur >= starttime and cur <= endtime then
      extra = 3
    end
  end

  -- map(mapid=value)
  local mapgroup = {[1] = 0.5, [2] = 2}
  local starttime = os.time({year = 2020, month = 2, day = 27, hour = 11, min = 15})
  local endtime = os.time({year = 2020, month = 2, day = 28, hour = 11, min = 20})
  if cur >= starttime and cur <= endtime then
    if stype == 1 then
      if #mapgroup == 0 then
        mextra = 0
      else
        for k,v in pairs(mapgroup) do
          if k == mapid then
            mextra = v;
            break
          end
        end
      end
    elseif npczone == 1 then
      if npctype == 3 or npctype == 4 or npctype == 5 then
        if #mapgroup == 0 then
          mextra = 0
        else
          for k,v in pairs(mapgroup) do
            if k == mapid then
              mextra = v;
              break
            end
          end
        end
      end
    end
  end

  --print("extra = "..extra)
  --print("mextra = "..mextra)
  return extra + mextra
end







--[[
-- 获得衰减因子
function CommonFun.getReduceValue(deltalv)
  local per = { [0]=1.0,[1]=1.0,[2]=1.0,[3]=1.0,[4]=1.0,[5]=1.0,[6]=1.0,[7]=1.0,[8]=1.0,[9]=1.0,[10]=1.0,
                [11]=1.0,[12]=1.0,[13]=0.8,[14]=0.6,[15]=0.4,[-1]=1.0,[-2]=1.0,[-3]=1.0,[-4]=1.0,[-5]=1.0,
                [-6]=0.8,[-7]=0.8,[-8]=0.8,[-9]=0.6,[-10]=0.6,[-11]=0.6,[-12]=0.6,[-13]=0.6,[-14]=0.6,
                [-15]=0.6,[-16]=0.4,[-17]=0.4,[-18]=0.4,[-19]=0.4,[-20]=0.4,[-21]=0.2,[-22]=0.2,[-23]=0.2,
                [-24]=0.2,[-25]=0.2,[-26]=0.1,[-27]=0.1,[-28]=0.1,[-29]=0.1,[-30]=0.1}
  local extrper = 0
  if deltalv > 15 then
    extrper = 0.4
  elseif deltalv < -30 then
    extrper = 0.1
  else
    extrper = per[deltalv]
    if extrper == nil then
      extrper = 1
    end
  end

  return extrper
end
--]]

function CommonFun.getItemReduceValue(deltalv, star)
  local  extrper  = 0
  local  extrper1 = 0
  local  extrper2 = 0            
  
              
  if deltalv >= -20 then
     extrper1=1
  elseif  -30 <= deltalv and deltalv <= -21 then
     extrper1=0.8
  elseif  -40 <= deltalv and deltalv <= -31 then
     extrper1=0.6
  elseif  -50 <= deltalv and deltalv <= -41 then
     extrper1=0.4
  elseif  deltalv <-50  then
     extrper1=0.2
  end 
  
  if deltalv >= -10 then
     extrper2=1
  elseif  -20 <= deltalv and deltalv <= -11 then
     extrper2=0.9
  elseif  -30 <= deltalv and deltalv <= -21 then
     extrper2=0.8
  elseif  -40 <= deltalv and deltalv <= -31 then
     extrper2=0.7
  elseif  -50 <= deltalv and deltalv <= -41 then
     extrper2=0.6
  elseif  deltalv <-50  then
     extrper2=0.5
  end    
  
  if star ~= nil and star == true then
     extrper=extrper1
  else
     extrper=extrper2   
  end

  return extrper
end


function CommonFun.getExpReduceValue(deltalv, star)
  local per = { [0]=1.0,[1]=1.0,[2]=1.0,[3]=1.0,[4]=1.0,[5]=1.0,[6]=1.0,[7]=1.0,[8]=1.0,[9]=1.0,[10]=1.0,
                [11]=0.8,[12]=0.8,[13]=0.8,[14]=0.8,[15]=0.8,[16]=0.8,[17]=0.8,[18]=0.8,[19]=0.8,[20]=0.8,[-1]=1.0,[-2]=1.0,[-3]=1.0,[-4]=1.0,[-5]=1.0,
                [-6]=1.0,[-7]=1.0,[-8]=1.0,[-9]=1.0,[-10]=1.0,[-11]=0.8,[-12]=0.8,[-13]=0.8,[-14]=0.8,
                [-15]=0.8,[-16]=0.6,[-17]=0.6,[-18]=0.6,[-19]=0.6,[-20]=0.6,[-21]=0.4,[-22]=0.4,[-23]=0.4,
                [-24]=0.4,[-25]=0.4,[-26]=0.2,[-27]=0.2,[-28]=0.2,[-29]=0.2,[-30]=0.2}
  local extrper = 0
  if deltalv > 20 then
    extrper = 0.5
  elseif deltalv < -30 then
    extrper = 0.1
  else
    extrper = per[deltalv]
    if extrper == nil then
      extrper = 1
    end
  end

  return extrper
end

-- 抗击魔潮倍率
function CommonFun.getDailyRatio(dailyextra)
  local ratio =  (1 + dailyextra)
  return ratio
end

-- 计算怪物掉落经验
function CommonFun.calcNpcDropBaseExp(damage, deltalv, npctype, npczone, maxhp, exp, extrabuff, membercount, layer, mapid, stype, killer, dailyextra, star)
  --print("------------------------------------------")
  --print("deltalv = "..deltalv)
  --print("npctype= "..npctype)
  --print("extrabuff = "..extrabuff)
  --print("membercount = "..membercount)
  --print("stype = "..stype)
  --print("dailyextra= "..dailyextra)

  -- npctype
  -- 5 : mvp

  -- 伤害保护
  if damage >= maxhp then
    damage = maxhp
  end

 -- print("damage= "..damage)
 -- print("maxhp= "..maxhp)
  --print("exp= "..exp)


  -- 获取额外经验倍率
  local extra = CommonFun.getExpExtra(npczone, npctype, stype, mapid)
  --print("extra = "..extra)
  local reduce = CommonFun.getExpReduceValue(deltalv, star)
  --print("reduce = "..reduce)

  if membercount == 0 then
    membercount = 1
  end

  -- 计算mvp经验
  if npctype == 5 then
    local e1 = (0.2 * killer + 0.8 * damage / maxhp) * exp * ((membercount - 1) * 0.1 + 1) / membercount * reduce

    if e1<=1 then
       e1=1
    end

    local e2 = e1 * CommonFun.getDailyRatio(dailyextra)
    local result = e2 * (1 + extra)
    if result <= 0 then
      result = 1
    end
    return result
  end

  -- 其他怪经验
 -- local e = exp * ((membercount - 1) * 0.1 + 1) / membercount * reduce * (1 + dailyextra)
  local e3 = (damage / maxhp) * exp * ((membercount - 1) * 0.1 + 1) / membercount * reduce

  if e3<=1 then
     e3=1
  end

  local e4 = e3 * CommonFun.getDailyRatio(dailyextra)

  local result = e4 * (1 + extra)
  if result <= 1 then
    result = 1
  end

--  print("result = "..result)
  return result
end

function CommonFun.openSkillDisplay()
  -- 0 关闭显示; 1 显示 人打怪; 2 显示 怪打人; 3 显示 1&2;
  return 0
end

-- 计算玩家死亡经验掉落
function CommonFun.calcUserDieDropBaseExp(lv)
  local tmp =lv*lv*2
    if lv<=10 and tmp>=50 then
      return 50
    else
      return tmp
    end
  end

-- 计算玩家离线时间
function CommonFun.calcUserOfflineTime(logintime, offlinetime)
  if logintime < offlinetime + 30 * 60 then
    return 0
  end
  local t = logintime - offlinetime
  if t > 720 * 60 then
    t = 720 * 60
  end
  return math.ceil(t / 60)
end

-- 计算玩家离线经验
function CommonFun.calcUserOfflineExp(level, logintime, offlinetime)
  if level <= 30 then
    return 0
  end

  local min = CommonFun.calcUserOfflineTime(logintime, offlinetime)
  local exp = min * (1 * level + 10)
  return exp
end

-- 计算玩家离线job经验
function CommonFun.calcUserOfflineJobExp(level, logintime, offlinetime)
  if level <= 30 then
    return 0
  end

  local min = CommonFun.calcUserOfflineTime(logintime, offlinetime)
  local exp = min * (0.6 * level + 10)
  return exp
end

-- 计算抗击魔潮经验池扣除
function CommonFun.calcDailyExpSub(exp)
  return exp
end

-- 计算装备强化所需费用
function CommonFun.calcEquipStrengthCost(lv, q, t)
  local qparam = GameConfig.StrengthCost.Quality[q]
  local tparam = GameConfig.StrengthCost.Type[t]
  if qparam == nil or tparam == nil then
    return 0
  end

  local a1 = lv % 10
  local b1=GameConfig.StrengthCost.Remainder[a1]
  local a2=math.floor(lv/10)
  local b2=GameConfig.StrengthCost.Quotient[a2]

  local result = GameConfig.StrengthCost.BaseCost * b1 * b2 * qparam * tparam

  --print("base = "..GameConfig.StrengthCost.BaseCost)
  --print("lv = "..lv)
  --print("qparam = "..qparam)
  --print("tparam = "..tparam)
  --print("b1= "..b1)
  --print("b2= "..b2)
    result = result - result % 10
  --print("result = "..result)
  return result
end


-- 防沉迷第一段时间
function CommonFun.getAddictSec1()
  local sec = 5*60*60
  return sec
end

-- 防沉迷第二段时间
function CommonFun.getAddictSec2()
  local sec = 8*60*60
  return sec
end

function CommonFun.getAddictBase()
  return 10*60*60
end

function CommonFun.getAddictStage()
  return 3*60*60
end


function CommonFun.GetRandom(array, index)

    -- 随机数最大个数为20, 每个数包含5个随机数, 共可表示100个随机数
    local MAX_RANDOM_INDEX = 100
    --return 20,50
    local group = math.ceil(index / 5)              -- ex: 8 -> 2
    local key = index - math.floor(index / 5) * 5        -- ex: 8 -> 3, 取第二个数据的第3随机数,(1234567890->56)
    key = key ~= 0 and key or 5

    if array[group]==nil or index > MAX_RANDOM_INDEX then
      return 0, index
    end

    local groupValue = array[group]
    local value = math.floor(groupValue/math.pow(100, 5-key)) % 100

    local newIndex = index == MAX_RANDOM_INDEX and 1 or index + 1

    return value, newIndex
end


--refactory begin
-- CommonFun.Params = { -- CalcDamage
--     skillIDAndLevel,--技能id和技能等级
--     hitedIndex,--主要被击中目标还是次要被击中目标
--     hitedCount,--范围内的最大选择个数
--     -- new
--     pvpMap,--当前是否PVP地图
-- }

-- CommonFun.User = {
--     name,
--     BaseLv,
--     race,
--     shape,
--     boss,

--     function GetProperty(name)
--         return 0
--     end

--     function GetLernedSkillLevel(skillID)
--         return 0
--     end

--     function IsEnemy(targetUser)
--         return false
--     end

--     -- new
--     function IgnoreJinzhanDamage()
--         return false
--     end

--     function IsFly()
--         return false
--     end

--     function SelfBuffChangeSkill()
--         return nil
--     end

--     function GetProfressionID()
--         return 0
--     end

--     function DefiniteHitAndCritical()
--         return false
--     end

--     function GetAttackSkillIDAndLevel()
--         return 0
--     end

--     function DamageAlways1()
--         return false
--     end

--     funtion GetRandom()
--         return 0
--     end
-- }
function CommonFun.CalcTeamPwsScore(winteam_ave, loseteam_ave, winmax, losemax,selfscore, iswin)
  local user_score = 0
  local winscore = 0
  local losescore = 0
  if  selfscore<500 then
      winscore = 100
      losescore = 20
    elseif  selfscore<1200 then
      winscore = 100
      losescore = 10
    elseif  selfscore<2000 then
      winscore = 100
      losescore = -20
    else
       winscore = 100
      losescore = -50
  end

  if iswin ==true then
    local a=loseteam_ave-winteam_ave
    local b=selfscore-winteam_ave
    local grouppara=1
    if a==0 then
      a=1
    end

    local avepara = 0.3*math.sin(math.min(math.abs(a),50)*math.pi/100)*math.abs(a)/a

    if math.abs(b)>0 then
       grouppara = 1/math.tan(((math.min(math.abs(b),winmax/2))-0.1)/winmax/4*math.pi)*(((math.min(math.abs(b),winmax/2))-0.1)/winmax/4*math.pi)
    end
  user_score=math.max((0.7+avepara)*(0.4+0.6*grouppara)*winscore,1)
  end
 if iswin == false then
   if selfscore<1200 then
    local a=winteam_ave-loseteam_ave
    local b=selfscore-loseteam_ave
    if a==0 then
      a=1
    end
    local grouppara=1
    local avepara = 0.3*math.sin(math.min(math.abs(a),50)*math.pi/100)*math.abs(a)/a
  if math.abs(b)>0 then
     grouppara = 1/math.tan(((math.min(math.abs(b),losemax/2))-0.1)/losemax/4*math.pi)*(((math.min(math.abs(b),losemax/2))-0.1)/losemax/4*math.pi)
  end
   user_score=math.max((0.7+avepara)*(0.4+0.6*grouppara)*losescore,1)
  elseif selfscore>=1200  then
    local a=winteam_ave-loseteam_ave
    local b=selfscore-loseteam_ave
    if a==0 then
       a=1
    end
    local grouppara=0.25
    local avepara = -0.3*math.sin(math.min(math.abs(a),50)*math.pi/100)*math.abs(a)/a
  if math.abs(b)>0 then
     grouppara = 0.25*math.sin(math.min(math.abs(b),losemax)*math.pi/losemax/2)*math.abs(b)/b
  end
    user_score=math.min((0.7+avepara)*(0.75+grouppara)*losescore,-1)
  end
end
    return user_score
end
function CommonFun.CalcRaidDeadBossSummonLevel(raidtype, param)

local a =math.random(0,100)
local boss_lv=1
  if raidtype== 2 then
    if param==1 then
      return 0
    elseif param==2 then
     if a<55 then
       boss_lv=1
     elseif a<85 then
       boss_lv=4
     else
       boss_lv=8
     end
    elseif param==3 then
      if a<35 then
       boss_lv=1
      elseif a<80 then
       boss_lv=4
      else
       boss_lv=8
      end
    elseif param==4 then
      if a<25 then
       boss_lv=1
      elseif a<60 then
       boss_lv=4
      else
       boss_lv=8
      end
    end
  end
  if raidtype== 3 then
     if a<40 then
       boss_lv=1
     elseif a<80 then
       boss_lv=4
     else
       boss_lv=8
     end
  end
  if raidtype== 4 then
     if a<30 then
       boss_lv=1
     elseif a<70 then
       boss_lv=4
     else
       boss_lv=8
     end
  end
  if raidtype== 1 then
     if a<50 then
       boss_lv=1
     elseif a<80 then
       boss_lv=4
     else
       boss_lv=8
     end
  end

  return boss_lv
end

-- 计算交易所税率  x%, price 单价
function CommonFun.calcTradeTax(price)
  local tax = 9
  if (price <= 100*10000) then
    return 9
  elseif( price <= 500*10000) then
    return 10
  elseif (price <=1000*10000) then
    return 11
  elseif (price <=2500*10000) then
    return 12
  elseif (price <=5000*10000) then
    return 13
  elseif (price <=10000*10000) then
    return 14
  else
    return 15
  end
end

-- 计算交易所赠送费  totalPrice总价，bg背景id
function CommonFun.calcTradeGiveFee(totalPrice, bg)
  local fee = totalPrice
  if (totalPrice <= 100 * 10000) then
    fee = 1 * 10000
  elseif (totalPrice <= 500 * 10000) then
    fee = 5 * 10000
  else
    fee = 10 * 10000
  end

  --process bg
  local extra = 0
  if (GameConfig.Exchange.SendMoney[bg] == nil ) then
    extra = 0
  else
    extra = GameConfig.Exchange.SendMoney[bg].price
  end
  return fee + extra
end
------------------------------商人系一坨乱七八糟公式
function CommonFun.calcExchangePendingCount(srcUser)
local skilllv_1 = srcUser:GetLernedSkillLevel(262)

return skilllv_1 ~=nil and skilllv_1

end

-- 商人制作 基础概率计算
function CommonFun.calcProduceRate(srcUser, etype, category,composeid)

 ------------------------------------------------------------------------------3魔石制作4尖锐合金制作5武器制作
 if srcUser == nil then
    return 0
 end
------------------------------------------------武器制作成功率
 if etype==3 and category==5 then

     ------------------------------------------------------------------------------武器制作
     local skilllv_1 = srcUser:GetLernedSkillLevel(261)
     ------------------------------------------------------------------------------武器研究
     local skilllv_2 = srcUser:GetLernedSkillLevel(214)
     ------------------------------------------------------------------------------制作大师
     local skilllv_3 = srcUser:GetLernedSkillLevel(221)

     local Dex    =  srcUser:GetProperty("Dex")
     local Luk    =  srcUser:GetProperty("Luk")

    local A1     =  (skilllv_1*75+450) + (skilllv_2*50) +(Dex/8 + Luk/8)*(1 + skilllv_3*0.05)*100

  -----------------------------------------------------------------武器制作最大值判断
     if A1>= 8000  then
        A1 = 8000
     end

     if skilllv_1 <= 0 then
        A1 = 0
     end

    return A1
 end
------------------------------------------------尖锐合金制作成功率
 if etype==3 and category==4 then

     ------------------------------------------------------------------------------制作大师
     local skilllv_3 = srcUser:GetLernedSkillLevel(221)
     ------------------------------------------------------------------------------尖锐合金
     local skilllv_6 = srcUser:GetLernedSkillLevel(218)

     local Dex    =  srcUser:GetProperty("Dex")
     local Luk    =  srcUser:GetProperty("Luk")

     local A2     =  (skilllv_6*100+700) + (Dex/8 + Luk/8)*(1 + skilllv_3*0.05)*100

     -------------------------------------------------------------------尖锐合金最大值判断
     if A2 >= 8500 then
        A2  = 8500
     end

     if skilllv_6 <= 0 then
        A2 = 0
     end

    return A2
 end
------------------------------------------------魔石制作成功率
 if etype==3 and category==3 then

    ------------------------------------------------------------------------------制作大师
     local skilllv_3 = srcUser:GetLernedSkillLevel(221)
     ------------------------------------------------------------------------------魔石制作
     local skilllv_4 = srcUser:GetLernedSkillLevel(269)

     local Dex    =  srcUser:GetProperty("Dex")
     local Luk    =  srcUser:GetProperty("Luk")

     local A3     =  (skilllv_4*220 + 1810)+(Dex/8 + Luk/8)*(1+skilllv_3*0.05)*100

    -------------------------------------------------------------------魔石最大值判断
     if A3 >= 9000 then
        A3  = 9000
     end

     if skilllv_4 <= 0 then
        A3 = 0
     end

    return A3
 end
 ----------------------------------------------炼金制作成功率
 if etype==4 and (category==8 or category==9) then
    local BaseRate = {[1310]=5000,[1320]=5000,[1330]=5000,[1340]=3000,[1350]=3000,[1360]=3000,[1370]=3000,[1380]=5000,[1390]=5000,[1400]=0,}
    ------------------------------------------------------------------------------配药
    local skilllv_5 = srcUser:GetLernedSkillLevel(418)
    ------------------------------------------------------------------------------知识药水
    local skilllv_6 = srcUser:GetLernedSkillLevel(419)

    local Dex    =  srcUser:GetProperty("Dex")
    local Luk    =  srcUser:GetProperty("Luk")

    local AttrRate = (Dex + Luk)*25

    if AttrRate>3000 then
        AttrRate = 3000
    end

    if BaseRate[composeid] == nil then
        BaseRate[composeid] =0
    end

    local A4 = BaseRate[composeid] + skilllv_5*200 + skilllv_6*200 + AttrRate

    if A4>10000 then
      A4 = 10000
    end

    return A4
 end
-------------------------------------------------符文石制作成功率
 if etype==5 and category==11 then
    local BaseRate = {[1420]=0,[1421]=1000,[1422]=2000,[1423]=0,[1424]=1000,[1425]=500,}
    local skilllv_fuwen = srcUser:GetLernedSkillLevel(1268)----------符文掌握
    local Str    =  srcUser:GetProperty("Str")
    local Int    =  srcUser:GetProperty("Int")

    local Attr  = Str*5 + Int*10
    if Attr > 2000 then
        Attr = 2000
    end

    if BaseRate[composeid] == nil then
        BaseRate[composeid] =0
    end

    local A5 = BaseRate[composeid] + skilllv_fuwen*1000 + Attr

    if A5>10000 then
      A5 = 10000
    end

    return A5
 end

  return 0
end

-----------------------------------------------------------------------------------交易大师
function CommonFun.calcTradeMaxPendingCout(srcUser)

local skilllv_1 = srcUser:GetLernedSkillLevel(262)

if srcUser == nil then
  return 0
end

  local basecount = 0
  if GameConfig.Exchange ~= nil then
    basecount = GameConfig.Exchange.MaxPendingCount
  end

  -- check skill lv
  return basecount+skilllv_1
end
-----------------------------------------------------------------------------------露天商店 摆摊位
function CommonFun.calcBoothMaxPendingCout(srcUser)

local skilllv_1 = srcUser:GetLernedSkillLevel(278)

if srcUser == nil then
  return 0
end

  local basecount = 0
  if GameConfig.Booth ~= nil then
    basecount = GameConfig.Booth.base_pending_count
  end

  -- check skill lv
  return basecount+skilllv_1
end
----------------------------------------------------------------------交易大师

function CommonFun.calcTradeBackMoneyPer(srcUser)
local skilllv_1 = srcUser:GetLernedSkillLevel(273)
local A = skilllv_1*0.2-0.1

if A <= 0 then
   A  = 0
end

if srcUser == nil then
    return 0
end
  return A
end


 ------------------------------------------------------------------------------金属研究
function CommonFun.calcOrideconResearch(srcUser)

local skilllv_1 = srcUser:GetLernedSkillLevel(270)
local Dex    =  srcUser:GetProperty("Dex")
local Luk    =  srcUser:GetProperty("Luk")

local DL     =  Dex/6000 + Luk/6000

if DL >= 0.05 then
   DL  = 0.05
end

local Value = skilllv_1*0.005 + DL

if  skilllv_1 <=0 then
    Value=0
end

return Value ~=nil and Value

end

-- 每级料理制作书，增加成功率5%，共10级
-- 食材平均熟练度，每级+3%
-- 烹饪熟练度，每级+3%
-- 如果料理的烹饪难度超出厨师等级，每高一级成功率减一半
-- 返回值 （1-1000）基础成功率：1000
function CommonFun.calcCookSuccessRate(cookerlv, cooklv, cookhard, avgmateriallv, book_addrate)
  local base_successrate = GameConfig.Food and GameConfig.Food.base_successrate
  base_successrate = base_successrate and base_successrate[cookhard] or 0;

  local reuslt = base_successrate + book_addrate + avgmateriallv * 3 + cooklv * 3;
  if(cookhard > cookerlv)then
    for i=1,cookhard-cookerlv do
      reuslt = reuslt/2;
    end
  end
  reuslt = math.floor(reuslt * 10);
  return math.min(1000, reuslt);
end
-----------------------拍卖
function CommonFun.calcAuctionPrice(basePrice, level)
  if level == 1 then
    return 10
  elseif level == 2 then
    return 100
  elseif level == 3 then
    return 1000
  end
end

---------------------扭蛋价格
--计算扭蛋需要的扭蛋币价格
--tp:扭蛋类型 2：装备 3:卡片
--count:今天已经扭蛋的次数
function CommonFun.calcLotteryCost(tp, count)
  if tp == 2 then     --装备
    if count == 0 then
      return 30
    elseif count == 1 then
      return 30
    elseif count == 2 then
      return 30
    elseif count == 3 then
      return 30
    else
      return 30
    end
  end

  if tp == 3 then     --卡片
    if count == 0 then
      return 30
    elseif count == 1 then
      return 30
    elseif count == 2 then
      return 30
    elseif count == 3 then
      return 30
    else
      return 30
    end
  end

  return 0
end


--计算精炼等级额外回收的扭蛋券个数
--itemid:物品id（暂未用）
--refinelv:精炼等级
--damge:破损（暂未用）
--type:返回类型，1:头饰 2：装备
function CommonFun.calcRefineRecovery(itemid, refinelv, damge,type)
 --装备精炼系数
  local refineparam = {
    [1] = 0,
    [2] = 0,
    [3] = 0,
    [4] = 0,
    [5] = 1.2,
    [6] = 1.4,
    [7] = 1.6,
    [8] = 2.2,
    [9] = 3.4,
    [10] = 5,
    [11] = 7.4,
    [12] = 12.4,
    [13] = 19.8,
    [14] = 35.2,
    [15] = 57.4
  }
  local ItemCount = 0
  local CountRatio = 0

--判断类型
  if type==1 then
    CountRatio = 3
  elseif  type==2 then
    CountRatio = 2
  else
    CountRatio = 2
  end

  if  refineparam[refinelv] == nil then
    return 0
  else
    ItemCount = CountRatio * refineparam[refinelv]
    return math.floor(ItemCount)
  end

end

---------------------------------------------------经验道具使用之后增加base
function CommonFun.calcAdventureGuideBaseExp(BaseLv)
    return 3024*BaseLv
end
---------------------------------------------------经验道具使用之后增加base
function CommonFun.calcAdventureGuideJobExp(BaseLv)
    return 1728*BaseLv
end

------------------------------------------------------------------------------------ 计算宠物冒险效率值
local EquipSite_Fushou = 1 --副手
local EquipSite_Kuijia = 2 --盔甲
local EquipSite_Pijian = 3 --披肩
local EquipSite_Xiezi = 4 --鞋子
local EquipSite_Shipin1 = 5 --饰品1
local EquipSite_Shipin2 = 6 --饰品2
local EquipSite_Wuqi = 7 --武器
local EquipSite_Toushi = 8 --头饰
local EquipSite_Lianbu = 9 --脸部
local EquipSite_Zuibu = 10 --嘴部
local EquipSite_Beibu = 11 --背部
local EquipSite_Weibu = 12 --尾部
local AllEquipSites = {
  EquipSite_Fushou,EquipSite_Kuijia,EquipSite_Pijian,EquipSite_Xiezi,
  EquipSite_Shipin1,EquipSite_Shipin2,EquipSite_Wuqi,EquipSite_Toushi,EquipSite_Lianbu,EquipSite_Zuibu,EquipSite_Beibu,EquipSite_Weibu
}
local refineScore = {[1]=20,[2]=30,[3]=40,[4]=50,[5]=100,[6]=120,[7]=140,[8]=200,[9]=220,[10]=240,[11]=300,[12]=320,[13]=340,[14]=360,[15]=400}
local isMax = false
--装备的精炼等级
function CommonFun.calcPetAdventure_RefineEfficiency(srcUser)
    local refinelv,scores
    scores = 0
    for i=1,#AllEquipSites do
        refinelv = srcUser:GetEquipedRefineLv(AllEquipSites[i])
        if(refinelv>0) then
            scores = scores + refineScore[refinelv]
        end
    end
    isMax = scores>=4000
    scores = math.min(scores,4000)
    return scores/10000,isMax
end

local enchantScore = {
    Vit={allscore =200,maxattr = 10},
    Str={allscore =200,maxattr = 10},
    Int={allscore =200,maxattr = 10},
    Luk={allscore =200,maxattr = 8},
    Dex={allscore =200,maxattr = 10},
    Agi={allscore =200,maxattr = 10},
    MaxHp={allscore =80,maxattr = 400},
    MaxSp={allscore =80,maxattr = 80},
    Atk={allscore =120,maxattr = 40},
    MAtk={allscore =120,maxattr = 40},
    Def={allscore =80,maxattr = 20},
    MDef={allscore =80,maxattr = 20},
    MaxHpPer={allscore =200,maxattr = 0.1},
    MaxSpPer={allscore =140,maxattr = 0.05},
    Hit={allscore =120,maxattr = 20},
    Flee={allscore =120,maxattr = 20},
    EquipASPD={allscore =160,maxattr = 0.04},
    Cri={allscore =160,maxattr = 10},
    CriRes={allscore =120,maxattr = 10},
    CriDamPer={allscore =160,maxattr = 0.1},
    CriDefPer={allscore =120,maxattr = 0.1},
    HealEncPer={allscore =160,maxattr = 0.05},
    BeHealEncPer={allscore =160,maxattr = 0.05},
    DamIncrease={allscore =200,maxattr = 0.04},
    DamReduc={allscore =200,maxattr = 0.04},
    SilenceDef={allscore =40,maxattr = 0.25},
    FreezeDef={allscore =40,maxattr = 0.25},
    StoneDef={allscore =40,maxattr = 0.25},
    StunDef={allscore =40,maxattr = 0.25},
    BlindDef={allscore =40,maxattr = 0.25},
    PoisonDef={allscore =40,maxattr = 0.25},
    SlowDef={allscore =40,maxattr = 0.25},
    ChaosDef={allscore =40,maxattr = 0.25},
    CurseDef={allscore =40,maxattr = 0.25},
  }

local enchantgroupScore = {[1]=100,[2]=150,[3]=200,[4]=250}
--装备附魔
function CommonFun.calcPetAdventure_EnchantEfficiency(srcUser)
    local scores=0
    for i=1,#AllEquipSites do
        -- 附魔
        local attrs = srcUser:GetEnchantAttrsBySite(AllEquipSites[i])
        if(attrs)then
          for j=1,#attrs do
              local attrType = attrs[j].typekey
              local attrValue = attrs[j].propVO.isPercent and attrs[j].value/100 or attrs[j].value
              local configValue = enchantScore[attrType]
              if(configValue)then
                  local cellValue = attrValue/configValue.maxattr>=0.8 and attrValue/configValue.maxattr * configValue.allscore or 0
                  scores = scores + cellValue
              end
          end
        end
        -- 附魔组合
        local combineEff = srcUser:GetCombineEffectsBySite(AllEquipSites[i])
        if(combineEff)then
            for j=1,#combineEff do
                local buffid = combineEff[j].buffid;
                if(buffid)then
                    local buffLv = buffid%10
                    if(enchantgroupScore[buffLv])then
                        scores = scores + enchantgroupScore[buffLv]
                    end
                end
            end
        end
    end
    isMax = scores>=3000
    scores = math.min(scores,3000)
    return scores/10000,isMax
end

local  title = {[1001]=0,[1002]=100,[1003]=200,[1004]=300,[1005]=400,[1006]=500,[1007]=600,[1008]=700,[1009]=800,[1010]=900,}
--冒险家等级
function CommonFun.calcPetAdventure_AdventureTitleEfficiency(srcUser)
    local adventureTitle = srcUser:GetAdventureTitle()
    if(adventureTitle and adventureTitle>0) then
        local value = title[adventureTitle]
        value = value and value/10000 or 0

        isMax = value>=0.1
        value = math.min(value,0.1)
        return value,isMax
    end
    return 0,false
end

--星盘已激活分
function CommonFun.calcPetAdventure_XingpanEfficiency(srcUser)
    local points = srcUser:GetActiveAstrolabePoints()
    if(points>0) then
       isMax = points>=3000
       return math.min(points/10000,0.3),isMax
    end
    return 0,false
end

 -------------头饰存储战斗力
local headwear = {[1]=4,[2]=6,[3]=10,[4]=30}
  -------------卡片存储战斗力
local card = {[1]=5,[2]=10,[3]=20,[4]=100}
--冒险手册存储头饰
function CommonFun.calcPetAdventure_AdventureSavedHeadWearEfficiency(srcUser)
    local scores = 0
    for quality,score in pairs(headwear) do
        scores = scores + srcUser:GetAdventureSavedHeadWear(quality) * score
    end
    isMax = scores>=4000
    return math.min(scores/10000,0.4),isMax
end

--冒险手册存储头饰
function CommonFun.calcPetAdventure_AdventureSavedCardEfficiency(srcUser)
    local scores = 0
    for quality,score in pairs(card) do
        scores = scores + srcUser:GetAdventureSavedCard(quality) * score
    end
    isMax = scores>=4000
    return math.min(scores/10000,0.4),isMax
end
------- 计算宠物冒险效率值 end

------- 计算公会建设时，随提交次数增加，提交道具数量的增加公式
function CommonFun.calcGuildBuildingMaterialItemCount(itemcount, submitcount)
	if submitcount == 0 then
	return itemcount
	elseif submitcount == 1 then
	return itemcount
	elseif submitcount == 2 then
	return itemcount
	elseif submitcount == 3 then
	return itemcount*2
	elseif submitcount == 4 then
	return itemcount*2
	elseif submitcount == 5 then
	return itemcount*3
	elseif submitcount == 6 then
	return itemcount*4
	end
	return itemcount*4
end
------- 计算重复制造神器时，重复制造神器数量的材料增加的公式
function CommonFun.calcArtifactMaterialItemCount(type,num,count)
	if type == 1 then
		return num
	elseif type == 2 then
		if count == 0 then
			return num
		elseif count == 1 then
			return num
		elseif count == 2 then
			return math.ceil(num*1.5)
		else
			return  num*2
		end
	else
		if count == 0 then
			return	num
		elseif count == 1 then
			return  num
		elseif count == 2 then
			return math.ceil(num*1.5)
		else
			return  num*2
		end
	end
end

