46fac6f1
 
  zhouahaihai
 
酱料
 | 
1
2
3
4
5 
 | 
  
  local Buff = class("Buff")
  
  Buff.HP_CHANGE = 1  --生命变化(每回合生效)
  Buff.HP_MAX_CHANGE = 2	--生命上限变化(状态)
 
 | 
0d405dc3
 
  suhongyang
 
Buff生命周期调整,被动加buf...
 | 
6 
 | 
  Buff.ATTR_CHANGE = 3 --属性变化(状态)
 
 | 
46fac6f1
 
  zhouahaihai
 
酱料
 | 
7
8
9
10
11
12
13
14
15
16
17 
 | 
  Buff.IMMNUE_ATK = 4 -- 免疫普通攻击
  Buff.BACK_HURT = 5 -- 伤害反弹
  Buff.HURT_CHANGE = 6 -- 伤害变化
  Buff.INJURED_CHANGE = 7 -- 受伤变化
  Buff.HURT_TRANSFER = 8 -- 侍宠(转移自己受到的伤害)
  Buff.HURT_ABSORB = 9 -- 舍身(吸收他人受到的伤害)
  Buff.CANT_BACK_ATK = 10 -- 无法反击
  Buff.IMMNUE_BUFF = 11 -- 免疫buff
  Buff.CLEAR_BUFF = 12 -- 清除buff
  Buff.CANT_SKILL = 13 -- 禁止技能
  Buff.OPEN_BLOCK = 14 -- 翻开格子(每回合)
 
 | 
3b0526d2
 
  zhouhaihai
 
冒险demo
 | 
18 
 | 
  Buff.SP_CHANGE = 15 -- sp变化(每回合)
 
 | 
6cd12079
 
  suhongyang
 
扣血buff立刻生效
 | 
19 
 | 
  Buff.HP_CHANGE_NOW = 16 -- 生命变化(每回合生效,立刻生效)
 
 | 
e90b4d20
 
  zhouhaihai
 
战斗buff
 | 
20 
 | 
  Buff.BATTLE_BUFF = 17 -- 切换为战斗中的buff
 
 | 
7828ffd0
 
  zhouhaihai
 
冒险 连续选择点 和 地图因子
 | 
21 
 | 
  Buff.CHANGE_DROP = 18 -- 转换掉落
 
 | 
b176d7d3
 
  zhouhaihai
 
冒险成就
 | 
22 
 | 
  Buff.BATTLE_PASSIVE = 19 -- 切换为战斗中的被动技
 
 | 
a95b35ce
 
  zhouhaihai
 
删除等级
 | 
23 
 | 
  -- Buff.EXP_ADD = 20 -- 增加exp(每回合)
 
 | 
4f0a5fae
 
  zhouhaihai
 
营养剂
 | 
24 
 | 
  Buff.DONT_DEFEND = 21 -- 不看守地板 -- 怪周围点半可点击
 
 | 
0c2770e4
 
  zhouhaihai
 
bug  扫雷buff
 | 
25 
 | 
  Buff.SHOW_DANGER = 22 -- 扫雷 展示地上怪物和陷阱数量的标记
 
 | 
35e2e3c4
 
  zhouhaihai
 
优化 gm advt  增加感知b...
 | 
26 
 | 
  Buff.SHOW_MONSTER_POS = 23 -- 蓝臂章训练场 感知
 
 | 
4f0a5fae
 
  zhouhaihai
 
营养剂
 | 
27
28
29 
 | 
  Buff.EXP_UP = 24 -- 杀敌经验提高
  Buff.DISABLE_BUFF = 25 -- 禁用固有技
  Buff.ATTR_CHANGE_COND = 26 --属性变化(状态)有条件
 
 | 
db3c56ad
 
  zhouhaihai
 
冒险相关
 | 
30 
 | 
  Buff.CHANGE_DROP_TO_CLICK = 27 --掉落转换为click
 
 | 
98761edc
 
  zhouhaihai
 
buff 补充
 | 
31
32
33 
 | 
  Buff.SP_MAX_CHANGE = 28 -- 魔法上限
  Buff.ITEM_GET_UP = 29 -- 获得道具数量增加
  Buff.Buff_EFFECT_CHANGE = 30 -- 改变 buff 效果
 
 | 
810c6151
 
  zhouhaihai
 
增加buff 效果31 地图被动刷...
 | 
34 
 | 
  Buff.Buff_NO_PASSIVE_MONSTER = 31 -- 地图被动刷新不出来怪物
 
 | 
a0834e49
 
  zhouhaihai
 
增加潜行 功能
 | 
35 
 | 
  Buff.SNEAK = 32 --潜行
 
 | 
c85cbad6
 
  zhouhaihai
 
怪 掉落增加 buff
 | 
36 
 | 
  Buff.DROP_BUFF_BY_ENEMY = 33 -- 怪物掉落加成  -- 怪物使用
 
 | 
b6a2b78b
 
  zhouhaihai
 
冒险 buff 类型 34 35
 | 
37 
 | 
  Buff.GET_PASSIVE = 34 -- 获得 passive -- 结束失效
 
 | 
a5660239
 
  zhouhaihai
 
冒险bug
 | 
38 
 | 
  Buff.OBSTACLE_CHANGE = 35 -- 看守类型改变  -- 怪物使用  2 - 1
 
 | 
3139a116
 
  zhouhaihai
 
光环相关buff
 | 
39
40 
 | 
  Buff.DISABLE_AURA = 36 -- 禁用光环
  Buff.GET_AURA = 37 -- 获得光环
 
 | 
be2bc68b
 
  zhouhaihai
 
看守周围的格子
 | 
41 
 | 
  Buff.OBSTACLE_PLUS = 38 -- 周围8格不能点击
 
 | 
46fac6f1
 
  zhouahaihai
 
酱料
 | 
42 
 | 
  
 
 | 
1e6f6a8a
 
  zhouhaihai
 
免疫 清除buff  增加新效果
 | 
43 
 | 
  
 
 | 
46fac6f1
 
  zhouahaihai
 
酱料
 | 
44
45 
 | 
  --角色一些属性的变化
  local function commonAttr(_Buff, attrName)
 
 | 
b71a8190
 
  zhouhaihai
 
动态改变 一些buff
 | 
46 
 | 
  	_Buff._init = function(self) --初始化变化值
 
 | 
46fac6f1
 
  zhouahaihai
 
酱料
 | 
47
48
49 
 | 
  		self.owner:reSetAttr(attrName)
  	end
  	_Buff._effectValue = function(self)
 
 | 
ccbafe67
 
  zhouhaihai
 
冒险神器和buff
 | 
50
51
52
53
54
55
56 
 | 
  		return self.buffData.effectValue1, self:doEffectChange(self.buffData.effectValue2) * self.layer, attrName
  	end
  	_Buff._overlay = function(self)
  		self.owner:reSetAttr(attrName)
  	end
  	_Buff._uncover = function(self)
  		self.owner:reSetAttr(attrName)
 
 | 
46fac6f1
 
  zhouahaihai
 
酱料
 | 
57
58
59
60 
 | 
  	end
  	_Buff._endBuff = function(self, data)
  		self.owner:reSetAttr(attrName)
  	end
 
 | 
ccbafe67
 
  zhouhaihai
 
冒险神器和buff
 | 
61
62
63 
 | 
  	_Buff._effectChange = function(self)
  		self.owner:reSetAttr(attrName)
  	end
 
 | 
46fac6f1
 
  zhouahaihai
 
酱料
 | 
64 
 | 
  end
 
 | 
4f0a5fae
 
  zhouhaihai
 
营养剂
 | 
65 
 | 
  local function commonAttCond(_Buff, attrName)
 
 | 
b71a8190
 
  zhouhaihai
 
动态改变 一些buff
 | 
66
67 
 | 
  	_Buff._init = function(self) --初始化变化值
  		self:_reSetAttr()
 
 | 
ccbafe67
 
  zhouhaihai
 
冒险神器和buff
 | 
68
69 
 | 
  	end
  	_Buff._overlay = function(self)
 
 | 
b71a8190
 
  zhouhaihai
 
