Commit 73db53c31e5ddcdfc54c491e7bad702ae5b1a6d7

Authored by zhouhaihai
1 parent 6826fdf6

天赋技能

Showing 2 changed files with 32 additions and 0 deletions   Show diff stats
src/models/HeroPlugin.lua
... ... @@ -247,6 +247,37 @@ function HeroPlugin.bind(Hero)
247 247 return level
248 248 end
249 249  
  250 + -- 天赋获得的技能
  251 + function Hero:getTalentSkill()
  252 + local TalentEnum = {
  253 + [1] = 1, -- 血量
  254 + [2] = 2, -- 攻击
  255 + [3] = 3, -- 物理防御
  256 + [4] = 4, -- 命中
  257 + [5] = 5, -- 闪避
  258 + }
  259 + local talentCsv = csvdb["unit_talent_" .. self:getProperty("type") .. "Csv"]
  260 + local curLv = self:getProperty("talent"):getv(1,1) - 1
  261 + local curRan = self:getProperty("talent"):getv(0,1)
  262 + local skills = {}
  263 + for ran, data in ipairs(talentCsv) do
  264 + if ran <= curRan then
  265 + for lv, value in ipairs(data) do
  266 + if ran < curRan or lv <= curLv then
  267 + if not TalentEnum[value.effect] then
  268 + skills[value.strength] = true
  269 + end
  270 + else
  271 + break
  272 + end
  273 + end
  274 + else
  275 + break
  276 + end
  277 + end
  278 + return skills
  279 + end
  280 +
250 281 function Hero:getSkillData(idx)
251 282 local unitData = csvdb["unitCsv"][self:getProperty("type")]
252 283 if idx == 1 then
... ...
src/models/RolePlugin.lua
... ... @@ -1283,6 +1283,7 @@ function RolePlugin.bind(Role)
1283 1283 info.specialLevel = hero:getSkillLevel(1)
1284 1284 info.passiveLevel = hero:getSkillLevel(3)
1285 1285 info.runeSkill = hero:getRuneSkill(102)
  1286 + info.talentSkills = hero:getTalentSkill()
1286 1287 teamInfo.heros[slot] = info
1287 1288 end
1288 1289 for slot, id in pairs(team.supports or {}) do
... ...