Blame view

src/models/HeroPlugin.lua 15.6 KB
8c74292c   zhouahaihai   增加item 以及 角色突破
1
2
3
4
5
  local HeroPlugin = {}
  
  
  function HeroPlugin.bind(Hero)
  
f22a33af   zhouhaihai   自己的日志
6
  	function Hero:mylog(contents)
3133cb76   zhouhaihai   日志
7
8
9
10
11
12
13
  		contents = contents or {}
  		if contents["cint1"] or contents["cint2"] or contents["cint3"] then
  			print("heroLog error log have cint1 or cint2 or cint3 ", debug.traceback())
  		end
  		contents["cint1"] = self:getProperty("id")
  		contents["cint2"] = self:getProperty("type")
  
f22a33af   zhouhaihai   自己的日志
14
  		self.owner:mylog("hero_action", contents)
3133cb76   zhouhaihai   日志
15
16
  	end
  
a43410e1   zhengshouren   整理格式,使用tab替代空格
17
18
19
20
  	function Hero:getMaxLevel()
  		return math.min(#csvdb["unit_expCsv"], csvdb["unit_breakCsv"][self:getProperty("breakL")].levelLimit)
  	end
  
028db777   zhouhaihai   属性加成
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
  
  	-- 纯% 的属性
  	local PercentAttr = {
  		crit = 6, 			-- 暴击
  		critHurt = 8, 		-- 暴伤
  		vampire = 9, 		-- 吸血
  		pierce = 10, 		-- 穿透
  	}
  	-- base 原, add 增加值 ,atype 增加类型(0 值 1%)
  	local function addAttr(base, add, atype, attrName)
  		base = base or 0
  		add = add or 0
  		if PercentAttr[attrName] then
  			atype = 0
  		end
  		if atype == 1 then
  			return base * add / 100
  		else
  			return add
  		end
  	end
  
c4262012   zhouhaihai   基础属性修改
43
  	--角色自身 = 初始 *(1+升级)*(1+突破)*(1+觉醒)+ 天赋升级 + 天赋阶段
a43410e1   zhengshouren   整理格式,使用tab替代空格
44
45
46
47
48
49
50
  	function Hero:getBaseAttrs(params)
  		params = params or {}
  		local unitData  = csvdb["unitCsv"][self:getProperty("type")]
  		local level = params.level or self:getProperty("level")
  		local breakL = params.breakL or self:getProperty("breakL")
  		local wakeL = params.wakeL or self:getProperty("wakeL")
  		local talent = params.talent or self:getProperty("talent")
96d591f7   liuzujun   天赋升级修改,增加英雄信赖
51
  		local heroCfgId = self:getProperty("type")
c4262012   zhouhaihai   基础属性修改
52
  		--天赋
a43410e1   zhengshouren   整理格式,使用tab替代空格
53
  		local talentAttrS = {}
c4262012   zhouhaihai   基础属性修改
54
  
a43410e1   zhengshouren   整理格式,使用tab替代空格
55
  		-- 四个基础属性
63190722   liuzujun   计算英雄战斗力,天赋,信赖
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
  		local cfgName = "unit_talent_"..heroCfgId.."Csv"
  		local curRank = talent:getv(0, 1)
  		local curLv = talent:getv(1,1) - 1
  		for i, value in ipairs(csvdb[cfgName]) do
  			if i <= curRank then
  				for lv, cfg in ipairs(value) do
  					if i < curRank or lv <= curLv then
  						if cfg.effect ~= 99 then
  							if not talentAttrS[cfg.effect] then
  								talentAttrS[AttsEnumEx[cfg.effect]] = 0
  							end
  							talentAttrS[AttsEnumEx[cfg.effect]] = cfg.strength
  						end
  					else
  						break
96d591f7   liuzujun   天赋升级修改,增加英雄信赖
71
72
  					end
  				end
63190722   liuzujun   计算英雄战斗力,天赋,信赖
73
74
  			else
  				break
96d591f7   liuzujun   天赋升级修改,增加英雄信赖
75
  			end
c4262012   zhouhaihai   基础属性修改
76
  		end
c4262012   zhouhaihai   基础属性修改
77
  		
cdbe8a36   zhouhaihai   天赋
78
79
  		for _, attrName in pairs(AttsEnumEx) do
  			if talentAttrS[attrName] then
8efb24c9   liuzujun   天赋系统属性加成改为百分比
80
  				talentAttrS[attrName] = addAttr(unitData[attrName], talentAttrS[attrName], 1, attrName)
96d591f7   liuzujun   天赋升级修改,增加英雄信赖
81
82
83
84
85
86
87
88
89
90
  			end
  		end
  
  		-- 信赖属性
  		local faithAttr = {}
  		local faith = self:getProperty("faith")
  		local faithConfig = csvdb["unit_trustCsv"]
  		for lvl = 1, #faithConfig do
  			if faith >= faithConfig[lvl].exp then
  				local add = faithConfig[lvl]["position_"..unitData.position]:toArray(true, "=")
63190722   liuzujun   计算英雄战斗力,天赋,信赖
91
  				faithAttr[AttsEnumEx[add[1]]] = (faithAttr[AttsEnumEx[add[1]]] or 0) + add[2]
cdbe8a36   zhouhaihai   天赋
92
  			end
c4262012   zhouhaihai   基础属性修改
93
  		end
8efb24c9   liuzujun   天赋系统属性加成改为百分比
94
95
96
97
98
  		for _, attrName in pairs(AttsEnumEx) do
  			if faithAttr[attrName] then
  				faithAttr[attrName] = addAttr(unitData[attrName], faithAttr[attrName], 1, attrName)
  			end
  		end
a43410e1   zhengshouren   整理格式,使用tab替代空格
99
  
c4262012   zhouhaihai   基础属性修改
100
101
102
103
104
105
106
  		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]