动态改变 一些buff
 | 
70 
 | 
  		self:_reSetAttr()
 
 | 
ccbafe67
 
  zhouhaihai
 
冒险神器和buff
 | 
71
72 
 | 
  	end	
  	_Buff._uncover = function(self)
 
 | 
98761edc
 
  zhouhaihai
 
buff 补充
 | 
73
74 
 | 
  		self:_reSetAttr()
  	end
 
 | 
d3da3368
 
  zhouhaihai
 
冒险地图被动技, buff  神器
 | 
75 
 | 
  
 
 | 
b71a8190
 
  zhouhaihai
 
动态改变 一些buff
 | 
76 
 | 
  	_Buff._reSetAttr = function(self)
 
 | 
98761edc
 
  zhouhaihai
 
buff 补充
 | 
77 
 | 
  		if attrName == "hp" then
 
 | 
b71a8190
 
  zhouhaihai
 
动态改变 一些buff
 | 
78 
 | 
  			self.owner:reSetHpMax()
 
 | 
98761edc
 
  zhouhaihai
 
buff 补充
 | 
79
80
81 
 | 
  		else
  			self.owner:reSetAttr(attrName)
  		end
 
 | 
ccbafe67
 
  zhouhaihai
 
冒险神器和buff
 | 
82 
 | 
  	end
 
 | 
98761edc
 
  zhouhaihai
 
buff 补充
 | 
83 
 | 
  
 
 | 
ccbafe67
 
  zhouhaihai
 
冒险神器和buff
 | 
84 
 | 
  	_Buff._calculate = function(self)
 
 | 
4f0a5fae
 
  zhouhaihai
 
营养剂
 | 
85
86 
 | 
  		local effectCount = 0
  		if self.buffData.effectValue4 == 0 then
 
 | 
b71a8190
 
  zhouhaihai
 
动态改变 一些buff
 | 
87
88
89
90
91 
 | 
  			effectCount = self.owner.battle.adv.owner:getProperty("advItems"):getv(ItemId.OldCoin, 0) / tonumber(self.buffData.effectValue5)
  		elseif self.buffData.effectValue4 == 1 then
  			effectCount = self.owner.battle.adv.level
  		elseif self.buffData.effectValue4 == 2 then
  			local buff = self.owner.battle.player:getBuffById(tonumber(self.buffData.effectValue5))
 
 | 
92d7d6ac
 
  zhouhaihai
 
加一些数据保护
 | 
92
93
94 
 | 
  			if buff then
  				effectCount = buff.layer
  			end
 
 | 
1e789624
 
  zhouhaihai
 
新的 buff 效果
 | 
95
96
97
98
99
100
101
102
103
104
105 
 | 
  		elseif self.buffData.effectValue4 == 3 then
  			local classify = tonumber(self.buffData.effectValue5) -- 怪标签
  			local enemy = self.owner.battle.player:getTeam(2)
  			for _, one in pairs(enemy) do
  				if one.isClassify and one:isClassify(classify) then
  					effectCount = effectCount + 1
  				end
  			end
  		elseif self.buffData.effectValue4 == 4 then
  			local eventType = tonumber(self.buffData.effectValue5) -- event 类型
  			effectCount = #self.owner.battle.adv:getCurMap():getEventTypeAllMap(eventType)
 
 | 
b71a8190
 
  zhouhaihai
 
动态改变 一些buff
 | 
106
107 
 | 
  		end
  		return self.buffData.effectValue2 * effectCount 
 
 | 
4f0a5fae
 
  zhouhaihai
 
营养剂
 | 
108 
 | 
  	end
 
 | 
b71a8190
 
  zhouhaihai
 
动态改变 一些buff
 | 
109
110
111 
 | 
  
  	_Buff.getEffectBy = function(self)
  		local cond = nil
 
 | 
1e789624
 
  zhouhaihai
 
新的 buff 效果
 | 
112 
 | 
  		if self.buffData.effectValue4 == 2 or self.buffData.effectValue4 == 3 or self.buffData.effectValue4 == 4 then
 
 | 
b71a8190
 
  zhouhaihai
 
动态改变 一些buff
 | 
113
114
115 
 | 
  			cond = tonumber(self.buffData.effectValue5)
  		end
  		return self.buffData.effectValue4, attrName, cond
 
 | 
4f0a5fae
 
  zhouhaihai
 
营养剂
 | 
116 
 | 
  	end
 
 | 
b71a8190
 
  zhouhaihai
 
动态改变 一些buff
 | 
117 
 | 
  
 
 | 
4f0a5fae
 
  zhouhaihai
 
营养剂
 | 
118 
 | 
  	_Buff._effectValue = function(self)
 
 | 
b71a8190
 
  zhouhaihai
 
动态改变 一些buff
 | 
119 
 | 
  		return self.buffData.effectValue1, self:_calculate() * self.layer, attrName
 
 | 
4f0a5fae
 
  zhouhaihai
 
营养剂
 | 
120 
 | 
  	end
 
 | 
b71a8190
 
  zhouhaihai
 
动态改变 一些buff
 | 
121 
 | 
  
 
 | 
4f0a5fae
 
  zhouhaihai
 
营养剂
 | 
122 
 | 
  	_Buff._endBuff = function(self, data)
 
 | 
98761edc
 
  zhouhaihai
 
buff 补充
 | 
123 
 | 
  		self:_reSetAttr()
 
 | 
4f0a5fae
 
  zhouhaihai
 
营养剂
 | 
124 
 | 
  	end
 
 | 
4f0a5fae
 
  zhouhaihai
 
营养剂
 | 
125 
 | 
  end
 
 | 
46fac6f1
 
  zhouahaihai
 
酱料
 | 
