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 -- 切换为战斗中的被动技
|
53e8037e
zhouhaihai
任务
|
23
|
Buff.EXP_ADD = 20 -- 增加exp(每回合)
|
4f0a5fae
zhouhaihai
营养剂
|
24
|
Buff.DONT_DEFEND = 21 -- 不看守地板 -- 怪周围点半可点击
|
0c2770e4
zhouhaihai
bug 扫雷buff
|
25
|
Buff.SHOW_DANGER = 22 -- 扫雷 展示地上怪物和陷阱数量的标记
|
4f0a5fae
zhouhaihai
营养剂
|
26
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 -- 地图被动刷新不出来怪物
|
46fac6f1
zhouahaihai
酱料
|
35
|
|
1e6f6a8a
zhouhaihai
免疫 清除buff 增加新效果
|
36
|
|
46fac6f1
zhouahaihai
酱料
|
37
38
|
--角色一些属性的变化
local function commonAttr(_Buff, attrName)
|
b71a8190
zhouhaihai
动态改变 一些buff
|
39
|
_Buff._init = function(self) --初始化变化值
|
46fac6f1
zhouahaihai
酱料
|
40
41
42
|
self.owner:reSetAttr(attrName)
end
_Buff._effectValue = function(self)
|
ccbafe67
zhouhaihai
冒险神器和buff
|
43
44
45
46
47
48
49
|
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
酱料
|
50
51
52
53
|
end
_Buff._endBuff = function(self, data)
self.owner:reSetAttr(attrName)
end
|
ccbafe67
zhouhaihai
冒险神器和buff
|
54
55
56
|
_Buff._effectChange = function(self)
self.owner:reSetAttr(attrName)
end
|
46fac6f1
zhouahaihai
酱料
|
57
|
end
|
4f0a5fae
zhouhaihai
营养剂
|
58
|
local function commonAttCond(_Buff, attrName)
|
b71a8190
zhouhaihai
动态改变 一些buff
|
59
60
|
_Buff._init = function(self) --初始化变化值
self:_reSetAttr()
|
ccbafe67
zhouhaihai
冒险神器和buff
|
61
62
|
end
_Buff._overlay = function(self)
|
b71a8190
zhouhaihai
动态改变 一些buff
|
63
|
self:_reSetAttr()
|
ccbafe67
zhouhaihai
冒险神器和buff
|
64
65
|
end
_Buff._uncover = function(self)
|
98761edc
zhouhaihai
buff 补充
|
66
67
|
self:_reSetAttr()
end
|
d3da3368
zhouhaihai
冒险地图被动技, buff 神器
|
68
|
|
b71a8190
zhouhaihai
动态改变 一些buff
|
69
|
_Buff._reSetAttr = function(self)
|
98761edc
zhouhaihai
buff 补充
|
70
|
if attrName == "hp" then
|
b71a8190
zhouhaihai
动态改变 一些buff
|
71
|
self.owner:reSetHpMax()
|
98761edc
zhouhaihai
buff 补充
|
72
73
74
|
else
self.owner:reSetAttr(attrName)
end
|
ccbafe67
zhouhaihai
冒险神器和buff
|
75
|
end
|
98761edc
zhouhaihai
buff 补充
|
76
|
|
ccbafe67
zhouhaihai
冒险神器和buff
|
77
|
_Buff._calculate = function(self)
|
4f0a5fae
zhouhaihai
营养剂
|
78
79
|
local effectCount = 0
if self.buffData.effectValue4 == 0 then
|
b71a8190
zhouhaihai
动态改变 一些buff
|
80
81
82
83
84
|
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
加一些数据保护
|
85
86
87
|
if buff then
effectCount = buff.layer
end
|
b71a8190
zhouhaihai
动态改变 一些buff
|
88
89
|
end
return self.buffData.effectValue2 * effectCount
|
4f0a5fae
zhouhaihai
营养剂
|
90
|
end
|
b71a8190
zhouhaihai
动态改变 一些buff
|
91
92
93
94
95
96
97
|
_Buff.getEffectBy = function(self)
local cond = nil
if self.buffData.effectValue4 == 2 then
cond = tonumber(self.buffData.effectValue5)
end
return self.buffData.effectValue4, attrName, cond
|
4f0a5fae
zhouhaihai
营养剂
|
98
|
end
|
b71a8190
zhouhaihai
动态改变 一些buff
|
99
|
|
4f0a5fae
zhouhaihai
营养剂
|
100
|
_Buff._effectValue = function(self)
|
b71a8190
zhouhaihai
动态改变 一些buff
|
101
|
return self.buffData.effectValue1, self:_calculate() * self.layer, attrName
|
4f0a5fae
zhouhaihai
营养剂
|
102
|
end
|
b71a8190
zhouhaihai
动态改变 一些buff
|
103
|
|
4f0a5fae
zhouhaihai
营养剂
|
104
|
_Buff._endBuff = function(self, data)
|
98761edc
zhouhaihai
buff 补充
|
105
|
self:_reSetAttr()
|
4f0a5fae
zhouhaihai
营养剂
|
106
|
end
|
4f0a5fae
zhouhaihai
营养剂
|
107
|
end
|
46fac6f1
zhouahaihai
酱料
|
108
109
110
|
local BuffFactory = {
[Buff.HP_CHANGE] = function(_Buff)
|
b71a8190
zhouhaihai
动态改变 一些buff
|
111
|
_Buff._init = function(self) --初始化变化值
|
ccbafe67
zhouhaihai
冒险神器和buff
|
112
113
114
115
116
117
118
119
120
121
|
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
酱料
|
122
|
if self.buffData.effectValue1 == 0 then --固定值
|
ccbafe67
zhouhaihai
冒险神器和buff
|
123
|
curValue = self.buffData.effectValue2
|
46fac6f1
zhouahaihai
酱料
|
124
125
126
|
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
|
127
|
curValue = baseOwner[attrs[self.buffData.effectValue3]] * self.buffData.effectValue2 / 100
|
46fac6f1
zhouahaihai
酱料
|
128
|
end
|
ccbafe67
zhouhaihai
冒险神器和buff
|
129
|
if curValue < 0 then
|
c047749a
zhouhaihai
buff
|
130
|
if self.release then
|
ccbafe67
zhouhaihai
冒险神器和buff
|
131
|
curValue = -self.release:getHurtValue(-curValue)
|
c047749a
zhouhaihai
buff
|
132
|
end
|
46fac6f1
zhouahaihai
酱料
|
133
|
end
|
ccbafe67
zhouhaihai
冒险神器和buff
|
134
|
return curValue
|
46fac6f1
zhouahaihai
酱料
|
135
136
137
138
|
end
_Buff._initDB = function(self, data)
self._changeV = data.cv
end
|
7c55db1f
suhongyang
Buff逻辑完善,buff生效次数...
|
139
140
141
142
143
|
_Buff._afterRound = function(self)
local value = self:effect()
if value > 0 then
self.owner:recover(value, self.release)
elseif value < 0 then
|
53e8037e
zhouhaihai
任务
|
144
|
self.owner:hurt(-value, self.release, {hurtType = self.buffData.effectValue5 == "1" and 6 or 2, buffId = self.id})
|
46fac6f1
zhouahaihai
酱料
|
145
146
|
end
end
|
7c55db1f
suhongyang
Buff逻辑完善,buff生效次数...
|
147
|
_Buff._effectValue = function(self)
|
ccbafe67
zhouhaihai
冒险神器和buff
|
148
|
return self:doEffectChange(self._changeV)
|
7c55db1f
suhongyang
Buff逻辑完善,buff生效次数...
|
149
|
end
|
ccbafe67
zhouhaihai
冒险神器和buff
|
150
|
|
46fac6f1
zhouahaihai
酱料
|
151
152
153
154
155
156
|
_Buff._getDB = function(self)
return {cv = self._changeV}
end
end,
[Buff.HP_MAX_CHANGE] = function(_Buff)
|
b71a8190
zhouhaihai
动态改变 一些buff
|
157
|
_Buff._init = function(self) --初始化变化值
|
ccbafe67
zhouhaihai
冒险神器和buff
|
158
|
self._changeV = self:_calculate()
|
b71a8190
zhouhaihai
动态改变 一些buff
|
159
|
self.owner:reSetHpMax()
|
ccbafe67
zhouhaihai
冒险神器和buff
|
160
161
162
|
end
_Buff._overlay = function(self)
self._changeV = (self._changeV or 0) + self:_calculate()
|
b71a8190
zhouhaihai
动态改变 一些buff
|
163
|
self.owner:reSetHpMax()
|
ccbafe67
zhouhaihai
冒险神器和buff
|
164
165
166
167
168
169
170
|
end
_Buff._uncover = function(self)
self._changeV = self._changeV - self._changeV / (self.layer + 1)
self.owner:reSetHpMax()
end
|
ccbafe67
zhouhaihai
冒险神器和buff
|
171
172
|
_Buff._calculate = function(self)
local curValue = 0
|
46fac6f1
zhouahaihai
酱料
|
173
|
if self.buffData.effectValue1 == 0 then --固定值
|
ccbafe67
zhouhaihai
冒险神器和buff
|
174
|
curValue = self.buffData.effectValue2
|
46fac6f1
zhouahaihai
酱料
|
175
176
177
|
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
|
178
|
curValue = baseOwner[attrs[self.buffData.effectValue3]] * self.buffData.effectValue2 / 100
|
46fac6f1
zhouahaihai
酱料
|
179
|
end
|
ccbafe67
zhouhaihai
冒险神器和buff
|
180
181
182
183
184
185
186
187
188
|
return curValue
end
_Buff._effectValue = function(self)
return self:doEffectChange(self._changeV)
end
_Buff._endBuff = function(self)
self.owner:reSetHpMax()
|
46fac6f1
zhouahaihai
酱料
|
189
|
end
|
ccbafe67
zhouhaihai
冒险神器和buff
|
190
191
192
193
194
|
_Buff._effectChange = function(self)
self.owner:reSetHpMax()
end
|
46fac6f1
zhouahaihai
酱料
|
195
196
197
|
_Buff._initDB = function(self, data)
self._changeV = data.cv
end
|
ccbafe67
zhouhaihai
冒险神器和buff
|
198
|
|
46fac6f1
zhouahaihai
酱料
|
199
200
201
202
|
_Buff._getDB = function(self)
return {cv = self._changeV}
end
end,
|
0d405dc3
suhongyang
Buff生命周期调整,被动加buf...
|
203
|
[Buff.ATTR_CHANGE] = function(_Buff)
|
d78bc768
suhongyang
Fix bug
|
204
|
local attrName = AttsEnumEx[_Buff.buffData.effectValue3]
|
0d405dc3
suhongyang
Buff生命周期调整,被动加buf...
|
205
|
commonAttr(_Buff, attrName)
|
46fac6f1
zhouahaihai
酱料
|
206
|
end,
|
4f0a5fae
zhouhaihai
营养剂
|
207
|
|
ccbafe67
zhouhaihai
冒险神器和buff
|
208
|
[Buff.ATTR_CHANGE_COND] = function(_Buff)
|
4f0a5fae
zhouhaihai
营养剂
|
209
210
211
212
213
|
local attrName = AttsEnumEx[_Buff.buffData.effectValue3]
commonAttCond(_Buff, attrName)
end,
|
db3c56ad
zhouhaihai
冒险相关
|
214
215
|
[Buff.CHANGE_DROP_TO_CLICK] = function(_Buff)
_Buff._effectValue = function(self)
|
ccbafe67
zhouhaihai
冒险神器和buff
|
216
|
-- id
|
db3c56ad
zhouhaihai
冒险相关
|
217
218
219
220
|
return self.buffData.effectValue1
end
end,
|
46fac6f1
zhouahaihai
酱料
|
221
|
[Buff.IMMNUE_BUFF] = function(_Buff)
|
1e6f6a8a
zhouhaihai
免疫 清除buff 增加新效果
|
222
223
224
225
226
227
228
229
230
231
232
233
|
_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生效次数...
|
234
|
end
|
1e6f6a8a
zhouhaihai
免疫 清除buff 增加新效果
|
235
|
return dispel
|
46fac6f1
zhouahaihai
酱料
|
236
237
238
239
|
end
end,
[Buff.CLEAR_BUFF] = function(_Buff)
|
b71a8190
zhouhaihai
动态改变 一些buff
|
240
|
_Buff._init = function(self)
|
1ffc16b9
zhouhaihai
冒险 选择点和 建筑
|
241
|
for _, buff in ipairs(self.owner.buffs) do -- 挂上就清除一下子
|
ccbafe67
zhouhaihai
冒险神器和buff
|
242
|
if not buff.isDel and self:canEffect(buff.id) and not self.isDel then
|
43716efb
zhouhaihai
buff 清除层数
|
243
|
while not buff.isDel and not self.isDel do
|
ccbafe67
zhouhaihai
冒险神器和buff
|
244
245
246
|
self:effect()
buff:uncover()
end
|
46fac6f1
zhouahaihai
酱料
|
247
|
end
|
7e45c419
suhongyang
现有buff补全战斗内生效逻辑
|
248
|
end
|
46fac6f1
zhouahaihai
酱料
|
249
|
end
|
ccbafe67
zhouhaihai
冒险神器和buff
|
250
251
|
_Buff._canEffect = function(self, buffId)
local buffData = csvdb["adv_map_buffCsv"][buffId]
|
1e6f6a8a
zhouhaihai
免疫 清除buff 增加新效果
|
252
253
254
255
256
257
258
259
260
261
|
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生效次数...
|
262
|
end
|
1e6f6a8a
zhouhaihai
免疫 清除buff 增加新效果
|
263
264
|
return dispel
|
46fac6f1
zhouahaihai
酱料
|
265
266
267
268
|
end
end,
[Buff.OPEN_BLOCK] = function(_Buff)
|
7c55db1f
suhongyang
Buff逻辑完善,buff生效次数...
|
269
270
|
_Buff._afterRound = function(self)
local roomNum = self:effect()
|
d3da3368
zhouhaihai
冒险地图被动技, buff 神器
|
271
|
self.owner.battle.adv:getCurMap():openBlockRand(roomNum, not self.owner.monsterId)
|
7c55db1f
suhongyang
Buff逻辑完善,buff生效次数...
|
272
|
end
|
7c55db1f
suhongyang
Buff逻辑完善,buff生效次数...
|
273
|
_Buff._effectValue = function(self)
|
ccbafe67
zhouhaihai
冒险神器和buff
|
274
275
|
-- 数量
return self.buffData.effectValue1 * self.layer
|
46fac6f1
zhouahaihai
酱料
|
276
277
278
|
end
end,
|
3b0526d2
zhouhaihai
冒险demo
|
279
|
[Buff.SP_CHANGE] = function(_Buff)
|
7c55db1f
suhongyang
Buff逻辑完善,buff生效次数...
|
280
|
_Buff._afterRound = function(self)
|
ccbafe67
zhouhaihai
冒险神器和buff
|
281
|
local cType, value = self:effect()
|
3b0526d2
zhouhaihai
冒险demo
|
282
|
self.owner:changeSp(value, cType)
|
7c55db1f
suhongyang
Buff逻辑完善,buff生效次数...
|
283
284
|
end
_Buff._effectValue = function(self)
|
ccbafe67
zhouhaihai
冒险神器和buff
|
285
286
|
-- 值/% 数量
return self.buffData.effectValue1, self:doEffectChange(self.buffData.effectValue2) * self.layer
|
46fac6f1
zhouahaihai
酱料
|
287
|
end
|
6cd12079
suhongyang
扣血buff立刻生效
|
288
|
end,
|
53e8037e
zhouhaihai
任务
|
289
|
|
ccbafe67
zhouhaihai
冒险神器和buff
|
290
|
[Buff.EXP_ADD] = function(_Buff)
|
6cd12079
suhongyang
扣血buff立刻生效
|
291
292
|
_Buff._afterRound = function(self)
local value = self:effect()
|
ccbafe67
zhouhaihai
冒险神器和buff
|
293
|
self.owner.battle.player:addExp(value)
|
6cd12079
suhongyang
扣血buff立刻生效
|
294
|
end
|
6cd12079
suhongyang
扣血buff立刻生效
|
295
|
_Buff._effectValue = function(self)
|
ccbafe67
zhouhaihai
冒险神器和buff
|
296
297
|
-- 经验值
return self.buffData.effectValue1 * self.layer
|
6cd12079
suhongyang
扣血buff立刻生效
|
298
299
|
end
end,
|
53e8037e
zhouhaihai
任务
|
300
|
|
ccbafe67
zhouhaihai
冒险神器和buff
|
301
|
[Buff.DISABLE_BUFF] = function(_Buff)
|
53e8037e
zhouhaihai
任务
|
302
303
304
305
|
_Buff._effectValue = function(self)
return self.buffData.effectValue1
end
end,
|
4f0a5fae
zhouhaihai
营养剂
|
306
|
|
ccbafe67
zhouhaihai
冒险神器和buff
|
307
|
[Buff.SP_MAX_CHANGE] = function(_Buff)
|
b71a8190
zhouhaihai
动态改变 一些buff
|
308
|
_Buff._init = function(self) --初始化变化值
|
1bab9165
zhouhaihai
buff xiugai
|
309
|
self.owner:reSetSpMax()
|
ccbafe67
zhouhaihai
冒险神器和buff
|
310
311
|
end
_Buff._overlay = function(self)
|
ccbafe67
zhouhaihai
冒险神器和buff
|
312
313
314
|
self.owner:reSetSpMax()
end
|
1bab9165
zhouhaihai
buff xiugai
|
315
|
_Buff._uncover = function(self)
|
ccbafe67
zhouhaihai
冒险神器和buff
|
316
|
self.owner:reSetSpMax()
|
ccbafe67
zhouhaihai
冒险神器和buff
|
317
318
319
320
321
322
323
324
325
|
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 补充
|
326
|
end,
|
ccbafe67
zhouhaihai
冒险神器和buff
|
327
328
|
[Buff.ITEM_GET_UP] = function(_Buff)
|
4f0a5fae
zhouhaihai
营养剂
|
329
|
_Buff._effectValue = function(self)
|
ccbafe67
zhouhaihai
冒险神器和buff
|
330
331
|
-- 值/% 数量 id
return self.buffData.effectValue1, self.buffData.effectValue2 * self.layer, self.buffData.effectValue3
|
4f0a5fae
zhouhaihai
营养剂
|
332
333
|
end
end,
|
ccbafe67
zhouhaihai
冒险神器和buff
|
334
335
336
337
338
339
|
-- 影响到的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 增加新效果
|
340
|
if not buff.isDel and buff.buffData.classify:sismember(self.buffData.effectValue1, " ") then
|
ccbafe67
zhouhaihai
冒险神器和buff
|
341
342
343
344
|
buff:effectChange()
end
end
end
|
4f0a5fae
zhouhaihai
营养剂
|
345
|
_Buff._effectValue = function(self)
|
ccbafe67
zhouhaihai
冒险神器和buff
|
346
347
348
349
350
351
352
|
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
营养剂
|
353
354
|
end
end,
|
810c6151
zhouhaihai
增加buff 效果31 地图被动刷...
|
355
356
357
358
359
360
361
|
[Buff.Buff_NO_PASSIVE_MONSTER] = function(_Buff)
_Buff._effectValue = function(self)
return self.buffData.effectValue1
end
end,
|
46fac6f1
zhouahaihai
酱料
|
362
363
|
}
|
ccbafe67
zhouhaihai
冒险神器和buff
|
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
|
-- 同样的返回 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生效次数...
|
381
382
383
|
function Buff:ctor(owner, id)
self.owner = owner
self.id = id
|
3b0526d2
zhouhaihai
冒险demo
|
384
|
self.buffData = csvdb["adv_map_buffCsv"][self.id]
|
7c55db1f
suhongyang
Buff逻辑完善,buff生效次数...
|
385
|
self.isDel = false
|
7c55db1f
suhongyang
Buff逻辑完善,buff生效次数...
|
386
|
self.roundSpace = 0 --生效间隔
|
7c55db1f
suhongyang
Buff逻辑完善,buff生效次数...
|
387
|
self.round = 0 --剩余的回合
|
7c55db1f
suhongyang
Buff逻辑完善,buff生效次数...
|
388
|
self.count = -1 -- 可生效的次数 -1 无次数限制
|
ccbafe67
zhouhaihai
冒险神器和buff
|
389
|
self.layer = 1 -- 当前buff 层数
|
d3da3368
zhouhaihai
冒险地图被动技, buff 神器
|
390
|
self.releaseId = nil -- 释放的怪物Id
|
7c55db1f
suhongyang
Buff逻辑完善,buff生效次数...
|
391
392
393
394
395
|
if BuffFactory[self.buffData.type] then
BuffFactory[self.buffData.type](self)
end
end
|
46fac6f1
zhouahaihai
酱料
|
396
397
398
399
400
401
402
403
404
405
406
407
408
|
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生效次数...
|
409
|
function Buff:initNew(release, data)
|
6d238bc6
suhongyang
Fix bug
|
410
|
self.release = release or self.owner
|
d3da3368
zhouhaihai
冒险地图被动技, buff 神器
|
411
|
self.releaseId = self.release.monsterId or 0
|
7c55db1f
suhongyang
Buff逻辑完善,buff生效次数...
|
412
|
self.round = self.buffData.round
|
ccbafe67
zhouhaihai
冒险神器和buff
|
413
414
|
self.roundSpace = 0 --生效间隔
self.layer = 1
|
7c55db1f
suhongyang
Buff逻辑完善,buff生效次数...
|
415
416
417
|
if self.buffData.effectTime > 0 then
self.count = self.buffData.effectTime
end
|
b71a8190
zhouhaihai
动态改变 一些buff
|
418
419
420
|
end
function Buff:createAfter()
|
7c55db1f
suhongyang
Buff逻辑完善,buff生效次数...
|
421
|
if self._init then
|
b71a8190
zhouhaihai
动态改变 一些buff
|
422
|
self:_init()
|
46fac6f1
zhouahaihai
酱料
|
423
424
425
426
427
428
429
430
431
432
433
|
end
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 神器
|
434
|
self.releaseId = data.releId
|
821f2b60
suhongyang
冒险战斗完善,增加battlebe...
|
435
|
self.round = data.round
|
ccbafe67
zhouhaihai
冒险神器和buff
|
436
|
self.roundSpace = data.roundSp
|
46fac6f1
zhouahaihai
酱料
|
437
438
439
|
if data.count then
self.count = data.count
end
|
ccbafe67
zhouhaihai
冒险神器和buff
|
440
|
self.layer = data.layer or 1
|
46fac6f1
zhouahaihai
酱料
|
441
442
443
444
445
|
if self._initDB then
self:_initDB(data)
end
end
|
7c55db1f
suhongyang
Buff逻辑完善,buff生效次数...
|
446
|
|
46fac6f1
zhouahaihai
酱料
|
447
|
function Buff:afterRound()
|
b176d7d3
zhouhaihai
冒险成就
|
448
|
if self.isDel or self.owner.isDead then return end
|
ccbafe67
zhouhaihai
冒险神器和buff
|
449
450
451
452
453
454
455
|
-- keepTerm 检查
if not self:checkKeep() then
self.isDel = true
return
end
|
7c55db1f
suhongyang
Buff逻辑完善,buff生效次数...
|
456
|
if self.roundSpace > 0 then
|
8d8bf91a
suhongyang
fix bug
|
457
|
self.roundSpace = self.roundSpace - 1
|
7c55db1f
suhongyang
Buff逻辑完善,buff生效次数...
|
458
459
460
461
462
463
|
self:decRound()
return
end
if self._afterRound then
self:_afterRound()
end
|
7c55db1f
suhongyang
Buff逻辑完善,buff生效次数...
|
464
|
if self.buffData.roundTime > 0 then
|
8d8bf91a
suhongyang
fix bug
|
465
|
self.roundSpace = self.buffData.roundTime
|
7c55db1f
suhongyang
Buff逻辑完善,buff生效次数...
|
466
467
468
|
end
self:decRound()
end
|
46fac6f1
zhouahaihai
酱料
|
469
|
|
d3da3368
zhouhaihai
冒险地图被动技, buff 神器
|
470
|
-- 只使用owner 和 buffData 和 releaseId
|
ccbafe67
zhouhaihai
冒险神器和buff
|
471
472
473
474
475
476
477
478
479
480
|
function Buff:checkKeep()
if self.buffData.keepTerm == "" then return true end
--[[
1=怪物id;
2=建筑id;
3=事件id
4=队伍为特定属性时
--]]
local checkFunc = {}
|
d3da3368
zhouhaihai
冒险地图被动技, buff 神器
|
481
|
checkFunc[1] = function(_)
|
ccbafe67
zhouhaihai
冒险神器和buff
|
482
483
|
local enemys = self.owner.battle.player:getTeam(2)
for _, enemy in pairs(enemys) do
|
d3da3368
zhouhaihai
冒险地图被动技, buff 神器
|
484
|
if enemy.monsterId == self.releaseId then
|
ccbafe67
zhouhaihai
冒险神器和buff
|
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
|
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
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生效次数...
|
520
|
function Buff:decRound()
|
4f0a5fae
zhouhaihai
营养剂
|
521
|
if self.buffData.round <= 0 then
|
7c55db1f
suhongyang
Buff逻辑完善,buff生效次数...
|
522
523
524
525
526
527
528
529
|
return
end
self.round = self.round - 1
if self.round <= 0 then
self.isDel = true
end
end
|
596ac19f
zhouhaihai
buff
|
530
531
532
533
534
535
536
|
function Buff:afterLayer()
-- 持续一层
if self.buffData.round == 0 then
self.isDel = true
end
end
|
7c55db1f
suhongyang
Buff逻辑完善,buff生效次数...
|
537
538
539
|
function Buff:canEffect(...)
if not self._canEffect then
return true
|
46fac6f1
zhouahaihai
酱料
|
540
|
end
|
7c55db1f
suhongyang
Buff逻辑完善,buff生效次数...
|
541
|
return self:_canEffect(...)
|
46fac6f1
zhouahaihai
酱料
|
542
543
|
end
|
7c55db1f
suhongyang
Buff逻辑完善,buff生效次数...
|
544
|
function Buff:effect()
|
3c89adfb
zhouhaihai
buff 减次数
|
545
|
self:decCount()
|
46fac6f1
zhouahaihai
酱料
|
546
547
548
|
if self._effectValue then
return self:_effectValue()
end
|
46fac6f1
zhouahaihai
酱料
|
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
|
end
--删除buff 时调用
function Buff:endBuff()
if self._endBuff then
self:_endBuff()
end
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
|
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
|
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
-- 叠加
function Buff:overlay(releaser, data)
local otype, maxLayer = self:getOverlay()
if self.isDel or not otype then -- 新获得的 (不可叠加相当于新获得的)
self.isDel = false
self:endBuff()
self:initNew(releaser, data)
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
-- 叠加层数
self.layer = self.layer + 1
if maxLayer ~= 0 then
self.layer = math.min(maxLayer, self.layer)
end
if self._overlay then
self:_overlay()
end
end
end
-- 扣减层数
function Buff:uncover()
if self.layer <= 1 then
self.isDel = true
end
self.layer = self.layer - 1
if self._uncover then
self:_uncover()
end
end
-- buff 效果增益减益
function Buff:effectChange()
if self._effectChange then
self:_effectChange()
end
end
function Buff:doEffectChange(effect)
|
d3da3368
zhouhaihai
冒险地图被动技, buff 神器
|
629
|
if self.buffData.classify == "" then return effect end
|
ccbafe67
zhouhaihai
冒险神器和buff
|
630
631
|
local change = self.owner:getBuffEffectChange(self.buffData.classify)
return effect * (1 + change)
|
46fac6f1
zhouahaihai
酱料
|
632
633
|
end
|
1ffc16b9
zhouhaihai
冒险 选择点和 建筑
|
634
635
636
637
|
function Buff:getLayer()
return self.layer
end
|
46fac6f1
zhouahaihai
酱料
|
638
639
640
641
642
643
644
645
646
|
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
|
647
|
if self.buffData.round > 0 then
|
821f2b60
suhongyang
冒险战斗完善,增加battlebe...
|
648
|
db.round = self.round
|
46fac6f1
zhouahaihai
酱料
|
649
|
end
|
7c55db1f
suhongyang
Buff逻辑完善,buff生效次数...
|
650
|
db.roundSp = self.roundSpace
|
46fac6f1
zhouahaihai
酱料
|
651
652
653
|
if self.count ~= -1 then
db.count = self.count
end
|
ccbafe67
zhouhaihai
冒险神器和buff
|
654
|
db.layer = self.layer
|
d3da3368
zhouhaihai
冒险地图被动技, buff 神器
|
655
656
657
|
if self.buffData.keepTerm:toArray(true, "=")[1] == 1 then
db.releId = self.releaseId
end
|
46fac6f1
zhouahaihai
酱料
|
658
659
660
661
|
return db
end
return Buff
|