a43410e1   zhengshouren   整理格式,使用tab替代空格
107
108
  		local wData = csvdb["unit_wakeCsv"][wakeL]
  		for attr, value in pairs(attrs) do
028db777   zhouhaihai   属性加成
109
110
  			attrs[attr] = attrs[attr] + addAttr(attrs[attr], lData[attr .. "Level"], 1, attr)
  			attrs[attr] = attrs[attr] + addAttr(attrs[attr], blData[attr .. "Level"], 1, attr)
96d591f7   liuzujun   天赋升级修改,增加英雄信赖
111
  			attrs[attr] = attrs[attr] + addAttr(attrs[attr], wData[attr .. "Level"], 1, attr) + (talentAttrS[attr] or 0) + (faithAttr[attr] or 0)
a43410e1   zhengshouren   整理格式,使用tab替代空格
112
113
114
115
116
  		end
  
  		return attrs
  	end
  
ece975b6   zhouhaihai   属性计算
117
  
699f4a74   zhouhaihai   属性公式修改
118
  	--当前属性 = 角色属性值 * (1 + 装备套装(百分比) + 铭文套装(百分比))+ (装备(固定)+ 铭文(固定))
a43410e1   zhengshouren   整理格式,使用tab替代空格
119
  	function Hero:getTotalAttrs(params)
b53593b5   zhouhaihai   羁绊加成
120
  		params = params or {}
a43410e1   zhengshouren   整理格式,使用tab替代空格
121
  		local attrs = self:getBaseAttrs()
ece975b6   zhouhaihai   属性计算
122
123
  		-- 装备零件
  		local equipAttrs = self:getRuneEquipAttrs()
3d8468b2   liuzujun   火花系统
124
  		local sparkAttrs = self:getSparkAttrs()
ece975b6   zhouhaihai   属性计算
125
126
  
  		for _, attName in pairs(AttsEnumEx) do
028db777   zhouhaihai   属性加成
127
  			attrs[attName] = attrs[attName] or 0
028db777   zhouhaihai   属性加成
128
  			attrs[attName] = attrs[attName] + addAttr(attrs[attName], equipAttrs.percent[attName], 1, attName)
