CommonFun

calcDamage / calcBuff explorer

1 formulas listed.

CommonFun.calcDamage_540217 mapped uses · 1 skills
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 1 <= IgnoreMDef then
    IgnoreMDef = 1
  end
  local MRefine = srcUser:GetProperty("MRefine")
  local srcAtkElement = CommonFun.GetUserAtkAttr(srcUser, params, damageParam)
  local targetDefElement = targetUser:GetProperty("DefAttr")
  local ElementRate = CommonFun.calcMagicElement(srcUser, targetUser, params, damageParam)
  if srcAtkElement == 6 and targetDefElement == 7 then
    local GemValue = srcUser:GetGemValue(51022)
    ElementRate = ElementRate + GemValue / 100000
  end
  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(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 5 < RefineLv7 then
    Trial1 = Trial1 + (RefineLv7 - 5) * 0.2
  end
  if (Ring2 == 42076 or Ring2 == 142076) and 10 <= RefineLv2 then
    Trial1 = Trial1 + 1
  end
  if (Ring1 == 41565 or Ring1 == 141565) and 5 < RefineLv7 then
    Trial1 = Trial1 + (RefineLv7 - 5) * 0.2
  end
  if srcUser:HasBuffID(90002053) and 5 <= RefineLv2 then
    Trial1 = Trial1 + 0.5
  end
  local equipRing = srcUser:getEquip(CommonFun.PackType.EPACKTYPE_EQUIP, CommonFun.EquipPos.EEQUIPPOS_ARMOUR)
  if equipRing.id == 42101 or equipRing.id == 142101 then
    if 5 <= equipRing.refinelv and 10 > equipRing.refinelv then
      Trial1 = Trial1 + 0.5
    elseif 10 <= equipRing.refinelv and equipRing.refinelv < 15 then
      Trial1 = Trial1 + 1 + 0.5
    elseif equipRing.refinelv >= 15 then
      Trial1 = Trial1 + 1 + 0.5 + 1.5
    end
  end
  local equipRingSD = srcUser:getEquip(CommonFun.PackType.EPACKTYPE_SHADOWEQUIP, CommonFun.EquipPos.EEQUIPPOS_ARMOUR)
  if equipRingSD.id == 42101 or equipRingSD.id == 142101 then
    if 5 <= equipRingSD.refinelv and 10 > equipRingSD.refinelv then
      Trial1 = Trial1 + 0.5 * equipRingSD.quench_per / 100
    elseif 10 <= equipRingSD.refinelv and equipRingSD.refinelv < 15 then
      Trial1 = Trial1 + 1.5 * equipRingSD.quench_per / 100
    elseif equipRingSD.refinelv >= 15 then
      Trial1 = Trial1 + 3.0 * equipRingSD.quench_per / 100
    end
  end
  if Ring3 == 43552 or Ring3 == 143552 then
    if 10 <= RefineLv4 and RefineLv4 < 15 then
      Trial1 = Trial1 + 0.5
    elseif 15 <= RefineLv4 then
      Trial1 = Trial1 + 1 + 0.5
    end
  end
  local equipRingshoes = srcUser:getEquip(CommonFun.PackType.EPACKTYPE_EQUIP, CommonFun.EquipPos.EEQUIPPOS_SHOES)
  if equipRingshoes.id == 43578 or equipRingshoes.id == 143578 then
    if 10 <= equipRingshoes.refinelv and equipRingshoes.refinelv < 15 then
      Trial1 = Trial1 + 0.5
    elseif equipRingshoes.refinelv >= 15 then
      Trial1 = Trial1 + 1 + 0.5
    end
  end
  local equipRingSDshoes = srcUser:getEquip(CommonFun.PackType.EPACKTYPE_SHADOWEQUIP, CommonFun.EquipPos.EEQUIPPOS_SHOES)
  if equipRingSDshoes.id == 43578 or equipRingSDshoes.id == 143578 then
    if 10 <= equipRingSDshoes.refinelv and equipRingSDshoes.refinelv < 15 then
      Trial1 = Trial1 + 0.5 * equipRingSDshoes.quench_per / 100
    elseif equipRingSDshoes.refinelv >= 15 then
      Trial1 = Trial1 + 1.5 * equipRingSDshoes.quench_per / 100
    end
  end
  if srcUser:HasBuffID(91000410) or srcUser:HasBuffID(91000690) or srcUser:HasBuffID(91001140) then
    Trial2 = 1.1
  end
  if srcUser:HasBuffID(91001150) then
    Trial2 = 1.15
  end
  if srcUser:HasBuffID(91001640) or srcUser:HasBuffID(91001641) or srcUser:HasBuffID(91001642) then
    Trial2 = 1.1
  end
  if srcUser:HasBuffID(91001643) then
    Trial2 = 1.15
  end
  local Num = srcUser:GetRunePoint(54050)
  local RuneDamage = 1 + Num * 0.06
  local GemValue1 = srcUser:GetGemValue(51003)
  local GemValue2 = srcUser:GetGemValue(51061)
  local GemDam = 1 + GemValue1 / 100000 + GemValue2 / 100000
  local A = ((MAtkFinal * MDefReduc * (1 - MDamReduc2) + MRefine) * (damChangePer + Trial1) * (1 - RefineMDamReduc) * (1 + MDamIncrease) * ElementRate * elementparam2 - Vit2 / 2 * (1 + VitPer2) - Int2 * (1 + IntPer2)) * Trial2 * RuneDamage * GemDam
  if A <= 1 then
    return 1
  end
  return A
end