Commit 85b487297470b41bf4d9f8eaaf1b1c19eb2880f0

Authored by zhouhaihai
2 parents 87fdc7fb c4262012

Merge branch 'develop' into qa

Showing 1 changed file with 23 additions and 29 deletions   Show diff stats
src/models/HeroPlugin.lua
... ... @@ -18,7 +18,7 @@ function HeroPlugin.bind(Hero)
18 18 return math.min(#csvdb["unit_expCsv"], csvdb["unit_breakCsv"][self:getProperty("breakL")].levelLimit)
19 19 end
20 20  
21   - --角色属性值 = 基础属性值(unit)* [ 1 + 升级属性(unit_exp)+ 突破属性(unit_break)] * [ 1 + 觉醒属性(unit_wake)+ 天赋属性(unit_talent)]
  21 + --角色自身 = 初始 *(1+升级)*(1+突破)*(1+觉醒)+ 天赋升级 + 天赋阶段
22 22 function Hero:getBaseAttrs(params)
23 23 params = params or {}
24 24 local unitData = csvdb["unitCsv"][self:getProperty("type")]
... ... @@ -27,25 +27,9 @@ function HeroPlugin.bind(Hero)
27 27 local wakeL = params.wakeL or self:getProperty("wakeL")
28 28 local talent = params.talent or self:getProperty("talent")
29 29  
30   -
31   - local attrs = {}
32   - for _, attName in pairs(AttsEnumEx) do
33   - attrs[attName] = unitData[attName] or 0
34   - end
35   - local lData = csvdb["unit_expCsv"][level]
36   - local blData = csvdb["unit_breakCsv"][breakL]
37   - -- core
38   - for attr, value in pairs(attrs) do
39   - attrs[attr] = attrs[attr] * (100 + (lData[attr .. "Level"] or 0) + (blData[attr .. "Level"] or 0)) / 100
40   - end
41   -
  30 + --天赋
42 31 local talentAttrS = {}
43   - -- 天赋阶段属性
44   - for i = 1, (talent:getv(0, 1) - 1) do
45   - local curData = csvdb["unit_talentCsv"][i]
46   - local effect = curData[#curData].effect:toArray(true, "=")
47   - talentAttrS[AttsEnumEx[effect[1]]] = (talentAttrS[AttsEnumEx[effect[1]]] or 0) + effect[2]
48   - end
  32 +
49 33 -- 四个基础属性
50 34 local curData = csvdb["unit_talentCsv"][talent:getv(0, 1)]
51 35 if not curData then -- 已经满阶段了
... ... @@ -59,20 +43,30 @@ function HeroPlugin.bind(Hero)
59 43 talentAttrS[AttsEnumEx[i]] = (talentAttrS[AttsEnumEx[i]] or 0) + curData[talent:getv(i, 0)].strength
60 44 end
61 45 end
  46 + --阶段属性
  47 + for i = 1, (talent:getv(0, 1) - 1) do
  48 + local curData = csvdb["unit_talentCsv"][i]
  49 + local effect = curData[#curData].effect:toArray(true, "=")
  50 + talentAttrS[AttsEnumEx[effect[1]]] = (talentAttrS[AttsEnumEx[effect[1]]] or 0) + effect[2]
  51 + end
62 52  
63   - --好感度
64   - local loveUp = {}
65   - -- for i = 0, self:getProperty("loveL") do
66   - -- local reward = csvdb["unit_love_effectCsv"][i]["reward"]
67   - -- for attrId, value in pairs(reward:toNumMap()) do
68   - -- loveUp[AttsEnumEx[attrId]] = (loveUp[AttsEnumEx[attrId]] or 0) + value
69   - -- end
70   - -- end
  53 +
  54 + for i = 1, 4 do
  55 + talentAttrS[AttsEnumEx[i]] = (unitData[AttsEnumEx[i]] or 0) * talentAttrS[AttsEnumEx[i]]
  56 + end
71 57  
72   - --觉醒
  58 + local attrs = {}
  59 + for _, attName in pairs(AttsEnumEx) do
  60 + attrs[attName] = unitData[attName] or 0
  61 + end
  62 + --升级、突破、觉醒
  63 + local lData = csvdb["unit_expCsv"][level]
  64 + local blData = csvdb["unit_breakCsv"][breakL]
73 65 local wData = csvdb["unit_wakeCsv"][wakeL]
74 66 for attr, value in pairs(attrs) do
75   - attrs[attr] = attrs[attr] * (100 + (wData[attr .. "Level"] or 0) + (talentAttrS[attr] or 0) + (loveUp[attr] or 0)) / 100
  67 + attrs[attr] = attrs[attr] * (1 + (lData[attr .. "Level"] or 0) / 100)
  68 + * (1 + (blData[attr .. "Level"] or 0) / 100)
  69 + * (1 + (wData[attr .. "Level"] or 0) / 100) + (talentAttrS[attr] or 0)
76 70 end
77 71  
78 72 return attrs
... ...