126
127
128 
 | 
  
  local BuffFactory = {
  	[Buff.HP_CHANGE] = function(_Buff)
 
 | 
b71a8190
 
  zhouhaihai
 
动态改变 一些buff
 | 
129 
 | 
  		_Buff._init = function(self) --初始化变化值
 
 | 
ccbafe67
 
  zhouhaihai
 
冒险神器和buff
 | 
130
131
132
133
134
135
136
137
138
139 
 | 
  			self._changeV = self:_calculate()
  		end
  		_Buff._overlay = function(self)
  			self._changeV = (self._changeV or 0) + self:_calculate()
  		end
  		_Buff._uncover = function(self)
  			self._changeV = self._changeV - self._changeV / (self.layer + 1)
  		end
  		_Buff._calculate = function(self)
  			local curValue = 0
 
 | 
46fac6f1
 
  zhouahaihai
 
酱料
 | 
140 
 | 
  			if self.buffData.effectValue1 == 0 then --固定值
 
 | 
ccbafe67
 
  zhouhaihai
 
冒险神器和buff
 | 
141 
 | 
  				curValue = self.buffData.effectValue2
 
 | 
46fac6f1
 
  zhouahaihai
 
酱料
 | 
142
143
144 
 | 
  			elseif self.buffData.effectValue1 == 1 then
  				local baseOwner = self.buffData.effectValue4 == 1 and self.owner or self.release
  				local attrs = {[0] = "hp", [1] = "hpMax", [2] = "atk"}
 
 | 
ccbafe67
 
  zhouhaihai
 
冒险神器和buff
 | 
145 
 | 
  				curValue = baseOwner[attrs[self.buffData.effectValue3]] * self.buffData.effectValue2 / 100
 
 | 
46fac6f1
 
  zhouahaihai
 
酱料
 | 
146 
 | 
  			end
 
 | 
ccbafe67
 
  zhouhaihai
 
冒险神器和buff
 | 
147 
 | 
  			if curValue < 0 then
 
 | 
c047749a
 
  zhouhaihai
 
buff
 | 
148 
 | 
  				if self.release then
 
 | 
ccbafe67
 
  zhouhaihai
 
冒险神器和buff
 | 
149 
 | 
  					curValue = -self.release:getHurtValue(-curValue)
 
 | 
c047749a
 
  zhouhaihai
 
buff
 | 
150 
 | 
  				end
 
 | 
46fac6f1
 
  zhouahaihai
 
酱料
 | 
151 
 | 
  			end
 
 | 
ccbafe67
 
  zhouhaihai
 
冒险神器和buff
 | 
152 
 | 
  			return curValue
 
 | 
46fac6f1
 
  zhouahaihai
 
酱料
 | 
153
154
155
156 
 | 
  		end
  		_Buff._initDB = function(self, data) 
  			self._changeV = data.cv
  		end
 
 | 
7c55db1f
 
  suhongyang
 
Buff逻辑完善,buff生效次数...
 | 
157
158
159
160
161 
 | 
  		_Buff._afterRound = function(self)
  			local value = self:effect()
  			if value > 0 then
  				self.owner:recover(value, self.release)
  			elseif value < 0 then
 
 | 
53e8037e
 
  zhouhaihai
 
任务
 | 
162 
 | 
  				self.owner:hurt(-value, self.release, {hurtType = self.buffData.effectValue5 == "1" and 6 or 2, buffId = self.id})
 
 | 
46fac6f1
 
  zhouahaihai
 
酱料
 | 
163
164 
 | 
  			end
  		end
 
 | 
7c55db1f
 
  suhongyang
 
Buff逻辑完善,buff生效次数...
 | 
165 
 | 
  		_Buff._effectValue = function(self)
 
 | 
ccbafe67
 
  zhouhaihai
 
冒险神器和buff
 | 
166 
 | 
  			return self:doEffectChange(self._changeV)
 
 | 
7c55db1f
 
  suhongyang
 
Buff逻辑完善,buff生效次数...
 | 
167 
 | 
  		end
 
 | 
ccbafe67
 
  zhouhaihai
 
冒险神器和buff
 | 
168 
 | 
  
 
 | 
46fac6f1
 
  zhouahaihai
 
酱料
 | 
169
170
171
172
173
174 
 | 
  		_Buff._getDB = function(self)
  			return {cv = self._changeV}
  		end
  	end,
  
  	[Buff.HP_MAX_CHANGE] = function(_Buff)
 
 | 
b71a8190
 
  zhouhaihai
 
动态改变 一些buff
 | 
175 
 | 
  		_Buff._init = function(self) --初始化变化值
 
 | 
ccbafe67
 
  zhouhaihai
 
冒险神器和buff
 | 
176 
 | 
  			self._changeV = self:_calculate()
 
 | 
375f40f1
 
  zhouhaihai
 
可控制 提高生命上限回复血量
 | 
177 
 | 
  			local old = self.owner.hpMax
 
 | 
b71a8190
 
  zhouhaihai
 
动态改变 一些buff
 | 
178 
 | 
  			self.owner:reSetHpMax()
 
 | 
375f40f1
 
  zhouhaihai
 
可控制 提高生命上限回复血量
 | 
179 
 | 
  			self:_addHpByMax(old)
 
 | 
ccbafe67
 
  zhouhaihai
 
冒险神器和buff
 | 
180
181
182 
 | 
  		end
  		_Buff._overlay = function(self)
  			self._changeV = (self._changeV or 0) + self:_calculate()
 
 | 
375f40f1
 
  zhouhaihai
 
可控制 提高生命上限回复血量
 | 
183 
 | 
  			local old = self.owner.hpMax
 
 | 
b71a8190
 
  zhouhaihai
 
动态改变 一些buff
 | 
184 
 | 
  			self.owner:reSetHpMax()
 
 | 
375f40f1
 
  zhouhaihai
 
可控制 提高生命上限回复血量
 | 
185 
 | 
  			self:_addHpByMax(old)
 
 | 
ccbafe67
 
  zhouhaihai
 
冒险神器和buff
 | 
186
187
188
189
190
191
192 
 | 
  		end
  
  		_Buff._uncover = function(self)
  			self._changeV = self._changeV - self._changeV / (self.layer + 1)
  			self.owner:reSetHpMax()
  		end
  
 
 | 
ccbafe67
 
  zhouhaihai
 
冒险神器和buff
 | 
193
194 
 | 
  		_Buff._calculate = function(self)
  			local curValue = 0
 
 | 
46fac6f1
 
  zhouahaihai
 
酱料
 | 
195 
 | 
  			if self.buffData.effectValue1 == 0 then --固定值
 
 | 
ccbafe67
 
  zhouhaihai
 
冒险神器和buff
 | 
196 
 | 
  				curValue = self.buffData.effectValue2
 
 | 
46fac6f1
 
  zhouahaihai
 
酱料
 | 
197 
 | 
  			elseif self.buffData.effectValue1 == 1 then
 
 | 
375f40f1
 
  zhouhaihai
 
可控制 提高生命上限回复血量
 | 
198 
 | 
  				local baseOwner = self.buffData.effectValue4 == 1 and self.owner or self.release 
 
 | 
46fac6f1
 
  zhouahaihai
 
酱料
 | 
199 
 | 
  				local attrs = {[0] = "hp", [1] = "hpMax", [2] = "atk"}
 
 | 
ccbafe67
 
  zhouhaihai
 
冒险神器和buff
 | 
200 
 | 
  				curValue = baseOwner[attrs[self.buffData.effectValue3]] * self.buffData.effectValue2 / 100
 
 | 
46fac6f1
 
  zhouahaihai
 
酱料
 | 
201 
 | 
  			end
 
 | 
ccbafe67
 
  zhouhaihai
 
冒险神器和buff
 | 
202
203
204
205
206
207
208 
 | 
  			return curValue
  		end
  
  		_Buff._effectValue = function(self)
  			return self:doEffectChange(self._changeV)
  		end
  
 
 | 
375f40f1
 
  zhouhaihai
 
可控制 提高生命上限回复血量
 | 
209
210
211
212
213
214
215
216
217 
 | 
  		_Buff._addHpByMax = function(self, old)
  			if self.buffData.effectValue5 == "1" then
  				local change = self.owner.hpMax - old
  				if change > 0 then
  					self.owner:recover(change, self.release) -- 防止release不存在,地图点buff
  				end
  			end
  		end
  
 
 | 
ccbafe67
 
  zhouhaihai
 
冒险神器和buff
 | 
218
219 
 | 
  		_Buff._endBuff = function(self)
  			self.owner:reSetHpMax()
 
 | 
46fac6f1
 
  zhouahaihai
 
酱料
 | 
220 
 | 
  		end
 
 | 
ccbafe67
 
  zhouhaihai
 
冒险神器和buff
 | 
221
222
223
224
225 
 | 
  
  		_Buff._effectChange = function(self)
  			self.owner:reSetHpMax()
  		end
  
 
 | 
46fac6f1
 
  zhouahaihai
 
酱料
 | 
226
227
228 
 | 
  		_Buff._initDB = function(self, data)
  			self._changeV = data.cv
  		end
 
 | 
ccbafe67
 
  zhouhaihai
 
冒险神器和buff
 | 
229 
 | 
  
 
 | 
46fac6f1
 
  zhouahaihai
 
酱料
 | 
230
231
232
233 
 | 
  		_Buff._getDB = function(self)
  			return {cv = self._changeV}
  		end
  	end,
 
 | 
0d405dc3
 
  suhongyang
 
Buff生命周期调整,被动加buf...
 | 
234 
 | 
  	[Buff.ATTR_CHANGE] = function(_Buff)
 
 | 
d78bc768
 
  suhongyang
 
Fix bug
 | 
235 
 | 
  		local attrName = AttsEnumEx[_Buff.buffData.effectValue3]
 
 | 
0d405dc3
 
  suhongyang
 
Buff生命周期调整,被动加buf...
 | 
236 
 | 
  		commonAttr(_Buff, attrName)
 
 | 
46fac6f1
 
  zhouahaihai
 
酱料
 | 
237 
 | 
  	end,
 
 | 
4f0a5fae
 
  zhouhaihai
 
营养剂
 | 
238 
 | 
  
 
 | 
ccbafe67
 
  zhouhaihai
 
冒险神器和buff
 | 
239 
 | 
  	[Buff.ATTR_CHANGE_COND] = function(_Buff)
 
 | 
4f0a5fae
 
  zhouhaihai
 
营养剂
 | 
240
241
242
243
244 
 | 
  		local attrName = AttsEnumEx[_Buff.buffData.effectValue3]
  		commonAttCond(_Buff, attrName)
  	end,
  
  
 
 | 
db3c56ad
 
  zhouhaihai
 
冒险相关
 | 
245
246 
 | 
  	[Buff.CHANGE_DROP_TO_CLICK] = function(_Buff)
  		_Buff._effectValue = function(self)
 
 | 
ccbafe67
 
  zhouhaihai
 
冒险神器和buff
 | 
247 
 | 
  			-- id
 
 | 
db3c56ad
 
  zhouhaihai
 
冒险相关
 | 
248
249
250
251 
 | 
  			return self.buffData.effectValue1
  		end
  	end,
  
 
 | 
46fac6f1
 
  zhouahaihai
 
酱料
 | 
252 
 | 
  	[Buff.IMMNUE_BUFF] = function(_Buff)
 
 | 
1e6f6a8a
 
  zhouhaihai
 
免疫 清除buff  增加新效果
 | 
253
254
255
256
257
258
259
260
261
262
263
264 
 | 
  		_Buff._canEffect = function(self, buffId)
  			local buffData = csvdb["adv_map_buffCsv"][buffId]
  			local cType, aim = self.buffData.effectValue1
  			if buffData.dispel ~= 0 then return end
  
  			local dispel = false
  			if self.buffData.effectValue1 == 0 then
  				dispel = buffId == self.buffData.effectValue2
  			elseif self.buffData.effectValue1 == 1 then
  				dispel = buffData.group == self.buffData.effectValue2
  			elseif self.buffData.effectValue1 == 2 then
  				dispel = buffData.classify:sismember(self.buffData.effectValue2, " ")
 
 | 
7c55db1f
 
  suhongyang
 
Buff逻辑完善,buff生效次数...
 | 
265 
 | 
  			end
 
 | 
1e6f6a8a
 
  zhouhaihai
 
免疫 清除buff  增加新效果
 | 
266 
 | 
  			return dispel
 
 | 
46fac6f1
 
  zhouahaihai
 
酱料
 | 
267
268
269
270 
 | 
  		end
  	end,
  
  	[Buff.CLEAR_BUFF] = function(_Buff)
 
 | 
b71a8190
 
  zhouhaihai
 
动态改变 一些buff
 | 
271 
 | 
  		_Buff._init = function(self)
 
 | 
1ffc16b9
 
  zhouhaihai
 
冒险 选择点和 建筑
 | 
272 
 | 
  			for _, buff in ipairs(self.owner.buffs) do -- 挂上就清除一下子
 
 | 
ccbafe67
 
  zhouhaihai
 
冒险神器和buff
 | 
273 
 | 
  				if not buff.isDel and self:canEffect(buff.id) and not self.isDel then
 
 | 
43716efb
 
  zhouhaihai
 
buff 清除层数
 | 
274 
 | 
  					while not buff.isDel and not self.isDel do
 
 | 
ccbafe67
 
  zhouhaihai
 
冒险神器和buff
 | 
275
276
277 
 | 
  						self:effect()
  						buff:uncover()
  					end
 
 | 
46fac6f1
 
  zhouahaihai
 
酱料
 | 
278 
 | 
  				end
 
 | 
7e45c419
 
  suhongyang
 
现有buff补全战斗内生效逻辑
 | 
279 
 | 
  			end 
 
 | 
46fac6f1
 
  zhouahaihai
 
酱料
 | 
280 
 | 
  		end
 
 | 
ccbafe67
 
  zhouhaihai
 
冒险神器和buff
 | 
281
282 
 | 
  		_Buff._canEffect = function(self, buffId)
  			local buffData = csvdb["adv_map_buffCsv"][buffId]
 
 | 
1e6f6a8a
 
  zhouhaihai
 
免疫 清除buff  增加新效果
 | 
283
284
285
286
287
288
289
290
291
292 
 | 
  			local cType, aim = self.buffData.effectValue1
  			if buffData.dispel ~= 0 then return end
  
  			local dispel = false
  			if self.buffData.effectValue1 == 0 then
  				dispel = buffId == self.buffData.effectValue2
  			elseif self.buffData.effectValue1 == 1 then
  				dispel = buffData.group == self.buffData.effectValue2
  			elseif self.buffData.effectValue1 == 2 then
  				dispel = buffData.classify:sismember(self.buffData.effectValue2, " ")
 
 | 
7c55db1f
 
  suhongyang
 
Buff逻辑完善,buff生效次数...
 | 
293 
 | 
  			end
 
 | 
1e6f6a8a
 
  zhouhaihai
 
免疫 清除buff  增加新效果
 | 
294
295 
 | 
  
  			return dispel
 
 | 
46fac6f1
 
  zhouahaihai
 
酱料
 | 
296
297
298
299 
 | 
  		end
  	end,
  
  	[Buff.OPEN_BLOCK] = function(_Buff)
 
 | 
7c55db1f
 
  suhongyang
 
Buff逻辑完善,buff生效次数...
 | 
300
301 
 | 
  		_Buff._afterRound = function(self)
  			local roomNum = self:effect()
 
 | 
d3da3368
 
  zhouhaihai
 
冒险地图被动技, buff  神器
 | 
302 
 | 
  			self.owner.battle.adv:getCurMap():openBlockRand(roomNum, not self.owner.monsterId)
 
 | 
7c55db1f
 
  suhongyang
 
Buff逻辑完善,buff生效次数...
 | 
303 
 | 
  		end
 
 | 
7c55db1f
 
  suhongyang
 
Buff逻辑完善,buff生效次数...
 | 
304 
 | 
  		_Buff._effectValue = function(self)
 
 | 
ccbafe67
 
  zhouhaihai
 
冒险神器和buff
 | 
305
306 
 | 
  			-- 数量
  			return self.buffData.effectValue1 * self.layer
 
 | 
46fac6f1
 
  zhouahaihai
 
酱料
 | 
307
308
309 
 | 
  		end
  	end,
  
 
 | 
3b0526d2
 
  zhouhaihai
 
冒险demo
 | 
310 
 | 
  	[Buff.SP_CHANGE] = function(_Buff)
 
 | 
7c55db1f
 
  suhongyang
 
Buff逻辑完善,buff生效次数...
 | 
311 
 | 
  		_Buff._afterRound = function(self)
 
 | 
ccbafe67
 
  zhouhaihai
 
冒险神器和buff
 | 
312 
 | 
  			local cType, value  = self:effect()
 
 | 
3b0526d2
 
  zhouhaihai
 
冒险demo
 | 
313 
 | 
  			self.owner:changeSp(value, cType)
 
 | 
7c55db1f
 
  suhongyang
 
Buff逻辑完善,buff生效次数...
 | 
314
315 
 | 
  		end
  		_Buff._effectValue = function(self)
 
 | 
ccbafe67
 
  zhouhaihai
 
冒险神器和buff
 | 
316
317 
 | 
  			-- 值/% 数量
  			return self.buffData.effectValue1, self:doEffectChange(self.buffData.effectValue2) * self.layer
 
 | 
46fac6f1
 
  zhouahaihai
 
酱料
 | 
318 
 | 
  		end
 
 | 
6cd12079
 
  suhongyang
 
扣血buff立刻生效
 | 
319 
 | 
  	end,
 
 | 
53e8037e
 
  zhouhaihai
 
任务
 | 
320 
 | 
  
 
 | 
a95b35ce
 
  zhouhaihai
 
删除等级
 | 
321
322
323
324
325
326
327
328
329
330 
 | 
  	-- [Buff.EXP_ADD] = function(_Buff)
  	-- 	_Buff._afterRound = function(self)
  	-- 		local value = self:effect()
  	-- 		self.owner.battle.player:addExp(value)
  	-- 	end
  	-- 	_Buff._effectValue = function(self)
  	-- 		-- 经验值
  	-- 		return self.buffData.effectValue1 * self.layer
  	-- 	end
  	-- end,
 
 | 
53e8037e
 
  zhouhaihai
 
任务
 | 
331 
 | 
  
 
 | 
ccbafe67
 
  zhouhaihai
 
冒险神器和buff
 | 
332 
 | 
  	[Buff.DISABLE_BUFF] = function(_Buff)
 
 | 
53e8037e
 
  zhouhaihai
 
任务
 | 
333
334
335
336 
 | 
  		_Buff._effectValue = function(self)
  			return self.buffData.effectValue1
  		end
  	end,
 
 | 
4f0a5fae
 
  zhouhaihai
 
营养剂
 | 
337 
 | 
  
 
 | 
3139a116
 
  zhouhaihai
 
光环相关buff
 | 
338
339
340
341
342
343
344
345
346
347
348
349 
 | 
  	[Buff.DISABLE_AURA] = function(_Buff)
  		_Buff._effectValue = function(self)
  			return self.buffData.effectValue1
  		end
  	end,
  
  	[Buff.GET_AURA] = function(_Buff)
  		_Buff._effectValue = function(self)
  			return self.buffData.effectValue1
  		end
  	end,
  
 
 | 
ccbafe67
 
  zhouhaihai
 
冒险神器和buff
 | 
350 
 | 
  	[Buff.SP_MAX_CHANGE] = function(_Buff)
 
 | 
b71a8190
 
  zhouhaihai
 
动态改变 一些buff
 | 
351 
 | 
  		_Buff._init = function(self) --初始化变化值
 
 | 
1bab9165
 
  zhouhaihai
 
buff xiugai
 | 
352 
 | 
  			self.owner:reSetSpMax()
 
 | 
ccbafe67
 
  zhouhaihai
 
冒险神器和buff
 | 
353
354 
 | 
  		end
  		_Buff._overlay = function(self)
 
 | 
ccbafe67
 
  zhouhaihai
 
冒险神器和buff
 | 
355
356
357 
 | 
  			self.owner:reSetSpMax()
  		end
  
 
 | 
1bab9165
 
  zhouhaihai
 
buff xiugai
 | 
358 
 | 
  		_Buff._uncover = function(self)
 
 | 
ccbafe67
 
  zhouhaihai
 
冒险神器和buff
 | 
359 
 | 
  			self.owner:reSetSpMax()
 
 | 
ccbafe67
 
  zhouhaihai
 
冒险神器和buff
 | 
360
361
362
363
364
365
366
367
368 
 | 
  		end
  
  		_Buff._endBuff = function(self)
  			self.owner:reSetSpMax()
  		end
  
  		_Buff._effectValue = function(self)
  			return self.buffData.effectValue1, self.buffData.effectValue2 * self.layer
  		end
 
 | 
98761edc
 
  zhouhaihai
 
buff 补充
 | 
369 
 | 
  	end,
 
 | 
ccbafe67
 
  zhouhaihai
 
冒险神器和buff
 | 
370
371 
 | 
  
  	[Buff.ITEM_GET_UP] = function(_Buff)
 
 | 
4f0a5fae
 
  zhouhaihai
 
营养剂
 | 
372 
 | 
  		_Buff._effectValue = function(self)
 
 | 
ccbafe67
 
  zhouhaihai
 
冒险神器和buff
 | 
373
374 
 | 
  			-- 值/% 数量 id
  			return self.buffData.effectValue1, self.buffData.effectValue2 * self.layer, self.buffData.effectValue3
 
 | 
4f0a5fae
 
  zhouhaihai
 
营养剂
 | 
375
376 
 | 
  		end
  	end,
 
 | 
ccbafe67
 
  zhouhaihai
 
冒险神器和buff
 | 
377
378
379
380
381
382 
 | 
  
  	-- 影响到的buff类型  1=生命变化、2=生命上限、3=属性变化、6=伤害变化、7=受伤变化、15=回魔、16=生命变化  (胡博文)
  	[Buff.Buff_EFFECT_CHANGE] = function(_Buff)
  		_Buff._init = function(self)
  			-- 先给自己的buff 搞一下子
  			for _, buff in ipairs(self.owner.buffs) do
 
 | 
1e6f6a8a
 
  zhouhaihai
 
免疫 清除buff  增加新效果
 | 
383 
 | 
  				if not buff.isDel and buff.buffData.classify:sismember(self.buffData.effectValue1, " ") then
 
 | 
ccbafe67
 
  zhouhaihai
 
冒险神器和buff
 | 
384
385
386
387 
 | 
  					buff:effectChange()
  				end
  			end
  		end
 
 | 
4f0a5fae
 
  zhouhaihai
 
营养剂
 | 
388 
 | 
  		_Buff._effectValue = function(self)
 
 | 
ccbafe67
 
  zhouhaihai
 
冒险神器和buff
 | 
389
390
391
392
393
394
395 
 | 
  			return self.buffData.effectValue1, self.buffData.effectValue2 * self.layer
  		end
  		_Buff._overlay = function(self)
  			self:_init()
  		end
  		_Buff._uncover = function(self)
  			self:_init()
 
 | 
4f0a5fae
 
  zhouhaihai
 
营养剂
 | 
396
397 
 | 
  		end
  	end,
 
 | 
810c6151
 
  zhouhaihai
 
增加buff 效果31 地图被动刷...
 | 
398
399
400
401
402
403 
 | 
  
  	[Buff.Buff_NO_PASSIVE_MONSTER] = function(_Buff)
  		_Buff._effectValue = function(self)
  			return self.buffData.effectValue1
  		end
  	end,
 
 | 
a0834e49
 
  zhouhaihai
 
增加潜行 功能
 | 
404 
 | 
  	[Buff.SNEAK] = function(_Buff)
 
 | 
9c08bf47
 
  zhouhaihai
 
简化=潜行
 | 
405
406 
 | 
  		_Buff._init = function(self)
  			self.layer = self.buffData.effectValue1
 
 | 
a0834e49
 
  zhouhaihai
 
增加潜行 功能
 | 
407
408 
 | 
  		end
  	end,
 
 | 
b6a2b78b
 
  zhouhaihai
 
冒险 buff 类型 34 35
 | 
409
410
411
412
413
414
415
416 
 | 
  	[Buff.GET_PASSIVE] = function( _Buff )
  		_Buff._init = function(self)
  			self.owner:addPassive({id = self.buffData.effectValue1})
  		end
  		_Buff._endBuff = function(self)
  			self.owner:delPassiveById(self.buffData.effectValue1)
  		end
  	end
 
 | 
46fac6f1
 
  zhouahaihai
 
酱料
 | 
417
418 
 | 
  }
  
 
 | 