699f4a74   zhouhaihai   属性公式修改
129
  			attrs[attName] = attrs[attName] + addAttr(attrs[attName], equipAttrs.value[attName], 0, attName)
3d8468b2   liuzujun   火花系统
130
  			attrs[attName] = attrs[attName] + addAttr(attrs[attName], sparkAttrs[attName], 0, attName)
ece975b6   zhouhaihai   属性计算
131
132
  		end
  
b53593b5   zhouhaihai   羁绊加成
133
  		-- 羁绊加成
e8ca14c4   zhouhaihai   羁绊加成去掉
134
135
136
137
138
  	   --  if params.activeRelation then
  	   --      for k, attName in pairs(AttsEnumEx) do
  				-- attrs[attName] = attrs[attName] + addAttr(attrs[attName], params.activeRelation[attName], 1, attName)
  	   --      end
  	   --  end
ece975b6   zhouhaihai   属性计算
139
140
141
142
143
  		return attrs
  	end
  
  	-- 当前零件和装备增加属性
  	function Hero:getRuneEquipAttrs()
acfc2f02   zhouhaihai   零件套装增加冒险战斗被动
144
  		local attrs = {value = {}, percent = {}}
ece975b6   zhouhaihai   属性计算
145
146
  		for _, attName in pairs(AttsEnumEx) do
  			attrs.value[attName] = 0
acfc2f02   zhouhaihai   零件套装增加冒险战斗被动
147
  			attrs.percent[attName] = 0
ece975b6   zhouhaihai   属性计算
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
  		end
  		local equipSuits = {}
  		-- 装备效果
  		for typ,level in pairs(self:getProperty("equip"):toNumMap()) do
  			if level > 0 then
  				local data = csvdb["equipCsv"][typ][level]
  				for k,v in pairs(data.attr1:toNumMap()) do
  					attrs.value[AttsEnumEx[k]] = attrs.value[AttsEnumEx[k]] + v
  				end
  				for k,v in pairs(data.attr2:toNumMap()) do
  					attrs.value[AttsEnumEx[k]] = attrs.value[AttsEnumEx[k]] + v
  				end
  				if data.suit ~= "" then
  					if not equipSuits[data.suit] then equipSuits[data.suit] = {} end
  					table.insert(equipSuits[data.suit], data)
  				end
  			end
  		end
  		-- 装备套装效果
  		for suitId,eDatas in pairs(equipSuits) do
  			local suitCsv = csvdb["equip_suitCsv"][tonumber(suitId)]
  			if suitCsv then 
  				local effects = suitCsv.effect:toTableArray(true)
  				local count = #eDatas
  				if count >= 2 then
acfc2f02   zhouhaihai   零件套装增加冒险战斗被动
173
  					attrs.percent[AttsEnumEx[effects[1][1]]] = attrs.percent[AttsEnumEx[effects[1][1]]] + effects[1][2]
ece975b6   zhouhaihai   属性计算
174
175
  				end
  				if count >= 3 then
acfc2f02   zhouhaihai   零件套装增加冒险战斗被动
176
  					attrs.percent[AttsEnumEx[effects[2][1]]] = attrs.percent[AttsEnumEx[effects[2][1]]] + effects[1][2]
ece975b6   zhouhaihai   属性计算
177
178
  				end
  				if count >= 4 then
acfc2f02   zhouhaihai   零件套装增加冒险战斗被动
179
  					attrs.percent[AttsEnumEx[effects[3][1]]] = attrs.percent[AttsEnumEx[effects[3][1]]] + effects[3][2]
ece975b6   zhouhaihai   属性计算
180
181
182
183
  				end
  			end
  		end
  		-- 零件效果
031dcf99   zhouhaihai   修改战斗属性计算 冒险增加效果类型
184
185
186
187
  	    local suits = {}
  	    for _, uid in pairs(self:getProperty("rune"):toNumMap()) do
  	        if uid > 0 then
  	            local rune = self.owner.runeBag[uid]
