搜索
查看: 1323|回复: 3

[已关闭] on_GetAttackPower(actor, nPoint)方法

 关闭 [复制链接]
发表于 2020-10-13 20:07:23 | 显示全部楼层 |阅读模式
BUG反馈
引擎版本号: 0814
登陆器版本号: 0814
BUG描述: --计算攻击威力(返回输出威力)
function on_GetAttackPower(actor, nPoint)
local incPoint = 0

local RaceId = actor:getRace()--种族ID
if (RaceId == 66) or (RaceId == 0) then--(英雄或人物)按角色的幸运值,进行威力加倍输出
local luck = actor:getLuck()--取人物的幸运值
if luck > 7 then
if luck > 10 then
incPoint= math.round(nPoint * 1.5)
elseif luck == 10 then
incPoint= math.round(nPoint * 1.3)
elseif luck == 9 then
incPoint= math.round(nPoint * 1.2)
elseif luck == 8 then
incPoint= math.round(nPoint * 1.1)
end
print("["..actor:getCharName().."]幸运值["..tostring(luck).."]造成威力加层["..tostring(incPoint).."]--[计算攻击威力(返回输出威力)]")
end
end

return nPoint + incPoint
end

=====M2报错===============
attempt to concatenate local 'nPoint' (a userdata value)
stack traceback:

意思是 nPoint返回类型有问题?
BUG重现方式: 每次攻击都能反馈
修复后应达到的效果: nPoint 数字型
联系QQ: 隐藏内容

 楼主| 发表于 2020-10-13 20:08:37 | 显示全部楼层
我好像知道了
 楼主| 发表于 2020-10-13 20:13:22 | 显示全部楼层
function on_GetAttackPower(actor, Target, nPoint)
  local incPoint = 0

  local RaceId = actor:getRace()--种族ID
  if (RaceId == 66) or (RaceId == 0) then--(英雄或人物)按角色的幸运值,进行威力加倍输出
    local luck = actor:getLuck()--取人物的幸运值
    if luck > 7 then
          if   luck > 10 then
            incPoint= math.round(nPoint * 1.5)
          elseif   luck == 10 then
                incPoint= math.round(nPoint * 1.3)
          elseif   luck == 9 then
                incPoint= math.round(nPoint * 1.2)
          elseif   luck == 8 then
           incPoint= math.round(nPoint * 1.1)
          end  
      print("["..actor:getCharName().."]幸运值["..tostring(luck).."]造成威力加成["..tostring(incPoint).."]--[计算攻击威力(返回输出威力)]")       
    end
  end

  return   nPoint + incPoint
end
发表于 2020-10-18 13:05:19 | 显示全部楼层
改下函数参数

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有账号?立即注册

x
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

手机版|小黑屋|HGEM2论坛

GMT+8, 2025-6-10 02:19 , Processed in 0.456704 second(s), 16 queries .

Powered by Discuz! X3.4

Copyright © 2001-2023, Tencent Cloud.

快速回复 返回顶部 返回列表