ccbafe67
 
  zhouhaihai
 
冒险神器和buff
 | 
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435 
 | 
  -- 同样的返回  effectValue1, effectValue2 * self.layer 类型的buff
  local function CommonFuncBackEffect12(_Buff)
  	_Buff._effectValue = function(self)
  		return self.buffData.effectValue1, self:doEffectChange(self.buffData.effectValue2) * self.layer
  	end
  end
  
  BuffFactory[Buff.BACK_HURT] = CommonFuncBackEffect12  -- 值/% 数量
  BuffFactory[Buff.HURT_CHANGE] = CommonFuncBackEffect12  -- 值/% 数量
  BuffFactory[Buff.INJURED_CHANGE] = CommonFuncBackEffect12 -- 值/% 数量
  BuffFactory[Buff.HURT_TRANSFER] = CommonFuncBackEffect12 -- 值/% 数量
  BuffFactory[Buff.HURT_ABSORB] = CommonFuncBackEffect12 -- 值/% 数量
  BuffFactory[Buff.CHANGE_DROP] = CommonFuncBackEffect12 -- id 数量
  BuffFactory[Buff.EXP_UP] = CommonFuncBackEffect12 -- 值/% 数量
  -- 历史遗留问题
  BuffFactory[Buff.HP_CHANGE_NOW] = BuffFactory[Buff.HP_CHANGE] 
  
 
 | 