b3a55168   liuzujun   复仇胜利需要扣除门票或次数
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
                  if not rune then
                      skynet.error(string.format("rune not exist,uid:%s,hero:%s,roleId:%s", uid, self:getProperty("id"), self:getProperty("roleid")))
                  else
                      local csvData = csvdb["runeCsv"][rune:getProperty("type")][rune:getProperty("id")]
                      local runeRareData = csvdb["rune_rareCsv"][csvData.rarity]
                      local buildData = csvdb["rune_buildCsv"][rune:getProperty("level")]
                      for k, v in pairs(rune:getProperty("attrs"):toNumMap()) do
                          local attName = AttsEnumEx[k]
                          --零件的加成属性有特殊需求 填的是 10倍的值
                          --rare的effect不影响 特殊属性
  
                          --铭文单件普通属性=attr*(1+[rune_build表effect]/100*[rune_rare表effect]/100)
                          --铭文单件特殊属性=attr+[rune_build表effect]
  
                          local effect = buildData[attName]
                          if not PercentAttr[attName] then
                              effect = buildData[attName] * runeRareData.effect / 100
                          end
                          attrs.value[attName] = attrs.value[attName] + (v / 100) + addAttr(v / 100, effect, 1, attName)
                      end
                      
                      if not suits[csvData.suit] then suits[csvData.suit] = {} end
                      table.insert(suits[csvData.suit],csvData)
                  end
031dcf99   zhouhaihai   修改战斗属性计算 冒险增加效果类型
212
213
  	        end
  	    end
ece975b6   zhouhaihai   属性计算
214
215
216
217
218
219
  		-- 零件套装效果
  		for suitId,runeDatas in pairs(suits) do
  			local suitCsv = csvdb["rune_suitCsv"][tonumber(suitId)]
  			if suitCsv then
  				local effects = suitCsv.effect:toTableArray(true)
  				local count = #runeDatas
acfc2f02   zhouhaihai   零件套装增加冒险战斗被动
220
221
222
223
224
  				if count >= 2 and AttsEnumEx[effects[1][1]]then
  					attrs.percent[AttsEnumEx[effects[1][1]]] = attrs.percent[AttsEnumEx[effects[1][1]]] + effects[1][2]
  				end
  				if count >= 4 and AttsEnumEx[effects[2][1]] then
  					attrs.percent[AttsEnumEx[effects[2][1]]] = attrs.percent[AttsEnumEx[effects[2][1]]] + effects[2][2]
ece975b6   zhouhaihai   属性计算
225
  				end
acfc2f02   zhouhaihai   零件套装增加冒险战斗被动
226
227
  				if count >= 6 and AttsEnumEx[effects[3][1]] then
  					attrs.percent[AttsEnumEx[effects[3][1]]] = attrs.percent[AttsEnumEx[effects[3][1]]] + effects[3][2]
ece975b6   zhouhaihai   属性计算
228
229
230
  				end
  			end
  		end
a43410e1   zhengshouren   整理格式,使用tab替代空格
231
232
  		return attrs
  	end
ece975b6   zhouhaihai   属性计算
233
  
3d8468b2   liuzujun   火花系统
234
235
236
237
238
  	function Hero:getSparkAttrs()
  		local attrs = {}
  		for _, attName in pairs(AttsEnumEx) do
  			attrs[attName] = 0
  		end
3dbe0d5d   zhouhaihai   #fxtr_10186 修复两个bug
239
240
  		for _, data in pairs(self:getProperty("spark") or {}) do
  			for k, v in pairs(data.attrs) do
3d8468b2   liuzujun   火花系统
241
242
243
244
245
246
  				attrs[AttsEnumEx[k]] = attrs[AttsEnumEx[k]] + v
  			end
  		end
  		return attrs
  	end
  
475a6d03   zhouhaihai   战斗力
247
  
17d9316a   zhouhaihai   修改 公式
248
  	-- 战斗力(当前属性)= POWER[(生命 + 防御 * 7 + 闪避 * 4)*(攻击*4 + 命中 * 2)*(1 + 暴击几率/100 * 暴击伤害/100)* 攻击速度 / 60000 ,0.8 ]
