CommonFun

CommonFun.IsCrit

Dataset · 20251127_update

Formula Source

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 or math.floor(skillID / 1000) == 5404 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
No formula links

Version History

Loading dependencies...
Loading usage...