7c55db1f
 
  suhongyang
 
Buff逻辑完善,buff生效次数...
 | 
436
437
438 
 | 
  function Buff:ctor(owner, id)
  	self.owner = owner
  	self.id = id
 
 | 
3b0526d2
 
  zhouhaihai
 
冒险demo
 | 
439 
 | 
  	self.buffData = csvdb["adv_map_buffCsv"][self.id]
 
 | 
7c55db1f
 
  suhongyang
 
Buff逻辑完善,buff生效次数...
 | 
440 
 | 
  	self.isDel = false
 
 | 
7c55db1f
 
  suhongyang
 
Buff逻辑完善,buff生效次数...
 | 
441 
 | 
  	self.roundSpace = 0 --生效间隔
 
 | 
7c55db1f
 
  suhongyang
 
Buff逻辑完善,buff生效次数...
 | 
442 
 | 
  	self.round = 0 --剩余的回合
 
 | 
7c55db1f
 
  suhongyang
 
Buff逻辑完善,buff生效次数...
 | 
443 
 | 
  	self.count = -1 -- 可生效的次数  -1 无次数限制
 
 | 
ccbafe67
 
  zhouhaihai
 
冒险神器和buff
 | 
444 
 | 
  	self.layer = 1 -- 当前buff 层数
 
 | 
