Formula Source
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 if srcUser:HasBuffID(49320) and srcUser:HasBuffID(49325) then elseif srcUser:HasBuffID(49320) then targetRace = 2 end 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 Card6 = srcUser:GetEquipCardNum(3, 20160) local Card7 = srcUser:GetEquipCardNum(3, 20173) local Card8 = srcUser:GetEquipCardNum(7, 20187) local Card9 = srcUser:GetEquipCardNum(7, 20197) local Card10 = srcUser:GetEquipCardNum(7, 20200) local a = 0 local b = 0 local c = 0 local d = 0 local e = 0 local f = 0 local g = 0 local h = 0 local i = 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 if targetRace == 7 then f = Card6 * 20 + Card8 * 20 end if targetRace == 1 or targetRace == 4 then g = Card7 * 15 end if targetRace == 10 then h = Card9 * 20 end if targetRace == 2 then i = Card10 * 20 end local mapid, maptype = srcUser:GetMapInfo() local CriDef = 0 if (maptype == 2 or maptype == 4) and targetUser:GetNpcID() ~= 40022 then CriDef = math.floor((Cri - CriRes2) / 3) CriDef = math.max(CriDef, 0) end local Hp_rate = 0.3 if 5 < skillLevel 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 + f + g + h - CriDef else rate = Cri - CriRes2 + a + b + c + d + e + f + g + h + i - CriDef end if (targetUser:GetNpcID() ~= 0 or targetUser.boss or targetUser.mini) and srcUser:HasBuffID(64710) then rate = 100 end if srcUser:HasBuffID(115090) or srcUser:HasBuffID(115091) then local Hp = srcUser:GetProperty("Hp") local MaxHp = srcUser:GetProperty("MaxHp") if Hp > MaxHp * 0.09 then rate = 0 end end if targetUser:HasBuffID(159610) then rate = rate * 0.75 end local Profession = srcUser:GetProfressionID() if Profession == 625 then rate = 0 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 if targetUser:HasBuffID(20310140) and (targetUser:HasBuffID(116070) or targetUser:HasBuffID(116072)) then rate = 0 end if targetUser:HasBuffID(151028) then rate = 0 end local skillID = skillParams.id if math.floor(skillID / 1000) == 5400 or math.floor(skillID / 1000) == 5404 then rate = 0 end if srcUser:GetNpcID() == 580101 or srcUser:GetNpcID() == 580102 or srcUser:GetNpcID() == 580103 or srcUser:GetNpcID() == 580104 or srcUser:GetNpcID() == 580105 then rate = 0 end rate = CommonFun.Clamp(rate, 0, 100) return rate end
No formula links