e8ca14c4   zhouhaihai   羁绊加成去掉
249
250
251
252
  	-- function Hero:getBattleValue(activeRelation) -- isReal包括队伍加成
  	function Hero:getBattleValue() -- isReal包括队伍加成
  	    -- local attrs = self:getTotalAttrs({activeRelation = activeRelation})
  	    local attrs = self:getTotalAttrs()
17d9316a   zhouhaihai   修改 公式
253
  	    local battleValue = ((attrs["hp"] + attrs["def"] * 7 + attrs["miss"] * 4) * (attrs["atk"] * 4 + attrs["hit"] * 2) * (1 + attrs["crit"]/100 * attrs["critHurt"]/100) * attrs["atkSpeed"] / 600000) ^ 0.8
475a6d03   zhouhaihai   战斗力
254
  	    return math.floor(battleValue)
a43410e1   zhengshouren   整理格式,使用tab替代空格
255
256
257
258
259
260
261
262
263
264
  	end
  
  	function Hero:saveBattleValue()
  		local battleValue = self:getBattleValue()
  		if battleValue ~= self:getProperty("battleV") then
  			self:setProperty("battleV", battleValue)
  		end
  		return battleValue
  	end
  
1c35c4cf   gaofengduan   fix hero awake
265
  	-- 技能1234 对应必杀技,冒险技,被动技,战斗技
a43410e1   zhengshouren   整理格式,使用tab替代空格
266
  	function Hero:getSkillLevel(idx)
0889982f   zhouhaihai   优化角色技能等级
267
268
269
270
271
272
273
274
275
276
  		local level = 1
  		for wakeL = 1, self:getProperty("wakeL") do
  			local wakeData = csvdb["unit_wakeCsv"][wakeL]
  			for _, slot in ipairs(wakeData.skill:toArray(true,"=")) do
  				if slot == idx then
  					level = level + 1
  				end
  			end
  		end
  		return level
a43410e1   zhengshouren   整理格式,使用tab替代空格
277
278
  	end
  
73db53c3   zhouhaihai   天赋技能
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
  	-- 天赋获得的技能
  	function Hero:getTalentSkill()
  		local TalentEnum = {
  			[1] = 1,			-- 血量
  			[2] = 2,			-- 攻击
  			[3] = 3,			-- 物理防御
  			[4] = 4,			-- 命中
  			[5] = 5, 			-- 闪避
  		}
  	    local talentCsv = csvdb["unit_talent_" .. self:getProperty("type") .. "Csv"]
  	    local curLv = self:getProperty("talent"):getv(1,1) - 1
  	    local curRan = self:getProperty("talent"):getv(0,1)
  	    local skills = {}
  	    for ran, data in ipairs(talentCsv) do
  	        if ran <= curRan then
  	            for lv, value in ipairs(data) do
  	                if ran < curRan or lv <= curLv then
  	                    if not TalentEnum[value.effect] then
  	                        skills[value.strength] = true
  	                    end
  	                else
  	                    break
  	                end
  	            end
  	        else
  	            break
  	        end
  	    end
  	    return skills
  	end
  
f2fa488d   wangyujie   删除skin相关
310
  	function Hero:getSkillData(idx)
1c35c4cf   gaofengduan   fix hero awake
311
  		local unitData = csvdb["unitCsv"][self:getProperty("type")]
a43410e1   zhengshouren   整理格式,使用tab替代空格
312
  		if idx == 1 then
a43410e1   zhengshouren   整理格式,使用tab替代空格
313
  			return csvdb["skill_specialCsv"][unitData.special]
1c35c4cf   gaofengduan   fix hero awake
314
  		elseif idx == 2 then
61421173   zhouhaihai   冒险技能取战斗的
315
  			return csvdb["adv_battle_specialCsv"][unitData.adv]
1c35c4cf   gaofengduan   fix hero awake
316
317
318
319
  		elseif idx == 3 then
  			return csvdb["skill_passiveCsv"][unitData.passive]
  		elseif idx == 4 then
  			return csvdb["skill_blockCsv"][unitData.block]