d3da3368
 
  zhouhaihai
 
冒险地图被动技, buff  神器
 | 
445 
 | 
  	self.releaseId = nil -- 释放的怪物Id
 
 | 
7c55db1f
 
  suhongyang
 
Buff逻辑完善,buff生效次数...
 | 
446
447
448
449
450 
 | 
  
  	if BuffFactory[self.buffData.type] then
  		BuffFactory[self.buffData.type](self)
  	end
  end
 
 | 
46fac6f1
 
  zhouahaihai
 
酱料
 | 
451
452
453
454
455
456
457
458
459
460
461
462
463 
 | 
  
  function Buff.create(owner, release, data)
  	local buff = Buff.new(owner, data.id)
  	buff:initNew(release, data)
  	return buff
  end
  
  function Buff.load(owner, data)
  	local buff = Buff.new(owner, data.id)
  	buff:initByDB(data)
  	return buff
  end
  
 
 | 
7c55db1f
 
  suhongyang
 
Buff逻辑完善,buff生效次数...
 | 
464 
 | 
  function Buff:initNew(release, data)
 
 | 
6d238bc6
 
  suhongyang
 
Fix bug
 | 
465 
 | 
  	self.release = release or self.owner
 
 | 
d3da3368
 
  zhouhaihai
 
冒险地图被动技, buff  神器
 | 
466 
 | 
  	self.releaseId = self.release.monsterId or 0
 
 | 
7c55db1f
 
  suhongyang
 
Buff逻辑完善,buff生效次数...
 | 
467 
 | 
  	self.round = self.buffData.round
 
 | 
ccbafe67
 
  zhouhaihai
 
冒险神器和buff
 | 
468
469 
 | 
  	self.roundSpace = 0 --生效间隔
  	self.layer = 1
 
 | 
7c55db1f
 
  suhongyang
 
Buff逻辑完善,buff生效次数...
 | 
470
471
472 
 | 
  	if self.buffData.effectTime > 0 then
  		self.count = self.buffData.effectTime
  	end
 
 | 
9c8e9482
 
  zhouhaihai
 
buff  被动 限定地图
 | 
473
474
475 
 | 
  	if self.buffData.mapLock == 1 then
  		self.mapId = self.owner.battle.adv:getCurMap().mapId
  	end
 
 | 
b71a8190
 
  zhouhaihai
 
动态改变 一些buff
 | 
476
477 
 | 
  end
  
 
 | 
a80fee7c
 
  zhouhaihai
 
光环
 | 
478
479
480
481
482
483
484
485
486
487
488
489 
 | 
  function Buff:createAfter(layer)
  	layer = layer or 1
  	local otype, maxLayer = self:getOverlay()
  	if otype then
  		self.layer = layer
  		if maxLayer ~= 0 then
  			self.layer = math.min(maxLayer, self.layer)
  		end
  	else
  		self.layer = 1
  	end
  	
 
 | 
7c55db1f
 
  suhongyang
 
Buff逻辑完善,buff生效次数...
 | 
490 
 | 
  	if self._init then
 
 | 
b71a8190
 
  zhouhaihai
 
动态改变 一些buff
 | 
491 
 | 
  		self:_init()
 
 | 
46fac6f1
 
  zhouahaihai
 
酱料
 | 
492 
 | 
  	end
 
 | 
cf584618
 
  zhouhaihai
 
效果发给客户端
 | 
493 
 | 
  	self:pushBackEffect(1)
 
 | 
e6dc06cc
 
  zhouhaihai
 
拾荒bug  增加bug log
 | 
494 
 | 
  	buglog("Buff", "who: %s create buffId: %s", self.owner.monsterId, self.id)
 
 | 
46fac6f1
 
  zhouahaihai
 
酱料
 | 
495
496
497
498
499
500
501
502
503
504 
 | 
  end
  
  function Buff:initByDB(data)
  	if data.rele then
  		if data.rele == 0 then
  			self.release = self.owner.battle.player
  		else
  			self.release = self.owner.battle:getEnemyById(data.rele)
  		end
  	end
 
 | 
d3da3368
 
  zhouhaihai
 
冒险地图被动技, buff  神器
 | 
505 
 | 
  	self.releaseId = data.releId
 
 | 
821f2b60
 
  suhongyang
 
冒险战斗完善,增加battlebe...
 | 
506 
 | 
  	self.round = data.round
 
 | 
ccbafe67
 
  zhouhaihai
 
冒险神器和buff
 | 
507 
 | 
  	self.roundSpace = data.roundSp
 
 | 
46fac6f1
 
  zhouahaihai
 
酱料
 | 
508
509
510 
 | 
  	if data.count then
  		self.count = data.count
  	end
 
 | 
9c8e9482
 
  zhouhaihai
 
buff  被动 限定地图
 | 
511
512
513 
 | 
  	if data.mapId then
  		self.mapId = data.mapId
  	end
 
 | 
ccbafe67
 
  zhouhaihai
 
冒险神器和buff
 | 
514 
 | 
  	self.layer = data.layer or 1
 
 | 
46fac6f1
 
  zhouahaihai
 
酱料
 | 
515
516
517
518
519 
 | 
  	if self._initDB then
  		self:_initDB(data)
  	end
  end
  
 
 | 
7c55db1f
 
  suhongyang
 
Buff逻辑完善,buff生效次数...
 | 
520 
 | 
  
 
 | 
46fac6f1
 
  zhouahaihai
 
酱料
 | 
521 
 | 
  function Buff:afterRound()
 
 | 
9c8e9482
 
  zhouhaihai
 
buff  被动 限定地图
 | 
522 
 | 
  	if self.owner.isDead or self:isHide() then return end
 
 | 
ccbafe67
 
  zhouhaihai
 
冒险神器和buff
 | 
523
524
525
526
527
528
529 
 | 
  
  	-- keepTerm 检查
  	if not self:checkKeep() then 
  		self.isDel = true
  		return 
  	end
  
 
 | 
7c55db1f
 
  suhongyang
 
Buff逻辑完善,buff生效次数...
 | 
530 
 | 
  	if self.roundSpace > 0 then
 
 | 
8d8bf91a
 
  suhongyang
 
fix bug
 | 
531 
 | 
  		self.roundSpace = self.roundSpace - 1
 
 | 
7c55db1f
 
  suhongyang
 
Buff逻辑完善,buff生效次数...
 | 
532
533
534
535
536
537 
 | 
  		self:decRound()
  		return
  	end
  	if self._afterRound then
  		self:_afterRound()
  	end
 
 | 
7c55db1f
 
  suhongyang
 
Buff逻辑完善,buff生效次数...
 | 
538 
 | 
  	if self.buffData.roundTime > 0 then
 
 | 
8d8bf91a
 
  suhongyang
 
fix bug
 | 
539 
 | 
  		self.roundSpace = self.buffData.roundTime
 
 | 
7c55db1f
 
  suhongyang
 
Buff逻辑完善,buff生效次数...
 | 
540
541
542 
 | 
  	end
  	self:decRound()
  end
 
 | 
46fac6f1
 
  zhouahaihai
 
酱料
 | 
