Explore ROM internal Lua formulas

1,812 formulas archived

CommonFun.Equip:new

Lua
function CommonFun.Equip:new(obj)
  obj = obj or {}
  setmetatable(obj, self)
  self.__index = self
  self.id = 0
9 linesView Formula

CommonFun.EquipBuffAndIgnoreDef

Lua
function CommonFun.EquipBuffAndIgnoreDef(skillid)
  res = {}
  if CommonFun.TableSkill2EquipBuffAndIgnoreDef[skillid] == nil then
    return res, 0
  elseif CommonFun.TableSkill2EquipBuffAndIgnoreDef[skillid].buffid == nil or CommonFun.TableSkill2EquipBuffAndIgnoreDef[skillid].IgnoreDef == nil then
10 linesView Formula

CommonFun.EquipBuffAndIgnoreMDef

Lua
function CommonFun.EquipBuffAndIgnoreMDef(skillid)
  res = {}
  if CommonFun.TableSkill2EquipBuffAndIgnoreMDef[skillid] == nil then
    return res, 0
  elseif CommonFun.TableSkill2EquipBuffAndIgnoreMDef[skillid].buffid == nil or CommonFun.TableSkill2EquipBuffAndIgnoreMDef[skillid].IgnoreMDef == nil then
10 linesView Formula

CommonFun.GetAtkAttrByArrow

Lua
function CommonFun.GetAtkAttrByArrow(itemid)
  if CommonFun.ArrowAttr == nil then
    return 0
  end
  for key, val in pairs(CommonFun.ArrowAttr) do
11 linesView Formula

CommonFun.GetAttrName

Lua
function CommonFun.GetAttrName(attrid)
  if Table_RoleData then
    local attr = Table_RoleData[attrid]
    if attr then
      return attr.VarName
9 linesView Formula

CommonFun.GetDamReduceValue

Lua
function CommonFun.GetDamReduceValue(srcUser, targetUser, value)
  local damage = value
  if damage ~= 0 then
  end
  local mapid, maptype = srcUser:GetMapInfo()
63 linesView Formula

CommonFun.GetElementRate

Lua
function CommonFun.GetElementRate(srcUser, srcAtkElement, targetUser, targetDefElement, params, damageParam)
  if srcAtkElement < 1 or 10 < srcAtkElement then
    return 0
  end
  if targetDefElement < 1 or 10 < targetDefElement then
58 linesView Formula

CommonFun.GetFormulaValue

Lua
function CommonFun.GetFormulaValue(srcUser, targetUser, type)
  if CommonFun.FormulaFuns[type] == nil then
    return 0
  end
  local func = CommonFun.FormulaFuns[type]
8 linesView Formula

CommonFun.GetMoonMark

Lua
function CommonFun.GetMoonMark(me, tar)
  if nil == me or nil == tar then
    return false
  end
  if me:HasBuffID(136361_SUN_MOON_SKILL_COOLDOWN_:MAX_STACK_0) and me:HasBuffID(136142_MOON_PLATE_BUFF_:MAX_STACK_0) then
10 linesView Formula

CommonFun.GetRandom

Lua
function CommonFun.GetRandom(array, index)
  local MAX_RANDOM_INDEX = 100
  local group = math.ceil(index / 5)
  local key = index - math.floor(index / 5) * 5
  key = key ~= 0 and key or 5
13 linesView Formula

CommonFun.GetRefineTicketType

Lua
function CommonFun.GetRefineTicketType(isNew, equipType, hasDecomposeID)
  if isNew == true then
    local isNewTypes = {
      [2] = true,
      [3] = true,
58 linesView Formula

CommonFun.GetSunMark

Lua
function CommonFun.GetSunMark(me, tar)
  if nil == me or nil == tar then
    return false
  end
  if me:HasBuffID(136361_SUN_MOON_SKILL_COOLDOWN_:MAX_STACK_0) and me:HasBuffID(136141_SUN_PLATE_BUFF_:MAX_STACK_0) then
10 linesView Formula

CommonFun.GetUserArrowAttr

Lua
function CommonFun.GetUserArrowAttr(srcUser, params)
  local skillParams = Table_Skill[params.skillIDAndLevel]
  if skillParams == nil then
    return 0
  end
33 linesView Formula

CommonFun.GetUserAtkAttr

Lua
function CommonFun.GetUserAtkAttr(srcUser, targetUser, params, damageParam)
  local skillParams = Table_Skill[params.skillIDAndLevel]
  if skillParams == nil then
    return 0
  end
89 linesView Formula

CommonFun.GetUserAtkAttrByList

Lua
function CommonFun.GetUserAtkAttrByList(srcUser, targetUser, params, damageParamList)
  if damageParamList == nil or damageParamList[1] == nil then
    return 5
  end
  return CommonFun.GetUserAtkAttr(srcUser, targetUser, params, damageParamList[1])
6 linesView Formula

CommonFun.GetUserAtkLevel

Lua
function CommonFun.GetUserAtkLevel(srcUser, element, params, damageParam)
  local srcAtkLevel = 1
  local rollType = 0
  if params ~= nil and damageParam ~= nil then
    local skillParams = Table_Skill[params.skillIDAndLevel]
19 linesView Formula

CommonFun.GetUserDefLevel

Lua
function CommonFun.GetUserDefLevel(targetUser, element)
  local targetDefLevel = 1
  if targetUser:GetNpcID() ~= 0 then
    if targetUser:GetNatureLv() ~= 0 then
      return targetUser:GetNatureLv()
15 linesView Formula

CommonFun.Inhale

Lua
function CommonFun.Inhale(srcUser, targetUser)
  if srcUser == nil or targetUser == nil then
    return 0
  end
  local A = 0
18 linesView Formula

CommonFun.IsCanBlock

Lua
function CommonFun.IsCanBlock(srcUser, targetUser)
  local srcAttrEffect = srcUser:GetProperty("AttrEffect3")
  local bits4 = CommonFun.getBits(srcAttrEffect)
  local AttrEffect4 = targetUser:GetProperty("AttrEffect3")
  local bits5 = CommonFun.getBits(AttrEffect4)
28 linesView Formula

CommonFun.IsCrit

Lua
function CommonFun.IsCrit(srcUser, targetUser, skillParams)
  local skillID = skillParams.id
  if CommonFun.RollType.Attack ~= skillParams.RollType or srcUser:IsAttackSkill(skillID) == false then
    return false
  end
26 linesView Formula