a43410e1   zhengshouren   整理格式,使用tab替代空格
320
321
322
  		end
  		return {}
  	end
a6508219   zhouhaihai   挂机奖励
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
  
  	function Hero:getRunes()
  	    local rune = self:getProperty("rune")
  	    if not rune or rune == "" then
  	        rune = "1=0 2=0 3=0 4=0 5=0 6=0"
  	    end
  	    local result = rune:toNumMap()
  	    for i = 1, 6 do
  	        if not result[i] then
  	            result[i] = 0
  	        end
  	    end
  	    return result
  	end
  
  	-- 101 冒险战斗被动技
  	-- 102 挂机战斗被动技
  	function Hero:getRuneSkill(skillType)
  	    local suits = {}
  	    for _,uid in pairs(self:getRunes()) do
  	        if uid > 0 then
  	            local runeData = self.owner.runeBag[uid]
  	            if not runeData then return  end
02538652   zhouhaihai   复制bug
346
  	            local csvData = csvdb["runeCsv"][runeData:getProperty("type")][runeData:getProperty("id")]
a6508219   zhouhaihai   挂机奖励
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
  	            if not suits[csvData.suit] then suits[csvData.suit] = {} end
  	            table.insert(suits[csvData.suit],csvData)
  	        end
  	    end
  
  	    for suitId,runes in pairs(suits) do
  	        local suitCsv = csvdb["rune_suitCsv"][tonumber(suitId)]
  	        if not suitCsv then return  end
  	        local effects = suitCsv.effect:toTableArray(true)
  	        local count = #runes
  	        if count >= 2 and effects[1][1] == skillType then
  	            return effects[1][2]
  	        end
  	        if count >= 4 and effects[2][1] == skillType then
  	            return effects[2][2]
  	        end
  	        if count >= 6 and effects[3][1] == skillType then
  	            return effects[3][2]
  	        end
  	    end
  	    return
  	end
96d591f7   liuzujun   天赋升级修改,增加英雄信赖
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
  
  	-- 添加英雄信赖
  	function Hero:addHeroFaith(exp)
  		local faith = self:getProperty("faith")
  		local config = csvdb["unit_trustCsv"]
  		local star = self:getProperty("wakeL")
  		local tmpExp = faith + exp
  		for lvl = 1, #config do
  			if star < config[lvl].star then
  				break
  			end
  			if tmpExp < config[lvl].exp then
  				faith = tmpExp
  				break
  			else
  				faith = config[lvl].exp
  			end
  		end
  		self:setProperty("faith", faith)
70fb62d1   liuzujun   服务器数据打点
388
  		self:mylog({desc = "addFaith", int1 = exp})
96d591f7   liuzujun   天赋升级修改,增加英雄信赖
389
390
  	end
  
659fe200   zhangqijia   feat: 天赋点
391
392
393
394
395
396
397
398
399
400
  	--检验天赋树是否合理
  	function Hero:checkGeniusTree(genius)
  		local maxWakeL = 0
  		local star = self:getProperty("wakeL")
  		if star < 4 then return maxWakeL end
  		if #genius == 0 then return maxWakeL end
  
  		local geniusTree = genius:toNumMap()
  		local tmpgenius = ""
  		for wakeL, val in pairs(geniusTree) do
659fe200   zhangqijia   feat: 天赋点
401
402
403
  			if wakeL < 4 then return maxWakeL end
  			if wakeL % 2 == 0 then
  				if geniusTree[wakeL+1] and geniusTree[wakeL+1] ~= val then
47343863   zhangqijia   fix: 天赋点自动升级,重置觉醒...
404
  					return 0, 0, tmpgenius
659fe200   zhangqijia   feat: 天赋点
405
406
407
408
409
410
411
412
413
  				end
  			end
  			maxWakeL = math.max(maxWakeL, wakeL)
  			if #tmpgenius == 0 then
  				tmpgenius = string.format("%s=%s", tostring(wakeL), tostring(val))
  			else
  				tmpgenius = string.format("%s %s=%s", tmpgenius, tostring(wakeL), tostring(val))
  			end
  		end