543 
 | 
  
 
 | 
d3da3368
 
  zhouhaihai
 
冒险地图被动技, buff  神器
 | 
544 
 | 
  -- 只使用owner 和 buffData 和 releaseId
 
 | 
ccbafe67
 
  zhouhaihai
 
冒险神器和buff
 | 
545
546
547
548
549
550
551 
 | 
  function Buff:checkKeep()
  	if self.buffData.keepTerm == "" then return true end
  	--[[
  		1=怪物id;
  		2=建筑id;
  		3=事件id
  		4=队伍为特定属性时
 
 | 
a0834e49
 
  zhouhaihai
 
增加潜行 功能
 | 
552 
 | 
  		5=拥有指定buff
 
 | 
ccbafe67
 
  zhouhaihai
 
冒险神器和buff
 | 
553
554
555 
 | 
  	--]]
  
  	local checkFunc = {}
 
 | 
d3da3368
 
  zhouhaihai
 
冒险地图被动技, buff  神器
 | 
556 
 | 
  	checkFunc[1] = function(_)
 
 | 
ccbafe67
 
  zhouhaihai
 
冒险神器和buff
 | 
557
558 
 | 
  		local enemys = self.owner.battle.player:getTeam(2)
  		for _, enemy in pairs(enemys) do
 
 | 
d3da3368
 
  zhouhaihai
 
冒险地图被动技, buff  神器
 | 
559 
 | 
  			if enemy.monsterId == self.releaseId then
 
 | 
ccbafe67
 
  zhouhaihai
 
冒险神器和buff
 | 
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588 
 | 
  				return true
  			end
  		end
  		return false
  	end
  	checkFunc[2] = function(_, buildId)
  		for roomId, room in pairs(self.owner.battle.adv:getCurMap().rooms) do
  			for blockId, block in pairs(room.blocks) do
  				if block.isOpen and block:getEventType() == AdvEventType.Build and block.event.id == buildId then
  					return true
  				end
  			end
  		end
  		return false
  	end
  	checkFunc[3] = function(_, chooseId)
  		for roomId, room in pairs(self.owner.battle.adv:getCurMap().rooms) do
  			for blockId, block in pairs(room.blocks) do
  				if block.isOpen and (block:getEventType() == AdvEventType.Choose or block:getEventType() == AdvEventType.LinkChoose) and block.event.id == chooseId then
  					return true
  				end
  			end
  		end
  		return false
  	end
  	checkFunc[4] = function(_, teamAttr)
  		local role = self.owner.battle.adv.owner
  		return role:getHerosCamp(role:getProperty("advTeam").heros) == teamAttr
  	end
 
 | 
a0834e49
 
  zhouhaihai
 
增加潜行 功能
 | 
589
590 
 | 
  	checkFunc[5] = function(_, buffId)
  		local buff = self.owner:getBuffById(buffId)
 
 | 
9c8e9482
 
  zhouhaihai
 
buff  被动 限定地图
 | 
591 
 | 
  		if buff then
 
 | 
a0834e49
 
  zhouhaihai
 
增加潜行 功能
 | 
592
593
594
595 
 | 
  			return true
  		end
  		return false
  	end
 
 | 
ccbafe67
 
  zhouhaihai
 
冒险神器和buff
 | 
596
597
598
599
600
601 
 | 
  	
  	local keepTerm = self.buffData.keepTerm:toArray(true, "=")
  	if not checkFunc[keepTerm[1]] then return true end
  	return checkFunc[keepTerm[1]](table.unpack(keepTerm))
  end
  
 
 | 
7c55db1f
 
  suhongyang
 
Buff逻辑完善,buff生效次数...
 | 
602 
 | 
  function Buff:decRound()
 
 | 
4f0a5fae
 
  zhouhaihai
 
营养剂
 | 
603 
 | 
  	if self.buffData.round <= 0 then
 
 | 
7c55db1f
 
  suhongyang
 
Buff逻辑完善,buff生效次数...
 | 
604
605
606
607
608
609
610
611 
 | 
  		return
  	end
  	self.round = self.round - 1
  	if self.round <= 0 then
  		self.isDel = true
  	end
  end
  
 
 | 
596ac19f
 
  zhouhaihai
 
buff
 | 
612
613 
 | 
  function Buff:afterLayer()
  	-- 持续一层
 
 | 
7b2dc17c
 
  zhouhaihai
 
地图 层 buff passive
 | 
614 
 | 
  	if self.buffData.round == 0 or self.buffData.mapLock == 1 then
 
 | 
596ac19f
 
  zhouhaihai
 
buff
 | 
615
616
617
618 
 | 
  		self.isDel = true
  	end
  end
  
 
 | 
7c55db1f
 
  suhongyang
 
Buff逻辑完善,buff生效次数...
 | 
619
620
621 
 | 
  function Buff:canEffect(...)
  	if not self._canEffect then
  		return true
 
 | 
46fac6f1
 
  zhouahaihai
 
酱料
 | 
622 
 | 
  	end
 
 | 
7c55db1f
 
  suhongyang
 
Buff逻辑完善,buff生效次数...
 | 
623 
 | 
  	return self:_canEffect(...)
 
 | 
46fac6f1
 
  zhouahaihai
 
酱料
 | 
624
625 
 | 
  end
  
 
 | 
cf584618
 
  zhouhaihai
 
效果发给客户端
 | 
626
627
628
629
630
631
632
633
634
635 
 | 
  function Buff:pushBackEffect(etype)
  	local shows = self.buffData.show:toTableArray(true)
  	for _, one in ipairs(shows) do
  		if one[1] == etype then
  			self.owner.battle.adv:pushBackEvent(AdvBackEventType.BuffEffect, {etype = etype, id = self.id, blockId = self.owner.blockId, roomId = self.owner.roomId})
  			break
  		end
  	end
  end
  
 
 | 
7c55db1f
 
  suhongyang
 
Buff逻辑完善,buff生效次数...
 | 
636 
 | 
  function Buff:effect()
 
 | 
e6dc06cc
 
  zhouhaihai
 
拾荒bug  增加bug log
 | 
637 
 | 
  	buglog("Buff", "who: %s effect buffId: %s", self.owner.monsterId, self.id)
 
 | 
3c89adfb
 
  zhouhaihai
 
buff 减次数
 | 
638 
 | 
  	self:decCount()
 
 | 
cf584618
 
  zhouhaihai
 
效果发给客户端
 | 
639 
 | 
  	self:pushBackEffect(2)
 
 | 
46fac6f1
 
  zhouahaihai
 
酱料
 | 
640
641
642 
 | 
  	if self._effectValue then
  		return self:_effectValue()
  	end
 
 | 
46fac6f1
 
  zhouahaihai
 
酱料
 | 
643 
 | 
  end
 
 | 
9c8e9482
 
  zhouhaihai
 
buff  被动 限定地图
 | 
644
645
646
647 
 | 
  
  -- 在当前阶段不可用 小透明 < 不会回合遍历  不会查找遍历  可以删除遍历  可以下层遍历 >
  function Buff:isHide()
  	if self.isDel then
 
 | 
e0c0365a
 
  zhouhaihai
 
反的判断
 | 
648 
 | 
  		return true
 
 | 
9c8e9482
 
  zhouhaihai
 
buff  被动 限定地图
 | 
649
650 
 | 
  	end
  	if self.buffData.mapLock == 1 and self.mapId and self.owner.battle.adv:getCurMap().mapId ~= self.mapId  then
 
 | 
e0c0365a
 
  zhouhaihai
 
反的判断
 | 
651 
 | 
  		return true
 
 | 
9c8e9482
 
  zhouhaihai
 
buff  被动 限定地图
 | 
652 
 | 
  	end
 
 | 
e0c0365a
 
  zhouhaihai
 
反的判断
 | 
653 
 | 
  	return false
 
 | 
9c8e9482
 
  zhouhaihai
 
buff  被动 限定地图
 | 
654
655 
 | 
  end
  
 
 | 
46fac6f1
 
  zhouahaihai
 
酱料
 | 
