Explore ROM internal Lua formulas

1,812 formulas archived

CommonFun.CalcHitRate

Lua
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)
105 linesView Formula

CommonFun.CalcMDef

Lua
function CommonFun.CalcMDef(srcUser, targetUser)
  local MDef2 = targetUser:GetProperty("MDef")
  local Int2 = targetUser:GetProperty("Int")
  local RealMDef = MDef2 - Int2
  if MDef2 <= 0 then
71 linesView Formula

CommonFun.CalcRaceParam

Lua
function CommonFun.CalcRaceParam(srcUser, targetUser, params, damageParam, logger)
  local raceInc = 0
  local raceRed = 0
  local srcRace = srcUser.race
  local targetRace = targetUser.race
67 linesView Formula

CommonFun.CalcRaceParam2

Lua
function CommonFun.CalcRaceParam2(srcUser, targetUser, params, damageParam, logger)
  local raceInc = 0
  local raceRed = 0
  local srcRace = srcUser.race
  local targetRace = targetUser.race
29 linesView Formula

CommonFun.CalcRaidDeadBossSummonLevel

Lua
function CommonFun.CalcRaidDeadBossSummonLevel(raidtype, param)
  local a = math.random(0, 100)
  local boss_lv = 1
  if raidtype == 5 then
    if param == 1 then
24 linesView Formula

CommonFun.CalcRiftBaseExp

Lua
function CommonFun.CalcRiftBaseExp(lv, maxlv, difficulty, speed_per)
  local Baseparam = {
    [170] = 45083341,
    [169] = 44817198,
    [168] = 44557245,
178 linesView Formula

CommonFun.CalcRiftJobExp

Lua
function CommonFun.CalcRiftJobExp(lv, maxlv, difficulty, speed_per)
  local Jobparam = {
    [170] = 26519612,
    [169] = 26363058,
    [168] = 26210144,
178 linesView Formula

CommonFun.CalcShareDamage

Lua
function CommonFun.CalcShareDamage(srcUser, tUser, damage, damagetype)
  if Table_Buffer == nil then
    return damage, nil
  end
  local result
127 linesView Formula

CommonFun.CalcSuckBlood

Lua
function CommonFun.CalcSuckBlood(srcUser, damage, skillid)
  local skillParams = Table_Skill[skillid]
  if skillParams == nil or skillParams.Logic_Param == nil then
    return 0
  end
63 linesView Formula

CommonFun.CalcSum

Lua
function CommonFun.CalcSum(num)
  local result = 0
  for i = num, 0, -1 do
    result = result + i
  end
7 linesView Formula

CommonFun.CalcTeamPwsScore

Lua
function CommonFun.CalcTeamPwsScore(winteam_ave, loseteam_ave, winmax, losemax, selfscore, iswin, extrascore, delta_server_ave)
  local user_score = 0
  local winscore = 0
  local losescore = 0
  if selfscore < 500 then
107 linesView Formula

CommonFun.CalcTripleSeasonScore

Lua
function CommonFun.CalcTripleSeasonScore(myscore, avescore, teamrank, legendrank, maxscore)
  if teamrank ~= 1 and teamrank ~= 2 and teamrank ~= 3 and teamrank ~= 7 and teamrank ~= 8 and teamrank ~= 9 then
    return myscore
  end
  local basicscore = {
60 linesView Formula

CommonFun.CheckBuffListSkill

Lua
function CommonFun.CheckBuffListSkill(bufflistskill, buffskill)
  local skillParams = Table_Skill[buffskill]
  if skillParams == nil then
    return false
  end
37 linesView Formula

CommonFun.CheckCanStolenSkill

Lua
function CommonFun.CheckCanStolenSkill(skillid)
  local skillParams = Table_Skill[skillid]
  if skillParams == nil then
    return false
  end
16 linesView Formula

CommonFun.CheckMissAndBlock

Lua
function CommonFun.CheckMissAndBlock(srcUser, targetUser, params, skillParams, iscrit, damage)
  if damage <= 0 then
    return
  end
  if (targetUser.boss or targetUser.mini or targetUser.changelinepunish) and (targetUser.zoneType == 1 or targetUser.zoneType == 22) and targetUser.noPunishBoss == false then
383 linesView Formula

CommonFun.CheckStormBossMiss

Lua
function CommonFun.CheckStormBossMiss(targetUser, srcUser)
  local monster = Table_Monster[targetUser:GetNpcID()]
  if monster == nil then
    return false
  end
19 linesView Formula

CommonFun.Clamp

Lua
function CommonFun.Clamp(value, min, max)
  if value < min then
    return min
  end
  if max < value then
9 linesView Formula

CommonFun.DoCalcDamage

Lua
function CommonFun.DoCalcDamage(srcUser, targetUser, params, logger)
  local damage = 0
  local damageType
  local RealDamage = targetUser:GetProperty("RealDamage")
  if targetUser:HasBuffID(96050_LEX_AETERNA_:MAX_STACK_0) and 1 <= RealDamage then
257 linesView Formula

CommonFun.DoCalcElementDam

Lua
function CommonFun.DoCalcElementDam(srcUser, targetUser, params, damageParam)
  local srcAtkElement = CommonFun.GetUserAtkAttr(srcUser, targetUser, params, damageParam)
  if srcUser.SetTempAtkAttr ~= nil then
    srcUser:SetTempAtkAttr(srcAtkElement)
  end
10 linesView Formula

CommonFun.DoCalcStateEffectDam

Lua
function CommonFun.DoCalcStateEffectDam(srcUser, targetUser, params)
  local StateEffect = targetUser:GetProperty("StateEffect")
  local bits = CommonFun.getBits(StateEffect)
  local Weapon = srcUser:GetEquipedID(7_WEAPON)
  local RefineLv = srcUser:GetEquipedRefineLv(7_WEAPON)
210 linesView Formula