diff --git a/src/models/HeroPlugin.lua b/src/models/HeroPlugin.lua index dda60d2..69330cc 100644 --- a/src/models/HeroPlugin.lua +++ b/src/models/HeroPlugin.lua @@ -18,7 +18,7 @@ function HeroPlugin.bind(Hero) return math.min(#csvdb["unit_expCsv"], csvdb["unit_breakCsv"][self:getProperty("breakL")].levelLimit) end - --角色属性值 = 基础属性值(unit)* [ 1 + 升级属性(unit_exp)+ 突破属性(unit_break)] * [ 1 + 觉醒属性(unit_wake)+ 天赋属性(unit_talent)] + --角色自身 = 初始 *(1+升级)*(1+突破)*(1+觉醒)+ 天赋升级 + 天赋阶段 function Hero:getBaseAttrs(params) params = params or {} local unitData = csvdb["unitCsv"][self:getProperty("type")] @@ -27,25 +27,9 @@ function HeroPlugin.bind(Hero) local wakeL = params.wakeL or self:getProperty("wakeL") local talent = params.talent or self:getProperty("talent") - - local attrs = {} - for _, attName in pairs(AttsEnumEx) do - attrs[attName] = unitData[attName] or 0 - end - local lData = csvdb["unit_expCsv"][level] - local blData = csvdb["unit_breakCsv"][breakL] - -- core - for attr, value in pairs(attrs) do - attrs[attr] = attrs[attr] * (100 + (lData[attr .. "Level"] or 0) + (blData[attr .. "Level"] or 0)) / 100 - end - + --天赋 local talentAttrS = {} - -- 天赋阶段属性 - for i = 1, (talent:getv(0, 1) - 1) do - local curData = csvdb["unit_talentCsv"][i] - local effect = curData[#curData].effect:toArray(true, "=") - talentAttrS[AttsEnumEx[effect[1]]] = (talentAttrS[AttsEnumEx[effect[1]]] or 0) + effect[2] - end + -- 四个基础属性 local curData = csvdb["unit_talentCsv"][talent:getv(0, 1)] if not curData then -- 已经满阶段了 @@ -59,20 +43,30 @@ function HeroPlugin.bind(Hero) talentAttrS[AttsEnumEx[i]] = (talentAttrS[AttsEnumEx[i]] or 0) + curData[talent:getv(i, 0)].strength end end + --阶段属性 + for i = 1, (talent:getv(0, 1) - 1) do + local curData = csvdb["unit_talentCsv"][i] + local effect = curData[#curData].effect:toArray(true, "=") + talentAttrS[AttsEnumEx[effect[1]]] = (talentAttrS[AttsEnumEx[effect[1]]] or 0) + effect[2] + end - --好感度 - local loveUp = {} - -- for i = 0, self:getProperty("loveL") do - -- local reward = csvdb["unit_love_effectCsv"][i]["reward"] - -- for attrId, value in pairs(reward:toNumMap()) do - -- loveUp[AttsEnumEx[attrId]] = (loveUp[AttsEnumEx[attrId]] or 0) + value - -- end - -- end + + for i = 1, 4 do + talentAttrS[AttsEnumEx[i]] = (unitData[AttsEnumEx[i]] or 0) * talentAttrS[AttsEnumEx[i]] + end - --觉醒 + local attrs = {} + for _, attName in pairs(AttsEnumEx) do + attrs[attName] = unitData[attName] or 0 + end + --升级、突破、觉醒 + local lData = csvdb["unit_expCsv"][level] + local blData = csvdb["unit_breakCsv"][breakL] local wData = csvdb["unit_wakeCsv"][wakeL] for attr, value in pairs(attrs) do - attrs[attr] = attrs[attr] * (100 + (wData[attr .. "Level"] or 0) + (talentAttrS[attr] or 0) + (loveUp[attr] or 0)) / 100 + attrs[attr] = attrs[attr] * (1 + (lData[attr .. "Level"] or 0) / 100) + * (1 + (blData[attr .. "Level"] or 0) / 100) + * (1 + (wData[attr .. "Level"] or 0) / 100) + (talentAttrS[attr] or 0) end return attrs -- libgit2 0.21.2