656
657
658
659
660 
 | 
  --删除buff 时调用
  function Buff:endBuff()
  	if self._endBuff then
  		self:_endBuff()
  	end
 
 | 
e6dc06cc
 
  zhouhaihai
 
拾荒bug  增加bug log
 | 
661 
 | 
  	buglog("Buff", "who: %s endBuff buffId: %s", self.owner.monsterId, self.id)
 
 | 
46fac6f1
 
  zhouahaihai
 
酱料
 | 
662
663
664
665
666
667
668
669
670
671
672
673
674
675 
 | 
  end
  
  function Buff:getType()
  	return self.buffData.type
  end
  
  function Buff:decCount()
  	if self.count == -1 then return end
  	self.count = self.count - 1
  	if self.count <= 0 then
  		self.isDel = true
  	end
  end
  
 
 | 
ccbafe67
 
  zhouhaihai
 
冒险神器和buff
 | 
676
677
678
679
680
681
682
683
684
685
686
687 
 | 
  function Buff:getOverlay()
  	if self.buffData.overlay == "" then
  		return false
  	end
  	local otype, layer = table.unpack(self.buffData.overlay:toArray(true, "="))
  	if otype == 1 then -- 叠加
  		return true, layer or 0  -- 0 叠加无数层
  	end
  	return false
  end
  
  -- 叠加
 
 | 
a80fee7c
 
  zhouhaihai
 
光环
 | 
688 
 | 
  function Buff:overlay(releaser, data, layer)
 
 | 
ccbafe67
 
  zhouhaihai
 
冒险神器和buff
 | 
689
690 
 | 
  	local otype, maxLayer = self:getOverlay()
  	if self.isDel or not otype then  -- 新获得的 (不可叠加相当于新获得的)
 
 | 
ccbafe67
 
  zhouhaihai
 
冒险神器和buff
 | 
691 
 | 
  		self:endBuff()
 
 | 
a80fee7c
 
  zhouhaihai
 
光环
 | 
692 
 | 
  		self.isDel = false
 
 | 
ccbafe67
 
  zhouhaihai
 
冒险神器和buff
 | 
693 
 | 
  		self:initNew(releaser, data)
 
 | 
a80fee7c
 
  zhouhaihai
 
光环
 | 
694 
 | 
  		self:createAfter(layer)
 
 | 
ccbafe67
 
  zhouhaihai
 
冒险神器和buff
 | 
695
696
697
698
699
700
701
702
703
704
705
706 
 | 
  	else
  		-- 重置回合 次数
  		self.roundSpace = 0
  		self.round = self.buffData.round
  		if self.buffData.effectTime > 0 then
  			self.count = self.buffData.effectTime
  		else
  			self.count = -1
  		end
  		
  		self.release = releaser or self.release
  		-- 叠加层数
 
 | 
7bd7eaa5
 
  zhouhaihai
 
buff 叠加判定
 | 
707 
 | 
  		local oldLayer = self.layer
 
 | 
a80fee7c
 
  zhouhaihai
 
光环
 | 
708 
 | 
  		self.layer = self.layer + layer
 
 | 
ccbafe67
 
  zhouhaihai
 
冒险神器和buff
 | 
709
710
711 
 | 
  		if maxLayer ~= 0 then
  			self.layer = math.min(maxLayer, self.layer)
  		end
 
 | 
7bd7eaa5
 
  zhouhaihai
 
buff 叠加判定
 | 
712
713 
 | 
  
  		if oldLayer ~= self.layer and self._overlay then
 
 | 
ccbafe67
 
  zhouhaihai
 
冒险神器和buff
 | 
714
715 
 | 
  			self:_overlay()
  		end
 
 | 
cf584618
 
  zhouhaihai
 
效果发给客户端
 | 
716
717 
 | 
  
  		self:pushBackEffect(1)
 
 | 
e6dc06cc
 
  zhouhaihai
 
拾荒bug  增加bug log
 | 
718 
 | 
  		buglog("Buff", "who: %s overlay buffId: %s", self.owner.monsterId, self.id)
 
 | 
ccbafe67
 
  zhouhaihai
 
冒险神器和buff
 | 
719
720
721
722 
 | 
  	end
  end
  
  -- 扣减层数
 
 | 
a80fee7c
 
  zhouhaihai
 
光环
 | 
723
724
725
726
727
728
729 
 | 
  function Buff:uncover(layer, isAura)
  	layer = layer or 1
  	local oldLayer = self.layer
  
  	self.layer = self.layer - layer
  
  	if self.layer <= 0 then
 
 | 
ccbafe67
 
  zhouhaihai
 
冒险神器和buff
 | 
730
731
732 
 | 
  		self.isDel = true
  	end
  
 
 | 
a80fee7c
 
  zhouhaihai
 
光环
 | 
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748 
 | 
  	if isAura then
  		if layer == -1 then
  			self.layer = 0
  			self.isDel = true
  		else
  			self.layer = math.max(1, self.layer)
  			self.isDel = false
  		end
  	end
  
  	if self.isDel then return end
  
  	if oldLayer ~= self.layer then
  		if self._uncover then
  			self:_uncover()
  		end
 
 | 
ccbafe67
 
  zhouhaihai
 
冒险神器和buff
 | 
749
750
751
752
753
754
755
756
757
758
759 
 | 
  	end
  end
  
  -- buff 效果增益减益
  function Buff:effectChange()
  	if self._effectChange then
  		self:_effectChange()
  	end
  end
  
  function Buff:doEffectChange(effect)
 
 | 
d3da3368
 
  zhouhaihai
 
冒险地图被动技, buff  神器
 | 
760 
 | 
  	if self.buffData.classify == "" then return effect end
 
 | 
ccbafe67
 
  zhouhaihai
 
冒险神器和buff
 | 
761
762 
 | 
  	local change = self.owner:getBuffEffectChange(self.buffData.classify)
  	return effect * (1 + change)
 
 | 
46fac6f1
 
  zhouahaihai
 
酱料
 | 
763
764 
 | 
  end
  
 
 | 
1ffc16b9
 
  zhouhaihai
 
冒险 选择点和 建筑
 | 
765
766
767
768 
 | 
  function Buff:getLayer()
  	return self.layer
  end
  
 
 | 
46fac6f1
 
  zhouahaihai
 
酱料
 | 
769
770
771
772
773
774
775
776
777 
 | 
  function Buff:getDB()
  	local db = {}
  	if self._getDB then
  		db = self:_getDB()
  	end
  	db.id = self.id
  	if self.release and not self.release.isDead then
  		db.rele = self.release.id or 0 --释放者的id  (0 为玩家)  (不存在 则释放者不存在或者已经死亡)
  	end
 
 | 
596ac19f
 
  zhouhaihai
 
buff
 | 
778 
 | 
  	if self.buffData.round > 0 then
 
 | 
821f2b60
 
  suhongyang
 
冒险战斗完善,增加battlebe...
 | 
779 
 | 
  		db.round = self.round
 
 | 
46fac6f1
 
  zhouahaihai
 
酱料
 | 
780 
 | 
  	end
 
 | 
7c55db1f
 
  suhongyang
 
Buff逻辑完善,buff生效次数...
 | 
781 
 | 
  	db.roundSp = self.roundSpace
 
 | 
46fac6f1
 
  zhouahaihai
 
酱料
 | 
782
783
784 
 | 
  	if self.count ~= -1 then
  		db.count = self.count
  	end
 
 | 
9c8e9482
 
  zhouhaihai
 
buff  被动 限定地图
 | 
785
786
787 
 | 
  	if self.mapId then
  		db.mapId = self.mapId
  	end
 
 | 
ccbafe67
 
  zhouhaihai
 
冒险神器和buff
 | 
788 
 | 
  	db.layer = self.layer
 
 | 
d3da3368
 
  zhouhaihai
 
冒险地图被动技, buff  神器
 | 
789
790
791 
 | 
  	if self.buffData.keepTerm:toArray(true, "=")[1] == 1 then
  		db.releId = self.releaseId
  	end
 
 | 
46fac6f1
 
  zhouahaihai
 
酱料
 | 
792
793
794
795 
 | 
  	return db
  end
  
  return Buff
 
 |