Formula

CommonFun.IsCrit

formula.lua
1function CommonFun.IsCrit(srcUser, targetUser, skillParams)
2  local skillID = skillParams.id
3  if CommonFun.RollType.Attack ~= skillParams.RollType or srcUser:IsAttackSkill(skillID) == false then
4    return false
5  end
6  local AttrEffect = srcUser:GetProperty("AttrEffect")
7  local AttrEffect2 = targetUser:GetProperty("AttrEffect")
8  local StateEffect2 = targetUser:GetProperty("StateEffect")
9  local bits = CommonFun.getBits(AttrEffect)
10  local bits1 = CommonFun.getBits(AttrEffect2)
11  local bits2 = CommonFun.getBits(StateEffect2)
12  if math.floor(skillID / 1000) == 91001 then
13    return false
14  end
15  if bits[CommonFun.AttrEffect.MustHitAndCri] == 1 or bits2[CommonFun.StateEffect.Sleep] == 1 then
16    return true
17  end
18  if bits1[CommonFun.AttrEffect.MustNotCri] == 1 then
19    return false
20  end
21  local critRate = CommonFun.CalcCritRate(srcUser, targetUser, skillParams)
22  if CommonFun.IsInRate(critRate, srcUser:GetRandom()) then
23    return true
24  end
25  return false
26end
Formula Graph

Connected Archive Data

See which cards, equipment, headwears, buffs, and other archived records connect to this formula.

Loading graph filters

CommonFun.IsCrit

commonfun-iscrit

Nodes

0

Edges

0

Related Nodes

Select at least one node type.