47343863   zhangqijia   fix: 天赋点自动升级,重置觉醒...
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
  		return tonumber(maxWakeL), tonumber(geniusTree[maxWakeL]), tmpgenius
  	end
  
  	function Hero:increGeniusTree()
  		local genius = self:getProperty("genius")
  		local wakeL = self:getProperty("wakeL")
  		local maxWakeL, awake
  		maxWakeL, awake, genius = self:checkGeniusTree(genius)
  		if maxWakeL >= 4 and wakeL > maxWakeL and maxWakeL % 2 == 0 then
  			maxWakeL = maxWakeL + 1
  			if #genius == 0 then
  				genius = string.format("%s=%s", tostring(maxWakeL), tostring(awake))
  			else
  				genius = string.format("%s %s=%s", genius, tostring(maxWakeL), tostring(awake))
  			end
  		end
  		return genius
  	end
  
  	function Hero:resetGeniusTree()
  		local unit_starTalent_reset = globalCsv["unit_starTalent_reset"]
  		local cost = unit_starTalent_reset:toNumMap()
  		if not self.owner:checkItemEnough(cost) then return false end
  
7cbae6f3   zhangqijia   fix: Role:costIte...
438
  		if not self.owner:costItems(cost, {log = {desc = "heroGenius", int1 = self:getProperty("id"), int2 = self:getProperty("type")}})  then return false end
47343863   zhangqijia   fix: 天赋点自动升级,重置觉醒...
439
  		return true
659fe200   zhangqijia   feat: 天赋点
440
441
442
443
  	end
  
  	function Hero:saveGeniusTree(wakeL, awake)
  		local genius = self:getProperty("genius")
47343863   zhangqijia   fix: 天赋点自动升级,重置觉醒...
444
445
446
447
448
449
  		local typ = self:getProperty("type")
  		local curWakeL = self:getProperty("wakeL")
  		if not wakeL or not awake then
  			if self:resetGeniusTree() == true then return "" end
  			return genius
  		end
659fe200   zhangqijia   feat: 天赋点
450
  
47343863   zhangqijia   fix: 天赋点自动升级,重置觉醒...
451
  		local heroUnit = csvdb["unitCsv"][typ]
659fe200   zhangqijia   feat: 天赋点
452
453
454
455
456
457
458
459
460
  		if not heroUnit then return genius end
  		if not heroUnit.awake_1 or not heroUnit.awake_2 then return genius end
  
  		if #genius == 0 then
  			genius = string.format("%s=%s", tostring(wakeL), tostring(awake))
  		else
  			genius = string.format("%s %s=%s", genius, tostring(wakeL), tostring(awake))
  		end
  
47343863   zhangqijia   fix: 天赋点自动升级,重置觉醒...
461
462
  		local maxWakeL
  		maxWakeL, _, genius = self:checkGeniusTree(genius)
a2df11d6   zhangqijia   fix: 修复天赋点 在6星的时候...
463
  		if maxWakeL == 0 then
659fe200   zhangqijia   feat: 天赋点
464
  			genius = self:getProperty("genius")
47343863   zhangqijia   fix: 天赋点自动升级,重置觉醒...
465
  		else
a2df11d6   zhangqijia   fix: 修复天赋点 在6星的时候...
466
467
  			if curWakeL > wakeL and wakeL % 2 == 0 then --自动升一级,举例,6星设置4星觉醒技能。自动升级到5星
  				genius = string.format("%s %s=%s", genius, tostring(wakeL + 1), tostring(awake))
47343863   zhangqijia   fix: 天赋点自动升级,重置觉醒...
468
469
  				maxWakeL, _, genius = self:checkGeniusTree(genius)
  			end
659fe200   zhangqijia   feat: 天赋点
470
471
472
473
  		end
  		return genius
  	end
  
8c74292c   zhouahaihai   增加item 以及 角色突破
474
475
476
477
  end
  
  
  return HeroPlugin